@constructor-io/constructorio-ui-asa 1.1.0 → 1.1.1

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.
@@ -32,6 +32,8 @@ function useAsaResults() {
32
32
  trackingRef.current = tracking;
33
33
  const callbacksRef = (0, react_1.useRef)(callbacks);
34
34
  callbacksRef.current = callbacks;
35
+ const staticRequestConfigsRef = (0, react_1.useRef)(staticRequestConfigs);
36
+ staticRequestConfigsRef.current = staticRequestConfigs;
35
37
  const nextMessageId = (0, react_1.useCallback)(() => {
36
38
  idCounterRef.current += 1;
37
39
  return `msg-${idCounterRef.current}-${Date.now()}`;
@@ -61,7 +63,14 @@ function useAsaResults() {
61
63
  setIsStreaming(true);
62
64
  isStreamingRef.current = true;
63
65
  killSwitchRef.current = false;
64
- const stream = cioClient.agent.getAgentResultsStream(intent, Object.assign({ domain }, (threadIdRef.current && { threadId: threadIdRef.current })));
66
+ // `intent` is passed as the first argument and `threadId` is managed per-stream
67
+ // below, so both are stripped here. Everything else configured on the provider
68
+ // (filters, guard, numResultsPerEvent, numResultEvents, qsParam,
69
+ // preFilterExpression, fmtOptions, ...) is forwarded to the agent as-is.
70
+ const agentParams = Object.assign({}, staticRequestConfigsRef.current);
71
+ delete agentParams.intent;
72
+ delete agentParams.threadId;
73
+ const stream = cioClient.agent.getAgentResultsStream(intent, Object.assign(Object.assign(Object.assign({}, agentParams), { domain }), (threadIdRef.current && { threadId: threadIdRef.current })));
65
74
  const reader = stream.getReader();
66
75
  readerRef.current = reader;
67
76
  // Mutable per-stream state kept on an object so the closures below don't capture
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.1.0';
3
+ exports.default = '1.1.1';
@@ -28,6 +28,8 @@ export default function useAsaResults() {
28
28
  trackingRef.current = tracking;
29
29
  const callbacksRef = useRef(callbacks);
30
30
  callbacksRef.current = callbacks;
31
+ const staticRequestConfigsRef = useRef(staticRequestConfigs);
32
+ staticRequestConfigsRef.current = staticRequestConfigs;
31
33
  const nextMessageId = useCallback(() => {
32
34
  idCounterRef.current += 1;
33
35
  return `msg-${idCounterRef.current}-${Date.now()}`;
@@ -56,7 +58,15 @@ export default function useAsaResults() {
56
58
  setIsStreaming(true);
57
59
  isStreamingRef.current = true;
58
60
  killSwitchRef.current = false;
61
+ // `intent` is passed as the first argument and `threadId` is managed per-stream
62
+ // below, so both are stripped here. Everything else configured on the provider
63
+ // (filters, guard, numResultsPerEvent, numResultEvents, qsParam,
64
+ // preFilterExpression, fmtOptions, ...) is forwarded to the agent as-is.
65
+ const agentParams = { ...staticRequestConfigsRef.current };
66
+ delete agentParams.intent;
67
+ delete agentParams.threadId;
59
68
  const stream = cioClient.agent.getAgentResultsStream(intent, {
69
+ ...agentParams,
60
70
  domain,
61
71
  ...(threadIdRef.current && { threadId: threadIdRef.current }),
62
72
  });
@@ -1 +1 @@
1
- export default '1.1.0';
1
+ export default '1.1.1';
@@ -1,2 +1,2 @@
1
- declare const _default: "1.1.0";
1
+ declare const _default: "1.1.1";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-ui-asa",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Constructor.io AI Shopping Agent UI library for web applications",
5
5
  "author": "constructor.io",
6
6
  "license": "MIT",