@gengage/assistant-fe 0.5.7 → 0.6.0

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 (190) hide show
  1. package/dist/agentic/adaptor/create-adaptor.d.ts +19 -0
  2. package/dist/agentic/adaptor/fetch-bridge.d.ts +11 -0
  3. package/dist/agentic/adaptor/mount.d.ts +38 -0
  4. package/dist/agentic/context/chat-context.d.ts +15 -0
  5. package/dist/agentic/context/context-store.d.ts +20 -0
  6. package/dist/agentic/context/persistence.d.ts +12 -0
  7. package/dist/agentic/events/builders.d.ts +10 -0
  8. package/dist/agentic/events/error-taxonomy.d.ts +27 -0
  9. package/dist/agentic/events/product-normalize.d.ts +47 -0
  10. package/dist/agentic/events/ui-specs.d.ts +37 -0
  11. package/dist/agentic/flow/beauty-consulting-turn.d.ts +1 -0
  12. package/dist/agentic/flow/create-flow.d.ts +2 -0
  13. package/dist/agentic/flow/dispatch.d.ts +3 -0
  14. package/dist/agentic/index.d.ts +18 -0
  15. package/dist/agentic/index.js +620 -0
  16. package/dist/agentic/types.d.ts +212 -0
  17. package/dist/agentic/util/assistant-host.d.ts +11 -0
  18. package/dist/agentic/util/be-url.d.ts +4 -0
  19. package/dist/agentic/util/browser-memory.d.ts +13 -0
  20. package/dist/agentic/util/browser-tools.d.ts +31 -0
  21. package/dist/agentic/util/lazy-runtime-loader.d.ts +9 -0
  22. package/dist/agentic/util/request-text.d.ts +3 -0
  23. package/dist/agentic/util/time.d.ts +2 -0
  24. package/dist/agentic/worker/be-client.d.ts +15 -0
  25. package/dist/agentic/worker/entry.d.ts +2 -0
  26. package/dist/agentic/worker/flow-runner.d.ts +24 -0
  27. package/dist/agentic/worker/jwt-mint.d.ts +21 -0
  28. package/dist/agentic/worker/rpc.d.ts +24 -0
  29. package/dist/agentic/worker/tool-bridge.d.ts +2 -0
  30. package/dist/agentic/worker.d.ts +16 -0
  31. package/dist/agentic/worker.js +119 -0
  32. package/dist/agentic.iife.js +5 -0
  33. package/dist/{api-paths-CwzwbgQZ.js → api-paths-DJFF9RuZ.js} +1 -1
  34. package/dist/beauty-consulting-turn-BmPXbkQg.js +1019 -0
  35. package/dist/chat/api.d.ts +17 -0
  36. package/dist/chat/assistant-mode.d.ts +20 -0
  37. package/dist/chat/attachment-utils.d.ts +9 -0
  38. package/dist/chat/catalog.d.ts +455 -0
  39. package/dist/chat/chat-presentation-state.d.ts +53 -0
  40. package/dist/chat/components/AIGroupingCards.d.ts +15 -0
  41. package/dist/chat/components/AISuggestedSearchCards.d.ts +13 -0
  42. package/dist/chat/components/AITopPicks.d.ts +9 -0
  43. package/dist/chat/components/BeautyPhotoStep.d.ts +31 -0
  44. package/dist/chat/components/CategoriesContainer.d.ts +11 -0
  45. package/dist/chat/components/ChatDrawer.d.ts +362 -0
  46. package/dist/chat/components/ChoicePrompter.d.ts +21 -0
  47. package/dist/chat/components/ComparisonTable.d.ts +66 -0
  48. package/dist/chat/components/ConsultingStylePicker.d.ts +40 -0
  49. package/dist/chat/components/FloatingComparisonButton.d.ts +7 -0
  50. package/dist/chat/components/FloatingLauncher.d.ts +79 -0
  51. package/dist/chat/components/GroundingReviewCard.d.ts +11 -0
  52. package/dist/chat/components/HandoffNotice.d.ts +9 -0
  53. package/dist/chat/components/KvkkBanner.d.ts +6 -0
  54. package/dist/chat/components/Launcher.d.ts +28 -0
  55. package/dist/chat/components/PanelRestoreCard.d.ts +4 -0
  56. package/dist/chat/components/PanelTopBar.d.ts +32 -0
  57. package/dist/chat/components/PhotoAnalysisCard.d.ts +27 -0
  58. package/dist/chat/components/ProductSummaryCard.d.ts +12 -0
  59. package/dist/chat/components/ProsAndCons.d.ts +8 -0
  60. package/dist/chat/components/ReviewHighlights.d.ts +16 -0
  61. package/dist/chat/components/actionClassifier.d.ts +12 -0
  62. package/dist/chat/components/product-price-layout.d.ts +17 -0
  63. package/dist/chat/components/productMentionLinker.d.ts +26 -0
  64. package/dist/chat/components/renderUISpec.d.ts +15 -0
  65. package/dist/chat/components/typewriter.d.ts +24 -0
  66. package/dist/chat/extendedModeManager.d.ts +32 -0
  67. package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +38 -0
  68. package/dist/chat/features/beauty-consulting/drawer-extensions.d.ts +22 -0
  69. package/dist/chat/features/beauty-consulting/mode-controller.d.ts +59 -0
  70. package/dist/chat/features/beauty-consulting/registry.d.ts +9 -0
  71. package/dist/chat/features/beauty-consulting/stream-handler.d.ts +45 -0
  72. package/dist/chat/history-storage.d.ts +85 -0
  73. package/dist/chat/index.d.ts +6 -0
  74. package/dist/chat/kvkk.d.ts +20 -0
  75. package/dist/chat/locales/en.d.ts +2 -0
  76. package/dist/chat/locales/index.d.ts +5 -0
  77. package/dist/chat/locales/tr.d.ts +2 -0
  78. package/dist/chat/panel-manager.d.ts +142 -0
  79. package/dist/chat/runtime.d.ts +416 -0
  80. package/dist/chat/session-persistence.d.ts +73 -0
  81. package/dist/chat/stream-error-display.d.ts +6 -0
  82. package/dist/chat/types.d.ts +547 -0
  83. package/dist/chat/utils/chat-presentation-debug.d.ts +18 -0
  84. package/dist/chat/utils/get-chat-scroll-element.d.ts +10 -0
  85. package/dist/chat/utils/ui.d.ts +10 -0
  86. package/dist/chat-runtime.js +1 -1
  87. package/dist/chat.iife.js +12 -12
  88. package/dist/chat.js +1 -1
  89. package/dist/common/action-router.d.ts +26 -0
  90. package/dist/common/api-paths.d.ts +23 -0
  91. package/dist/common/client.d.ts +27 -0
  92. package/dist/common/communication-bridge.d.ts +51 -0
  93. package/dist/common/config-constants.d.ts +1 -0
  94. package/dist/common/config-schema.d.ts +54 -0
  95. package/dist/common/connection-warning.d.ts +8 -0
  96. package/dist/common/consulting-sources.d.ts +8 -0
  97. package/dist/common/context.d.ts +64 -0
  98. package/dist/common/css-escape.d.ts +1 -0
  99. package/dist/common/customization-factories.d.ts +59 -0
  100. package/dist/common/debug.d.ts +13 -0
  101. package/dist/common/events.d.ts +55 -0
  102. package/dist/common/fastIntent.d.ts +1 -0
  103. package/dist/common/find-similar-payload.d.ts +3 -0
  104. package/dist/common/ga-datalayer.d.ts +80 -0
  105. package/dist/common/global-error-toast.d.ts +6 -0
  106. package/dist/common/index.d.ts +47 -0
  107. package/dist/common/indexed-db.d.ts +89 -0
  108. package/dist/common/locale.d.ts +1 -0
  109. package/dist/common/native-webview.d.ts +60 -0
  110. package/dist/common/navigation.d.ts +1 -0
  111. package/dist/common/overlay.d.ts +172 -0
  112. package/dist/common/page-detect.d.ts +36 -0
  113. package/dist/common/pill-launcher.d.ts +51 -0
  114. package/dist/common/preflight.d.ts +13 -0
  115. package/dist/common/price-formatter.d.ts +35 -0
  116. package/dist/common/product-utils.d.ts +35 -0
  117. package/dist/common/protocol-adapter.d.ts +108 -0
  118. package/dist/common/renderer/dom.d.ts +3 -0
  119. package/dist/common/renderer/index.d.ts +4 -0
  120. package/dist/common/renderer/overrides.d.ts +23 -0
  121. package/dist/common/renderer/registry.d.ts +2 -0
  122. package/dist/common/renderer/types.d.ts +19 -0
  123. package/dist/common/safe-html.d.ts +22 -0
  124. package/dist/common/sdk-version.d.ts +3 -0
  125. package/dist/common/streaming.d.ts +52 -0
  126. package/dist/common/suggested-search-keywords.d.ts +18 -0
  127. package/dist/common/theme-utils.d.ts +15 -0
  128. package/dist/common/transport.d.ts +75 -0
  129. package/dist/common/tts-player.d.ts +13 -0
  130. package/dist/common/types.d.ts +379 -0
  131. package/dist/common/ui-theme.d.ts +9 -0
  132. package/dist/common/uuidv7.d.ts +7 -0
  133. package/dist/common/voice-input.d.ts +74 -0
  134. package/dist/common/widget-base.d.ts +82 -0
  135. package/dist/{common-KpJP1YwP.js → common-BydCGBNn.js} +90 -139
  136. package/dist/common.js +41 -41
  137. package/dist/{connection-warning-B5T_1oBn.js → connection-warning-Pbvk3J8k.js} +1 -1
  138. package/dist/{fastIntent--Ukm2nOh.js → fastIntent-CkYN2UOl.js} +199 -137
  139. package/dist/index.d.ts +25 -0
  140. package/dist/index.js +50 -50
  141. package/dist/native/index.d.ts +2 -0
  142. package/dist/{native-webview-qfjm4SHx.js → native-webview-JDC1vtde.js} +1 -1
  143. package/dist/native.iife.js +14 -14
  144. package/dist/native.js +1 -1
  145. package/dist/{overlay-CP5A0Hhf.js → overlay-BetAvpVZ.js} +19 -19
  146. package/dist/overlay.d.ts +4 -0
  147. package/dist/overlay.js +1 -1
  148. package/dist/qna/api.d.ts +23 -0
  149. package/dist/qna/catalog.d.ts +60 -0
  150. package/dist/qna/components/ButtonRow.d.ts +15 -0
  151. package/dist/qna/components/TextInput.d.ts +11 -0
  152. package/dist/qna/components/renderUISpec.d.ts +7 -0
  153. package/dist/qna/index.d.ts +3 -0
  154. package/dist/qna/locales/en.d.ts +2 -0
  155. package/dist/qna/locales/index.d.ts +4 -0
  156. package/dist/qna/locales/tr.d.ts +2 -0
  157. package/dist/qna/normalize-ui-specs.d.ts +15 -0
  158. package/dist/qna/runtime.d.ts +73 -0
  159. package/dist/qna/types.d.ts +98 -0
  160. package/dist/qna-runtime.js +1 -1
  161. package/dist/qna.iife.js +1 -1
  162. package/dist/qna.js +1 -1
  163. package/dist/{runtime-BPyXOyyp.js → runtime-DbZO1qG5.js} +3 -3
  164. package/dist/{runtime-G3idwfkM.js → runtime-OpNoB3cu.js} +894 -853
  165. package/dist/{runtime-C3yOvNFK.js → runtime-iCLkUjI3.js} +3 -3
  166. package/dist/simbut/index.d.ts +31 -0
  167. package/dist/simbut/locales.d.ts +3 -0
  168. package/dist/simbut/types.d.ts +43 -0
  169. package/dist/{simbut-CiknJI6-.js → simbut-FyXolmZY.js} +1 -1
  170. package/dist/simbut.iife.js +1 -1
  171. package/dist/simbut.js +1 -1
  172. package/dist/simrel/api.d.ts +25 -0
  173. package/dist/simrel/catalog.d.ts +77 -0
  174. package/dist/simrel/components/GroupTabs.d.ts +24 -0
  175. package/dist/simrel/components/ProductCard.d.ts +19 -0
  176. package/dist/simrel/components/ProductGrid.d.ts +17 -0
  177. package/dist/simrel/components/renderUISpec.d.ts +7 -0
  178. package/dist/simrel/index.d.ts +5 -0
  179. package/dist/simrel/locales/en.d.ts +2 -0
  180. package/dist/simrel/locales/index.d.ts +4 -0
  181. package/dist/simrel/locales/tr.d.ts +2 -0
  182. package/dist/simrel/renderers/default.d.ts +41 -0
  183. package/dist/simrel/runtime.d.ts +68 -0
  184. package/dist/simrel/types.d.ts +145 -0
  185. package/dist/{simrel-C1YN71aW.js → simrel-CbLe5OAr.js} +1 -1
  186. package/dist/simrel-runtime.js +1 -1
  187. package/dist/simrel.iife.js +1 -1
  188. package/dist/simrel.js +2 -2
  189. package/dist/{widget-base-UmvgIqDk.js → widget-base-COP8QwU3.js} +1 -1
  190. package/package.json +20 -6
package/dist/native.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, i, n as t, r, t as s } from "./native-webview-qfjm4SHx.js";
1
+ import { a, i, n as t, r, t as s } from "./native-webview-JDC1vtde.js";
2
2
  export {
3
3
  s as DEFAULT_NATIVE_TRACKED_EVENTS,
4
4
  t as applyNativeSession,
@@ -72,16 +72,16 @@ var q = class {
72
72
  }
73
73
  async _initChat() {
74
74
  if (this.options.chat?.enabled === !1) return;
75
- const i = this.options.middlewareUrl, e = this.options.chat?.productDetailsExtended ?? this.options.productDetailsExtended, s = this.options.chat?.isDemoWebsite ?? this.options.isDemoWebsite, t = {
75
+ const i = this.options.middlewareUrl, e = this.options.chat?.productDetailsExtended ?? this.options.productDetailsExtended, s = this.options.chat?.isDemoWebsite ?? this.options.isDemoWebsite, a = this.options.chat?.injectorAdapter ?? this.options.injectorAdapter, t = {
76
76
  accountId: this.options.accountId,
77
77
  middlewareUrl: i,
78
78
  session: this.session,
79
79
  pageContext: this._pageContext,
80
80
  variant: this.options.chat?.variant ?? "floating"
81
81
  };
82
- this.options.theme !== void 0 && (t.theme = this.options.theme), this.options.locale !== void 0 && (t.locale = this.options.locale), this.options.pricing !== void 0 && (t.pricing = this.options.pricing), this.options.chat?.mountTarget !== void 0 && (t.mountTarget = this.options.chat.mountTarget), this.options.chat?.pillLauncher !== void 0 && (t.pillLauncher = this.options.chat.pillLauncher), this.options.chat?.floatingLauncher !== void 0 && (t.floatingLauncher = this.options.chat.floatingLauncher), this.options.chat?.launcherAnchor !== void 0 && (t.launcherAnchor = this.options.chat.launcherAnchor), this.options.chat?.launcherImageUrl !== void 0 ? t.launcherImageUrl = this.options.chat.launcherImageUrl : this.options.chat?.launcherSvg !== void 0 && (t.launcherSvg = this.options.chat.launcherSvg), this.options.chat?.mobileLauncherImageUrl !== void 0 && (t.mobileLauncherImageUrl = this.options.chat.mobileLauncherImageUrl), this.options.chat?.headerTitle !== void 0 && (t.headerTitle = this.options.chat.headerTitle), this.options.chat?.headerAvatarUrl !== void 0 && (t.headerAvatarUrl = this.options.chat.headerAvatarUrl), this.options.chat?.headerBadge !== void 0 && (t.headerBadge = this.options.chat.headerBadge), this.options.chat?.headerCartUrl !== void 0 && (t.headerCartUrl = this.options.chat.headerCartUrl), this.options.chat?.headerFavoritesToggle !== void 0 && (t.headerFavoritesToggle = this.options.chat.headerFavoritesToggle), this.options.chat?.onFavoritesClick !== void 0 && (t.onFavoritesClick = this.options.chat.onFavoritesClick), this.options.chat?.hideMobileLauncher !== void 0 && (t.hideMobileLauncher = this.options.chat.hideMobileLauncher), this.options.chat?.mobileBreakpoint !== void 0 && (t.mobileBreakpoint = this.options.chat.mobileBreakpoint), this.options.chat?.mobileInitialState !== void 0 && (t.mobileInitialState = this.options.chat.mobileInitialState), this.options.chat?.i18n !== void 0 && (t.i18n = this.options.chat.i18n), this.options.chat?.actionHandling !== void 0 && (t.actionHandling = this.options.chat.actionHandling), this.options.chat?.renderer !== void 0 && (t.renderer = this.options.chat.renderer), e !== void 0 && (t.productDetailsExtended = e), s !== void 0 && (t.isDemoWebsite = s), this.options.chat?.productPriceUi !== void 0 && (t.productPriceUi = this.options.chat.productPriceUi), this.options.chat?.hideProductDiscountBadge !== void 0 && (t.hideProductDiscountBadge = this.options.chat.hideProductDiscountBadge), this.options.chat?.hideUserReviews !== void 0 && (t.hideUserReviews = this.options.chat.hideUserReviews), this.options.chat?.hideStockStatus !== void 0 && (t.hideStockStatus = this.options.chat.hideStockStatus), this.options.onScriptCall !== void 0 && (t.onScriptCall = this.options.onScriptCall), this.options.onAddToCart !== void 0 && (t.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 && (t.onProductNavigate = this.options.onProductNavigate), this.options.chat?.onOpen !== void 0 && (t.onOpen = this.options.chat.onOpen), this.options.chat?.onClose !== void 0 && (t.onClose = this.options.chat.onClose);
83
- const { GengageChat: a } = await import("./chat-runtime.js");
84
- this._chat = new a(), await this._chat.init(t);
82
+ this.options.theme !== void 0 && (t.theme = this.options.theme), a !== void 0 && (t.injectorAdapter = a), this.options.locale !== void 0 && (t.locale = this.options.locale), this.options.pricing !== void 0 && (t.pricing = this.options.pricing), this.options.chat?.mountTarget !== void 0 && (t.mountTarget = this.options.chat.mountTarget), this.options.chat?.pillLauncher !== void 0 && (t.pillLauncher = this.options.chat.pillLauncher), this.options.chat?.floatingLauncher !== void 0 && (t.floatingLauncher = this.options.chat.floatingLauncher), this.options.chat?.launcherAnchor !== void 0 && (t.launcherAnchor = this.options.chat.launcherAnchor), this.options.chat?.launcherImageUrl !== void 0 ? t.launcherImageUrl = this.options.chat.launcherImageUrl : this.options.chat?.launcherSvg !== void 0 && (t.launcherSvg = this.options.chat.launcherSvg), this.options.chat?.mobileLauncherImageUrl !== void 0 && (t.mobileLauncherImageUrl = this.options.chat.mobileLauncherImageUrl), this.options.chat?.headerTitle !== void 0 && (t.headerTitle = this.options.chat.headerTitle), this.options.chat?.headerAvatarUrl !== void 0 && (t.headerAvatarUrl = this.options.chat.headerAvatarUrl), this.options.chat?.headerBadge !== void 0 && (t.headerBadge = this.options.chat.headerBadge), this.options.chat?.headerCartUrl !== void 0 && (t.headerCartUrl = this.options.chat.headerCartUrl), this.options.chat?.headerFavoritesToggle !== void 0 && (t.headerFavoritesToggle = this.options.chat.headerFavoritesToggle), this.options.chat?.onFavoritesClick !== void 0 && (t.onFavoritesClick = this.options.chat.onFavoritesClick), this.options.chat?.hideMobileLauncher !== void 0 && (t.hideMobileLauncher = this.options.chat.hideMobileLauncher), this.options.chat?.mobileBreakpoint !== void 0 && (t.mobileBreakpoint = this.options.chat.mobileBreakpoint), this.options.chat?.mobileInitialState !== void 0 && (t.mobileInitialState = this.options.chat.mobileInitialState), this.options.chat?.i18n !== void 0 && (t.i18n = this.options.chat.i18n), this.options.chat?.actionHandling !== void 0 && (t.actionHandling = this.options.chat.actionHandling), this.options.chat?.renderer !== void 0 && (t.renderer = this.options.chat.renderer), e !== void 0 && (t.productDetailsExtended = e), s !== void 0 && (t.isDemoWebsite = s), this.options.chat?.productPriceUi !== void 0 && (t.productPriceUi = this.options.chat.productPriceUi), this.options.chat?.hideProductDiscountBadge !== void 0 && (t.hideProductDiscountBadge = this.options.chat.hideProductDiscountBadge), this.options.chat?.hideUserReviews !== void 0 && (t.hideUserReviews = this.options.chat.hideUserReviews), this.options.chat?.hideStockStatus !== void 0 && (t.hideStockStatus = this.options.chat.hideStockStatus), this.options.onScriptCall !== void 0 && (t.onScriptCall = this.options.onScriptCall), this.options.onAddToCart !== void 0 && (t.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 && (t.onProductNavigate = this.options.onProductNavigate), this.options.chat?.onOpen !== void 0 && (t.onOpen = this.options.chat.onOpen), this.options.chat?.onClose !== void 0 && (t.onClose = this.options.chat.onClose);
83
+ const { GengageChat: h } = await import("./chat-runtime.js");
84
+ this._chat = new h(), await this._chat.init(t);
85
85
  }
86
86
  async _syncPdpWidgets() {
87
87
  if (this._destroyed) return;
@@ -92,15 +92,15 @@ var q = class {
92
92
  }
93
93
  const e = this.options.middlewareUrl;
94
94
  if (this.options.qna?.enabled !== !1) {
95
- const s = this.options.qna?.mountTarget ?? y, t = r(s);
96
- if (t)
95
+ const s = this.options.qna?.mountTarget ?? y, a = r(s);
96
+ if (a)
97
97
  if (this._warnedQnaMountMissing = !1, this._qna)
98
98
  this._qna.show(), this._qna.update({
99
99
  pageType: "pdp",
100
100
  sku: i
101
101
  });
102
102
  else {
103
- const { GengageQNA: a } = await import("./qna-runtime.js"), h = new a(), o = {
103
+ const { GengageQNA: t } = await import("./qna-runtime.js"), h = new t(), o = {
104
104
  accountId: this.options.accountId,
105
105
  middlewareUrl: e,
106
106
  session: this.session,
@@ -108,7 +108,7 @@ var q = class {
108
108
  pageType: "pdp",
109
109
  sku: i
110
110
  },
111
- mountTarget: t
111
+ mountTarget: a
112
112
  };
113
113
  this.options.theme !== void 0 && (o.theme = this.options.theme), this.options.qna?.chrome !== void 0 && (o.chrome = this.options.qna.chrome), this.options.qna?.ctaText !== void 0 && (o.ctaText = this.options.qna.ctaText), this.options.qna?.hideButtonRowCta !== void 0 && (o.hideButtonRowCta = this.options.qna.hideButtonRowCta), this.options.qna?.inputPlaceholder !== void 0 && (o.inputPlaceholder = this.options.qna.inputPlaceholder), this.options.qna?.inputAfterPills !== void 0 && (o.inputAfterPills = this.options.qna.inputAfterPills), this.options.qna?.i18n !== void 0 && (o.i18n = this.options.qna.i18n), this.options.qna?.renderer !== void 0 && (o.renderer = this.options.qna.renderer);
114
114
  const n = this.options.qna?.headerTitle ?? this.options.qna?.headingTitle;
@@ -119,20 +119,20 @@ var q = class {
119
119
  } else
120
120
  this._qna?.destroy(), this._qna = null;
121
121
  if (this.options.simrel !== void 0 && this.options.simrel.enabled !== !1) {
122
- const s = this.options.simrel?.mountTarget ?? w, t = r(s);
123
- if (t)
122
+ const s = this.options.simrel?.mountTarget ?? w, a = r(s);
123
+ if (a)
124
124
  if (this._warnedSimRelMountMissing = !1, this._simrel)
125
125
  this._simrel.show(), this._simrel.update({
126
126
  pageType: "pdp",
127
127
  sku: i
128
128
  });
129
129
  else {
130
- const { GengageSimRel: a } = await import("./simrel-runtime.js"), h = new a(), o = {
130
+ const { GengageSimRel: t } = await import("./simrel-runtime.js"), h = new t(), o = {
131
131
  accountId: this.options.accountId,
132
132
  middlewareUrl: e,
133
133
  session: this.session,
134
134
  sku: i,
135
- mountTarget: t
135
+ mountTarget: a
136
136
  };
137
137
  this.options.theme !== void 0 && (o.theme = this.options.theme), this.options.pricing !== void 0 && (o.pricing = this.options.pricing), this.options.simrel?.discountType !== void 0 && (o.discountType = this.options.simrel.discountType), this.options.simrel?.gridColumns !== void 0 && (o.gridColumns = this.options.simrel.gridColumns), this.options.simrel?.enableProductGroupings !== void 0 && (o.enableProductGroupings = this.options.simrel.enableProductGroupings), this.options.simrel?.renderCardElement !== void 0 && (o.renderCardElement = this.options.simrel.renderCardElement), this.options.simrel?.renderer !== void 0 && (o.renderer = this.options.simrel.renderer), this.options.onAddToCart !== void 0 && (o.onAddToCart = this.options.onAddToCart), this.options.onProductNavigate !== void 0 ? o.onProductNavigate = this.options.onProductNavigate : o.onProductNavigate = (n, u, c) => {
138
138
  g(n) && (this._chat?.saveSession(c ?? this.session.sessionId, u), window.location.href = n);
@@ -143,8 +143,8 @@ var q = class {
143
143
  } else
144
144
  this._simrel?.destroy(), this._simrel = null;
145
145
  if (this.options.simbut && this.options.simbut.enabled !== !1) {
146
- const s = this.options.simbut.mountTarget ?? C, t = r(s), a = this._chat ?? this.options.simbut.onFindSimilar;
147
- if (t && a)
146
+ const s = this.options.simbut.mountTarget ?? C, a = r(s), t = this._chat ?? this.options.simbut.onFindSimilar;
147
+ if (a && t)
148
148
  if (this._warnedSimButMountMissing = !1, this._warnedSimButNoChat = !1, this._simbut)
149
149
  this._simbut.show(), this._simbut.setChat(this._chat), this._simbut.update({
150
150
  pageType: "pdp",
@@ -159,13 +159,13 @@ var q = class {
159
159
  pageType: "pdp",
160
160
  sku: i
161
161
  },
162
- mountTarget: t,
162
+ mountTarget: a,
163
163
  chat: this._chat
164
164
  };
165
165
  this.options.theme !== void 0 && (n.theme = this.options.theme), this.options.locale !== void 0 && (n.locale = this.options.locale), this.options.simbut.layout !== void 0 && (n.layout = this.options.simbut.layout), this.options.simbut.inlineCard !== void 0 && (n.inlineCard = this.options.simbut.inlineCard), this.options.simbut.imageUrl !== void 0 && (n.imageUrl = this.options.simbut.imageUrl), this.options.simbut.i18n !== void 0 && (n.i18n = this.options.simbut.i18n), this.options.simbut.onFindSimilar !== void 0 && (n.onFindSimilar = this.options.simbut.onFindSimilar), await o.init(n), this._simbut = o;
166
166
  }
167
167
  else
168
- this._simbut?.destroy(), this._simbut = null, !t && !this._warnedSimButMountMissing ? (console.warn(`[gengage] SimBut mount target not found: ${s}`), this._warnedSimButMountMissing = !0) : !a && !this._warnedSimButNoChat && (console.warn("[gengage] SimBut requires chat to be enabled or simbut.onFindSimilar"), this._warnedSimButNoChat = !0);
168
+ this._simbut?.destroy(), this._simbut = null, !a && !this._warnedSimButMountMissing ? (console.warn(`[gengage] SimBut mount target not found: ${s}`), this._warnedSimButMountMissing = !0) : !t && !this._warnedSimButNoChat && (console.warn("[gengage] SimBut requires chat to be enabled or simbut.onFindSimilar"), this._warnedSimButNoChat = !0);
169
169
  } else
170
170
  this._simbut?.destroy(), this._simbut = null;
171
171
  }
@@ -176,10 +176,10 @@ var q = class {
176
176
  }
177
177
  };
178
178
  async function k(i) {
179
- const e = p(i), s = d(), t = s.instances[e];
180
- if (t) return t;
181
- const a = s.pending[e];
179
+ const e = p(i), s = d(), a = s.instances[e];
182
180
  if (a) return a;
181
+ const t = s.pending[e];
182
+ if (t) return t;
183
183
  const h = new q(i, () => {
184
184
  const n = d();
185
185
  delete n.instances[e], delete n.pending[e];
@@ -0,0 +1,4 @@
1
+ export { initOverlayWidgets, getOverlayWidgets, destroyOverlayWidgets, buildOverlayIdempotencyKey, } from './common/overlay.js';
2
+ export type { OverlayWidgetsController, OverlayWidgetsOptions, OverlayChatOptions, OverlayQNAOptions, OverlaySimRelOptions, OverlaySimButOptions, } from './common/overlay.js';
3
+ export { bootstrapSession, updatePageContext } from './common/context.js';
4
+ export type { PageContext, SessionContext, WidgetTheme } from './common/types.js';
package/dist/overlay.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as t, t as a } from "./context-BBuSsXZ9.js";
2
- import { i as r, n as i, r as o, t as d } from "./overlay-CP5A0Hhf.js";
2
+ import { i as r, n as i, r as o, t as d } from "./overlay-BetAvpVZ.js";
3
3
  export {
4
4
  a as bootstrapSession,
5
5
  d as buildOverlayIdempotencyKey,
@@ -0,0 +1,23 @@
1
+ import type { UISpec } from '../common/types.js';
2
+ import type { ChatTransportConfig } from '../common/api-paths.js';
3
+ export interface LauncherActionRequest {
4
+ account_id: string;
5
+ session_id: string;
6
+ correlation_id: string;
7
+ sku: string;
8
+ user_id?: string;
9
+ view_id?: string;
10
+ page_type?: string;
11
+ locale?: string;
12
+ output_language?: string;
13
+ mode?: string;
14
+ }
15
+ export interface LauncherActionResult {
16
+ uiSpecs: UISpec[];
17
+ actions: Array<{
18
+ title: string;
19
+ type: string;
20
+ payload?: unknown;
21
+ }>;
22
+ }
23
+ export declare function fetchLauncherActions(request: LauncherActionRequest, transport: ChatTransportConfig, signal?: AbortSignal): Promise<LauncherActionResult>;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * QNA widget — json-render catalog definition.
3
+ *
4
+ * Backend endpoint: POST /chat/launcher_action
5
+ * Response format: NDJSON stream, each line a StreamEvent.
6
+ *
7
+ * The backend returns a `ui_spec` event whose elements are typed to the
8
+ * component names defined below. The frontend renders them via ./registry.
9
+ *
10
+ * Customising:
11
+ * Fork this repo and replace ./registry implementations with your own.
12
+ * The catalog schema (component names + prop types) is the API contract
13
+ * with the backend — do not rename components without a backend release.
14
+ */
15
+ import { z } from 'zod';
16
+ export declare const qnaCatalog: {
17
+ readonly components: {
18
+ readonly ActionButton: {
19
+ readonly schema: z.ZodObject<{
20
+ label: z.ZodString;
21
+ action: z.ZodObject<{
22
+ title: z.ZodString;
23
+ type: z.ZodString;
24
+ payload: z.ZodOptional<z.ZodUnknown>;
25
+ }, z.core.$strip>;
26
+ variant: z.ZodOptional<z.ZodEnum<{
27
+ primary: "primary";
28
+ outline: "outline";
29
+ ghost: "ghost";
30
+ }>>;
31
+ }, z.core.$strip>;
32
+ readonly description: "A single clickable QNA action button.";
33
+ };
34
+ readonly ButtonRow: {
35
+ readonly schema: z.ZodObject<{
36
+ orientation: z.ZodOptional<z.ZodEnum<{
37
+ horizontal: "horizontal";
38
+ vertical: "vertical";
39
+ }>>;
40
+ wrap: z.ZodOptional<z.ZodBoolean>;
41
+ }, z.core.$strip>;
42
+ readonly description: "Container for a group of QNA action buttons.";
43
+ };
44
+ readonly TextInput: {
45
+ readonly schema: z.ZodObject<{
46
+ placeholder: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
47
+ ctaLabel: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>;
49
+ readonly description: "Free-text input with rotating placeholder and CTA button.";
50
+ };
51
+ readonly QuestionHeading: {
52
+ readonly schema: z.ZodObject<{
53
+ text: z.ZodString;
54
+ }, z.core.$strip>;
55
+ readonly description: "A heading displayed above the QNA button group.";
56
+ };
57
+ };
58
+ };
59
+ export type QNACatalog = typeof qnaCatalog;
60
+ export type QNAComponentName = keyof QNACatalog['components'];
@@ -0,0 +1,15 @@
1
+ import type { ActionPayload } from '../../common/types.js';
2
+ export interface ButtonRowOptions {
3
+ actions: Array<{
4
+ title: string;
5
+ type: string;
6
+ payload?: unknown;
7
+ }>;
8
+ onAction: (action: ActionPayload) => void;
9
+ ctaText?: string;
10
+ defaultCtaText?: string;
11
+ onOpenChat?: () => void;
12
+ orientation?: 'horizontal' | 'vertical';
13
+ quickQuestionsAriaLabel?: string;
14
+ }
15
+ export declare function renderButtonRow(options: ButtonRowOptions): HTMLElement;
@@ -0,0 +1,11 @@
1
+ import type { ActionPayload } from '../../common/types.js';
2
+ export interface TextInputOptions {
3
+ placeholders?: string | string[];
4
+ ctaLabel?: string;
5
+ defaultInputPlaceholder?: string;
6
+ askQuestionAriaLabel?: string;
7
+ sendButtonText?: string;
8
+ sendQuestionAriaLabel?: string;
9
+ onSubmit: (action: ActionPayload) => void;
10
+ }
11
+ export declare function renderTextInput(options: TextInputOptions): HTMLElement;
@@ -0,0 +1,7 @@
1
+ import type { UISpecDomRegistry, UISpecDomUnknownRenderer } from '../../common/renderer/index.js';
2
+ import type { UISpec } from '../../common/types.js';
3
+ import type { QNAUISpecRenderContext } from '../types.js';
4
+ export type QNAUISpecRegistry = UISpecDomRegistry<QNAUISpecRenderContext>;
5
+ export declare const defaultQnaUnknownUISpecRenderer: UISpecDomUnknownRenderer<QNAUISpecRenderContext>;
6
+ export declare function createDefaultQnaUISpecRegistry(): QNAUISpecRegistry;
7
+ export declare function renderQnaUISpec(spec: UISpec, context: QNAUISpecRenderContext, registry?: QNAUISpecRegistry, unknownRenderer?: UISpecDomUnknownRenderer<QNAUISpecRenderContext>): HTMLElement;
@@ -0,0 +1,3 @@
1
+ export * from './runtime.js';
2
+ export { qnaCatalog } from './catalog.js';
3
+ export type { QNACatalog, QNAComponentName } from './catalog.js';
@@ -0,0 +1,2 @@
1
+ import type { QNAI18n } from '../types.js';
2
+ export declare const QNA_I18N_EN: QNAI18n;
@@ -0,0 +1,4 @@
1
+ import type { QNAI18n } from '../types.js';
2
+ import { QNA_I18N_TR } from './tr.js';
3
+ export declare function resolveQnaLocale(locale?: string): QNAI18n;
4
+ export { QNA_I18N_TR };
@@ -0,0 +1,2 @@
1
+ import type { QNAI18n } from '../types.js';
2
+ export declare const QNA_I18N_TR: QNAI18n;
@@ -0,0 +1,15 @@
1
+ import type { PageContext, UISpec } from '../common/types.js';
2
+ import type { QNAI18n } from './types.js';
3
+ /** SKUs to send with the product-context quick pill (`user_message` + sku_list). */
4
+ export type MergeQuickPillsOptions = {
5
+ skuList?: string[] | undefined;
6
+ };
7
+ /**
8
+ * Resolve SKU list for QNA → chat payloads: current PDP sku, or `visible_skus` on listings.
9
+ */
10
+ export declare function resolveQnaSkuListForPayload(pageContext: PageContext | undefined): string[] | undefined;
11
+ /**
12
+ * Removes standalone hero `ActionButton` blocks for `findSimilar` (e.g. from `text_image`)
13
+ * and merges a product-context quick question pill instead (same row as other questions).
14
+ */
15
+ export declare function mergeStandaloneFindSimilarIntoQuickPills(specs: UISpec[], i18n: QNAI18n, options?: MergeQuickPillsOptions): UISpec[];
@@ -0,0 +1,73 @@
1
+ /**
2
+ * QNA widget -- public entry point.
3
+ *
4
+ * Renders contextual action buttons (and an optional free-text input) on
5
+ * product or content pages. When a user taps a button, the widget opens
6
+ * the Chat widget with that action pre-loaded.
7
+ *
8
+ * Backend: POST /chat/launcher_action
9
+ * Protocol: NDJSON stream -> json-render UISpec -> ActionButton / ButtonRow / TextInput
10
+ */
11
+ import type { ActionPayload, PageContext } from '../common/types.js';
12
+ import { BaseWidget } from '../common/widget-base.js';
13
+ import type { QNAWidgetConfig } from './types.js';
14
+ import './components/qna.css';
15
+ /**
16
+ * Contextual Q&A action buttons for product pages.
17
+ * Renders quick-action buttons that open the chat widget with a pre-built query.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { GengageQNA, wireQNAToChat, bootstrapSession } from '@gengage/assistant-fe';
22
+ *
23
+ * const qna = new GengageQNA();
24
+ * await qna.init({
25
+ * accountId: 'mystore',
26
+ * middlewareUrl: '<backend service location provided for your Gengage account>',
27
+ * mountTarget: '#qna-section',
28
+ * pageContext: { pageType: 'pdp', sku: '12345' },
29
+ * session: { sessionId: bootstrapSession() },
30
+ * });
31
+ * wireQNAToChat(); // Wire button clicks to chat.openWithAction()
32
+ * ```
33
+ */
34
+ export declare class GengageQNA extends BaseWidget<QNAWidgetConfig> {
35
+ private _abortController;
36
+ private _debounceTimer;
37
+ private _contentEl;
38
+ private _lastSku;
39
+ private _i18n;
40
+ protected onInit(config: QNAWidgetConfig): Promise<void>;
41
+ protected onUpdate(context: Partial<PageContext>): void;
42
+ protected onShow(): void;
43
+ protected onHide(): void;
44
+ protected onDestroy(): void;
45
+ private _abort;
46
+ /** `headerTitle` wins over deprecated `headingTitle`. */
47
+ private _resolvedQnaHeaderTitle;
48
+ /** Clean up TextInput placeholder rotation timers to prevent interval leaks. */
49
+ private _cleanupTextInputTimers;
50
+ private _fetchAndRender;
51
+ private _createLoadingIndicator;
52
+ private _resolveI18n;
53
+ private _createChrome;
54
+ private _resolveUISpecRegistry;
55
+ private _renderUISpec;
56
+ private _specIncludesType;
57
+ private _buildFallbackActionsSpec;
58
+ /**
59
+ * Free-text field when the launcher stream has no TextInput. Sits above the pills by
60
+ * default; set `inputAfterPills: true` in config to place it after.
61
+ */
62
+ private _insertStandaloneInputBeforePills;
63
+ private _appendStandaloneInput;
64
+ private _handleAction;
65
+ private _handleOpenChat;
66
+ private _showTransitionIndicator;
67
+ _actionHandler: (action: ActionPayload) => void;
68
+ _openChatHandler: () => void;
69
+ }
70
+ export declare function createQNAWidget(): GengageQNA;
71
+ export type { QNAWidgetConfig, QNAUIComponents, QNAI18n, QNAChromeLayout, QNAChromeConfig, QNAUISpecRenderContext, QNARendererConfig, } from './types.js';
72
+ export { renderQnaUISpec, createDefaultQnaUISpecRegistry, defaultQnaUnknownUISpecRenderer, } from './components/renderUISpec.js';
73
+ export type { QNAUISpecRegistry } from './components/renderUISpec.js';
@@ -0,0 +1,98 @@
1
+ import type { BaseWidgetConfig, ActionPayload } from '../common/types.js';
2
+ import type { UISpecRendererOverrides } from '../common/renderer/index.js';
3
+ export interface QNAWidgetConfig extends BaseWidgetConfig {
4
+ /** Where to mount the QNA buttons container. Required. */
5
+ mountTarget: HTMLElement | string;
6
+ /** Optional SDK-owned outer chrome for merchant PDP prompts. Defaults to no chrome. */
7
+ chrome?: QNAChromeConfig;
8
+ /** CTA label for the "open chat" pill/button (default: 'Ask something else'). */
9
+ ctaText?: string;
10
+ /** Hide the CTA button inside the quick-question button row.
11
+ * Useful when a TextInput is already visible and the CTA would be redundant. */
12
+ hideButtonRowCta?: boolean;
13
+ /** Placeholder text cycling inside the free-text input.
14
+ * Set to `true` to use fetched action titles as rotating placeholders. */
15
+ inputPlaceholder?: string | string[] | true;
16
+ /** When true, the standalone input is placed after the question pills instead of before them. */
17
+ inputAfterPills?: boolean;
18
+ /** Locale key for SDK defaults (for example 'tr', 'en'). */
19
+ locale?: string;
20
+ i18n?: Partial<QNAI18n>;
21
+ renderer?: QNARendererConfig;
22
+ /** Show a static question above the rotating buttons. */
23
+ showStaticQuestion?: boolean;
24
+ staticQuestionText?: string;
25
+ /**
26
+ * Title above the Q&A module (e.g. "Koçtaş'a Sor", "Teknosa'ya Sor").
27
+ * When set, overrides the stream `QuestionHeading` text from the backend.
28
+ * Overlay defaults: `qna.headerTitle` → `qna.headingTitle` (deprecated) → `chat.headerTitle`.
29
+ */
30
+ headerTitle?: string;
31
+ /**
32
+ * @deprecated Use `headerTitle` — same behavior.
33
+ */
34
+ headingTitle?: string;
35
+ /** Called when a QNA action button is clicked. */
36
+ onActionSelected?: (action: ActionPayload) => void;
37
+ /** Called when the open-chat CTA is clicked. */
38
+ onOpenChat?: () => void;
39
+ }
40
+ export interface QNAI18n {
41
+ quickQuestionsAriaLabel: string;
42
+ askQuestionAriaLabel: string;
43
+ defaultInputPlaceholder: string;
44
+ sendButton: string;
45
+ sendQuestionAriaLabel: string;
46
+ defaultCtaText: string;
47
+ redirectingToChat: string;
48
+ /**
49
+ * Replaces the standalone backend “similar products” hero with this quick question pill
50
+ * (user_message, not findSimilar).
51
+ */
52
+ productContextQuickPillLabel: string;
53
+ }
54
+ export type QNAChromeLayout = 'default' | 'side-image';
55
+ export interface QNAChromeConfig {
56
+ /** Optional chrome layout. `side-image` keeps the QNA body in the content column beside the image. */
57
+ layout?: QNAChromeLayout;
58
+ title?: string;
59
+ subtitle?: string;
60
+ imageUrl?: string;
61
+ imageAlt?: string;
62
+ /** Optional CSS padding value applied to the chrome image. */
63
+ imagePadding?: string;
64
+ startButtonLabel?: string;
65
+ }
66
+ export interface QNAUISpecRenderContext {
67
+ onAction: (action: ActionPayload) => void;
68
+ onOpenChat?: () => void;
69
+ ctaText?: string;
70
+ inputPlaceholder?: string | string[];
71
+ i18n: QNAI18n;
72
+ /** When set (from `QNAWidgetConfig.headerTitle` / `headingTitle`), replaces QuestionHeading `text` from the stream. */
73
+ headingTitleOverride?: string;
74
+ }
75
+ export type QNARendererConfig = UISpecRendererOverrides<QNAUISpecRenderContext>;
76
+ export interface QNAUIComponents {
77
+ /** A single QNA action button. */
78
+ ActionButton: {
79
+ label: string;
80
+ action: ActionPayload;
81
+ /** Visual variant for the button. */
82
+ variant?: 'primary' | 'outline' | 'ghost';
83
+ };
84
+ /** The container holding all action buttons. */
85
+ ButtonRow: {
86
+ orientation?: 'horizontal' | 'vertical';
87
+ wrap?: boolean;
88
+ };
89
+ /** Free-text input field with rotating placeholder text. */
90
+ TextInput: {
91
+ placeholder?: string | string[];
92
+ ctaLabel?: string;
93
+ };
94
+ /** A heading or label above the buttons. */
95
+ QuestionHeading: {
96
+ text: string;
97
+ };
98
+ }
@@ -1,4 +1,4 @@
1
- import { a, i as r, n, r as t, t as s } from "./runtime-BPyXOyyp.js";
1
+ import { a, i as r, n, r as t, t as s } from "./runtime-DbZO1qG5.js";
2
2
  export {
3
3
  s as GengageQNA,
4
4
  t as createDefaultQnaUISpecRegistry,