@gengage/assistant-fe 0.3.18 → 0.3.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 (309) hide show
  1. package/dist/chat/api.d.ts +3 -1
  2. package/dist/chat/assistant-mode.d.ts +19 -0
  3. package/dist/chat/attachment-utils.d.ts +0 -1
  4. package/dist/chat/catalog.d.ts +32 -1
  5. package/dist/chat/chat-presentation-state.d.ts +0 -1
  6. package/dist/chat/components/AIGroupingCards.d.ts +0 -1
  7. package/dist/chat/components/AISuggestedSearchCards.d.ts +0 -1
  8. package/dist/chat/components/AITopPicks.d.ts +0 -1
  9. package/dist/chat/components/BeautyPhotoStep.d.ts +16 -0
  10. package/dist/chat/components/CategoriesContainer.d.ts +0 -1
  11. package/dist/chat/components/ChatDrawer.d.ts +22 -2
  12. package/dist/chat/components/ChoicePrompter.d.ts +0 -1
  13. package/dist/chat/components/ComparisonTable.d.ts +0 -1
  14. package/dist/chat/components/ConsultingStylePicker.d.ts +25 -0
  15. package/dist/chat/components/FloatingComparisonButton.d.ts +0 -1
  16. package/dist/chat/components/GroundingReviewCard.d.ts +0 -1
  17. package/dist/chat/components/HandoffNotice.d.ts +0 -1
  18. package/dist/chat/components/KvkkBanner.d.ts +0 -1
  19. package/dist/chat/components/Launcher.d.ts +0 -1
  20. package/dist/chat/components/PanelTopBar.d.ts +0 -1
  21. package/dist/chat/components/PhotoAnalysisCard.d.ts +22 -0
  22. package/dist/chat/components/ProductSummaryCard.d.ts +0 -1
  23. package/dist/chat/components/ProsAndCons.d.ts +0 -1
  24. package/dist/chat/components/ReviewHighlights.d.ts +0 -1
  25. package/dist/chat/components/ThumbnailsColumn.d.ts +0 -1
  26. package/dist/chat/components/actionClassifier.d.ts +0 -1
  27. package/dist/chat/components/product-price-layout.d.ts +0 -1
  28. package/dist/chat/components/productMentionLinker.d.ts +0 -1
  29. package/dist/chat/components/renderUISpec.d.ts +2 -2
  30. package/dist/chat/components/typewriter.d.ts +0 -1
  31. package/dist/chat/extendedModeManager.d.ts +0 -1
  32. package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +18 -0
  33. package/dist/chat/features/beauty-consulting/drawer-extensions.d.ts +20 -0
  34. package/dist/chat/features/beauty-consulting/mode-controller.d.ts +53 -0
  35. package/dist/chat/features/beauty-consulting/registry.d.ts +3 -0
  36. package/dist/chat/features/beauty-consulting/stream-handler.d.ts +38 -0
  37. package/dist/chat/index.d.ts +11 -1
  38. package/dist/chat/kvkk.d.ts +0 -1
  39. package/dist/chat/locales/en.d.ts +0 -1
  40. package/dist/chat/locales/index.d.ts +0 -1
  41. package/dist/chat/locales/tr.d.ts +0 -1
  42. package/dist/chat/panel-manager.d.ts +0 -1
  43. package/dist/chat/session-persistence.d.ts +0 -1
  44. package/dist/chat/stream-error-display.d.ts +0 -1
  45. package/dist/chat/types.d.ts +27 -2
  46. package/dist/chat/utils/chat-presentation-debug.d.ts +0 -1
  47. package/dist/chat/utils/get-chat-scroll-element.d.ts +0 -1
  48. package/dist/chat/utils/ui.d.ts +0 -1
  49. package/dist/chat-CuPO9t-Z.cjs +93 -0
  50. package/dist/chat-yAf9OADM.js +7111 -0
  51. package/dist/chat.cjs +1 -1
  52. package/dist/chat.iife.js +48 -49
  53. package/dist/chat.js +13 -2
  54. package/dist/common/action-router.d.ts +0 -1
  55. package/dist/common/activity-tracker.d.ts +0 -1
  56. package/dist/common/analytics-events.d.ts +0 -1
  57. package/dist/common/analytics.d.ts +0 -1
  58. package/dist/common/api-paths.d.ts +0 -1
  59. package/dist/common/client.d.ts +0 -1
  60. package/dist/common/communication-bridge.d.ts +0 -1
  61. package/dist/common/config-schema.d.ts +0 -1
  62. package/dist/common/connection-warning.d.ts +0 -1
  63. package/dist/common/consulting-sources.d.ts +9 -0
  64. package/dist/common/context.d.ts +0 -1
  65. package/dist/common/customization-factories.d.ts +0 -1
  66. package/dist/common/debug.d.ts +0 -1
  67. package/dist/common/events.d.ts +0 -1
  68. package/dist/common/ga-datalayer.d.ts +0 -1
  69. package/dist/common/global-error-toast.d.ts +0 -1
  70. package/dist/common/index.d.ts +0 -1
  71. package/dist/common/indexed-db.d.ts +0 -1
  72. package/dist/common/native-webview.d.ts +0 -1
  73. package/dist/common/overlay.d.ts +1 -1
  74. package/dist/common/page-detect.d.ts +0 -1
  75. package/dist/common/pill-launcher.d.ts +0 -1
  76. package/dist/common/preflight.d.ts +0 -1
  77. package/dist/common/price-formatter.d.ts +0 -1
  78. package/dist/common/product-utils.d.ts +0 -1
  79. package/dist/common/protocol-adapter.d.ts +0 -1
  80. package/dist/common/renderer/dom.d.ts +0 -1
  81. package/dist/common/renderer/index.d.ts +0 -1
  82. package/dist/common/renderer/overrides.d.ts +0 -1
  83. package/dist/common/renderer/registry.d.ts +0 -1
  84. package/dist/common/renderer/types.d.ts +0 -1
  85. package/dist/common/safe-html.d.ts +0 -1
  86. package/dist/common/skeleton.d.ts +0 -1
  87. package/dist/common/streaming.d.ts +0 -1
  88. package/dist/common/suggested-search-keywords.d.ts +0 -1
  89. package/dist/common/theme-utils.d.ts +0 -1
  90. package/dist/common/tts-player.d.ts +0 -1
  91. package/dist/common/types.d.ts +4 -1
  92. package/dist/common/ui-theme.d.ts +0 -1
  93. package/dist/common/uuidv7.d.ts +0 -1
  94. package/dist/common/voice-input.d.ts +0 -1
  95. package/dist/common/widget-base.d.ts +0 -1
  96. package/dist/common-BzegEdJs.cjs +1 -0
  97. package/dist/common-C8NRcP7O.js +367 -0
  98. package/dist/common.cjs +1 -1
  99. package/dist/common.js +86 -7
  100. package/dist/connection-warning-CL1CReZo.cjs +1 -0
  101. package/dist/connection-warning-CVZzlGJt.js +95 -0
  102. package/dist/ga-datalayer-CgI6Kb_i.js +1044 -0
  103. package/dist/ga-datalayer-DkfsAHf9.cjs +47 -0
  104. package/dist/index.cjs +1 -1
  105. package/dist/index.d.ts +0 -1
  106. package/dist/index.js +76 -10
  107. package/dist/native/index.d.ts +0 -1
  108. package/dist/native-webview-B8vOoxns.js +571 -0
  109. package/dist/native-webview-D2lDXTh3.cjs +1 -0
  110. package/dist/native.cjs +1 -1
  111. package/dist/native.iife.js +51 -52
  112. package/dist/native.js +8 -2
  113. package/dist/product-utils-Bm3aiAlJ.js +46 -0
  114. package/dist/product-utils-DLXQQJbh.cjs +1 -0
  115. package/dist/qna/api.d.ts +0 -1
  116. package/dist/qna/catalog.d.ts +0 -1
  117. package/dist/qna/components/ButtonRow.d.ts +0 -1
  118. package/dist/qna/components/TextInput.d.ts +0 -1
  119. package/dist/qna/components/renderUISpec.d.ts +0 -1
  120. package/dist/qna/index.d.ts +0 -1
  121. package/dist/qna/locales/en.d.ts +0 -1
  122. package/dist/qna/locales/index.d.ts +0 -1
  123. package/dist/qna/locales/tr.d.ts +0 -1
  124. package/dist/qna/normalize-ui-specs.d.ts +0 -1
  125. package/dist/qna/types.d.ts +0 -1
  126. package/dist/qna-KizG_W1J.cjs +1 -0
  127. package/dist/qna-YSaIDxjs.js +663 -0
  128. package/dist/qna.cjs +1 -1
  129. package/dist/qna.iife.js +35 -36
  130. package/dist/qna.js +9 -2
  131. package/dist/schemas-B6RjqKrg.cjs +40 -0
  132. package/dist/schemas-PkedCk_-.js +4047 -0
  133. package/dist/simbut/index.d.ts +0 -1
  134. package/dist/simbut/locales.d.ts +0 -1
  135. package/dist/simbut/types.d.ts +0 -1
  136. package/dist/simbut-B2jXtckF.cjs +1 -0
  137. package/dist/simbut-BI054QK0.js +71 -0
  138. package/dist/simbut.cjs +1 -1
  139. package/dist/simbut.iife.js +15 -16
  140. package/dist/simbut.js +5 -2
  141. package/dist/simrel/api.d.ts +0 -1
  142. package/dist/simrel/catalog.d.ts +0 -1
  143. package/dist/simrel/components/GroupTabs.d.ts +0 -1
  144. package/dist/simrel/components/ProductCard.d.ts +0 -1
  145. package/dist/simrel/components/ProductGrid.d.ts +0 -1
  146. package/dist/simrel/components/renderUISpec.d.ts +0 -1
  147. package/dist/simrel/index.d.ts +0 -1
  148. package/dist/simrel/locales/en.d.ts +0 -1
  149. package/dist/simrel/locales/index.d.ts +0 -1
  150. package/dist/simrel/locales/tr.d.ts +0 -1
  151. package/dist/simrel/types.d.ts +0 -1
  152. package/dist/simrel-C-DKpfVB.js +694 -0
  153. package/dist/simrel-vL0woDkE.cjs +1 -0
  154. package/dist/simrel.cjs +1 -1
  155. package/dist/simrel.iife.js +35 -36
  156. package/dist/simrel.js +9 -2
  157. package/package.json +1 -1
  158. package/dist/chat/api.d.ts.map +0 -1
  159. package/dist/chat/attachment-utils.d.ts.map +0 -1
  160. package/dist/chat/catalog.d.ts.map +0 -1
  161. package/dist/chat/chat-presentation-state.d.ts.map +0 -1
  162. package/dist/chat/components/AIGroupingCards.d.ts.map +0 -1
  163. package/dist/chat/components/AISuggestedSearchCards.d.ts.map +0 -1
  164. package/dist/chat/components/AITopPicks.d.ts.map +0 -1
  165. package/dist/chat/components/CategoriesContainer.d.ts.map +0 -1
  166. package/dist/chat/components/ChatDrawer.d.ts.map +0 -1
  167. package/dist/chat/components/ChoicePrompter.d.ts.map +0 -1
  168. package/dist/chat/components/ComparisonTable.d.ts.map +0 -1
  169. package/dist/chat/components/FloatingComparisonButton.d.ts.map +0 -1
  170. package/dist/chat/components/GroundingReviewCard.d.ts.map +0 -1
  171. package/dist/chat/components/HandoffNotice.d.ts.map +0 -1
  172. package/dist/chat/components/KvkkBanner.d.ts.map +0 -1
  173. package/dist/chat/components/Launcher.d.ts.map +0 -1
  174. package/dist/chat/components/PanelTopBar.d.ts.map +0 -1
  175. package/dist/chat/components/ProductSummaryCard.d.ts.map +0 -1
  176. package/dist/chat/components/ProsAndCons.d.ts.map +0 -1
  177. package/dist/chat/components/ReviewHighlights.d.ts.map +0 -1
  178. package/dist/chat/components/ThumbnailsColumn.d.ts.map +0 -1
  179. package/dist/chat/components/actionClassifier.d.ts.map +0 -1
  180. package/dist/chat/components/product-price-layout.d.ts.map +0 -1
  181. package/dist/chat/components/productMentionLinker.d.ts.map +0 -1
  182. package/dist/chat/components/renderUISpec.d.ts.map +0 -1
  183. package/dist/chat/components/typewriter.d.ts.map +0 -1
  184. package/dist/chat/extendedModeManager.d.ts.map +0 -1
  185. package/dist/chat/index.d.ts.map +0 -1
  186. package/dist/chat/kvkk.d.ts.map +0 -1
  187. package/dist/chat/locales/en.d.ts.map +0 -1
  188. package/dist/chat/locales/index.d.ts.map +0 -1
  189. package/dist/chat/locales/tr.d.ts.map +0 -1
  190. package/dist/chat/panel-manager.d.ts.map +0 -1
  191. package/dist/chat/session-persistence.d.ts.map +0 -1
  192. package/dist/chat/stream-error-display.d.ts.map +0 -1
  193. package/dist/chat/types.d.ts.map +0 -1
  194. package/dist/chat/utils/chat-presentation-debug.d.ts.map +0 -1
  195. package/dist/chat/utils/get-chat-scroll-element.d.ts.map +0 -1
  196. package/dist/chat/utils/ui.d.ts.map +0 -1
  197. package/dist/chat-Ck0cC4R_.cjs +0 -94
  198. package/dist/chat-Ck0cC4R_.cjs.map +0 -1
  199. package/dist/chat-CmKpcbQS.js +0 -6574
  200. package/dist/chat-CmKpcbQS.js.map +0 -1
  201. package/dist/chat.iife.js.map +0 -1
  202. package/dist/common/action-router.d.ts.map +0 -1
  203. package/dist/common/activity-tracker.d.ts.map +0 -1
  204. package/dist/common/analytics-events.d.ts.map +0 -1
  205. package/dist/common/analytics.d.ts.map +0 -1
  206. package/dist/common/api-paths.d.ts.map +0 -1
  207. package/dist/common/client.d.ts.map +0 -1
  208. package/dist/common/communication-bridge.d.ts.map +0 -1
  209. package/dist/common/config-schema.d.ts.map +0 -1
  210. package/dist/common/connection-warning.d.ts.map +0 -1
  211. package/dist/common/context.d.ts.map +0 -1
  212. package/dist/common/customization-factories.d.ts.map +0 -1
  213. package/dist/common/debug.d.ts.map +0 -1
  214. package/dist/common/events.d.ts.map +0 -1
  215. package/dist/common/ga-datalayer.d.ts.map +0 -1
  216. package/dist/common/global-error-toast.d.ts.map +0 -1
  217. package/dist/common/index.d.ts.map +0 -1
  218. package/dist/common/indexed-db.d.ts.map +0 -1
  219. package/dist/common/native-webview.d.ts.map +0 -1
  220. package/dist/common/overlay.d.ts.map +0 -1
  221. package/dist/common/page-detect.d.ts.map +0 -1
  222. package/dist/common/pill-launcher.d.ts.map +0 -1
  223. package/dist/common/preflight.d.ts.map +0 -1
  224. package/dist/common/price-formatter.d.ts.map +0 -1
  225. package/dist/common/product-utils.d.ts.map +0 -1
  226. package/dist/common/protocol-adapter.d.ts.map +0 -1
  227. package/dist/common/renderer/dom.d.ts.map +0 -1
  228. package/dist/common/renderer/index.d.ts.map +0 -1
  229. package/dist/common/renderer/overrides.d.ts.map +0 -1
  230. package/dist/common/renderer/registry.d.ts.map +0 -1
  231. package/dist/common/renderer/types.d.ts.map +0 -1
  232. package/dist/common/safe-html.d.ts.map +0 -1
  233. package/dist/common/skeleton.d.ts.map +0 -1
  234. package/dist/common/streaming.d.ts.map +0 -1
  235. package/dist/common/suggested-search-keywords.d.ts.map +0 -1
  236. package/dist/common/theme-utils.d.ts.map +0 -1
  237. package/dist/common/tts-player.d.ts.map +0 -1
  238. package/dist/common/types.d.ts.map +0 -1
  239. package/dist/common/ui-theme.d.ts.map +0 -1
  240. package/dist/common/uuidv7.d.ts.map +0 -1
  241. package/dist/common/voice-input.d.ts.map +0 -1
  242. package/dist/common/widget-base.d.ts.map +0 -1
  243. package/dist/common-C0CDlovf.cjs +0 -2
  244. package/dist/common-C0CDlovf.cjs.map +0 -1
  245. package/dist/common-D7J-qASM.js +0 -357
  246. package/dist/common-D7J-qASM.js.map +0 -1
  247. package/dist/connection-warning-BF8r3_5W.js +0 -96
  248. package/dist/connection-warning-BF8r3_5W.js.map +0 -1
  249. package/dist/connection-warning-Dlirb_Pi.cjs +0 -2
  250. package/dist/connection-warning-Dlirb_Pi.cjs.map +0 -1
  251. package/dist/ga-datalayer-DSVuycfp.cjs +0 -48
  252. package/dist/ga-datalayer-DSVuycfp.cjs.map +0 -1
  253. package/dist/ga-datalayer-DygUbUWr.js +0 -915
  254. package/dist/ga-datalayer-DygUbUWr.js.map +0 -1
  255. package/dist/index.d.ts.map +0 -1
  256. package/dist/native/index.d.ts.map +0 -1
  257. package/dist/native-webview-4YU7k1qK.js +0 -547
  258. package/dist/native-webview-4YU7k1qK.js.map +0 -1
  259. package/dist/native-webview-ifBEffwH.cjs +0 -2
  260. package/dist/native-webview-ifBEffwH.cjs.map +0 -1
  261. package/dist/native.iife.js.map +0 -1
  262. package/dist/product-utils-BEnINMdx.cjs +0 -2
  263. package/dist/product-utils-BEnINMdx.cjs.map +0 -1
  264. package/dist/product-utils-BUalkWz3.js +0 -45
  265. package/dist/product-utils-BUalkWz3.js.map +0 -1
  266. package/dist/qna/api.d.ts.map +0 -1
  267. package/dist/qna/catalog.d.ts.map +0 -1
  268. package/dist/qna/components/ButtonRow.d.ts.map +0 -1
  269. package/dist/qna/components/TextInput.d.ts.map +0 -1
  270. package/dist/qna/components/renderUISpec.d.ts.map +0 -1
  271. package/dist/qna/index.d.ts.map +0 -1
  272. package/dist/qna/locales/en.d.ts.map +0 -1
  273. package/dist/qna/locales/index.d.ts.map +0 -1
  274. package/dist/qna/locales/tr.d.ts.map +0 -1
  275. package/dist/qna/normalize-ui-specs.d.ts.map +0 -1
  276. package/dist/qna/types.d.ts.map +0 -1
  277. package/dist/qna-BUsDAFdn.cjs +0 -2
  278. package/dist/qna-BUsDAFdn.cjs.map +0 -1
  279. package/dist/qna-DrlUFVgh.js +0 -672
  280. package/dist/qna-DrlUFVgh.js.map +0 -1
  281. package/dist/qna.iife.js.map +0 -1
  282. package/dist/schemas-BneJIS3a.cjs +0 -41
  283. package/dist/schemas-BneJIS3a.cjs.map +0 -1
  284. package/dist/schemas-DwX3rpp6.js +0 -3871
  285. package/dist/schemas-DwX3rpp6.js.map +0 -1
  286. package/dist/simbut/index.d.ts.map +0 -1
  287. package/dist/simbut/locales.d.ts.map +0 -1
  288. package/dist/simbut/types.d.ts.map +0 -1
  289. package/dist/simbut-DG48EcoU.js +0 -68
  290. package/dist/simbut-DG48EcoU.js.map +0 -1
  291. package/dist/simbut-DHZFpGIA.cjs +0 -2
  292. package/dist/simbut-DHZFpGIA.cjs.map +0 -1
  293. package/dist/simbut.iife.js.map +0 -1
  294. package/dist/simrel/api.d.ts.map +0 -1
  295. package/dist/simrel/catalog.d.ts.map +0 -1
  296. package/dist/simrel/components/GroupTabs.d.ts.map +0 -1
  297. package/dist/simrel/components/ProductCard.d.ts.map +0 -1
  298. package/dist/simrel/components/ProductGrid.d.ts.map +0 -1
  299. package/dist/simrel/components/renderUISpec.d.ts.map +0 -1
  300. package/dist/simrel/index.d.ts.map +0 -1
  301. package/dist/simrel/locales/en.d.ts.map +0 -1
  302. package/dist/simrel/locales/index.d.ts.map +0 -1
  303. package/dist/simrel/locales/tr.d.ts.map +0 -1
  304. package/dist/simrel/types.d.ts.map +0 -1
  305. package/dist/simrel-B6PD6vfG.js +0 -699
  306. package/dist/simrel-B6PD6vfG.js.map +0 -1
  307. package/dist/simrel-BIp8IAYj.cjs +0 -2
  308. package/dist/simrel-BIp8IAYj.cjs.map +0 -1
  309. package/dist/simrel.iife.js.map +0 -1
@@ -1,915 +0,0 @@
1
- //#region src/common/analytics-events.ts
2
- function e(e, t) {
3
- let n = {
4
- event_name: "stream.start",
5
- account_id: e.account_id,
6
- session_id: e.session_id,
7
- correlation_id: e.correlation_id,
8
- payload: {
9
- endpoint: t.endpoint,
10
- request_id: t.request_id
11
- }
12
- };
13
- 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;
14
- }
15
- function t(e, t) {
16
- let n = {
17
- request_id: t.request_id,
18
- chunk_index: t.chunk_index
19
- };
20
- t.latency_ms !== void 0 && (n.latency_ms = t.latency_ms);
21
- let r = {
22
- event_name: "stream.chunk",
23
- account_id: e.account_id,
24
- session_id: e.session_id,
25
- correlation_id: e.correlation_id,
26
- payload: n
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), t.widget !== void 0 && (r.widget = t.widget), e.page_type !== void 0 && (r.page_type = e.page_type), e.sku !== void 0 && (r.sku = e.sku), r;
29
- }
30
- function n(e, t) {
31
- let n = {
32
- event_name: "stream.ui_spec",
33
- account_id: e.account_id,
34
- session_id: e.session_id,
35
- correlation_id: e.correlation_id,
36
- payload: {
37
- request_id: t.request_id,
38
- chunk_index: t.chunk_index,
39
- component_type: t.component_type
40
- }
41
- };
42
- 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;
43
- }
44
- function r(e, t) {
45
- let n = {
46
- event_name: "stream.done",
47
- account_id: e.account_id,
48
- session_id: e.session_id,
49
- correlation_id: e.correlation_id,
50
- payload: {
51
- request_id: t.request_id,
52
- latency_ms: t.latency_ms,
53
- chunk_count: t.chunk_count
54
- }
55
- };
56
- 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;
57
- }
58
- function i(e, t) {
59
- let n = {
60
- event_name: "stream.error",
61
- account_id: e.account_id,
62
- session_id: e.session_id,
63
- correlation_id: e.correlation_id,
64
- payload: {
65
- request_id: t.request_id,
66
- error_code: t.error_code,
67
- error_message: t.error_message
68
- }
69
- };
70
- 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;
71
- }
72
- function a(e, t) {
73
- let n = {
74
- model: t.model,
75
- prompt_tokens: t.prompt_tokens,
76
- completion_tokens: t.completion_tokens,
77
- total_tokens: t.total_tokens
78
- };
79
- t.provider !== void 0 && (n.provider = t.provider);
80
- let r = {
81
- event_name: "llm.usage",
82
- account_id: e.account_id,
83
- session_id: e.session_id,
84
- correlation_id: e.correlation_id,
85
- payload: n
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;
88
- }
89
- function o(e, t) {
90
- let n = {
91
- event_name: "metering.increment",
92
- account_id: e.account_id,
93
- session_id: e.session_id,
94
- correlation_id: e.correlation_id,
95
- payload: {
96
- meter_key: t.meter_key,
97
- quantity: t.quantity,
98
- unit: t.unit
99
- }
100
- };
101
- 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;
102
- }
103
- function s(e, t) {
104
- let n = {
105
- event_name: "metering.summary",
106
- account_id: e.account_id,
107
- session_id: e.session_id,
108
- correlation_id: e.correlation_id,
109
- payload: {
110
- meter_key: t.meter_key,
111
- quantity: t.quantity,
112
- unit: t.unit
113
- }
114
- };
115
- 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;
116
- }
117
- function c(e, t) {
118
- let n = {
119
- event_name: "chat.history.snapshot",
120
- account_id: e.account_id,
121
- session_id: e.session_id,
122
- correlation_id: e.correlation_id,
123
- payload: {
124
- message_count: t.message_count,
125
- history_ref: t.history_ref,
126
- redaction_level: t.redaction_level
127
- }
128
- };
129
- 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;
130
- }
131
- function l(e, t) {
132
- let n = {
133
- event_name: "widget.history.snapshot",
134
- account_id: e.account_id,
135
- session_id: e.session_id,
136
- correlation_id: e.correlation_id,
137
- widget: t.widget,
138
- payload: {
139
- message_count: t.message_count,
140
- history_ref: t.history_ref,
141
- redaction_level: t.redaction_level
142
- }
143
- };
144
- 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;
145
- }
146
- function u(e, t) {
147
- let n = {
148
- event_name: "basket.add",
149
- account_id: e.account_id,
150
- session_id: e.session_id,
151
- correlation_id: e.correlation_id,
152
- widget: t.attribution_source,
153
- payload: {
154
- attribution_source: t.attribution_source,
155
- attribution_action_id: t.attribution_action_id,
156
- cart_value: t.cart_value,
157
- currency: t.currency,
158
- line_items: t.line_items,
159
- sku: t.sku
160
- }
161
- };
162
- 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;
163
- }
164
- function d(e, t) {
165
- let n = {
166
- event_name: "checkout.start",
167
- account_id: e.account_id,
168
- session_id: e.session_id,
169
- correlation_id: e.correlation_id,
170
- widget: t.attribution_source,
171
- payload: {
172
- attribution_source: t.attribution_source,
173
- attribution_action_id: t.attribution_action_id,
174
- cart_value: t.cart_value,
175
- currency: t.currency,
176
- line_items: t.line_items
177
- }
178
- };
179
- 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;
180
- }
181
- function f(e, t) {
182
- let n = {
183
- event_name: "checkout.complete",
184
- account_id: e.account_id,
185
- session_id: e.session_id,
186
- correlation_id: e.correlation_id,
187
- widget: t.attribution_source,
188
- payload: {
189
- attribution_source: t.attribution_source,
190
- attribution_action_id: t.attribution_action_id,
191
- cart_value: t.cart_value,
192
- currency: t.currency,
193
- line_items: t.line_items
194
- }
195
- };
196
- 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;
197
- }
198
- //#endregion
199
- //#region src/common/safe-html.ts
200
- var p = new Set(/* @__PURE__ */ "p.br.a.strong.b.em.i.u.ul.ol.li.h1.h2.h3.h4.h5.h6.span.div.table.thead.tbody.tr.th.td.hr.code.pre.blockquote.img.sup.sub".split(".")), ee = new Set([
201
- "script",
202
- "iframe",
203
- "object",
204
- "embed",
205
- "form",
206
- "input",
207
- "textarea",
208
- "select",
209
- "button",
210
- "style",
211
- "link",
212
- "meta",
213
- "template",
214
- "noscript"
215
- ]), m = {
216
- "*": new Set(["class"]),
217
- a: new Set([
218
- "href",
219
- "target",
220
- "rel"
221
- ]),
222
- img: new Set([
223
- "src",
224
- "alt",
225
- "width",
226
- "height"
227
- ]),
228
- div: new Set(["style"]),
229
- span: new Set(["style"]),
230
- p: new Set(["style"])
231
- };
232
- function te(e) {
233
- return /^\s*javascript\s*:/i.test(e);
234
- }
235
- var ne = new Set(/* @__PURE__ */ "color.background-color.font-size.font-weight.font-style.font-family.text-align.text-decoration.line-height.letter-spacing.margin.margin-top.margin-right.margin-bottom.margin-left.padding.padding-top.padding-right.padding-bottom.padding-left.border.border-top.border-right.border-bottom.border-left.border-radius.border-color.border-width.border-style.width.max-width.min-width.height.max-height.min-height.display.vertical-align.white-space.word-break.overflow.opacity.visibility.list-style.list-style-type.text-transform.text-indent.text-overflow.box-sizing.flex.flex-direction.flex-wrap.justify-content.align-items.gap".split(".")), re = /url\s*\(|expression\s*\(|javascript\s*:|\bimport\b|-moz-binding|behavior\s*:/i;
236
- function h(e) {
237
- let t = [];
238
- for (let n of e.split(";")) {
239
- let e = n.trim();
240
- if (!e) continue;
241
- let r = e.indexOf(":");
242
- if (r === -1) continue;
243
- let i = e.slice(0, r).trim().toLowerCase(), a = e.slice(r + 1).trim();
244
- ne.has(i) && (re.test(a) || t.push(e));
245
- }
246
- return t.join("; ");
247
- }
248
- function g(e, t) {
249
- if (e.nodeType === Node.TEXT_NODE) return;
250
- if (e.nodeType !== Node.ELEMENT_NODE) {
251
- e.parentNode?.removeChild(e);
252
- return;
253
- }
254
- let n = e, r = n.tagName.toLowerCase();
255
- if (ee.has(r)) {
256
- n.parentNode?.removeChild(n);
257
- return;
258
- }
259
- if (!p.has(r)) {
260
- let e = Array.from(n.childNodes);
261
- for (let r of e) t.insertBefore(r, n);
262
- t.removeChild(n);
263
- for (let n of e) g(n, t);
264
- return;
265
- }
266
- let i = m["*"] ?? /* @__PURE__ */ new Set(), a = m[r] ?? /* @__PURE__ */ new Set(), o = Array.from(n.attributes);
267
- for (let e of o) {
268
- let t = e.name.toLowerCase();
269
- if (!i.has(t) && !a.has(t)) {
270
- n.removeAttribute(e.name);
271
- continue;
272
- }
273
- if (te(e.value)) {
274
- n.removeAttribute(e.name);
275
- continue;
276
- }
277
- if (t === "style") {
278
- let t = h(e.value);
279
- t ? n.setAttribute("style", t) : n.removeAttribute("style");
280
- continue;
281
- }
282
- }
283
- if (r === "a") {
284
- let e = n.getAttribute("href");
285
- if (e !== null) {
286
- let t = e.trim().toLowerCase();
287
- !t.startsWith("http://") && !t.startsWith("https://") && !t.startsWith("mailto:") && n.removeAttribute("href");
288
- }
289
- n.setAttribute("target", "_blank"), n.setAttribute("rel", "noopener noreferrer");
290
- }
291
- if (r === "img") {
292
- let e = n.getAttribute("src");
293
- e !== null && (e.trim().toLowerCase().startsWith("https://") || n.removeAttribute("src"));
294
- }
295
- let s = Array.from(n.childNodes);
296
- for (let e of s) g(e, n);
297
- }
298
- var _ = ["http:", "https:"];
299
- function ie(e) {
300
- try {
301
- return _.includes(new URL(e).protocol);
302
- } catch {
303
- return !1;
304
- }
305
- }
306
- function v(e) {
307
- if (e.startsWith("/") && !e.startsWith("//")) return !0;
308
- try {
309
- let t = new URL(e);
310
- return _.includes(t.protocol);
311
- } catch {
312
- return !1;
313
- }
314
- }
315
- function ae(e, t, n) {
316
- (t === "href" || t === "src") && !v(n) || e.setAttribute(t, n);
317
- }
318
- function oe(e) {
319
- if (!e) return "";
320
- let t = new DOMParser().parseFromString(e, "text/html").body, n = Array.from(t.childNodes);
321
- for (let e of n) g(e, t);
322
- return t.innerHTML;
323
- }
324
- //#endregion
325
- //#region src/common/events.ts
326
- function se(e, t) {
327
- window.dispatchEvent(new CustomEvent(e, {
328
- detail: t,
329
- bubbles: !1
330
- }));
331
- }
332
- function y(e, t) {
333
- let n = (e) => {
334
- t(e.detail);
335
- };
336
- return window.addEventListener(e, n), () => window.removeEventListener(e, n);
337
- }
338
- function ce(e) {
339
- if (e.type !== "user_message" && e.type !== "inputText") return null;
340
- if (typeof e.payload == "string" && e.payload.trim().length > 0) return e.payload.trim();
341
- if (typeof e.payload == "object" && e.payload !== null) {
342
- let t = e.payload;
343
- if (typeof t.text == "string") {
344
- let e = t.text.trim();
345
- if (e.length > 0) return e;
346
- }
347
- }
348
- return typeof e.title == "string" && e.title.trim().length > 0 ? e.title.trim() : null;
349
- }
350
- function b(e) {
351
- if (e.type !== "inputText" && e.type !== "user_message") return e;
352
- let t = typeof e.payload == "string" ? { text: e.payload.trim() } : e.payload != null && typeof e.payload == "object" && !Array.isArray(e.payload) ? { ...e.payload } : {};
353
- if (typeof t.text != "string" || !t.text.trim()) {
354
- let n = e.title?.trim();
355
- n && (t.text = n);
356
- }
357
- return "is_launcher" in t || (t.is_launcher = 1), "is_suggested_text" in t || (t.is_suggested_text = 1), {
358
- ...e,
359
- payload: t
360
- };
361
- }
362
- function x(e) {
363
- let t = !1, n = [], r = 0, i = null, a = 0;
364
- function o() {
365
- return window.gengage?.chat ?? null;
366
- }
367
- function s() {
368
- t ||= (console.warn("[gengage] QNA tried to open chat, but chat widget is not initialized. Ensure GengageChat is initialized before calling wireQNAToChat()."), !0), e?.onChatUnavailable?.();
369
- }
370
- function c(e, t) {
371
- if (e.openWithAction) {
372
- let n = t.type === "inputText" || t.type === "user_message" ? b(t) : t;
373
- e.openWithAction(n);
374
- return;
375
- }
376
- let n = ce(t);
377
- if (n && e.sendMessage) {
378
- e.open?.(), e.sendMessage(n);
379
- return;
380
- }
381
- }
382
- function l() {
383
- i !== null && (window.clearInterval(i), i = null);
384
- }
385
- function u() {
386
- let e = o();
387
- if (!e) return !1;
388
- if (r > 0 && (e.open?.(), r = 0), n.length > 0) {
389
- let t = n.splice(0, n.length);
390
- for (let n of t) c(e, n);
391
- }
392
- return l(), !0;
393
- }
394
- function d() {
395
- i === null && (a = Date.now(), i = window.setInterval(() => {
396
- u() || Date.now() - a >= 5e3 && (n.length = 0, r = 0, l());
397
- }, 100));
398
- }
399
- let f = y("gengage:qna:action", (e) => {
400
- let t = o();
401
- if (t) {
402
- c(t, e);
403
- return;
404
- }
405
- s(), n.length >= 20 && n.shift(), n.push(e), d();
406
- }), p = y("gengage:qna:open-chat", () => {
407
- let e = o();
408
- if (e) {
409
- e.open?.();
410
- return;
411
- }
412
- s(), r += 1, d();
413
- });
414
- return () => {
415
- f(), p(), n.length = 0, r = 0, l();
416
- };
417
- }
418
- function S() {
419
- return y("gengage:similar:product-click", ({ sku: e, url: t, sessionId: n }) => {
420
- n && window.gengage?.chat?.saveSession(n, e), v(t) && (window.location.href = t);
421
- });
422
- }
423
- //#endregion
424
- //#region src/common/context.ts
425
- function C() {
426
- let e = window.__gengageSessionId ?? sessionStorage.getItem("gengage_session_id") ?? null ?? crypto.randomUUID();
427
- return window.__gengageSessionId = e, sessionStorage.setItem("gengage_session_id", e), window.gengage || (window.gengage = {}), window.gengage.sessionId = e, e;
428
- }
429
- function w() {
430
- return window.gengage?.pageContext ?? null;
431
- }
432
- function T(e) {
433
- window.gengage || (window.gengage = {}), window.gengage.pageContext = {
434
- pageType: "other",
435
- ...window.gengage.pageContext,
436
- ...e
437
- }, window.dispatchEvent(new CustomEvent("gengage:context:update", { detail: e }));
438
- }
439
- function E(e) {
440
- return {
441
- sessionId: e?.sessionId ?? C(),
442
- ...e
443
- };
444
- }
445
- //#endregion
446
- //#region src/common/ui-theme.ts
447
- var D = {
448
- "--gengage-chat-offset": "20px",
449
- "--gengage-chat-launcher-size": "56px",
450
- "--gengage-chat-width": "400px",
451
- "--gengage-chat-shell-radius": "1rem",
452
- "--gengage-chat-header-height": "72px",
453
- "--gengage-chat-conversation-width": "396px",
454
- "--gengage-chat-panel-min-width": "320px",
455
- "--gengage-chat-panel-max-width": "1200px",
456
- "--gengage-chat-input-height": "48px",
457
- "--gengage-qna-pill-radius": "999px",
458
- "--gengage-qna-input-radius": "12px",
459
- "--gengage-simrel-card-radius": "0.75rem",
460
- "--radius-control": "12px",
461
- "--radius-card": "16px",
462
- "--radius-panel": "24px",
463
- "--radius-pill": "999px",
464
- "--surface-card-muted": "#f8fafc",
465
- "--text-secondary": "#4b5563",
466
- "--text-muted": "#6b7280",
467
- "--border-default": "rgba(17, 24, 39, 0.10)"
468
- };
469
- function O(e) {
470
- return e ? {
471
- ...D,
472
- ...e
473
- } : { ...D };
474
- }
475
- //#endregion
476
- //#region src/common/theme-utils.ts
477
- var k = {
478
- primaryColor: "#b7102a",
479
- primaryForeground: "#ffffff",
480
- backgroundColor: "#ffffff",
481
- foregroundColor: "#111827",
482
- borderRadius: "0.75rem",
483
- fontFamily: "\"Plus Jakarta Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif",
484
- fontSize: "14px",
485
- zIndex: "1000",
486
- "--glov-chatbot-width": "420px",
487
- "--glov-left-spacing": "260px",
488
- "--chatbot-padding": "16px",
489
- "--root-wrapper-background-color": "#f8f9fa",
490
- "--root-wrapper-border-color": "#edeeef",
491
- "--gengage-chat-width": "400px",
492
- "--gengage-chat-shell-radius": "1rem",
493
- "--gengage-chat-header-height": "72px",
494
- "--gengage-chat-conversation-width": "396px",
495
- "--gengage-chat-panel-min-width": "320px",
496
- "--gengage-chat-panel-max-width": "1200px",
497
- "--gengage-chat-input-height": "48px",
498
- "--gengage-qna-pill-radius": "999px",
499
- "--gengage-qna-input-radius": "0.75rem",
500
- "--gengage-simrel-card-radius": "0.75rem",
501
- "--client-primary": "#b7102a",
502
- "--client-primary-hover": "color-mix(in srgb, #b7102a 88%, black 12%)",
503
- "--client-primary-active": "color-mix(in srgb, #b7102a 78%, black 22%)",
504
- "--client-primary-subtle": "color-mix(in srgb, #b7102a 12%, white)",
505
- "--client-primary-soft": "color-mix(in srgb, #b7102a 20%, white)",
506
- "--client-on-primary": "#ffffff",
507
- "--client-focus-ring": "color-mix(in srgb, #b7102a 32%, transparent)",
508
- "--surface-page": "#f6f7fb",
509
- "--surface-shell": "#10131a",
510
- "--surface-card": "#ffffff",
511
- "--surface-card-muted": "#f8fafc",
512
- "--surface-card-soft": "#f8fafc",
513
- "--surface-elevated": "#ffffff",
514
- "--surface-input": "#ffffff",
515
- "--surface-overlay": "rgba(16, 19, 26, 0.52)",
516
- "--text-primary": "#111827",
517
- "--text-secondary": "#4b5563",
518
- "--text-muted": "#6b7280",
519
- "--text-inverse": "#f9fafb",
520
- "--border-subtle": "rgba(17, 24, 39, 0.06)",
521
- "--border-default": "rgba(17, 24, 39, 0.10)",
522
- "--border-strong": "rgba(17, 24, 39, 0.18)",
523
- "--shadow-1": "0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06)",
524
- "--shadow-2": "0 4px 12px rgba(16, 24, 40, 0.08)",
525
- "--shadow-3": "0 10px 24px rgba(16, 24, 40, 0.12)",
526
- "--radius-control": "12px",
527
- "--radius-card": "16px",
528
- "--radius-panel": "24px",
529
- "--radius-pill": "999px",
530
- "--success": "#16a34a",
531
- "--warning": "#d97706",
532
- "--error": "#dc2626",
533
- "--info": "#2563eb",
534
- "--rating": "#f5b301",
535
- "--ai-accent-start": "#0b24d6",
536
- "--ai-accent-end": "#f768f2",
537
- "--ai-accent-soft": "linear-gradient(135deg, rgba(11, 36, 214, 0.08), rgba(247, 104, 242, 0.08))"
538
- };
539
- function le(e) {
540
- return {
541
- ...k,
542
- ...e
543
- };
544
- }
545
- //#endregion
546
- //#region src/common/global-error-toast.ts
547
- var A = "gengage-global-toast-root", j = "gengage-global-toast-style", M = "gengage-global-toast-root--visible", ue = 4200, de = 1500, fe = 15e3, N = [
548
- "--gengage-font-family",
549
- "--surface-card",
550
- "--text-primary",
551
- "--text-muted",
552
- "--border-default",
553
- "--radius-card",
554
- "--shadow-3",
555
- "--error",
556
- "--ds-toast-error-bg",
557
- "--ds-toast-error-border",
558
- "--ds-toast-error-accent",
559
- "--ds-toast-error-fg",
560
- "--ds-toast-error-shadow"
561
- ], P = !1, F = null, I = [
562
- /failed to fetch/i,
563
- /networkerror/i,
564
- /network request failed/i,
565
- /load failed/i,
566
- /err_network/i,
567
- /fetch failed/i,
568
- /network error/i
569
- ];
570
- function L(e) {
571
- return typeof e == "string" && e.toLowerCase().startsWith("tr");
572
- }
573
- function R(e) {
574
- if (typeof navigator < "u" && navigator.onLine === !1) return !0;
575
- let t = e instanceof Error ? e.message.trim() : "";
576
- return t ? I.some((e) => e.test(t)) : !1;
577
- }
578
- function z(e, t) {
579
- return R(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.";
580
- }
581
- function B() {
582
- P || typeof window > "u" || typeof document > "u" || (P = !0, y("gengage:global:error", (e) => {
583
- V(e);
584
- }));
585
- }
586
- function V(e) {
587
- if (typeof document > "u") return;
588
- let t = e.message.trim();
589
- if (!t) return;
590
- _e();
591
- let n = me();
592
- he(n), n.innerHTML = "";
593
- let r = document.createElement("section");
594
- r.className = "gengage-global-toast gengage-global-toast--error", r.setAttribute("role", "status"), r.setAttribute("aria-live", "polite");
595
- let i = document.createElement("div");
596
- i.className = "gengage-global-toast-title", i.textContent = pe(e.source);
597
- let a = document.createElement("div");
598
- a.className = "gengage-global-toast-message", a.textContent = t, r.appendChild(i), r.appendChild(a), n.appendChild(r), n.classList.add(M), F &&= (clearTimeout(F), null), e.sticky !== !0 && (F = setTimeout(() => {
599
- H();
600
- }, ge(e.durationMs)));
601
- }
602
- function H() {
603
- if (typeof document > "u") return;
604
- let e = document.getElementById(A);
605
- e && (e.classList.remove(M), e.innerHTML = "", F &&= (clearTimeout(F), null));
606
- }
607
- function pe(e) {
608
- switch (e) {
609
- case "chat": return "Chat warning";
610
- case "qna": return "QnA warning";
611
- case "simrel": return "Widget warning";
612
- default: return "Connection warning";
613
- }
614
- }
615
- function me() {
616
- let e = document.getElementById(A);
617
- if (e instanceof HTMLElement) return e;
618
- let t = document.createElement("div");
619
- return t.id = A, t.className = "gengage-global-toast-root", document.body.appendChild(t), t;
620
- }
621
- function he(e) {
622
- if (typeof document > "u" || typeof window > "u") return;
623
- let t = document.querySelector(".gengage-chat-root, .gengage-qna-container, .gengage-simrel-container, .gengage-simbut-root");
624
- if (!t) return;
625
- let n = window.getComputedStyle(t);
626
- for (let t of N) {
627
- let r = n.getPropertyValue(t).trim();
628
- r ? e.style.setProperty(t, r) : e.style.removeProperty(t);
629
- }
630
- }
631
- function ge(e) {
632
- return typeof e != "number" || !Number.isFinite(e) ? ue : Math.min(fe, Math.max(de, Math.round(e)));
633
- }
634
- function _e() {
635
- if (document.getElementById(j)) return;
636
- let e = document.createElement("style");
637
- e.id = j;
638
- let t = k["--surface-card"] ?? k.backgroundColor ?? "#ffffff", n = k["--text-primary"] ?? k.foregroundColor ?? "#111827", r = k["--border-default"] ?? "rgba(17, 24, 39, 0.10)", i = k["--error"] ?? "#dc2626", a = k["--shadow-3"] ?? "0 10px 24px rgba(16, 24, 40, 0.12)", o = k["--radius-card"] ?? "16px", s = k["--text-muted"] ?? "#6b7280";
639
- e.textContent = `
640
- #${A} {
641
- position: fixed;
642
- top: 16px;
643
- right: 16px;
644
- z-index: 2147483646;
645
- pointer-events: none;
646
- }
647
- #${A}.${M} {
648
- pointer-events: auto;
649
- }
650
- #${A} .gengage-global-toast {
651
- min-width: 260px;
652
- max-width: min(92vw, 420px);
653
- border-radius: var(--radius-card, ${o});
654
- border: 1px solid var(--ds-toast-error-border, color-mix(in srgb, var(--error, ${i}) 18%, var(--border-default, ${r})));
655
- border-left: 4px solid var(--ds-toast-error-accent, var(--error, ${i}));
656
- background: var(--ds-toast-error-bg, color-mix(in srgb, var(--error, ${i}) 5%, var(--surface-card, ${t})));
657
- color: var(--ds-toast-error-fg, color-mix(in srgb, var(--error, ${i}) 22%, var(--text-primary, ${n})));
658
- box-shadow: var(--ds-toast-error-shadow, var(--shadow-3, ${a}));
659
- padding: 10px 12px;
660
- font-family: var(--gengage-font-family, ${JSON.stringify(k.fontFamily ?? "-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif")});
661
- font-size: 13px;
662
- line-height: 1.4;
663
- animation: gengage-global-toast-in 180ms ease-out forwards;
664
- }
665
- #${A} .gengage-global-toast-title {
666
- margin: 0 0 4px;
667
- font-size: 12px;
668
- font-weight: 700;
669
- color: var(--text-muted, ${s});
670
- }
671
- #${A} .gengage-global-toast-message {
672
- margin: 0;
673
- font-weight: 500;
674
- }
675
- @keyframes gengage-global-toast-in {
676
- from {
677
- opacity: 0;
678
- transform: translateY(-8px);
679
- }
680
- to {
681
- opacity: 1;
682
- transform: translateY(0);
683
- }
684
- }
685
- `, document.head.appendChild(e);
686
- }
687
- //#endregion
688
- //#region src/common/debug.ts
689
- var U = null;
690
- function ve() {
691
- if (U !== null) return U;
692
- try {
693
- U = localStorage.getItem("gengage:debug") === "1";
694
- } catch {
695
- U = !1;
696
- }
697
- return U;
698
- }
699
- function W(e, t, n) {
700
- if (!ve()) return;
701
- let r = [`[gengage:${e}]`, t];
702
- n !== void 0 && r.push(n), console.debug(...r);
703
- }
704
- //#endregion
705
- //#region src/common/widget-base.ts
706
- var ye = class {
707
- constructor() {
708
- this.isVisible = !1, this.isInitialised = !1, this._handlers = /* @__PURE__ */ new Map(), this._cleanups = [], this._ownsRoot = !1, this._destroying = !1;
709
- }
710
- async init(e) {
711
- if (this.isInitialised) {
712
- console.warn("[gengage] Widget already initialised. Call update() instead.");
713
- return;
714
- }
715
- let t = O(e.theme);
716
- this.config = {
717
- ...e,
718
- theme: t,
719
- session: E(e.session)
720
- }, this.root = this._resolveMount(e.mountTarget), this._applyTheme(t), B();
721
- let n = y("gengage:context:update", (e) => this.update(e));
722
- this._cleanups.push(n), W("lifecycle", `${this.constructor.name}.init`, {
723
- accountId: e.accountId,
724
- sku: e.pageContext?.sku
725
- });
726
- try {
727
- await this.onInit(this.config);
728
- } catch (e) {
729
- throw this.destroy(), e;
730
- }
731
- this._destroying || (this.isInitialised = !0, W("lifecycle", `${this.constructor.name} ready`), this.emit("ready"));
732
- }
733
- update(e) {
734
- this.isInitialised && (this.config.pageContext ? this.config = {
735
- ...this.config,
736
- pageContext: {
737
- ...this.config.pageContext,
738
- ...e
739
- }
740
- } : e.pageType !== void 0 && (this.config = {
741
- ...this.config,
742
- pageContext: e
743
- }), this.onUpdate(e), this.emit("context-update", this.config.pageContext));
744
- }
745
- show() {
746
- this.isVisible || (this.isVisible = !0, this.root.style.display = "", this.onShow(), this.emit("show"));
747
- }
748
- hide() {
749
- this.isVisible && (this.isVisible = !1, this.root.style.display = "none", this.onHide(), this.emit("hide"));
750
- }
751
- destroy() {
752
- this._destroying || (this._destroying = !0, this.emit("destroy"), this._cleanups.forEach((e) => e()), this._cleanups.length = 0, this._handlers.clear(), this.onDestroy(), this.config.analyticsClient?.destroy(), this._ownsRoot ? this.root.remove() : this.root.innerHTML = "", this.isInitialised = !1);
753
- }
754
- on(e, t) {
755
- return this._handlers.has(e) || this._handlers.set(e, /* @__PURE__ */ new Set()), this._handlers.get(e).add(t), () => this._handlers.get(e)?.delete(t);
756
- }
757
- trackCheckout(e, t) {
758
- let n = e === "start" ? d : f;
759
- this.track(n(this.analyticsContext(), t));
760
- }
761
- flushMeteringSummary(e) {
762
- this.track(s(this.analyticsContext(), e));
763
- }
764
- emit(e, ...t) {
765
- this._handlers.get(e)?.forEach((e) => e(...t));
766
- }
767
- addCleanup(e) {
768
- this._cleanups.push(e);
769
- }
770
- track(e) {
771
- this.config.analyticsClient?.track(e);
772
- }
773
- analyticsContext() {
774
- let e = {
775
- account_id: this.config.accountId,
776
- session_id: this.config.session?.sessionId ?? "",
777
- correlation_id: this.config.session?.sessionId ?? ""
778
- };
779
- return this.config.session?.viewId !== void 0 && (e.view_id = this.config.session.viewId), this.config.session?.userId !== void 0 && (e.user_id = this.config.session.userId), this.config.pageContext?.pageType !== void 0 && (e.page_type = this.config.pageContext.pageType), this.config.pageContext?.sku !== void 0 && (e.sku = this.config.pageContext.sku), this.config.session?.abTestVariant !== void 0 && (e.ab_test_variant = this.config.session.abTestVariant), this.config.session?.abTestExperimentId !== void 0 && (e.ab_test_experiment_id = this.config.session.abTestExperimentId), e;
780
- }
781
- _resolveMount(e) {
782
- if (e instanceof HTMLElement) return e;
783
- if (typeof e == "string") {
784
- let t = document.querySelector(e);
785
- if (!t) throw Error(`[gengage] Mount target not found: "${e}"`);
786
- return t;
787
- }
788
- let t = document.createElement("div");
789
- return t.dataset.gengageWidget = this.constructor.name.toLowerCase(), document.body.insertBefore(t, document.body.firstChild), this._ownsRoot = !0, t;
790
- }
791
- _applyTheme(e) {
792
- if (e) {
793
- for (let [t, n] of Object.entries(e)) if (n !== void 0) {
794
- let e = t.startsWith("--") ? t : `--gengage-${be(t)}`;
795
- this.root.style.setProperty(e, n);
796
- }
797
- }
798
- }
799
- };
800
- function be(e) {
801
- return e.replace(/([A-Z])/g, "-$1").toLowerCase();
802
- }
803
- //#endregion
804
- //#region src/common/ga-datalayer.ts
805
- function xe() {
806
- return typeof window < "u" && Array.isArray(window.dataLayer);
807
- }
808
- function G(e, t) {
809
- let n = {
810
- event: e,
811
- ...t
812
- };
813
- xe() && window.dataLayer.push(n);
814
- }
815
- function K(e) {
816
- G("gengage-on-init", { gengage_widget: e });
817
- }
818
- function q(e) {
819
- G("gengage-show", { gengage_widget: e });
820
- }
821
- function Se(e) {
822
- G("gengage-hide", { gengage_widget: e });
823
- }
824
- function J(e, t) {
825
- G("gengage-suggested-question", {
826
- gengage_question_title: e,
827
- gengage_action_type: t
828
- });
829
- }
830
- function Ce(e) {
831
- G("gengage-find-similars", { gengage_sku: e });
832
- }
833
- function we(e) {
834
- G("gengage-compare-preselection", { gengage_sku: e });
835
- }
836
- function Te(e) {
837
- G("gengage-compare-selected", {
838
- gengage_skus: e,
839
- gengage_product_count: e.length
840
- });
841
- }
842
- function Y() {
843
- G("gengage-compare-clear");
844
- }
845
- function Ee(e) {
846
- G("gengage-compare-received", { gengage_product_count: e });
847
- }
848
- function De(e) {
849
- G("gengage-like-product", { gengage_sku: e });
850
- }
851
- function Oe() {
852
- G("gengage-like-list");
853
- }
854
- function ke(e, t) {
855
- G("gengage-search", {
856
- gengage_search_query: e,
857
- gengage_result_count: t
858
- });
859
- }
860
- function X(e, t) {
861
- G("gengage-product-detail", {
862
- gengage_sku: e,
863
- gengage_product_name: t
864
- });
865
- }
866
- function Z(e, t) {
867
- G("gengage-cart-add", {
868
- gengage_sku: e,
869
- gengage_quantity: t
870
- });
871
- }
872
- function Ae() {
873
- G("gengage-message-sent");
874
- }
875
- function je() {
876
- G("gengage-message-received");
877
- }
878
- function Me() {
879
- G("gengage-conversation-start");
880
- }
881
- function Q() {
882
- G("gengage-voice-input");
883
- }
884
- function Ne(e, t) {
885
- G("gengage-error", {
886
- gengage_widget: e,
887
- gengage_error: t
888
- });
889
- }
890
- var $ = null;
891
- function Pe() {
892
- if (typeof window > "u") return () => {};
893
- if ($) return $;
894
- let e = [];
895
- function t(t, n) {
896
- let r = (e) => n(e.detail);
897
- window.addEventListener(t, r), e.push(() => window.removeEventListener(t, r));
898
- }
899
- return t("gengage:chat:open", () => q("chat")), t("gengage:chat:close", () => Se("chat")), t("gengage:chat:ready", () => K("chat")), t("gengage:similar:add-to-cart", ({ sku: e, quantity: t }) => {
900
- Z(e, t);
901
- }), t("gengage:similar:product-click", ({ sku: e }) => {
902
- X(e);
903
- }), t("gengage:qna:action", ({ title: e, type: t }) => {
904
- J(e, t);
905
- }), t("gengage:chat:voice", () => Q()), t("gengage:qna:open-chat", () => q("chat")), t("gengage:global:error", ({ source: e, message: t }) => {
906
- Ne(e, t);
907
- }), $ = () => {
908
- for (let t of e) t();
909
- e.length = 0, $ = null;
910
- }, $;
911
- }
912
- //#endregion
913
- export { n as $, C as A, ae as B, R as C, le as D, k as E, y as F, d as G, u as H, x as I, s as J, a as K, S as L, E as M, T as N, D as O, se as P, e as Q, ie as R, z as S, V as T, c as U, oe as V, f as W, r as X, t as Y, i as Z, Q as _, Te as a, W as b, K as c, je as d, l as et, Ae as f, J as g, q as h, Ee as i, w as j, O as k, Oe as l, ke as m, Y as n, Me as o, X as p, o as q, we as r, Ce as s, Z as t, De as u, Pe as v, B as w, H as x, ye as y, v as z };
914
-
915
- //# sourceMappingURL=ga-datalayer-DygUbUWr.js.map