@websolutespa/bom-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-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/esm/index.js CHANGED
@@ -19896,7 +19896,8 @@ const createLlmViewStore = _ref => {
19896
19896
  embedded,
19897
19897
  portal,
19898
19898
  send,
19899
- setEmbed
19899
+ setEmbed,
19900
+ setCurrentContext
19900
19901
  } = _ref;
19901
19902
  const props = {
19902
19903
  opened: opened != null ? opened : embedded != null || threadId != null ? true : false,
@@ -20065,6 +20066,10 @@ const createLlmViewStore = _ref => {
20065
20066
  const opened = !state.opened;
20066
20067
  if (opened) {
20067
20068
  state.openingContext = openingContext;
20069
+ setCurrentContext(openingContext ? {
20070
+ context: openingContext,
20071
+ title: 'opening-context'
20072
+ } : undefined);
20068
20073
  }
20069
20074
  pushDataLayer({
20070
20075
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close',
@@ -20088,6 +20093,10 @@ const createLlmViewStore = _ref => {
20088
20093
  set(state => {
20089
20094
  if (opened) {
20090
20095
  state.openingContext = openingContext;
20096
+ setCurrentContext(openingContext ? {
20097
+ context: openingContext,
20098
+ title: 'opening-context'
20099
+ } : undefined);
20091
20100
  }
20092
20101
  pushDataLayer({
20093
20102
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close',
@@ -20158,14 +20167,16 @@ function LlmViewProvider(_ref2) {
20158
20167
  } = _ref2;
20159
20168
  const {
20160
20169
  send,
20161
- setEmbed
20170
+ setEmbed,
20171
+ setCurrentContext
20162
20172
  } = useLlm(state => state.actions);
20163
20173
  const storeRef = reactExports.useRef();
20164
20174
  if (!storeRef.current) {
20165
20175
  storeRef.current = createLlmViewStore({
20166
20176
  ...props,
20167
20177
  send,
20168
- setEmbed
20178
+ setEmbed,
20179
+ setCurrentContext
20169
20180
  });
20170
20181
  }
20171
20182
  return storeRef.current && /*#__PURE__*/jsxRuntimeExports.jsx(LlmViewContext.Provider, {
@@ -45681,7 +45692,7 @@ const createLlmStore = config => {
45681
45692
  currentContext,
45682
45693
  systemContext: {
45683
45694
  ...systemContext,
45684
- ...currentContext.context
45695
+ ...currentContext?.context
45685
45696
  }
45686
45697
  }));
45687
45698
  },