@gengage/assistant-fe 0.6.11 → 0.6.13

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 (50) hide show
  1. package/dist/agentic/adaptor/mount.d.ts +1 -0
  2. package/dist/agentic/context/context-store.d.ts +2 -1
  3. package/dist/agentic/context/persistence.d.ts +2 -1
  4. package/dist/agentic/index.d.ts +3 -1
  5. package/dist/agentic/index.js +244 -240
  6. package/dist/agentic/types.d.ts +39 -21
  7. package/dist/agentic/util/browser-memory.d.ts +2 -2
  8. package/dist/agentic/util/cache-key.d.ts +15 -0
  9. package/dist/agentic/worker/be-client.d.ts +3 -1
  10. package/dist/agentic/worker.d.ts +3 -1
  11. package/dist/agentic/worker.js +92 -86
  12. package/dist/agentic.iife.js +5 -5
  13. package/dist/{api-paths-D65Uavfh.js → api-paths-ChCMvKkx.js} +1 -1
  14. package/dist/{chat-CrEa2W-e.js → chat-BP-yXukW.js} +1 -1
  15. package/dist/chat-runtime.js +1 -1
  16. package/dist/chat.iife.js +17 -17
  17. package/dist/chat.js +2 -2
  18. package/dist/common/request-response-cache.d.ts +9 -0
  19. package/dist/{common-D9p39tcK.js → common-BD_DSsqY.js} +3 -3
  20. package/dist/common.js +7 -7
  21. package/dist/{connection-warning-B4WXvW_P.js → connection-warning-CPeEsQ35.js} +1 -1
  22. package/dist/{fastIntent-CtaxOsQe.js → fastIntent-C1WeEqW8.js} +1 -1
  23. package/dist/index.js +12 -12
  24. package/dist/{native-webview-BlHM7cLs.js → native-webview-DbKq9lN8.js} +1 -1
  25. package/dist/native.iife.js +14 -14
  26. package/dist/native.js +1 -1
  27. package/dist/overlay.js +1 -1
  28. package/dist/{qna-BNvttR6s.js → qna-B3lMzHvS.js} +1 -1
  29. package/dist/qna-runtime.js +1 -1
  30. package/dist/qna.iife.js +13 -13
  31. package/dist/qna.js +2 -2
  32. package/dist/request-response-cache-zsgz3Awp.js +154 -0
  33. package/dist/request-text-su3Vlhrs.js +1318 -0
  34. package/dist/{runtime-BozDJELC.js → runtime-Dbwwd8yF.js} +38 -37
  35. package/dist/{runtime-CDjc7MP2.js → runtime-DclobJaN.js} +365 -364
  36. package/dist/{runtime-Brx9ReJA.js → runtime-Duvrignh.js} +69 -68
  37. package/dist/{simbut-DFRlkncH.js → simbut-5C5EAfoM.js} +1 -1
  38. package/dist/simbut.iife.js +1 -1
  39. package/dist/simbut.js +1 -1
  40. package/dist/{simrel-Cizk0RY8.js → simrel-DCcSBFez.js} +3 -3
  41. package/dist/simrel-runtime.js +1 -1
  42. package/dist/simrel.iife.js +12 -12
  43. package/dist/simrel.js +2 -2
  44. package/dist/{widget-base-Bux39ZWf.js → widget-base-BolzGV28.js} +1 -1
  45. package/package.json +1 -1
  46. package/dist/agentic/flow/beauty-consulting-turn.d.ts +0 -1
  47. package/dist/similarity-CqRK9i75.js +0 -1251
  48. /package/dist/{overlay-fgrzmFTR.js → overlay-CyoB1K0w.js} +0 -0
  49. /package/dist/{price-formatter-xI3g9Cd4.js → price-formatter-CFsWT0lP.js} +0 -0
  50. /package/dist/{schemas-CLo8wCjs.js → schemas-Cq2blsO_.js} +0 -0
package/dist/qna.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a, i as r, n as t, r as n, t as o } from "./runtime-BozDJELC.js";
2
- import { t as p } from "./qna-BNvttR6s.js";
1
+ import { a, i as r, n as t, r as n, t as o } from "./runtime-Dbwwd8yF.js";
2
+ import { t as p } from "./qna-B3lMzHvS.js";
3
3
  export {
4
4
  o as GengageQNA,
5
5
  n as createDefaultQnaUISpecRegistry,
@@ -0,0 +1,154 @@
1
+ var w = 72e5, b = 200, S = 5 * 1024 * 1024, g = "gengage_request_response_cache", T = 1, c = "responses", _ = /* @__PURE__ */ new Set(["addToCart", "like"]), a = /* @__PURE__ */ new Map(), A = null;
2
+ async function H(e, t = {}, r = {}) {
3
+ const n = B(e, t);
4
+ if (!n) return fetch(e, t);
5
+ const s = Date.now(), o = await C(n, s);
6
+ if (o) return j(o);
7
+ const u = await fetch(e, t);
8
+ return u.ok && I(n, u.clone(), s, {
9
+ ttlMs: r.ttlMs ?? w,
10
+ maxEntries: r.maxEntries ?? b,
11
+ maxBodyBytes: r.maxBodyBytes ?? S
12
+ }), u;
13
+ }
14
+ function B(e, t = {}) {
15
+ if (typeof Request < "u" && e instanceof Request) return null;
16
+ const r = String(t.method || "GET").toUpperCase();
17
+ return r !== "POST" || typeof t.body != "string" || D(t.body) ? null : `rr:${F(q({
18
+ url: String(e),
19
+ method: r,
20
+ headers: M(t.headers),
21
+ body: t.body
22
+ }))}`;
23
+ }
24
+ function D(e) {
25
+ try {
26
+ const t = JSON.parse(e);
27
+ if (!t || typeof t != "object" || Array.isArray(t)) return !1;
28
+ const r = t.type;
29
+ return typeof r == "string" && _.has(r);
30
+ } catch {
31
+ return !1;
32
+ }
33
+ }
34
+ async function C(e, t) {
35
+ const r = a.get(e);
36
+ if (r) if (r.expiresAt <= t) a.delete(e);
37
+ else
38
+ return r.lastAccessedAt = t, a.delete(e), a.set(e, r), y(r), r;
39
+ const n = await R(e);
40
+ return n ? n.expiresAt <= t ? (a.delete(e), L(e), null) : (n.lastAccessedAt = t, a.set(e, n), y(n), m(b), n) : null;
41
+ }
42
+ async function I(e, t, r, n) {
43
+ try {
44
+ const s = await t.text();
45
+ if (U(s) > n.maxBodyBytes || O(s)) return;
46
+ const o = {
47
+ key: e,
48
+ status: t.status,
49
+ statusText: t.statusText,
50
+ headers: P(t.headers),
51
+ body: s,
52
+ createdAt: r,
53
+ expiresAt: r + n.ttlMs,
54
+ lastAccessedAt: r
55
+ };
56
+ a.set(e, o), m(n.maxEntries), await y(o), await N(n.maxEntries, r);
57
+ } catch {
58
+ }
59
+ }
60
+ function O(e) {
61
+ return /"_error"\s*:/u.test(e) || /"type"\s*:\s*"error"/u.test(e);
62
+ }
63
+ function j(e) {
64
+ return new Response(e.body, {
65
+ status: e.status,
66
+ statusText: e.statusText,
67
+ headers: new Headers(e.headers)
68
+ });
69
+ }
70
+ function M(e) {
71
+ const t = new Headers(e), r = [];
72
+ return t.forEach((n, s) => {
73
+ const o = s.toLowerCase();
74
+ o !== "authorization" && o !== "cookie" && r.push([o, n]);
75
+ }), r.sort(([n], [s]) => n.localeCompare(s));
76
+ }
77
+ function P(e) {
78
+ const t = [];
79
+ return e.forEach((r, n) => {
80
+ const s = n.toLowerCase();
81
+ s !== "set-cookie" && t.push([s, r]);
82
+ }), t.sort(([r], [n]) => r.localeCompare(n));
83
+ }
84
+ function m(e) {
85
+ for (; a.size > e; ) {
86
+ const t = [...a.values()].sort((r, n) => r.lastAccessedAt - n.lastAccessedAt)[0];
87
+ if (!t) break;
88
+ a.delete(t.key);
89
+ }
90
+ }
91
+ async function d() {
92
+ return typeof indexedDB > "u" ? null : (A ??= new Promise((e) => {
93
+ const t = indexedDB.open(g, T);
94
+ t.onupgradeneeded = () => {
95
+ const r = t.result;
96
+ r.objectStoreNames.contains(c) || r.createObjectStore(c, { keyPath: "key" }).createIndex("lastAccessedAt", "lastAccessedAt", { unique: !1 });
97
+ }, t.onsuccess = () => e(t.result), t.onerror = () => e(null), t.onblocked = () => e(null);
98
+ }), A);
99
+ }
100
+ async function R(e) {
101
+ const t = await d();
102
+ return t ? new Promise((r) => {
103
+ const n = t.transaction(c, "readonly"), s = n.objectStore(c).get(e);
104
+ s.onsuccess = () => r(s.result ?? null), s.onerror = () => r(null), n.onerror = () => r(null);
105
+ }) : null;
106
+ }
107
+ async function y(e) {
108
+ const t = await d();
109
+ t && await new Promise((r) => {
110
+ const n = t.transaction(c, "readwrite");
111
+ n.objectStore(c).put(e), n.oncomplete = () => r(), n.onerror = () => r(), n.onabort = () => r();
112
+ });
113
+ }
114
+ async function L(e) {
115
+ const t = await d();
116
+ t && await new Promise((r) => {
117
+ const n = t.transaction(c, "readwrite");
118
+ n.objectStore(c).delete(e), n.oncomplete = () => r(), n.onerror = () => r(), n.onabort = () => r();
119
+ });
120
+ }
121
+ async function N(e, t) {
122
+ const r = await d();
123
+ r && await new Promise((n) => {
124
+ const s = r.transaction(c, "readwrite"), o = s.objectStore(c), u = [], f = o.openCursor();
125
+ f.onsuccess = () => {
126
+ const l = f.result;
127
+ if (!l) {
128
+ const p = u.filter((i) => i.expiresAt <= t), x = u.filter((i) => i.expiresAt > t).sort((i, E) => i.lastAccessedAt - E.lastAccessedAt).slice(0, Math.max(0, u.length - p.length - e));
129
+ for (const i of [...p, ...x]) o.delete(i.key);
130
+ return;
131
+ }
132
+ u.push(l.value), l.continue();
133
+ }, f.onerror = () => n(), s.oncomplete = () => n(), s.onerror = () => n(), s.onabort = () => n();
134
+ });
135
+ }
136
+ function q(e) {
137
+ return JSON.stringify(h(e));
138
+ }
139
+ function h(e) {
140
+ return Array.isArray(e) ? e.map(h) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => [t, h(r)]));
141
+ }
142
+ function F(e) {
143
+ let t = 14695981039346656037n;
144
+ const r = 1099511628211n;
145
+ for (let n = 0; n < e.length; n += 1)
146
+ t ^= BigInt(e.charCodeAt(n)), t = BigInt.asUintN(64, t * r);
147
+ return t.toString(16).padStart(16, "0");
148
+ }
149
+ function U(e) {
150
+ return typeof TextEncoder < "u" ? new TextEncoder().encode(e).byteLength : e.length;
151
+ }
152
+ export {
153
+ H as t
154
+ };