@gengage/assistant-fe 0.3.37 → 0.3.39

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 (36) hide show
  1. package/dist/assistant-fe.css +1 -1
  2. package/dist/chat/catalog.d.ts +2 -0
  3. package/dist/chat/components/ChatDrawer.d.ts +7 -2
  4. package/dist/chat/components/ConsultingStylePicker.d.ts +8 -0
  5. package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +10 -7
  6. package/dist/chat/index.d.ts +33 -3
  7. package/dist/{chat-BJu5cvMq.js → chat-BdYYhBg0.js} +2374 -2188
  8. package/dist/chat.iife.js +21 -21
  9. package/dist/chat.js +1 -1
  10. package/dist/common/ga-datalayer.d.ts +29 -1
  11. package/dist/common/native-webview.d.ts +1 -1
  12. package/dist/common/types.d.ts +13 -1
  13. package/dist/{common-DxR7wUEx.js → common-DmixzWHZ.js} +2 -2
  14. package/dist/common.js +44 -44
  15. package/dist/{connection-warning-nm_yulO-.js → connection-warning-n88bjkqL.js} +5 -5
  16. package/dist/index.js +38 -38
  17. package/dist/{ga-datalayer-BUM5z5Pq.js → locale-MM0U5eeR.js} +361 -304
  18. package/dist/{native-webview-BFWh8f-u.js → native-webview-DkvOte_j.js} +132 -127
  19. package/dist/native.iife.js +23 -23
  20. package/dist/native.js +1 -1
  21. package/dist/{qna-6_XrdLG_.js → qna-DrlYm1d8.js} +15 -15
  22. package/dist/qna.iife.js +7 -7
  23. package/dist/qna.js +1 -1
  24. package/dist/{schemas-ZYhTx11k.js → schemas-DnAo0x7A.js} +491 -470
  25. package/dist/{simbut--wBhTxId.js → simbut-Cb5RfaAp.js} +17 -17
  26. package/dist/simbut.css +1 -1
  27. package/dist/simbut.iife.js +3 -3
  28. package/dist/simbut.js +1 -1
  29. package/dist/simrel/components/GroupTabs.d.ts +5 -0
  30. package/dist/simrel/index.d.ts +1 -0
  31. package/dist/simrel/types.d.ts +5 -0
  32. package/dist/simrel-BjNqBbmw.js +736 -0
  33. package/dist/simrel.iife.js +17 -17
  34. package/dist/simrel.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/simrel-jN_YPfC7.js +0 -710
@@ -1,4 +1,4 @@
1
- function ke(e, t) {
1
+ function Ee(e, t) {
2
2
  const i = {
3
3
  event_name: "stream.start",
4
4
  account_id: e.account_id,
@@ -11,7 +11,7 @@ function ke(e, t) {
11
11
  };
12
12
  return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
13
13
  }
14
- function Ce(e, t) {
14
+ function Te(e, t) {
15
15
  const i = {
16
16
  request_id: t.request_id,
17
17
  chunk_index: t.chunk_index
@@ -26,7 +26,7 @@ function Ce(e, t) {
26
26
  };
27
27
  return e.view_id !== void 0 && (n.view_id = e.view_id), e.user_id !== void 0 && (n.user_id = e.user_id), t.widget !== void 0 && (n.widget = t.widget), e.page_type !== void 0 && (n.page_type = e.page_type), e.sku !== void 0 && (n.sku = e.sku), n;
28
28
  }
29
- function Se(e, t) {
29
+ function Ae(e, t) {
30
30
  const i = {
31
31
  event_name: "stream.ui_spec",
32
32
  account_id: e.account_id,
@@ -40,7 +40,7 @@ function Se(e, t) {
40
40
  };
41
41
  return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
42
42
  }
43
- function Ee(e, t) {
43
+ function Ie(e, t) {
44
44
  const i = {
45
45
  event_name: "stream.done",
46
46
  account_id: e.account_id,
@@ -54,7 +54,7 @@ function Ee(e, t) {
54
54
  };
55
55
  return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
56
56
  }
57
- function Te(e, t) {
57
+ function Le(e, t) {
58
58
  const i = {
59
59
  event_name: "stream.error",
60
60
  account_id: e.account_id,
@@ -68,7 +68,7 @@ function Te(e, t) {
68
68
  };
69
69
  return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), t.widget !== void 0 && (i.widget = t.widget), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
70
70
  }
71
- function Ae(e, t) {
71
+ function Me(e, t) {
72
72
  const i = {
73
73
  model: t.model,
74
74
  prompt_tokens: t.prompt_tokens,
@@ -85,7 +85,7 @@ function Ae(e, t) {
85
85
  };
86
86
  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;
87
87
  }
88
- function Ie(e, t) {
88
+ function qe(e, t) {
89
89
  const i = {
90
90
  event_name: "metering.increment",
91
91
  account_id: e.account_id,
@@ -113,7 +113,7 @@ function U(e, t) {
113
113
  };
114
114
  return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
115
115
  }
116
- function Le(e, t) {
116
+ function Re(e, t) {
117
117
  const i = {
118
118
  event_name: "chat.history.snapshot",
119
119
  account_id: e.account_id,
@@ -127,7 +127,7 @@ function Le(e, t) {
127
127
  };
128
128
  return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
129
129
  }
130
- function Me(e, t) {
130
+ function Ne(e, t) {
131
131
  const i = {
132
132
  event_name: "widget.history.snapshot",
133
133
  account_id: e.account_id,
@@ -142,7 +142,7 @@ function Me(e, t) {
142
142
  };
143
143
  return e.view_id !== void 0 && (i.view_id = e.view_id), e.user_id !== void 0 && (i.user_id = e.user_id), e.page_type !== void 0 && (i.page_type = e.page_type), e.sku !== void 0 && (i.sku = e.sku), i;
144
144
  }
145
- function qe(e, t) {
145
+ function Oe(e, t) {
146
146
  const i = {
147
147
  event_name: "basket.add",
148
148
  account_id: e.account_id,
@@ -325,8 +325,8 @@ function G(e) {
325
325
  if (!n) continue;
326
326
  const r = n.indexOf(":");
327
327
  if (r === -1) continue;
328
- const d = n.slice(0, r).trim().toLowerCase(), f = n.slice(r + 1).trim();
329
- V.has(d) && (B.test(f) || t.push(n));
328
+ const s = n.slice(0, r).trim().toLowerCase(), c = n.slice(r + 1).trim();
329
+ V.has(s) && (B.test(c) || t.push(n));
330
330
  }
331
331
  return t.join("; ");
332
332
  }
@@ -342,71 +342,230 @@ function k(e, t) {
342
342
  return;
343
343
  }
344
344
  if (!x.has(n)) {
345
- const o = Array.from(i.childNodes);
346
- for (const g of o) t.insertBefore(g, i);
345
+ const a = Array.from(i.childNodes);
346
+ for (const d of a) t.insertBefore(d, i);
347
347
  t.removeChild(i);
348
- for (const g of o) k(g, t);
348
+ for (const d of a) k(d, t);
349
349
  return;
350
350
  }
351
- const r = E["*"] ?? /* @__PURE__ */ new Set(), d = E[n] ?? /* @__PURE__ */ new Set(), f = Array.from(i.attributes);
352
- for (const o of f) {
353
- const g = o.name.toLowerCase();
354
- if (!r.has(g) && !d.has(g)) {
355
- i.removeAttribute(o.name);
351
+ const r = E["*"] ?? /* @__PURE__ */ new Set(), s = E[n] ?? /* @__PURE__ */ new Set(), c = Array.from(i.attributes);
352
+ for (const a of c) {
353
+ const d = a.name.toLowerCase();
354
+ if (!r.has(d) && !s.has(d)) {
355
+ i.removeAttribute(a.name);
356
356
  continue;
357
357
  }
358
- if (H(o.value)) {
359
- i.removeAttribute(o.name);
358
+ if (H(a.value)) {
359
+ i.removeAttribute(a.name);
360
360
  continue;
361
361
  }
362
- if (g === "style") {
363
- const h = G(o.value);
362
+ if (d === "style") {
363
+ const h = G(a.value);
364
364
  h ? i.setAttribute("style", h) : i.removeAttribute("style");
365
365
  continue;
366
366
  }
367
367
  }
368
368
  if (n === "a") {
369
- const o = i.getAttribute("href");
370
- if (o !== null) {
371
- const g = o.trim().toLowerCase();
372
- !g.startsWith("http://") && !g.startsWith("https://") && !g.startsWith("mailto:") && i.removeAttribute("href");
369
+ const a = i.getAttribute("href");
370
+ if (a !== null) {
371
+ const d = a.trim().toLowerCase();
372
+ !d.startsWith("http://") && !d.startsWith("https://") && !d.startsWith("mailto:") && i.removeAttribute("href");
373
373
  }
374
374
  i.setAttribute("target", "_blank"), i.setAttribute("rel", "noopener noreferrer");
375
375
  }
376
376
  if (n === "img") {
377
- const o = i.getAttribute("src");
378
- o !== null && (o.trim().toLowerCase().startsWith("https://") || i.removeAttribute("src"));
377
+ const a = i.getAttribute("src");
378
+ a !== null && (a.trim().toLowerCase().startsWith("https://") || i.removeAttribute("src"));
379
379
  }
380
380
  const p = Array.from(i.childNodes);
381
- for (const o of p) k(o, i);
381
+ for (const a of p) k(a, i);
382
382
  }
383
- var N = ["http:", "https:"];
384
- function Ne(e) {
383
+ var R = ["http:", "https:"];
384
+ function Pe(e) {
385
385
  try {
386
- return N.includes(new URL(e).protocol);
386
+ return R.includes(new URL(e).protocol);
387
387
  } catch {
388
388
  return !1;
389
389
  }
390
390
  }
391
- function R(e) {
391
+ function N(e) {
392
392
  if (e.startsWith("/") && !e.startsWith("//")) return !0;
393
393
  try {
394
394
  const t = new URL(e);
395
- return N.includes(t.protocol);
395
+ return R.includes(t.protocol);
396
396
  } catch {
397
397
  return !1;
398
398
  }
399
399
  }
400
- function Re(e, t, i) {
401
- (t === "href" || t === "src") && !R(i) || e.setAttribute(t, i);
400
+ function De(e, t, i) {
401
+ (t === "href" || t === "src") && !N(i) || e.setAttribute(t, i);
402
402
  }
403
- function Oe(e) {
403
+ function $e(e) {
404
404
  if (!e) return "";
405
405
  const t = new DOMParser().parseFromString(e, "text/html").body, i = Array.from(t.childNodes);
406
406
  for (const n of i) k(n, t);
407
407
  return t.innerHTML;
408
408
  }
409
- function De(e, t) {
409
+ function j() {
410
+ return typeof window < "u" && Array.isArray(window.dataLayer);
411
+ }
412
+ function o(e, t) {
413
+ const i = {
414
+ event: e,
415
+ ...t
416
+ };
417
+ j() && window.dataLayer.push(i);
418
+ }
419
+ function Q(e) {
420
+ o("gengage-on-init", { gengage_widget: e });
421
+ }
422
+ function T(e) {
423
+ o("gengage-show", { gengage_widget: e });
424
+ }
425
+ function Y(e) {
426
+ o("gengage-hide", { gengage_widget: e });
427
+ }
428
+ function J(e, t) {
429
+ o("gengage-suggested-question", {
430
+ gengage_question_title: e,
431
+ gengage_action_type: t
432
+ });
433
+ }
434
+ function Ue(e) {
435
+ o("gengage-find-similars", { gengage_sku: e });
436
+ }
437
+ function We(e) {
438
+ o("gengage-compare-preselection", { gengage_sku: e });
439
+ }
440
+ function ze(e) {
441
+ o("gengage-compare-selected", {
442
+ gengage_skus: e,
443
+ gengage_product_count: e.length
444
+ });
445
+ }
446
+ function xe() {
447
+ o("gengage-compare-clear");
448
+ }
449
+ function Fe(e) {
450
+ o("gengage-compare-received", { gengage_product_count: e });
451
+ }
452
+ function He(e) {
453
+ o("gengage-like-product", { gengage_sku: e });
454
+ }
455
+ function Ve() {
456
+ o("gengage-like-list");
457
+ }
458
+ function Be(e, t) {
459
+ o("gengage-search", {
460
+ gengage_search_query: e,
461
+ gengage_result_count: t
462
+ });
463
+ }
464
+ function Ge(e, t) {
465
+ o("gengage-product-detail", {
466
+ gengage_sku: e,
467
+ gengage_product_name: t
468
+ });
469
+ }
470
+ function K(e, t) {
471
+ o("gengage-similar-product-click", {
472
+ gengage_sku: e,
473
+ ...t?.url !== void 0 ? { gengage_product_url: t.url } : {},
474
+ ...t?.name !== void 0 ? { gengage_product_name: t.name } : {},
475
+ ...t?.session_id !== void 0 ? { gengage_session_id: t.session_id } : {}
476
+ });
477
+ }
478
+ function X(e, t) {
479
+ o("gengage-similar-grouping-click", {
480
+ gengage_grouping_label: e,
481
+ gengage_grouping_index: t
482
+ });
483
+ }
484
+ function Z(e) {
485
+ o("gengage-similar-products-impression", {
486
+ gengage_source_sku: e.source_sku,
487
+ gengage_product_count: e.product_count,
488
+ gengage_grouped: e.grouped,
489
+ ...e.session_id !== void 0 ? { gengage_session_id: e.session_id } : {}
490
+ });
491
+ }
492
+ function je(e) {
493
+ o("gengage-compare-product", {
494
+ gengage_skus: e,
495
+ gengage_product_count: e.length
496
+ });
497
+ }
498
+ function Qe() {
499
+ o("gengage-chatbot-maximized");
500
+ }
501
+ function ee(e) {
502
+ o("gengage-interface-not-ready", {
503
+ ...e?.reason !== void 0 ? { gengage_reason: e.reason } : {},
504
+ ...e?.attempts !== void 0 ? { gengage_attempts: e.attempts } : {},
505
+ ...e?.message !== void 0 ? { gengage_message: e.message } : {}
506
+ });
507
+ }
508
+ function te(e, t) {
509
+ o("gengage-cart-add", {
510
+ gengage_sku: e,
511
+ gengage_quantity: t
512
+ });
513
+ }
514
+ function Ye() {
515
+ o("gengage-message-sent");
516
+ }
517
+ function Je() {
518
+ o("gengage-message-received");
519
+ }
520
+ function Ke() {
521
+ o("gengage-conversation-start");
522
+ }
523
+ function ie() {
524
+ o("gengage-voice-input");
525
+ }
526
+ function ne(e, t) {
527
+ o("gengage-error", {
528
+ gengage_widget: e,
529
+ gengage_error: t
530
+ });
531
+ }
532
+ var m = null;
533
+ function Xe() {
534
+ if (typeof window > "u") return () => {
535
+ };
536
+ if (m) return m;
537
+ const e = [];
538
+ function t(i, n) {
539
+ const r = (s) => n(s.detail);
540
+ window.addEventListener(i, r), e.push(() => window.removeEventListener(i, r));
541
+ }
542
+ return t("gengage:chat:open", () => T("chat")), t("gengage:chat:close", () => Y("chat")), t("gengage:chat:ready", () => Q("chat")), t("gengage:similar:add-to-cart", ({ sku: i, quantity: n }) => {
543
+ te(i, n);
544
+ }), t("gengage:similar:product-click", ({ sku: i, url: n, sessionId: r, productName: s }) => {
545
+ const c = {
546
+ url: n,
547
+ session_id: r
548
+ };
549
+ s !== void 0 && s !== "" && (c.name = s), K(i, c);
550
+ }), t("gengage:similar:grouping-click", ({ grouping_label: i, grouping_index: n }) => {
551
+ X(i, n);
552
+ }), t("gengage:similar:products-impression", ({ source_sku: i, product_count: n, grouped: r, sessionId: s }) => {
553
+ Z({
554
+ source_sku: i,
555
+ product_count: n,
556
+ grouped: r,
557
+ session_id: s
558
+ });
559
+ }), t("gengage:qna:action", ({ title: i, type: n }) => {
560
+ J(i, n);
561
+ }), t("gengage:chat:voice", () => ie()), t("gengage:qna:open-chat", () => T("chat")), t("gengage:global:error", ({ source: i, message: n }) => {
562
+ ne(i, n);
563
+ }), m = () => {
564
+ for (const i of e) i();
565
+ e.length = 0, m = null;
566
+ }, m;
567
+ }
568
+ function Ze(e, t) {
410
569
  window.dispatchEvent(new CustomEvent(e, {
411
570
  detail: t,
412
571
  bubbles: !1
@@ -418,7 +577,7 @@ function w(e, t) {
418
577
  };
419
578
  return window.addEventListener(e, i), () => window.removeEventListener(e, i);
420
579
  }
421
- function j(e) {
580
+ function re(e) {
422
581
  if (e.type !== "user_message" && e.type !== "inputText") return null;
423
582
  if (typeof e.payload == "string" && e.payload.trim().length > 0) return e.payload.trim();
424
583
  if (typeof e.payload == "object" && e.payload !== null) {
@@ -430,7 +589,7 @@ function j(e) {
430
589
  }
431
590
  return typeof e.title == "string" && e.title.trim().length > 0 ? e.title.trim() : null;
432
591
  }
433
- function Q(e) {
592
+ function oe(e) {
434
593
  if (e.type !== "inputText" && e.type !== "user_message") return e;
435
594
  const t = typeof e.payload == "string" ? { text: e.payload.trim() } : e.payload != null && typeof e.payload == "object" && !Array.isArray(e.payload) ? { ...e.payload } : {};
436
595
  if (typeof t.text != "string" || !t.text.trim()) {
@@ -442,26 +601,26 @@ function Q(e) {
442
601
  payload: t
443
602
  };
444
603
  }
445
- function Pe(e) {
604
+ function et(e) {
446
605
  let t = !1;
447
606
  const i = [];
448
- let n = 0, r = null, d = 0;
449
- const f = 100, p = 5e3;
450
- function o() {
607
+ let n = 0, r = null, s = 0;
608
+ const c = 500, p = 10;
609
+ function a() {
451
610
  return window.gengage?.chat ?? null;
452
611
  }
453
- function g() {
612
+ function d() {
454
613
  t || (console.warn("[gengage] QNA tried to open chat, but chat widget is not initialized. Ensure GengageChat is initialized before calling wireQNAToChat()."), t = !0), e?.onChatUnavailable?.();
455
614
  }
456
- function h(a, c) {
457
- if (a.openWithAction) {
458
- const $ = c.type === "inputText" || c.type === "user_message" ? Q(c) : c;
459
- a.openWithAction($);
615
+ function h(g, l) {
616
+ if (g.openWithAction) {
617
+ const $ = l.type === "inputText" || l.type === "user_message" ? oe(l) : l;
618
+ g.openWithAction($);
460
619
  return;
461
620
  }
462
- const y = j(c);
463
- if (y && a.sendMessage) {
464
- a.open?.(), a.sendMessage(y);
621
+ const y = re(l);
622
+ if (y && g.sendMessage) {
623
+ g.open?.(), g.sendMessage(y);
465
624
  return;
466
625
  }
467
626
  }
@@ -469,64 +628,67 @@ function Pe(e) {
469
628
  r !== null && (window.clearInterval(r), r = null);
470
629
  }
471
630
  function O() {
472
- const a = o();
473
- if (!a) return !1;
474
- if (n > 0 && (a.open?.(), n = 0), i.length > 0) {
475
- const c = i.splice(0, i.length);
476
- for (const y of c) h(a, y);
631
+ const g = a();
632
+ if (!g) return !1;
633
+ if (n > 0 && (g.open?.(), n = 0), i.length > 0) {
634
+ const l = i.splice(0, i.length);
635
+ for (const y of l) h(g, y);
477
636
  }
478
637
  return b(), !0;
479
638
  }
480
639
  function S() {
481
- r === null && (d = Date.now(), r = window.setInterval(() => {
482
- O() || Date.now() - d >= p && (i.length = 0, n = 0, b());
483
- }, f));
640
+ r === null && (s = 0, r = window.setInterval(() => {
641
+ O() || (s += 1, s >= p && ((i.length > 0 || n > 0) && ee({
642
+ reason: "chat_unavailable_after_poll",
643
+ attempts: p
644
+ }), i.length = 0, n = 0, b()));
645
+ }, c));
484
646
  }
485
- const D = w("gengage:qna:action", (a) => {
486
- const c = o();
487
- if (c) {
488
- h(c, a);
647
+ const P = w("gengage:qna:action", (g) => {
648
+ const l = a();
649
+ if (l) {
650
+ h(l, g);
489
651
  return;
490
652
  }
491
- g(), i.length >= 20 && i.shift(), i.push(a), S();
492
- }), P = w("gengage:qna:open-chat", () => {
493
- const a = o();
494
- if (a) {
495
- a.open?.();
653
+ d(), i.length >= 20 && i.shift(), i.push(g), S();
654
+ }), D = w("gengage:qna:open-chat", () => {
655
+ const g = a();
656
+ if (g) {
657
+ g.open?.();
496
658
  return;
497
659
  }
498
- g(), n += 1, S();
660
+ d(), n += 1, S();
499
661
  });
500
662
  return () => {
501
- D(), P(), i.length = 0, n = 0, b();
663
+ P(), D(), i.length = 0, n = 0, b();
502
664
  };
503
665
  }
504
- function $e() {
666
+ function tt() {
505
667
  return w("gengage:similar:product-click", ({ sku: e, url: t, sessionId: i }) => {
506
- i && window.gengage?.chat?.saveSession(i, e), R(t) && (window.location.href = t);
668
+ i && window.gengage?.chat?.saveSession(i, e), N(t) && (window.location.href = t);
507
669
  });
508
670
  }
509
- function Y() {
671
+ function se() {
510
672
  const e = window.__gengageSessionId ?? sessionStorage.getItem("gengage_session_id") ?? null ?? crypto.randomUUID();
511
673
  return window.__gengageSessionId = e, sessionStorage.setItem("gengage_session_id", e), window.gengage || (window.gengage = {}), window.gengage.sessionId = e, e;
512
674
  }
513
- function Ue() {
675
+ function it() {
514
676
  return window.gengage?.pageContext ?? null;
515
677
  }
516
- function We(e) {
678
+ function nt(e) {
517
679
  window.gengage || (window.gengage = {}), window.gengage.pageContext = {
518
680
  pageType: "other",
519
681
  ...window.gengage.pageContext,
520
682
  ...e
521
683
  }, window.dispatchEvent(new CustomEvent("gengage:context:update", { detail: e }));
522
684
  }
523
- function J(e) {
685
+ function ae(e) {
524
686
  return {
525
- sessionId: e?.sessionId ?? Y(),
687
+ sessionId: e?.sessionId ?? se(),
526
688
  ...e
527
689
  };
528
690
  }
529
- var T = {
691
+ var A = {
530
692
  "--gengage-chat-offset": "20px",
531
693
  "--gengage-chat-launcher-size": "56px",
532
694
  "--gengage-chat-width": "400px",
@@ -548,11 +710,11 @@ var T = {
548
710
  "--text-muted": "#6b7280",
549
711
  "--border-default": "rgba(17, 24, 39, 0.10)"
550
712
  };
551
- function K(e) {
713
+ function ge(e) {
552
714
  return e ? {
553
- ...T,
715
+ ...A,
554
716
  ...e
555
- } : { ...T };
717
+ } : { ...A };
556
718
  }
557
719
  var u = {
558
720
  primaryColor: "#b7102a",
@@ -616,13 +778,13 @@ var u = {
616
778
  "--ai-accent-end": "#f768f2",
617
779
  "--ai-accent-soft": "linear-gradient(135deg, rgba(11, 36, 214, 0.08), rgba(247, 104, 242, 0.08))"
618
780
  };
619
- function ze(e) {
781
+ function rt(e) {
620
782
  return {
621
783
  ...u,
622
784
  ...e
623
785
  };
624
786
  }
625
- var l = "gengage-global-toast-root", A = "gengage-global-toast-style", C = "gengage-global-toast-root--visible", X = 4200, Z = 1500, ee = 15e3, te = [
787
+ var f = "gengage-global-toast-root", I = "gengage-global-toast-style", C = "gengage-global-toast-root--visible", de = 4200, ue = 1500, ce = 15e3, le = [
626
788
  "--gengage-font-family",
627
789
  "--surface-card",
628
790
  "--text-primary",
@@ -636,7 +798,7 @@ var l = "gengage-global-toast-root", A = "gengage-global-toast-style", C = "geng
636
798
  "--ds-toast-error-accent",
637
799
  "--ds-toast-error-fg",
638
800
  "--ds-toast-error-shadow"
639
- ], I = !1, _ = null, ie = [
801
+ ], L = !1, _ = null, fe = [
640
802
  /failed to fetch/i,
641
803
  /networkerror/i,
642
804
  /network request failed/i,
@@ -645,44 +807,44 @@ var l = "gengage-global-toast-root", A = "gengage-global-toast-style", C = "geng
645
807
  /fetch failed/i,
646
808
  /network error/i
647
809
  ];
648
- function L(e) {
810
+ function M(e) {
649
811
  return typeof e == "string" && e.toLowerCase().startsWith("tr");
650
812
  }
651
- function ne(e) {
813
+ function _e(e) {
652
814
  if (typeof navigator < "u" && navigator.onLine === !1) return !0;
653
815
  const t = e instanceof Error ? e.message.trim() : "";
654
- return t ? ie.some((i) => i.test(t)) : !1;
816
+ return t ? fe.some((i) => i.test(t)) : !1;
655
817
  }
656
- function xe(e, t) {
657
- return ne(t) ? 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.";
818
+ function ot(e, t) {
819
+ return _e(t) ? M(e) ? "Bağlantı sorunu oluştu. Lütfen tekrar deneyin." : "Connection issue. Please try again." : M(e) ? "Bir hata oluştu. Lütfen tekrar deneyin." : "Something went wrong. Please try again.";
658
820
  }
659
- function re() {
660
- I || typeof window > "u" || typeof document > "u" || (I = !0, w("gengage:global:error", (e) => {
661
- oe(e);
821
+ function pe() {
822
+ L || typeof window > "u" || typeof document > "u" || (L = !0, w("gengage:global:error", (e) => {
823
+ he(e);
662
824
  }));
663
825
  }
664
- function oe(e) {
826
+ function he(e) {
665
827
  if (typeof document > "u") return;
666
828
  const t = e.message.trim();
667
829
  if (!t) return;
668
- ce();
669
- const i = de();
670
- ge(i), i.innerHTML = "";
830
+ ke();
831
+ const i = we();
832
+ ye(i), i.innerHTML = "";
671
833
  const n = document.createElement("section");
672
834
  n.className = "gengage-global-toast gengage-global-toast--error", n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite");
673
835
  const r = document.createElement("div");
674
- r.className = "gengage-global-toast-title", r.textContent = ae(e.source);
675
- const d = document.createElement("div");
676
- d.className = "gengage-global-toast-message", d.textContent = t, n.appendChild(r), n.appendChild(d), i.appendChild(n), i.classList.add(C), _ && (clearTimeout(_), _ = null), e.sticky !== !0 && (_ = setTimeout(() => {
677
- se();
678
- }, ue(e.durationMs)));
836
+ r.className = "gengage-global-toast-title", r.textContent = ve(e.source);
837
+ const s = document.createElement("div");
838
+ s.className = "gengage-global-toast-message", s.textContent = t, n.appendChild(r), n.appendChild(s), i.appendChild(n), i.classList.add(C), _ && (clearTimeout(_), _ = null), e.sticky !== !0 && (_ = setTimeout(() => {
839
+ me();
840
+ }, be(e.durationMs)));
679
841
  }
680
- function se() {
842
+ function me() {
681
843
  if (typeof document > "u") return;
682
- const e = document.getElementById(l);
844
+ const e = document.getElementById(f);
683
845
  e && (e.classList.remove(C), e.innerHTML = "", _ && (clearTimeout(_), _ = null));
684
846
  }
685
- function ae(e) {
847
+ function ve(e) {
686
848
  switch (e) {
687
849
  case "chat":
688
850
  return "Chat warning";
@@ -694,63 +856,63 @@ function ae(e) {
694
856
  return "Connection warning";
695
857
  }
696
858
  }
697
- function de() {
698
- const e = document.getElementById(l);
859
+ function we() {
860
+ const e = document.getElementById(f);
699
861
  if (e instanceof HTMLElement) return e;
700
862
  const t = document.createElement("div");
701
- return t.id = l, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
863
+ return t.id = f, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
702
864
  }
703
- function ge(e) {
865
+ function ye(e) {
704
866
  if (typeof document > "u" || typeof window > "u") return;
705
867
  const t = document.querySelector(".gengage-chat-root, .gengage-qna-container, .gengage-simrel-container, .gengage-simbut-root");
706
868
  if (!t) return;
707
869
  const i = window.getComputedStyle(t);
708
- for (const n of te) {
870
+ for (const n of le) {
709
871
  const r = i.getPropertyValue(n).trim();
710
872
  r ? e.style.setProperty(n, r) : e.style.removeProperty(n);
711
873
  }
712
874
  }
713
- function ue(e) {
714
- return typeof e != "number" || !Number.isFinite(e) ? X : Math.min(ee, Math.max(Z, Math.round(e)));
875
+ function be(e) {
876
+ return typeof e != "number" || !Number.isFinite(e) ? de : Math.min(ce, Math.max(ue, Math.round(e)));
715
877
  }
716
- function ce() {
717
- if (document.getElementById(A)) return;
878
+ function ke() {
879
+ if (document.getElementById(I)) return;
718
880
  const e = document.createElement("style");
719
- e.id = A;
720
- const t = u["--surface-card"] ?? u.backgroundColor ?? "#ffffff", i = u["--text-primary"] ?? u.foregroundColor ?? "#111827", n = u["--border-default"] ?? "rgba(17, 24, 39, 0.10)", r = u["--error"] ?? "#dc2626", d = u["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", f = u["--radius-card"] ?? "16px", p = u["--text-muted"] ?? "#6b7280";
881
+ e.id = I;
882
+ const t = u["--surface-card"] ?? u.backgroundColor ?? "#ffffff", i = u["--text-primary"] ?? u.foregroundColor ?? "#111827", n = u["--border-default"] ?? "rgba(17, 24, 39, 0.10)", r = u["--error"] ?? "#dc2626", s = u["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", c = u["--radius-card"] ?? "16px", p = u["--text-muted"] ?? "#6b7280";
721
883
  e.textContent = `
722
- #${l} {
884
+ #${f} {
723
885
  position: fixed;
724
886
  top: 16px;
725
887
  right: 16px;
726
888
  z-index: 2147483646;
727
889
  pointer-events: none;
728
890
  }
729
- #${l}.${C} {
891
+ #${f}.${C} {
730
892
  pointer-events: auto;
731
893
  }
732
- #${l} .gengage-global-toast {
894
+ #${f} .gengage-global-toast {
733
895
  min-width: 260px;
734
896
  max-width: min(92vw, 420px);
735
- border-radius: var(--radius-card, ${f});
897
+ border-radius: var(--radius-card, ${c});
736
898
  border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${r}) 18%, var(--border-default, ${n})));
737
899
  border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${r}));
738
900
  background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${r}) 5%, var(--surface-card, ${t})));
739
901
  color: var(--ds-toast-error-fg, color-mix(in srgb, var(--error, ${r}) 22%, var(--text-primary, ${i})));
740
- box-shadow: var(--ds-toast-error-shadow, var(--shadow-3, ${d}));
902
+ box-shadow: var(--ds-toast-error-shadow, var(--shadow-3, ${s}));
741
903
  padding: 10px 12px;
742
904
  font-family: var(--gengage-font-family, ${JSON.stringify(u.fontFamily ?? '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif')});
743
905
  font-size: 13px;
744
906
  line-height: 1.4;
745
907
  animation: gengage-global-toast-in 180ms ease-out forwards;
746
908
  }
747
- #${l} .gengage-global-toast-title {
909
+ #${f} .gengage-global-toast-title {
748
910
  margin: 0 0 4px;
749
911
  font-size: 12px;
750
912
  font-weight: 700;
751
913
  color: var(--text-muted, ${p});
752
914
  }
753
- #${l} .gengage-global-toast-message {
915
+ #${f} .gengage-global-toast-message {
754
916
  margin: 0;
755
917
  font-weight: 500;
756
918
  }
@@ -766,22 +928,22 @@ function ce() {
766
928
  }
767
929
  `, document.head.appendChild(e);
768
930
  }
769
- var m = null;
770
- function le() {
771
- if (m !== null) return m;
931
+ var v = null;
932
+ function Ce() {
933
+ if (v !== null) return v;
772
934
  try {
773
- m = localStorage.getItem("gengage:debug") === "1";
935
+ v = localStorage.getItem("gengage:debug") === "1";
774
936
  } catch {
775
- m = !1;
937
+ v = !1;
776
938
  }
777
- return m;
939
+ return v;
778
940
  }
779
- function M(e, t, i) {
780
- if (!le()) return;
941
+ function q(e, t, i) {
942
+ if (!Ce()) return;
781
943
  const n = [`[gengage:${e}]`, t];
782
944
  i !== void 0 && n.push(i), console.debug(...n);
783
945
  }
784
- var Fe = class {
946
+ var st = class {
785
947
  constructor() {
786
948
  this.isVisible = !1, this.isInitialised = !1, this._handlers = /* @__PURE__ */ new Map(), this._cleanups = [], this._ownsRoot = !1, this._destroying = !1;
787
949
  }
@@ -790,14 +952,14 @@ var Fe = class {
790
952
  console.warn("[gengage] Widget already initialised. Call update() instead.");
791
953
  return;
792
954
  }
793
- const t = K(e.theme);
955
+ const t = ge(e.theme);
794
956
  this.config = {
795
957
  ...e,
796
958
  theme: t,
797
- session: J(e.session)
798
- }, this.root = this._resolveMount(e.mountTarget), this._applyTheme(t), re();
959
+ session: ae(e.session)
960
+ }, this.root = this._resolveMount(e.mountTarget), this._applyTheme(t), pe();
799
961
  const i = w("gengage:context:update", (n) => this.update(n));
800
- this._cleanups.push(i), M("lifecycle", `${this.constructor.name}.init`, {
962
+ this._cleanups.push(i), q("lifecycle", `${this.constructor.name}.init`, {
801
963
  accountId: e.accountId,
802
964
  sku: e.pageContext?.sku
803
965
  });
@@ -806,7 +968,7 @@ var Fe = class {
806
968
  } catch (n) {
807
969
  throw this.destroy(), n;
808
970
  }
809
- this._destroying || (this.isInitialised = !0, M("lifecycle", `${this.constructor.name} ready`), this.emit("ready"));
971
+ this._destroying || (this.isInitialised = !0, q("lifecycle", `${this.constructor.name} ready`), this.emit("ready"));
810
972
  }
811
973
  update(e) {
812
974
  this.isInitialised && (this.config.pageContext ? this.config = {
@@ -872,181 +1034,76 @@ var Fe = class {
872
1034
  _applyTheme(e) {
873
1035
  if (e) {
874
1036
  for (const [t, i] of Object.entries(e)) if (i !== void 0) {
875
- const n = t.startsWith("--") ? t : `--gengage-${fe(t)}`;
1037
+ const n = t.startsWith("--") ? t : `--gengage-${Se(t)}`;
876
1038
  this.root.style.setProperty(n, i);
877
1039
  }
878
1040
  }
879
1041
  }
880
1042
  };
881
- function fe(e) {
1043
+ function Se(e) {
882
1044
  return e.replace(/([A-Z])/g, "-$1").toLowerCase();
883
1045
  }
884
- function He(e) {
1046
+ function at(e) {
885
1047
  const t = e?.trim();
886
1048
  return t || "tr";
887
1049
  }
888
- function _e() {
889
- return typeof window < "u" && Array.isArray(window.dataLayer);
890
- }
891
- function s(e, t) {
892
- const i = {
893
- event: e,
894
- ...t
895
- };
896
- _e() && window.dataLayer.push(i);
897
- }
898
- function pe(e) {
899
- s("gengage-on-init", { gengage_widget: e });
900
- }
901
- function q(e) {
902
- s("gengage-show", { gengage_widget: e });
903
- }
904
- function he(e) {
905
- s("gengage-hide", { gengage_widget: e });
906
- }
907
- function me(e, t) {
908
- s("gengage-suggested-question", {
909
- gengage_question_title: e,
910
- gengage_action_type: t
911
- });
912
- }
913
- function Ve(e) {
914
- s("gengage-find-similars", { gengage_sku: e });
915
- }
916
- function Be(e) {
917
- s("gengage-compare-preselection", { gengage_sku: e });
918
- }
919
- function Ge(e) {
920
- s("gengage-compare-selected", {
921
- gengage_skus: e,
922
- gengage_product_count: e.length
923
- });
924
- }
925
- function je() {
926
- s("gengage-compare-clear");
927
- }
928
- function Qe(e) {
929
- s("gengage-compare-received", { gengage_product_count: e });
930
- }
931
- function Ye(e) {
932
- s("gengage-like-product", { gengage_sku: e });
933
- }
934
- function Je() {
935
- s("gengage-like-list");
936
- }
937
- function Ke(e, t) {
938
- s("gengage-search", {
939
- gengage_search_query: e,
940
- gengage_result_count: t
941
- });
942
- }
943
- function ve(e, t) {
944
- s("gengage-product-detail", {
945
- gengage_sku: e,
946
- gengage_product_name: t
947
- });
948
- }
949
- function we(e, t) {
950
- s("gengage-cart-add", {
951
- gengage_sku: e,
952
- gengage_quantity: t
953
- });
954
- }
955
- function Xe() {
956
- s("gengage-message-sent");
957
- }
958
- function Ze() {
959
- s("gengage-message-received");
960
- }
961
- function et() {
962
- s("gengage-conversation-start");
963
- }
964
- function ye() {
965
- s("gengage-voice-input");
966
- }
967
- function be(e, t) {
968
- s("gengage-error", {
969
- gengage_widget: e,
970
- gengage_error: t
971
- });
972
- }
973
- var v = null;
974
- function tt() {
975
- if (typeof window > "u") return () => {
976
- };
977
- if (v) return v;
978
- const e = [];
979
- function t(i, n) {
980
- const r = (d) => n(d.detail);
981
- window.addEventListener(i, r), e.push(() => window.removeEventListener(i, r));
982
- }
983
- return t("gengage:chat:open", () => q("chat")), t("gengage:chat:close", () => he("chat")), t("gengage:chat:ready", () => pe("chat")), t("gengage:similar:add-to-cart", ({ sku: i, quantity: n }) => {
984
- we(i, n);
985
- }), t("gengage:similar:product-click", ({ sku: i }) => {
986
- ve(i);
987
- }), t("gengage:qna:action", ({ title: i, type: n }) => {
988
- me(i, n);
989
- }), t("gengage:chat:voice", () => ye()), t("gengage:qna:open-chat", () => q("chat")), t("gengage:global:error", ({ source: i, message: n }) => {
990
- be(i, n);
991
- }), v = () => {
992
- for (const i of e) i();
993
- e.length = 0, v = null;
994
- }, v;
995
- }
996
1050
  export {
997
- ke as $,
998
- K as A,
999
- R as B,
1051
+ Te as $,
1052
+ Q as A,
1053
+ ie as B,
1000
1054
  xe as C,
1001
- u as D,
1002
- oe as E,
1003
- De as F,
1004
- z as G,
1005
- Oe as H,
1006
- w as I,
1007
- Ie as J,
1008
- W as K,
1009
- Pe as L,
1010
- Ue as M,
1011
- J as N,
1012
- ze as O,
1013
- We as P,
1014
- Te as Q,
1015
- $e as R,
1016
- se as S,
1017
- re as T,
1018
- qe as U,
1019
- Re as V,
1020
- Le as W,
1021
- Ce as X,
1022
- U as Y,
1023
- Ee as Z,
1024
- ye as _,
1025
- Ge as a,
1026
- Fe as b,
1027
- pe as c,
1028
- Ze as d,
1029
- Se as et,
1030
- Xe as f,
1031
- me as g,
1032
- q as h,
1033
- Qe as i,
1034
- Y as j,
1035
- T as k,
1036
- Je as l,
1037
- Ke as m,
1038
- je as n,
1039
- et as o,
1040
- ve as p,
1041
- Ae as q,
1042
- Be as r,
1043
- Ve as s,
1044
- we as t,
1045
- Me as tt,
1046
- Ye as u,
1047
- tt as v,
1048
- ne as w,
1049
- M as x,
1050
- He as y,
1051
- Ne as z
1055
+ ze as D,
1056
+ Fe as E,
1057
+ Ye as F,
1058
+ $e as G,
1059
+ Pe as H,
1060
+ Ge as I,
1061
+ z as J,
1062
+ Oe as K,
1063
+ Be as L,
1064
+ Ve as M,
1065
+ He as N,
1066
+ Ke as O,
1067
+ Je as P,
1068
+ U as Q,
1069
+ T as R,
1070
+ Qe as S,
1071
+ je as T,
1072
+ N as U,
1073
+ Xe as V,
1074
+ De as W,
1075
+ Me as X,
1076
+ W as Y,
1077
+ qe as Z,
1078
+ Ze as _,
1079
+ ot as a,
1080
+ tt as b,
1081
+ he as c,
1082
+ A as d,
1083
+ Ie as et,
1084
+ ge as f,
1085
+ nt as g,
1086
+ ae as h,
1087
+ me as i,
1088
+ Ne as it,
1089
+ ee as j,
1090
+ Ue as k,
1091
+ u as l,
1092
+ it as m,
1093
+ st as n,
1094
+ Ee as nt,
1095
+ _e as o,
1096
+ se as p,
1097
+ Re as q,
1098
+ q as r,
1099
+ Ae as rt,
1100
+ pe as s,
1101
+ at as t,
1102
+ Le as tt,
1103
+ rt as u,
1104
+ w as v,
1105
+ We as w,
1106
+ te as x,
1107
+ et as y,
1108
+ J as z
1052
1109
  };