@gengage/assistant-fe 0.4.4 → 0.4.6

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 (50) hide show
  1. package/README.md +1 -1
  2. package/dist/api-paths-C4GDpeTf.js +1214 -0
  3. package/dist/chat/index.d.ts +1 -374
  4. package/dist/chat/runtime.d.ts +374 -0
  5. package/dist/chat/types.d.ts +1 -1
  6. package/dist/chat-BRKK63lt.js +303 -0
  7. package/dist/chat-runtime.js +13 -0
  8. package/dist/chat.iife.js +7 -7
  9. package/dist/chat.js +11 -10
  10. package/dist/common/config-constants.d.ts +1 -0
  11. package/dist/common/config-schema.d.ts +0 -1
  12. package/dist/common/overlay.d.ts +4 -4
  13. package/dist/common-CEN5OW7E.js +491 -0
  14. package/dist/common.js +78 -76
  15. package/dist/{connection-warning-n88bjkqL.js → connection-warning-B6oIU-9s.js} +1 -1
  16. package/dist/context-VIG4SVcS.js +529 -0
  17. package/dist/index.js +70 -67
  18. package/dist/locale-CfqNifrU.js +7 -0
  19. package/dist/native-webview-DudQ7nHe.js +273 -0
  20. package/dist/native.iife.js +28 -91
  21. package/dist/native.js +1 -1
  22. package/dist/overlay-1EO41ZC7.js +212 -0
  23. package/dist/overlay.d.ts +4 -0
  24. package/dist/overlay.js +10 -0
  25. package/dist/pill-launcher-57nrdLRr.js +364 -0
  26. package/dist/qna/index.d.ts +1 -61
  27. package/dist/qna/runtime.d.ts +61 -0
  28. package/dist/qna-BNvttR6s.js +40 -0
  29. package/dist/qna-runtime.js +8 -0
  30. package/dist/qna.iife.js +4 -4
  31. package/dist/qna.js +6 -5
  32. package/dist/{simrel-K2TGFi1r.js → runtime-BdwZZIrO.js} +244 -293
  33. package/dist/{chat-DI7Vm0gh.js → runtime-C0qZk0y7.js} +1644 -2298
  34. package/dist/{qna-C5Ok3wd0.js → runtime-DDu8Wk0z.js} +87 -121
  35. package/dist/schemas-CLo8wCjs.js +3207 -0
  36. package/dist/{simbut-Cb5RfaAp.js → simbut-BMWC6x_t.js} +24 -22
  37. package/dist/simbut.js +1 -1
  38. package/dist/simrel/index.d.ts +1 -59
  39. package/dist/simrel/runtime.d.ts +59 -0
  40. package/dist/simrel-ohfkluhp.js +55 -0
  41. package/dist/simrel-runtime.js +8 -0
  42. package/dist/simrel.iife.js +4 -4
  43. package/dist/simrel.js +7 -6
  44. package/dist/widget-base-TgwiA8cD.js +578 -0
  45. package/package.json +17 -1
  46. package/dist/common-BxSi3UWt.js +0 -387
  47. package/dist/locale-MM0U5eeR.js +0 -1109
  48. package/dist/native-webview-DFqnyus6.js +0 -586
  49. package/dist/schemas-JpRGzRQT.js +0 -4419
  50. /package/dist/{price-formatter-CR6VT5z4.js → price-formatter-xI3g9Cd4.js} +0 -0
@@ -0,0 +1,374 @@
1
+ import { ActionPayload, PageContext, UIElement } from '../common/types.js';
2
+ import { BaseWidget } from '../common/widget-base.js';
3
+ import { ChatWidgetConfig } from './types.js';
4
+ import { AssistantMode } from './assistant-mode.js';
5
+ /**
6
+ * Floating AI chat widget with streaming NDJSON responses, product cards, and comparison tables.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { GengageChat, bootstrapSession } from '@gengage/assistant-fe';
11
+ *
12
+ * const chat = new GengageChat();
13
+ * await chat.init({
14
+ * accountId: 'mystore',
15
+ * middlewareUrl: '<backend service location provided for your Gengage account>',
16
+ * session: { sessionId: bootstrapSession() },
17
+ * });
18
+ * chat.open(); // Programmatically open the drawer
19
+ * ```
20
+ */
21
+ export declare function isSimilarsAppendGrid(element: UIElement | undefined): boolean;
22
+ export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
23
+ private static readonly _MAX_COMPARISON_SELECTION;
24
+ private _shadow;
25
+ private _rootEl;
26
+ /** Full-viewport scrim when drawer is open (floating/overlay); not used for inline. */
27
+ private _backdropEl;
28
+ private _launcher;
29
+ private _drawer;
30
+ private _bridge;
31
+ private _drawerVisible;
32
+ /** Set when `config.pillLauncher` is used — `apply()` runs at end of `onInit`. */
33
+ private _pillLauncherApply;
34
+ /**
35
+ * Host scroll blocked via capture-phase `touchmove`/`wheel` + preventDefault on `window` and
36
+ * `document`, `scroll` pin for the viewport, temporary `overflow` / `overscroll-behavior` on
37
+ * `html`/`body` (restored on release).
38
+ */
39
+ private _hostScrollLockActive;
40
+ private _hostOverflowRestore;
41
+ /** Viewport scroll position captured when the lock starts (Windows / nested layouts). */
42
+ private _hostScrollLockViewport;
43
+ private _hostScrollPinning;
44
+ private readonly _preventHostDocumentTouchMove;
45
+ private readonly _preventHostDocumentWheel;
46
+ private readonly _pinHostViewportScroll;
47
+ private _messages;
48
+ private _currentMessageId;
49
+ private _abortControllers;
50
+ /** Current thread cursor — only messages with threadId <= this are visible. */
51
+ private _currentThreadId;
52
+ /** Most recent threadId ever created — used to detect branch points. */
53
+ private _lastThreadId;
54
+ /** Timestamp when the chat session was created (ISO 8601). */
55
+ private _chatCreatedAt;
56
+ /** Last backend-streamed context object — sent back with every request. */
57
+ private _lastBackendContext;
58
+ private _productSort;
59
+ private _lastSku;
60
+ private _lastPageType;
61
+ private _lastSkuListKey;
62
+ private _comparisonSelectMode;
63
+ private _comparisonSelectedSkus;
64
+ private _comparisonSelectionWarning;
65
+ private _comparisonRefreshRafId;
66
+ private _lastAppliedKeyboardInset;
67
+ /** SKUs of products the user has viewed across panel product grids. */
68
+ private _viewedProductSkus;
69
+ /** Latest AI analysis UISpec (AITopPicks/AIGroupingCards) per thread for panel restore. */
70
+ private _panelAiSpecByThread;
71
+ private _choicePrompterEl;
72
+ private _openState;
73
+ private _mobileBreakpoint;
74
+ private _isMobileViewport;
75
+ /** GA: previous MainPane expanded state for `gengage-chatbot-maximized` edge detection. */
76
+ private _gaPrevMainPaneExpanded;
77
+ private _pdpLaunched;
78
+ private _plpLaunched;
79
+ private _homepageLaunched;
80
+ private _entryContextPrimed;
81
+ /** True while a silent context-prime launch (PDP/PLP/homepage) is in flight. */
82
+ private _contextPrimingInFlight;
83
+ /** User messages queued until context priming completes. */
84
+ private _queuedUserMessages;
85
+ private _productContextUnavailableSku;
86
+ private _i18n;
87
+ private _extendedModeManager;
88
+ /** Active typewriter animation handle — cancelled on new action or drawer close. */
89
+ private _activeTypewriter;
90
+ /** Active TTS audio handle — stopped on new stream start or drawer close. */
91
+ private _activeTtsHandle;
92
+ /** Active request thread ID — guards against stale stream events from cancelled requests. */
93
+ private _activeRequestThreadId;
94
+ /** Accumulated SKU → product item map from outputText events. */
95
+ private _skuToProductItem;
96
+ /** Current conversation mode from the latest outputText event. */
97
+ private _conversationMode;
98
+ /** Whether initialization (including IDB restore) has completed. */
99
+ private _initComplete;
100
+ /** Queue of actions received before init completes. Max 10, FIFO discard. */
101
+ private _pendingActions;
102
+ /** Supplemental context received from host via bridge (e.g. PDP detail context). */
103
+ private _bridgeContext;
104
+ /** Last cart quantity received from host via bridge. */
105
+ private _cartQuantity;
106
+ private _threadsWithFirstBot;
107
+ /** Panel state manager (snapshots, topbar, navigation). */
108
+ private _panel;
109
+ /** Client-side panel navigation stack for local drilldowns (e.g. card → detail). Max 10 entries.
110
+ * Stores rebuild info (UISpec or kind) instead of DOM clones so back navigation
111
+ * produces fresh elements with live event listeners. */
112
+ private _localPanelHistory;
113
+ private static readonly _MAX_PANEL_HISTORY;
114
+ /** Tracks how the current panel content was produced, for history/error-recovery rebuild. */
115
+ private _currentPanelSource;
116
+ /** IndexedDB session persistence manager. */
117
+ private _session;
118
+ /** LocalStorage-backed chat history manager. */
119
+ private _historyStorage;
120
+ /** Active local history session ID for the current conversation. */
121
+ private _activeHistorySessionId;
122
+ /** Transcript focus, pin-to-bottom, and scroll request coordination. */
123
+ private readonly _presentation;
124
+ /** Registered event callbacks (GA4 event hooks). Key = event name, value = set of callbacks. */
125
+ private _eventCallbacks;
126
+ /** Last sent action+options for retry on error. */
127
+ private _lastSentAction;
128
+ /** Consecutive identical error counter for account-inactive detection. */
129
+ private _consecutiveErrorCount;
130
+ /** Last error message text for deduplication. */
131
+ private _lastErrorMessage;
132
+ private _modeController;
133
+ /** @deprecated Alias for backward compat in tests. Use _modeController.mode. */
134
+ get _assistantMode(): AssistantMode;
135
+ set _assistantMode(value: AssistantMode);
136
+ /** @deprecated Alias for backward compat in tests. Use _modeController.uiHints. */
137
+ get _uiHints(): Record<string, unknown> | null;
138
+ set _uiHints(value: Record<string, unknown> | null);
139
+ protected onInit(config: ChatWidgetConfig): Promise<void>;
140
+ protected onUpdate(context: Partial<PageContext>): void;
141
+ protected onShow(): void;
142
+ protected onHide(): void;
143
+ protected onDestroy(): void;
144
+ open(options?: {
145
+ state?: 'full' | 'half';
146
+ initialMessage?: string;
147
+ }): void;
148
+ openWithAction(action: ActionPayload, options?: {
149
+ sku?: string;
150
+ state?: 'full' | 'half';
151
+ }): void;
152
+ /** Send a user message programmatically (same flow as typing + submit). */
153
+ sendMessage(text: string): void;
154
+ /** Send a backend action programmatically. */
155
+ sendAction(action: ActionPayload, options?: {
156
+ silent?: boolean;
157
+ }): void;
158
+ close(): void;
159
+ saveSession(sessionId: string, sku: string): void;
160
+ get isOpen(): boolean;
161
+ /**
162
+ * Register a callback for integration events (e.g. 'gengage-cart-add', 'gengage-product-favorite').
163
+ * The callback receives the event detail and should return true (success) or false (failure).
164
+ * For add-to-cart, failure triggers an error message in the chat.
165
+ * For product-favorite, failure reverts the heart on the card and shows an error message.
166
+ * @returns unsubscribe function
167
+ */
168
+ addCallback(eventName: string, callback: (detail: Record<string, unknown>) => boolean | Promise<boolean>): () => void;
169
+ private _applyDiscountedPriceColorVar;
170
+ private _abortAllActiveRequests;
171
+ /**
172
+ * Drop assistant rows that are still "streaming" with no text when the user starts
173
+ * a new turn. Otherwise each superseded request leaves an empty model message in
174
+ * `_messages` — it is included in `chatHistory` and can confuse the backend and
175
+ * delay or distort the next response.
176
+ */
177
+ private _pruneEmptyStreamingAssistantPlaceholders;
178
+ /** Clear all runtime conversation state while keeping the widget mounted and ready. */
179
+ private _clearConversationState;
180
+ /** Reset all chat state when navigating to a different SKU/page. */
181
+ private _resetForNewPage;
182
+ /** Start a brand-new local conversation on the current page context. */
183
+ private _startNewChat;
184
+ /**
185
+ * Same side effects as stream UISpec `clearPanel`: hide/clear the assistant panel without
186
+ * `restoreOrClearPanel()`. Used for `clearPanel` chunks and PDP chat layout (`productDetailsExtended` off).
187
+ */
188
+ private _clearAssistantPanelLikeStreamClearPanel;
189
+ private _flushPresentationScroll;
190
+ private _focusPresentationThread;
191
+ /** Align inline UISpec render so the thread’s first visible node stays at the top. */
192
+ private _scrollInlineIntoView;
193
+ private _releasePresentationFocus;
194
+ private _hasMultipleThreadIds;
195
+ private _orderedThreadIds;
196
+ private _maybeAutoAnchorUnreadAssistant;
197
+ private _handleBridgeMessage;
198
+ private _registerPublicAPI;
199
+ private _showDrawer;
200
+ /** Show welcome message and starter pills on first open with empty history. */
201
+ private _showWelcomeIfNeeded;
202
+ private _resolveOpeningContextKey;
203
+ private _resolveContextualOpeningMessage;
204
+ private _resolveContextualOpeningGuidance;
205
+ private _resolveContextualOpeningActions;
206
+ private _resolveContextualOpeningAction;
207
+ private _readContextStringField;
208
+ private _readContextStringListField;
209
+ private _buildEntryOpeningPageDetails;
210
+ /** True when the current page type has a dedicated silent auto-launch that provides its own greeting. */
211
+ private _hasDedicatedContextLaunch;
212
+ private _shouldPrimeContextualOpening;
213
+ private _maybePrimeEntryContextOpening;
214
+ private _hideDrawer;
215
+ private _syncViewportState;
216
+ /**
217
+ * Dimming backdrop + click-through scrim only in this state:
218
+ * - overlay: drawer open (full-screen modal)
219
+ * - floating: drawer open and side panel visible (split / “maximized” layout)
220
+ */
221
+ private _isMaximizedForHostChrome;
222
+ /** Host page scroll blocked whenever MainPane is shown (including collapsed split). */
223
+ private _shouldLockHostDocumentScroll;
224
+ private _applyOpenStateClasses;
225
+ /** MainPane = assistant left panel; mobile counts full overlay panel as expanded. */
226
+ private _mainPaneExpandedForAnalytics;
227
+ private _maybeTrackChatbotMainPaneGa;
228
+ private _syncHostDocumentScrollLock;
229
+ /**
230
+ * When true, we do not preventDefault — the event may drive chat-internal scrolling.
231
+ * Full-viewport backdrop sits inside the shadow tree, so `composedPath()` always hits
232
+ * the host; we must not treat "inside widget" as "allow scroll" for that case.
233
+ */
234
+ private _hostScrollEventShouldReachChatScroller;
235
+ private _applyHostDocumentScrollLock;
236
+ private _releaseHostDocumentScrollLock;
237
+ private _handleAttachment;
238
+ private _sendMessage;
239
+ private _flushQueuedUserMessages;
240
+ /** Apply ui_hints from the backend CONTEXT event — delegates to mode controller. */
241
+ private _applyUiHints;
242
+ private _handleRedirectMetadata;
243
+ private _sendAction;
244
+ /** Return messages visible at the current thread cursor. */
245
+ private _getVisibleMessages;
246
+ /** Handle rollback-on-click from a user message bubble. */
247
+ private _appendSimilarsToPanel;
248
+ /** Normalize product SKU for comparisons (wire may send string or number). */
249
+ private _coerceSkuKey;
250
+ private _productSkuKey;
251
+ private _pdpPageContextSkuKey;
252
+ /**
253
+ * Returns the SKU of the product currently rendered in the side panel, if any.
254
+ *
255
+ * Used to short-circuit duplicate `ProductSummaryCard` messages when the user
256
+ * re-clicks the product that is already open in the panel. Only returns a SKU
257
+ * when the live panel source is a `ProductDetailsPanel` spec (either standalone
258
+ * or paired with a similars grid).
259
+ */
260
+ private _getCurrentPanelProductSku;
261
+ /**
262
+ * “Active” PDP SKU for suppressing redundant `ProductSummaryCard` clicks: prefer
263
+ * the panel spec when `productDetailsExtended` keeps a PDP there; otherwise
264
+ * fall back to host `pageContext` on PDP pages (panel may have been cleared).
265
+ */
266
+ private _activeSkuForProductSummaryClick;
267
+ /** After similars grid is appended, extend panel source so back/history/snapshot rebuild includes it. */
268
+ private _mergePanelSourceWithSimilars;
269
+ /** Re-render PDP plus similar-products block (matches `_appendSimilarsToPanel` structure). */
270
+ private _renderProductDetailsWithSimilars;
271
+ /** Sets ctx.panelProductListHeading for ProductGrid / PDP+similars rebuilds. */
272
+ private _applyPanelListHeadingToContext;
273
+ private _renderPanelFromSource;
274
+ private _handleRollback;
275
+ private _ensureMobileFullSheetForPanel;
276
+ private _ensureMobilePanelOverlayVisible;
277
+ private _ensurePdpPrimeSuggestedUiIfNeeded;
278
+ /** Rewind the conversation to the given thread. */
279
+ private _rollbackToThread;
280
+ private _persistHistoryToLocalStorage;
281
+ private _persistConversationState;
282
+ private _persistConversationStateForNavigation;
283
+ private _formatHistoryTimestamp;
284
+ private _openHistoryPanel;
285
+ private _buildHistoryPageEl;
286
+ private _deleteHistorySession;
287
+ private _loadHistorySession;
288
+ private _restoreFromHistoryRecord;
289
+ private _persistToIndexedDB;
290
+ private _isSameOriginUrl;
291
+ private _markUnavailableProductContext;
292
+ private _clearUnavailableProductContext;
293
+ private _hasUnavailableProductContext;
294
+ private _ensureAssistantMessageRendered;
295
+ private _saveSessionAndOpenURL;
296
+ private _loadPayload;
297
+ /**
298
+ * Attempt to restore chat session from IndexedDB.
299
+ * Always restores when IDB has session data for the current sessionId.
300
+ * Best-effort — failures are silently ignored.
301
+ */
302
+ private _restoreFromIndexedDB;
303
+ /**
304
+ * Toggle comparison mode or individual SKU selection, then refresh the DOM.
305
+ * Extracted so both the render-context callback and DOM-created checkboxes
306
+ * share the same state-mutation + refresh path.
307
+ */
308
+ /**
309
+ * Panel back navigation: pop local drilldown history first (e.g. card→detail),
310
+ * then fall back to thread-level history.
311
+ */
312
+ private _navigatePanelBack;
313
+ private _toggleComparisonSku;
314
+ /**
315
+ * Refresh the panel DOM to reflect the current comparison state without
316
+ * full re-render. Updates: toggle button active class, checkbox overlays
317
+ * on product cards, and the floating comparison button.
318
+ */
319
+ private _refreshComparisonUI;
320
+ private _clearChoicePrompter;
321
+ private _mountChoicePrompter;
322
+ private _parseAddToCartActionPayload;
323
+ private _coerceAddToCartString;
324
+ private _runChatAddToCartFlow;
325
+ /**
326
+ * Build a ChatUISpecRenderContext with all callbacks wired up.
327
+ * Used both during streaming and during session restore.
328
+ */
329
+ private _buildRenderContext;
330
+ private _toggleFavorite;
331
+ /** Revert optimistic heart UI after a failed host favorite callback. */
332
+ private _revertFavoriteHeartUi;
333
+ /**
334
+ * Product-card favorite: dispatches window + bridge for the host, then runs `addCallback('gengage-product-favorite')`
335
+ * handlers when registered. If none are registered, falls back to IDB favorites + optional `like` backend action.
336
+ */
337
+ private _toggleProductFavorite;
338
+ private _openFavoritesPanel;
339
+ private _buildFavoritesPageEl;
340
+ private _isMessageHostedUISpec;
341
+ private _isPanelAiSpec;
342
+ private _rememberPanelAiSpec;
343
+ private _restorePanelAiSpecMap;
344
+ private _hydrateRestoredUISpecMetadata;
345
+ private _renderMessageUISpec;
346
+ private _maybeAddPanelRestoreMessage;
347
+ private _restorePanelFromFrontendMessage;
348
+ private _restorePanelAiZoneForThread;
349
+ /**
350
+ * Run registered callbacks for a GA4 event.
351
+ * If any callback returns false or throws, handle the failure (e.g. show error for cart-add).
352
+ */
353
+ private _runEventCallbacks;
354
+ /**
355
+ * Handle a callback failure — for add-to-cart, show an error message in chat.
356
+ */
357
+ private _handleCallbackFailure;
358
+ /**
359
+ * Re-render inline UISpec elements for a restored bot message.
360
+ * Inserts them into the messages container after the message bubble.
361
+ */
362
+ private _restoreInlineUISpec;
363
+ private _createMessage;
364
+ private _resolveI18n;
365
+ private _resolveUISpecRegistry;
366
+ private _renderUISpec;
367
+ }
368
+ export declare function createChatWidget(): GengageChat;
369
+ export type { ChatWidgetConfig, ChatMessage, ChatSession, ChatUIComponents, ChatI18n, ChatRendererConfig, ChatUISpecRenderContext, ChatUISpecRegistry, ProductSortState, SerializableChatMessage, } from './types.js';
370
+ export { renderUISpec, createDefaultChatUISpecRegistry, defaultChatUnknownUISpecRenderer, } from './components/renderUISpec.js';
371
+ export type { UISpecRenderContext } from './components/renderUISpec.js';
372
+ export { getChatScrollElement, invalidateChatScrollCache, CHAT_SCROLL_ELEMENT_ID, } from './utils/get-chat-scroll-element.js';
373
+ export { ChatPresentationState } from './chat-presentation-state.js';
374
+ export type { GroupReadState, PresentationGroupMeta, ScrollRequest } from './chat-presentation-state.js';
@@ -71,7 +71,7 @@ export interface ChatWidgetConfig extends BaseWidgetConfig {
71
71
  /**
72
72
  * Panel display mode:
73
73
  * - 'auto' : Panel appears/hides with content; user can toggle (default)
74
- * - 'collapsed' : Panel starts collapsed; user can expand
74
+ * - 'collapsed' : Panel starts collapsed; fresh panel content reopens it
75
75
  * - 'expanded' : Panel starts expanded (users can still collapse/expand)
76
76
  */
77
77
  panelMode?: 'auto' | 'collapsed' | 'expanded';
@@ -0,0 +1,303 @@
1
+ import { a as i, c as o, l as p, n as t, o as a, r as n, s as l, t as s, u as e } from "./schemas-CLo8wCjs.js";
2
+ var u = a({
3
+ role: s(["user", "assistant"]),
4
+ content: o(),
5
+ timestamp: i().optional()
6
+ }), h = a({
7
+ sku: o(),
8
+ name: o(),
9
+ imageUrl: o().url().optional(),
10
+ price: o().optional(),
11
+ originalPrice: o().optional(),
12
+ url: o().url(),
13
+ ctaLabel: o().optional()
14
+ }), m = a({ buttons: t(a({
15
+ label: o(),
16
+ action: a({
17
+ title: o(),
18
+ type: o(),
19
+ payload: e().optional()
20
+ })
21
+ })) }), g = a({}), v = a({ label: o().optional() }), c = a({
22
+ sku: o(),
23
+ name: o(),
24
+ price: o(),
25
+ imageUrl: o().optional(),
26
+ rating: i().optional(),
27
+ reviewCount: i().optional()
28
+ }), w = a({
29
+ recommended: c,
30
+ products: t(c),
31
+ attributes: t(a({
32
+ label: o(),
33
+ values: t(o())
34
+ })),
35
+ highlights: t(o()),
36
+ specialCases: t(o()).optional(),
37
+ recommendedText: o().optional(),
38
+ winnerHits: l(o(), a({
39
+ positive: t(o()).optional(),
40
+ negative: t(o()).optional()
41
+ })).optional(),
42
+ productActions: l(o(), a({
43
+ title: o(),
44
+ type: o(),
45
+ payload: e().optional()
46
+ })).optional()
47
+ }), b = a({
48
+ label: o(),
49
+ sentiment: s([
50
+ "positive",
51
+ "negative",
52
+ "neutral"
53
+ ]).optional()
54
+ }), y = a({
55
+ product: l(o(), e()),
56
+ role: o().optional(),
57
+ reason: o().optional(),
58
+ labels: t(b).optional(),
59
+ expertQualityScore: i().optional(),
60
+ reviewHighlight: o().optional(),
61
+ action: a({
62
+ title: o(),
63
+ type: o(),
64
+ payload: e().optional()
65
+ }).optional()
66
+ }), S = a({ suggestions: t(y) }), _ = a({
67
+ title: o().optional(),
68
+ text: o().optional(),
69
+ reviewCount: o().optional(),
70
+ action: a({
71
+ title: o(),
72
+ type: o(),
73
+ payload: e().optional()
74
+ })
75
+ }), C = a({ entries: t(a({
76
+ name: o(),
77
+ image: o().optional(),
78
+ description: o().optional(),
79
+ action: a({
80
+ title: o(),
81
+ type: o(),
82
+ payload: e().optional()
83
+ })
84
+ })) }), f = a({ entries: t(a({
85
+ shortName: o(),
86
+ detailedMessage: o().optional(),
87
+ whyDifferent: o().optional(),
88
+ image: o().optional(),
89
+ action: a({
90
+ title: o(),
91
+ type: o(),
92
+ payload: e().optional()
93
+ })
94
+ })) }), d = a({
95
+ title: o(),
96
+ type: o(),
97
+ payload: e().optional()
98
+ }), r = a({
99
+ name: o().optional(),
100
+ value: o().optional(),
101
+ option_value: o().optional(),
102
+ attribute_value: o().optional(),
103
+ type: o().optional(),
104
+ attribute: o().optional(),
105
+ option_name: o().optional(),
106
+ attribute_name: o().optional(),
107
+ variant_name: o().optional(),
108
+ sku: o().optional(),
109
+ price: p([i(), o()]).optional(),
110
+ price_discounted: p([i(), o()]).optional(),
111
+ image: o().optional(),
112
+ imageUrl: o().optional(),
113
+ image_url: o().optional(),
114
+ color: o().optional(),
115
+ colour: o().optional(),
116
+ color_hex: o().optional(),
117
+ hex: o().optional(),
118
+ swatch: o().optional(),
119
+ swatchColor: o().optional(),
120
+ in_stock: n().optional(),
121
+ inStock: n().optional()
122
+ }), A = a({
123
+ product: a({
124
+ sku: o().optional(),
125
+ name: o().optional(),
126
+ images: t(o()).optional(),
127
+ imageUrl: o().optional(),
128
+ rating: i().optional(),
129
+ reviewCount: i().optional(),
130
+ price: o().optional(),
131
+ originalPrice: o().optional(),
132
+ discountReason: o().optional(),
133
+ discount_reason: o().optional(),
134
+ campaignReason: o().optional(),
135
+ campaign_reason: o().optional(),
136
+ originalPriceStyle: s(["strikethrough", "inline"]).optional(),
137
+ price_original_style: s(["strikethrough", "inline"]).optional(),
138
+ price_discount_rate: i().optional(),
139
+ price_async: n().optional(),
140
+ inStock: n().optional(),
141
+ promotions: t(o()).optional(),
142
+ variants: t(r).optional(),
143
+ variantOptions: t(r).optional(),
144
+ variant_options: t(r).optional(),
145
+ productVariants: t(r).optional(),
146
+ product_variants: t(r).optional(),
147
+ url: o().optional(),
148
+ cartCode: o().optional(),
149
+ description: o().optional(),
150
+ description_html: o().optional(),
151
+ descriptionHtml: o().optional(),
152
+ facet_hits: l(o(), e()).optional(),
153
+ facetHits: l(o(), e()).optional(),
154
+ features: t(a({
155
+ name: o().optional(),
156
+ key: o().optional(),
157
+ label: o().optional(),
158
+ value: p([
159
+ o(),
160
+ i(),
161
+ n()
162
+ ]).optional()
163
+ })).optional(),
164
+ specifications: p([l(o(), o()), t(a({
165
+ key: o(),
166
+ value: o()
167
+ }))]).optional()
168
+ }).optional(),
169
+ action: d.optional()
170
+ }), P = a({
171
+ endOfList: n().optional(),
172
+ rankingState: s(["pending", "final"]).optional(),
173
+ sequenceId: o().optional()
174
+ }), k = a({
175
+ review_class: o().optional(),
176
+ review_text: o().optional(),
177
+ review_rating: p([o(), i()]).optional(),
178
+ review_tag: o().optional()
179
+ }), I = a({ reviews: t(k).optional() }), T = a({
180
+ productName: o().optional(),
181
+ pros: t(o()).optional(),
182
+ cons: t(o()).optional()
183
+ }), R = a({
184
+ groups: t(a({
185
+ groupName: o(),
186
+ image: o().optional(),
187
+ products: t(l(o(), e())).optional()
188
+ })).optional(),
189
+ filterTags: t(a({
190
+ title: o(),
191
+ action: d.optional()
192
+ })).optional()
193
+ }), x = a({
194
+ summary: o().optional(),
195
+ products_discussed: t(o()).optional(),
196
+ user_sentiment: o().optional()
197
+ }), H = a({
198
+ eyebrow: o().optional(),
199
+ title: o().optional(),
200
+ showTitle: n().optional(),
201
+ ctaLabel: o().optional(),
202
+ panelMessageId: o(),
203
+ highlightMessageId: o().optional(),
204
+ threadId: o().optional(),
205
+ products: t(a({
206
+ imageUrl: o().url().optional(),
207
+ name: o().optional()
208
+ })).optional()
209
+ }), B = a({
210
+ summary: o(),
211
+ strengths: t(o()).optional(),
212
+ focus_points: t(o()).optional(),
213
+ celeb_style: o().optional(),
214
+ celeb_style_reason: o().optional(),
215
+ next_question: o().optional(),
216
+ style_images: t(o()).optional()
217
+ }), G = a({
218
+ processing: n().optional(),
219
+ title: o().optional(),
220
+ description: o().optional(),
221
+ upload_label: o().optional(),
222
+ skip_label: o().optional()
223
+ }), D = { components: {
224
+ MessageBubble: {
225
+ schema: u,
226
+ description: "A single chat message bubble for user or assistant turns."
227
+ },
228
+ ProductCard: {
229
+ schema: h,
230
+ description: "A product card rendered inline in the chat stream."
231
+ },
232
+ ActionButtons: {
233
+ schema: m,
234
+ description: "A horizontal row of quick-reply action buttons."
235
+ },
236
+ TypingIndicator: {
237
+ schema: g,
238
+ description: "An animated indicator shown while the assistant is typing."
239
+ },
240
+ Divider: {
241
+ schema: v,
242
+ description: "A horizontal rule with an optional label."
243
+ },
244
+ ComparisonTable: {
245
+ schema: w,
246
+ description: "A product comparison table with recommended pick, attribute rows, and highlights."
247
+ },
248
+ AITopPicks: {
249
+ schema: S,
250
+ description: "Rich AI-curated product suggestion cards with roles, sentiment labels, scores, and review quotes."
251
+ },
252
+ GroundingReviewCard: {
253
+ schema: _,
254
+ description: "A card showing review grounding data with review count and CTA."
255
+ },
256
+ AIGroupingCards: {
257
+ schema: C,
258
+ description: "Category grouping cards with images and labels for product discovery."
259
+ },
260
+ AISuggestedSearchCards: {
261
+ schema: f,
262
+ description: "Suggested search cards with images, descriptions, and differentiation."
263
+ },
264
+ ProductDetailsPanel: {
265
+ schema: A,
266
+ description: "Full product detail view with images, specs, variants, and purchase actions."
267
+ },
268
+ ProductGrid: {
269
+ schema: P,
270
+ description: 'A scrollable grid of ProductCard children with optional "more" pagination.'
271
+ },
272
+ ReviewHighlights: {
273
+ schema: I,
274
+ description: "A list of highlighted customer reviews with sentiment and ratings."
275
+ },
276
+ ProsAndCons: {
277
+ schema: T,
278
+ description: "A pros and cons list for a product."
279
+ },
280
+ CategoriesContainer: {
281
+ schema: R,
282
+ description: "Tabbed product groups with optional filter tag buttons."
283
+ },
284
+ HandoffNotice: {
285
+ schema: x,
286
+ description: "A notice shown when the conversation is escalated to a human agent."
287
+ },
288
+ PanelRestoreCard: {
289
+ schema: H,
290
+ description: "A frontend-owned transcript card that reopens a related panel snapshot."
291
+ },
292
+ PhotoAnalysisCard: {
293
+ schema: B,
294
+ description: "Structured photo analysis card with strengths, focus points, celeb vibe, and follow-up question."
295
+ },
296
+ BeautyPhotoStep: {
297
+ schema: G,
298
+ description: "Transient selfie upload prompt for beauty consulting init flow."
299
+ }
300
+ } };
301
+ export {
302
+ D as t
303
+ };
@@ -0,0 +1,13 @@
1
+ import { a as e, c as t, i as r, l as s, n, o as i, r as l, s as C, t as c, u as h } from "./runtime-C0qZk0y7.js";
2
+ export {
3
+ t as CHAT_SCROLL_ELEMENT_ID,
4
+ r as ChatPresentationState,
5
+ c as GengageChat,
6
+ n as createChatWidget,
7
+ e as createDefaultChatUISpecRegistry,
8
+ i as defaultChatUnknownUISpecRenderer,
9
+ s as getChatScrollElement,
10
+ h as invalidateChatScrollCache,
11
+ l as isSimilarsAppendGrid,
12
+ C as renderUISpec
13
+ };