@gengage/assistant-fe 0.3.34 → 0.3.36

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 (33) hide show
  1. package/README.md +4 -0
  2. package/dist/chat/components/ChatDrawer.d.ts +17 -10
  3. package/dist/chat/components/ComparisonTable.d.ts +2 -1
  4. package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +10 -0
  5. package/dist/chat/index.d.ts +4 -1
  6. package/dist/chat/session-persistence.d.ts +2 -1
  7. package/dist/chat/types.d.ts +1 -0
  8. package/dist/{chat-BTEzcajz.js → chat-BJu5cvMq.js} +2042 -1982
  9. package/dist/chat.iife.js +39 -39
  10. package/dist/chat.js +11 -10
  11. package/dist/common/action-router.d.ts +1 -0
  12. package/dist/common/locale.d.ts +1 -0
  13. package/dist/common/navigation.d.ts +5 -0
  14. package/dist/{common-sIQyC3Kp.js → common-C50zU8bu.js} +2 -2
  15. package/dist/common.js +41 -41
  16. package/dist/{connection-warning-CHHi3BAf.js → connection-warning-nm_yulO-.js} +9 -9
  17. package/dist/{ga-datalayer-BwxWX-cr.js → ga-datalayer-BUM5z5Pq.js} +65 -60
  18. package/dist/index.js +31 -31
  19. package/dist/{native-webview-nUmdIN_8.js → native-webview-CrnoI_JS.js} +31 -31
  20. package/dist/native.iife.js +36 -36
  21. package/dist/native.js +1 -1
  22. package/dist/{product-utils-Bm3aiAlJ.js → price-formatter-CR6VT5z4.js} +27 -27
  23. package/dist/{qna-BuBvAr2H.js → qna-6_XrdLG_.js} +85 -85
  24. package/dist/qna.iife.js +6 -6
  25. package/dist/qna.js +1 -1
  26. package/dist/{schemas-DBRIy5NT.js → schemas-ZYhTx11k.js} +1 -1
  27. package/dist/{simbut-BBXTlzOg.js → simbut--wBhTxId.js} +29 -29
  28. package/dist/simbut.iife.js +7 -7
  29. package/dist/simbut.js +1 -1
  30. package/dist/{simrel-BRh5eB2K.js → simrel-5I3yDyyo.js} +65 -65
  31. package/dist/simrel.iife.js +5 -5
  32. package/dist/simrel.js +1 -1
  33. package/package.json +29 -2
@@ -1,9 +1,9 @@
1
- import { a as k, c as h, i as D, o as f, r as m, t as A } from "./schemas-DBRIy5NT.js";
2
- import { I as H, M as Q, b as M, z as K } from "./ga-datalayer-BwxWX-cr.js";
3
- import { t as V } from "./chat-BTEzcajz.js";
4
- import { t as $ } from "./qna-BuBvAr2H.js";
5
- import { t as j } from "./simrel-BRh5eB2K.js";
6
- import { t as G } from "./simbut-BBXTlzOg.js";
1
+ import { a as k, c as h, i as D, o as f, r as m, t as A } from "./schemas-ZYhTx11k.js";
2
+ import { B as H, L as Q, N as K, x as M } from "./ga-datalayer-BUM5z5Pq.js";
3
+ import { t as V } from "./chat-BJu5cvMq.js";
4
+ import { t as $ } from "./qna-6_XrdLG_.js";
5
+ import { t as j } from "./simrel-5I3yDyyo.js";
6
+ import { t as G } from "./simbut--wBhTxId.js";
7
7
  var b = f({ enabled: m().default(!0) }), Y = f({
8
8
  chat: h().optional(),
9
9
  qna: h().optional(),
@@ -31,8 +31,8 @@ var b = f({ enabled: m().default(!0) }), Y = f({
31
31
  keepaliveFetch: m().default(!0),
32
32
  timeoutMs: k().int().positive().default(4e3),
33
33
  maxRetries: k().int().min(0).max(5).default(1)
34
- }), R = "__gengageWidgetsInit", ee = f({
35
- idempotencyKey: h().default(R),
34
+ }), L = "__gengageWidgetsInit", ee = f({
35
+ idempotencyKey: h().default(L),
36
36
  requireDomReady: m().default(!0)
37
37
  }), te = A([
38
38
  "log-and-ignore",
@@ -41,7 +41,7 @@ var b = f({ enabled: m().default(!0) }), Y = f({
41
41
  ]), ie = f({
42
42
  unknownActionPolicy: te.default("log-and-ignore"),
43
43
  allowScriptCall: m().default(!1)
44
- }), L = f({
44
+ }), R = f({
45
45
  version: D("1", { error: 'version must be "1"' }),
46
46
  accountId: h({ error: "accountId must be a non-empty string" }).min(1, { error: "accountId must be a non-empty string" }),
47
47
  middlewareUrl: h({ error: 'middlewareUrl must be a valid URL (e.g. "https://your-backend.example.com")' }).url({ error: 'middlewareUrl must be a valid URL (e.g. "https://your-backend.example.com")' }),
@@ -78,16 +78,16 @@ var b = f({ enabled: m().default(!0) }), Y = f({
78
78
  });
79
79
  function ne(e) {
80
80
  M("config", "parsing account runtime config", e);
81
- const t = L.parse(e);
81
+ const t = R.parse(e);
82
82
  return M("config", "config resolved", {
83
83
  accountId: t.accountId,
84
84
  middlewareUrl: t.middlewareUrl
85
85
  }), t;
86
86
  }
87
87
  function qe(e) {
88
- return L.safeParse(e);
88
+ return R.safeParse(e);
89
89
  }
90
- function Se(e) {
90
+ function Ne(e) {
91
91
  return ne({
92
92
  version: "1",
93
93
  accountId: e.accountId,
@@ -101,7 +101,7 @@ function Se(e) {
101
101
  }
102
102
  });
103
103
  }
104
- var P = `${R}_overlay_`, se = "#gengage-qna", oe = "#gengage-simrel", ae = "#gengage-simbut";
104
+ var B = `${L}_overlay_`, se = "#gengage-qna", oe = "#gengage-simrel", ae = "#gengage-simbut";
105
105
  function q() {
106
106
  const e = window;
107
107
  return e.__gengageOverlayRegistry || (e.__gengageOverlayRegistry = {
@@ -124,12 +124,12 @@ function de(e, t) {
124
124
  function I(e) {
125
125
  return e instanceof HTMLElement || document.querySelector(e) ? e : null;
126
126
  }
127
- function B(e) {
128
- return e.idempotencyKey ?? `${P}${e.accountId}`;
127
+ function P(e) {
128
+ return e.idempotencyKey ?? `${B}${e.accountId}`;
129
129
  }
130
130
  var le = class {
131
131
  constructor(e, t) {
132
- this.options = e, this.onDestroy = t, this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, this._analyticsClient = null, this._offQnaWire = null, this._destroyed = !1, this._queue = Promise.resolve(), this._warnedQnaMountMissing = !1, this._warnedSimRelMountMissing = !1, this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this.idempotencyKey = B(e), this.session = Q(e.session), this._pageContext = re(e);
132
+ this.options = e, this.onDestroy = t, this._chat = null, this._qna = null, this._simrel = null, this._simbut = null, this._analyticsClient = null, this._offQnaWire = null, this._destroyed = !1, this._queue = Promise.resolve(), this._warnedQnaMountMissing = !1, this._warnedSimRelMountMissing = !1, this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this.idempotencyKey = P(e), this.session = K(e.session), this._pageContext = re(e);
133
133
  }
134
134
  get chat() {
135
135
  return this._chat;
@@ -147,7 +147,7 @@ var le = class {
147
147
  return this._analyticsClient;
148
148
  }
149
149
  async init() {
150
- window.gengage || (window.gengage = {}), window.gengage.sessionId = this.session.sessionId, window.gengage.pageContext = this._pageContext, await this._initChat(), this.options.wireQnaToChat !== !1 && (this._offQnaWire = H()), await this._syncPdpWidgets(), window.gengage.overlay = this;
150
+ window.gengage || (window.gengage = {}), window.gengage.sessionId = this.session.sessionId, window.gengage.pageContext = this._pageContext, await this._initChat(), this.options.wireQnaToChat !== !1 && (this._offQnaWire = Q()), await this._syncPdpWidgets(), window.gengage.overlay = this;
151
151
  }
152
152
  openChat(e) {
153
153
  this._chat?.open(e);
@@ -238,7 +238,7 @@ var le = class {
238
238
  mountTarget: s
239
239
  };
240
240
  this.options.theme !== void 0 && (n.theme = this.options.theme), this.options.pricing !== void 0 && (n.pricing = this.options.pricing), this.options.simrel?.discountType !== void 0 && (n.discountType = this.options.simrel.discountType), this.options.simrel?.renderCardElement !== void 0 && (n.renderCardElement = this.options.simrel.renderCardElement), this.options.simrel?.renderer !== void 0 && (n.renderer = this.options.simrel.renderer), this.options.onAddToCart !== void 0 && (n.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 ? n.onProductNavigate = this.options.onProductNavigate : n.onProductNavigate = (d, c, a) => {
241
- K(d) && (this._chat?.saveSession(a ?? this.session.sessionId, c), window.location.href = d);
241
+ H(d) && (this._chat?.saveSession(a ?? this.session.sessionId, c), window.location.href = d);
242
242
  }, await o.init(n), this._simrel = o;
243
243
  }
244
244
  else
@@ -279,7 +279,7 @@ var le = class {
279
279
  }
280
280
  };
281
281
  async function ue(e) {
282
- const t = B(e), i = q(), s = i.instances[t];
282
+ const t = P(e), i = q(), s = i.instances[t];
283
283
  if (s) return s;
284
284
  const o = i.pending[t];
285
285
  if (o) return o;
@@ -294,11 +294,11 @@ async function ue(e) {
294
294
  function ce(e) {
295
295
  return q().instances[e] ?? null;
296
296
  }
297
- function Ne(e) {
297
+ function Se(e) {
298
298
  ce(e)?.destroy();
299
299
  }
300
300
  function ke(e) {
301
- return `${P}${e}`;
301
+ return `${B}${e}`;
302
302
  }
303
303
  var ge = [
304
304
  "gengage:chat:open",
@@ -356,11 +356,11 @@ function fe(e) {
356
356
  }
357
357
  return null;
358
358
  }
359
- function S(e, t) {
359
+ function N(e, t) {
360
360
  return t instanceof HTMLElement ? !0 : typeof t != "string" ? !1 : e.document.querySelector(t) !== null;
361
361
  }
362
362
  function E(e, t, i) {
363
- if (t instanceof HTMLElement || S(e, t) || typeof t != "string") return t;
363
+ if (t instanceof HTMLElement || N(e, t) || typeof t != "string") return t;
364
364
  if (t.startsWith("#")) {
365
365
  const n = t.slice(1);
366
366
  if (n.length > 0) {
@@ -455,8 +455,8 @@ function ye(e = {}) {
455
455
  }, W = () => {
456
456
  if (!a || u.length === 0) return;
457
457
  const l = u.splice(0, u.length);
458
- for (const r of l) N(r);
459
- }, N = (l) => {
458
+ for (const r of l) S(r);
459
+ }, S = (l) => {
460
460
  const r = pe(l);
461
461
  if (!r || typeof r.type != "string") {
462
462
  console.warn("[gengage:native-bridge] Invalid message:", l);
@@ -500,7 +500,7 @@ function ye(e = {}) {
500
500
  }, C = {
501
501
  env: c,
502
502
  sendToNative: v,
503
- receive: N,
503
+ receive: S,
504
504
  setController(l) {
505
505
  a = l, W();
506
506
  },
@@ -536,7 +536,7 @@ async function Me(e) {
536
536
  enabled: !0,
537
537
  mountTarget: u
538
538
  };
539
- } else S(window, x) || (n.qna = { enabled: !1 });
539
+ } else N(window, x) || (n.qna = { enabled: !1 });
540
540
  const c = n.simrel?.enabled === !0 || n.simrel?.mountTarget !== void 0;
541
541
  if (n.simrel?.enabled !== !1)
542
542
  if (c) {
@@ -546,7 +546,7 @@ async function Me(e) {
546
546
  enabled: !0,
547
547
  mountTarget: u
548
548
  };
549
- } else S(window, U) || (n.simrel = { enabled: !1 });
549
+ } else N(window, U) || (n.simrel = { enabled: !1 });
550
550
  const a = await ue(n);
551
551
  return o.setController(a), i && o.sendToNative("ready", {
552
552
  sessionId: a.session.sessionId,
@@ -574,9 +574,9 @@ export {
574
574
  ne as m,
575
575
  ve as n,
576
576
  ke as o,
577
- Se as p,
577
+ Ne as p,
578
578
  ye as r,
579
- Ne as s,
579
+ Se as s,
580
580
  ge as t,
581
- L as u
581
+ R as u
582
582
  };