@gengage/assistant-fe 0.4.20 → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-paths-CReMDZWg.js → api-paths-Bg6iwO5w.js} +1 -1
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +2 -2
- package/dist/chat.js +1 -1
- package/dist/{common-BM2ZsSLI.js → common-DDJSeQhg.js} +2 -2
- package/dist/common.js +5 -5
- package/dist/{connection-warning-C_4e7ahZ.js → connection-warning-BeD-B0Ec.js} +1 -1
- package/dist/{fastIntent-DMNzXOSI.js → fastIntent-BeeDIwd2.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +2 -2
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{runtime-C51WykbJ.js → runtime-C8ZBidd2.js} +3 -3
- package/dist/{runtime-bbMljGVG.js → runtime-CRSFPLku.js} +3 -3
- package/dist/{runtime-DBh8899B.js → runtime-Ct1qOl8V.js} +5 -5
- package/dist/{simbut-CO1rLVM9.js → simbut-BrAeZ6SH.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-zCDlCrqG.js → simrel-Cha5de6P.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-Cf9ofZhh.js → widget-base-BtBl_PCR.js} +1 -1
- package/package.json +8 -5
- package/dist/chat/api.d.ts +0 -88
- package/dist/chat/assistant-mode.d.ts +0 -19
- package/dist/chat/attachment-utils.d.ts +0 -9
- package/dist/chat/catalog.d.ts +0 -826
- package/dist/chat/chat-presentation-state.d.ts +0 -53
- package/dist/chat/components/AIGroupingCards.d.ts +0 -3
- package/dist/chat/components/AISuggestedSearchCards.d.ts +0 -3
- package/dist/chat/components/AITopPicks.d.ts +0 -3
- package/dist/chat/components/BeautyPhotoStep.d.ts +0 -16
- package/dist/chat/components/CategoriesContainer.d.ts +0 -3
- package/dist/chat/components/ChatDrawer.d.ts +0 -360
- package/dist/chat/components/ChoicePrompter.d.ts +0 -21
- package/dist/chat/components/ComparisonTable.d.ts +0 -57
- package/dist/chat/components/ConsultingStylePicker.d.ts +0 -34
- package/dist/chat/components/FloatingComparisonButton.d.ts +0 -2
- package/dist/chat/components/FloatingLauncher.d.ts +0 -79
- package/dist/chat/components/GroundingReviewCard.d.ts +0 -3
- package/dist/chat/components/HandoffNotice.d.ts +0 -4
- package/dist/chat/components/KvkkBanner.d.ts +0 -6
- package/dist/chat/components/Launcher.d.ts +0 -28
- package/dist/chat/components/PanelRestoreCard.d.ts +0 -4
- package/dist/chat/components/PanelTopBar.d.ts +0 -32
- package/dist/chat/components/PhotoAnalysisCard.d.ts +0 -20
- package/dist/chat/components/ProductSummaryCard.d.ts +0 -3
- package/dist/chat/components/ProsAndCons.d.ts +0 -8
- package/dist/chat/components/ReviewHighlights.d.ts +0 -9
- package/dist/chat/components/actionClassifier.d.ts +0 -12
- package/dist/chat/components/product-price-layout.d.ts +0 -18
- package/dist/chat/components/productMentionLinker.d.ts +0 -25
- package/dist/chat/components/renderUISpec.d.ts +0 -11
- package/dist/chat/components/typewriter.d.ts +0 -24
- package/dist/chat/extendedModeManager.d.ts +0 -32
- package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +0 -31
- package/dist/chat/features/beauty-consulting/drawer-extensions.d.ts +0 -20
- package/dist/chat/features/beauty-consulting/mode-controller.d.ts +0 -53
- package/dist/chat/features/beauty-consulting/registry.d.ts +0 -3
- package/dist/chat/features/beauty-consulting/stream-handler.d.ts +0 -38
- package/dist/chat/history-storage.d.ts +0 -85
- package/dist/chat/index.d.ts +0 -5
- package/dist/chat/kvkk.d.ts +0 -20
- package/dist/chat/locales/en.d.ts +0 -2
- package/dist/chat/locales/index.d.ts +0 -5
- package/dist/chat/locales/tr.d.ts +0 -2
- package/dist/chat/panel-manager.d.ts +0 -126
- package/dist/chat/runtime.d.ts +0 -400
- package/dist/chat/session-persistence.d.ts +0 -65
- package/dist/chat/stream-error-display.d.ts +0 -6
- package/dist/chat/types.d.ts +0 -543
- package/dist/chat/utils/chat-presentation-debug.d.ts +0 -19
- package/dist/chat/utils/get-chat-scroll-element.d.ts +0 -10
- package/dist/chat/utils/ui.d.ts +0 -10
- package/dist/common/action-router.d.ts +0 -26
- package/dist/common/activity-tracker.d.ts +0 -37
- package/dist/common/analytics-events.d.ts +0 -91
- package/dist/common/analytics.d.ts +0 -61
- package/dist/common/api-paths.d.ts +0 -15
- package/dist/common/client.d.ts +0 -27
- package/dist/common/communication-bridge.d.ts +0 -51
- package/dist/common/config-constants.d.ts +0 -1
- package/dist/common/config-schema.d.ts +0 -81
- package/dist/common/connection-warning.d.ts +0 -8
- package/dist/common/consulting-sources.d.ts +0 -9
- package/dist/common/context.d.ts +0 -27
- package/dist/common/css-escape.d.ts +0 -1
- package/dist/common/customization-factories.d.ts +0 -62
- package/dist/common/debug.d.ts +0 -13
- package/dist/common/events.d.ts +0 -46
- package/dist/common/fastIntent.d.ts +0 -1
- package/dist/common/find-similar-payload.d.ts +0 -3
- package/dist/common/ga-datalayer.d.ts +0 -89
- package/dist/common/global-error-toast.d.ts +0 -6
- package/dist/common/index.d.ts +0 -50
- package/dist/common/indexed-db.d.ts +0 -79
- package/dist/common/locale.d.ts +0 -1
- package/dist/common/native-webview.d.ts +0 -60
- package/dist/common/navigation.d.ts +0 -5
- package/dist/common/overlay.d.ts +0 -168
- package/dist/common/page-detect.d.ts +0 -30
- package/dist/common/pill-launcher.d.ts +0 -51
- package/dist/common/preflight.d.ts +0 -13
- package/dist/common/price-formatter.d.ts +0 -35
- package/dist/common/product-utils.d.ts +0 -35
- package/dist/common/protocol-adapter.d.ts +0 -105
- package/dist/common/renderer/dom.d.ts +0 -3
- package/dist/common/renderer/index.d.ts +0 -4
- package/dist/common/renderer/overrides.d.ts +0 -23
- package/dist/common/renderer/registry.d.ts +0 -2
- package/dist/common/renderer/types.d.ts +0 -19
- package/dist/common/safe-html.d.ts +0 -22
- package/dist/common/sdk-version.d.ts +0 -3
- package/dist/common/skeleton.d.ts +0 -8
- package/dist/common/streaming.d.ts +0 -37
- package/dist/common/suggested-search-keywords.d.ts +0 -18
- package/dist/common/theme-utils.d.ts +0 -15
- package/dist/common/tts-player.d.ts +0 -13
- package/dist/common/types.d.ts +0 -381
- package/dist/common/ui-theme.d.ts +0 -9
- package/dist/common/uuidv7.d.ts +0 -7
- package/dist/common/voice-input.d.ts +0 -74
- package/dist/common/widget-base.d.ts +0 -97
- package/dist/index.d.ts +0 -25
- package/dist/native/index.d.ts +0 -2
- package/dist/overlay.d.ts +0 -4
- package/dist/qna/api.d.ts +0 -23
- package/dist/qna/catalog.d.ts +0 -73
- package/dist/qna/components/ButtonRow.d.ts +0 -15
- package/dist/qna/components/TextInput.d.ts +0 -11
- package/dist/qna/components/renderUISpec.d.ts +0 -7
- package/dist/qna/index.d.ts +0 -3
- package/dist/qna/locales/en.d.ts +0 -2
- package/dist/qna/locales/index.d.ts +0 -5
- package/dist/qna/locales/tr.d.ts +0 -2
- package/dist/qna/normalize-ui-specs.d.ts +0 -15
- package/dist/qna/runtime.d.ts +0 -62
- package/dist/qna/types.d.ts +0 -98
- package/dist/simbut/index.d.ts +0 -22
- package/dist/simbut/locales.d.ts +0 -3
- package/dist/simbut/types.d.ts +0 -43
- package/dist/simrel/api.d.ts +0 -25
- package/dist/simrel/catalog.d.ts +0 -110
- package/dist/simrel/components/GroupTabs.d.ts +0 -24
- package/dist/simrel/components/ProductCard.d.ts +0 -19
- package/dist/simrel/components/ProductGrid.d.ts +0 -17
- package/dist/simrel/components/renderUISpec.d.ts +0 -7
- package/dist/simrel/index.d.ts +0 -5
- package/dist/simrel/locales/en.d.ts +0 -2
- package/dist/simrel/locales/index.d.ts +0 -5
- package/dist/simrel/locales/tr.d.ts +0 -2
- package/dist/simrel/renderers/default.d.ts +0 -40
- package/dist/simrel/runtime.d.ts +0 -59
- package/dist/simrel/types.d.ts +0 -141
|
@@ -1,28 +0,0 @@
|
|
|
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;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { UIElement } from '../../common/types.js';
|
|
2
|
-
import { 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;
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { UIElement } from '../../common/types.js';
|
|
2
|
-
import { ChatUISpecRenderContext } from '../types.js';
|
|
3
|
-
export interface PhotoAnalysisData {
|
|
4
|
-
summary: string;
|
|
5
|
-
strengths?: string[];
|
|
6
|
-
focusPoints?: string[];
|
|
7
|
-
celebStyle?: string;
|
|
8
|
-
celebStyleReason?: string;
|
|
9
|
-
nextQuestion?: string;
|
|
10
|
-
}
|
|
11
|
-
/** Extract structured photo-analysis data from a UISpec element's props. */
|
|
12
|
-
export declare function parsePhotoAnalysisProps(props: Record<string, unknown>): PhotoAnalysisData | null;
|
|
13
|
-
export declare function renderPhotoAnalysisCard(element: UIElement, ctx: ChatUISpecRenderContext): HTMLElement;
|
|
14
|
-
/** Renders the structured PhotoAnalysisCard data captured from the UISpec. */
|
|
15
|
-
export declare function renderPhotoAnalysisBubble(container: HTMLElement, labels: {
|
|
16
|
-
badge: string;
|
|
17
|
-
strengths: string;
|
|
18
|
-
focus: string;
|
|
19
|
-
celebStyle: string;
|
|
20
|
-
}, structured?: PhotoAnalysisData): void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UIElement } from '../../common/types.js';
|
|
2
|
-
export declare function renderReviewHighlights(element: UIElement, options?: {
|
|
3
|
-
emptyReviewsMessage?: string | undefined;
|
|
4
|
-
reviewFilterPositive?: string | undefined;
|
|
5
|
-
reviewFilterNegative?: string | undefined;
|
|
6
|
-
reviewCustomersMentionSingular?: string | undefined;
|
|
7
|
-
reviewCustomersMentionPlural?: string | undefined;
|
|
8
|
-
reviewSubjectsHeading?: string | undefined;
|
|
9
|
-
}): HTMLElement;
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ChatUISpecRenderContext, ProductPriceOriginalStyle } from '../types.js';
|
|
2
|
-
export declare function discountReasonFromProduct(product: Record<string, unknown> | undefined): string | undefined;
|
|
3
|
-
export declare function campaignReasonForDisplay(ctx: ChatUISpecRenderContext, product: Record<string, unknown> | undefined): string | undefined;
|
|
4
|
-
/**
|
|
5
|
-
* Per-product `originalPriceStyle` / `price_original_style` override config.
|
|
6
|
-
* Default `strikethrough`; `inline` uses a separator row without a strike line.
|
|
7
|
-
*/
|
|
8
|
-
export declare function resolveOriginalPriceStyle(ctx: ChatUISpecRenderContext, product: Record<string, unknown> | undefined): ProductPriceOriginalStyle;
|
|
9
|
-
export declare function createCampaignReasonElement(text: string): HTMLDivElement;
|
|
10
|
-
export declare function resolveCampaignBadgeLogoUrl(ctx: ChatUISpecRenderContext, product: Record<string, unknown> | undefined): string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Single bordered badge: optional logo, campaign line (body text), sale price — gradient border, transparent fill.
|
|
13
|
-
*/
|
|
14
|
-
export declare function createCampaignPriceBadge(options: {
|
|
15
|
-
reasonText: string;
|
|
16
|
-
salePriceFormatted: string;
|
|
17
|
-
logoUrl?: string;
|
|
18
|
-
}): HTMLElement;
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
export 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;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UISpec, UIElement } from '../../common/types.js';
|
|
2
|
-
import { UISpecDomRegistry, UISpecDomUnknownRenderer } from '../../common/renderer/index.js';
|
|
3
|
-
import { ChatUISpecRenderContext } from '../types.js';
|
|
4
|
-
import { PriceFormatConfig } from '../../common/price-formatter.js';
|
|
5
|
-
export type UISpecRenderContext = ChatUISpecRenderContext;
|
|
6
|
-
export type ChatUISpecRegistry = UISpecDomRegistry<UISpecRenderContext>;
|
|
7
|
-
export type { PriceFormatConfig };
|
|
8
|
-
export declare const defaultChatUnknownUISpecRenderer: UISpecDomUnknownRenderer<UISpecRenderContext>;
|
|
9
|
-
export declare function createDefaultChatUISpecRegistry(): ChatUISpecRegistry;
|
|
10
|
-
export declare function renderUISpec(spec: UISpec, ctx: UISpecRenderContext, registry?: ChatUISpecRegistry, unknownRenderer?: UISpecDomUnknownRenderer<UISpecRenderContext>): HTMLElement;
|
|
11
|
-
export declare function renderProductCard(element: UIElement, ctx: UISpecRenderContext): HTMLElement;
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UIElement } from '../../../common/types.js';
|
|
2
|
-
import { ChatUISpecRenderContext } from '../../types.js';
|
|
3
|
-
import { StyleVariation } from '../../components/ConsultingStylePicker.js';
|
|
4
|
-
export interface ConsultingGridResult {
|
|
5
|
-
isConsulting: boolean;
|
|
6
|
-
source: string | undefined;
|
|
7
|
-
styleVariations: StyleVariation[];
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Check whether a ProductGrid element should render as a consulting style picker.
|
|
11
|
-
* Returns the check result plus pre-parsed data for {@link renderConsultingGrid}.
|
|
12
|
-
*/
|
|
13
|
-
export declare function detectConsultingGrid(element: UIElement): ConsultingGridResult;
|
|
14
|
-
/**
|
|
15
|
-
* Render a consulting style picker into the ProductGrid wrapper.
|
|
16
|
-
* Call only when `detectConsultingGrid` returned `isConsulting: true`.
|
|
17
|
-
*/
|
|
18
|
-
export declare function renderConsultingGrid(wrapper: HTMLElement, grid: HTMLElement, detected: ConsultingGridResult, ctx?: ChatUISpecRenderContext): void;
|
|
19
|
-
/**
|
|
20
|
-
* Whether at least one variation is not actively `loading`, so the panel can
|
|
21
|
-
* paint the first ready style immediately (fast-first). Remaining `loading`
|
|
22
|
-
* tabs stream in and update in place via {@link patchConsultingGridDom} without
|
|
23
|
-
* replacing the whole panel.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isConsultingGridReady(detected: ConsultingGridResult): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Apply a streaming consulting ProductGrid update to the visible panel without
|
|
28
|
-
* `setPanelContent` (avoids full DOM swap / blink). Returns false if the
|
|
29
|
-
* panel is not currently showing a consulting picker.
|
|
30
|
-
*/
|
|
31
|
-
export declare function patchConsultingGridDom(wrapper: HTMLElement, detected: ConsultingGridResult, ctx?: ChatUISpecRenderContext): boolean;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ChatI18n } from '../../types.js';
|
|
2
|
-
export interface BeautyPhotoStepCardOptions {
|
|
3
|
-
visible: boolean;
|
|
4
|
-
processing?: boolean;
|
|
5
|
-
onSkip?: (() => void) | undefined;
|
|
6
|
-
title?: string | undefined;
|
|
7
|
-
description?: string | undefined;
|
|
8
|
-
uploadLabel?: string | undefined;
|
|
9
|
-
skipLabel?: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Lazily create the beauty photo step slot element and insert it before
|
|
13
|
-
* the input area. Returns the created or existing element.
|
|
14
|
-
*/
|
|
15
|
-
export declare function ensureBeautyPhotoStepSlot(existing: HTMLElement | null, conversationEl: HTMLElement | null): HTMLElement;
|
|
16
|
-
/**
|
|
17
|
-
* Show or hide the beauty photo step card.
|
|
18
|
-
* Returns the slot element (possibly newly created).
|
|
19
|
-
*/
|
|
20
|
-
export declare function applyBeautyPhotoStepCard(slotEl: HTMLElement | null, conversationEl: HTMLElement | null, options: BeautyPhotoStepCardOptions, i18n: ChatI18n, openAttachmentPicker: () => void): HTMLElement | null;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { AssistantMode } from '../../assistant-mode.js';
|
|
2
|
-
/**
|
|
3
|
-
* Minimal drawer interface consumed by the mode controller.
|
|
4
|
-
* Keeps the controller decoupled from ChatDrawer internals.
|
|
5
|
-
*/
|
|
6
|
-
export interface ModeDrawerAdapter {
|
|
7
|
-
setAttachmentControlsVisible(visible: boolean): void;
|
|
8
|
-
setInputPlaceholder(text: string): void;
|
|
9
|
-
setBeautyPhotoStepCard(options: {
|
|
10
|
-
visible: boolean;
|
|
11
|
-
}): void;
|
|
12
|
-
}
|
|
13
|
-
export declare class AssistantModeController {
|
|
14
|
-
private _mode;
|
|
15
|
-
private _uiHints;
|
|
16
|
-
get mode(): AssistantMode;
|
|
17
|
-
set mode(value: AssistantMode);
|
|
18
|
-
get uiHints(): Record<string, unknown> | null;
|
|
19
|
-
set uiHints(value: Record<string, unknown> | null);
|
|
20
|
-
get isShopping(): boolean;
|
|
21
|
-
get isBeautyConsulting(): boolean;
|
|
22
|
-
/** Whether choice prompter is hidden by backend ui_hints. */
|
|
23
|
-
get isChoicePrompterHidden(): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Apply backend ui_hints to the drawer.
|
|
26
|
-
*
|
|
27
|
-
* @param drawer Drawer adapter (null when drawer not yet created).
|
|
28
|
-
* @param defaultPlaceholder Default input placeholder for shopping mode.
|
|
29
|
-
* @param removePersistentChoicePrompter Callback to remove persistent choice prompter from Shadow DOM.
|
|
30
|
-
*/
|
|
31
|
-
applyUiHints(drawer: ModeDrawerAdapter | null, defaultPlaceholder: string, removePersistentChoicePrompter?: () => void): void;
|
|
32
|
-
/**
|
|
33
|
-
* Handle redirect metadata from a backend metadata event.
|
|
34
|
-
* Returns true if the mode actually switched.
|
|
35
|
-
*/
|
|
36
|
-
handleRedirect(redirectPayload: unknown): boolean;
|
|
37
|
-
/** Switch to a new assistant mode. */
|
|
38
|
-
switchMode(mode: AssistantMode): void;
|
|
39
|
-
/**
|
|
40
|
-
* Derive mode and ui_hints from a backend CONTEXT panel payload.
|
|
41
|
-
* Missing `assistant_mode` field preserves current mode (old backends).
|
|
42
|
-
* Explicit `null` resets to shopping.
|
|
43
|
-
*/
|
|
44
|
-
updateFromContext(panel: Record<string, unknown>): void;
|
|
45
|
-
/**
|
|
46
|
-
* Reset to shopping mode. Returns true if mode was non-shopping before reset.
|
|
47
|
-
*/
|
|
48
|
-
reset(): boolean;
|
|
49
|
-
/** Resolve attachment action type based on current mode. */
|
|
50
|
-
resolveAttachmentActionType(): 'user_message' | 'findSimilar';
|
|
51
|
-
/** Non-shopping modes condense thinking step lists. */
|
|
52
|
-
shouldCondenseThinking(): boolean;
|
|
53
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { PhotoAnalysisData } from '../../components/PhotoAnalysisCard.js';
|
|
2
|
-
import { ChatMessage } from '../../types.js';
|
|
3
|
-
/** Per-stream state for beauty consulting features. */
|
|
4
|
-
export interface BeautyStreamState {
|
|
5
|
-
streamIncludedBeautyPhotoStep: boolean;
|
|
6
|
-
pendingPhotoStepSkip: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function createBeautyStreamState(): BeautyStreamState;
|
|
9
|
-
/** Callbacks needed by the beauty stream handler. */
|
|
10
|
-
export interface BeautyStreamContext {
|
|
11
|
-
drawer: {
|
|
12
|
-
updateBotMessage(messageId: string, html: string, renderHint?: string, photoAnalysis?: PhotoAnalysisData): void;
|
|
13
|
-
setBeautyPhotoStepCard(options: {
|
|
14
|
-
visible: boolean;
|
|
15
|
-
processing?: boolean;
|
|
16
|
-
onSkip?: (() => void) | undefined;
|
|
17
|
-
title?: string | undefined;
|
|
18
|
-
description?: string | undefined;
|
|
19
|
-
uploadLabel?: string | undefined;
|
|
20
|
-
skipLabel?: string | undefined;
|
|
21
|
-
}): void;
|
|
22
|
-
} | null;
|
|
23
|
-
ensureRendered: () => void;
|
|
24
|
-
cancelTypewriter: () => void;
|
|
25
|
-
sendSkipMessage: () => void;
|
|
26
|
-
streamDone: boolean;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Handle a beauty-specific UISpec component during stream processing.
|
|
30
|
-
* Returns true if the component was handled (caller should `return`).
|
|
31
|
-
*/
|
|
32
|
-
export declare function handleBeautyUISpec(componentType: string, rootElementProps: Record<string, unknown>, state: BeautyStreamState, ctx: BeautyStreamContext, botMsg: ChatMessage): boolean;
|
|
33
|
-
/** Returns true if the bot message should render as a photo analysis card. */
|
|
34
|
-
export declare function isPhotoAnalysisMessage(botMsg: ChatMessage): boolean;
|
|
35
|
-
/** Flush pending beauty photo step state on stream complete. */
|
|
36
|
-
export declare function flushBeautyStreamComplete(state: BeautyStreamState, ctx: BeautyStreamContext): void;
|
|
37
|
-
/** Flush pending beauty photo step skip on stream error. */
|
|
38
|
-
export declare function flushBeautyStreamError(state: BeautyStreamState, ctx: BeautyStreamContext): void;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { BackendContext, UISpec } from '../common/types.js';
|
|
2
|
-
import { ChatMessage } from './types.js';
|
|
3
|
-
type LegacyThumbnailEntry = {
|
|
4
|
-
sku: string;
|
|
5
|
-
imageUrl: string;
|
|
6
|
-
threadId: string;
|
|
7
|
-
};
|
|
8
|
-
export 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 {};
|
package/dist/chat/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
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';
|
package/dist/chat/kvkk.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { ChatDrawer } from './components/ChatDrawer.js';
|
|
2
|
-
import { CommunicationBridge } from '../common/communication-bridge.js';
|
|
3
|
-
import { ExtendedModeManager } from './extendedModeManager.js';
|
|
4
|
-
import { ChatI18n } from './types.js';
|
|
5
|
-
import { UISpec } from '../common/types.js';
|
|
6
|
-
/** Minimal interface the panel manager needs from its host widget. */
|
|
7
|
-
export interface PanelManagerDeps {
|
|
8
|
-
drawer: () => ChatDrawer | null;
|
|
9
|
-
shadow: () => ShadowRoot | null;
|
|
10
|
-
currentThreadId: () => string | null;
|
|
11
|
-
bridge: () => CommunicationBridge | null;
|
|
12
|
-
extendedModeManager: () => ExtendedModeManager | null;
|
|
13
|
-
i18n: () => ChatI18n;
|
|
14
|
-
rollbackToThread: (threadId: string) => void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Rebuild source for local drilldown history and stream-end snapshots.
|
|
18
|
-
* `productDetailsWithSimilars` keeps PDP + appended similar grid in sync when
|
|
19
|
-
* similars arrive in a second stream chunk (DOM append does not update `spec` alone).
|
|
20
|
-
*/
|
|
21
|
-
export type PanelSource = {
|
|
22
|
-
kind: 'spec';
|
|
23
|
-
spec: UISpec;
|
|
24
|
-
} | {
|
|
25
|
-
kind: 'productDetailsWithSimilars';
|
|
26
|
-
pdpSpec: UISpec;
|
|
27
|
-
similarsSpec: UISpec;
|
|
28
|
-
} | {
|
|
29
|
-
kind: 'favorites';
|
|
30
|
-
} | {
|
|
31
|
-
kind: 'history';
|
|
32
|
-
};
|
|
33
|
-
export type PanelSnapshotOptions = {
|
|
34
|
-
rebuild?: (() => HTMLElement) | undefined;
|
|
35
|
-
source?: PanelSource | undefined;
|
|
36
|
-
threadId?: string | undefined;
|
|
37
|
-
};
|
|
38
|
-
export declare class PanelManager {
|
|
39
|
-
private readonly deps;
|
|
40
|
-
/** Panel content snapshots keyed by bot message ID for history navigation. */
|
|
41
|
-
readonly snapshots: Map<string, HTMLElement>;
|
|
42
|
-
/** Rebuild functions keyed by message ID — produce fresh DOM with live event listeners. */
|
|
43
|
-
private readonly _snapshotRebuilders;
|
|
44
|
-
private readonly _snapshotSources;
|
|
45
|
-
private readonly _threadSources;
|
|
46
|
-
/** Component type for each panel snapshot (for topbar title restoration). */
|
|
47
|
-
readonly snapshotTypes: Map<string, string>;
|
|
48
|
-
/** Currently active (highlighted) message ID in the chat pane. */
|
|
49
|
-
activePanelMessageId: string | null;
|
|
50
|
-
/** Current panel component type. */
|
|
51
|
-
currentType: string | null;
|
|
52
|
-
/** Thread IDs that have panel content, in order of creation. */
|
|
53
|
-
threads: string[];
|
|
54
|
-
/** Action type that triggered the current stream (for panel title disambiguation). */
|
|
55
|
-
lastActionType: string | null;
|
|
56
|
-
constructor(deps: PanelManagerDeps);
|
|
57
|
-
clearSnapshots(): void;
|
|
58
|
-
sourceForMessage(messageId: string): PanelSource | null;
|
|
59
|
-
sourceForThread(threadId: string): PanelSource | null;
|
|
60
|
-
componentTypeForSource(source: PanelSource): string;
|
|
61
|
-
/**
|
|
62
|
-
* Snapshot the current panel state for a message. Stores a rebuild function
|
|
63
|
-
* (preferred — produces fresh DOM with live event listeners) alongside a
|
|
64
|
-
* static DOM clone as fallback.
|
|
65
|
-
*/
|
|
66
|
-
snapshotForMessage(messageId: string, options?: PanelSnapshotOptions | (() => HTMLElement) | undefined): void;
|
|
67
|
-
/**
|
|
68
|
-
* Restore the panel content snapshot associated with a given message ID.
|
|
69
|
-
* Highlights the active message and de-highlights the previous one.
|
|
70
|
-
* Also restores the panel topbar title for the snapshot's component type.
|
|
71
|
-
* Returns true if the snapshot was found and restored.
|
|
72
|
-
*/
|
|
73
|
-
restoreForMessage(messageId: string, highlightMessageId?: string): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Send maximize-pdp / minify-pdp bridge messages with production-matching delays.
|
|
76
|
-
* Called by the extended mode manager when panel extension state changes.
|
|
77
|
-
*/
|
|
78
|
-
notifyExtension(extended: boolean): void;
|
|
79
|
-
/**
|
|
80
|
-
* Derive panel title from UISpec root element type using i18n strings.
|
|
81
|
-
* When the backend provides a `panelTitle` prop, it takes precedence.
|
|
82
|
-
*/
|
|
83
|
-
titleForComponent(componentType: string, backendTitle?: string): string;
|
|
84
|
-
/**
|
|
85
|
-
* Update the panel top bar navigation state and title.
|
|
86
|
-
* When the backend provides a `panelTitle`, it takes precedence over i18n defaults.
|
|
87
|
-
*/
|
|
88
|
-
/** @param displayTitle When passed (including empty string), used instead of titleForComponent. */
|
|
89
|
-
updateTopBar(componentType: string, backendTitle?: string, displayTitle?: string): void;
|
|
90
|
-
/**
|
|
91
|
-
* Set panel topbar title during loading (before actual panel content arrives).
|
|
92
|
-
* Maps backend pending types to the same i18n titles used for final content.
|
|
93
|
-
*/
|
|
94
|
-
updateTopBarForLoading(pendingType: string): void;
|
|
95
|
-
/**
|
|
96
|
-
* Map UISpec component types to PanelContentType for the extended mode manager.
|
|
97
|
-
*/
|
|
98
|
-
updateExtendedMode(componentType: string): void;
|
|
99
|
-
/** Navigate to the previous panel thread. */
|
|
100
|
-
navigateBack(): void;
|
|
101
|
-
/** Navigate to the next panel thread. */
|
|
102
|
-
navigateForward(): void;
|
|
103
|
-
/**
|
|
104
|
-
* Panel route shaping:
|
|
105
|
-
* - product details => expanded LHS panel (`ProductDetailsPanel`)
|
|
106
|
-
* - all other panel-routed specs keep their original component types
|
|
107
|
-
*/
|
|
108
|
-
toPanelSpec(spec: UISpec): UISpec;
|
|
109
|
-
destroy(): void;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Decide how to apply incoming panel UISpec content.
|
|
113
|
-
*
|
|
114
|
-
* - `'replace'` — set as sole panel content (new search, comparison, product details)
|
|
115
|
-
* - `'append'` — add below existing content (similar products grid after product details)
|
|
116
|
-
* - `'appendSimilars'` — append via the dedicated similars helper
|
|
117
|
-
*/
|
|
118
|
-
export type PanelUpdateAction = 'replace' | 'append' | 'appendSimilars';
|
|
119
|
-
export declare function determinePanelUpdateAction(opts: {
|
|
120
|
-
componentType: string;
|
|
121
|
-
similarsAppend: boolean;
|
|
122
|
-
currentPanelType: string | null;
|
|
123
|
-
hasPanelContent: boolean;
|
|
124
|
-
isPanelLoading: boolean;
|
|
125
|
-
isFirstPanelContentInStream: boolean;
|
|
126
|
-
}): PanelUpdateAction;
|