@gengage/assistant-fe 0.6.16 → 0.6.18

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.
Files changed (56) hide show
  1. package/dist/{request-text-DThlE-Xd.js → account-config-gj7_mF6Q.js} +725 -312
  2. package/dist/agentic/events/comparison.d.ts +6 -0
  3. package/dist/agentic/events/context-products.d.ts +6 -0
  4. package/dist/agentic/index.d.ts +8 -0
  5. package/dist/agentic/index.js +251 -168
  6. package/dist/agentic/recipes/catalog-assistant-flow.d.ts +50 -0
  7. package/dist/agentic/recipes/input-text/actions.d.ts +15 -0
  8. package/dist/agentic/recipes/input-text/index.d.ts +4 -0
  9. package/dist/agentic/recipes/input-text/products.d.ts +4 -0
  10. package/dist/agentic/recipes/input-text/ranking.d.ts +14 -0
  11. package/dist/agentic/recipes/input-text/steps.d.ts +31 -0
  12. package/dist/agentic/util/account-config.d.ts +8 -0
  13. package/dist/agentic/util/privacy.d.ts +12 -0
  14. package/dist/agentic/widgets/endpoints.d.ts +12 -0
  15. package/dist/agentic/worker.d.ts +8 -0
  16. package/dist/agentic/worker.js +415 -106
  17. package/dist/agentic.iife.js +7 -5
  18. package/dist/{api-paths-C7Y4wTde.js → api-paths-CEDR4rld.js} +1 -1
  19. package/dist/chat/components/InlineLauncher.d.ts +15 -0
  20. package/dist/chat/index.d.ts +1 -1
  21. package/dist/chat-runtime.js +1 -1
  22. package/dist/{chat-BP-yXukW.js → chat-rvSffJXw.js} +1 -1
  23. package/dist/chat.iife.js +15 -12
  24. package/dist/chat.js +2 -2
  25. package/dist/{common-BR9JIIjb.js → common-BBgWfT-W.js} +3 -3
  26. package/dist/common.js +8 -8
  27. package/dist/{connection-warning-DyeP1AB2.js → connection-warning-B-doodzu.js} +1 -1
  28. package/dist/{fastIntent-C8jh7D1D.js → fastIntent-CloHPZQh.js} +2 -2
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +13 -13
  31. package/dist/{native-webview-U9HtGabb.js → native-webview-NWc9LrJh.js} +1 -1
  32. package/dist/native.iife.js +13 -10
  33. package/dist/native.js +1 -1
  34. package/dist/{overlay-ClYgI2Kl.js → overlay-COzFFq0-.js} +1 -1
  35. package/dist/overlay.js +2 -2
  36. package/dist/{qna-B3lMzHvS.js → qna-DUs97irI.js} +1 -1
  37. package/dist/qna-runtime.js +1 -1
  38. package/dist/qna.iife.js +1 -1
  39. package/dist/qna.js +2 -2
  40. package/dist/{runtime-LY1J9JFl.js → runtime-BGCNkU1H.js} +6 -6
  41. package/dist/{runtime-Bt2VV3L3.js → runtime-CbWCU424.js} +1082 -1042
  42. package/dist/{runtime-rjNaPWIi.js → runtime-Ctqq0V6G.js} +8 -8
  43. package/dist/{simbut-DV4oPMpH.js → simbut-Dh4cJysK.js} +3 -3
  44. package/dist/simbut.iife.js +1 -1
  45. package/dist/simbut.js +1 -1
  46. package/dist/{simrel-DaAhtabq.js → simrel-B-sjHbL5.js} +4 -4
  47. package/dist/simrel-runtime.js +1 -1
  48. package/dist/simrel.iife.js +2 -2
  49. package/dist/simrel.js +2 -2
  50. package/dist/{widget-base-DRaUfd-H.js → widget-base-CIJT5AiP.js} +2 -2
  51. package/package.json +1 -1
  52. /package/dist/{context-BBuSsXZ9.js → context-heG8hv5l.js} +0 -0
  53. /package/dist/{locale-CfqNifrU.js → locale-uQ5XZ2yS.js} +0 -0
  54. /package/dist/{price-formatter-CFsWT0lP.js → price-formatter-CHUmYq8I.js} +0 -0
  55. /package/dist/{request-response-cache-zsgz3Awp.js → request-response-cache-BxRsKGJ0.js} +0 -0
  56. /package/dist/{schemas-Cq2blsO_.js → schemas-BnYUhYSy.js} +0 -0
@@ -1,12 +1,12 @@
1
- import { A as Ne, B as Ge, C as J, D as He, E as Ke, F as Je, H as z, I as k, M as ze, N as We, O as Qe, P as W, R as Q, S as Y, T as Ye, U as V, _ as L, a as Ve, b as Xe, c as Ze, d as et, f as tt, g as rt, h as nt, i as ot, j as X, k as at, l as st, m as it, n as ct, o as lt, p as ut, r as dt, s as ft, t as pt, u as gt, v as wt, w as yt, x as ht, y as mt, z as bt } from "../request-text-DThlE-Xd.js";
1
+ import { $ as Ge, A as He, B as Ke, C as ze, Ct as Je, D as Qe, E as We, Et as z, F as Ve, G as Ye, H as Xe, I as Ze, J as et, K as tt, L as rt, M as nt, N as ot, O as at, P as st, Q as it, R as ct, S as lt, St as ut, T as dt, Tt as J, U as ft, V as pt, W as gt, X as ht, Y as mt, Z as yt, _ as wt, _t as Q, a as bt, at as W, b as St, c as Et, ct as Pt, d as At, dt as Rt, et as A, f as vt, ft as Tt, g as Ut, gt as xt, h as _t, ht as kt, i as Ct, it as Lt, j as Mt, k as jt, l as Bt, lt as It, m as $t, mt as V, n as Dt, nt as Ot, o as Ft, ot as Y, p as qt, pt as Nt, q as Gt, r as Ht, rt as Kt, s as zt, st as Jt, t as Qt, tt as Wt, u as Vt, ut as Yt, v as Xt, vt as Zt, w as er, x as tr, xt as X, y as rr, yt as C, z as nr } from "../account-config-gj7_mF6Q.js";
2
2
  var Z = 512, ee = 0.74;
3
- function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: y }) {
3
+ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: m }) {
4
4
  let f = 1;
5
5
  const u = /* @__PURE__ */ new Map();
6
- return z({
6
+ return J({
7
7
  worker: t,
8
8
  tools: p,
9
- beacon: (l) => y?.({
9
+ beacon: (l) => m?.({
10
10
  ...l,
11
11
  accountId: l.accountId || e
12
12
  }),
@@ -27,20 +27,20 @@ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
27
27
  s.type === "end" && u.delete(i);
28
28
  }
29
29
  }), (l, s, i, d) => {
30
- const w = f++;
31
- u.set(w, s);
30
+ const h = f++;
31
+ u.set(h, s);
32
32
  const g = () => {
33
- u.delete(w), t.postMessage({
34
- id: w,
33
+ u.delete(h), t.postMessage({
34
+ id: h,
35
35
  type: "abort"
36
36
  });
37
- }, m = (h) => {
37
+ }, w = (y) => {
38
38
  if (i.aborted) {
39
39
  g();
40
40
  return;
41
41
  }
42
42
  t.postMessage({
43
- id: w,
43
+ id: h,
44
44
  type: "invoke",
45
45
  accountId: e,
46
46
  beUrl: r,
@@ -48,7 +48,7 @@ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
48
48
  tokenBrokerUrl: o,
49
49
  tokenBrokerAudience: a,
50
50
  defaultLocale: c,
51
- request: h,
51
+ request: y,
52
52
  parentUrl: window.location.href
53
53
  });
54
54
  };
@@ -57,64 +57,64 @@ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
57
57
  return;
58
58
  }
59
59
  if (i.addEventListener("abort", g, { once: !0 }), d) {
60
- C(l, d).then(m).catch((h) => {
61
- u.delete(w), s.onError(h instanceof Error ? h : /* @__PURE__ */ new Error("Failed to read image attachment"));
60
+ L(l, d).then(w).catch((y) => {
61
+ u.delete(h), s.onError(y instanceof Error ? y : /* @__PURE__ */ new Error("Failed to read image attachment"));
62
62
  });
63
63
  return;
64
64
  }
65
- m(l);
65
+ w(l);
66
66
  };
67
67
  }
68
- function re({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: y }) {
68
+ function re({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: m }) {
69
69
  let f = null;
70
70
  const u = ne({
71
71
  accountId: e,
72
72
  tools: p,
73
- beacon: y
74
- }), l = Y(u), s = k({
73
+ beacon: m
74
+ }), l = W(u), s = C({
75
75
  accountId: e,
76
76
  ...n ? { devJwtSecret: n } : {},
77
77
  ...o ? { tokenBrokerUrl: o } : {},
78
78
  ...a ? { tokenBrokerAudience: a } : {}
79
79
  });
80
- return async (i, d, w, g) => {
81
- const m = await C(i || {}, g);
82
- f ||= new Q({
80
+ return async (i, d, h, g) => {
81
+ const w = await L(i || {}, g);
82
+ f ||= new X({
83
83
  accountId: e,
84
- locale: m?.locale || c,
84
+ locale: w?.locale || c,
85
85
  parentUrl: window.location.href,
86
86
  rpc: u,
87
87
  persistentPanelKeys: t.contextPersistence?.panelKeys
88
88
  });
89
89
  try {
90
- await J({
91
- request: m,
90
+ await Y({
91
+ request: w,
92
92
  accountModule: {
93
93
  ...t,
94
94
  accountId: e
95
95
  },
96
96
  contextStore: f,
97
- beClient: { invoke({ op: h, input: S, signal: v, cacheTtlS: G, cacheKey: H, browserCache: K }) {
98
- return X({
97
+ beClient: { invoke({ op: y, input: S, signal: T, cacheTtlS: G, cacheKey: H, browserCache: K }) {
98
+ return V({
99
99
  beUrl: r,
100
100
  accountId: e,
101
101
  jwtProvider: s,
102
102
  parentUrl: window.location.href,
103
- op: h,
103
+ op: y,
104
104
  input: S,
105
105
  cacheTtlS: G,
106
106
  cacheKey: H,
107
107
  browserCache: K,
108
- ...v ? { signal: v } : {}
108
+ ...T ? { signal: T } : {}
109
109
  });
110
110
  } },
111
111
  toolBridge: l,
112
- emit: (h) => E(d, h),
112
+ emit: (y) => E(d, y),
113
113
  rpc: u,
114
- signal: w
114
+ signal: h
115
115
  });
116
- } catch (h) {
117
- w?.aborted || (E(d, W(h)), d.onDone());
116
+ } catch (y) {
117
+ h?.aborted || (E(d, Q(y)), d.onDone());
118
118
  }
119
119
  };
120
120
  }
@@ -123,13 +123,13 @@ function ne({ accountId: e, tools: t, beacon: r }) {
123
123
  ...o,
124
124
  accountId: o.accountId || e
125
125
  });
126
- return ((o, a) => V(o, a, {
126
+ return ((o, a) => z(o, a, {
127
127
  tools: t,
128
128
  beacon: n,
129
129
  memory: sessionStorage
130
130
  }));
131
131
  }
132
- async function C(e, t) {
132
+ async function L(e, t) {
133
133
  if (!t || !t.type?.startsWith("image/")) return e;
134
134
  const r = await se(t), n = {
135
135
  ...oe(e.payload ?? e.action?.payload),
@@ -168,7 +168,7 @@ async function ie(e) {
168
168
  const c = a.getContext("2d");
169
169
  if (!c) return null;
170
170
  c.drawImage(t, 0, 0, n, o);
171
- const p = await new Promise((y) => a.toBlob(y, "image/jpeg", ee));
171
+ const p = await new Promise((m) => a.toBlob(m, "image/jpeg", ee));
172
172
  return p ? {
173
173
  dataUrl: await M(p),
174
174
  mime: p.type || "image/jpeg"
@@ -223,18 +223,18 @@ var le = "entries", ue = 1, de = {
223
223
  session: "Current-visit tool context without raw tokens or PII-heavy payloads.",
224
224
  local: "Small, non-sensitive capability facts or user preferences.",
225
225
  indexedDb: "Larger product/search payload caches with short TTLs."
226
- }, P = /* @__PURE__ */ new Map();
227
- function A() {
226
+ }, U = /* @__PURE__ */ new Map();
227
+ function P() {
228
228
  return Date.now();
229
229
  }
230
- function U(e) {
231
- return e?.expiresAt != null && e.expiresAt <= A();
230
+ function R(e) {
231
+ return e?.expiresAt != null && e.expiresAt <= P();
232
232
  }
233
- function R(e, t) {
233
+ function v(e, t) {
234
234
  return {
235
235
  value: e,
236
- createdAt: A(),
237
- expiresAt: t ? A() + t : null
236
+ createdAt: P(),
237
+ expiresAt: t ? P() + t : null
238
238
  };
239
239
  }
240
240
  function fe(e, t, r) {
@@ -242,14 +242,14 @@ function fe(e, t, r) {
242
242
  const n = e.getItem(`${t}${r}`);
243
243
  if (!n) return null;
244
244
  const o = JSON.parse(n);
245
- return U(o) ? (e.removeItem(`${t}${r}`), null) : o.value;
245
+ return R(o) ? (e.removeItem(`${t}${r}`), null) : o.value;
246
246
  } catch {
247
247
  return null;
248
248
  }
249
249
  }
250
250
  function pe(e, t, r, n, o) {
251
251
  try {
252
- return e.setItem(`${t}${r}`, JSON.stringify(R(n, o))), !0;
252
+ return e.setItem(`${t}${r}`, JSON.stringify(v(n, o))), !0;
253
253
  } catch {
254
254
  return !1;
255
255
  }
@@ -260,14 +260,14 @@ function ge(e, t, r) {
260
260
  } catch {
261
261
  }
262
262
  }
263
- function T(e) {
263
+ function x(e) {
264
264
  try {
265
265
  return window[e];
266
266
  } catch {
267
267
  return null;
268
268
  }
269
269
  }
270
- function x(e, t) {
270
+ function _(e, t) {
271
271
  return e ? {
272
272
  get: (r) => fe(e, t, r),
273
273
  set: (r, n, o = {}) => pe(e, t, r, n, o.ttlMs),
@@ -279,7 +279,7 @@ function x(e, t) {
279
279
  }
280
280
  };
281
281
  }
282
- function we(e, t) {
282
+ function he(e, t) {
283
283
  const r = t.dbName || `gengage-${e}`, n = t.dbStore || le, o = t.dbVersion || ue, a = /* @__PURE__ */ new Map();
284
284
  let c = null;
285
285
  const p = () => "indexedDB" in window ? c || (c = new Promise((l) => {
@@ -293,24 +293,24 @@ function we(e, t) {
293
293
  idbGet: async (l) => {
294
294
  const s = await p();
295
295
  return s ? new Promise((i) => {
296
- const d = s.transaction(n, "readwrite").objectStore(n), w = d.get(l);
297
- w.onsuccess = () => {
298
- const g = w.result;
299
- if (!g || U(g)) {
296
+ const d = s.transaction(n, "readwrite").objectStore(n), h = d.get(l);
297
+ h.onsuccess = () => {
298
+ const g = h.result;
299
+ if (!g || R(g)) {
300
300
  g && d.delete(l), i(null);
301
301
  return;
302
302
  }
303
303
  i(g.value);
304
- }, w.onerror = () => i(null);
304
+ }, h.onerror = () => i(null);
305
305
  }) : null;
306
306
  },
307
307
  idbSet: async (l, s, i = {}) => {
308
308
  const d = await p();
309
- return d ? new Promise((w) => {
309
+ return d ? new Promise((h) => {
310
310
  const g = d.transaction(n, "readwrite");
311
- g.oncomplete = () => w(!0), g.onerror = () => w(!1), g.objectStore(n).put({
311
+ g.oncomplete = () => h(!0), g.onerror = () => h(!1), g.objectStore(n).put({
312
312
  key: l,
313
- ...R(s, i.ttlMs)
313
+ ...v(s, i.ttlMs)
314
314
  });
315
315
  }) : !1;
316
316
  },
@@ -323,14 +323,14 @@ function we(e, t) {
323
323
  function j(e, t = {}) {
324
324
  const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}), a = o[e];
325
325
  if (a) return a;
326
- const c = P.get(e) || we(e, t);
327
- P.set(e, c);
328
- const p = t.sessionPrefix || `gengage:${e}:session:`, y = t.localPrefix || `gengage:${e}:local:`, u = {
326
+ const c = U.get(e) || he(e, t);
327
+ U.set(e, c);
328
+ const p = t.sessionPrefix || `gengage:${e}:session:`, m = t.localPrefix || `gengage:${e}:local:`, u = {
329
329
  get: (i) => {
330
330
  const d = c.volatileEntries.get(i);
331
- return d ? U(d) ? (c.volatileEntries.delete(i), null) : d.value : null;
331
+ return d ? R(d) ? (c.volatileEntries.delete(i), null) : d.value : null;
332
332
  },
333
- set: (i, d, w = {}) => (c.volatileEntries.set(i, R(d, w.ttlMs)), !0),
333
+ set: (i, d, h = {}) => (c.volatileEntries.set(i, v(d, h.ttlMs)), !0),
334
334
  remove: (i) => {
335
335
  c.volatileEntries.delete(i);
336
336
  },
@@ -342,10 +342,10 @@ function j(e, t = {}) {
342
342
  }, s = {
343
343
  accountId: e,
344
344
  volatile: u,
345
- session: x(T("sessionStorage"), p),
346
- local: x(T("localStorage"), y),
345
+ session: _(x("sessionStorage"), p),
346
+ local: _(x("localStorage"), m),
347
347
  indexedDb: l,
348
- stableKey: L,
348
+ stableKey: A,
349
349
  policy: {
350
350
  ...de,
351
351
  ...t.policy || {}
@@ -355,15 +355,15 @@ function j(e, t = {}) {
355
355
  for (const i of t.aliases || []) o[i] = s;
356
356
  return s;
357
357
  }
358
- var b = "__gengageAgentFetchBridge", ye = 1e3 * 60 * 60 * 24 * 14;
359
- function St({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache: n }) {
358
+ var b = "__gengageAgentFetchBridge", me = 1e3 * 60 * 60 * 24 * 14;
359
+ function or({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache: n }) {
360
360
  if (!e) throw new Error("accountId is required.");
361
361
  if (typeof t != "function") throw new Error("streamTransport is required.");
362
- const o = he(), a = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, c = /* @__PURE__ */ new Set(), p = n ? Ue({
362
+ const o = ye(), a = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, c = /* @__PURE__ */ new Set(), p = n ? Ae({
363
363
  accountId: e,
364
364
  endpointCache: n,
365
365
  fetchImpl: o.originalFetch
366
- }) : void 0, y = (f) => {
366
+ }) : void 0, m = (f) => {
367
367
  const u = `${a}/chat/${f}`;
368
368
  c.add(u);
369
369
  const l = r[f], s = {
@@ -372,17 +372,17 @@ function St({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache
372
372
  };
373
373
  l && (s.endpointHandler = l), p && (s.endpointCache = p), o.routes.set(u, s);
374
374
  };
375
- y("process_action");
376
- for (const f of Object.keys(r)) f !== "process_action" && y(f);
375
+ m("process_action");
376
+ for (const f of Object.keys(r)) f !== "process_action" && m(f);
377
377
  return {
378
378
  middlewareUrl: a,
379
379
  stop() {
380
380
  for (const f of c) o.routes.delete(f);
381
- me(o);
381
+ we(o);
382
382
  }
383
383
  };
384
384
  }
385
- function he() {
385
+ function ye() {
386
386
  const e = window, t = e[b];
387
387
  if (t) return t;
388
388
  const r = e.fetch.bind(e), n = {
@@ -395,7 +395,7 @@ function he() {
395
395
  return p ? Se(p, o, a) : r(o, a);
396
396
  }, e.fetch = n.installedFetch, e[b] = n, n;
397
397
  }
398
- function me(e) {
398
+ function we(e) {
399
399
  if (e.routes.size > 0) return;
400
400
  const t = window;
401
401
  t.fetch === e.installedFetch && (t.fetch = e.originalFetch), t[b] === e && delete t[b];
@@ -403,7 +403,7 @@ function me(e) {
403
403
  function B(e) {
404
404
  return typeof e == "string" ? e : e instanceof URL ? e.href : e?.url || "";
405
405
  }
406
- function _(e, t) {
406
+ function k(e, t) {
407
407
  if (t?.signal) return t.signal;
408
408
  if (typeof Request < "u" && e instanceof Request) return e.signal;
409
409
  }
@@ -424,7 +424,7 @@ async function be(e, t) {
424
424
  }
425
425
  async function Se(e, t, r) {
426
426
  if (e.endpoint && e.endpoint !== "process_action" && e.endpointHandler) {
427
- const f = new AbortController(), u = _(t, r);
427
+ const f = new AbortController(), u = k(t, r);
428
428
  let l = null;
429
429
  if (u) {
430
430
  const s = () => f.abort();
@@ -432,23 +432,23 @@ async function Se(e, t, r) {
432
432
  }
433
433
  try {
434
434
  const s = await Ee(t, r), i = {
435
- accountId: Ae(t),
435
+ accountId: Pe(t),
436
436
  endpoint: e.endpoint,
437
437
  signal: f.signal
438
438
  }, d = Re(e.endpointCache, e.endpoint, s, i.accountId);
439
439
  if (d) {
440
440
  const g = await ve(e.endpointCache, d, f.signal);
441
- if (g) return Le(g);
441
+ if (g) return Ce(g);
442
442
  }
443
- const w = await e.endpointHandler(s, i);
444
- return d && w.ok && await Pe(e.endpointCache, d, w.clone(), f.signal), w;
443
+ const h = await e.endpointHandler(s, i);
444
+ return d && h.ok && await Te(e.endpointCache, d, h.clone(), f.signal), h;
445
445
  } finally {
446
446
  l?.();
447
447
  }
448
448
  }
449
- const n = new TextEncoder(), o = new AbortController(), a = _(t, r);
449
+ const n = new TextEncoder(), o = new AbortController(), a = k(t, r);
450
450
  let c = !1, p = null;
451
- const y = new ReadableStream({
451
+ const m = new ReadableStream({
452
452
  async start(f) {
453
453
  const u = (i) => {
454
454
  c || f.enqueue(n.encode(`${JSON.stringify(i)}
@@ -473,18 +473,18 @@ async function Se(e, t, r) {
473
473
  a.addEventListener("abort", i, { once: !0 }), p = () => a.removeEventListener("abort", i);
474
474
  }
475
475
  try {
476
- const { request: i, attachment: d } = await be(t, r), w = e.streamTransport(i, {
477
- onTextChunk: (g, m, h = {}) => u({
476
+ const { request: i, attachment: d } = await be(t, r), h = e.streamTransport(i, {
477
+ onTextChunk: (g, w, y = {}) => u({
478
478
  type: "text_chunk",
479
479
  content: g,
480
- final: m === !0,
481
- ...h
480
+ final: w === !0,
481
+ ...y
482
482
  }),
483
- onUISpec: (g, m, h, S) => u({
483
+ onUISpec: (g, w, y, S) => u({
484
484
  type: "ui_spec",
485
485
  spec: g,
486
- widget: m,
487
- ...h ? { panelHint: h } : {},
486
+ widget: w,
487
+ ...y ? { panelHint: y } : {},
488
488
  ...S ? { clearPanel: !0 } : {}
489
489
  }),
490
490
  onAction: (g) => {
@@ -504,7 +504,7 @@ async function Se(e, t, r) {
504
504
  u({ type: "done" }), l();
505
505
  }
506
506
  }, o.signal, d);
507
- Be(w) && (await w, o.signal.aborted || (u({ type: "done" }), l()));
507
+ Be(h) && (await h, o.signal.aborted || (u({ type: "done" }), l()));
508
508
  } catch (i) {
509
509
  o.signal.aborted || s(i);
510
510
  }
@@ -513,7 +513,7 @@ async function Se(e, t, r) {
513
513
  o.abort(), p?.(), c = !0;
514
514
  }
515
515
  });
516
- return new Response(y, {
516
+ return new Response(m, {
517
517
  status: 200,
518
518
  headers: { "Content-Type": "application/x-ndjson" }
519
519
  });
@@ -522,7 +522,7 @@ async function Ee(e, t) {
522
522
  const r = await Promise.resolve(I(e, t));
523
523
  return typeof r != "string" || r.trim() === "" ? {} : JSON.parse(r);
524
524
  }
525
- function Ae(e) {
525
+ function Pe(e) {
526
526
  try {
527
527
  const [t] = new URL(B(e)).pathname.split("/").filter(Boolean);
528
528
  return decodeURIComponent(t || "");
@@ -530,15 +530,15 @@ function Ae(e) {
530
530
  return "";
531
531
  }
532
532
  }
533
- function Ue({ accountId: e, endpointCache: t, fetchImpl: r }) {
533
+ function Ae({ accountId: e, endpointCache: t, fetchImpl: r }) {
534
534
  return {
535
535
  accountId: e,
536
536
  beUrl: t.beUrl,
537
537
  ...t.parentUrl ? { parentUrl: t.parentUrl } : {},
538
- ttlMs: t.ttlMs ?? ye,
538
+ ttlMs: t.ttlMs ?? me,
539
539
  policies: t.policies,
540
540
  fetchImpl: r,
541
- jwtProvider: k({
541
+ jwtProvider: C({
542
542
  accountId: e,
543
543
  ...t.devJwtSecret ? { devJwtSecret: t.devJwtSecret } : {},
544
544
  ...t.tokenBrokerUrl ? { tokenBrokerUrl: t.tokenBrokerUrl } : {},
@@ -562,12 +562,12 @@ function Re(e, t, r, n) {
562
562
  };
563
563
  }
564
564
  async function ve(e, t, r) {
565
- const n = F(e.accountId, t), o = await Ce(e.accountId, n);
566
- if ($(o)) return o;
567
- const a = await Te(e, t, r);
565
+ const n = F(e.accountId, t), o = await Le(e.accountId, n);
566
+ if (O(o)) return o;
567
+ const a = await Ue(e, t, r);
568
568
  return a ? (await q(e.accountId, n, a, t.ttlMs), a) : null;
569
569
  }
570
- async function Pe(e, t, r, n) {
570
+ async function Te(e, t, r, n) {
571
571
  try {
572
572
  const o = await ke(r);
573
573
  if (je(o.body)) return;
@@ -576,11 +576,11 @@ async function Pe(e, t, r, n) {
576
576
  } catch {
577
577
  }
578
578
  }
579
- async function Te(e, t, r) {
579
+ async function Ue(e, t, r) {
580
580
  try {
581
- const n = await e.fetchImpl(O(e.beUrl), {
581
+ const n = await e.fetchImpl(D(e.beUrl), {
582
582
  method: "POST",
583
- headers: await D(e, r),
583
+ headers: await $(e, r),
584
584
  body: JSON.stringify({
585
585
  partition: t.partition,
586
586
  key: t.key
@@ -589,16 +589,16 @@ async function Te(e, t, r) {
589
589
  });
590
590
  if (!n.ok) return null;
591
591
  const o = await n.json();
592
- return o.hit === !0 && $(o.payload) ? o.payload : null;
592
+ return o.hit === !0 && O(o.payload) ? o.payload : null;
593
593
  } catch {
594
594
  return null;
595
595
  }
596
596
  }
597
597
  async function xe(e, t, r, n) {
598
598
  try {
599
- await e.fetchImpl(O(e.beUrl), {
599
+ await e.fetchImpl(D(e.beUrl), {
600
600
  method: "POST",
601
- headers: await D(e, n),
601
+ headers: await $(e, n),
602
602
  body: JSON.stringify({
603
603
  partition: t.partition,
604
604
  key: t.key,
@@ -610,7 +610,7 @@ async function xe(e, t, r, n) {
610
610
  } catch {
611
611
  }
612
612
  }
613
- async function D(e, t) {
613
+ async function $(e, t) {
614
614
  return {
615
615
  authorization: `Bearer ${await e.jwtProvider({
616
616
  signal: t,
@@ -627,7 +627,7 @@ function _e() {
627
627
  return "";
628
628
  }
629
629
  }
630
- function O(e) {
630
+ function D(e) {
631
631
  return `${String(e).replace(/\/+$/u, "")}/v1/cache`;
632
632
  }
633
633
  async function ke(e) {
@@ -638,26 +638,26 @@ async function ke(e) {
638
638
  body: await e.text()
639
639
  };
640
640
  }
641
- function Le(e) {
641
+ function Ce(e) {
642
642
  return new Response(e.body, {
643
643
  status: e.status,
644
644
  statusText: e.statusText,
645
645
  headers: new Headers(e.headers)
646
646
  });
647
647
  }
648
- function $(e) {
648
+ function O(e) {
649
649
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
650
650
  const t = e;
651
651
  return typeof t.status == "number" && typeof t.statusText == "string" && typeof t.body == "string" && Array.isArray(t.headers);
652
652
  }
653
653
  function F(e, t) {
654
- return `endpoint-response:${L({
654
+ return `endpoint-response:${A({
655
655
  accountId: e,
656
656
  partition: t.partition,
657
657
  key: t.key
658
658
  })}`;
659
659
  }
660
- async function Ce(e, t) {
660
+ async function Le(e, t) {
661
661
  const r = j(e);
662
662
  return r.volatile.get(t) || await r.indexedDb.get(t) || r.local.get(t);
663
663
  }
@@ -674,7 +674,7 @@ function je(e) {
674
674
  function Be(e) {
675
675
  return e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
676
676
  }
677
- function Et({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: a, defaultLocale: c = "en-GB", accountModule: p, tools: y = {}, beacon: f, allowBlobWorker: u = !1 }) {
677
+ function ar({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: a, defaultLocale: c = "en-GB", accountModule: p, tools: m = {}, beacon: f, allowBlobWorker: u = !1 }) {
678
678
  if (!e) throw new Error("accountId is required.");
679
679
  if (!t) throw new Error("beUrl is required. The injector owns backend URLs; the SDK has no default.");
680
680
  if (!a) throw new Error("workerUrl is required.");
@@ -695,7 +695,7 @@ function Et({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
695
695
  ...n ? { tokenBrokerUrl: n } : {},
696
696
  ...o ? { tokenBrokerAudience: o } : {},
697
697
  defaultLocale: c,
698
- tools: y,
698
+ tools: m,
699
699
  ...f ? { beacon: f } : {}
700
700
  }) : re({
701
701
  accountId: e,
@@ -705,10 +705,10 @@ function Et({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
705
705
  ...n ? { tokenBrokerUrl: n } : {},
706
706
  ...o ? { tokenBrokerAudience: o } : {},
707
707
  defaultLocale: c,
708
- tools: y,
708
+ tools: m,
709
709
  ...f ? { beacon: f } : {}
710
710
  });
711
- const w = {
711
+ const h = {
712
712
  type: "agent",
713
713
  stop() {
714
714
  delete i.streamTransport, d?.worker.terminate(), d?.cleanup(), delete i.agentController;
@@ -725,7 +725,7 @@ function Et({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
725
725
  };
726
726
  }
727
727
  };
728
- return i.agentController = w, w;
728
+ return i.agentController = h, h;
729
729
  }
730
730
  function N(e) {
731
731
  const t = new URL(e, window.location.href);
@@ -758,21 +758,62 @@ function Ie(e, t, r = {}) {
758
758
  throw URL.revokeObjectURL(a), c;
759
759
  }
760
760
  }
761
+ function $e(e, t, r = "v1") {
762
+ return `endpoint:${r}:${A({
763
+ endpoint: e,
764
+ request: t
765
+ })}`;
766
+ }
767
+ function sr(e) {
768
+ const t = e.version || "v1", r = (n) => (o) => ({
769
+ partition: `${e.partitionPrefix}/${n}`,
770
+ key: $e(n, o, t),
771
+ ...e.ttlMs ? { ttlMs: e.ttlMs } : {}
772
+ });
773
+ return {
774
+ launcher_action: r("launcher_action"),
775
+ similar_products: r("similar_products"),
776
+ product_groupings: r("product_groupings")
777
+ };
778
+ }
779
+ function ir(e) {
780
+ return { ...e };
781
+ }
782
+ function cr(e, t = {}) {
783
+ return new Response(e.map((r) => JSON.stringify(r)).join(`
784
+ `) + `
785
+ `, {
786
+ ...t,
787
+ headers: {
788
+ "content-type": "application/x-ndjson",
789
+ ...t.headers || {}
790
+ }
791
+ });
792
+ }
793
+ function lr(e, t = {}) {
794
+ return new Response(JSON.stringify(e), {
795
+ ...t,
796
+ headers: {
797
+ "content-type": "application/json",
798
+ ...t.headers || {}
799
+ }
800
+ });
801
+ }
761
802
  function De(e) {
762
803
  const t = (e?.chat || e?._chat)?.root || e?._chat?.root;
763
804
  return t ? t.getRootNode?.()?.host || t : Array.from(document.querySelectorAll("*")).find((r) => r.shadowRoot?.querySelector?.(".gengage-chat-root, .gengage-chat-launcher-container"));
764
805
  }
765
- function At(e, t) {
806
+ function ur(e, t) {
766
807
  const r = De(e);
767
808
  r?.style && (t ? r.style.removeProperty("display") : r.style.setProperty("display", "none", "important")), t || (e?.chat || e?._chat)?.close?.();
768
809
  }
769
810
  var Oe = "nd_be_url";
770
- function Ut(e, t) {
771
- const r = $e() || e.beUrl || t;
811
+ function dr(e, t) {
812
+ const r = Fe() || e.beUrl || t;
772
813
  if (!r) throw new Error("resolveBeUrl: backend URL is required. The injector must supply a fallback URL; the SDK has no default.");
773
814
  return r;
774
815
  }
775
- function $e() {
816
+ function Fe() {
776
817
  try {
777
818
  const e = new URLSearchParams(window.location.search).get(Oe)?.trim();
778
819
  if (!e) return null;
@@ -782,7 +823,7 @@ function $e() {
782
823
  return null;
783
824
  }
784
825
  }
785
- var Fe = [
826
+ var qe = [
786
827
  "addToCart",
787
828
  "search",
788
829
  "searchKeyword",
@@ -790,17 +831,17 @@ var Fe = [
790
831
  "searchGiftOptions",
791
832
  "similaritySearch"
792
833
  ];
793
- function Rt(e, t, r = {}) {
834
+ function fr(e, t, r = {}) {
794
835
  const n = window, o = n.gengage || (n.gengage = {}), a = o.tools || (o.tools = {});
795
836
  a[e] = t;
796
837
  for (const c of r.accountAliases || []) a[c] = t;
797
- if (r.exposeStandardAliases !== !1) for (const c of r.standardAliases || Fe) {
838
+ if (r.exposeStandardAliases !== !1) for (const c of r.standardAliases || qe) {
798
839
  const p = t[c];
799
840
  typeof p == "function" && (a[c] = a[c] || p);
800
841
  }
801
842
  return t;
802
843
  }
803
- function vt({ getPageType: e, getProduct: t }) {
844
+ function pr({ getPageType: e, getProduct: t }) {
804
845
  return () => ({
805
846
  url: window.location.href,
806
847
  title: document.title,
@@ -808,7 +849,7 @@ function vt({ getPageType: e, getProduct: t }) {
808
849
  product: t()
809
850
  });
810
851
  }
811
- function Pt({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: a }) {
852
+ function gr({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: a }) {
812
853
  return async () => ({
813
854
  accountId: e,
814
855
  url: window.location.href,
@@ -820,7 +861,7 @@ function Pt({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getS
820
861
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
821
862
  });
822
863
  }
823
- function Tt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o } = {}) {
864
+ function hr({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o } = {}) {
824
865
  if (!e) throw new Error("accountId is required.");
825
866
  const a = o || e, c = window, p = () => {
826
867
  const l = c.GengageInjectorConfig || {}, s = l[e] || {};
@@ -828,7 +869,7 @@ function Tt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
828
869
  ...l,
829
870
  ...s
830
871
  };
831
- }, y = () => {
872
+ }, m = () => {
832
873
  const l = p();
833
874
  if (l.runtimeUrl) return l.runtimeUrl;
834
875
  const s = l.assetBaseUrl || l.baseUrl || document.currentScript?.getAttribute("src") || (n ? c[n] : null);
@@ -837,7 +878,7 @@ function Tt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
837
878
  }, f = c.GengageAssistantInjector || (c.GengageAssistantInjector = {}), u = f[e] || (f[e] = {});
838
879
  return u.loaderPromise || (u.loaderPromise = import(
839
880
  /* @vite-ignore */
840
- y()
881
+ m()
841
882
  ).then((l) => {
842
883
  const s = l[r];
843
884
  if (typeof s != "function") throw new Error(`${a} runtime export ${r} is unavailable.`);
@@ -847,52 +888,94 @@ function Tt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
847
888
  })), u.loaderPromise;
848
889
  }
849
890
  export {
850
- ze as AgentError,
851
- Q as ContextStore,
852
- Ye as action,
853
- gt as actionButtonsUiSpec,
854
- We as beErrorToAgentError,
855
- ct as buildPhotoSimilarityProfile,
856
- dt as buildProductSimilarityProfile,
857
- ot as buildSimilarityQueries,
891
+ kt as AgentError,
892
+ X as ContextStore,
893
+ Pt as action,
894
+ ft as actionButtonsUiSpec,
895
+ Xt as actionCandidatePayload,
896
+ Gt as alignProductsToTable,
897
+ Ht as anonymousRequestText,
898
+ xt as beErrorToAgentError,
899
+ Ve as buildPhotoSimilarityProfile,
900
+ Ze as buildProductSimilarityProfile,
901
+ rt as buildSimilarityQueries,
858
902
  N as canUseModuleWorker,
859
- W as caughtToStreamError,
860
- et as comparisonUiSpec,
903
+ Q as caughtToStreamError,
904
+ Qt as compactAccountConfig,
905
+ ht as compactContextProducts,
906
+ Et as compareCachedResultSteps,
907
+ Bt as compareResultSteps,
908
+ Vt as compareSearchSteps,
909
+ At as compareSteps,
910
+ et as comparisonResultForUi,
911
+ gt as comparisonUiSpec,
861
912
  j as createBrowserMemory,
862
- Pt as createDiagnosticsTool,
863
- st as createFlow,
913
+ gr as createDiagnosticsTool,
914
+ sr as createEndpointCachePolicies,
915
+ ir as createEndpointHandlers,
916
+ Xe as createFlow,
864
917
  te as createInjectorAdapter,
865
918
  re as createMainThreadInjectorAdapter,
866
919
  Ie as createModuleWorker,
867
- vt as createReadPageTool,
868
- Ke as done,
869
- bt as elapsedMs,
870
- He as error,
871
- Je as httpErrorToAgentError,
872
- Rt as installBrowserTools,
873
- St as installFetchTransportBridge,
874
- it as llmCacheKey,
875
- Qe as metadata,
876
- Et as mountAccount,
877
- mt as normalizeProduct,
878
- Ve as normalizeSimilarityText,
879
- Ge as nowIso,
880
- tt as productDetailsUiSpec,
881
- nt as productFactsKey,
882
- rt as productSkuKey,
883
- ut as productsUiSpec,
884
- lt as rankSimilarProducts,
885
- pt as requestText,
886
- Ut as resolveBeUrl,
887
- yt as resolveFlow,
888
- ft as scoreSimilarityCandidate,
889
- At as setAssistantHostVisible,
890
- L as stableKey,
891
- Tt as startLazyRuntimeLoader,
892
- at as textChunk,
893
- wt as textKey,
894
- Ze as tokenizeSimilarityText,
895
- Xe as trimProductFactsCore,
896
- ht as trimProductFactsListCore,
897
- Ne as uiSpec
920
+ pr as createReadPageTool,
921
+ Ct as defaultPiiPatternPack,
922
+ bt as defaultPiiPatterns,
923
+ It as done,
924
+ ut as elapsedMs,
925
+ $e as endpointStableKey,
926
+ Yt as error,
927
+ Qe as hasProductImage,
928
+ at as hasUsablePrice,
929
+ jt as hasVisibleShoppingFacts,
930
+ Zt as httpErrorToAgentError,
931
+ fr as installBrowserTools,
932
+ or as installFetchTransportBridge,
933
+ vt as intentQuestionSteps,
934
+ lr as jsonResponse,
935
+ yt as llmCacheKey,
936
+ Rt as metadata,
937
+ ar as mountAccount,
938
+ cr as ndjsonResponse,
939
+ rr as normalizeActionLabel,
940
+ mt as normalizeComparisonTable,
941
+ Ot as normalizeProduct,
942
+ He as normalizeQueryText,
943
+ ct as normalizeSimilarityText,
944
+ St as normalizeSuggestedActions,
945
+ Je as nowIso,
946
+ ze as panelProductScore,
947
+ qt as panelQuestionSteps,
948
+ er as prioritizePanelProducts,
949
+ tr as productActions,
950
+ Ye as productDetailsUiSpec,
951
+ it as productFactsKey,
952
+ lt as productPanelActions,
953
+ $t as productQuestionSteps,
954
+ Mt as productRankScore,
955
+ nt as productSearchText,
956
+ Ge as productSkuKey,
957
+ dt as productsMatchingParams,
958
+ tt as productsUiSpec,
959
+ nr as rankSimilarProducts,
960
+ ot as rankedSearchProducts,
961
+ st as rankingTokens,
962
+ Ft as redactPii,
963
+ zt as requestText,
964
+ dr as resolveBeUrl,
965
+ Jt as resolveFlow,
966
+ Ke as scoreSimilarityCandidate,
967
+ _t as searchResultSteps,
968
+ Ut as searchSteps,
969
+ ur as setAssistantHostVisible,
970
+ A as stableKey,
971
+ hr as startLazyRuntimeLoader,
972
+ wt as suggestedActionSteps,
973
+ Tt as textChunk,
974
+ Wt as textKey,
975
+ pt as tokenizeSimilarityText,
976
+ Kt as trimProductFactsCore,
977
+ Lt as trimProductFactsListCore,
978
+ Nt as uiSpec,
979
+ We as uniqueProducts,
980
+ Dt as withAccountConfig
898
981
  };