@gengage/assistant-fe 0.4.20 → 0.4.21

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 (156) hide show
  1. package/dist/{api-paths-CReMDZWg.js → api-paths-Bg6iwO5w.js} +1 -1
  2. package/dist/chat-runtime.js +1 -1
  3. package/dist/chat.iife.js +2 -2
  4. package/dist/chat.js +1 -1
  5. package/dist/{common-BM2ZsSLI.js → common-DDJSeQhg.js} +2 -2
  6. package/dist/common.js +5 -5
  7. package/dist/{connection-warning-C_4e7ahZ.js → connection-warning-BeD-B0Ec.js} +1 -1
  8. package/dist/{fastIntent-DMNzXOSI.js → fastIntent-BeeDIwd2.js} +1 -1
  9. package/dist/index.js +10 -10
  10. package/dist/native.iife.js +2 -2
  11. package/dist/qna-runtime.js +1 -1
  12. package/dist/qna.iife.js +1 -1
  13. package/dist/qna.js +1 -1
  14. package/dist/{runtime-C51WykbJ.js → runtime-C8ZBidd2.js} +3 -3
  15. package/dist/{runtime-bbMljGVG.js → runtime-CRSFPLku.js} +3 -3
  16. package/dist/{runtime-DBh8899B.js → runtime-Ct1qOl8V.js} +5 -5
  17. package/dist/{simbut-CO1rLVM9.js → simbut-BrAeZ6SH.js} +1 -1
  18. package/dist/simbut.iife.js +1 -1
  19. package/dist/simbut.js +1 -1
  20. package/dist/{simrel-zCDlCrqG.js → simrel-Cha5de6P.js} +1 -1
  21. package/dist/simrel-runtime.js +1 -1
  22. package/dist/simrel.iife.js +1 -1
  23. package/dist/simrel.js +2 -2
  24. package/dist/{widget-base-Cf9ofZhh.js → widget-base-BtBl_PCR.js} +1 -1
  25. package/package.json +8 -5
  26. package/dist/chat/api.d.ts +0 -88
  27. package/dist/chat/assistant-mode.d.ts +0 -19
  28. package/dist/chat/attachment-utils.d.ts +0 -9
  29. package/dist/chat/catalog.d.ts +0 -826
  30. package/dist/chat/chat-presentation-state.d.ts +0 -53
  31. package/dist/chat/components/AIGroupingCards.d.ts +0 -3
  32. package/dist/chat/components/AISuggestedSearchCards.d.ts +0 -3
  33. package/dist/chat/components/AITopPicks.d.ts +0 -3
  34. package/dist/chat/components/BeautyPhotoStep.d.ts +0 -16
  35. package/dist/chat/components/CategoriesContainer.d.ts +0 -3
  36. package/dist/chat/components/ChatDrawer.d.ts +0 -360
  37. package/dist/chat/components/ChoicePrompter.d.ts +0 -21
  38. package/dist/chat/components/ComparisonTable.d.ts +0 -57
  39. package/dist/chat/components/ConsultingStylePicker.d.ts +0 -34
  40. package/dist/chat/components/FloatingComparisonButton.d.ts +0 -2
  41. package/dist/chat/components/FloatingLauncher.d.ts +0 -79
  42. package/dist/chat/components/GroundingReviewCard.d.ts +0 -3
  43. package/dist/chat/components/HandoffNotice.d.ts +0 -4
  44. package/dist/chat/components/KvkkBanner.d.ts +0 -6
  45. package/dist/chat/components/Launcher.d.ts +0 -28
  46. package/dist/chat/components/PanelRestoreCard.d.ts +0 -4
  47. package/dist/chat/components/PanelTopBar.d.ts +0 -32
  48. package/dist/chat/components/PhotoAnalysisCard.d.ts +0 -20
  49. package/dist/chat/components/ProductSummaryCard.d.ts +0 -3
  50. package/dist/chat/components/ProsAndCons.d.ts +0 -8
  51. package/dist/chat/components/ReviewHighlights.d.ts +0 -9
  52. package/dist/chat/components/actionClassifier.d.ts +0 -12
  53. package/dist/chat/components/product-price-layout.d.ts +0 -18
  54. package/dist/chat/components/productMentionLinker.d.ts +0 -25
  55. package/dist/chat/components/renderUISpec.d.ts +0 -11
  56. package/dist/chat/components/typewriter.d.ts +0 -24
  57. package/dist/chat/extendedModeManager.d.ts +0 -32
  58. package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +0 -31
  59. package/dist/chat/features/beauty-consulting/drawer-extensions.d.ts +0 -20
  60. package/dist/chat/features/beauty-consulting/mode-controller.d.ts +0 -53
  61. package/dist/chat/features/beauty-consulting/registry.d.ts +0 -3
  62. package/dist/chat/features/beauty-consulting/stream-handler.d.ts +0 -38
  63. package/dist/chat/history-storage.d.ts +0 -85
  64. package/dist/chat/index.d.ts +0 -5
  65. package/dist/chat/kvkk.d.ts +0 -20
  66. package/dist/chat/locales/en.d.ts +0 -2
  67. package/dist/chat/locales/index.d.ts +0 -5
  68. package/dist/chat/locales/tr.d.ts +0 -2
  69. package/dist/chat/panel-manager.d.ts +0 -126
  70. package/dist/chat/runtime.d.ts +0 -400
  71. package/dist/chat/session-persistence.d.ts +0 -65
  72. package/dist/chat/stream-error-display.d.ts +0 -6
  73. package/dist/chat/types.d.ts +0 -543
  74. package/dist/chat/utils/chat-presentation-debug.d.ts +0 -19
  75. package/dist/chat/utils/get-chat-scroll-element.d.ts +0 -10
  76. package/dist/chat/utils/ui.d.ts +0 -10
  77. package/dist/common/action-router.d.ts +0 -26
  78. package/dist/common/activity-tracker.d.ts +0 -37
  79. package/dist/common/analytics-events.d.ts +0 -91
  80. package/dist/common/analytics.d.ts +0 -61
  81. package/dist/common/api-paths.d.ts +0 -15
  82. package/dist/common/client.d.ts +0 -27
  83. package/dist/common/communication-bridge.d.ts +0 -51
  84. package/dist/common/config-constants.d.ts +0 -1
  85. package/dist/common/config-schema.d.ts +0 -81
  86. package/dist/common/connection-warning.d.ts +0 -8
  87. package/dist/common/consulting-sources.d.ts +0 -9
  88. package/dist/common/context.d.ts +0 -27
  89. package/dist/common/css-escape.d.ts +0 -1
  90. package/dist/common/customization-factories.d.ts +0 -62
  91. package/dist/common/debug.d.ts +0 -13
  92. package/dist/common/events.d.ts +0 -46
  93. package/dist/common/fastIntent.d.ts +0 -1
  94. package/dist/common/find-similar-payload.d.ts +0 -3
  95. package/dist/common/ga-datalayer.d.ts +0 -89
  96. package/dist/common/global-error-toast.d.ts +0 -6
  97. package/dist/common/index.d.ts +0 -50
  98. package/dist/common/indexed-db.d.ts +0 -79
  99. package/dist/common/locale.d.ts +0 -1
  100. package/dist/common/native-webview.d.ts +0 -60
  101. package/dist/common/navigation.d.ts +0 -5
  102. package/dist/common/overlay.d.ts +0 -168
  103. package/dist/common/page-detect.d.ts +0 -30
  104. package/dist/common/pill-launcher.d.ts +0 -51
  105. package/dist/common/preflight.d.ts +0 -13
  106. package/dist/common/price-formatter.d.ts +0 -35
  107. package/dist/common/product-utils.d.ts +0 -35
  108. package/dist/common/protocol-adapter.d.ts +0 -105
  109. package/dist/common/renderer/dom.d.ts +0 -3
  110. package/dist/common/renderer/index.d.ts +0 -4
  111. package/dist/common/renderer/overrides.d.ts +0 -23
  112. package/dist/common/renderer/registry.d.ts +0 -2
  113. package/dist/common/renderer/types.d.ts +0 -19
  114. package/dist/common/safe-html.d.ts +0 -22
  115. package/dist/common/sdk-version.d.ts +0 -3
  116. package/dist/common/skeleton.d.ts +0 -8
  117. package/dist/common/streaming.d.ts +0 -37
  118. package/dist/common/suggested-search-keywords.d.ts +0 -18
  119. package/dist/common/theme-utils.d.ts +0 -15
  120. package/dist/common/tts-player.d.ts +0 -13
  121. package/dist/common/types.d.ts +0 -381
  122. package/dist/common/ui-theme.d.ts +0 -9
  123. package/dist/common/uuidv7.d.ts +0 -7
  124. package/dist/common/voice-input.d.ts +0 -74
  125. package/dist/common/widget-base.d.ts +0 -97
  126. package/dist/index.d.ts +0 -25
  127. package/dist/native/index.d.ts +0 -2
  128. package/dist/overlay.d.ts +0 -4
  129. package/dist/qna/api.d.ts +0 -23
  130. package/dist/qna/catalog.d.ts +0 -73
  131. package/dist/qna/components/ButtonRow.d.ts +0 -15
  132. package/dist/qna/components/TextInput.d.ts +0 -11
  133. package/dist/qna/components/renderUISpec.d.ts +0 -7
  134. package/dist/qna/index.d.ts +0 -3
  135. package/dist/qna/locales/en.d.ts +0 -2
  136. package/dist/qna/locales/index.d.ts +0 -5
  137. package/dist/qna/locales/tr.d.ts +0 -2
  138. package/dist/qna/normalize-ui-specs.d.ts +0 -15
  139. package/dist/qna/runtime.d.ts +0 -62
  140. package/dist/qna/types.d.ts +0 -98
  141. package/dist/simbut/index.d.ts +0 -22
  142. package/dist/simbut/locales.d.ts +0 -3
  143. package/dist/simbut/types.d.ts +0 -43
  144. package/dist/simrel/api.d.ts +0 -25
  145. package/dist/simrel/catalog.d.ts +0 -110
  146. package/dist/simrel/components/GroupTabs.d.ts +0 -24
  147. package/dist/simrel/components/ProductCard.d.ts +0 -19
  148. package/dist/simrel/components/ProductGrid.d.ts +0 -17
  149. package/dist/simrel/components/renderUISpec.d.ts +0 -7
  150. package/dist/simrel/index.d.ts +0 -5
  151. package/dist/simrel/locales/en.d.ts +0 -2
  152. package/dist/simrel/locales/index.d.ts +0 -5
  153. package/dist/simrel/locales/tr.d.ts +0 -2
  154. package/dist/simrel/renderers/default.d.ts +0 -40
  155. package/dist/simrel/runtime.d.ts +0 -59
  156. package/dist/simrel/types.d.ts +0 -141
@@ -1,543 +0,0 @@
1
- import { BaseWidgetConfig, ActionPayload } from '../common/types.js';
2
- import { UnknownActionPolicy } from '../common/config-schema.js';
3
- import { PillLauncherOptions } from '../common/pill-launcher.js';
4
- import { FloatingLauncherOptions } from './components/FloatingLauncher.js';
5
- import { UISpecDomRegistry, UISpecRendererOverrides } from '../common/renderer/index.js';
6
- export type { FloatingLauncherOptions };
7
- export interface ChatWidgetConfig extends BaseWidgetConfig {
8
- /**
9
- * Widget display variant:
10
- * - 'floating' : Launcher button + slide-in drawer (default)
11
- * - 'inline' : Renders directly into mountTarget, no launcher
12
- * - 'overlay' : Full-screen modal, triggered programmatically
13
- */
14
- variant?: 'floating' | 'inline' | 'overlay';
15
- /**
16
- * Initial open state for mobile.
17
- * 'half' shows a half-height sheet; 'full' is full-screen.
18
- */
19
- mobileInitialState?: 'half' | 'full';
20
- /** Custom launcher button SVG markup. */
21
- launcherSvg?: string;
22
- /**
23
- * Launcher image URL — renders the launcher as a full-size image button
24
- * (no circular background, no padding). The image fills the entire button.
25
- * Takes precedence over launcherSvg when set.
26
- * Ignored when `pillLauncher` is set (pill derives `launcherImageUrl` from `pillLauncher.avatarUrl`).
27
- */
28
- launcherImageUrl?: string;
29
- /**
30
- * Mobile-specific launcher image URL. When set alongside `launcherImageUrl`,
31
- * this image is shown on mobile viewports and `launcherImageUrl` on desktop.
32
- */
33
- mobileLauncherImageUrl?: string;
34
- /**
35
- * Declarative pill-shaped floating launcher (label + avatar). The widget calls
36
- * `makePillLauncher` and `apply()` internally after mount — no host `apply()` needed.
37
- * Floating variant only; omit manual `launcherImageUrl` when using this.
38
- */
39
- pillLauncher?: PillLauncherOptions;
40
- /**
41
- * Search-bar style floating launcher with voice input. Replaces the standard
42
- * FAB button with a full-width pill input bar. The widget mounts it inside the
43
- * shadow DOM — no host-side `apply()` needed.
44
- * Floating variant only; mutually exclusive with `pillLauncher` and `launcherImageUrl`.
45
- */
46
- floatingLauncher?: FloatingLauncherOptions;
47
- /** Tooltip text shown on launcher hover. */
48
- launcherTooltip?: string;
49
- /** Header display title (overrides i18n.headerTitle). */
50
- headerTitle?: string;
51
- /** Header avatar image URL. */
52
- headerAvatarUrl?: string;
53
- /** Header badge text (e.g. "BETA"). */
54
- headerBadge?: string;
55
- /**
56
- * Header background color (CSS color value, e.g. "#1d2939" or "hsl(220 26% 14%)").
57
- * Sets the `--gengage-chat-header-bg` CSS custom property.
58
- * Can also be set via `theme['--gengage-chat-header-bg']`.
59
- */
60
- headerBg?: string;
61
- /**
62
- * Header foreground (text/icon) color.
63
- * Sets the `--gengage-chat-header-foreground` CSS custom property.
64
- * Can also be set via `theme['--gengage-chat-header-foreground']`.
65
- */
66
- headerForeground?: string;
67
- /** Header cart link URL (e.g. "/sepetim"). Shows a cart icon in the header. */
68
- headerCartUrl?: string;
69
- /**
70
- * Legacy: show the header favorites (heart) button without `onFavoritesClick`.
71
- * Opens the built-in favorites list in the side panel (IDB-backed).
72
- */
73
- headerFavoritesToggle?: boolean;
74
- /**
75
- * When set, shows the header favorites button. On click, only this callback runs — use it to
76
- * open the merchant's favorites page (same pattern as `onCartClick`). The built-in favorites panel is not opened.
77
- */
78
- onFavoritesClick?: () => void;
79
- /** Callback fired when the cart icon button in the header is clicked (when headerCartUrl is not set). */
80
- onCartClick?: () => void;
81
- /** Hide the launcher on mobile viewports. */
82
- hideMobileLauncher?: boolean;
83
- /** Mobile breakpoint in px (default: 768). */
84
- mobileBreakpoint?: number;
85
- /**
86
- * Dynamically positions the launcher relative to a page element per viewport.
87
- * ResizeObserver tracks the element and updates the launcher CSS variables on
88
- * every resize — no static overrides needed. Call `syncLauncherAnchor()` from
89
- * SPA navigation handlers to re-query anchors after page transitions.
90
- *
91
- * Offset semantics:
92
- * - `0` → launcher edge aligns with the element's same edge (overlap, no gap)
93
- * - `N>0` → launcher is N px outside the element's far edge
94
- *
95
- * `bottomOffset`: 0 = align with el.bottom, N = N px above el.top
96
- * `rightOffset`: 0 = align with el.right, N = N px left of el.left
97
- */
98
- launcherAnchor?: {
99
- mobile?: {
100
- /**
101
- * Anchor source element selector. If omitted, `bottom` / `right` offsets are
102
- * applied directly from viewport edges (without element tracking).
103
- */
104
- selector?: string;
105
- /**
106
- * Vertical anchor. `offset` is the distance in px; `type` controls the reference:
107
- * - `'gap'` (default): offset=0 → launcher bottom = element bottom;
108
- * offset>0 → launcher sits N px above the element's top edge.
109
- * - `'root'`: offset always measured from the element's bottom edge;
110
- * offset=0 → launcher bottom = element bottom; N > 0 → N px above element's bottom.
111
- */
112
- bottom?: {
113
- offset: number;
114
- type?: 'gap' | 'root';
115
- };
116
- /**
117
- * Horizontal anchor. `offset` is the distance in px; `type` controls the reference:
118
- * - `'gap'` (default): offset=0 → launcher right = element right;
119
- * offset>0 → launcher sits N px to the left of the element's left edge.
120
- * - `'root'`: offset always measured from the element's right edge;
121
- * offset=0 → launcher right = element right; N > 0 → N px inward from element's right.
122
- */
123
- right?: {
124
- offset: number;
125
- type?: 'gap' | 'root';
126
- };
127
- /**
128
- * When true, launcher animates to the anchored position when the element
129
- * scrolls into view, and returns to default when it scrolls out.
130
- */
131
- dynamicRelocate?: boolean;
132
- };
133
- desktop?: {
134
- /**
135
- * Anchor source element selector. If omitted, `bottom` / `right` offsets are
136
- * applied directly from viewport edges (without element tracking).
137
- */
138
- selector?: string;
139
- bottom?: {
140
- offset: number;
141
- type?: 'gap' | 'root';
142
- };
143
- right?: {
144
- offset: number;
145
- type?: 'gap' | 'root';
146
- };
147
- dynamicRelocate?: boolean;
148
- };
149
- };
150
- /**
151
- * Panel display mode:
152
- * - 'auto' : Panel appears/hides with content; user can toggle (default)
153
- * - 'collapsed' : Panel starts collapsed; fresh panel content reopens it
154
- * - 'expanded' : Panel starts expanded (users can still collapse/expand)
155
- */
156
- panelMode?: 'auto' | 'collapsed' | 'expanded';
157
- /**
158
- * Locale for built-in i18n strings.
159
- * Provide a custom `i18n` object to override any string.
160
- */
161
- locale?: string;
162
- i18n?: Partial<ChatI18n>;
163
- renderer?: ChatRendererConfig;
164
- /** Controls how streamed actions are routed (policy for unknowns, script_call gating). */
165
- actionHandling?: {
166
- unknownActionPolicy?: UnknownActionPolicy;
167
- allowScriptCall?: boolean;
168
- };
169
- /** Welcome message shown on first drawer open with empty history. */
170
- welcomeMessage?: string;
171
- /** Starter action pills shown with welcome message. */
172
- welcomeActions?: string[];
173
- /** Context-specific starter action pills for blank/home/listing/PDP entry states. */
174
- welcomeActionsByContext?: ChatWelcomeActionsByContext;
175
- /** Context-specific opening copy that is forwarded to the backend entry-opening flow. */
176
- openingMessagesByContext?: ChatContextualCopyByContext;
177
- /** Context-specific steering notes forwarded to the backend entry-opening flow. */
178
- openingGuidanceByContext?: ChatContextualCopyByContext;
179
- /**
180
- * Whether this is a demo website. When combined with `productDetailsExtended: true`,
181
- * `productDetails` content triggers the extended panel (host PDP maximize).
182
- * Regular accounts render product details inline in the chat pane.
183
- */
184
- isDemoWebsite?: boolean;
185
- /**
186
- * When `true`, full `ProductDetailsPanel` and PDP similar products (`similarsAppend` grid) use
187
- * the assistant side panel; demo extended mode includes `productDetails`. Default `false`/omitted:
188
- * product details and similar products render only in the chat stream; the side panel is cleared.
189
- * `ProductSummaryCard` always renders inline (except for silent messages).
190
- */
191
- productDetailsExtended?: boolean;
192
- /** Product price presentation (cards, summary, details, AI Top Picks). */
193
- productPriceUi?: ProductPriceUiConfig;
194
- /**
195
- * When true, hides the circular percent discount badge on product card images and the
196
- * inline percent badge in the product details price row. List/sale price and campaign badges are unchanged.
197
- */
198
- hideProductDiscountBadge?: boolean;
199
- /** When true, hides the ReviewHighlights component in chat responses. */
200
- hideUserReviews?: boolean;
201
- /** When true, hides in-stock / out-of-stock labels on product cards. */
202
- hideStockStatus?: boolean;
203
- /** Enable browser-native voice input. Default: false. */
204
- voiceEnabled?: boolean;
205
- onOpen?: () => void;
206
- onClose?: () => void;
207
- onReady?: () => void;
208
- onScriptCall?: (params: {
209
- name: string;
210
- payload?: Record<string, unknown>;
211
- }) => void;
212
- onAddToCart?: (params: import('../common/types.js').AddToCartParams) => void;
213
- /**
214
- * Allowed origins for the postMessage communication bridge.
215
- * Defaults to `[location.origin]` (same-origin only).
216
- * Pass `['*']` to allow any origin (not recommended for production).
217
- */
218
- allowedOrigins?: string[];
219
- }
220
- export interface ChatI18n {
221
- headerTitle: string;
222
- inputPlaceholder: string;
223
- sendButton: string;
224
- closeButton: string;
225
- openButton: string;
226
- newChatButton: string;
227
- poweredBy: string;
228
- errorMessage: string;
229
- retryButton: string;
230
- loadingMessage: string;
231
- loadingSequenceGeneric: string[];
232
- loadingSequencePanel: string[];
233
- loadingSequenceComparison: string[];
234
- productCtaLabel: string;
235
- /** CTA label in the product details panel when navigating to the product URL (distinct from the card "İncele" CTA). */
236
- viewOnSiteLabel: string;
237
- attachImageButton: string;
238
- /** Image attach popup: pick from device. */
239
- attachMenuSelectPhoto: string;
240
- /** Image attach popup: paste from clipboard. */
241
- attachMenuPaste: string;
242
- /** When clipboard has no image (paste menu or unsupported API). */
243
- clipboardNoImageMessage: string;
244
- removeAttachmentButton: string;
245
- invalidFileType: string;
246
- fileTooLarge: string;
247
- aiTopPicksTitle: string;
248
- roleWinner: string;
249
- roleBestValue: string;
250
- roleBestAlternative: string;
251
- viewDetails: string;
252
- groundingReviewCta: string;
253
- groundingReviewSubtitle: string;
254
- variantsLabel: string;
255
- sortRelated: string;
256
- sortPriceAsc: string;
257
- sortPriceDesc: string;
258
- sortToolbarAriaLabel: string;
259
- compareSelected: string;
260
- compareMinHint: string;
261
- compareMaxHint: string;
262
- comparisonSelectLabel: string;
263
- comparisonSelectedLabel: string;
264
- /** Shown on product cards while comparison mode is on — whole card toggles selection. */
265
- comparisonSelectCardHint: string;
266
- /** Shown on the main panel while the comparison table is being generated. */
267
- comparisonPreparingLabel: string;
268
- panelTitleProductDetails: string;
269
- panelTitleSimilarProducts: string;
270
- panelTitleComparisonResults: string;
271
- panelTitleCategories: string;
272
- panelTitleSearchResults: string;
273
- inStockLabel: string;
274
- outOfStockLabel: string;
275
- findSimilarLabel: string;
276
- /** Product details gallery: previous / next image controls */
277
- galleryPrevAriaLabel: string;
278
- galleryNextAriaLabel: string;
279
- /** Title shown above consultant style cards. Supports {count} placeholder. */
280
- beautyStylesPreparedTitle: string;
281
- /** Title shown above watch-expert style cards. Supports {count} placeholder. */
282
- watchStylesPreparedTitle: string;
283
- /** Label for products that were not included in a backend recommendation group. */
284
- consultingOtherCompatibleProductsLabel: string;
285
- /** Fallback label for an unnamed consulting recommendation group. */
286
- consultingFallbackGroupLabel: string;
287
- /** Fallback label for a consulting style card. Supports {index} placeholder. */
288
- consultingFallbackStyleLabel: string;
289
- consultingStyleLoadingDescription: string;
290
- consultingStyleUnavailableDescription: string;
291
- consultingStyleLoadingBadge: string;
292
- consultingStyleUnavailableBadge: string;
293
- choicePrompterHeading: string;
294
- choicePrompterSuggestion: string;
295
- choicePrompterCta: string;
296
- viewMoreLabel: string;
297
- similarProductsLabel: string;
298
- addToCartButton: string;
299
- addedToCartToast: string;
300
- shareButton: string;
301
- productInfoTab: string;
302
- specificationsTab: string;
303
- recommendedChoiceLabel: string;
304
- highlightsLabel: string;
305
- keyDifferencesLabel: string;
306
- specialCasesLabel: string;
307
- emptyReviewsMessage: string;
308
- closeAriaLabel: string;
309
- startChatLabel: string;
310
- voiceButton: string;
311
- voiceListening: string;
312
- voiceNotSupported: string;
313
- voicePermissionDenied: string;
314
- voiceError: string;
315
- handoffHeading: string;
316
- productNotFoundMessage: string;
317
- stopGenerating: string;
318
- offlineMessage: string;
319
- cartAriaLabel: string;
320
- favoritesAriaLabel: string;
321
- historyAriaLabel: string;
322
- historyPageTitle: string;
323
- emptyHistoryMessage: string;
324
- historyDeleteLabel: string;
325
- historyDeleteConfirmMessage: string;
326
- showPanelAriaLabel: string;
327
- addToFavoritesLabel: string;
328
- customerReviewsTitle: string;
329
- togglePanelAriaLabel: string;
330
- chatMessagesAriaLabel: string;
331
- suggestionsAriaLabel: string;
332
- moreSuggestionsAriaLabel: string;
333
- rollbackAriaLabel: string;
334
- backAriaLabel: string;
335
- forwardAriaLabel: string;
336
- /** Aria label for the panel close (✕) button shown on mobile. */
337
- closePanelAriaLabel: string;
338
- dismissAriaLabel: string;
339
- cartAddErrorMessage: string;
340
- /** Shown when a host `gengage-product-favorite` callback fails (returns false or throws). */
341
- favoriteToggleErrorMessage: string;
342
- /** Used as lowercase suffix for positive mention counts, e.g. "3 positive". */
343
- reviewFilterPositive: string;
344
- /** Used as lowercase suffix for negative mention counts, e.g. "2 negative". */
345
- reviewFilterNegative: string;
346
- decreaseLabel: string;
347
- increaseLabel: string;
348
- reviewCustomersMentionSingular: string;
349
- reviewCustomersMentionPlural: string;
350
- reviewSubjectsHeading: string;
351
- tryAgainButton: string;
352
- askSomethingElseButton: string;
353
- accountInactiveMessage: string;
354
- favoritesPageTitle: string;
355
- emptyFavoritesMessage: string;
356
- /** Sticky control when transcript is focused on the latest thread — restores full history */
357
- showFormerMessagesButton: string;
358
- /** Shown above the product grid on desktop while AI picks/groupings are still streaming. */
359
- aiAnalysisAnalyzingLabel: string;
360
- /** Section heading above AI grouping cards (panel browse categories). */
361
- aiBrowseCategoriesTitle: string;
362
- /** Badge text on photo analysis message cards. */
363
- photoAnalysisBadge: string;
364
- /** Photo analysis section label: strengths. */
365
- photoAnalysisStrengthsLabel: string;
366
- /** Photo analysis section label: focus points. */
367
- photoAnalysisFocusLabel: string;
368
- /** Photo analysis section label: celeb style match. */
369
- photoAnalysisCelebStyleLabel: string;
370
- /** Beauty photo step card: title. */
371
- beautyPhotoStepTitle: string;
372
- /** Beauty photo step card: description. */
373
- beautyPhotoStepDescription: string;
374
- /** Beauty photo step card: upload button label. */
375
- beautyPhotoStepUpload: string;
376
- /** Beauty photo step card: processing state label. */
377
- beautyPhotoStepProcessing: string;
378
- /** Beauty photo step card: skip button label. */
379
- beautyPhotoStepSkip: string;
380
- /** Message sent to backend when user clicks skip on beauty photo step. */
381
- beautyPhotoStepSkipMessage: string;
382
- }
383
- export type OpeningContextKey = 'home' | 'listing' | 'product' | 'default';
384
- export interface ChatActionChip {
385
- title: string;
386
- icon?: string;
387
- }
388
- export interface ChatWelcomeActionsByContext {
389
- home?: ChatActionChip[];
390
- listing?: ChatActionChip[];
391
- product?: ChatActionChip[];
392
- default?: ChatActionChip[];
393
- }
394
- export interface ChatContextualCopyByContext {
395
- home?: string;
396
- listing?: string;
397
- product?: string;
398
- default?: string;
399
- }
400
- /** List vs sale price row: strike-through or inline with separator. */
401
- export type ProductPriceOriginalStyle = 'strikethrough' | 'inline';
402
- /** Sale price text color: body default or brand (`--client-primary`). */
403
- export type DiscountedPriceColor = 'default' | 'client';
404
- export interface ProductPriceUiConfig {
405
- /**
406
- * How the list price is shown. Override per product via `originalPriceStyle` / `price_original_style`.
407
- * `strikethrough`: crossed-out list price. `inline`: current, separator, muted list price (no line).
408
- */
409
- originalPriceStyle?: ProductPriceOriginalStyle;
410
- /**
411
- * When true, show a campaign / discount reason line when the payload includes `discount_reason` (or aliases).
412
- */
413
- showCampaignReason?: boolean;
414
- /**
415
- * Sale price color. Sets `--gengage-discounted-price-color` on the widget host when `client`.
416
- */
417
- discountedPriceColor?: DiscountedPriceColor;
418
- /**
419
- * Optional default image URL for the left column of the campaign price badge (logo).
420
- * Override per product via `campaignReasonLogoUrl` / `campaign_reason_logo_url` (or `discountBadgeLogoUrl`).
421
- */
422
- campaignBadgeLogoUrl?: string;
423
- }
424
- export interface ChatUISpecRenderContext {
425
- locale?: string | undefined;
426
- onAction: (action: ActionPayload) => void;
427
- onProductClick?: (params: {
428
- sku: string;
429
- url: string;
430
- name?: string;
431
- }) => void;
432
- onAddToCart?: (params: import('../common/types.js').AddToCartParams) => void;
433
- onProductSelect?: (product: Record<string, unknown>) => void;
434
- pricing?: import('../common/price-formatter.js').PriceFormatConfig | undefined;
435
- productPriceUi?: ProductPriceUiConfig | undefined;
436
- hideProductDiscountBadge?: boolean | undefined;
437
- hideUserReviews?: boolean | undefined;
438
- hideStockStatus?: boolean | undefined;
439
- i18n?: Pick<ChatI18n, 'productCtaLabel' | 'viewOnSiteLabel' | 'aiTopPicksTitle' | 'roleWinner' | 'roleBestValue' | 'roleBestAlternative' | 'viewDetails' | 'groundingReviewCta' | 'groundingReviewSubtitle' | 'variantsLabel' | 'sortRelated' | 'sortPriceAsc' | 'sortPriceDesc' | 'sortToolbarAriaLabel' | 'compareSelected' | 'compareMinHint' | 'comparisonSelectLabel' | 'comparisonSelectedLabel' | 'comparisonSelectCardHint' | 'panelTitleProductDetails' | 'panelTitleSimilarProducts' | 'panelTitleComparisonResults' | 'panelTitleCategories' | 'panelTitleSearchResults' | 'inStockLabel' | 'outOfStockLabel' | 'findSimilarLabel' | 'galleryPrevAriaLabel' | 'galleryNextAriaLabel' | 'beautyStylesPreparedTitle' | 'watchStylesPreparedTitle' | 'consultingOtherCompatibleProductsLabel' | 'consultingFallbackGroupLabel' | 'consultingFallbackStyleLabel' | 'consultingStyleLoadingDescription' | 'consultingStyleUnavailableDescription' | 'consultingStyleLoadingBadge' | 'consultingStyleUnavailableBadge' | 'viewMoreLabel' | 'similarProductsLabel' | 'addToCartButton' | 'shareButton' | 'productInfoTab' | 'specificationsTab' | 'recommendedChoiceLabel' | 'highlightsLabel' | 'keyDifferencesLabel' | 'specialCasesLabel' | 'emptyReviewsMessage' | 'closeAriaLabel' | 'dismissAriaLabel' | 'startChatLabel' | 'handoffHeading' | 'customerReviewsTitle' | 'addToFavoritesLabel' | 'showPanelAriaLabel' | 'reviewFilterPositive' | 'reviewFilterNegative' | 'decreaseLabel' | 'increaseLabel' | 'reviewCustomersMentionSingular' | 'reviewCustomersMentionPlural' | 'reviewSubjectsHeading' | 'aiBrowseCategoriesTitle' | 'photoAnalysisBadge' | 'photoAnalysisStrengthsLabel' | 'photoAnalysisFocusLabel' | 'photoAnalysisCelebStyleLabel' | 'beautyPhotoStepTitle' | 'beautyPhotoStepDescription' | 'beautyPhotoStepUpload' | 'beautyPhotoStepProcessing' | 'beautyPhotoStepSkip'>;
440
- productSort?: ProductSortState | undefined;
441
- onSortChange?: ((sort: ProductSortState) => void) | undefined;
442
- comparisonSelectMode?: boolean | undefined;
443
- comparisonSelectedSkus?: string[] | undefined;
444
- comparisonMaxSelection?: number | undefined;
445
- comparisonSelectionWarning?: string | null | undefined;
446
- onToggleComparisonSku?: ((sku: string) => void) | undefined;
447
- favoritedSkus?: Set<string> | undefined;
448
- onFavoriteToggle?: ((sku: string, product: Record<string, unknown>) => void) | undefined;
449
- topPicksLoadingSku?: string | null | undefined;
450
- /** When true the stream is still in progress — defer compare CTA until stream ends. */
451
- isStreaming?: boolean | undefined;
452
- /** True when the widget is displayed in mobile viewport. Replaces hardcoded 768px check. */
453
- isMobile?: boolean | undefined;
454
- /** ProductGrid: heading on the same row as sort/compare (panel list / Benzer Ürünler). */
455
- panelProductListHeading?: string | undefined;
456
- }
457
- export interface ProductSortState {
458
- type: 'related' | 'price';
459
- direction?: 'asc' | 'desc' | undefined;
460
- }
461
- export type ChatUISpecRegistry = UISpecDomRegistry<ChatUISpecRenderContext>;
462
- export type ChatRendererConfig = UISpecRendererOverrides<ChatUISpecRenderContext>;
463
- export interface ChatMessage {
464
- id: string;
465
- threadId?: string;
466
- role: 'user' | 'assistant';
467
- /** Plain text content. */
468
- content?: string;
469
- /** json-render UI spec attached to this message (e.g. product cards). */
470
- uiSpec?: import('../common/types.js').UISpec;
471
- /** Frontend-synthesized visible message; exclude from backend chat history. */
472
- frontendOnly?: boolean;
473
- /** Image attachment (user-uploaded). Stored in-memory until send. */
474
- attachment?: File;
475
- /** Snapshot of panel DOM at time this message's stream completed. */
476
- panelSnapshot?: HTMLElement;
477
- /** Silent messages are hidden from the conversation but kept for context. */
478
- silent?: boolean;
479
- /** Backend render hint for special rendering (e.g. "photo_analysis"). */
480
- renderHint?: string;
481
- /** Structured photo analysis data from PhotoAnalysisCard UISpec. */
482
- photoAnalysis?: {
483
- summary: string;
484
- strengths?: string[];
485
- focusPoints?: string[];
486
- celebStyle?: string;
487
- celebStyleReason?: string;
488
- nextQuestion?: string;
489
- };
490
- timestamp: number;
491
- status: 'streaming' | 'done' | 'error';
492
- }
493
- export interface ChatSession {
494
- sessionId: string;
495
- messages: ChatMessage[];
496
- /** SKU associated with this session (for cross-page restore). */
497
- sku?: string;
498
- }
499
- /**
500
- * Serializable subset of ChatMessage for IndexedDB persistence.
501
- * Omits `attachment` (File) and `panelSnapshot` (HTMLElement) which are not
502
- * structurally cloneable.
503
- */
504
- export interface SerializableChatMessage {
505
- id: string;
506
- threadId?: string | undefined;
507
- role: 'user' | 'assistant';
508
- content?: string | undefined;
509
- frontendOnly?: boolean | undefined;
510
- silent?: boolean | undefined;
511
- timestamp: number;
512
- status: 'streaming' | 'done' | 'error';
513
- }
514
- export interface ChatUIComponents {
515
- /** A single text message bubble. */
516
- MessageBubble: {
517
- role: 'user' | 'assistant';
518
- content: string;
519
- timestamp?: number;
520
- };
521
- /** A product card shown inline in the chat stream. */
522
- ProductCard: {
523
- sku: string;
524
- name: string;
525
- imageUrl?: string;
526
- price?: string;
527
- originalPrice?: string;
528
- url: string;
529
- };
530
- /** A row of quick-reply action buttons. */
531
- ActionButtons: {
532
- buttons: Array<{
533
- label: string;
534
- action: ActionPayload;
535
- }>;
536
- };
537
- /** A "typing..." indicator. */
538
- TypingIndicator: Record<string, never>;
539
- /** A divider with an optional label (e.g. "New conversation"). */
540
- Divider: {
541
- label?: string;
542
- };
543
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Opt-in debug logging for chat presentation (query ?chat_debug=1 or localStorage gengage_chat_debug=1).
3
- */
4
- type Entry = {
5
- seq: number;
6
- time: string;
7
- scope: string;
8
- message: string;
9
- payload?: unknown;
10
- };
11
- declare global {
12
- interface Window {
13
- __gengageChatPresentationDebugLog?: Entry[];
14
- __gengageChatPresentationDebugSeq?: number;
15
- }
16
- }
17
- export declare function isChatPresentationDebugEnabled(): boolean;
18
- export declare function logChatPresentation(scope: string, message: string, payload?: unknown): void;
19
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Resolves the chat transcript scroll container (messages pane).
3
- * Prefers a widget-registered element (Shadow DOM–safe); falls back to #gengage-chat-scroll in light DOM.
4
- */
5
- /** DOM id on the transcript scroller — stable for host tooling */
6
- export declare const CHAT_SCROLL_ELEMENT_ID = "gengage-chat-scroll";
7
- /** Called when the chat drawer mounts / updates its messages scroller */
8
- export declare function registerChatScrollElement(el: HTMLElement | null): void;
9
- export declare function getChatScrollElement(): HTMLElement | null;
10
- export declare function invalidateChatScrollCache(): void;
@@ -1,10 +0,0 @@
1
- /**
2
- * UI Utilities for the Gengage Chat components.
3
- */
4
- /**
5
- * Creates a Lucide-style SVG icon from paths.
6
- * @param paths SVG path strings (the 'd' attribute).
7
- * @param size Icon width/height in pixels.
8
- * @returns An SVGElement.
9
- */
10
- export declare function createLucideIcon(paths: string[], size?: number): SVGElement;
@@ -1,26 +0,0 @@
1
- import { UnknownActionPolicy } from './config-schema.js';
2
- import { ActionPayload, AddToCartParams, StreamEventAction } from './types.js';
3
- export interface HostActionHandlers {
4
- openChat?: (payload?: ActionPayload | unknown) => void;
5
- navigate?: (params: {
6
- url: string;
7
- newTab?: boolean;
8
- }) => void;
9
- saveSession?: (params: {
10
- sessionId: string;
11
- sku: string;
12
- }) => void;
13
- addToCart?: (params: AddToCartParams) => void;
14
- scriptCall?: (params: {
15
- name: string;
16
- payload?: Record<string, unknown>;
17
- }) => void;
18
- unknown?: (action: StreamEventAction['action']) => void;
19
- }
20
- export interface ActionRouterOptions {
21
- allowScriptCall?: boolean;
22
- unknownActionPolicy?: UnknownActionPolicy;
23
- logger?: Pick<Console, 'warn' | 'error' | 'debug'>;
24
- defaultNavigate?: (url: string, newTab?: boolean) => void;
25
- }
26
- export declare function routeStreamAction(event: StreamEventAction, handlers: HostActionHandlers, options?: ActionRouterOptions): void;
@@ -1,37 +0,0 @@
1
- /**
2
- * Tracks user activity signals (page views, idle, scroll depth) for
3
- * engagement analytics.
4
- */
5
- export interface ActivityEvent {
6
- type: 'pageview' | 'idle' | 'scroll' | 'focus' | 'blur';
7
- timestamp: number;
8
- data?: Record<string, unknown>;
9
- }
10
- export interface ActivityTrackerOptions {
11
- /** Idle threshold in ms (default: 30000). */
12
- idleThresholdMs?: number;
13
- /** Scroll depth granularity in percent (default: 25). */
14
- scrollGranularity?: number;
15
- /** Callback when an activity event fires. */
16
- onActivity?: (event: ActivityEvent) => void;
17
- }
18
- export declare class ActivityTracker {
19
- private _idleTimer;
20
- private _idleThreshold;
21
- private _scrollGranularity;
22
- private _maxScrollDepth;
23
- private _lastReportedDepth;
24
- private _onActivity;
25
- private _listeners;
26
- private _destroyed;
27
- constructor(options?: ActivityTrackerOptions);
28
- private _setup;
29
- private _listen;
30
- private _resetIdleTimer;
31
- private _onScroll;
32
- private _onVisibility;
33
- private _emit;
34
- /** Current max scroll depth reached (0-100). */
35
- get maxScrollDepth(): number;
36
- destroy(): void;
37
- }