@gengage/assistant-fe 0.4.1 → 0.4.2

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/dist/chat.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as e, f as t, i as r, l as s, m as n, n as i, o as l, p as C, r as c, s as h, t as o } from "./chat-C9l4oBJA.js";
1
+ import { c as e, f as t, i as r, l as s, m as n, n as i, o as l, p as C, r as c, s as h, t as o } from "./chat-Ci4ZA37X.js";
2
2
  export {
3
3
  t as CHAT_SCROLL_ELEMENT_ID,
4
4
  l as ChatPresentationState,
@@ -31,6 +31,10 @@ export interface OverlayChatOptions {
31
31
  productDetailsExtended?: boolean;
32
32
  /** Hides percent discount badges on chat product cards / details when true. */
33
33
  hideProductDiscountBadge?: ChatWidgetConfig['hideProductDiscountBadge'];
34
+ /** When true, hides user reviews (ReviewHighlights, review chip, AITopPicks reviewHighlight). */
35
+ hideUserReviews?: ChatWidgetConfig['hideUserReviews'];
36
+ /** When true, hides in-stock / out-of-stock labels on product cards. */
37
+ hideStockStatus?: ChatWidgetConfig['hideStockStatus'];
34
38
  isDemoWebsite?: ChatWidgetConfig['isDemoWebsite'];
35
39
  /** Pill launcher — forwarded to `chat.pillLauncher` (applied inside GengageChat). */
36
40
  pillLauncher?: ChatWidgetConfig['pillLauncher'];
@@ -1,5 +1,5 @@
1
1
  import { f as u } from "./schemas-JFGRVTVz.js";
2
- import { h, l as f } from "./native-webview-FnIiDil0.js";
2
+ import { h, l as f } from "./native-webview-v2HYw_9X.js";
3
3
  var m = {
4
4
  enabled: !0,
5
5
  endpoint: "/analytics",
package/dist/common.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { C as a, S as t, b as s, d as r, f as n, g as i, h as o, m as c, p as m, v as l, w as g, x as d, y as u } from "./schemas-JFGRVTVz.js";
2
2
  import { $ as E, G as S, J as h, K as v, Q as y, V as f, X as C, Y as A, Z as T, _ as w, a as U, b as W, c as I, d as P, et as b, f as D, g as R, h as k, i as G, it as O, l as N, m as _, n as x, nt as L, p as M, q as z, rt as B, s as H, tt as K, u as F, v as V, y as Q } from "./locale-MM0U5eeR.js";
3
- import { a as Z, d as J, h as X, u as Y } from "./chat-C9l4oBJA.js";
3
+ import { a as Z, d as J, h as X, u as Y } from "./chat-Ci4ZA37X.js";
4
4
  import { n as j, t as ee } from "./connection-warning-n88bjkqL.js";
5
- import { a as te, c as se, d as re, f as ne, h as ie, i as oe, l as ce, m as me, n as le, o as ge, p as de, r as ue, s as pe, u as Ee } from "./native-webview-FnIiDil0.js";
6
- import { a as he, c as ve, d as ye, f as fe, i as Ce, l as Ae, n as Te, o as we, p as Ue, r as We, s as Ie, t as Pe, u as be } from "./common-CiTC1BDg.js";
5
+ import { a as te, c as se, d as re, f as ne, h as ie, i as oe, l as ce, m as me, n as le, o as ge, p as de, r as ue, s as pe, u as Ee } from "./native-webview-v2HYw_9X.js";
6
+ import { a as he, c as ve, d as ye, f as fe, i as Ce, l as Ae, n as Te, o as we, p as Ue, r as We, s as Ie, t as Pe, u as be } from "./common-DUMmqYxM.js";
7
7
  export {
8
8
  Ee as AccountRuntimeConfigSchema,
9
9
  re as AnalyticsAuthModeSchema,
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { C as a, b as t, d as s, f as i, w as n, x as r } from "./schemas-JFGRVTVz.js";
2
2
  import { V as c, _ as m, b as l, d, f as g, g as p, l as u, p as f, u as S, v as C, y as h } from "./locale-MM0U5eeR.js";
3
- import { a as y, c as A, d as I, h as R, l as T, n as W, s as w, t as D, u as E } from "./chat-C9l4oBJA.js";
3
+ import { a as y, c as A, d as I, h as R, l as T, n as W, s as w, t as D, u as E } from "./chat-Ci4ZA37X.js";
4
4
  import { t as N } from "./connection-warning-n88bjkqL.js";
5
5
  import { a as P, i as G, n as _, o as k, t as Q } from "./qna-CQugVOHy.js";
6
6
  import { a as L, i as x, n as B, o as M, t as F } from "./simrel-DjzpRZmZ.js";
7
7
  import { n as H, t as K } from "./simbut-Cb5RfaAp.js";
8
- import { a as Z, c as j, d as q, f as J, h as X, i as Y, l as $, m as ee, n as ae, o as te, p as se, r as ie, s as ne, u as re } from "./native-webview-FnIiDil0.js";
9
- import { a as ce, c as me, d as le, i as de, l as ge, n as pe, o as ue, p as fe, r as Se, s as Ce, t as he, u as Ue } from "./common-CiTC1BDg.js";
8
+ import { a as Z, c as j, d as q, f as J, h as X, i as Y, l as $, m as ee, n as ae, o as te, p as se, r as ie, s as ne, u as re } from "./native-webview-v2HYw_9X.js";
9
+ import { a as ce, c as me, d as le, i as de, l as ge, n as pe, o as ue, p as fe, r as Se, s as Ce, t as he, u as Ue } from "./common-DUMmqYxM.js";
10
10
  export {
11
11
  re as AccountRuntimeConfigSchema,
12
12
  q as AnalyticsAuthModeSchema,
@@ -1,10 +1,10 @@
1
- import { a as k, c as h, i as W, o as f, r as m, t as A } from "./schemas-JFGRVTVz.js";
1
+ import { a as N, c as h, i as W, o as f, r as m, t as A } from "./schemas-JFGRVTVz.js";
2
2
  import { U as H, h as Q, j, r as M, y as K } from "./locale-MM0U5eeR.js";
3
- import { t as V } from "./chat-C9l4oBJA.js";
3
+ import { t as V } from "./chat-Ci4ZA37X.js";
4
4
  import { t as $ } from "./qna-CQugVOHy.js";
5
5
  import { t as G } from "./simrel-DjzpRZmZ.js";
6
6
  import { t as Y } from "./simbut-Cb5RfaAp.js";
7
- var b = f({ enabled: m().default(!0) }), J = f({
7
+ var w = f({ enabled: m().default(!0) }), J = f({
8
8
  chat: h().optional(),
9
9
  qna: h().optional(),
10
10
  simrel: h().optional(),
@@ -29,8 +29,8 @@ var b = f({ enabled: m().default(!0) }), J = f({
29
29
  fireAndForget: m().default(!0),
30
30
  useBeacon: m().default(!0),
31
31
  keepaliveFetch: m().default(!0),
32
- timeoutMs: k().int().positive().default(4e3),
33
- maxRetries: k().int().min(0).max(5).default(1)
32
+ timeoutMs: N().int().positive().default(4e3),
33
+ maxRetries: N().int().min(0).max(5).default(1)
34
34
  }), R = "__gengageWidgetsInit", te = f({
35
35
  idempotencyKey: h().default(R),
36
36
  requireDomReady: m().default(!0)
@@ -47,10 +47,10 @@ var b = f({ enabled: m().default(!0) }), J = f({
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")' }),
48
48
  locale: h().optional(),
49
49
  widgets: f({
50
- chat: b.default({ enabled: !0 }),
51
- qna: b.default({ enabled: !0 }),
52
- simrel: b.optional(),
53
- simbut: b.default({ enabled: !1 })
50
+ chat: w.default({ enabled: !0 }),
51
+ qna: w.default({ enabled: !0 }),
52
+ simrel: w.optional(),
53
+ simbut: w.default({ enabled: !1 })
54
54
  }),
55
55
  mounts: J.default({}),
56
56
  transport: X.default({}),
@@ -84,10 +84,10 @@ function se(e) {
84
84
  middlewareUrl: t.middlewareUrl
85
85
  }), t;
86
86
  }
87
- function qe(e) {
87
+ function ke(e) {
88
88
  return L.safeParse(e);
89
89
  }
90
- function Ne(e) {
90
+ function qe(e) {
91
91
  return se({
92
92
  version: "1",
93
93
  accountId: e.accountId,
@@ -101,7 +101,7 @@ function Ne(e) {
101
101
  });
102
102
  }
103
103
  var P = `${R}_overlay_`, oe = "#gengage-qna", ae = "#gengage-simrel", re = "#gengage-simbut";
104
- function S() {
104
+ function I() {
105
105
  const e = window;
106
106
  return e.__gengageOverlayRegistry || (e.__gengageOverlayRegistry = {
107
107
  instances: {},
@@ -120,7 +120,7 @@ function le(e, t) {
120
120
  };
121
121
  return t.pageType !== void 0 && t.pageType !== e.pageType ? (t.pageType !== "pdp" && t.sku === void 0 && delete i.sku, t.pageType !== "plp" && t.skuList === void 0 && delete i.skuList) : (t.sku === void 0 && e.sku !== void 0 && (i.sku = e.sku), t.skuList === void 0 && e.skuList !== void 0 && (i.skuList = e.skuList)), i;
122
122
  }
123
- function I(e) {
123
+ function S(e) {
124
124
  return e instanceof HTMLElement || document.querySelector(e) ? e : null;
125
125
  }
126
126
  function B(e) {
@@ -183,7 +183,7 @@ var ce = class {
183
183
  pageContext: this._pageContext,
184
184
  variant: this.options.chat?.variant ?? "floating"
185
185
  };
186
- this.options.theme !== void 0 && (s.theme = this.options.theme), this.options.locale !== void 0 && (s.locale = this.options.locale), this.options.pricing !== void 0 && (s.pricing = this.options.pricing), this.options.chat?.mountTarget !== void 0 && (s.mountTarget = this.options.chat.mountTarget), this.options.chat?.pillLauncher !== void 0 && (s.pillLauncher = this.options.chat.pillLauncher), this.options.chat?.launcherImageUrl !== void 0 ? s.launcherImageUrl = this.options.chat.launcherImageUrl : this.options.chat?.launcherSvg !== void 0 && (s.launcherSvg = this.options.chat.launcherSvg), this.options.chat?.headerTitle !== void 0 && (s.headerTitle = this.options.chat.headerTitle), this.options.chat?.headerAvatarUrl !== void 0 && (s.headerAvatarUrl = this.options.chat.headerAvatarUrl), this.options.chat?.headerBadge !== void 0 && (s.headerBadge = this.options.chat.headerBadge), this.options.chat?.headerCartUrl !== void 0 && (s.headerCartUrl = this.options.chat.headerCartUrl), this.options.chat?.headerFavoritesToggle !== void 0 && (s.headerFavoritesToggle = this.options.chat.headerFavoritesToggle), this.options.chat?.onFavoritesClick !== void 0 && (s.onFavoritesClick = this.options.chat.onFavoritesClick), this.options.chat?.hideMobileLauncher !== void 0 && (s.hideMobileLauncher = this.options.chat.hideMobileLauncher), this.options.chat?.mobileBreakpoint !== void 0 && (s.mobileBreakpoint = this.options.chat.mobileBreakpoint), this.options.chat?.mobileInitialState !== void 0 && (s.mobileInitialState = this.options.chat.mobileInitialState), this.options.chat?.i18n !== void 0 && (s.i18n = this.options.chat.i18n), this.options.chat?.actionHandling !== void 0 && (s.actionHandling = this.options.chat.actionHandling), this.options.chat?.renderer !== void 0 && (s.renderer = this.options.chat.renderer), t !== void 0 && (s.productDetailsExtended = t), i !== void 0 && (s.isDemoWebsite = i), this.options.chat?.productPriceUi !== void 0 && (s.productPriceUi = this.options.chat.productPriceUi), this.options.chat?.hideProductDiscountBadge !== void 0 && (s.hideProductDiscountBadge = this.options.chat.hideProductDiscountBadge), this.options.onScriptCall !== void 0 && (s.onScriptCall = this.options.onScriptCall), this.options.onAddToCart !== void 0 && (s.onAddToCart = this.options.onAddToCart), this.options.chat?.onOpen !== void 0 && (s.onOpen = this.options.chat.onOpen), this.options.chat?.onClose !== void 0 && (s.onClose = this.options.chat.onClose), this._chat = new V(), await this._chat.init(s);
186
+ this.options.theme !== void 0 && (s.theme = this.options.theme), this.options.locale !== void 0 && (s.locale = this.options.locale), this.options.pricing !== void 0 && (s.pricing = this.options.pricing), this.options.chat?.mountTarget !== void 0 && (s.mountTarget = this.options.chat.mountTarget), this.options.chat?.pillLauncher !== void 0 && (s.pillLauncher = this.options.chat.pillLauncher), this.options.chat?.launcherImageUrl !== void 0 ? s.launcherImageUrl = this.options.chat.launcherImageUrl : this.options.chat?.launcherSvg !== void 0 && (s.launcherSvg = this.options.chat.launcherSvg), this.options.chat?.headerTitle !== void 0 && (s.headerTitle = this.options.chat.headerTitle), this.options.chat?.headerAvatarUrl !== void 0 && (s.headerAvatarUrl = this.options.chat.headerAvatarUrl), this.options.chat?.headerBadge !== void 0 && (s.headerBadge = this.options.chat.headerBadge), this.options.chat?.headerCartUrl !== void 0 && (s.headerCartUrl = this.options.chat.headerCartUrl), this.options.chat?.headerFavoritesToggle !== void 0 && (s.headerFavoritesToggle = this.options.chat.headerFavoritesToggle), this.options.chat?.onFavoritesClick !== void 0 && (s.onFavoritesClick = this.options.chat.onFavoritesClick), this.options.chat?.hideMobileLauncher !== void 0 && (s.hideMobileLauncher = this.options.chat.hideMobileLauncher), this.options.chat?.mobileBreakpoint !== void 0 && (s.mobileBreakpoint = this.options.chat.mobileBreakpoint), this.options.chat?.mobileInitialState !== void 0 && (s.mobileInitialState = this.options.chat.mobileInitialState), this.options.chat?.i18n !== void 0 && (s.i18n = this.options.chat.i18n), this.options.chat?.actionHandling !== void 0 && (s.actionHandling = this.options.chat.actionHandling), this.options.chat?.renderer !== void 0 && (s.renderer = this.options.chat.renderer), t !== void 0 && (s.productDetailsExtended = t), i !== void 0 && (s.isDemoWebsite = i), this.options.chat?.productPriceUi !== void 0 && (s.productPriceUi = this.options.chat.productPriceUi), this.options.chat?.hideProductDiscountBadge !== void 0 && (s.hideProductDiscountBadge = this.options.chat.hideProductDiscountBadge), this.options.chat?.hideUserReviews !== void 0 && (s.hideUserReviews = this.options.chat.hideUserReviews), this.options.chat?.hideStockStatus !== void 0 && (s.hideStockStatus = this.options.chat.hideStockStatus), this.options.onScriptCall !== void 0 && (s.onScriptCall = this.options.onScriptCall), this.options.onAddToCart !== void 0 && (s.onAddToCart = this.options.onAddToCart), this.options.chat?.onOpen !== void 0 && (s.onOpen = this.options.chat.onOpen), this.options.chat?.onClose !== void 0 && (s.onClose = this.options.chat.onClose), this._chat = new V(), await this._chat.init(s);
187
187
  }
188
188
  async _syncPdpWidgets() {
189
189
  if (this._destroyed) return;
@@ -194,7 +194,7 @@ var ce = class {
194
194
  }
195
195
  const t = this.options.middlewareUrl;
196
196
  if (this.options.qna?.enabled !== !1) {
197
- const i = this.options.qna?.mountTarget ?? oe, s = I(i);
197
+ const i = this.options.qna?.mountTarget ?? oe, s = S(i);
198
198
  if (s)
199
199
  if (this._warnedQnaMountMissing = !1, this._qna)
200
200
  this._qna.show(), this._qna.update({
@@ -221,7 +221,7 @@ var ce = class {
221
221
  } else
222
222
  this._qna?.destroy(), this._qna = null;
223
223
  if (this.options.simrel !== void 0 && this.options.simrel.enabled !== !1) {
224
- const i = this.options.simrel?.mountTarget ?? ae, s = I(i);
224
+ const i = this.options.simrel?.mountTarget ?? ae, s = S(i);
225
225
  if (s)
226
226
  if (this._warnedSimRelMountMissing = !1, this._simrel)
227
227
  this._simrel.show(), this._simrel.update({
@@ -245,7 +245,7 @@ var ce = class {
245
245
  } else
246
246
  this._simrel?.destroy(), this._simrel = null;
247
247
  if (this.options.simbut && this.options.simbut.enabled !== !1) {
248
- const i = this.options.simbut.mountTarget ?? re, s = I(i), o = this._chat ?? this.options.simbut.onFindSimilar;
248
+ const i = this.options.simbut.mountTarget ?? re, s = S(i), o = this._chat ?? this.options.simbut.onFindSimilar;
249
249
  if (s && o)
250
250
  if (this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this._simbut)
251
251
  this._simbut.show(), this._simbut.setChat(this._chat), this._simbut.update({
@@ -278,12 +278,12 @@ var ce = class {
278
278
  }
279
279
  };
280
280
  async function ue(e) {
281
- const t = B(e), i = S(), s = i.instances[t];
281
+ const t = B(e), i = I(), s = i.instances[t];
282
282
  if (s) return s;
283
283
  const o = i.pending[t];
284
284
  if (o) return o;
285
285
  const n = new ce(e, () => {
286
- const l = S();
286
+ const l = I();
287
287
  delete l.instances[t], delete l.pending[t];
288
288
  }), d = n.init().then(() => (i.instances[t] = n, delete i.pending[t], n)).catch((l) => {
289
289
  throw delete i.pending[t], j({
@@ -294,9 +294,9 @@ async function ue(e) {
294
294
  return i.pending[t] = d, d;
295
295
  }
296
296
  function ge(e) {
297
- return S().instances[e] ?? null;
297
+ return I().instances[e] ?? null;
298
298
  }
299
- function ke(e) {
299
+ function Ne(e) {
300
300
  ge(e)?.destroy();
301
301
  }
302
302
  function Me(e) {
@@ -360,11 +360,11 @@ function me(e) {
360
360
  }
361
361
  return null;
362
362
  }
363
- function q(e, t) {
363
+ function k(e, t) {
364
364
  return t instanceof HTMLElement ? !0 : typeof t != "string" ? !1 : e.document.querySelector(t) !== null;
365
365
  }
366
366
  function E(e, t, i) {
367
- if (t instanceof HTMLElement || q(e, t) || typeof t != "string") return t;
367
+ if (t instanceof HTMLElement || k(e, t) || typeof t != "string") return t;
368
368
  if (t.startsWith("#")) {
369
369
  const n = t.slice(1);
370
370
  if (n.length > 0) {
@@ -383,13 +383,13 @@ function D(e, t) {
383
383
  const i = e.webkit?.messageHandlers?.[t];
384
384
  return i && typeof i.postMessage == "function" ? i.postMessage.bind(i) : null;
385
385
  }
386
- function w(e, t) {
386
+ function b(e, t) {
387
387
  const i = e[t];
388
388
  return i && typeof i == "object" && typeof i.postMessage == "function" ? i : null;
389
389
  }
390
390
  function ve(e = {}) {
391
391
  const t = e.win ?? window, i = e.iosHandlerName ?? "gengage", s = e.androidInterfaceName ?? "GengageNative", o = e.reactNativeInterfaceName ?? "ReactNativeWebView";
392
- return D(t, i) ? "ios" : w(t, s) ? "android" : w(t, o) ? "react-native" : "browser";
392
+ return D(t, i) ? "ios" : b(t, s) ? "android" : b(t, o) ? "react-native" : "browser";
393
393
  }
394
394
  function ye(e, t = {}) {
395
395
  const i = t.win ?? window;
@@ -426,11 +426,11 @@ function _e(e = {}) {
426
426
  return;
427
427
  }
428
428
  if (l === "android") {
429
- w(t, o)?.postMessage(JSON.stringify(p));
429
+ b(t, o)?.postMessage(JSON.stringify(p));
430
430
  return;
431
431
  }
432
432
  if (l === "react-native") {
433
- w(t, n)?.postMessage(JSON.stringify(p));
433
+ b(t, n)?.postMessage(JSON.stringify(p));
434
434
  return;
435
435
  }
436
436
  }, y = (c) => {
@@ -459,8 +459,8 @@ function _e(e = {}) {
459
459
  }, F = () => {
460
460
  if (!a || u.length === 0) return;
461
461
  const c = u.splice(0, u.length);
462
- for (const r of c) N(r);
463
- }, N = (c) => {
462
+ for (const r of c) q(r);
463
+ }, q = (c) => {
464
464
  const r = fe(c);
465
465
  if (!r || typeof r.type != "string") {
466
466
  console.warn("[gengage:native-bridge] Invalid message:", c);
@@ -504,7 +504,7 @@ function _e(e = {}) {
504
504
  }, C = {
505
505
  env: l,
506
506
  sendToNative: v,
507
- receive: N,
507
+ receive: q,
508
508
  setController(c) {
509
509
  a = c, F();
510
510
  },
@@ -540,7 +540,7 @@ async function xe(e) {
540
540
  enabled: !0,
541
541
  mountTarget: u
542
542
  };
543
- } else q(window, x) || (n.qna = { enabled: !1 });
543
+ } else k(window, x) || (n.qna = { enabled: !1 });
544
544
  const l = n.simrel?.enabled === !0 || n.simrel?.mountTarget !== void 0;
545
545
  if (n.simrel?.enabled !== !1)
546
546
  if (l) {
@@ -550,7 +550,7 @@ async function xe(e) {
550
550
  enabled: !0,
551
551
  mountTarget: u
552
552
  };
553
- } else q(window, U) || (n.simrel = { enabled: !1 });
553
+ } else k(window, U) || (n.simrel = { enabled: !1 });
554
554
  const a = await ue(n);
555
555
  return o.setController(a), i && o.sendToNative("ready", {
556
556
  sessionId: a.session.sessionId,
@@ -572,15 +572,15 @@ export {
572
572
  ge as c,
573
573
  z as d,
574
574
  ie as f,
575
- qe as h,
575
+ ke as h,
576
576
  ve as i,
577
577
  ue as l,
578
578
  se as m,
579
579
  ye as n,
580
580
  Me as o,
581
- Ne as p,
581
+ qe as p,
582
582
  _e as r,
583
- ke as s,
583
+ Ne as s,
584
584
  he as t,
585
585
  L as u
586
586
  };