@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
@@ -0,0 +1,362 @@
1
+ import type { ChatI18n, ChatMessage } from '../types.js';
2
+ /** SVG icon map for suggested action chips/pills. Keys match backend icon names. */
3
+ declare const SUGGESTED_ACTION_ICONS: Record<string, string>;
4
+ export { SUGGESTED_ACTION_ICONS };
5
+ export interface ChatDrawerOptions {
6
+ i18n: ChatI18n;
7
+ onSend: (text: string, attachment?: File) => void;
8
+ /** Callback fired when the cart icon button in the header is clicked. */
9
+ onCartClick?: (() => void) | undefined;
10
+ onClose: () => void;
11
+ onAttachment?: (file: File) => void;
12
+ onPanelToggle?: () => void;
13
+ /**
14
+ * Fired when side panel visibility/content changes so the parent can refresh host scroll lock
15
+ * and backdrop classes. Not related to the Google Chrome browser — “host shell” means the
16
+ * surrounding page/document integration.
17
+ */
18
+ onHostShellSync?: () => void;
19
+ onRollback?: (messageId: string) => void;
20
+ headerTitle?: string | undefined;
21
+ headerAvatarUrl?: string | undefined;
22
+ /** Launcher image URL — used as avatar fallback when headerAvatarUrl is not set. */
23
+ launcherImageUrl?: string | undefined;
24
+ headerBadge?: string | undefined;
25
+ /** URL for the cart icon link in the header (e.g. "/sepetim"). */
26
+ /** @deprecated Use onCartClick instead. If set, the cart button will navigate to this URL. */
27
+ headerCartUrl?: string | undefined;
28
+ /** When true, render the header favorites (heart) button. */
29
+ showHeaderFavorites?: boolean | undefined;
30
+ onFavoritesClick?: (() => void) | undefined;
31
+ /** Callback fired when the history button in the header is clicked. */
32
+ onHistoryClick?: (() => void) | undefined;
33
+ /** Callback fired when the panel back button is clicked. */
34
+ onPanelBack?: (() => void) | undefined;
35
+ /** Callback fired when the panel forward button is clicked. */
36
+ onPanelForward?: (() => void) | undefined;
37
+ /** Callback fired when the mobile panel close (✕) button is tapped.
38
+ * Should clear panel history and comparison state in the caller. */
39
+ onPanelClose?: (() => void) | undefined;
40
+ /**
41
+ * Fired when the user drags the mobile handle and releases.
42
+ * 'half' | 'full' → switch to that snap position.
43
+ * 'close' → close the drawer.
44
+ */
45
+ onMobileSnap?: ((state: 'half' | 'full' | 'close') => void) | undefined;
46
+ /** Returns the current mobile sheet state so the drag handler knows which snap to target. */
47
+ getMobileState?: (() => 'half' | 'full') | undefined;
48
+ /** Returns true when the chat is displayed as a mobile bottom-sheet. Used to keep the side-panel back button always enabled. */
49
+ getMobileViewport?: (() => boolean) | undefined;
50
+ /** Callback fired when a link in bot HTML is clicked. */
51
+ onLinkClick?: ((url: string) => void) | undefined;
52
+ /** Render a frontend-owned message UI payload inside the bubble, when present. */
53
+ renderMessageUISpec?: ((message: ChatMessage) => HTMLElement | null) | undefined;
54
+ /** Enable voice input (Web Speech API STT). Default: false. */
55
+ voiceEnabled?: boolean | undefined;
56
+ /** BCP 47 language for speech recognition. Default: 'tr-TR'. */
57
+ voiceLang?: string | undefined;
58
+ /** Callback fired when the "New Chat" button is clicked. */
59
+ onNewChat?: (() => void) | undefined;
60
+ /**
61
+ * Transcript presentation hooks (focus thread, pin-to-bottom heuristics).
62
+ * Optional — when omitted, legacy scroll behaviour is unchanged.
63
+ */
64
+ presentation?: {
65
+ onPinnedToBottomChange?: (pinned: boolean) => void;
66
+ onUserInteractingChange?: (interacting: boolean) => void;
67
+ /** User scrolled up while a thread focus is active — parent may show "former messages" */
68
+ onFormerMessagesHint?: () => void;
69
+ /** When true, stream-driven soft scroll-to-bottom is suppressed */
70
+ shouldBlockSoftAutoScroll?: () => boolean;
71
+ /** User tapped "show former messages" */
72
+ onReleasePresentationFocus?: () => void;
73
+ };
74
+ }
75
+ type SetPanelContentOptions = {
76
+ preserveAiZone?: boolean;
77
+ };
78
+ type TypingIndicatorMode = 'full' | 'presence';
79
+ export declare class ChatDrawer {
80
+ private root;
81
+ private messagesEl;
82
+ private inputEl;
83
+ private sendBtn;
84
+ private _sendStopHandler;
85
+ private i18n;
86
+ private onSend;
87
+ private _panelEl;
88
+ private _panelVisible;
89
+ private _panelCollapsed;
90
+ private _dividerEl;
91
+ private _onPanelToggle;
92
+ private _onHostShellSync;
93
+ private _pendingAttachment;
94
+ private _fileInput;
95
+ private _previewStrip;
96
+ private _previewName;
97
+ private _onAttachment;
98
+ private _onRollback;
99
+ private _onLinkClick;
100
+ private _pillsEl;
101
+ private _kvkkSlot;
102
+ private _panelTopBar;
103
+ private _userScrolledUp;
104
+ private _scrollLockedUntil;
105
+ private _inputChipsEl;
106
+ private _panelFloatingEl;
107
+ /** Mobile: overlay host for comparison dock (above panel scroll; avoids transformed panel containing block). */
108
+ private _comparisonDockSlotEl;
109
+ /** Slot between panel top bar and main scroll content (desktop AI picks / analyzing strip). */
110
+ private _panelAiZoneEl;
111
+ private _favBadgeEl;
112
+ private _thinkingSteps;
113
+ private _firstBotMessageIds;
114
+ private _voiceInput;
115
+ private _micBtn;
116
+ private _voiceEnabled;
117
+ private _voiceLang;
118
+ private _ignoreNextDividerClick;
119
+ private readonly _cleanups;
120
+ private _focusTrapHandler;
121
+ private _previouslyFocusedElement;
122
+ private _conversationEl;
123
+ private readonly _options;
124
+ private _reopenPanelBtn;
125
+ private _presentationFocusThreadId;
126
+ private _formerMessagesBtn;
127
+ private _programmaticScrollUntil;
128
+ private _userInteractionUntil;
129
+ private _touchStartY;
130
+ private _presentationPinned;
131
+ private _presentationUserInteracting;
132
+ private _resizeRafId;
133
+ private _cartBtn;
134
+ private _attachWrapEl;
135
+ private _attachMenuEl;
136
+ private _attachBtn;
137
+ private _attachMenuCleanup;
138
+ private _attachMenuClickTimerId;
139
+ private _typingLoadingBinding;
140
+ private _panelLoadingBinding;
141
+ private _panelAiZoneLoadingBinding;
142
+ private _beautyPhotoStepEl;
143
+ private _renderPhotoAnalysisCard;
144
+ constructor(container: HTMLElement, options: ChatDrawerOptions);
145
+ addMessage(message: ChatMessage): void;
146
+ /** Remove one transcript bubble (e.g. superseded empty assistant placeholder). */
147
+ removeMessageBubble(messageId: string): void;
148
+ showTypingIndicator(searchText?: string, mode?: TypingIndicatorMode | 'auto'): void;
149
+ /** Accumulate a new thinking step (shown as a checklist in the typing indicator). */
150
+ addThinkingStep(text: string): void;
151
+ setThinkingSteps(steps: string[]): void;
152
+ removeTypingIndicator(): void;
153
+ setTypingIndicatorMode(mode: TypingIndicatorMode | 'auto'): void;
154
+ private _panelOwnsProgressSurface;
155
+ /** Show a "Stop generating" button below the typing indicator. */
156
+ showStopButton(onStop: () => void): void;
157
+ /** Remove the stop-generating button if present. */
158
+ hideStopButton(): void;
159
+ showError(message?: string, onRetry?: () => void): void;
160
+ /** Show error with recovery action pills ("Try again" + "Ask something else"). */
161
+ showErrorWithRecovery(message: string, actions: {
162
+ onRetry: () => void;
163
+ onNewQuestion: () => void;
164
+ }): void;
165
+ /** Recovery pills only — error copy is shown as a normal assistant message. */
166
+ showRecoveryPillsOnly(actions: {
167
+ onRetry: () => void;
168
+ onNewQuestion: () => void;
169
+ }): void;
170
+ private setRecoveryPills;
171
+ clearMessages(): void;
172
+ /** Replace suggestion pills. Pass empty array to hide. */
173
+ setPills(pills: Array<{
174
+ label: string;
175
+ onAction: () => void;
176
+ icon?: string;
177
+ image?: string;
178
+ description?: string;
179
+ }>): void;
180
+ focusInput(): void;
181
+ showKvkkBanner(html: string, onDismiss: () => void): void;
182
+ hideKvkkBanner(): void;
183
+ /** True when the KVKK banner is mounted (user has not dismissed it yet). */
184
+ isKvkkBannerVisible(): boolean;
185
+ getElement(): HTMLElement;
186
+ /** Opens the hidden file picker used by the attachment flow. */
187
+ openAttachmentPicker(): void;
188
+ /** Show/hide camera attach controls in the input shell. */
189
+ setAttachmentControlsVisible(visible: boolean): void;
190
+ /** Beauty mode selfie helper card shown above the input area. */
191
+ setBeautyPhotoStepCard(options: {
192
+ visible: boolean;
193
+ processing?: boolean;
194
+ onSkip?: (() => void) | undefined;
195
+ title?: string | undefined;
196
+ description?: string | undefined;
197
+ uploadLabel?: string | undefined;
198
+ skipLabel?: string | undefined;
199
+ }): void;
200
+ /** Stage a file attachment for sending. Shows preview. */
201
+ stageAttachment(file: File): void;
202
+ /** Remove the staged attachment and hide preview. */
203
+ clearAttachment(): void;
204
+ private _routeAttachmentFile;
205
+ private _closeAttachMenu;
206
+ private _openAttachMenu;
207
+ private _toggleAttachMenu;
208
+ private _pasteImageFromClipboardMenu;
209
+ /** Get the currently staged attachment file, or null. */
210
+ getPendingAttachment(): File | null;
211
+ /**
212
+ * Area above the main panel body for “analyzing” + AITopPicks / AIGroupingCards
213
+ * so they stay in the main pane instead of the chat column.
214
+ */
215
+ setPanelAiZoneState(state: 'hidden' | 'analyzing' | 'results', options?: {
216
+ resultEl?: HTMLElement;
217
+ analyzingLabel?: string;
218
+ }): void;
219
+ private _clearPanelAiZoneState;
220
+ private _resetPanelAiZoneElement;
221
+ private _emitHostShellSync;
222
+ private _applyPanelCollapsedState;
223
+ private _syncPanelTopBarFromContent;
224
+ private _syncPanelTopBarTitleFromContent;
225
+ /** Replace panel content and show the panel. */
226
+ setPanelContent(el: HTMLElement, options?: SetPanelContentOptions): void;
227
+ /**
228
+ * Targeted content swap for an already-visible panel. Replaces the skeleton
229
+ * or the current content element with `el`, leaving topbar / AI zone /
230
+ * floating element attached. Also resets topbar actions
231
+ * because the incoming content provides its own toolbar.
232
+ */
233
+ private _swapPanelContent;
234
+ /** Append content to the panel without replacing existing content. */
235
+ appendPanelContent(el: HTMLElement): void;
236
+ /** Return the panel element's content child (after topbar), or null. */
237
+ getPanelContentElement(): HTMLElement | null;
238
+ /**
239
+ * After in-place mutations to panel content (e.g. consulting grid streaming patch),
240
+ * refresh top bar title derivation without replacing the content node.
241
+ */
242
+ resyncPanelTopBarFromCurrentContent(): void;
243
+ /** Whether the panel is currently visible (may be empty). */
244
+ isPanelVisible(): boolean;
245
+ /** Whether the panel is currently visible and has rendered content beyond chrome elements. */
246
+ hasPanelContent(): boolean;
247
+ /** Whether panel currently shows loading skeleton blocks. */
248
+ isPanelLoading(): boolean;
249
+ /** Show loading skeleton in the panel. Variant depends on contentType hint. */
250
+ showPanelLoading(contentType?: string): void;
251
+ /** Update the panel top bar navigation state. */
252
+ updatePanelTopBar(canBack: boolean, canForward: boolean, title: string): void;
253
+ getPanelTopBarTitle(): string;
254
+ /** Update the favorites badge count. Pass 0 to hide the badge. */
255
+ updateFavoritesBadge(count: number): void;
256
+ /**
257
+ * Hide the panel and clear its content. Always hides — even in force-expanded mode.
258
+ * Callers: _hideDrawer (stale panel cleanup), stream onDone (loading skeleton cleanup),
259
+ * thread navigation (no snapshot to restore). All require full hide.
260
+ * Keeps `_panelCollapsed` untouched so user collapse preference survives future panel renders.
261
+ */
262
+ clearPanel(): void;
263
+ private _syncComparisonDockVisibility;
264
+ /**
265
+ * Mobile-only slot (see CSS): pins the comparison dock above panel scroll.
266
+ * Pass null to clear.
267
+ */
268
+ setComparisonDockContent(el: HTMLElement | null): void;
269
+ /**
270
+ * On mobile: hide the side panel overlay without clearing its content.
271
+ * Shows the reopen button in the header so the user can slide the panel back in.
272
+ */
273
+ hideMobilePanel(): void;
274
+ private _showMobilePanelFromBtn;
275
+ showMobilePanel(): void;
276
+ /** Expand panel without locking — user can still toggle via divider. */
277
+ expandPanel(): void;
278
+ /**
279
+ * Ensure the panel starts expanded (panelMode: 'expanded').
280
+ * Users can still collapse/expand via the divider chevron.
281
+ */
282
+ setForceExpanded(): void;
283
+ /**
284
+ * Reset the left panel scroll to the top after new list/grid content is mounted.
285
+ * innerHTML assignment already resets scrollTop to 0; this is a defensive pin in
286
+ * case subsequent DOM mutations (appended children, layout) shift it.
287
+ */
288
+ private _smoothScrollPanelListToTop;
289
+ private _getChoicePrompterRevealScrollThreshold;
290
+ /** Update scroll affordance (bottom fade gradient) on the panel. */
291
+ private _updateScrollAffordance;
292
+ /** Horizontal swipe on conversation/panel areas to toggle the panel (mobile only). */
293
+ private _setupHorizontalSwipe;
294
+ /** Toggle panel between collapsed and expanded. */
295
+ togglePanel(): void;
296
+ /** Whether the panel is currently collapsed by the user. */
297
+ isPanelCollapsed(): boolean;
298
+ /** Programmatically set panel collapsed state. */
299
+ setPanelCollapsed(collapsed: boolean): void;
300
+ /** Save panel collapsed state to sessionStorage. */
301
+ persistPanelState(accountId: string): void;
302
+ /** Restore panel collapsed state from sessionStorage. Returns true when restored as collapsed. */
303
+ restorePanelState(accountId: string): boolean;
304
+ private _createLoadingSequence;
305
+ private _applyLoadingSteps;
306
+ private _clearLoadingBindingInterval;
307
+ private _destroyLoadingBinding;
308
+ private _updateSendEnabled;
309
+ private _renderSendButtonIcon;
310
+ private _submit;
311
+ private _toggleVoice;
312
+ /** Lock auto-scroll for 500ms after session history restore to prevent visual jump. */
313
+ lockScrollForRestore(): void;
314
+ /** Scroll to bottom only if user hasn't scrolled up. Force=true always scrolls. */
315
+ private _scrollToBottom;
316
+ /** Public method for typewriter ticks — scrolls only if user is near bottom. */
317
+ scrollToBottomIfNeeded(): void;
318
+ /** Update a bot message's text content in the DOM (e.g. for fallback messages). */
319
+ updateBotMessage(messageId: string, html: string, renderHint?: string, photoAnalysis?: {
320
+ summary: string;
321
+ strengths?: string[];
322
+ focusPoints?: string[];
323
+ celebStyle?: string;
324
+ celebStyleReason?: string;
325
+ nextQuestion?: string;
326
+ }): void;
327
+ /** Mark a message as the first bot message in its thread (for special styling). */
328
+ markFirstBotMessage(messageId: string): void;
329
+ /** Scroll to the first message of the last thread (for restore targeting). */
330
+ scrollToLastThread(): void;
331
+ /** Scroll transcript so the thread’s first visible element sits near the top; skips
332
+ * empty/zero-height bubbles (silent or not-yet-streamed) so real content anchors instead. */
333
+ scrollThreadIntoView(threadId: string, behavior?: ScrollBehavior): boolean;
334
+ /** Programmatic scroll to bottom (e.g. host bridge) — bypasses “user scrolled up” until next frame. */
335
+ scrollToBottomPresentation(behavior?: ScrollBehavior): void;
336
+ private _scrollMessagesTo;
337
+ /** Collapse transcript to a single thread (null = show full history). */
338
+ setPresentationFocus(threadId: string | null): void;
339
+ setFormerMessagesButtonVisible(visible: boolean): void;
340
+ setInputPlaceholder(placeholder: string): void;
341
+ private _applyPresentationCollapsed;
342
+ /** Call after inline chat DOM (e.g. ProductSummaryCard) is appended — reapplies thread collapse. */
343
+ refreshPresentationCollapsed(): void;
344
+ /** Set compact input-area chips (search/info/review shortcuts above input). */
345
+ setInputAreaChips(chips: Array<{
346
+ label: string;
347
+ onAction: () => void;
348
+ icon?: string;
349
+ }>): void;
350
+ /** Clear input-area chips. */
351
+ clearInputAreaChips(): void;
352
+ /** Activate focus trap — Tab/Shift+Tab cycles within the drawer. */
353
+ trapFocus(): void;
354
+ /** Release the focus trap and restore previously focused element. */
355
+ releaseFocus(): void;
356
+ /** Briefly animate the cart icon button to signal a successful add-to-cart. */
357
+ flashCartBadge(): void;
358
+ /** Show a temporary success toast inside the shadow root. */
359
+ showCartToast(message: string): void;
360
+ /** Clean up event listeners and child resources (VoiceInput, timers). */
361
+ destroy(): void;
362
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Floating card that suggests the user try comparison mode.
3
+ *
4
+ * Shows in the panel bottom-right when a ProductGrid is displayed and
5
+ * comparison mode is not active.
6
+ */
7
+ export interface ChoicePrompterOptions {
8
+ heading: string;
9
+ suggestion: string;
10
+ ctaLabel: string;
11
+ threadId: string;
12
+ onCtaClick: () => void;
13
+ onDismiss?: () => void;
14
+ dismissAriaLabel?: string;
15
+ }
16
+ export declare function createChoicePrompter(options: ChoicePrompterOptions): HTMLElement;
17
+ /** Called when a new user search starts so the card can be shown again. */
18
+ export declare function clearChoicePrompterDismissState(): void;
19
+ export declare function isChoicePrompterDismissed(threadId: string): boolean;
20
+ /** Records the same dismiss state as the CTA for external toolbar actions. */
21
+ export declare function recordChoicePrompterDismissedForThread(threadId: string): void;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * ComparisonTable — renders a product comparison table with recommended pick,
3
+ * attribute rows, highlights, and optional special cases.
4
+ *
5
+ * XSS safety: All text is set via textContent. Image URLs are validated
6
+ * for safe protocols before being assigned to img.src.
7
+ */
8
+ import type { PriceFormatConfig } from '../../common/price-formatter.js';
9
+ /**
10
+ * Map a raw criteria field name to a human-readable label.
11
+ * Checks locale-specific `criteriaLabels` first (from i18n), then the
12
+ * built-in fallback map, then applies a formatting heuristic.
13
+ */
14
+ export declare function formatCriteriaName(rawName: string, criteriaLabels?: Record<string, string>, locale?: string): string;
15
+ export interface ComparisonProduct {
16
+ sku: string;
17
+ name: string;
18
+ price: string;
19
+ url?: string | undefined;
20
+ imageUrl?: string | undefined;
21
+ rating?: number | undefined;
22
+ reviewCount?: number | undefined;
23
+ }
24
+ export interface ComparisonAttribute {
25
+ label: string;
26
+ values: string[];
27
+ }
28
+ interface ComparisonTableI18n {
29
+ comparisonHeading?: string;
30
+ recommendedChoiceLabel?: string;
31
+ highlightsLabel?: string;
32
+ keyDifferencesLabel?: string;
33
+ specialCasesLabel?: string;
34
+ viewMoreLabel?: string;
35
+ addToCartButton?: string;
36
+ /** Locale-specific attribute display names (e.g., { screen_size: 'Screen Size' }). */
37
+ criteriaLabels?: Record<string, string>;
38
+ }
39
+ export interface ComparisonTableOptions {
40
+ recommended: ComparisonProduct;
41
+ products: ComparisonProduct[];
42
+ attributes: ComparisonAttribute[];
43
+ highlights: string[];
44
+ specialCases?: string[] | undefined;
45
+ onProductClick: (params: {
46
+ sku: string;
47
+ name: string;
48
+ }) => void;
49
+ onAddToCart?: ((sku: string) => void) | undefined;
50
+ recommendedText?: string | undefined;
51
+ winnerHits?: Record<string, {
52
+ positive?: string[];
53
+ negative?: string[];
54
+ }> | undefined;
55
+ productActions?: Record<string, {
56
+ title: string;
57
+ type: string;
58
+ payload?: unknown;
59
+ }> | undefined;
60
+ keyDifferencesHtml?: string | undefined;
61
+ locale?: string | undefined;
62
+ i18n?: ComparisonTableI18n | undefined;
63
+ pricing?: PriceFormatConfig | undefined;
64
+ }
65
+ export declare function renderComparisonTable(options: ComparisonTableOptions): HTMLElement;
66
+ export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Consulting Style Picker — renders a tabbed style variation picker
3
+ * for beauty consulting and grouped account-expert flows.
4
+ *
5
+ * Extracted from renderProductGrid() to keep renderUISpec.ts focused
6
+ * on generic component dispatch.
7
+ *
8
+ * Streaming: the first non-`loading` variation can paint immediately; later
9
+ * chunks update tabs + product grid in place via {@link patchConsultingStylePickerDom}
10
+ * so the panel is not fully replaced (no skeleton→full flash).
11
+ */
12
+ import type { ChatUISpecRenderContext } from '../types.js';
13
+ type StyleVariationProduct = Record<string, unknown>;
14
+ export type StyleVariation = {
15
+ style_label?: string;
16
+ style_mood?: string;
17
+ image_url?: string;
18
+ status?: string;
19
+ product_list?: StyleVariationProduct[];
20
+ recommendation_groups?: Array<{
21
+ label?: string;
22
+ reason?: string;
23
+ skus?: string[];
24
+ }>;
25
+ };
26
+ /**
27
+ * Renders the consulting style picker UI (variation buttons + grouped product grid).
28
+ *
29
+ * @param wrapper Container to append into.
30
+ * @param grid The product grid element (cleared and repopulated per variation).
31
+ * @param styleVariations Non-empty filtered variation list.
32
+ * @param ctx Render context (i18n, callbacks).
33
+ */
34
+ export declare function renderConsultingStylePicker(wrapper: HTMLElement, grid: HTMLElement, styleVariations: StyleVariation[], ctx?: ChatUISpecRenderContext): void;
35
+ /**
36
+ * Apply streaming updates to an existing consulting picker without replacing the
37
+ * whole panel DOM. Returns false if `wrapper` is not a consulting grid shell.
38
+ */
39
+ export declare function patchConsultingStylePickerDom(wrapper: HTMLElement, styleVariations: StyleVariation[], ctx?: ChatUISpecRenderContext): boolean;
40
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Slim bottom-docked comparison bar for the main panel.
3
+ *
4
+ * Keeps compare mode visible without the oversized floating prompt.
5
+ */
6
+ import type { ChatUISpecRenderContext } from '../types.js';
7
+ export declare function renderFloatingComparisonButton(selectedSkus: string[], ctx: ChatUISpecRenderContext): HTMLElement;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * FloatingLauncher — Customizable search-bar style launcher that mounts inside
3
+ * the chat widget's shadow DOM.
4
+ *
5
+ * Follows the same pattern as `makePillLauncher`: the chat widget runtime
6
+ * calls `createFloatingLauncher()` internally when `config.floatingLauncher`
7
+ * is set — no host-side `apply()` step is needed.
8
+ *
9
+ * In the injector, just pass the option through chat config:
10
+ *
11
+ * chat: {
12
+ * floatingLauncher: {
13
+ * primaryColor: '#ec6e00',
14
+ * placeholders: ['Ürün ara', 'Karşılaştır', 'Soru sor'],
15
+ * },
16
+ * }
17
+ */
18
+ export interface FloatingLauncherOptions {
19
+ /** Brand accent color — focus ring, wave bars, border animation. Default: '#6366f1' */
20
+ primaryColor?: string;
21
+ /** Input bar background. Default: '#ffffff' */
22
+ backgroundColor?: string;
23
+ /** Input text color. Default: '#111827' */
24
+ textColor?: string;
25
+ /** Placeholder text color. Default: '#9ca3af' */
26
+ placeholderColor?: string;
27
+ /** Icon / button color. Default: '#6b7280' */
28
+ iconColor?: string;
29
+ /** Normal-state border color. Default: '#e5e7eb' */
30
+ borderColor?: string;
31
+ /** Input bar corner radius. Default: '999px' */
32
+ borderRadius?: string;
33
+ /** Input bar height. Default: '56px' */
34
+ height?: string;
35
+ /**
36
+ * Maximum width of the input bar.
37
+ * Can also be set via CSS: `--gengage-floating-launcher-max-width`.
38
+ * Default: '680px'
39
+ */
40
+ maxWidth?: string;
41
+ /** CSS font-family string. Default: 'inherit' */
42
+ fontFamily?: string;
43
+ /**
44
+ * Placeholder texts that cycle in sequence.
45
+ * Default: ['Ürün ara', 'Karşılaştır', 'Soru sor']
46
+ */
47
+ placeholders?: string[];
48
+ /** Milliseconds between placeholder rotations. Default: 2000 */
49
+ placeholderInterval?: number;
50
+ /**
51
+ * Web Speech API language code.
52
+ * Default: 'tr-TR'
53
+ */
54
+ voiceLang?: string;
55
+ /**
56
+ * Animate a rainbow border ring while voice recording is active.
57
+ * Default: true
58
+ */
59
+ showBorderAnimation?: boolean;
60
+ sendAriaLabel?: string;
61
+ micAriaLabel?: string;
62
+ cancelAriaLabel?: string;
63
+ openChatAriaLabel?: string;
64
+ }
65
+ export interface FloatingLauncherKit {
66
+ /** Root container element — the runtime appends this to the shadow DOM. */
67
+ readonly container: HTMLElement;
68
+ /**
69
+ * Show the "open chat" icon button. The runtime calls this after the user's
70
+ * first message has been successfully sent.
71
+ */
72
+ showOpenChatButton(): void;
73
+ /** Release all resources. Called by the widget's `destroy()`. */
74
+ destroy(): void;
75
+ }
76
+ export declare function createFloatingLauncher(options: FloatingLauncherOptions, callbacks: {
77
+ onSend: (text: string) => void;
78
+ onOpenChat: () => void;
79
+ }, shadowRoot: ShadowRoot): FloatingLauncherKit;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Grounding Review Card renderer.
3
+ *
4
+ * Renders a clickable card for review grounding data with title,
5
+ * review count, and a CTA arrow. The entire card is clickable.
6
+ *
7
+ * XSS safety: All text is set via textContent. No innerHTML.
8
+ */
9
+ import type { UIElement } from '../../common/types.js';
10
+ import type { ChatUISpecRenderContext } from '../types.js';
11
+ export declare function renderGroundingReviewCard(element: UIElement, ctx: ChatUISpecRenderContext): HTMLElement;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Renders a handoff notice when the backend escalates to a human agent.
3
+ *
4
+ * XSS safety: All text is set via textContent. No innerHTML.
5
+ */
6
+ import type { ChatUISpecRenderContext } from '../types.js';
7
+ export declare function renderHandoffNotice(element: {
8
+ props?: Record<string, unknown>;
9
+ }, context: ChatUISpecRenderContext): HTMLElement;
@@ -0,0 +1,6 @@
1
+ export interface KvkkBannerOptions {
2
+ htmlContent: string;
3
+ onDismiss: () => void;
4
+ closeAriaLabel?: string;
5
+ }
6
+ export declare function createKvkkBanner(options: KvkkBannerOptions): HTMLElement;
@@ -0,0 +1,28 @@
1
+ export interface LauncherOptions {
2
+ onClick: () => void;
3
+ svgMarkup?: string;
4
+ /** Full-size image URL — renders launcher as an image button (no circular bg). */
5
+ imageUrl?: string;
6
+ /** Mobile-specific image URL. When set, shown on mobile; `imageUrl` shown on desktop. */
7
+ mobileImageUrl?: string;
8
+ ariaLabel?: string;
9
+ hideMobile?: boolean;
10
+ mobileBreakpoint?: number;
11
+ tooltip?: string;
12
+ }
13
+ /**
14
+ * Result of createLauncher — the container wraps the button and exposes
15
+ * content-area slots where the QNA widget or host page can inject engagement
16
+ * actions (buying-hesitation questions, "Find Similar" buttons, etc.).
17
+ */
18
+ export interface LauncherElements {
19
+ /** Outer container — append this to the DOM. */
20
+ container: HTMLElement;
21
+ /** The clickable FAB button. */
22
+ button: HTMLButtonElement;
23
+ /** Slot above the button (primary QNA actions). */
24
+ contentArea: HTMLElement;
25
+ /** Slot below the button (secondary content). */
26
+ contentAreaBottom: HTMLElement;
27
+ }
28
+ export declare function createLauncher(options: LauncherOptions): LauncherElements;
@@ -0,0 +1,4 @@
1
+ import type { UIElement } from '../../common/types.js';
2
+ import type { ChatUISpecRenderContext } from '../types.js';
3
+ export declare const FRONTEND_PANEL_RESTORE_ACTION = "frontend_restore_panel_message";
4
+ export declare function renderPanelRestoreCard(element: UIElement, ctx: ChatUISpecRenderContext): HTMLElement;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * PanelTopBar — navigation bar at the top of the panel pane.
3
+ *
4
+ * Shows back/forward arrow buttons and a title derived from the current
5
+ * panel content type. On mobile a close (✕) button is also rendered so
6
+ * users can dismiss all panel layers with a single tap and return to the
7
+ * conversation, without having to navigate back through every history entry.
8
+ */
9
+ export interface PanelTopBarOptions {
10
+ onBack: () => void;
11
+ onForward: () => void;
12
+ /** Called when the mobile close (✕) button is tapped. Should clear all panel history. */
13
+ onClose?: () => void;
14
+ backAriaLabel?: string;
15
+ forwardAriaLabel?: string;
16
+ /** Aria label for the close button (mobile only). */
17
+ closePanelAriaLabel?: string;
18
+ }
19
+ export declare class PanelTopBar {
20
+ private _el;
21
+ private _backBtn;
22
+ private _forwardBtn;
23
+ private _titleEl;
24
+ private _actionsEl;
25
+ private _closeBtn;
26
+ constructor(options: PanelTopBarOptions);
27
+ update(canBack: boolean, canForward: boolean, title: string): void;
28
+ getElement(): HTMLElement;
29
+ setTitle(title: string): void;
30
+ setActions(actionsEl: HTMLElement | null): void;
31
+ getTitle(): string;
32
+ }