@websolutespa/bom-mixer-llm 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @websolutespa/bom-mixer-llm
2
2
 
3
+ ## 2.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: useLlmView clear with openingContext
8
+
9
+ ## 2.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Added: setCurrentContext with openingContext
14
+
3
15
  ## 2.0.2
4
16
 
5
17
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -222,8 +222,10 @@ const createLlmViewStore = _ref => {
222
222
  opened,
223
223
  embedded,
224
224
  portal,
225
+ clear,
225
226
  send,
226
- setEmbed
227
+ setEmbed,
228
+ setCurrentContext
227
229
  } = _ref;
228
230
  const props = {
229
231
  opened: opened != null ? opened : embedded != null || threadId != null ? true : false,
@@ -390,6 +392,15 @@ const createLlmViewStore = _ref => {
390
392
  const opened = !state.opened;
391
393
  if (opened) {
392
394
  state.openingContext = openingContext;
395
+ if (openingContext) {
396
+ clear();
397
+ setCurrentContext({
398
+ context: openingContext,
399
+ title: 'opening-context'
400
+ });
401
+ } else {
402
+ setCurrentContext();
403
+ }
393
404
  }
394
405
  pushDataLayer(Object.assign({
395
406
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close'
@@ -412,6 +423,15 @@ const createLlmViewStore = _ref => {
412
423
  set(state => {
413
424
  if (opened) {
414
425
  state.openingContext = openingContext;
426
+ if (openingContext) {
427
+ clear();
428
+ setCurrentContext({
429
+ context: openingContext,
430
+ title: 'opening-context'
431
+ });
432
+ } else {
433
+ setCurrentContext();
434
+ }
415
435
  }
416
436
  pushDataLayer(Object.assign({
417
437
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close'
@@ -480,14 +500,18 @@ function LlmViewProvider(_a) {
480
500
  } = _a,
481
501
  props = __rest(_a, ["children"]);
482
502
  const {
503
+ clear,
483
504
  send,
484
- setEmbed
505
+ setEmbed,
506
+ setCurrentContext
485
507
  } = useLlm(state => state.actions);
486
508
  const storeRef = React.useRef();
487
509
  if (!storeRef.current) {
488
510
  storeRef.current = createLlmViewStore(Object.assign(Object.assign({}, props), {
511
+ clear,
489
512
  send,
490
- setEmbed
513
+ setEmbed,
514
+ setCurrentContext
491
515
  }));
492
516
  }
493
517
  return storeRef.current && jsxRuntime.jsx(LlmViewContext.Provider, {
@@ -8607,7 +8631,7 @@ const createLlmStore = config => {
8607
8631
  } = get();
8608
8632
  set(state => ({
8609
8633
  currentContext,
8610
- systemContext: Object.assign(Object.assign({}, systemContext), currentContext.context)
8634
+ systemContext: Object.assign(Object.assign({}, systemContext), currentContext === null || currentContext === void 0 ? void 0 : currentContext.context)
8611
8635
  }));
8612
8636
  },
8613
8637
  setVars: vars => set(state => ({