@gengage/assistant-fe 0.3.35 → 0.3.36

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 (32) hide show
  1. package/dist/chat/components/ChatDrawer.d.ts +17 -10
  2. package/dist/chat/components/ComparisonTable.d.ts +2 -1
  3. package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +10 -0
  4. package/dist/chat/index.d.ts +4 -1
  5. package/dist/chat/session-persistence.d.ts +2 -1
  6. package/dist/chat/types.d.ts +1 -0
  7. package/dist/{chat-BVxo08xS.js → chat-BJu5cvMq.js} +2042 -1981
  8. package/dist/chat.iife.js +39 -39
  9. package/dist/chat.js +11 -10
  10. package/dist/common/action-router.d.ts +1 -0
  11. package/dist/common/locale.d.ts +1 -0
  12. package/dist/common/navigation.d.ts +5 -0
  13. package/dist/{common-dxI9x9_U.js → common-C50zU8bu.js} +2 -2
  14. package/dist/common.js +41 -41
  15. package/dist/{connection-warning-CHHi3BAf.js → connection-warning-nm_yulO-.js} +9 -9
  16. package/dist/{ga-datalayer-BwxWX-cr.js → ga-datalayer-BUM5z5Pq.js} +65 -60
  17. package/dist/index.js +31 -31
  18. package/dist/{native-webview-CMsUMLah.js → native-webview-CrnoI_JS.js} +31 -31
  19. package/dist/native.iife.js +36 -36
  20. package/dist/native.js +1 -1
  21. package/dist/{product-utils-Bm3aiAlJ.js → price-formatter-CR6VT5z4.js} +27 -27
  22. package/dist/{qna-BuBvAr2H.js → qna-6_XrdLG_.js} +85 -85
  23. package/dist/qna.iife.js +6 -6
  24. package/dist/qna.js +1 -1
  25. package/dist/{schemas-DBRIy5NT.js → schemas-ZYhTx11k.js} +1 -1
  26. package/dist/{simbut-BBXTlzOg.js → simbut--wBhTxId.js} +29 -29
  27. package/dist/simbut.iife.js +7 -7
  28. package/dist/simbut.js +1 -1
  29. package/dist/{simrel-BRh5eB2K.js → simrel-5I3yDyyo.js} +65 -65
  30. package/dist/simrel.iife.js +5 -5
  31. package/dist/simrel.js +1 -1
  32. package/package.json +2 -2
@@ -73,6 +73,9 @@ export interface ChatDrawerOptions {
73
73
  onReleasePresentationFocus?: () => void;
74
74
  };
75
75
  }
76
+ type SetPanelContentOptions = {
77
+ preserveAiZone?: boolean;
78
+ };
76
79
  export declare class ChatDrawer {
77
80
  private root;
78
81
  private messagesEl;
@@ -116,8 +119,6 @@ export declare class ChatDrawer {
116
119
  private _voiceEnabled;
117
120
  private _voiceLang;
118
121
  private _ignoreNextDividerClick;
119
- /** Cancels in-flight panel list scroll-to-top tween when a new one starts. */
120
- private _panelListScrollAnimToken;
121
122
  private readonly _cleanups;
122
123
  private _focusTrapHandler;
123
124
  private _previouslyFocusedElement;
@@ -216,12 +217,20 @@ export declare class ChatDrawer {
216
217
  resultEl?: HTMLElement;
217
218
  analyzingLabel?: string;
218
219
  }): void;
220
+ private _clearPanelAiZoneState;
219
221
  private _resetPanelAiZoneElement;
220
222
  private _emitHostShellSync;
221
223
  private _syncPanelTopBarFromContent;
222
224
  private _syncPanelTopBarTitleFromContent;
223
225
  /** Replace panel content and show the panel. */
224
- setPanelContent(el: HTMLElement): void;
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
+ * thumbnails column / floating element attached. Also resets topbar actions
231
+ * because the incoming content provides its own toolbar.
232
+ */
233
+ private _swapPanelContent;
225
234
  /** Append content to the panel without replacing existing content. */
226
235
  appendPanelContent(el: HTMLElement): void;
227
236
  /** Return the panel element's content child (after topbar), or null. */
@@ -265,9 +274,9 @@ export declare class ChatDrawer {
265
274
  */
266
275
  setForceExpanded(): void;
267
276
  /**
268
- * After new list/grid content is mounted, scroll the left panel toward the top smoothly.
269
- * InnerHTML resets scrollTop to 0, so we nudge down first; a rAF tween (ease-out quint) replaces
270
- * native smooth scroll for a softer deceleration.
277
+ * Reset the left panel scroll to the top after new list/grid content is mounted.
278
+ * innerHTML assignment already resets scrollTop to 0; this is a defensive pin in
279
+ * case subsequent DOM mutations (appended children, layout) shift it.
271
280
  */
272
281
  private _smoothScrollPanelListToTop;
273
282
  /** Update scroll affordance (bottom fade gradient) on the panel. */
@@ -312,10 +321,8 @@ export declare class ChatDrawer {
312
321
  markFirstBotMessage(messageId: string): void;
313
322
  /** Scroll to the first message of the last thread (for restore targeting). */
314
323
  scrollToLastThread(): void;
315
- /**
316
- * Smooth scroll transcript so the given thread’s first bubble is near the top.
317
- * Used by centralized presentation scroll requests.
318
- */
324
+ /** Scroll transcript so the thread’s first visible element sits near the top; skips
325
+ * empty/zero-height bubbles (silent or not-yet-streamed) so real content anchors instead. */
319
326
  scrollThreadIntoView(threadId: string, behavior?: ScrollBehavior): boolean;
320
327
  /** Programmatic scroll to bottom (e.g. host bridge) — bypasses “user scrolled up” until next frame. */
321
328
  scrollToBottomPresentation(behavior?: ScrollBehavior): void;
@@ -4,7 +4,7 @@ import { PriceFormatConfig } from '../../common/price-formatter.js';
4
4
  * Checks locale-specific `criteriaLabels` first (from i18n), then the
5
5
  * built-in fallback map, then applies a formatting heuristic.
6
6
  */
7
- export declare function formatCriteriaName(rawName: string, criteriaLabels?: Record<string, string>): string;
7
+ export declare function formatCriteriaName(rawName: string, criteriaLabels?: Record<string, string>, locale?: string): string;
8
8
  export interface ComparisonProduct {
9
9
  sku: string;
10
10
  name: string;
@@ -50,6 +50,7 @@ export interface ComparisonTableOptions {
50
50
  payload?: unknown;
51
51
  }> | undefined;
52
52
  keyDifferencesHtml?: string | undefined;
53
+ locale?: string | undefined;
53
54
  i18n?: ComparisonTableI18n | undefined;
54
55
  pricing?: PriceFormatConfig | undefined;
55
56
  }
@@ -16,3 +16,13 @@ export declare function detectConsultingGrid(element: UIElement): ConsultingGrid
16
16
  * Call only when `detectConsultingGrid` returned `isConsulting: true`.
17
17
  */
18
18
  export declare function renderConsultingGrid(wrapper: HTMLElement, grid: HTMLElement, detected: ConsultingGridResult, ctx?: ChatUISpecRenderContext): void;
19
+ /**
20
+ * Whether every variation in a consulting grid has completed (not `loading`).
21
+ *
22
+ * Backend may stream a consulting ProductGrid twice in one response: once
23
+ * with some variations still `loading`, then again with everything `ready`.
24
+ * The panel renderer uses this to skip the partial render and avoid a
25
+ * skeleton→partial→final flash; the skeleton stays visible until every
26
+ * variation is ready (or the stream ends with the partial spec as fallback).
27
+ */
28
+ export declare function isConsultingGridReady(detected: ConsultingGridResult): boolean;
@@ -1,4 +1,4 @@
1
- import { ActionPayload, PageContext } from '../common/types.js';
1
+ import { ActionPayload, PageContext, UIElement } from '../common/types.js';
2
2
  import { BaseWidget } from '../common/widget-base.js';
3
3
  import { ChatWidgetConfig } from './types.js';
4
4
  import { AssistantMode } from './assistant-mode.js';
@@ -18,6 +18,7 @@ import { AssistantMode } from './assistant-mode.js';
18
18
  * chat.open(); // Programmatically open the drawer
19
19
  * ```
20
20
  */
21
+ export declare function isSimilarsAppendGrid(element: UIElement | undefined): boolean;
21
22
  export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
22
23
  private static readonly _MAX_COMPARISON_SELECTION;
23
24
  private _shadow;
@@ -169,6 +170,8 @@ export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
169
170
  private _clearAssistantPanelLikeStreamClearPanel;
170
171
  private _flushPresentationScroll;
171
172
  private _focusPresentationThread;
173
+ /** Align inline UISpec render so the thread’s first visible node stays at the top. */
174
+ private _scrollInlineIntoView;
172
175
  private _releasePresentationFocus;
173
176
  private _hasMultipleThreadIds;
174
177
  private _orderedThreadIds;
@@ -4,6 +4,7 @@ import { BackendContext, UISpec } from '../common/types.js';
4
4
  import { ChatMessage } from './types.js';
5
5
  import { ThumbnailEntry } from './components/ThumbnailsColumn.js';
6
6
  export type { FavoriteData };
7
+ type NavigateFn = (url: string) => void;
7
8
  export interface PersistSessionParams {
8
9
  userId: string;
9
10
  appId: string;
@@ -44,7 +45,7 @@ export declare class SessionPersistence {
44
45
  * after posting saveSessionAndOpenURL to the iframe. The clean-room runs in
45
46
  * the same window (Shadow DOM, not iframe), so it navigates directly.
46
47
  */
47
- saveAndOpenURL(url: string, persistFn: () => Promise<void>, bridge: CommunicationBridge | null): Promise<void>;
48
+ saveAndOpenURL(url: string, persistFn: () => Promise<void>, bridge: CommunicationBridge | null, navigate?: NavigateFn): Promise<void>;
48
49
  /**
49
50
  * Load a UISpec payload from IndexedDB with retry logic.
50
51
  * Returns null if not found or all retries fail.
@@ -329,6 +329,7 @@ export interface ProductPriceUiConfig {
329
329
  campaignBadgeLogoUrl?: string;
330
330
  }
331
331
  export interface ChatUISpecRenderContext {
332
+ locale?: string | undefined;
332
333
  onAction: (action: ActionPayload) => void;
333
334
  onProductClick?: (params: {
334
335
  sku: string;