@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.
- package/dist/agentic/adaptor/create-adaptor.d.ts +19 -0
- package/dist/agentic/adaptor/fetch-bridge.d.ts +11 -0
- package/dist/agentic/adaptor/mount.d.ts +38 -0
- package/dist/agentic/context/chat-context.d.ts +15 -0
- package/dist/agentic/context/context-store.d.ts +20 -0
- package/dist/agentic/context/persistence.d.ts +12 -0
- package/dist/agentic/events/builders.d.ts +10 -0
- package/dist/agentic/events/error-taxonomy.d.ts +27 -0
- package/dist/agentic/events/product-normalize.d.ts +47 -0
- package/dist/agentic/events/ui-specs.d.ts +37 -0
- package/dist/agentic/flow/beauty-consulting-turn.d.ts +1 -0
- package/dist/agentic/flow/create-flow.d.ts +2 -0
- package/dist/agentic/flow/dispatch.d.ts +3 -0
- package/dist/agentic/index.d.ts +18 -0
- package/dist/agentic/index.js +620 -0
- package/dist/agentic/types.d.ts +212 -0
- package/dist/agentic/util/assistant-host.d.ts +11 -0
- package/dist/agentic/util/be-url.d.ts +4 -0
- package/dist/agentic/util/browser-memory.d.ts +13 -0
- package/dist/agentic/util/browser-tools.d.ts +31 -0
- package/dist/agentic/util/lazy-runtime-loader.d.ts +9 -0
- package/dist/agentic/util/request-text.d.ts +3 -0
- package/dist/agentic/util/time.d.ts +2 -0
- package/dist/agentic/worker/be-client.d.ts +15 -0
- package/dist/agentic/worker/entry.d.ts +2 -0
- package/dist/agentic/worker/flow-runner.d.ts +24 -0
- package/dist/agentic/worker/jwt-mint.d.ts +21 -0
- package/dist/agentic/worker/rpc.d.ts +24 -0
- package/dist/agentic/worker/tool-bridge.d.ts +2 -0
- package/dist/agentic/worker.d.ts +16 -0
- package/dist/agentic/worker.js +119 -0
- package/dist/agentic.iife.js +5 -0
- package/dist/{api-paths-CwzwbgQZ.js → api-paths-DJFF9RuZ.js} +1 -1
- package/dist/beauty-consulting-turn-BmPXbkQg.js +1019 -0
- package/dist/chat/api.d.ts +17 -0
- package/dist/chat/assistant-mode.d.ts +20 -0
- package/dist/chat/attachment-utils.d.ts +9 -0
- package/dist/chat/catalog.d.ts +455 -0
- package/dist/chat/chat-presentation-state.d.ts +53 -0
- package/dist/chat/components/AIGroupingCards.d.ts +15 -0
- package/dist/chat/components/AISuggestedSearchCards.d.ts +13 -0
- package/dist/chat/components/AITopPicks.d.ts +9 -0
- package/dist/chat/components/BeautyPhotoStep.d.ts +31 -0
- package/dist/chat/components/CategoriesContainer.d.ts +11 -0
- package/dist/chat/components/ChatDrawer.d.ts +362 -0
- package/dist/chat/components/ChoicePrompter.d.ts +21 -0
- package/dist/chat/components/ComparisonTable.d.ts +66 -0
- package/dist/chat/components/ConsultingStylePicker.d.ts +40 -0
- package/dist/chat/components/FloatingComparisonButton.d.ts +7 -0
- package/dist/chat/components/FloatingLauncher.d.ts +79 -0
- package/dist/chat/components/GroundingReviewCard.d.ts +11 -0
- package/dist/chat/components/HandoffNotice.d.ts +9 -0
- package/dist/chat/components/KvkkBanner.d.ts +6 -0
- package/dist/chat/components/Launcher.d.ts +28 -0
- package/dist/chat/components/PanelRestoreCard.d.ts +4 -0
- package/dist/chat/components/PanelTopBar.d.ts +32 -0
- package/dist/chat/components/PhotoAnalysisCard.d.ts +27 -0
- package/dist/chat/components/ProductSummaryCard.d.ts +12 -0
- package/dist/chat/components/ProsAndCons.d.ts +8 -0
- package/dist/chat/components/ReviewHighlights.d.ts +16 -0
- package/dist/chat/components/actionClassifier.d.ts +12 -0
- package/dist/chat/components/product-price-layout.d.ts +17 -0
- package/dist/chat/components/productMentionLinker.d.ts +26 -0
- package/dist/chat/components/renderUISpec.d.ts +15 -0
- package/dist/chat/components/typewriter.d.ts +24 -0
- package/dist/chat/extendedModeManager.d.ts +32 -0
- package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +38 -0
- package/dist/chat/features/beauty-consulting/drawer-extensions.d.ts +22 -0
- package/dist/chat/features/beauty-consulting/mode-controller.d.ts +59 -0
- package/dist/chat/features/beauty-consulting/registry.d.ts +9 -0
- package/dist/chat/features/beauty-consulting/stream-handler.d.ts +45 -0
- package/dist/chat/history-storage.d.ts +85 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/kvkk.d.ts +20 -0
- package/dist/chat/locales/en.d.ts +2 -0
- package/dist/chat/locales/index.d.ts +5 -0
- package/dist/chat/locales/tr.d.ts +2 -0
- package/dist/chat/panel-manager.d.ts +142 -0
- package/dist/chat/runtime.d.ts +416 -0
- package/dist/chat/session-persistence.d.ts +73 -0
- package/dist/chat/stream-error-display.d.ts +6 -0
- package/dist/chat/types.d.ts +547 -0
- package/dist/chat/utils/chat-presentation-debug.d.ts +18 -0
- package/dist/chat/utils/get-chat-scroll-element.d.ts +10 -0
- package/dist/chat/utils/ui.d.ts +10 -0
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +12 -12
- package/dist/chat.js +1 -1
- package/dist/common/action-router.d.ts +26 -0
- package/dist/common/api-paths.d.ts +23 -0
- package/dist/common/client.d.ts +27 -0
- package/dist/common/communication-bridge.d.ts +51 -0
- package/dist/common/config-constants.d.ts +1 -0
- package/dist/common/config-schema.d.ts +54 -0
- package/dist/common/connection-warning.d.ts +8 -0
- package/dist/common/consulting-sources.d.ts +8 -0
- package/dist/common/context.d.ts +64 -0
- package/dist/common/css-escape.d.ts +1 -0
- package/dist/common/customization-factories.d.ts +59 -0
- package/dist/common/debug.d.ts +13 -0
- package/dist/common/events.d.ts +55 -0
- package/dist/common/fastIntent.d.ts +1 -0
- package/dist/common/find-similar-payload.d.ts +3 -0
- package/dist/common/ga-datalayer.d.ts +80 -0
- package/dist/common/global-error-toast.d.ts +6 -0
- package/dist/common/index.d.ts +47 -0
- package/dist/common/indexed-db.d.ts +89 -0
- package/dist/common/locale.d.ts +1 -0
- package/dist/common/native-webview.d.ts +60 -0
- package/dist/common/navigation.d.ts +1 -0
- package/dist/common/overlay.d.ts +172 -0
- package/dist/common/page-detect.d.ts +36 -0
- package/dist/common/pill-launcher.d.ts +51 -0
- package/dist/common/preflight.d.ts +13 -0
- package/dist/common/price-formatter.d.ts +35 -0
- package/dist/common/product-utils.d.ts +35 -0
- package/dist/common/protocol-adapter.d.ts +108 -0
- package/dist/common/renderer/dom.d.ts +3 -0
- package/dist/common/renderer/index.d.ts +4 -0
- package/dist/common/renderer/overrides.d.ts +23 -0
- package/dist/common/renderer/registry.d.ts +2 -0
- package/dist/common/renderer/types.d.ts +19 -0
- package/dist/common/safe-html.d.ts +22 -0
- package/dist/common/sdk-version.d.ts +3 -0
- package/dist/common/streaming.d.ts +52 -0
- package/dist/common/suggested-search-keywords.d.ts +18 -0
- package/dist/common/theme-utils.d.ts +15 -0
- package/dist/common/transport.d.ts +75 -0
- package/dist/common/tts-player.d.ts +13 -0
- package/dist/common/types.d.ts +379 -0
- package/dist/common/ui-theme.d.ts +9 -0
- package/dist/common/uuidv7.d.ts +7 -0
- package/dist/common/voice-input.d.ts +74 -0
- package/dist/common/widget-base.d.ts +82 -0
- package/dist/{common-KpJP1YwP.js → common-BydCGBNn.js} +90 -139
- package/dist/common.js +41 -41
- package/dist/{connection-warning-B5T_1oBn.js → connection-warning-Pbvk3J8k.js} +1 -1
- package/dist/{fastIntent--Ukm2nOh.js → fastIntent-CkYN2UOl.js} +199 -137
- package/dist/index.d.ts +25 -0
- package/dist/index.js +50 -50
- package/dist/native/index.d.ts +2 -0
- package/dist/{native-webview-qfjm4SHx.js → native-webview-JDC1vtde.js} +1 -1
- package/dist/native.iife.js +14 -14
- package/dist/native.js +1 -1
- package/dist/{overlay-CP5A0Hhf.js → overlay-BetAvpVZ.js} +19 -19
- package/dist/overlay.d.ts +4 -0
- package/dist/overlay.js +1 -1
- package/dist/qna/api.d.ts +23 -0
- package/dist/qna/catalog.d.ts +60 -0
- package/dist/qna/components/ButtonRow.d.ts +15 -0
- package/dist/qna/components/TextInput.d.ts +11 -0
- package/dist/qna/components/renderUISpec.d.ts +7 -0
- package/dist/qna/index.d.ts +3 -0
- package/dist/qna/locales/en.d.ts +2 -0
- package/dist/qna/locales/index.d.ts +4 -0
- package/dist/qna/locales/tr.d.ts +2 -0
- package/dist/qna/normalize-ui-specs.d.ts +15 -0
- package/dist/qna/runtime.d.ts +73 -0
- package/dist/qna/types.d.ts +98 -0
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{runtime-BPyXOyyp.js → runtime-DbZO1qG5.js} +3 -3
- package/dist/{runtime-G3idwfkM.js → runtime-OpNoB3cu.js} +894 -853
- package/dist/{runtime-C3yOvNFK.js → runtime-iCLkUjI3.js} +3 -3
- package/dist/simbut/index.d.ts +31 -0
- package/dist/simbut/locales.d.ts +3 -0
- package/dist/simbut/types.d.ts +43 -0
- package/dist/{simbut-CiknJI6-.js → simbut-FyXolmZY.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/simrel/api.d.ts +25 -0
- package/dist/simrel/catalog.d.ts +77 -0
- package/dist/simrel/components/GroupTabs.d.ts +24 -0
- package/dist/simrel/components/ProductCard.d.ts +19 -0
- package/dist/simrel/components/ProductGrid.d.ts +17 -0
- package/dist/simrel/components/renderUISpec.d.ts +7 -0
- package/dist/simrel/index.d.ts +5 -0
- package/dist/simrel/locales/en.d.ts +2 -0
- package/dist/simrel/locales/index.d.ts +4 -0
- package/dist/simrel/locales/tr.d.ts +2 -0
- package/dist/simrel/renderers/default.d.ts +41 -0
- package/dist/simrel/runtime.d.ts +68 -0
- package/dist/simrel/types.d.ts +145 -0
- package/dist/{simrel-C1YN71aW.js → simrel-CbLe5OAr.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-UmvgIqDk.js → widget-base-COP8QwU3.js} +1 -1
- package/package.json +20 -6
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured photo analysis card — rendered inline in the chat message stream.
|
|
3
|
+
*
|
|
4
|
+
* The backend sends a `PhotoAnalysisCard` UISpec with skin/beauty analysis
|
|
5
|
+
* findings. This component renders them as a visually distinct card so the
|
|
6
|
+
* user can scan the highlights quickly.
|
|
7
|
+
*/
|
|
8
|
+
import type { UIElement } from '../../common/types.js';
|
|
9
|
+
import type { ChatUISpecRenderContext } from '../types.js';
|
|
10
|
+
export interface PhotoAnalysisData {
|
|
11
|
+
summary: string;
|
|
12
|
+
strengths?: string[];
|
|
13
|
+
focusPoints?: string[];
|
|
14
|
+
celebStyle?: string;
|
|
15
|
+
celebStyleReason?: string;
|
|
16
|
+
nextQuestion?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Extract structured photo-analysis data from a UISpec element's props. */
|
|
19
|
+
export declare function parsePhotoAnalysisProps(props: Record<string, unknown>): PhotoAnalysisData | null;
|
|
20
|
+
export declare function renderPhotoAnalysisCard(element: UIElement, ctx: ChatUISpecRenderContext): HTMLElement;
|
|
21
|
+
/** Renders the structured PhotoAnalysisCard data captured from the UISpec. */
|
|
22
|
+
export declare function renderPhotoAnalysisBubble(container: HTMLElement, labels: {
|
|
23
|
+
badge: string;
|
|
24
|
+
strengths: string;
|
|
25
|
+
focus: string;
|
|
26
|
+
celebStyle: string;
|
|
27
|
+
}, structured?: PhotoAnalysisData): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact horizontal product card for inline chat-pane rendering.
|
|
3
|
+
*
|
|
4
|
+
* Production parity: mirrors the prior engine's `LaunchSingleProduct` component.
|
|
5
|
+
* Renders when `productDetails` arrives — the full ProductDetailsPanel goes
|
|
6
|
+
* to the left panel while this compact summary appears inline in chat messages.
|
|
7
|
+
*
|
|
8
|
+
* Layout: [image 64×64] [name · rating · price] [View link]
|
|
9
|
+
*/
|
|
10
|
+
import type { UIElement } from '../../common/types.js';
|
|
11
|
+
import type { ChatUISpecRenderContext } from '../types.js';
|
|
12
|
+
export declare function renderProductSummaryCard(element: UIElement, ctx: ChatUISpecRenderContext): HTMLElement;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReviewHighlights — subject-first review intelligence panel.
|
|
3
|
+
*
|
|
4
|
+
* Subjects are neutral topics (e.g., "Build quality").
|
|
5
|
+
* Sentiment is represented by per-subject positive/negative mention counts.
|
|
6
|
+
* Clicking a subject shows short snippets, not full review bodies.
|
|
7
|
+
*/
|
|
8
|
+
import type { UIElement } from '../../common/types.js';
|
|
9
|
+
export declare function renderReviewHighlights(element: UIElement, options?: {
|
|
10
|
+
emptyReviewsMessage?: string | undefined;
|
|
11
|
+
reviewFilterPositive?: string | undefined;
|
|
12
|
+
reviewFilterNegative?: string | undefined;
|
|
13
|
+
reviewCustomersMentionSingular?: string | undefined;
|
|
14
|
+
reviewCustomersMentionPlural?: string | undefined;
|
|
15
|
+
reviewSubjectsHeading?: string | undefined;
|
|
16
|
+
}): HTMLElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classifies suggested actions into input-area chips vs message-flow pills.
|
|
3
|
+
*
|
|
4
|
+
* Input-area chips: compact shortcuts above the input field (search, info, review, similar).
|
|
5
|
+
* Message-flow pills: larger interactive cards in the suggestion row.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isInputAreaAction(btn: {
|
|
8
|
+
icon?: string;
|
|
9
|
+
action?: {
|
|
10
|
+
type?: string;
|
|
11
|
+
};
|
|
12
|
+
}): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ChatUISpecRenderContext, ProductPriceOriginalStyle } from '../types.js';
|
|
2
|
+
export declare function campaignReasonForDisplay(ctx: ChatUISpecRenderContext, product: Record<string, unknown> | undefined): string | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Per-product `originalPriceStyle` / `price_original_style` override config.
|
|
5
|
+
* Default `strikethrough`; `inline` uses a separator row without a strike line.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveOriginalPriceStyle(ctx: ChatUISpecRenderContext, product: Record<string, unknown> | undefined): ProductPriceOriginalStyle;
|
|
8
|
+
export declare function createCampaignReasonElement(text: string): HTMLDivElement;
|
|
9
|
+
export declare function resolveCampaignBadgeLogoUrl(ctx: ChatUISpecRenderContext, product: Record<string, unknown> | undefined): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Single bordered badge: optional logo, campaign line (body text), sale price — gradient border, transparent fill.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createCampaignPriceBadge(options: {
|
|
14
|
+
reasonText: string;
|
|
15
|
+
salePriceFormatted: string;
|
|
16
|
+
logoUrl?: string;
|
|
17
|
+
}): HTMLElement;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product mention linker.
|
|
3
|
+
*
|
|
4
|
+
* After sanitiseHtml() renders bot text, this module walks text nodes and
|
|
5
|
+
* wraps product name occurrences with clickable links that dispatch a
|
|
6
|
+
* `launchSingleProduct` action.
|
|
7
|
+
*
|
|
8
|
+
* XSS safety: Uses DOM text-node manipulation only — no innerHTML.
|
|
9
|
+
*/
|
|
10
|
+
interface ProductMention {
|
|
11
|
+
sku: string;
|
|
12
|
+
short_name: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ProductMentionLinkerOptions {
|
|
15
|
+
container: HTMLElement;
|
|
16
|
+
mentions: ProductMention[];
|
|
17
|
+
onProductClick: (sku: string) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Walk text nodes in `container` and wrap occurrences of each mention's
|
|
21
|
+
* `short_name` with a clickable `<a>` element.
|
|
22
|
+
*
|
|
23
|
+
* Only the first occurrence of each mention is linked to avoid visual clutter.
|
|
24
|
+
*/
|
|
25
|
+
export declare function linkProductMentions(options: ProductMentionLinkerOptions): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders a json-render UISpec into DOM elements.
|
|
3
|
+
*
|
|
4
|
+
* XSS safety: All text is set via textContent. URLs are validated for safe protocols.
|
|
5
|
+
* No innerHTML is used anywhere in this module.
|
|
6
|
+
*/
|
|
7
|
+
import type { UISpec, UIElement } from '../../common/types.js';
|
|
8
|
+
import type { UISpecDomRegistry, UISpecDomUnknownRenderer } from '../../common/renderer/index.js';
|
|
9
|
+
import type { ChatUISpecRenderContext } from '../types.js';
|
|
10
|
+
export type UISpecRenderContext = ChatUISpecRenderContext;
|
|
11
|
+
export type ChatUISpecRegistry = UISpecDomRegistry<UISpecRenderContext>;
|
|
12
|
+
export declare const defaultChatUnknownUISpecRenderer: UISpecDomUnknownRenderer<UISpecRenderContext>;
|
|
13
|
+
export declare function createDefaultChatUISpecRegistry(): ChatUISpecRegistry;
|
|
14
|
+
export declare function renderUISpec(spec: UISpec, ctx: UISpecRenderContext, registry?: ChatUISpecRegistry, unknownRenderer?: UISpecDomUnknownRenderer<UISpecRenderContext>): HTMLElement;
|
|
15
|
+
export declare function renderProductCard(element: UIElement, ctx: UISpecRenderContext): HTMLElement;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block-by-block HTML typewriter effect.
|
|
3
|
+
*
|
|
4
|
+
* Parses sanitised HTML into top-level blocks and reveals them one at a time
|
|
5
|
+
* with a configurable stagger delay. Respects prefers-reduced-motion.
|
|
6
|
+
*/
|
|
7
|
+
export interface TypewriterOptions {
|
|
8
|
+
container: HTMLElement;
|
|
9
|
+
html: string;
|
|
10
|
+
/** Delay in ms between block reveals (default: 30). */
|
|
11
|
+
delayMs?: number;
|
|
12
|
+
/** Called after each block is revealed — useful for scroll tracking. */
|
|
13
|
+
onTick?: () => void;
|
|
14
|
+
/** Called when all blocks have been revealed. */
|
|
15
|
+
onComplete?: () => void;
|
|
16
|
+
}
|
|
17
|
+
export interface TypewriterHandle {
|
|
18
|
+
/** Skip animation and show all content immediately. */
|
|
19
|
+
complete(): void;
|
|
20
|
+
/** Cancel animation, leave content as-is. */
|
|
21
|
+
cancel(): void;
|
|
22
|
+
readonly isRunning: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function typewriteHtml(options: TypewriterOptions): TypewriterHandle;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extended Mode Manager — production lock-count system for panel extension.
|
|
3
|
+
*
|
|
4
|
+
* Controls whether the host page PDP area should be maximized or minimized
|
|
5
|
+
* based on a combination of conditions: lock count, user visibility preference,
|
|
6
|
+
* favorites mode, panel content type, and chat visibility.
|
|
7
|
+
*/
|
|
8
|
+
export type PanelContentType = 'comparisonTable' | 'groupList' | 'productDetails' | 'productDetailsSimilars' | 'productList';
|
|
9
|
+
export interface ExtendedModeManagerOptions {
|
|
10
|
+
onChange: (extended: boolean) => void;
|
|
11
|
+
/** Whether `productDetails` should trigger panel extension (default: false, true for demo sites). */
|
|
12
|
+
productDetailsInPanel?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class ExtendedModeManager {
|
|
15
|
+
private _lockCount;
|
|
16
|
+
private _hiddenByUser;
|
|
17
|
+
private _lastPanelContentType;
|
|
18
|
+
private _chatShown;
|
|
19
|
+
private _isFavoritesMode;
|
|
20
|
+
private _lastExtended;
|
|
21
|
+
private _onChange;
|
|
22
|
+
private _panelContentTypes;
|
|
23
|
+
constructor(options: ExtendedModeManagerOptions);
|
|
24
|
+
get isExtended(): boolean;
|
|
25
|
+
unlock(): void;
|
|
26
|
+
lock(): void;
|
|
27
|
+
setHiddenByUser(hidden: boolean): void;
|
|
28
|
+
setChatShown(shown: boolean): void;
|
|
29
|
+
setFavoritesMode(fav: boolean): void;
|
|
30
|
+
setPanelContentType(type: PanelContentType | null): void;
|
|
31
|
+
private _checkStateChange;
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consulting-aware ProductGrid helper — determines whether a ProductGrid
|
|
3
|
+
* should render as a consulting style picker instead of a standard grid.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from renderProductGrid() in renderUISpec.ts so the generic
|
|
6
|
+
* grid renderer doesn't contain mode-specific branching inline.
|
|
7
|
+
*/
|
|
8
|
+
import type { UIElement } from '../../../common/types.js';
|
|
9
|
+
import type { ChatUISpecRenderContext } from '../../types.js';
|
|
10
|
+
import type { StyleVariation } from '../../components/ConsultingStylePicker.js';
|
|
11
|
+
export interface ConsultingGridResult {
|
|
12
|
+
isConsulting: boolean;
|
|
13
|
+
source: string | undefined;
|
|
14
|
+
styleVariations: StyleVariation[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Check whether a ProductGrid element should render as a consulting style picker.
|
|
18
|
+
* Returns the check result plus pre-parsed data for {@link renderConsultingGrid}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectConsultingGrid(element: UIElement): ConsultingGridResult;
|
|
21
|
+
/**
|
|
22
|
+
* Render a consulting style picker into the ProductGrid wrapper.
|
|
23
|
+
* Call only when `detectConsultingGrid` returned `isConsulting: true`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderConsultingGrid(wrapper: HTMLElement, grid: HTMLElement, detected: ConsultingGridResult, ctx?: ChatUISpecRenderContext): void;
|
|
26
|
+
/**
|
|
27
|
+
* Whether at least one variation is not actively `loading`, so the panel can
|
|
28
|
+
* paint the first ready style immediately (fast-first). Remaining `loading`
|
|
29
|
+
* tabs stream in and update in place via {@link patchConsultingGridDom} without
|
|
30
|
+
* replacing the whole panel.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isConsultingGridReady(detected: ConsultingGridResult): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Apply a streaming consulting ProductGrid update to the visible panel without
|
|
35
|
+
* `setPanelContent` (avoids full DOM swap / blink). Returns false if the
|
|
36
|
+
* panel is not currently showing a consulting picker.
|
|
37
|
+
*/
|
|
38
|
+
export declare function patchConsultingGridDom(wrapper: HTMLElement, detected: ConsultingGridResult, ctx?: ChatUISpecRenderContext): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beauty consulting drawer extensions — DOM helpers for beauty-specific
|
|
3
|
+
* elements in the chat drawer.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from ChatDrawer so the 2,700-line drawer file doesn't grow
|
|
6
|
+
* with each new consulting mode.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChatI18n } from '../../types.js';
|
|
9
|
+
export interface BeautyPhotoStepCardOptions {
|
|
10
|
+
visible: boolean;
|
|
11
|
+
processing?: boolean;
|
|
12
|
+
onSkip?: (() => void) | undefined;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
description?: string | undefined;
|
|
15
|
+
uploadLabel?: string | undefined;
|
|
16
|
+
skipLabel?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Show or hide the beauty photo step card.
|
|
20
|
+
* Returns the slot element (possibly newly created).
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyBeautyPhotoStepCard(slotEl: HTMLElement | null, conversationEl: HTMLElement | null, options: BeautyPhotoStepCardOptions, i18n: ChatI18n, openAttachmentPicker: () => void): HTMLElement | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assistant mode controller — encapsulates mode state and UI hints.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from GengageChat (index.ts) so the 3,900-line widget file
|
|
5
|
+
* stays focused on stream orchestration and drawer coordination.
|
|
6
|
+
*/
|
|
7
|
+
import type { AssistantMode } from '../../assistant-mode.js';
|
|
8
|
+
/**
|
|
9
|
+
* Minimal drawer interface consumed by the mode controller.
|
|
10
|
+
* Keeps the controller decoupled from ChatDrawer internals.
|
|
11
|
+
*/
|
|
12
|
+
export interface ModeDrawerAdapter {
|
|
13
|
+
setAttachmentControlsVisible(visible: boolean): void;
|
|
14
|
+
setInputPlaceholder(text: string): void;
|
|
15
|
+
setBeautyPhotoStepCard(options: {
|
|
16
|
+
visible: boolean;
|
|
17
|
+
}): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class AssistantModeController {
|
|
20
|
+
private _mode;
|
|
21
|
+
private _uiHints;
|
|
22
|
+
get mode(): AssistantMode;
|
|
23
|
+
set mode(value: AssistantMode);
|
|
24
|
+
get uiHints(): Record<string, unknown> | null;
|
|
25
|
+
set uiHints(value: Record<string, unknown> | null);
|
|
26
|
+
get isShopping(): boolean;
|
|
27
|
+
get isBeautyConsulting(): boolean;
|
|
28
|
+
/** Whether choice prompter is hidden by backend ui_hints. */
|
|
29
|
+
get isChoicePrompterHidden(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Apply backend ui_hints to the drawer.
|
|
32
|
+
*
|
|
33
|
+
* @param drawer Drawer adapter (null when drawer not yet created).
|
|
34
|
+
* @param defaultPlaceholder Default input placeholder for shopping mode.
|
|
35
|
+
* @param removePersistentChoicePrompter Callback to remove persistent choice prompter from Shadow DOM.
|
|
36
|
+
*/
|
|
37
|
+
applyUiHints(drawer: ModeDrawerAdapter | null, defaultPlaceholder: string, removePersistentChoicePrompter?: () => void): void;
|
|
38
|
+
/**
|
|
39
|
+
* Handle redirect metadata from a backend metadata event.
|
|
40
|
+
* Returns true if the mode actually switched.
|
|
41
|
+
*/
|
|
42
|
+
handleRedirect(redirectPayload: unknown): boolean;
|
|
43
|
+
/** Switch to a new assistant mode. */
|
|
44
|
+
switchMode(mode: AssistantMode): void;
|
|
45
|
+
/**
|
|
46
|
+
* Derive mode and ui_hints from a backend CONTEXT panel payload.
|
|
47
|
+
* Missing `assistant_mode` field preserves current mode (old backends).
|
|
48
|
+
* Explicit `null` resets to shopping.
|
|
49
|
+
*/
|
|
50
|
+
updateFromContext(panel: Record<string, unknown>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Reset to shopping mode. Returns true if mode was non-shopping before reset.
|
|
53
|
+
*/
|
|
54
|
+
reset(): boolean;
|
|
55
|
+
/** Resolve attachment action type based on current mode. */
|
|
56
|
+
resolveAttachmentActionType(): 'user_message' | 'findSimilar';
|
|
57
|
+
/** Non-shopping modes condense thinking step lists. */
|
|
58
|
+
shouldCondenseThinking(): boolean;
|
|
59
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beauty consulting UISpec component registry entries.
|
|
3
|
+
*
|
|
4
|
+
* Spread into the default chat UISpec registry so central renderUISpec.ts
|
|
5
|
+
* only has a one-line integration point.
|
|
6
|
+
*/
|
|
7
|
+
import type { UISpecDomRegistry } from '../../../common/renderer/index.js';
|
|
8
|
+
import type { ChatUISpecRenderContext } from '../../types.js';
|
|
9
|
+
export declare const beautyConsultingRegistry: Partial<UISpecDomRegistry<ChatUISpecRenderContext>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beauty consulting stream handler — intercepts beauty-specific UISpec
|
|
3
|
+
* components during NDJSON stream processing.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from GengageChat._startStream() so index.ts only has thin
|
|
6
|
+
* delegation calls for beauty-specific stream events.
|
|
7
|
+
*/
|
|
8
|
+
import type { PhotoAnalysisData } from '../../components/PhotoAnalysisCard.js';
|
|
9
|
+
import type { ChatMessage } from '../../types.js';
|
|
10
|
+
/** Per-stream state for beauty consulting features. */
|
|
11
|
+
export interface BeautyStreamState {
|
|
12
|
+
streamIncludedBeautyPhotoStep: boolean;
|
|
13
|
+
pendingPhotoStepSkip: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function createBeautyStreamState(): BeautyStreamState;
|
|
16
|
+
/** Callbacks needed by the beauty stream handler. */
|
|
17
|
+
export interface BeautyStreamContext {
|
|
18
|
+
drawer: {
|
|
19
|
+
updateBotMessage(messageId: string, html: string, renderHint?: string, photoAnalysis?: PhotoAnalysisData): void;
|
|
20
|
+
setBeautyPhotoStepCard(options: {
|
|
21
|
+
visible: boolean;
|
|
22
|
+
processing?: boolean;
|
|
23
|
+
onSkip?: (() => void) | undefined;
|
|
24
|
+
title?: string | undefined;
|
|
25
|
+
description?: string | undefined;
|
|
26
|
+
uploadLabel?: string | undefined;
|
|
27
|
+
skipLabel?: string | undefined;
|
|
28
|
+
}): void;
|
|
29
|
+
} | null;
|
|
30
|
+
ensureRendered: () => void;
|
|
31
|
+
cancelTypewriter: () => void;
|
|
32
|
+
sendSkipMessage: () => void;
|
|
33
|
+
streamDone: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Handle a beauty-specific UISpec component during stream processing.
|
|
37
|
+
* Returns true if the component was handled (caller should `return`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function handleBeautyUISpec(componentType: string, rootElementProps: Record<string, unknown>, state: BeautyStreamState, ctx: BeautyStreamContext, botMsg: ChatMessage): boolean;
|
|
40
|
+
/** Returns true if the bot message should render as a photo analysis card. */
|
|
41
|
+
export declare function isPhotoAnalysisMessage(botMsg: ChatMessage): boolean;
|
|
42
|
+
/** Flush pending beauty photo step state on stream complete. */
|
|
43
|
+
export declare function flushBeautyStreamComplete(state: BeautyStreamState, ctx: BeautyStreamContext): void;
|
|
44
|
+
/** Flush pending beauty photo step skip on stream error. */
|
|
45
|
+
export declare function flushBeautyStreamError(state: BeautyStreamState, ctx: BeautyStreamContext): void;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { BackendContext, UISpec } from '../common/types.js';
|
|
2
|
+
import type { ChatMessage } from './types.js';
|
|
3
|
+
type LegacyThumbnailEntry = {
|
|
4
|
+
sku: string;
|
|
5
|
+
imageUrl: string;
|
|
6
|
+
threadId: string;
|
|
7
|
+
};
|
|
8
|
+
interface StoredHistoryMessage {
|
|
9
|
+
id: string;
|
|
10
|
+
threadId?: string | undefined;
|
|
11
|
+
role: 'user' | 'assistant';
|
|
12
|
+
content?: string | undefined;
|
|
13
|
+
uiSpec?: UISpec | undefined;
|
|
14
|
+
frontendOnly?: boolean | undefined;
|
|
15
|
+
silent?: boolean | undefined;
|
|
16
|
+
renderHint?: string | undefined;
|
|
17
|
+
photoAnalysis?: {
|
|
18
|
+
summary: string;
|
|
19
|
+
strengths?: string[];
|
|
20
|
+
focusPoints?: string[];
|
|
21
|
+
celebStyle?: string;
|
|
22
|
+
celebStyleReason?: string;
|
|
23
|
+
nextQuestion?: string;
|
|
24
|
+
} | undefined;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
status: 'done' | 'error';
|
|
27
|
+
}
|
|
28
|
+
export interface ChatHistoryIndexEntry {
|
|
29
|
+
id: string;
|
|
30
|
+
title: string;
|
|
31
|
+
preview: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
updatedAt: string;
|
|
34
|
+
messageCount: number;
|
|
35
|
+
pageType?: string | undefined;
|
|
36
|
+
sku?: string | undefined;
|
|
37
|
+
sourceSessionId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ChatHistorySessionRecord extends ChatHistoryIndexEntry {
|
|
40
|
+
version: number;
|
|
41
|
+
userId: string;
|
|
42
|
+
appId: string;
|
|
43
|
+
messages: StoredHistoryMessage[];
|
|
44
|
+
currentThreadId: string | null;
|
|
45
|
+
lastThreadId: string | null;
|
|
46
|
+
panelThreads?: string[] | undefined;
|
|
47
|
+
/** Legacy thumbnail-strip data kept optional for backward compatibility with older local history. */
|
|
48
|
+
thumbnailEntries?: LegacyThumbnailEntry[] | undefined;
|
|
49
|
+
panelSnapshotHtml?: Record<string, string> | undefined;
|
|
50
|
+
panelSnapshotTypes?: Record<string, string> | undefined;
|
|
51
|
+
panelAiSpecByThread?: Record<string, UISpec> | undefined;
|
|
52
|
+
lastBackendContext: BackendContext | null;
|
|
53
|
+
}
|
|
54
|
+
export interface SaveHistorySessionParams {
|
|
55
|
+
historyId: string;
|
|
56
|
+
userId: string;
|
|
57
|
+
appId: string;
|
|
58
|
+
sourceSessionId: string;
|
|
59
|
+
messages: ChatMessage[];
|
|
60
|
+
currentThreadId: string | null;
|
|
61
|
+
lastThreadId: string | null;
|
|
62
|
+
chatCreatedAt: string;
|
|
63
|
+
panelSnapshots: Map<string, HTMLElement>;
|
|
64
|
+
panelSnapshotTypes: Map<string, string>;
|
|
65
|
+
panelThreads: string[];
|
|
66
|
+
panelAiSpecByThread?: Map<string, UISpec> | undefined;
|
|
67
|
+
lastBackendContext: BackendContext | null;
|
|
68
|
+
pageType?: string | undefined;
|
|
69
|
+
sku?: string | undefined;
|
|
70
|
+
}
|
|
71
|
+
export declare class ChatHistoryStorage {
|
|
72
|
+
private readonly _appId;
|
|
73
|
+
private readonly _userId;
|
|
74
|
+
private readonly _storage;
|
|
75
|
+
private readonly _scope;
|
|
76
|
+
constructor(_appId: string, _userId: string, _storage?: Storage | null);
|
|
77
|
+
createHistoryId(): string;
|
|
78
|
+
findSessionId(sourceSessionId: string, createdAt: string): string | null;
|
|
79
|
+
listSessions(): ChatHistoryIndexEntry[];
|
|
80
|
+
loadSession(historyId: string): ChatHistorySessionRecord | null;
|
|
81
|
+
saveSession(params: SaveHistorySessionParams): ChatHistorySessionRecord | null;
|
|
82
|
+
deleteSession(historyId: string): void;
|
|
83
|
+
private _commitRecord;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './runtime.js';
|
|
2
|
+
export { chatCatalog } from './catalog.js';
|
|
3
|
+
export type { ChatCatalog, ChatComponentName } from './catalog.js';
|
|
4
|
+
export { createFloatingLauncher } from './components/FloatingLauncher.js';
|
|
5
|
+
export type { FloatingLauncherOptions } from './components/FloatingLauncher.js';
|
|
6
|
+
export type { ActionEnrichmentContext, BackendRequestMeta, InjectorAdapter, ProcessActionRequest, StreamCallbacks, } from '../common/transport.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KVKK notice filtering and caching helpers.
|
|
3
|
+
*
|
|
4
|
+
* KVKK (Kişisel Verilerin Korunması Kanunu) is Turkey's data protection law.
|
|
5
|
+
* When the backend streams a response containing a KVKK notice, we:
|
|
6
|
+
* 1. Strip the KVKK block from the visible bot text
|
|
7
|
+
* 2. Show a banner on first encounter (per account)
|
|
8
|
+
* 3. Mark it as shown in localStorage to avoid repeat banners
|
|
9
|
+
*/
|
|
10
|
+
export declare function containsKvkk(html: string): boolean;
|
|
11
|
+
export declare function isKvkkShown(accountId: string): boolean;
|
|
12
|
+
export declare function markKvkkShown(accountId: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Strip the KVKK portion from bot HTML.
|
|
15
|
+
* KVKK is typically wrapped in a `<div style="...">` at the start.
|
|
16
|
+
* We remove the first block-level element that contains a KVKK marker.
|
|
17
|
+
*/
|
|
18
|
+
export declare function stripKvkkBlock(html: string): string;
|
|
19
|
+
export declare function extractKvkkBlock(html: string): string | null;
|
|
20
|
+
export declare function localeToOutputLanguage(locale?: string): string;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PanelManager — manages the two-pane panel state for the chat widget.
|
|
3
|
+
*
|
|
4
|
+
* Owns panel snapshots, snapshot types, active message highlighting,
|
|
5
|
+
* panel thread navigation, topbar updates, and extended mode coordination.
|
|
6
|
+
*
|
|
7
|
+
* Extracted from chat/index.ts to improve cohesion and reduce file size.
|
|
8
|
+
*/
|
|
9
|
+
import type { ChatDrawer } from './components/ChatDrawer.js';
|
|
10
|
+
import type { CommunicationBridge } from '../common/communication-bridge.js';
|
|
11
|
+
import type { ExtendedModeManager } from './extendedModeManager.js';
|
|
12
|
+
import type { ChatI18n } from './types.js';
|
|
13
|
+
import type { UISpec } from '../common/types.js';
|
|
14
|
+
/** Minimal interface the panel manager needs from its host widget. */
|
|
15
|
+
export interface PanelManagerDeps {
|
|
16
|
+
drawer: () => ChatDrawer | null;
|
|
17
|
+
shadow: () => ShadowRoot | null;
|
|
18
|
+
currentThreadId: () => string | null;
|
|
19
|
+
bridge: () => CommunicationBridge | null;
|
|
20
|
+
extendedModeManager: () => ExtendedModeManager | null;
|
|
21
|
+
i18n: () => ChatI18n;
|
|
22
|
+
rollbackToThread: (threadId: string) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Rebuild source for local drilldown history and stream-end snapshots.
|
|
26
|
+
* `productDetailsWithSimilars` keeps PDP + appended similar grid in sync when
|
|
27
|
+
* similars arrive in a second stream chunk (DOM append does not update `spec` alone).
|
|
28
|
+
*/
|
|
29
|
+
export type PanelSource = {
|
|
30
|
+
kind: 'spec';
|
|
31
|
+
spec: UISpec;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'productDetailsWithSimilars';
|
|
34
|
+
pdpSpec: UISpec;
|
|
35
|
+
similarsSpec: UISpec;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'favorites';
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'history';
|
|
40
|
+
};
|
|
41
|
+
export type PanelSnapshotOptions = {
|
|
42
|
+
rebuild?: (() => HTMLElement) | undefined;
|
|
43
|
+
source?: PanelSource | undefined;
|
|
44
|
+
threadId?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
export declare class PanelManager {
|
|
47
|
+
private readonly deps;
|
|
48
|
+
/** Panel content snapshots keyed by bot message ID for history navigation. */
|
|
49
|
+
readonly snapshots: Map<string, HTMLElement>;
|
|
50
|
+
/** Rebuild functions keyed by message ID — produce fresh DOM with live event listeners. */
|
|
51
|
+
private readonly _snapshotRebuilders;
|
|
52
|
+
private readonly _snapshotSources;
|
|
53
|
+
private readonly _threadSources;
|
|
54
|
+
/** Component type for each panel snapshot (for topbar title restoration). */
|
|
55
|
+
readonly snapshotTypes: Map<string, string>;
|
|
56
|
+
/** Currently active (highlighted) message ID in the chat pane. */
|
|
57
|
+
activePanelMessageId: string | null;
|
|
58
|
+
/** Current panel component type. */
|
|
59
|
+
currentType: string | null;
|
|
60
|
+
/** Thread IDs that have panel content, in order of creation. */
|
|
61
|
+
threads: string[];
|
|
62
|
+
/** Action type that triggered the current stream (for panel title disambiguation). */
|
|
63
|
+
lastActionType: string | null;
|
|
64
|
+
constructor(deps: PanelManagerDeps);
|
|
65
|
+
/**
|
|
66
|
+
* Panel nav lists threads that received panel content; the conversation cursor may be
|
|
67
|
+
* newer (`indexOf` === -1). Anchor to the newest listed thread at/before the cursor.
|
|
68
|
+
* UUIDv7 ids sort chronologically as strings.
|
|
69
|
+
*/
|
|
70
|
+
private _resolvePanelHistoryIdx;
|
|
71
|
+
clearSnapshots(): void;
|
|
72
|
+
deleteSnapshotForMessage(messageId: string): void;
|
|
73
|
+
pruneThreadsAfter(threadId: string): void;
|
|
74
|
+
sourceForMessage(messageId: string): PanelSource | null;
|
|
75
|
+
sourceForThread(threadId: string): PanelSource | null;
|
|
76
|
+
componentTypeForSource(source: PanelSource): string;
|
|
77
|
+
/**
|
|
78
|
+
* Snapshot the current panel state for a message. Stores a rebuild function
|
|
79
|
+
* (preferred — produces fresh DOM with live event listeners) alongside a
|
|
80
|
+
* static DOM clone as fallback.
|
|
81
|
+
*/
|
|
82
|
+
snapshotForMessage(messageId: string, options?: PanelSnapshotOptions | (() => HTMLElement) | undefined): void;
|
|
83
|
+
/**
|
|
84
|
+
* Restore the panel content snapshot associated with a given message ID.
|
|
85
|
+
* Highlights the active message and de-highlights the previous one.
|
|
86
|
+
* Also restores the panel topbar title for the snapshot's component type.
|
|
87
|
+
* Returns true if the snapshot was found and restored.
|
|
88
|
+
*/
|
|
89
|
+
restoreForMessage(messageId: string, highlightMessageId?: string): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Send maximize-pdp / minify-pdp bridge messages with production-matching delays.
|
|
92
|
+
* Called by the extended mode manager when panel extension state changes.
|
|
93
|
+
*/
|
|
94
|
+
notifyExtension(extended: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Derive panel title from UISpec root element type using i18n strings.
|
|
97
|
+
* When the backend provides a `panelTitle` prop, it takes precedence.
|
|
98
|
+
*/
|
|
99
|
+
titleForComponent(componentType: string, backendTitle?: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Update the panel top bar navigation state and title.
|
|
102
|
+
* When the backend provides a `panelTitle`, it takes precedence over i18n defaults.
|
|
103
|
+
*/
|
|
104
|
+
/** @param displayTitle When passed (including empty string), used instead of titleForComponent. */
|
|
105
|
+
updateTopBar(componentType: string, backendTitle?: string, displayTitle?: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* Set panel topbar title during loading (before actual panel content arrives).
|
|
108
|
+
* Maps backend pending types to the same i18n titles used for final content.
|
|
109
|
+
*/
|
|
110
|
+
updateTopBarForLoading(pendingType: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Map UISpec component types to PanelContentType for the extended mode manager.
|
|
113
|
+
*/
|
|
114
|
+
updateExtendedMode(componentType: string): void;
|
|
115
|
+
/** Navigate to the previous panel thread. */
|
|
116
|
+
navigateBack(): void;
|
|
117
|
+
/** Navigate to the next panel thread. */
|
|
118
|
+
navigateForward(): void;
|
|
119
|
+
/**
|
|
120
|
+
* Panel route shaping:
|
|
121
|
+
* - product details => expanded LHS panel (`ProductDetailsPanel`)
|
|
122
|
+
* - all other panel-routed specs keep their original component types
|
|
123
|
+
*/
|
|
124
|
+
toPanelSpec(spec: UISpec): UISpec;
|
|
125
|
+
destroy(): void;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Decide how to apply incoming panel UISpec content.
|
|
129
|
+
*
|
|
130
|
+
* - `'replace'` — set as sole panel content (new search, comparison, product details)
|
|
131
|
+
* - `'append'` — add below existing content (similar products grid after product details)
|
|
132
|
+
* - `'appendSimilars'` — append via the dedicated similars helper
|
|
133
|
+
*/
|
|
134
|
+
export type PanelUpdateAction = 'replace' | 'append' | 'appendSimilars';
|
|
135
|
+
export declare function determinePanelUpdateAction(opts: {
|
|
136
|
+
componentType: string;
|
|
137
|
+
similarsAppend: boolean;
|
|
138
|
+
currentPanelType: string | null;
|
|
139
|
+
hasPanelContent: boolean;
|
|
140
|
+
isPanelLoading: boolean;
|
|
141
|
+
isFirstPanelContentInStream: boolean;
|
|
142
|
+
}): PanelUpdateAction;
|