@websolutespa/bom-mixer-llm 2.0.2 → 2.0.3

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,11 @@
1
1
  # @websolutespa/bom-mixer-llm
2
2
 
3
+ ## 2.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: setCurrentContext with openingContext
8
+
3
9
  ## 2.0.2
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -223,7 +223,8 @@ const createLlmViewStore = _ref => {
223
223
  embedded,
224
224
  portal,
225
225
  send,
226
- setEmbed
226
+ setEmbed,
227
+ setCurrentContext
227
228
  } = _ref;
228
229
  const props = {
229
230
  opened: opened != null ? opened : embedded != null || threadId != null ? true : false,
@@ -390,6 +391,10 @@ const createLlmViewStore = _ref => {
390
391
  const opened = !state.opened;
391
392
  if (opened) {
392
393
  state.openingContext = openingContext;
394
+ setCurrentContext(openingContext ? {
395
+ context: openingContext,
396
+ title: 'opening-context'
397
+ } : undefined);
393
398
  }
394
399
  pushDataLayer(Object.assign({
395
400
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close'
@@ -412,6 +417,10 @@ const createLlmViewStore = _ref => {
412
417
  set(state => {
413
418
  if (opened) {
414
419
  state.openingContext = openingContext;
420
+ setCurrentContext(openingContext ? {
421
+ context: openingContext,
422
+ title: 'opening-context'
423
+ } : undefined);
415
424
  }
416
425
  pushDataLayer(Object.assign({
417
426
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close'
@@ -481,13 +490,15 @@ function LlmViewProvider(_a) {
481
490
  props = __rest(_a, ["children"]);
482
491
  const {
483
492
  send,
484
- setEmbed
493
+ setEmbed,
494
+ setCurrentContext
485
495
  } = useLlm(state => state.actions);
486
496
  const storeRef = React.useRef();
487
497
  if (!storeRef.current) {
488
498
  storeRef.current = createLlmViewStore(Object.assign(Object.assign({}, props), {
489
499
  send,
490
- setEmbed
500
+ setEmbed,
501
+ setCurrentContext
491
502
  }));
492
503
  }
493
504
  return storeRef.current && jsxRuntime.jsx(LlmViewContext.Provider, {
@@ -8607,7 +8618,7 @@ const createLlmStore = config => {
8607
8618
  } = get();
8608
8619
  set(state => ({
8609
8620
  currentContext,
8610
- systemContext: Object.assign(Object.assign({}, systemContext), currentContext.context)
8621
+ systemContext: Object.assign(Object.assign({}, systemContext), currentContext === null || currentContext === void 0 ? void 0 : currentContext.context)
8611
8622
  }));
8612
8623
  },
8613
8624
  setVars: vars => set(state => ({