@gengage/assistant-fe 0.4.19 → 0.4.20

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 (37) hide show
  1. package/dist/api-paths-CReMDZWg.js +1250 -0
  2. package/dist/chat/components/ChoicePrompter.d.ts +2 -2
  3. package/dist/chat/runtime.d.ts +2 -1
  4. package/dist/chat-runtime.js +1 -1
  5. package/dist/chat.iife.js +17 -17
  6. package/dist/chat.js +1 -1
  7. package/dist/common/find-similar-payload.d.ts +3 -0
  8. package/dist/common/index.d.ts +1 -0
  9. package/dist/common/overlay.d.ts +2 -2
  10. package/dist/common/sdk-version.d.ts +3 -0
  11. package/dist/{common-Bpp43wr0.js → common-BM2ZsSLI.js} +2 -2
  12. package/dist/common.js +79 -77
  13. package/dist/{connection-warning-C7ehvQxx.js → connection-warning-C_4e7ahZ.js} +1 -1
  14. package/dist/{fastIntent-CINRmM8r.js → fastIntent-DMNzXOSI.js} +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +75 -73
  17. package/dist/native.iife.js +18 -18
  18. package/dist/qna-runtime.js +1 -1
  19. package/dist/qna.iife.js +22 -22
  20. package/dist/qna.js +1 -1
  21. package/dist/{runtime-B0hDHRlN.js → runtime-C51WykbJ.js} +13 -13
  22. package/dist/{runtime-DhdfOJEN.js → runtime-DBh8899B.js} +854 -847
  23. package/dist/{runtime-CLcYqzoA.js → runtime-bbMljGVG.js} +17 -17
  24. package/dist/simbut/index.d.ts +1 -1
  25. package/dist/simbut/types.d.ts +7 -7
  26. package/dist/{simbut-3kqLW3SM.js → simbut-CO1rLVM9.js} +19 -22
  27. package/dist/simbut.iife.js +9 -9
  28. package/dist/simbut.js +1 -1
  29. package/dist/simrel/components/GroupTabs.d.ts +1 -1
  30. package/dist/simrel/types.d.ts +3 -3
  31. package/dist/simrel-runtime.js +1 -1
  32. package/dist/{simrel-fQg2EIB8.js → simrel-zCDlCrqG.js} +1 -1
  33. package/dist/simrel.iife.js +7 -7
  34. package/dist/simrel.js +2 -2
  35. package/dist/{widget-base-bdJaGJYi.js → widget-base-Cf9ofZhh.js} +91 -83
  36. package/package.json +2 -1
  37. package/dist/api-paths-BX3Lea3A.js +0 -1213
package/dist/simrel.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a, i as r, n as t, r as i, t as m } from "./runtime-CLcYqzoA.js";
2
- import { n as R, t as n } from "./simrel-fQg2EIB8.js";
1
+ import { a, i as r, n as t, r as i, t as m } from "./runtime-bbMljGVG.js";
2
+ import { n as R, t as n } from "./simrel-zCDlCrqG.js";
3
3
  export {
4
4
  m as GengageSimRel,
5
5
  i as createDefaultSimRelUISpecRegistry,
@@ -1,5 +1,5 @@
1
- import { o as p, r as y } from "./context-DGz5F81j.js";
2
- function U(e, i) {
1
+ import { o as h, r as y } from "./context-DGz5F81j.js";
2
+ function W(e, i) {
3
3
  const t = {
4
4
  event_name: "stream.start",
5
5
  account_id: e.account_id,
@@ -12,22 +12,22 @@ function U(e, i) {
12
12
  };
13
13
  return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), i.widget !== void 0 && (t.widget = i.widget), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
14
14
  }
15
- function W(e, i) {
15
+ function z(e, i) {
16
16
  const t = {
17
17
  request_id: i.request_id,
18
18
  chunk_index: i.chunk_index
19
19
  };
20
20
  i.latency_ms !== void 0 && (t.latency_ms = i.latency_ms);
21
- const r = {
21
+ const n = {
22
22
  event_name: "stream.chunk",
23
23
  account_id: e.account_id,
24
24
  session_id: e.session_id,
25
25
  correlation_id: e.correlation_id,
26
26
  payload: t
27
27
  };
28
- return e.view_id !== void 0 && (r.view_id = e.view_id), e.user_id !== void 0 && (r.user_id = e.user_id), i.widget !== void 0 && (r.widget = i.widget), e.page_type !== void 0 && (r.page_type = e.page_type), e.sku !== void 0 && (r.sku = e.sku), r;
28
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), i.widget !== void 0 && (n.widget = i.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
29
29
  }
30
- function F(e, i) {
30
+ function Y(e, i) {
31
31
  const t = {
32
32
  event_name: "stream.ui_spec",
33
33
  account_id: e.account_id,
@@ -41,7 +41,7 @@ function F(e, i) {
41
41
  };
42
42
  return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), i.widget !== void 0 && (t.widget = i.widget), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
43
43
  }
44
- function z(e, i) {
44
+ function J(e, i) {
45
45
  const t = {
46
46
  event_name: "stream.done",
47
47
  account_id: e.account_id,
@@ -55,7 +55,7 @@ function z(e, i) {
55
55
  };
56
56
  return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), i.widget !== void 0 && (t.widget = i.widget), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
57
57
  }
58
- function G(e, i) {
58
+ function K(e, i) {
59
59
  const t = {
60
60
  event_name: "stream.error",
61
61
  account_id: e.account_id,
@@ -69,7 +69,7 @@ function G(e, i) {
69
69
  };
70
70
  return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), i.widget !== void 0 && (t.widget = i.widget), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
71
71
  }
72
- function Y(e, i) {
72
+ function j(e, i) {
73
73
  const t = {
74
74
  model: i.model,
75
75
  prompt_tokens: i.prompt_tokens,
@@ -77,16 +77,16 @@ function Y(e, i) {
77
77
  total_tokens: i.total_tokens
78
78
  };
79
79
  i.provider !== void 0 && (t.provider = i.provider);
80
- const r = {
80
+ const n = {
81
81
  event_name: "llm.usage",
82
82
  account_id: e.account_id,
83
83
  session_id: e.session_id,
84
84
  correlation_id: e.correlation_id,
85
85
  payload: t
86
86
  };
87
- return e.view_id !== void 0 && (r.view_id = e.view_id), e.user_id !== void 0 && (r.user_id = e.user_id), e.page_type !== void 0 && (r.page_type = e.page_type), e.sku !== void 0 && (r.sku = e.sku), r;
87
+ return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
88
88
  }
89
- function J(e, i) {
89
+ function Q(e, i) {
90
90
  const t = {
91
91
  event_name: "metering.increment",
92
92
  account_id: e.account_id,
@@ -114,7 +114,7 @@ function w(e, i) {
114
114
  };
115
115
  return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
116
116
  }
117
- function K(e, i) {
117
+ function X(e, i) {
118
118
  const t = {
119
119
  event_name: "chat.history.snapshot",
120
120
  account_id: e.account_id,
@@ -128,7 +128,7 @@ function K(e, i) {
128
128
  };
129
129
  return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
130
130
  }
131
- function j(e, i) {
131
+ function Z(e, i) {
132
132
  const t = {
133
133
  event_name: "widget.history.snapshot",
134
134
  account_id: e.account_id,
@@ -143,7 +143,7 @@ function j(e, i) {
143
143
  };
144
144
  return e.view_id !== void 0 && (t.view_id = e.view_id), e.user_id !== void 0 && (t.user_id = e.user_id), e.page_type !== void 0 && (t.page_type = e.page_type), e.sku !== void 0 && (t.sku = e.sku), t;
145
145
  }
146
- function Q(e, i) {
146
+ function x(e, i) {
147
147
  const t = {
148
148
  event_name: "basket.add",
149
149
  account_id: e.account_id,
@@ -288,7 +288,7 @@ var s = {
288
288
  "--ai-accent-end": "#f768f2",
289
289
  "--ai-accent-soft": "linear-gradient(135deg, rgba(11, 36, 214, 0.08), rgba(247, 104, 242, 0.08))"
290
290
  };
291
- function X(e) {
291
+ function ee(e) {
292
292
  return {
293
293
  ...s,
294
294
  ...e
@@ -308,7 +308,7 @@ var o = "gengage-global-toast-root", c = "gengage-global-toast-style", g = "geng
308
308
  "--ds-toast-error-accent",
309
309
  "--ds-toast-error-fg",
310
310
  "--ds-toast-error-shadow"
311
- ], f = !1, a = null, M = [
311
+ ], f = !1, a = null, L = [
312
312
  /failed to fetch/i,
313
313
  /networkerror/i,
314
314
  /network request failed/i,
@@ -320,36 +320,36 @@ var o = "gengage-global-toast-root", c = "gengage-global-toast-style", g = "geng
320
320
  function l(e) {
321
321
  return typeof e == "string" && e.toLowerCase().startsWith("tr");
322
322
  }
323
- function q(e) {
323
+ function R(e) {
324
324
  if (typeof navigator < "u" && navigator.onLine === !1) return !0;
325
325
  const i = e instanceof Error ? e.message.trim() : "";
326
- return i ? M.some((t) => t.test(i)) : !1;
326
+ return i ? L.some((t) => t.test(i)) : !1;
327
327
  }
328
- function Z(e, i) {
329
- return q(i) ? l(e) ? "Bağlantı sorunu oluştu. Lütfen tekrar deneyin." : "Connection issue. Please try again." : l(e) ? "Bir hata oluştu. Lütfen tekrar deneyin." : "Something went wrong. Please try again.";
328
+ function ie(e, i) {
329
+ return R(i) ? l(e) ? "Bağlantı sorunu oluştu. Lütfen tekrar deneyin." : "Connection issue. Please try again." : l(e) ? "Bir hata oluştu. Lütfen tekrar deneyin." : "Something went wrong. Please try again.";
330
330
  }
331
- function L() {
332
- f || typeof window > "u" || typeof document > "u" || (f = !0, p("gengage:global:error", (e) => {
333
- $(e);
331
+ function $() {
332
+ f || typeof window > "u" || typeof document > "u" || (f = !0, h("gengage:global:error", (e) => {
333
+ M(e);
334
334
  }));
335
335
  }
336
- function $(e) {
336
+ function M(e) {
337
337
  if (typeof document > "u") return;
338
338
  const i = e.message.trim();
339
339
  if (!i) return;
340
- O();
340
+ V();
341
341
  const t = N();
342
342
  D(t), t.innerHTML = "";
343
- const r = document.createElement("section");
344
- r.className = "gengage-global-toast gengage-global-toast--error", r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite");
345
- const n = document.createElement("div");
346
- n.className = "gengage-global-toast-title", n.textContent = A(e.source);
343
+ const n = document.createElement("section");
344
+ n.className = "gengage-global-toast gengage-global-toast--error", n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite");
345
+ const r = document.createElement("div");
346
+ r.className = "gengage-global-toast-title", r.textContent = A(e.source);
347
347
  const d = document.createElement("div");
348
- d.className = "gengage-global-toast-message", d.textContent = i, r.appendChild(n), r.appendChild(d), t.appendChild(r), t.classList.add(g), a && (clearTimeout(a), a = null), e.sticky !== !0 && (a = setTimeout(() => {
349
- R();
350
- }, B(e.durationMs)));
348
+ d.className = "gengage-global-toast-message", d.textContent = i, n.appendChild(r), n.appendChild(d), t.appendChild(n), t.classList.add(g), a && (clearTimeout(a), a = null), e.sticky !== !0 && (a = setTimeout(() => {
349
+ q();
350
+ }, O(e.durationMs)));
351
351
  }
352
- function R() {
352
+ function q() {
353
353
  if (typeof document > "u") return;
354
354
  const e = document.getElementById(o);
355
355
  e && (e.classList.remove(g), e.innerHTML = "", a && (clearTimeout(a), a = null));
@@ -377,19 +377,19 @@ function D(e) {
377
377
  const i = document.querySelector(".gengage-chat-root, .gengage-qna-container, .gengage-simrel-container, .gengage-simbut-root");
378
378
  if (!i) return;
379
379
  const t = window.getComputedStyle(i);
380
- for (const r of S) {
381
- const n = t.getPropertyValue(r).trim();
382
- n ? e.style.setProperty(r, n) : e.style.removeProperty(r);
380
+ for (const n of S) {
381
+ const r = t.getPropertyValue(n).trim();
382
+ r ? e.style.setProperty(n, r) : e.style.removeProperty(n);
383
383
  }
384
384
  }
385
- function B(e) {
385
+ function O(e) {
386
386
  return typeof e != "number" || !Number.isFinite(e) ? C : Math.min(I, Math.max(T, Math.round(e)));
387
387
  }
388
- function O() {
388
+ function V() {
389
389
  if (document.getElementById(c)) return;
390
390
  const e = document.createElement("style");
391
391
  e.id = c;
392
- const i = s["--surface-card"] ?? s.backgroundColor ?? "#ffffff", t = s["--text-primary"] ?? s.foregroundColor ?? "#111827", r = s["--border-default"] ?? "rgba(17, 24, 39, 0.10)", n = s["--error"] ?? "#dc2626", d = s["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", v = s["--radius-card"] ?? "16px", m = s["--text-muted"] ?? "#6b7280";
392
+ const i = s["--surface-card"] ?? s.backgroundColor ?? "#ffffff", t = s["--text-primary"] ?? s.foregroundColor ?? "#111827", n = s["--border-default"] ?? "rgba(17, 24, 39, 0.10)", r = s["--error"] ?? "#dc2626", d = s["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", v = s["--radius-card"] ?? "16px", m = s["--text-muted"] ?? "#6b7280";
393
393
  e.textContent = `
394
394
  #${o} {
395
395
  position: fixed;
@@ -405,10 +405,10 @@ function O() {
405
405
  min-width: 260px;
406
406
  max-width: min(92vw, 420px);
407
407
  border-radius: var(--radius-card, ${v});
408
- border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${n}) 18%, var(--border-default, ${r})));
409
- border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${n}));
410
- background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${n}) 5%, var(--surface-card, ${i})));
411
- color: var(--ds-toast-error-fg, color-mix(in srgb, var(--error, ${n}) 22%, var(--text-primary, ${t})));
408
+ border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${r}) 18%, var(--border-default, ${n})));
409
+ border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${r}));
410
+ background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${r}) 5%, var(--surface-card, ${i})));
411
+ color: var(--ds-toast-error-fg, color-mix(in srgb, var(--error, ${r}) 22%, var(--text-primary, ${t})));
412
412
  box-shadow: var(--ds-toast-error-shadow, var(--shadow-3, ${d}));
413
413
  padding: 10px 12px;
414
414
  font-family: var(--gengage-font-family, ${JSON.stringify(s.fontFamily ?? '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif')});
@@ -439,7 +439,7 @@ function O() {
439
439
  `, document.head.appendChild(e);
440
440
  }
441
441
  var u = null;
442
- function V() {
442
+ function B() {
443
443
  if (u !== null) return u;
444
444
  try {
445
445
  u = localStorage.getItem("gengage:debug") === "1";
@@ -448,12 +448,18 @@ function V() {
448
448
  }
449
449
  return u;
450
450
  }
451
- function h(e, i, t) {
452
- if (!V()) return;
453
- const r = [`[gengage:${e}]`, i];
454
- t !== void 0 && r.push(t), console.debug(...r);
451
+ function p(e, i, t) {
452
+ if (!B()) return;
453
+ const n = [`[gengage:${e}]`, i];
454
+ t !== void 0 && n.push(t), console.debug(...n);
455
+ }
456
+ var G = ("0.4.20".trim(), "0.4.20".trim()), H = ("package-build".trim(), "package-build".trim());
457
+ function P() {
458
+ if (typeof window > "u") return;
459
+ const e = window;
460
+ e.__gengageSdkRuntimeInfoLogged || (e.__gengageSdkRuntimeInfoLogged = !0, console.info(`[gengage] @gengage/assistant-fe v${G} (${H})`));
455
461
  }
456
- var x = class {
462
+ var te = class {
457
463
  constructor() {
458
464
  this.isVisible = !1, this.isInitialised = !1, this._handlers = /* @__PURE__ */ new Map(), this._cleanups = [], this._ownsRoot = !1, this._destroying = !1;
459
465
  }
@@ -463,22 +469,22 @@ var x = class {
463
469
  return;
464
470
  }
465
471
  const i = E(e.theme);
466
- this.config = {
472
+ P(), this.config = {
467
473
  ...e,
468
474
  theme: i,
469
475
  session: y(e.session)
470
- }, this.root = this._resolveMount(e.mountTarget), this._applyTheme(i), L();
471
- const t = p("gengage:context:update", (r) => this.update(r));
472
- this._cleanups.push(t), h("lifecycle", `${this.constructor.name}.init`, {
476
+ }, this.root = this._resolveMount(e.mountTarget), this._applyTheme(i), $();
477
+ const t = h("gengage:context:update", (n) => this.update(n));
478
+ this._cleanups.push(t), p("lifecycle", `${this.constructor.name}.init`, {
473
479
  accountId: e.accountId,
474
480
  sku: e.pageContext?.sku
475
481
  });
476
482
  try {
477
483
  await this.onInit(this.config);
478
- } catch (r) {
479
- throw this.destroy(), r;
484
+ } catch (n) {
485
+ throw this.destroy(), n;
480
486
  }
481
- this._destroying || (this.isInitialised = !0, h("lifecycle", `${this.constructor.name} ready`), this.emit("ready"));
487
+ this._destroying || (this.isInitialised = !0, p("lifecycle", `${this.constructor.name} ready`), this.emit("ready"));
482
488
  }
483
489
  update(e) {
484
490
  this.isInitialised && (this.config.pageContext ? this.config = {
@@ -544,38 +550,40 @@ var x = class {
544
550
  _applyTheme(e) {
545
551
  if (e) {
546
552
  for (const [i, t] of Object.entries(e)) if (t !== void 0) {
547
- const r = i.startsWith("--") ? i : `--gengage-${H(i)}`;
548
- this.root.style.setProperty(r, t);
553
+ const n = i.startsWith("--") ? i : `--gengage-${U(i)}`;
554
+ this.root.style.setProperty(n, t);
549
555
  }
550
556
  }
551
557
  }
552
558
  };
553
- function H(e) {
559
+ function U(e) {
554
560
  return e.replace(/([A-Z])/g, "-$1").toLowerCase();
555
561
  }
556
562
  export {
557
- F as C,
558
- U as S,
559
- J as _,
563
+ K as C,
564
+ Z as E,
565
+ J as S,
566
+ Y as T,
567
+ b as _,
560
568
  q as a,
561
- z as b,
562
- s as c,
563
- E as d,
564
- Q as f,
565
- Y as g,
566
- b as h,
567
- Z as i,
568
- X as l,
569
- k as m,
570
- h as n,
571
- L as o,
572
- K as p,
573
- R as r,
574
- $ as s,
575
- x as t,
576
- _ as u,
577
- w as v,
578
- j as w,
579
- G as x,
580
- W as y
569
+ w as b,
570
+ $ as c,
571
+ ee as d,
572
+ _ as f,
573
+ k as g,
574
+ X as h,
575
+ p as i,
576
+ M as l,
577
+ x as m,
578
+ H as n,
579
+ ie as o,
580
+ E as p,
581
+ G as r,
582
+ R as s,
583
+ te as t,
584
+ s as u,
585
+ j as v,
586
+ W as w,
587
+ z as x,
588
+ Q as y
581
589
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gengage/assistant-fe",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
4
4
  "description": "Source-available frontend widgets for Gengage AI Assistant — chat, Q&A, and similar-products. Backend is SaaS (gengage.ai).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -101,6 +101,7 @@
101
101
  "n11comPLP": "npm run dev -- n11comPLP --sku=726304379",
102
102
  "hepsiburadacom": "npm run dev -- hepsiburadacom --sku=HBCV00001ABCDE",
103
103
  "yatasbeddingcomtr": "npm run dev -- yatasbeddingcomtr --sku=1066800",
104
+ "yatsancom": "npm run dev -- yatsancom --sku=MM-048688",
104
105
  "taccomtr": "npm run dev -- taccomtr --sku=1000050442",
105
106
  "penticom": "npm run dev -- penticom --sku=PLNADGST22IY-BG40",
106
107
  "flormarcomtr": "npm run dev -- flormarcomtr --sku=8682536017985",