@gengage/assistant-fe 0.6.49 → 0.7.0

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 (51) hide show
  1. package/dist/chat/api.d.ts +1 -1
  2. package/dist/chat/components/ChatDrawer.d.ts +3 -1
  3. package/dist/chat/features/beauty-consulting/mode-controller.d.ts +1 -1
  4. package/dist/chat/features/beauty-consulting/stream-handler.d.ts +7 -1
  5. package/dist/chat/history-storage.d.ts +36 -4
  6. package/dist/chat/runtime.d.ts +73 -3
  7. package/dist/chat/utils/chat-presentation-debug.d.ts +0 -14
  8. package/dist/chat-runtime.js +1 -1
  9. package/dist/chat.iife.js +72 -72
  10. package/dist/chat.js +1 -1
  11. package/dist/common/connection-warning.d.ts +10 -0
  12. package/dist/common/indexed-db.d.ts +35 -2
  13. package/dist/common/native-webview.d.ts +1 -1
  14. package/dist/common/streaming.d.ts +6 -1
  15. package/dist/common/transport.d.ts +2 -1
  16. package/dist/common/types.d.ts +16 -0
  17. package/dist/{common-nAeMxZrn.js → common-CeuGSwJL.js} +61 -65
  18. package/dist/common.js +30 -30
  19. package/dist/{connection-warning-CDtUX-ol.js → connection-warning-C0e2byq5.js} +31 -25
  20. package/dist/{fastIntent-D45C2rEO.js → fastIntent-BI7l1oDv.js} +2 -2
  21. package/dist/global-error-toast-DvaKvPNA.js +798 -0
  22. package/dist/index.js +29 -29
  23. package/dist/native-webview-CHKpwixw.js +303 -0
  24. package/dist/native.iife.js +30 -30
  25. package/dist/native.js +1 -1
  26. package/dist/{overlay-BPZEIyo_.js → overlay-C3XzoSKd.js} +51 -32
  27. package/dist/overlay.js +6 -6
  28. package/dist/{price-formatter-CHUmYq8I.js → price-formatter-Q3wUKrl1.js} +2 -1
  29. package/dist/qna/runtime.d.ts +1 -0
  30. package/dist/qna-runtime.js +1 -1
  31. package/dist/qna.iife.js +32 -32
  32. package/dist/qna.js +1 -1
  33. package/dist/{request-response-cache-CGxwN0CV.js → request-response-cache-BLQy7llq.js} +478 -454
  34. package/dist/{runtime-CNlICVeC.js → runtime-BC8-a6Ql.js} +231 -219
  35. package/dist/runtime-BSIrZhF2.js +8889 -0
  36. package/dist/{runtime-Cg-6aUps.js → runtime-DiONTdBz.js} +230 -212
  37. package/dist/{simbut-BtaGMLLn.js → simbut-BDbb3nMH.js} +5 -5
  38. package/dist/simbut.iife.js +2 -2
  39. package/dist/simbut.js +1 -1
  40. package/dist/simrel/components/GroupTabs.d.ts +6 -0
  41. package/dist/simrel/runtime.d.ts +8 -0
  42. package/dist/{simrel-iGl2aXiY.js → simrel-CdxDIKu3.js} +15 -15
  43. package/dist/simrel-runtime.js +1 -1
  44. package/dist/simrel.iife.js +22 -22
  45. package/dist/simrel.js +2 -2
  46. package/dist/widget-base-Cvxdrqqt.js +141 -0
  47. package/package.json +1 -1
  48. package/dist/context-UTzCGyR9.js +0 -543
  49. package/dist/native-webview-CYX30O3Q.js +0 -273
  50. package/dist/runtime-COLQGOkl.js +0 -8708
  51. package/dist/widget-base-AuwRxs2X.js +0 -365
@@ -1,365 +0,0 @@
1
- import { o as m, r as x } from "./context-UTzCGyR9.js";
2
- var l = {
3
- "--gengage-chat-offset": "20px",
4
- "--gengage-chat-launcher-width": "56px",
5
- "--gengage-chat-launcher-height": "56px",
6
- "--gengage-chat-width": "400px",
7
- "--gengage-chat-shell-radius": "1rem",
8
- "--gengage-chat-header-height": "72px",
9
- "--gengage-chat-conversation-width": "396px",
10
- "--gengage-chat-panel-min-width": "320px",
11
- "--gengage-chat-panel-max-width": "1200px",
12
- "--gengage-chat-input-height": "48px",
13
- "--gengage-qna-pill-radius": "999px",
14
- "--gengage-qna-input-radius": "12px",
15
- "--gengage-simrel-card-radius": "0.75rem",
16
- "--radius-control": "12px",
17
- "--radius-card": "16px",
18
- "--radius-panel": "24px",
19
- "--radius-pill": "999px",
20
- "--surface-card-muted": "#f8fafc",
21
- "--text-secondary": "#4b5563",
22
- "--text-muted": "#6b7280",
23
- "--border-default": "rgba(17, 24, 39, 0.10)"
24
- };
25
- function w(e) {
26
- if (!e) return { ...l };
27
- const t = {
28
- ...l,
29
- ...e
30
- }, r = e["--gengage-chat-launcher-size"];
31
- return r !== void 0 && (e["--gengage-chat-launcher-width"] === void 0 && (t["--gengage-chat-launcher-width"] = r), e["--gengage-chat-launcher-height"] === void 0 && (t["--gengage-chat-launcher-height"] = r)), t;
32
- }
33
- var i = {
34
- primaryColor: "#b7102a",
35
- primaryForeground: "#ffffff",
36
- backgroundColor: "#ffffff",
37
- foregroundColor: "#111827",
38
- borderRadius: "0.75rem",
39
- fontFamily: '"Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
40
- fontSize: "14px",
41
- zIndex: "1000",
42
- "--glov-chatbot-width": "420px",
43
- "--glov-left-spacing": "260px",
44
- "--chatbot-padding": "16px",
45
- "--root-wrapper-background-color": "#f8f9fa",
46
- "--root-wrapper-border-color": "#edeeef",
47
- "--gengage-chat-width": "400px",
48
- "--gengage-chat-shell-radius": "1rem",
49
- "--gengage-chat-header-height": "72px",
50
- "--gengage-chat-conversation-width": "396px",
51
- "--gengage-chat-panel-min-width": "320px",
52
- "--gengage-chat-panel-max-width": "1200px",
53
- "--gengage-chat-input-height": "48px",
54
- "--gengage-qna-pill-radius": "999px",
55
- "--gengage-qna-input-radius": "0.75rem",
56
- "--gengage-simrel-card-radius": "0.75rem",
57
- "--client-primary": "#b7102a",
58
- "--client-primary-hover": "color-mix(in srgb, #b7102a 88%, black 12%)",
59
- "--client-primary-active": "color-mix(in srgb, #b7102a 78%, black 22%)",
60
- "--client-primary-subtle": "color-mix(in srgb, #b7102a 12%, white)",
61
- "--client-primary-soft": "color-mix(in srgb, #b7102a 20%, white)",
62
- "--client-on-primary": "#ffffff",
63
- "--client-focus-ring": "color-mix(in srgb, #b7102a 32%, transparent)",
64
- "--surface-page": "#f6f7fb",
65
- "--surface-shell": "#10131a",
66
- "--surface-card": "#ffffff",
67
- "--surface-card-muted": "#f8fafc",
68
- "--surface-card-soft": "#f8fafc",
69
- "--surface-elevated": "#ffffff",
70
- "--surface-input": "#ffffff",
71
- "--surface-overlay": "rgba(16, 19, 26, 0.52)",
72
- "--text-primary": "#111827",
73
- "--text-secondary": "#4b5563",
74
- "--text-muted": "#6b7280",
75
- "--text-inverse": "#f9fafb",
76
- "--border-subtle": "rgba(17, 24, 39, 0.06)",
77
- "--border-default": "rgba(17, 24, 39, 0.10)",
78
- "--border-strong": "rgba(17, 24, 39, 0.18)",
79
- "--shadow-1": "0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06)",
80
- "--shadow-2": "0 4px 12px rgba(16, 24, 40, 0.08)",
81
- "--shadow-3": "0 10px 24px rgba(16, 24, 40, 0.12)",
82
- "--radius-control": "12px",
83
- "--radius-card": "16px",
84
- "--radius-panel": "24px",
85
- "--radius-pill": "999px",
86
- "--success": "#16a34a",
87
- "--warning": "#d97706",
88
- "--error": "#dc2626",
89
- "--info": "#2563eb",
90
- "--rating": "#f5b301",
91
- "--gengage-brand-accent-start": "#0b24d6",
92
- "--gengage-brand-accent-mid": "#f768f2",
93
- "--gengage-brand-accent-end": "#ffed74",
94
- "--ai-accent-start": "#0b24d6",
95
- "--ai-accent-end": "#f768f2",
96
- "--ai-accent-soft": "linear-gradient(135deg, rgba(11, 36, 214, 0.08), rgba(247, 104, 242, 0.08))"
97
- };
98
- function F(e) {
99
- return {
100
- ...i,
101
- ...e
102
- };
103
- }
104
- var o = "gengage-global-toast-root", u = "gengage-global-toast-style", c = "gengage-global-toast-root--visible", v = 4200, _ = 1500, E = 15e3, T = [
105
- "--gengage-font-family",
106
- "--surface-card",
107
- "--text-primary",
108
- "--text-muted",
109
- "--border-default",
110
- "--radius-card",
111
- "--shadow-3",
112
- "--error",
113
- "--ds-toast-error-bg",
114
- "--ds-toast-error-border",
115
- "--ds-toast-error-accent",
116
- "--ds-toast-error-fg",
117
- "--ds-toast-error-shadow"
118
- ], f = !1, s = null, C = [
119
- /failed to fetch/i,
120
- /networkerror/i,
121
- /network request failed/i,
122
- /load failed/i,
123
- /err_network/i,
124
- /fetch failed/i,
125
- /network error/i
126
- ];
127
- function h(e) {
128
- return typeof e == "string" && e.toLowerCase().startsWith("tr");
129
- }
130
- function I(e) {
131
- if (typeof navigator < "u" && navigator.onLine === !1) return !0;
132
- const t = e instanceof Error ? e.message.trim() : "";
133
- return t ? C.some((r) => r.test(t)) : !1;
134
- }
135
- function H(e, t) {
136
- return I(t) ? h(e) ? "Bağlantı sorunu oluştu. Lütfen tekrar deneyin." : "Connection issue. Please try again." : h(e) ? "Bir hata oluştu. Lütfen tekrar deneyin." : "Something went wrong. Please try again.";
137
- }
138
- function S() {
139
- f || typeof window > "u" || typeof document > "u" || (f = !0, m("gengage:global:error", (e) => {
140
- k(e);
141
- }));
142
- }
143
- function k(e) {
144
- if (typeof document > "u") return;
145
- const t = e.message.trim();
146
- if (!t) return;
147
- A();
148
- const r = $();
149
- M(r), r.innerHTML = "";
150
- const a = document.createElement("section");
151
- a.className = "gengage-global-toast gengage-global-toast--error", a.setAttribute("role", "status"), a.setAttribute("aria-live", "polite");
152
- const n = document.createElement("div");
153
- n.className = "gengage-global-toast-title", n.textContent = R(e.source);
154
- const g = document.createElement("div");
155
- g.className = "gengage-global-toast-message", g.textContent = t, a.appendChild(n), a.appendChild(g), r.appendChild(a), r.classList.add(c), s && (clearTimeout(s), s = null), e.sticky !== !0 && (s = setTimeout(() => {
156
- L();
157
- }, N(e.durationMs)));
158
- }
159
- function L() {
160
- if (typeof document > "u") return;
161
- const e = document.getElementById(o);
162
- e && (e.classList.remove(c), e.innerHTML = "", s && (clearTimeout(s), s = null));
163
- }
164
- function R(e) {
165
- switch (e) {
166
- case "chat":
167
- return "Chat warning";
168
- case "qna":
169
- return "QnA warning";
170
- case "simrel":
171
- return "Widget warning";
172
- default:
173
- return "Connection warning";
174
- }
175
- }
176
- function $() {
177
- const e = document.getElementById(o);
178
- if (e instanceof HTMLElement) return e;
179
- const t = document.createElement("div");
180
- return t.id = o, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
181
- }
182
- function M(e) {
183
- if (typeof document > "u" || typeof window > "u") return;
184
- const t = document.querySelector(".gengage-chat-root, .gengage-qna-container, .gengage-simrel-container, .gengage-simbut-root");
185
- if (!t) return;
186
- const r = window.getComputedStyle(t);
187
- for (const a of T) {
188
- const n = r.getPropertyValue(a).trim();
189
- n ? e.style.setProperty(a, n) : e.style.removeProperty(a);
190
- }
191
- }
192
- function N(e) {
193
- return typeof e != "number" || !Number.isFinite(e) ? v : Math.min(E, Math.max(_, Math.round(e)));
194
- }
195
- function A() {
196
- if (document.getElementById(u)) return;
197
- const e = document.createElement("style");
198
- e.id = u;
199
- const t = i["--surface-card"] ?? i.backgroundColor ?? "#ffffff", r = i["--text-primary"] ?? i.foregroundColor ?? "#111827", a = i["--border-default"] ?? "rgba(17, 24, 39, 0.10)", n = i["--error"] ?? "#dc2626", g = i["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", b = i["--radius-card"] ?? "16px", y = i["--text-muted"] ?? "#6b7280";
200
- e.textContent = `
201
- #${o} {
202
- position: fixed;
203
- top: 16px;
204
- right: 16px;
205
- z-index: 2147483646;
206
- pointer-events: none;
207
- }
208
- #${o}.${c} {
209
- pointer-events: auto;
210
- }
211
- #${o} .gengage-global-toast {
212
- min-width: 260px;
213
- max-width: min(92vw, 420px);
214
- border-radius: var(--radius-card, ${b});
215
- border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${n}) 18%, var(--border-default, ${a})));
216
- border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${n}));
217
- background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${n}) 5%, var(--surface-card, ${t})));
218
- color: var(--ds-toast-error-fg, color-mix(in srgb, var(--error, ${n}) 22%, var(--text-primary, ${r})));
219
- box-shadow: var(--ds-toast-error-shadow, var(--shadow-3, ${g}));
220
- padding: 10px 12px;
221
- font-family: var(--gengage-font-family, ${JSON.stringify(i.fontFamily ?? '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif')});
222
- font-size: 13px;
223
- line-height: 1.4;
224
- animation: gengage-global-toast-in 180ms ease-out forwards;
225
- }
226
- #${o} .gengage-global-toast-title {
227
- margin: 0 0 4px;
228
- font-size: 12px;
229
- font-weight: 700;
230
- color: var(--text-muted, ${y});
231
- }
232
- #${o} .gengage-global-toast-message {
233
- margin: 0;
234
- font-weight: 500;
235
- }
236
- @keyframes gengage-global-toast-in {
237
- from {
238
- opacity: 0;
239
- transform: translateY(-8px);
240
- }
241
- to {
242
- opacity: 1;
243
- transform: translateY(0);
244
- }
245
- }
246
- `, document.head.appendChild(e);
247
- }
248
- var d = null;
249
- function O() {
250
- if (d !== null) return d;
251
- try {
252
- d = localStorage.getItem("gengage:debug") === "1";
253
- } catch {
254
- d = !1;
255
- }
256
- return d;
257
- }
258
- function p(e, t, r) {
259
- if (!O()) return;
260
- const a = [`[gengage:${e}]`, t];
261
- r !== void 0 && a.push(r), console.debug(...a);
262
- }
263
- var D = ("0.6.49".trim(), "0.6.49".trim()), B = ("package-build".trim(), "package-build".trim());
264
- function G() {
265
- if (typeof window > "u") return;
266
- const e = window;
267
- e.__gengageSdkRuntimeInfoLogged || (e.__gengageSdkRuntimeInfoLogged = !0, console.info(`[gengage] @gengage/assistant-fe v${D} (${B})`));
268
- }
269
- var P = class {
270
- constructor() {
271
- this.isVisible = !1, this.isInitialised = !1, this._handlers = /* @__PURE__ */ new Map(), this._cleanups = [], this._ownsRoot = !1, this._destroying = !1;
272
- }
273
- async init(e) {
274
- if (this.isInitialised) {
275
- console.warn("[gengage] Widget already initialised. Call update() instead.");
276
- return;
277
- }
278
- const t = w(e.theme);
279
- G(), this.config = {
280
- ...e,
281
- theme: t,
282
- session: x(e.session)
283
- }, this.root = this._resolveMount(e.mountTarget), this._applyTheme(t), S();
284
- const r = m("gengage:context:update", (a) => this.update(a));
285
- this._cleanups.push(r), p("lifecycle", `${this.constructor.name}.init`, {
286
- accountId: e.accountId,
287
- sku: e.pageContext?.sku
288
- });
289
- try {
290
- await this.onInit(this.config);
291
- } catch (a) {
292
- throw this.destroy(), a;
293
- }
294
- this._destroying || (this.isInitialised = !0, p("lifecycle", `${this.constructor.name} ready`), this.emit("ready"));
295
- }
296
- update(e) {
297
- this.isInitialised && (this.config.pageContext ? this.config = {
298
- ...this.config,
299
- pageContext: {
300
- ...this.config.pageContext,
301
- ...e
302
- }
303
- } : e.pageType !== void 0 && (this.config = {
304
- ...this.config,
305
- pageContext: e
306
- }), this.onUpdate(e), this.emit("context-update", this.config.pageContext));
307
- }
308
- show() {
309
- this.isVisible || (this.isVisible = !0, this.root.style.display = "", this.onShow(), this.emit("show"));
310
- }
311
- hide() {
312
- this.isVisible && (this.isVisible = !1, this.root.style.display = "none", this.onHide(), this.emit("hide"));
313
- }
314
- destroy() {
315
- this._destroying || (this._destroying = !0, this.emit("destroy"), this._cleanups.forEach((e) => e()), this._cleanups.length = 0, this._handlers.clear(), this.onDestroy(), this._cleanupRoot(), this.isInitialised = !1);
316
- }
317
- _cleanupRoot() {
318
- this._ownsRoot ? this.root.remove() : this.root.innerHTML = "";
319
- }
320
- on(e, t) {
321
- return this._handlers.has(e) || this._handlers.set(e, /* @__PURE__ */ new Set()), this._handlers.get(e).add(t), () => this._handlers.get(e)?.delete(t);
322
- }
323
- emit(e, ...t) {
324
- this._handlers.get(e)?.forEach((r) => r(...t));
325
- }
326
- addCleanup(e) {
327
- this._cleanups.push(e);
328
- }
329
- _resolveMount(e) {
330
- if (e instanceof HTMLElement) return e;
331
- if (typeof e == "string") {
332
- const r = document.querySelector(e);
333
- if (!r) throw new Error(`[gengage] Mount target not found: "${e}"`);
334
- return r;
335
- }
336
- const t = document.createElement("div");
337
- return t.dataset.gengageWidget = this.constructor.name.toLowerCase(), document.body.insertBefore(t, document.body.firstChild), this._ownsRoot = !0, t;
338
- }
339
- _applyTheme(e) {
340
- if (e) {
341
- for (const [t, r] of Object.entries(e)) if (r !== void 0) {
342
- const a = t.startsWith("--") ? t : `--gengage-${V(t)}`;
343
- this.root.style.setProperty(a, r);
344
- }
345
- }
346
- }
347
- };
348
- function V(e) {
349
- return e.replace(/([A-Z])/g, "-$1").toLowerCase();
350
- }
351
- export {
352
- L as a,
353
- S as c,
354
- F as d,
355
- l as f,
356
- p as i,
357
- k as l,
358
- B as n,
359
- H as o,
360
- w as p,
361
- D as r,
362
- I as s,
363
- P as t,
364
- i as u
365
- };