@websolutespa/bom-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/dist/umd/index.js CHANGED
@@ -19901,8 +19901,10 @@
19901
19901
  opened,
19902
19902
  embedded,
19903
19903
  portal,
19904
+ clear,
19904
19905
  send,
19905
- setEmbed
19906
+ setEmbed,
19907
+ setCurrentContext
19906
19908
  } = _ref;
19907
19909
  const props = {
19908
19910
  opened: opened != null ? opened : embedded != null || threadId != null ? true : false,
@@ -20071,6 +20073,15 @@
20071
20073
  const opened = !state.opened;
20072
20074
  if (opened) {
20073
20075
  state.openingContext = openingContext;
20076
+ if (openingContext) {
20077
+ clear();
20078
+ setCurrentContext({
20079
+ context: openingContext,
20080
+ title: 'opening-context'
20081
+ });
20082
+ } else {
20083
+ setCurrentContext();
20084
+ }
20074
20085
  }
20075
20086
  pushDataLayer({
20076
20087
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close',
@@ -20094,6 +20105,15 @@
20094
20105
  set(state => {
20095
20106
  if (opened) {
20096
20107
  state.openingContext = openingContext;
20108
+ if (openingContext) {
20109
+ clear();
20110
+ setCurrentContext({
20111
+ context: openingContext,
20112
+ title: 'opening-context'
20113
+ });
20114
+ } else {
20115
+ setCurrentContext();
20116
+ }
20097
20117
  }
20098
20118
  pushDataLayer({
20099
20119
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close',
@@ -20163,15 +20183,19 @@
20163
20183
  ...props
20164
20184
  } = _ref2;
20165
20185
  const {
20186
+ clear,
20166
20187
  send,
20167
- setEmbed
20188
+ setEmbed,
20189
+ setCurrentContext
20168
20190
  } = useLlm(state => state.actions);
20169
20191
  const storeRef = reactExports.useRef();
20170
20192
  if (!storeRef.current) {
20171
20193
  storeRef.current = createLlmViewStore({
20172
20194
  ...props,
20195
+ clear,
20173
20196
  send,
20174
- setEmbed
20197
+ setEmbed,
20198
+ setCurrentContext
20175
20199
  });
20176
20200
  }
20177
20201
  return storeRef.current && /*#__PURE__*/jsxRuntimeExports.jsx(LlmViewContext.Provider, {
@@ -45687,7 +45711,7 @@ ${Object.entries(vars).map(_ref2 => {
45687
45711
  currentContext,
45688
45712
  systemContext: {
45689
45713
  ...systemContext,
45690
- ...currentContext.context
45714
+ ...currentContext?.context
45691
45715
  }
45692
45716
  }));
45693
45717
  },