@gengage/assistant-fe 0.6.0 → 0.6.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.
- package/README.md +6 -22
- package/dist/agentic/index.js +157 -153
- package/dist/agentic/util/be-url.d.ts +1 -1
- package/dist/agentic.iife.js +4 -4
- package/dist/{api-paths-DJFF9RuZ.js → api-paths-C4WzXzyY.js} +1 -1
- package/dist/chat/runtime.d.ts +1 -0
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +2 -2
- package/dist/chat.js +1 -1
- package/dist/common/overlay.d.ts +1 -1
- package/dist/{common-BydCGBNn.js → common-DstAcheX.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-Pbvk3J8k.js → connection-warning-Ddr91Y9x.js} +1 -1
- package/dist/{fastIntent-CkYN2UOl.js → fastIntent-XtUvISni.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +2 -2
- package/dist/qna/types.d.ts +1 -1
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{runtime-OpNoB3cu.js → runtime-C66Wp6OR.js} +116 -113
- package/dist/{runtime-iCLkUjI3.js → runtime-CcA_r8pw.js} +3 -3
- package/dist/{runtime-DbZO1qG5.js → runtime-DJMUL882.js} +3 -3
- package/dist/{simbut-FyXolmZY.js → simbut-B6L3fwI7.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-CbLe5OAr.js → simrel-BB4Jrr32.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-COP8QwU3.js → widget-base-B3Oq8pjs.js} +1 -1
- package/package.json +2 -34
package/dist/agentic/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
function B({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience:
|
|
3
|
-
let
|
|
1
|
+
import { C as j, D as q, M as _, O as ue, S as le, T as D, _ as de, a as fe, b as O, c as ge, d as $, f as C, g as pe, h as we, i as me, j as M, k as he, l as ye, m as be, n as Se, o as Ee, p as Re, r as Ae, s as ve, t as Te, u as Ue, v as xe, w as Pe, x as Le, y as je } from "../beauty-consulting-turn-BmPXbkQg.js";
|
|
2
|
+
function B({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, defaultLocale: c, tools: g = {}, beacon: m }) {
|
|
3
|
+
let w = 1;
|
|
4
4
|
const d = /* @__PURE__ */ new Map();
|
|
5
5
|
return M({
|
|
6
6
|
worker: t,
|
|
7
7
|
tools: g,
|
|
8
|
-
beacon: (u) =>
|
|
8
|
+
beacon: (u) => m?.({
|
|
9
9
|
...u,
|
|
10
10
|
accountId: u.accountId || e
|
|
11
11
|
}),
|
|
@@ -26,7 +26,7 @@ function B({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl:
|
|
|
26
26
|
a.type === "end" && d.delete(s);
|
|
27
27
|
}
|
|
28
28
|
}), (u, a, s) => {
|
|
29
|
-
const l =
|
|
29
|
+
const l = w++;
|
|
30
30
|
d.set(l, a);
|
|
31
31
|
const p = () => {
|
|
32
32
|
d.delete(l), t.postMessage({
|
|
@@ -45,42 +45,42 @@ function B({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl:
|
|
|
45
45
|
beUrl: r,
|
|
46
46
|
devJwtSecret: n,
|
|
47
47
|
tokenBrokerUrl: o,
|
|
48
|
-
tokenBrokerAudience:
|
|
49
|
-
defaultLocale:
|
|
48
|
+
tokenBrokerAudience: i,
|
|
49
|
+
defaultLocale: c,
|
|
50
50
|
request: u,
|
|
51
51
|
parentUrl: window.location.href
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
let
|
|
57
|
-
const d =
|
|
55
|
+
function k({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: i, defaultLocale: c, tools: g = {}, beacon: m }) {
|
|
56
|
+
let w = null;
|
|
57
|
+
const d = F({
|
|
58
58
|
accountId: e,
|
|
59
59
|
tools: g,
|
|
60
|
-
beacon:
|
|
61
|
-
}), u =
|
|
60
|
+
beacon: m
|
|
61
|
+
}), u = $(d), a = D({
|
|
62
62
|
accountId: e,
|
|
63
63
|
...n ? { devJwtSecret: n } : {},
|
|
64
64
|
...o ? { tokenBrokerUrl: o } : {},
|
|
65
|
-
...
|
|
65
|
+
...i ? { tokenBrokerAudience: i } : {}
|
|
66
66
|
});
|
|
67
67
|
return async (s, l, p) => {
|
|
68
|
-
|
|
68
|
+
w ||= new q({
|
|
69
69
|
accountId: e,
|
|
70
|
-
locale: s?.locale ||
|
|
70
|
+
locale: s?.locale || c,
|
|
71
71
|
parentUrl: window.location.href,
|
|
72
72
|
rpc: d
|
|
73
73
|
});
|
|
74
74
|
try {
|
|
75
|
-
await
|
|
75
|
+
await C({
|
|
76
76
|
request: s || {},
|
|
77
77
|
accountModule: {
|
|
78
78
|
...t,
|
|
79
79
|
accountId: e
|
|
80
80
|
},
|
|
81
|
-
contextStore:
|
|
81
|
+
contextStore: w,
|
|
82
82
|
beClient: { invoke({ op: f, input: y, signal: h }) {
|
|
83
|
-
return
|
|
83
|
+
return O({
|
|
84
84
|
beUrl: r,
|
|
85
85
|
accountId: e,
|
|
86
86
|
jwtProvider: a,
|
|
@@ -96,16 +96,16 @@ function F({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBro
|
|
|
96
96
|
signal: p
|
|
97
97
|
});
|
|
98
98
|
} catch (f) {
|
|
99
|
-
p?.aborted || (b(l,
|
|
99
|
+
p?.aborted || (b(l, j(f)), l.onDone());
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function F({ accountId: e, tools: t, beacon: r }) {
|
|
104
104
|
const n = (o) => r?.({
|
|
105
105
|
...o,
|
|
106
106
|
accountId: o.accountId || e
|
|
107
107
|
});
|
|
108
|
-
return ((o,
|
|
108
|
+
return ((o, i) => _(o, i, {
|
|
109
109
|
tools: t,
|
|
110
110
|
beacon: n,
|
|
111
111
|
memory: sessionStorage
|
|
@@ -162,9 +162,9 @@ function G() {
|
|
|
162
162
|
routes: /* @__PURE__ */ new Map(),
|
|
163
163
|
originalFetch: r
|
|
164
164
|
};
|
|
165
|
-
return e.fetch = (o,
|
|
166
|
-
const
|
|
167
|
-
return g ?
|
|
165
|
+
return e.fetch = (o, i) => {
|
|
166
|
+
const c = I(o), g = n.routes.get(c);
|
|
167
|
+
return g ? K(g, o, i) : r(o, i);
|
|
168
168
|
}, e[v] = n, n;
|
|
169
169
|
}
|
|
170
170
|
function I(e) {
|
|
@@ -180,25 +180,25 @@ function W(e, t) {
|
|
|
180
180
|
async function H(e, t) {
|
|
181
181
|
const r = W(e, t);
|
|
182
182
|
if (r instanceof FormData) {
|
|
183
|
-
const o = r.get("request"),
|
|
183
|
+
const o = r.get("request"), i = r.get("attachment");
|
|
184
184
|
return {
|
|
185
185
|
request: JSON.parse(String(o || "{}")),
|
|
186
|
-
...
|
|
186
|
+
...i instanceof File ? { attachment: i } : {}
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
const n = await Promise.resolve(r);
|
|
190
190
|
return typeof n == "string" ? { request: JSON.parse(n || "{}") } : { request: {} };
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
const n = new TextEncoder(), o = new AbortController(),
|
|
194
|
-
let
|
|
195
|
-
const
|
|
196
|
-
async start(
|
|
192
|
+
function K(e, t, r) {
|
|
193
|
+
const n = new TextEncoder(), o = new AbortController(), i = J(t, r);
|
|
194
|
+
let c = !1, g = null;
|
|
195
|
+
const m = new ReadableStream({
|
|
196
|
+
async start(w) {
|
|
197
197
|
const d = (s) => {
|
|
198
|
-
|
|
198
|
+
c || w.enqueue(n.encode(`${JSON.stringify(s)}
|
|
199
199
|
`));
|
|
200
200
|
}, u = () => {
|
|
201
|
-
|
|
201
|
+
c || (c = !0, g?.(), w.close());
|
|
202
202
|
}, a = (s) => {
|
|
203
203
|
d({
|
|
204
204
|
type: "error",
|
|
@@ -206,15 +206,15 @@ function V(e, t, r) {
|
|
|
206
206
|
message: s instanceof Error ? s.message : String(s)
|
|
207
207
|
}), d({ type: "done" }), u();
|
|
208
208
|
};
|
|
209
|
-
if (
|
|
209
|
+
if (i) {
|
|
210
210
|
const s = () => {
|
|
211
|
-
o.abort(),
|
|
211
|
+
o.abort(), c || (c = !0, g?.(), w.error(new DOMException("Aborted", "AbortError")));
|
|
212
212
|
};
|
|
213
|
-
if (
|
|
213
|
+
if (i.aborted) {
|
|
214
214
|
s();
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
i.addEventListener("abort", s, { once: !0 }), g = () => i.removeEventListener("abort", s);
|
|
218
218
|
}
|
|
219
219
|
try {
|
|
220
220
|
const { request: s, attachment: l } = await H(t, r), p = e.streamTransport(s, {
|
|
@@ -224,12 +224,12 @@ function V(e, t, r) {
|
|
|
224
224
|
final: y === !0,
|
|
225
225
|
...h
|
|
226
226
|
}),
|
|
227
|
-
onUISpec: (f, y, h,
|
|
227
|
+
onUISpec: (f, y, h, L) => d({
|
|
228
228
|
type: "ui_spec",
|
|
229
229
|
spec: f,
|
|
230
230
|
widget: y,
|
|
231
231
|
...h ? { panelHint: h } : {},
|
|
232
|
-
...
|
|
232
|
+
...L ? { clearPanel: !0 } : {}
|
|
233
233
|
}),
|
|
234
234
|
onAction: (f) => {
|
|
235
235
|
d(f?.type === "action" ? f : {
|
|
@@ -248,28 +248,30 @@ function V(e, t, r) {
|
|
|
248
248
|
d({ type: "done" }), u();
|
|
249
249
|
}
|
|
250
250
|
}, o.signal, l);
|
|
251
|
-
|
|
251
|
+
V(p) && (await p, o.signal.aborted || (d({ type: "done" }), u()));
|
|
252
252
|
} catch (s) {
|
|
253
253
|
o.signal.aborted || a(s);
|
|
254
254
|
}
|
|
255
255
|
},
|
|
256
256
|
cancel() {
|
|
257
|
-
o.abort(), g?.(),
|
|
257
|
+
o.abort(), g?.(), c = !0;
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
|
-
return Promise.resolve(new Response(
|
|
260
|
+
return Promise.resolve(new Response(m, {
|
|
261
261
|
status: 200,
|
|
262
262
|
headers: { "Content-Type": "application/x-ndjson" }
|
|
263
263
|
}));
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function V(e) {
|
|
266
266
|
return e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function _e({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: i, defaultLocale: c = "en-GB", accountModule: g, tools: m = {}, beacon: w, allowBlobWorker: d = !1 }) {
|
|
269
269
|
if (!e) throw new Error("accountId is required.");
|
|
270
|
+
if (!t) throw new Error("beUrl is required. The injector owns backend URLs; the SDK has no default.");
|
|
271
|
+
if (!i) throw new Error("workerUrl is required.");
|
|
270
272
|
const u = window, a = u.GengageAssistantInjector || (u.GengageAssistantInjector = {}), s = a[e] || (a[e] = {});
|
|
271
273
|
if (s.agentController) return s.agentController;
|
|
272
|
-
const l = P(
|
|
274
|
+
const l = P(i) || d ? Y(i, `gengage-${e}-agent`, { allowBlobWorker: d }) : null;
|
|
273
275
|
s.streamTransport = l ? B({
|
|
274
276
|
accountId: e,
|
|
275
277
|
worker: l.worker,
|
|
@@ -277,19 +279,19 @@ function Oe({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
|
|
|
277
279
|
...r ? { devJwtSecret: r } : {},
|
|
278
280
|
...n ? { tokenBrokerUrl: n } : {},
|
|
279
281
|
...o ? { tokenBrokerAudience: o } : {},
|
|
280
|
-
defaultLocale:
|
|
281
|
-
tools:
|
|
282
|
-
...
|
|
283
|
-
}) :
|
|
282
|
+
defaultLocale: c,
|
|
283
|
+
tools: m,
|
|
284
|
+
...w ? { beacon: w } : {}
|
|
285
|
+
}) : k({
|
|
284
286
|
accountId: e,
|
|
285
287
|
accountModule: g,
|
|
286
288
|
beUrl: t,
|
|
287
289
|
...r ? { devJwtSecret: r } : {},
|
|
288
290
|
...n ? { tokenBrokerUrl: n } : {},
|
|
289
291
|
...o ? { tokenBrokerAudience: o } : {},
|
|
290
|
-
defaultLocale:
|
|
291
|
-
tools:
|
|
292
|
-
...
|
|
292
|
+
defaultLocale: c,
|
|
293
|
+
tools: m,
|
|
294
|
+
...w ? { beacon: w } : {}
|
|
293
295
|
});
|
|
294
296
|
const p = {
|
|
295
297
|
type: "agent",
|
|
@@ -300,7 +302,7 @@ function Oe({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
|
|
|
300
302
|
return {
|
|
301
303
|
accountId: e,
|
|
302
304
|
beUrl: t,
|
|
303
|
-
workerUrl:
|
|
305
|
+
workerUrl: i,
|
|
304
306
|
mounted: !0,
|
|
305
307
|
transport: l ? "worker" : "main-thread",
|
|
306
308
|
flows: Object.keys(g?.flows || {})
|
|
@@ -313,7 +315,7 @@ function P(e) {
|
|
|
313
315
|
const t = new URL(e, window.location.href);
|
|
314
316
|
return t.origin === window.location.origin || t.protocol === "blob:";
|
|
315
317
|
}
|
|
316
|
-
function
|
|
318
|
+
function Y(e, t, r = {}) {
|
|
317
319
|
const n = new URL(e, window.location.href);
|
|
318
320
|
if (P(e)) return {
|
|
319
321
|
worker: new Worker(n.href, {
|
|
@@ -325,36 +327,38 @@ function z(e, t, r = {}) {
|
|
|
325
327
|
};
|
|
326
328
|
if (!r.allowBlobWorker) throw new Error("Cross-origin agent workers require allowBlobWorker=true or a same-origin workerUrl.");
|
|
327
329
|
const o = new Blob([`import ${JSON.stringify(n.href)};
|
|
328
|
-
`], { type: "text/javascript" }),
|
|
330
|
+
`], { type: "text/javascript" }), i = URL.createObjectURL(o);
|
|
329
331
|
try {
|
|
330
332
|
return {
|
|
331
|
-
worker: new Worker(
|
|
333
|
+
worker: new Worker(i, {
|
|
332
334
|
type: "module",
|
|
333
335
|
name: t
|
|
334
336
|
}),
|
|
335
337
|
cleanup() {
|
|
336
|
-
URL.revokeObjectURL(
|
|
338
|
+
URL.revokeObjectURL(i);
|
|
337
339
|
}
|
|
338
340
|
};
|
|
339
|
-
} catch (
|
|
340
|
-
throw URL.revokeObjectURL(
|
|
341
|
+
} catch (c) {
|
|
342
|
+
throw URL.revokeObjectURL(i), c;
|
|
341
343
|
}
|
|
342
344
|
}
|
|
343
|
-
function
|
|
345
|
+
function z(e) {
|
|
344
346
|
const t = (e?.chat || e?._chat)?.root || e?._chat?.root;
|
|
345
347
|
return t ? t.getRootNode?.()?.host || t : Array.from(document.querySelectorAll("*")).find((r) => r.shadowRoot?.querySelector?.(".gengage-chat-root, .gengage-chat-launcher-container"));
|
|
346
348
|
}
|
|
347
|
-
function
|
|
348
|
-
const r =
|
|
349
|
+
function De(e, t) {
|
|
350
|
+
const r = z(e);
|
|
349
351
|
r?.style && (t ? r.style.removeProperty("display") : r.style.setProperty("display", "none", "important")), t || (e?.chat || e?._chat)?.close?.();
|
|
350
352
|
}
|
|
351
|
-
var Q = "
|
|
352
|
-
function
|
|
353
|
-
|
|
353
|
+
var Q = "nd_be_url";
|
|
354
|
+
function Oe(e, t) {
|
|
355
|
+
const r = X() || e.beUrl || t;
|
|
356
|
+
if (!r) throw new Error("resolveBeUrl: backend URL is required. The injector must supply a fallback URL; the SDK has no default.");
|
|
357
|
+
return r;
|
|
354
358
|
}
|
|
355
|
-
function
|
|
359
|
+
function X() {
|
|
356
360
|
try {
|
|
357
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
361
|
+
const e = new URLSearchParams(window.location.search).get(Q)?.trim();
|
|
358
362
|
if (!e) return null;
|
|
359
363
|
const t = new URL(e);
|
|
360
364
|
return t.protocol !== "https:" && t.protocol !== "http:" ? null : t.toString().replace(/\/+$/u, "");
|
|
@@ -362,7 +366,7 @@ function Z() {
|
|
|
362
366
|
return null;
|
|
363
367
|
}
|
|
364
368
|
}
|
|
365
|
-
var
|
|
369
|
+
var Z = "entries", ee = 1, te = {
|
|
366
370
|
volatile: "Hot per-page state and sensitive request context.",
|
|
367
371
|
session: "Current-visit tool context without raw tokens or PII-heavy payloads.",
|
|
368
372
|
local: "Small, non-sensitive capability facts or user preferences.",
|
|
@@ -371,34 +375,34 @@ var ee = "entries", te = 1, re = {
|
|
|
371
375
|
function S() {
|
|
372
376
|
return Date.now();
|
|
373
377
|
}
|
|
374
|
-
function
|
|
378
|
+
function R(e) {
|
|
375
379
|
return e?.expiresAt != null && e.expiresAt <= S();
|
|
376
380
|
}
|
|
377
|
-
function
|
|
381
|
+
function A(e, t) {
|
|
378
382
|
return {
|
|
379
383
|
value: e,
|
|
380
384
|
createdAt: S(),
|
|
381
385
|
expiresAt: t ? S() + t : null
|
|
382
386
|
};
|
|
383
387
|
}
|
|
384
|
-
function
|
|
388
|
+
function re(e, t, r) {
|
|
385
389
|
try {
|
|
386
390
|
const n = e.getItem(`${t}${r}`);
|
|
387
391
|
if (!n) return null;
|
|
388
392
|
const o = JSON.parse(n);
|
|
389
|
-
return
|
|
393
|
+
return R(o) ? (e.removeItem(`${t}${r}`), null) : o.value;
|
|
390
394
|
} catch {
|
|
391
395
|
return null;
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
|
-
function
|
|
398
|
+
function ne(e, t, r, n, o) {
|
|
395
399
|
try {
|
|
396
|
-
return e.setItem(`${t}${r}`, JSON.stringify(
|
|
400
|
+
return e.setItem(`${t}${r}`, JSON.stringify(A(n, o))), !0;
|
|
397
401
|
} catch {
|
|
398
402
|
return !1;
|
|
399
403
|
}
|
|
400
404
|
}
|
|
401
|
-
function
|
|
405
|
+
function oe(e, t, r) {
|
|
402
406
|
try {
|
|
403
407
|
e.removeItem(`${t}${r}`);
|
|
404
408
|
} catch {
|
|
@@ -413,9 +417,9 @@ function U(e) {
|
|
|
413
417
|
}
|
|
414
418
|
function x(e, t) {
|
|
415
419
|
return e ? {
|
|
416
|
-
get: (r) =>
|
|
417
|
-
set: (r, n, o = {}) =>
|
|
418
|
-
remove: (r) =>
|
|
420
|
+
get: (r) => re(e, t, r),
|
|
421
|
+
set: (r, n, o = {}) => ne(e, t, r, n, o.ttlMs),
|
|
422
|
+
remove: (r) => oe(e, t, r)
|
|
419
423
|
} : {
|
|
420
424
|
get: () => null,
|
|
421
425
|
set: () => !1,
|
|
@@ -431,31 +435,31 @@ function E(e) {
|
|
|
431
435
|
}
|
|
432
436
|
return JSON.stringify(e);
|
|
433
437
|
}
|
|
434
|
-
function
|
|
438
|
+
function se(e) {
|
|
435
439
|
let t = 2166136261;
|
|
436
440
|
const r = E(e);
|
|
437
441
|
for (let n = 0; n < r.length; n += 1)
|
|
438
442
|
t ^= r.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
439
443
|
return (t >>> 0).toString(36);
|
|
440
444
|
}
|
|
441
|
-
function
|
|
442
|
-
const r = t.dbName || `gengage-${e}`, n = t.dbStore ||
|
|
443
|
-
let
|
|
444
|
-
const g = () => "indexedDB" in window ?
|
|
445
|
+
function ae(e, t) {
|
|
446
|
+
const r = t.dbName || `gengage-${e}`, n = t.dbStore || Z, o = t.dbVersion || ee, i = /* @__PURE__ */ new Map();
|
|
447
|
+
let c = null;
|
|
448
|
+
const g = () => "indexedDB" in window ? c || (c = new Promise((u) => {
|
|
445
449
|
const a = indexedDB.open(r, o);
|
|
446
450
|
a.onupgradeneeded = () => {
|
|
447
451
|
a.result.createObjectStore(n, { keyPath: "key" });
|
|
448
452
|
}, a.onsuccess = () => u(a.result), a.onerror = () => u(null), a.onblocked = () => u(null);
|
|
449
|
-
}),
|
|
453
|
+
}), c) : Promise.resolve(null);
|
|
450
454
|
return {
|
|
451
|
-
volatileEntries:
|
|
455
|
+
volatileEntries: i,
|
|
452
456
|
idbGet: async (u) => {
|
|
453
457
|
const a = await g();
|
|
454
458
|
return a ? new Promise((s) => {
|
|
455
459
|
const l = a.transaction(n, "readwrite").objectStore(n), p = l.get(u);
|
|
456
460
|
p.onsuccess = () => {
|
|
457
461
|
const f = p.result;
|
|
458
|
-
if (!f ||
|
|
462
|
+
if (!f || R(f)) {
|
|
459
463
|
f && l.delete(u), s(null);
|
|
460
464
|
return;
|
|
461
465
|
}
|
|
@@ -469,7 +473,7 @@ function ie(e, t) {
|
|
|
469
473
|
const f = l.transaction(n, "readwrite");
|
|
470
474
|
f.oncomplete = () => p(!0), f.onerror = () => p(!1), f.objectStore(n).put({
|
|
471
475
|
key: u,
|
|
472
|
-
...
|
|
476
|
+
...A(a, s.ttlMs)
|
|
473
477
|
});
|
|
474
478
|
}) : !1;
|
|
475
479
|
},
|
|
@@ -479,34 +483,34 @@ function ie(e, t) {
|
|
|
479
483
|
}
|
|
480
484
|
};
|
|
481
485
|
}
|
|
482
|
-
function
|
|
483
|
-
const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}),
|
|
484
|
-
if (
|
|
485
|
-
const
|
|
486
|
-
T.set(e,
|
|
487
|
-
const g = t.sessionPrefix || `gengage:${e}:session:`,
|
|
486
|
+
function $e(e, t = {}) {
|
|
487
|
+
const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}), i = o[e];
|
|
488
|
+
if (i) return i;
|
|
489
|
+
const c = T.get(e) || ae(e, t);
|
|
490
|
+
T.set(e, c);
|
|
491
|
+
const g = t.sessionPrefix || `gengage:${e}:session:`, m = t.localPrefix || `gengage:${e}:local:`, d = {
|
|
488
492
|
get: (s) => {
|
|
489
|
-
const l =
|
|
490
|
-
return l ?
|
|
493
|
+
const l = c.volatileEntries.get(s);
|
|
494
|
+
return l ? R(l) ? (c.volatileEntries.delete(s), null) : l.value : null;
|
|
491
495
|
},
|
|
492
|
-
set: (s, l, p = {}) => (
|
|
496
|
+
set: (s, l, p = {}) => (c.volatileEntries.set(s, A(l, p.ttlMs)), !0),
|
|
493
497
|
remove: (s) => {
|
|
494
|
-
|
|
498
|
+
c.volatileEntries.delete(s);
|
|
495
499
|
},
|
|
496
|
-
clear: () =>
|
|
500
|
+
clear: () => c.volatileEntries.clear()
|
|
497
501
|
}, u = {
|
|
498
|
-
get:
|
|
499
|
-
set:
|
|
500
|
-
remove:
|
|
502
|
+
get: c.idbGet,
|
|
503
|
+
set: c.idbSet,
|
|
504
|
+
remove: c.idbRemove
|
|
501
505
|
}, a = {
|
|
502
506
|
accountId: e,
|
|
503
507
|
volatile: d,
|
|
504
508
|
session: x(U("sessionStorage"), g),
|
|
505
|
-
local: x(U("localStorage"),
|
|
509
|
+
local: x(U("localStorage"), m),
|
|
506
510
|
indexedDb: u,
|
|
507
|
-
stableKey:
|
|
511
|
+
stableKey: se,
|
|
508
512
|
policy: {
|
|
509
|
-
...
|
|
513
|
+
...te,
|
|
510
514
|
...t.policy || {}
|
|
511
515
|
}
|
|
512
516
|
};
|
|
@@ -514,7 +518,7 @@ function De(e, t = {}) {
|
|
|
514
518
|
for (const s of t.aliases || []) o[s] = a;
|
|
515
519
|
return a;
|
|
516
520
|
}
|
|
517
|
-
var
|
|
521
|
+
var ie = [
|
|
518
522
|
"addToCart",
|
|
519
523
|
"search",
|
|
520
524
|
"searchKeyword",
|
|
@@ -522,17 +526,17 @@ var ce = [
|
|
|
522
526
|
"searchGiftOptions",
|
|
523
527
|
"similaritySearch"
|
|
524
528
|
];
|
|
525
|
-
function
|
|
526
|
-
const n = window, o = n.gengage || (n.gengage = {}),
|
|
527
|
-
|
|
528
|
-
for (const
|
|
529
|
-
if (r.exposeStandardAliases !== !1) for (const
|
|
530
|
-
const g = t[
|
|
531
|
-
typeof g == "function" && (c
|
|
529
|
+
function Ce(e, t, r = {}) {
|
|
530
|
+
const n = window, o = n.gengage || (n.gengage = {}), i = o.tools || (o.tools = {});
|
|
531
|
+
i[e] = t;
|
|
532
|
+
for (const c of r.accountAliases || []) i[c] = t;
|
|
533
|
+
if (r.exposeStandardAliases !== !1) for (const c of r.standardAliases || ie) {
|
|
534
|
+
const g = t[c];
|
|
535
|
+
typeof g == "function" && (i[c] = i[c] || g);
|
|
532
536
|
}
|
|
533
537
|
return t;
|
|
534
538
|
}
|
|
535
|
-
function
|
|
539
|
+
function Me({ getPageType: e, getProduct: t }) {
|
|
536
540
|
return () => ({
|
|
537
541
|
url: window.location.href,
|
|
538
542
|
title: document.title,
|
|
@@ -540,7 +544,7 @@ function Be({ getPageType: e, getProduct: t }) {
|
|
|
540
544
|
product: t()
|
|
541
545
|
});
|
|
542
546
|
}
|
|
543
|
-
function
|
|
547
|
+
function Be({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: i }) {
|
|
544
548
|
return async () => ({
|
|
545
549
|
accountId: e,
|
|
546
550
|
url: window.location.href,
|
|
@@ -548,31 +552,31 @@ function Fe({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getS
|
|
|
548
552
|
productSku: r()?.sku ?? null,
|
|
549
553
|
toolNames: n(),
|
|
550
554
|
...o ? { searchCapabilities: o() } : {},
|
|
551
|
-
...
|
|
555
|
+
...i ? { memoryPolicy: i().policy } : {},
|
|
552
556
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
553
557
|
});
|
|
554
558
|
}
|
|
555
559
|
function ke({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o } = {}) {
|
|
556
560
|
if (!e) throw new Error("accountId is required.");
|
|
557
|
-
const
|
|
558
|
-
const u =
|
|
561
|
+
const i = o || e, c = window, g = () => {
|
|
562
|
+
const u = c.GengageInjectorConfig || {}, a = u[e] || {};
|
|
559
563
|
return {
|
|
560
564
|
...u,
|
|
561
565
|
...a
|
|
562
566
|
};
|
|
563
|
-
},
|
|
567
|
+
}, m = () => {
|
|
564
568
|
const u = g();
|
|
565
569
|
if (u.runtimeUrl) return u.runtimeUrl;
|
|
566
|
-
const a = u.assetBaseUrl || u.baseUrl || document.currentScript?.getAttribute("src") || (n ?
|
|
567
|
-
if (!a) throw new Error(`${
|
|
570
|
+
const a = u.assetBaseUrl || u.baseUrl || document.currentScript?.getAttribute("src") || (n ? c[n] : null);
|
|
571
|
+
if (!a) throw new Error(`${i} runtime URL cannot be resolved.`);
|
|
568
572
|
return new URL(t, a).href;
|
|
569
|
-
},
|
|
573
|
+
}, w = c.GengageAssistantInjector || (c.GengageAssistantInjector = {}), d = w[e] || (w[e] = {});
|
|
570
574
|
return d.loaderPromise || (d.loaderPromise = import(
|
|
571
575
|
/* @vite-ignore */
|
|
572
|
-
|
|
576
|
+
m()
|
|
573
577
|
).then((u) => {
|
|
574
578
|
const a = u[r];
|
|
575
|
-
if (typeof a != "function") throw new Error(`${
|
|
579
|
+
if (typeof a != "function") throw new Error(`${i} runtime export ${r} is unavailable.`);
|
|
576
580
|
return a();
|
|
577
581
|
}).catch((u) => {
|
|
578
582
|
throw console.error(`[Gengage][${e}] runtime load failed`, u), u;
|
|
@@ -580,41 +584,41 @@ function ke({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
|
|
|
580
584
|
}
|
|
581
585
|
export {
|
|
582
586
|
Le as AgentError,
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
587
|
+
q as ContextStore,
|
|
588
|
+
be as action,
|
|
589
|
+
me as actionButtonsUiSpec,
|
|
590
|
+
le as beErrorToAgentError,
|
|
591
|
+
Te as beautyConsultingTurnFlow,
|
|
588
592
|
P as canUseModuleWorker,
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
593
|
+
j as caughtToStreamError,
|
|
594
|
+
fe as comparisonUiSpec,
|
|
595
|
+
$e as createBrowserMemory,
|
|
596
|
+
Be as createDiagnosticsTool,
|
|
597
|
+
Se as createFlow,
|
|
594
598
|
B as createInjectorAdapter,
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
599
|
+
k as createMainThreadInjectorAdapter,
|
|
600
|
+
Y as createModuleWorker,
|
|
601
|
+
Me as createReadPageTool,
|
|
598
602
|
we as done,
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
+
ue as elapsedMs,
|
|
604
|
+
pe as error,
|
|
605
|
+
Pe as httpErrorToAgentError,
|
|
606
|
+
Ce as installBrowserTools,
|
|
603
607
|
qe as installFetchTransportBridge,
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
608
|
+
de as metadata,
|
|
609
|
+
_e as mountAccount,
|
|
610
|
+
ge as normalizeProduct,
|
|
611
|
+
he as nowIso,
|
|
612
|
+
Ee as productDetailsUiSpec,
|
|
613
|
+
ve as productsUiSpec,
|
|
614
|
+
Ae as requestText,
|
|
615
|
+
Oe as resolveBeUrl,
|
|
612
616
|
Re as resolveFlow,
|
|
613
|
-
|
|
614
|
-
|
|
617
|
+
De as setAssistantHostVisible,
|
|
618
|
+
se as stableKey,
|
|
615
619
|
ke as startLazyRuntimeLoader,
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
620
|
+
xe as textChunk,
|
|
621
|
+
ye as trimProductFactsCore,
|
|
622
|
+
Ue as trimProductFactsListCore,
|
|
619
623
|
je as uiSpec
|
|
620
624
|
};
|