@gengage/assistant-fe 0.4.19 → 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-Bg6iwO5w.js +1250 -0
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +17 -17
- package/dist/chat.js +1 -1
- package/dist/{common-Bpp43wr0.js → common-DDJSeQhg.js} +2 -2
- package/dist/common.js +79 -77
- package/dist/{connection-warning-C7ehvQxx.js → connection-warning-BeD-B0Ec.js} +1 -1
- package/dist/{fastIntent-CINRmM8r.js → fastIntent-BeeDIwd2.js} +1 -1
- package/dist/index.js +75 -73
- package/dist/native.iife.js +18 -18
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +22 -22
- package/dist/qna.js +1 -1
- package/dist/{runtime-B0hDHRlN.js → runtime-C8ZBidd2.js} +13 -13
- package/dist/{runtime-CLcYqzoA.js → runtime-CRSFPLku.js} +17 -17
- package/dist/{runtime-DhdfOJEN.js → runtime-Ct1qOl8V.js} +855 -848
- package/dist/{simbut-3kqLW3SM.js → simbut-BrAeZ6SH.js} +19 -22
- package/dist/simbut.iife.js +9 -9
- package/dist/simbut.js +1 -1
- package/dist/{simrel-fQg2EIB8.js → simrel-Cha5de6P.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +7 -7
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-bdJaGJYi.js → widget-base-BtBl_PCR.js} +91 -83
- package/package.json +9 -5
- package/dist/api-paths-BX3Lea3A.js +0 -1213
- 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 -399
- 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/ga-datalayer.d.ts +0 -89
- package/dist/common/global-error-toast.d.ts +0 -6
- package/dist/common/index.d.ts +0 -49
- 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/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,79 +0,0 @@
|
|
|
1
|
-
import { SerializableChatMessage } from '../chat/types.js';
|
|
2
|
-
import { UISpec } from './types.js';
|
|
3
|
-
export interface SessionData {
|
|
4
|
-
userId: string;
|
|
5
|
-
appId: string;
|
|
6
|
-
sessionId: string;
|
|
7
|
-
messages: SerializableChatMessage[];
|
|
8
|
-
currentThreadId: string | null;
|
|
9
|
-
lastThreadId: string | null;
|
|
10
|
-
createdAt: string;
|
|
11
|
-
/** Thread IDs that produced panel content, in creation order. */
|
|
12
|
-
panelThreads?: string[] | undefined;
|
|
13
|
-
/** Legacy thumbnail-strip data kept optional for backward compatibility with older sessions. */
|
|
14
|
-
thumbnailEntries?: Array<{
|
|
15
|
-
sku: string;
|
|
16
|
-
imageUrl: string;
|
|
17
|
-
threadId: string;
|
|
18
|
-
}> | undefined;
|
|
19
|
-
/** Serialized panel HTML keyed by bot message ID (for panel snapshot restore). */
|
|
20
|
-
panelSnapshotHtml?: Record<string, string> | undefined;
|
|
21
|
-
/** Panel component type keyed by snapshot message ID. */
|
|
22
|
-
panelSnapshotTypes?: Record<string, string> | undefined;
|
|
23
|
-
/** Latest panel AI-zone UISpec keyed by thread ID. */
|
|
24
|
-
panelAiSpecByThread?: Record<string, UISpec> | undefined;
|
|
25
|
-
/** SKU active when session was saved — prevents cross-SKU restore. */
|
|
26
|
-
sku?: string | undefined;
|
|
27
|
-
}
|
|
28
|
-
export interface ContextData {
|
|
29
|
-
sessionId: string;
|
|
30
|
-
threadId: string;
|
|
31
|
-
context: import('./types.js').BackendContext;
|
|
32
|
-
}
|
|
33
|
-
export interface PayloadData {
|
|
34
|
-
threadId: string;
|
|
35
|
-
messageId: string;
|
|
36
|
-
uiSpec: UISpec;
|
|
37
|
-
}
|
|
38
|
-
export interface FavoriteData {
|
|
39
|
-
userId: string;
|
|
40
|
-
appId: string;
|
|
41
|
-
sku: string;
|
|
42
|
-
name?: string | undefined;
|
|
43
|
-
imageUrl?: string | undefined;
|
|
44
|
-
price?: string | undefined;
|
|
45
|
-
savedAt: string;
|
|
46
|
-
}
|
|
47
|
-
export declare class GengageIndexedDB {
|
|
48
|
-
private _db;
|
|
49
|
-
private _dbName;
|
|
50
|
-
private _version;
|
|
51
|
-
constructor(dbName?: string, version?: number);
|
|
52
|
-
open(): Promise<IDBDatabase>;
|
|
53
|
-
close(): void;
|
|
54
|
-
saveSession(data: SessionData): Promise<void>;
|
|
55
|
-
loadSession(userId: string, appId: string, sessionId: string): Promise<SessionData | null>;
|
|
56
|
-
saveContext(data: ContextData): Promise<void>;
|
|
57
|
-
loadContext(sessionId: string, threadId: string): Promise<ContextData | null>;
|
|
58
|
-
/**
|
|
59
|
-
* Delete all context entries for a session whose threadId is lexicographically
|
|
60
|
-
* greater than the given threadId. Used during rollback to prune future branches.
|
|
61
|
-
*
|
|
62
|
-
* Thread IDs are UUIDv7 (lexicographically sortable by time), so string
|
|
63
|
-
* comparison is sufficient.
|
|
64
|
-
*/
|
|
65
|
-
deleteContextsAfterThread(sessionId: string, threadId: string): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Load the most recent context for a session (latest threadId).
|
|
68
|
-
* Uses lexicographic ordering of UUIDv7 threadIds for chronological sort.
|
|
69
|
-
*/
|
|
70
|
-
loadLatestContext(sessionId: string): Promise<ContextData | null>;
|
|
71
|
-
savePayload(data: PayloadData): Promise<void>;
|
|
72
|
-
loadPayload(threadId: string, messageId: string): Promise<PayloadData | null>;
|
|
73
|
-
loadPayloadsByThread(threadId: string): Promise<PayloadData[]>;
|
|
74
|
-
saveFavorite(data: FavoriteData): Promise<void>;
|
|
75
|
-
removeFavorite(userId: string, appId: string, sku: string): Promise<void>;
|
|
76
|
-
loadFavorites(userId: string, appId: string): Promise<FavoriteData[]>;
|
|
77
|
-
isFavorite(userId: string, appId: string, sku: string): Promise<boolean>;
|
|
78
|
-
private _requireDb;
|
|
79
|
-
}
|
package/dist/common/locale.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function resolveLocaleTag(locale: string | null | undefined): string;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { OverlayWidgetsController, OverlayWidgetsOptions } from './overlay.js';
|
|
2
|
-
export declare const DEFAULT_NATIVE_TRACKED_EVENTS: readonly ["gengage:chat:open", "gengage:chat:close", "gengage:chat:ready", "gengage:chat:add-to-cart", "gengage:qna:action", "gengage:qna:open-chat", "gengage:similar:product-click", "gengage:similar:grouping-click", "gengage:similar:products-impression", "gengage:similar:add-to-cart", "gengage:global:error", "gengage:context:update"];
|
|
3
|
-
export type NativeTrackedEvent = (typeof DEFAULT_NATIVE_TRACKED_EVENTS)[number];
|
|
4
|
-
export type NativeInboundMessage = 'openChat' | 'closeChat' | 'updateContext' | 'updatePageContext' | 'setPageContext' | 'updateSku' | 'setSession' | 'destroy';
|
|
5
|
-
export type NativeBridgeEnvironment = 'ios' | 'android' | 'react-native' | 'browser';
|
|
6
|
-
export interface NativeSessionPayload {
|
|
7
|
-
sessionId?: string;
|
|
8
|
-
userId?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface NativeBridgeMessage {
|
|
11
|
-
type: string;
|
|
12
|
-
payload?: unknown;
|
|
13
|
-
}
|
|
14
|
-
export interface NativeWebViewBridgeOptions {
|
|
15
|
-
iosHandlerName?: string;
|
|
16
|
-
androidInterfaceName?: string;
|
|
17
|
-
reactNativeInterfaceName?: string;
|
|
18
|
-
trackedEvents?: NativeTrackedEvent[] | string[];
|
|
19
|
-
/** Log unhandled inbound message types to console in addition to forwarding to postMessage. */
|
|
20
|
-
logUnhandled?: boolean;
|
|
21
|
-
/** Injected for tests; defaults to global window. */
|
|
22
|
-
win?: Window;
|
|
23
|
-
}
|
|
24
|
-
export interface NativeWebViewBridge {
|
|
25
|
-
readonly env: NativeBridgeEnvironment;
|
|
26
|
-
sendToNative(type: string, payload?: unknown): void;
|
|
27
|
-
receive(message: NativeBridgeMessage | string): void;
|
|
28
|
-
setController(controller: OverlayWidgetsController | null): void;
|
|
29
|
-
destroy(): void;
|
|
30
|
-
}
|
|
31
|
-
export interface NativeOverlayInitOptions extends OverlayWidgetsOptions {
|
|
32
|
-
nativeBridge?: Omit<NativeWebViewBridgeOptions, 'win'>;
|
|
33
|
-
emitReadyEvent?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface NativeOverlayInitResult {
|
|
36
|
-
controller: OverlayWidgetsController;
|
|
37
|
-
bridge: NativeWebViewBridge;
|
|
38
|
-
destroy(): void;
|
|
39
|
-
}
|
|
40
|
-
export declare function detectNativeEnvironment(options?: Pick<NativeWebViewBridgeOptions, 'iosHandlerName' | 'androidInterfaceName' | 'reactNativeInterfaceName' | 'win'>): NativeBridgeEnvironment;
|
|
41
|
-
/**
|
|
42
|
-
* Applies native-provided session identity so widgets can share correlation IDs
|
|
43
|
-
* with the host app. Safe to call before or after widget initialization.
|
|
44
|
-
*/
|
|
45
|
-
export declare function applyNativeSession(payload: NativeSessionPayload, options?: Pick<NativeWebViewBridgeOptions, 'win'>): void;
|
|
46
|
-
/**
|
|
47
|
-
* Installs a native WebView bridge compatible with:
|
|
48
|
-
* - iOS WKWebView (`webkit.messageHandlers`)
|
|
49
|
-
* - Android JavascriptInterface (`window.GengageNative`)
|
|
50
|
-
* - React Native WebView (`window.ReactNativeWebView`)
|
|
51
|
-
* and exposes it on `window.gengageNative`.
|
|
52
|
-
*/
|
|
53
|
-
export declare function createNativeWebViewBridge(options?: NativeWebViewBridgeOptions): NativeWebViewBridge;
|
|
54
|
-
/**
|
|
55
|
-
* Convenience helper for mobile WebViews:
|
|
56
|
-
* 1) installs native bridge
|
|
57
|
-
* 2) initializes overlay widgets
|
|
58
|
-
* 3) sends a `ready` message to native
|
|
59
|
-
*/
|
|
60
|
-
export declare function initNativeOverlayWidgets(options: NativeOverlayInitOptions): Promise<NativeOverlayInitResult>;
|
package/dist/common/overlay.d.ts
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { GengageChat } from '../chat/runtime.js';
|
|
2
|
-
import { ChatI18n, ChatWidgetConfig } from '../chat/types.js';
|
|
3
|
-
import { GengageQNA } from '../qna/runtime.js';
|
|
4
|
-
import { QNAWidgetConfig } from '../qna/types.js';
|
|
5
|
-
import { GengageSimRel } from '../simrel/runtime.js';
|
|
6
|
-
import { SimRelWidgetConfig } from '../simrel/types.js';
|
|
7
|
-
import { GengageSimBut } from '../simbut/index.js';
|
|
8
|
-
import { SimButWidgetConfig } from '../simbut/types.js';
|
|
9
|
-
import { PageContext, SessionContext, WidgetTheme } from './types.js';
|
|
10
|
-
export interface OverlayChatOptions {
|
|
11
|
-
enabled?: boolean;
|
|
12
|
-
variant?: ChatWidgetConfig['variant'];
|
|
13
|
-
mountTarget?: HTMLElement | string;
|
|
14
|
-
launcherSvg?: string;
|
|
15
|
-
launcherImageUrl?: string;
|
|
16
|
-
mobileLauncherImageUrl?: string;
|
|
17
|
-
headerTitle?: string;
|
|
18
|
-
headerAvatarUrl?: string;
|
|
19
|
-
headerBadge?: string;
|
|
20
|
-
headerCartUrl?: string;
|
|
21
|
-
headerFavoritesToggle?: boolean;
|
|
22
|
-
/** Opens merchant favorites page (passed to chat `onFavoritesClick`). */
|
|
23
|
-
onFavoritesClick?: () => void;
|
|
24
|
-
hideMobileLauncher?: boolean;
|
|
25
|
-
mobileBreakpoint?: number;
|
|
26
|
-
mobileInitialState?: 'half' | 'full';
|
|
27
|
-
i18n?: Partial<ChatI18n>;
|
|
28
|
-
actionHandling?: ChatWidgetConfig['actionHandling'];
|
|
29
|
-
/** UISpec renderer overrides for chat components. */
|
|
30
|
-
renderer?: ChatWidgetConfig['renderer'];
|
|
31
|
-
/** When true, allow full product details in the assistant side panel; default is chat summary only. */
|
|
32
|
-
productDetailsExtended?: boolean;
|
|
33
|
-
/** Hides percent discount badges on chat product cards / details when true. */
|
|
34
|
-
hideProductDiscountBadge?: ChatWidgetConfig['hideProductDiscountBadge'];
|
|
35
|
-
/** When true, hides user reviews (ReviewHighlights, review chip, AITopPicks reviewHighlight). */
|
|
36
|
-
hideUserReviews?: ChatWidgetConfig['hideUserReviews'];
|
|
37
|
-
/** When true, hides in-stock / out-of-stock labels on product cards. */
|
|
38
|
-
hideStockStatus?: ChatWidgetConfig['hideStockStatus'];
|
|
39
|
-
isDemoWebsite?: ChatWidgetConfig['isDemoWebsite'];
|
|
40
|
-
/** Pill launcher — forwarded to `chat.pillLauncher` (applied inside GengageChat). */
|
|
41
|
-
pillLauncher?: ChatWidgetConfig['pillLauncher'];
|
|
42
|
-
/** Search-bar style floating launcher — forwarded to `chat.floatingLauncher`. */
|
|
43
|
-
floatingLauncher?: ChatWidgetConfig['floatingLauncher'];
|
|
44
|
-
/** Dynamic launcher positioning relative to page elements. */
|
|
45
|
-
launcherAnchor?: ChatWidgetConfig['launcherAnchor'];
|
|
46
|
-
/** Called when the chat panel opens. */
|
|
47
|
-
onOpen?: () => void;
|
|
48
|
-
/** Called when the chat panel closes. */
|
|
49
|
-
onClose?: () => void;
|
|
50
|
-
productPriceUi?: ChatWidgetConfig['productPriceUi'];
|
|
51
|
-
}
|
|
52
|
-
export interface OverlayQNAOptions {
|
|
53
|
-
enabled?: boolean;
|
|
54
|
-
mountTarget?: HTMLElement | string;
|
|
55
|
-
chrome?: QNAWidgetConfig['chrome'];
|
|
56
|
-
ctaText?: string;
|
|
57
|
-
hideButtonRowCta?: boolean;
|
|
58
|
-
inputPlaceholder?: QNAWidgetConfig['inputPlaceholder'];
|
|
59
|
-
inputAfterPills?: QNAWidgetConfig['inputAfterPills'];
|
|
60
|
-
i18n?: QNAWidgetConfig['i18n'];
|
|
61
|
-
/** UISpec renderer overrides for QNA components. */
|
|
62
|
-
renderer?: QNAWidgetConfig['renderer'];
|
|
63
|
-
/**
|
|
64
|
-
* Q&A panel heading (e.g. "Koçtaş'a Sor"). Independent from `chat.headerTitle`.
|
|
65
|
-
* If omitted, falls back to the deprecated `headingTitle` field.
|
|
66
|
-
* Set this explicitly — it does not inherit from `chat.headerTitle`.
|
|
67
|
-
*/
|
|
68
|
-
headerTitle?: string;
|
|
69
|
-
/** @deprecated Use `headerTitle` */
|
|
70
|
-
headingTitle?: string;
|
|
71
|
-
}
|
|
72
|
-
export interface OverlaySimRelOptions {
|
|
73
|
-
enabled?: boolean;
|
|
74
|
-
mountTarget?: HTMLElement | string;
|
|
75
|
-
discountType?: SimRelWidgetConfig['discountType'];
|
|
76
|
-
gridColumns?: SimRelWidgetConfig['gridColumns'];
|
|
77
|
-
/** Custom card element renderer for the direct rendering path (GroupTabs/ProductGrid). */
|
|
78
|
-
renderCardElement?: SimRelWidgetConfig['renderCardElement'];
|
|
79
|
-
/** UISpec renderer overrides for simrel components. */
|
|
80
|
-
renderer?: SimRelWidgetConfig['renderer'];
|
|
81
|
-
}
|
|
82
|
-
export interface OverlaySimButOptions {
|
|
83
|
-
enabled?: boolean;
|
|
84
|
-
mountTarget?: HTMLElement | string;
|
|
85
|
-
layout?: SimButWidgetConfig['layout'];
|
|
86
|
-
inlineCard?: SimButWidgetConfig['inlineCard'];
|
|
87
|
-
/** `findSimilar` yüküne eklenecek ürün görseli URL’si. */
|
|
88
|
-
imageUrl?: string;
|
|
89
|
-
i18n?: SimButWidgetConfig['i18n'];
|
|
90
|
-
/** Chat kapalıyken veya özel davranış için; tanımlıysa tıklamada `chat` yerine bu çağrılır. */
|
|
91
|
-
onFindSimilar?: SimButWidgetConfig['onFindSimilar'];
|
|
92
|
-
}
|
|
93
|
-
export interface OverlayWidgetsOptions {
|
|
94
|
-
accountId: string;
|
|
95
|
-
middlewareUrl: string;
|
|
96
|
-
locale?: string;
|
|
97
|
-
session?: Partial<SessionContext>;
|
|
98
|
-
pageContext?: Partial<PageContext>;
|
|
99
|
-
sku?: string;
|
|
100
|
-
theme?: WidgetTheme;
|
|
101
|
-
/** Backward-compatible alias for `chat.isDemoWebsite`. */
|
|
102
|
-
isDemoWebsite?: ChatWidgetConfig['isDemoWebsite'];
|
|
103
|
-
/** Backward-compatible alias for `chat.productDetailsExtended`. */
|
|
104
|
-
productDetailsExtended?: ChatWidgetConfig['productDetailsExtended'];
|
|
105
|
-
/** Price formatting options. Defaults to Turkish locale. */
|
|
106
|
-
pricing?: import('./price-formatter.js').PriceFormatConfig;
|
|
107
|
-
idempotencyKey?: string;
|
|
108
|
-
wireQnaToChat?: boolean;
|
|
109
|
-
chat?: OverlayChatOptions;
|
|
110
|
-
qna?: OverlayQNAOptions;
|
|
111
|
-
simrel?: OverlaySimRelOptions;
|
|
112
|
-
simbut?: OverlaySimButOptions;
|
|
113
|
-
onAddToCart?: (params: import('./types.js').AddToCartParams) => void;
|
|
114
|
-
onProductNavigate?: SimRelWidgetConfig['onProductNavigate'];
|
|
115
|
-
onScriptCall?: ChatWidgetConfig['onScriptCall'];
|
|
116
|
-
}
|
|
117
|
-
export interface OverlayWidgetsController {
|
|
118
|
-
readonly idempotencyKey: string;
|
|
119
|
-
readonly session: SessionContext;
|
|
120
|
-
readonly chat: GengageChat | null;
|
|
121
|
-
readonly qna: GengageQNA | null;
|
|
122
|
-
readonly simrel: GengageSimRel | null;
|
|
123
|
-
readonly simbut: GengageSimBut | null;
|
|
124
|
-
/** Shared analytics client for custom event tracking (null if not configured). */
|
|
125
|
-
readonly analyticsClient: import('./analytics.js').AnalyticsClient | null;
|
|
126
|
-
openChat(options?: {
|
|
127
|
-
state?: 'half' | 'full';
|
|
128
|
-
}): void;
|
|
129
|
-
closeChat(): void;
|
|
130
|
-
/**
|
|
131
|
-
* Merges partial page context (SKU, page type, category, …) into the active
|
|
132
|
-
* widgets. Use after SPA navigation so chat and PDP stay aligned.
|
|
133
|
-
*/
|
|
134
|
-
updateContext(patch: Partial<PageContext>): Promise<void>;
|
|
135
|
-
/** @see {@link updateContext} */
|
|
136
|
-
updatePageContext(patch: Partial<PageContext>): Promise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* Merge-only page context update. This is an alias of {@link updateContext},
|
|
139
|
-
* not a full replacement of the existing PageContext.
|
|
140
|
-
*/
|
|
141
|
-
setPageContext(patch: Partial<PageContext>): Promise<void>;
|
|
142
|
-
updateSku(sku: string, pageType?: PageContext['pageType']): Promise<void>;
|
|
143
|
-
destroy(): void;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Initialize chat, QNA, SimRel, and optional SimBut (PDP image “find similar” pill) in one call.
|
|
147
|
-
* Idempotent — safe to call multiple times from GTM; deduplicates by account + SKU key.
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* import { initOverlayWidgets } from '@gengage/assistant-fe/overlay';
|
|
152
|
-
*
|
|
153
|
-
* const controller = await initOverlayWidgets({
|
|
154
|
-
* accountId: 'mystore',
|
|
155
|
-
* middlewareUrl: '<backend service location provided for your Gengage account>',
|
|
156
|
-
* sku: window.productSku,
|
|
157
|
-
* pageContext: { pageType: 'pdp' },
|
|
158
|
-
* chat: { variant: 'floating' },
|
|
159
|
-
* qna: { mountTarget: '#qna-section' },
|
|
160
|
-
* simrel: { mountTarget: '#similar-products' },
|
|
161
|
-
* simbut: { mountTarget: '#pdp-image-wrap' },
|
|
162
|
-
* });
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
export declare function initOverlayWidgets(options: OverlayWidgetsOptions): Promise<OverlayWidgetsController>;
|
|
166
|
-
export declare function getOverlayWidgets(idempotencyKey: string): OverlayWidgetsController | null;
|
|
167
|
-
export declare function destroyOverlayWidgets(idempotencyKey: string): void;
|
|
168
|
-
export declare function buildOverlayIdempotencyKey(accountId: string): string;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { PageContext } from './types.js';
|
|
2
|
-
export type DetectablePageType = PageContext['pageType'];
|
|
3
|
-
export interface PageDetectionRule {
|
|
4
|
-
/** Page type to assign when this rule matches. */
|
|
5
|
-
pageType: DetectablePageType;
|
|
6
|
-
/** URL pathname patterns (tested with `new RegExp(pattern)`). */
|
|
7
|
-
urlPatterns?: string[];
|
|
8
|
-
/** If present, page type is detected only when this query param exists. */
|
|
9
|
-
queryParam?: string;
|
|
10
|
-
/** DOM selector — if an element matching this exists, rule matches. */
|
|
11
|
-
selector?: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Detects page type from the current URL and optional DOM signals.
|
|
15
|
-
*
|
|
16
|
-
* @param rules - Custom rules (defaults to common Turkish e-commerce patterns).
|
|
17
|
-
* @param url - URL to analyze (defaults to window.location).
|
|
18
|
-
* @returns Detected page type, or 'other' if no rule matches.
|
|
19
|
-
*/
|
|
20
|
-
export declare function detectPageType(rules?: PageDetectionRule[], url?: URL): DetectablePageType;
|
|
21
|
-
/**
|
|
22
|
-
* Attempts to extract a product SKU from the URL path.
|
|
23
|
-
* Looks for common patterns like `/p/SKU`, `/urun/SKU`, `/-p-SKU`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function extractSkuFromUrl(url?: URL): string | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Auto-detects page context from URL and DOM signals.
|
|
28
|
-
* Use as a fallback when the host page doesn't set pageContext explicitly.
|
|
29
|
-
*/
|
|
30
|
-
export declare function autoDetectPageContext(rules?: PageDetectionRule[]): Partial<PageContext>;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* makePillLauncher — creates a pill-shaped chat launcher that combines an
|
|
3
|
-
* avatar image with a text label, replacing the default circular FAB.
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
* });
|
|
7
|
-
*
|
|
8
|
-
* Or call `makePillLauncher` + `apply()` manually when you need custom control.
|
|
9
|
-
*/
|
|
10
|
-
export interface PillLauncherOptions {
|
|
11
|
-
/** Text label shown beside the avatar inside the pill */
|
|
12
|
-
label: string;
|
|
13
|
-
/** Avatar image URL — also used as `launcherImageUrl` to activate image-mode */
|
|
14
|
-
avatarUrl: string;
|
|
15
|
-
/** Brand primary color — used for border and hover effects */
|
|
16
|
-
primaryColor: string;
|
|
17
|
-
/** Dark text / shadow color for the label and drop shadow (default: '#111827') */
|
|
18
|
-
secondaryColor?: string;
|
|
19
|
-
/** CSS font-family string for the label text */
|
|
20
|
-
fontFamily?: string;
|
|
21
|
-
/** CSS class name injected on the label span (default: 'gengage-pill-launcher-label') */
|
|
22
|
-
labelClassName?: string;
|
|
23
|
-
/** id for the <style> tag injected into the shadow root (default: 'gengage-pill-launcher-style') */
|
|
24
|
-
styleId?: string;
|
|
25
|
-
/** Mobile breakpoint in px (default: 768) */
|
|
26
|
-
mobileBreakpoint?: number;
|
|
27
|
-
/** Desktop pill width (default: '188px') */
|
|
28
|
-
desktopWidth?: string;
|
|
29
|
-
/** Desktop pill height (default: '60px') */
|
|
30
|
-
desktopHeight?: string;
|
|
31
|
-
/** Avatar icon diameter (default: '46px') */
|
|
32
|
-
iconSize?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface PillLauncherKit {
|
|
35
|
-
/**
|
|
36
|
-
* Pass as `chat.launcherImageUrl` to `initOverlayWidgets`.
|
|
37
|
-
* Equals `avatarUrl` — activates image-mode on the launcher button.
|
|
38
|
-
*/
|
|
39
|
-
launcherImageUrl: string;
|
|
40
|
-
/**
|
|
41
|
-
* Call after `initOverlayWidgets` resolves.
|
|
42
|
-
* Injects pill CSS into the widget shadow root, fixes the header avatar
|
|
43
|
-
* class, and appends the text label span to the launcher button.
|
|
44
|
-
* Retries via requestAnimationFrame for up to ~1.5 s.
|
|
45
|
-
*
|
|
46
|
-
* Pass the widget's shadow root when it is available to avoid a global DOM
|
|
47
|
-
* scan — required when multiple GengageChat instances share the same page.
|
|
48
|
-
*/
|
|
49
|
-
apply(targetShadow?: ShadowRoot): Promise<void>;
|
|
50
|
-
}
|
|
51
|
-
export declare function makePillLauncher(options: PillLauncherOptions): PillLauncherKit;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AccountRuntimeConfig } from './config-schema.js';
|
|
2
|
-
export interface PreflightWarning {
|
|
3
|
-
code: string;
|
|
4
|
-
message: string;
|
|
5
|
-
severity: 'warn' | 'error';
|
|
6
|
-
}
|
|
7
|
-
export interface PreflightResult {
|
|
8
|
-
ok: boolean;
|
|
9
|
-
warnings: PreflightWarning[];
|
|
10
|
-
}
|
|
11
|
-
export declare function preflightDiagnostics(config: AccountRuntimeConfig, options?: {
|
|
12
|
-
skipCspCheck?: boolean;
|
|
13
|
-
}): PreflightResult;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configurable price formatting.
|
|
3
|
-
*
|
|
4
|
-
* Defaults to Turkish locale (dot thousands, comma decimal, TL suffix),
|
|
5
|
-
* but renders whole TL amounts without kurus for a cleaner retail UI.
|
|
6
|
-
* Configure via widget config `pricing` field for any locale/currency.
|
|
7
|
-
*/
|
|
8
|
-
export interface PriceFormatConfig {
|
|
9
|
-
/** ISO 4217 currency code (e.g. 'TRY', 'USD'). Used by analytics only — not consumed by formatPrice(). */
|
|
10
|
-
currencyCode?: string;
|
|
11
|
-
/** Currency symbol. Default: 'TL' */
|
|
12
|
-
currencySymbol?: string;
|
|
13
|
-
/** Where to place the symbol. Default: 'suffix' */
|
|
14
|
-
currencyPosition?: 'prefix' | 'suffix';
|
|
15
|
-
/** Separator between thousands. Default: '.' (Turkish) */
|
|
16
|
-
thousandsSeparator?: string;
|
|
17
|
-
/** Decimal point character. Default: ',' (Turkish) */
|
|
18
|
-
decimalSeparator?: string;
|
|
19
|
-
/** Whether to show decimal part for whole numbers. Default: false */
|
|
20
|
-
alwaysShowDecimals?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Formats a raw numeric price string into the configured locale format.
|
|
24
|
-
*
|
|
25
|
-
* Examples (default Turkish):
|
|
26
|
-
* "17990" → "17.990 TL"
|
|
27
|
-
* "17990.5" → "17.990,50 TL"
|
|
28
|
-
*
|
|
29
|
-
* Examples (GBP prefix):
|
|
30
|
-
* "17990" with { currencySymbol: '£', currencyPosition: 'prefix', thousandsSeparator: ',', decimalSeparator: '.' }
|
|
31
|
-
* → "£17,990"
|
|
32
|
-
*
|
|
33
|
-
* Returns the input as-is if it's not a valid number.
|
|
34
|
-
*/
|
|
35
|
-
export declare function formatPrice(raw: string, config?: PriceFormatConfig): string;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared product rendering utilities.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from chat/renderUISpec and simrel/ProductCard to eliminate
|
|
5
|
-
* duplication and provide consistent behavior across all widgets.
|
|
6
|
-
*/
|
|
7
|
-
/** Clamp a rating value to the 0–5 range. Returns 0 for NaN/non-finite. */
|
|
8
|
-
export declare function clampRating(value: number): number;
|
|
9
|
-
/** Clamp a discount percentage to the 0–100 range, rounded to integer. Returns 0 for NaN/non-finite. */
|
|
10
|
-
export declare function clampDiscount(value: number): number;
|
|
11
|
-
/**
|
|
12
|
-
* Render a star rating string with full, half, and empty stars.
|
|
13
|
-
*
|
|
14
|
-
* @param rating - A numeric rating (will be clamped to 0–5).
|
|
15
|
-
* @param halfStars - Whether to render half-star characters. Defaults to true.
|
|
16
|
-
* @returns A string like "★★★½☆" or "★★★☆☆" (without half-stars).
|
|
17
|
-
*/
|
|
18
|
-
export declare function renderStarRating(rating: number, halfStars?: boolean): string;
|
|
19
|
-
/**
|
|
20
|
-
* Create a star rating DOM element with proper half-filled star rendering.
|
|
21
|
-
*
|
|
22
|
-
* Uses a CSS-clipped full star overlaid on an empty star for the half-star,
|
|
23
|
-
* giving a visually accurate half-filled appearance instead of the "½" character.
|
|
24
|
-
*
|
|
25
|
-
* @param rating - A numeric rating (will be clamped to 0–5).
|
|
26
|
-
* @returns An HTMLSpanElement containing the star icons.
|
|
27
|
-
*/
|
|
28
|
-
export declare function createStarRatingElement(rating: number): HTMLSpanElement;
|
|
29
|
-
/**
|
|
30
|
-
* Attach a one-time error handler that hides the image on load failure.
|
|
31
|
-
*
|
|
32
|
-
* Works with any HTMLImageElement. Hides the element by setting
|
|
33
|
-
* `display: none` so layout doesn't break from broken images.
|
|
34
|
-
*/
|
|
35
|
-
export declare function addImageErrorHandler(img: HTMLImageElement): void;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { StreamEvent } from './types.js';
|
|
2
|
-
export interface V1Product {
|
|
3
|
-
sku: string;
|
|
4
|
-
name: string;
|
|
5
|
-
brand?: string;
|
|
6
|
-
images?: string[];
|
|
7
|
-
price?: number;
|
|
8
|
-
price_discounted?: number;
|
|
9
|
-
price_discount_rate?: number;
|
|
10
|
-
price_currency?: string;
|
|
11
|
-
discount_reason?: string;
|
|
12
|
-
url?: string;
|
|
13
|
-
rating?: number;
|
|
14
|
-
review_count?: number;
|
|
15
|
-
cart_code?: string;
|
|
16
|
-
in_stock?: boolean;
|
|
17
|
-
description?: string;
|
|
18
|
-
description_html?: string;
|
|
19
|
-
features?: Array<{
|
|
20
|
-
name?: string;
|
|
21
|
-
key?: string;
|
|
22
|
-
value?: string | number | boolean;
|
|
23
|
-
[key: string]: unknown;
|
|
24
|
-
}>;
|
|
25
|
-
specifications?: Record<string, string> | Array<{
|
|
26
|
-
key: string;
|
|
27
|
-
value: string;
|
|
28
|
-
}>;
|
|
29
|
-
short_name?: string;
|
|
30
|
-
category_ids?: string[];
|
|
31
|
-
category_names?: string[];
|
|
32
|
-
variants?: Array<Record<string, unknown>>;
|
|
33
|
-
facet_hits?: Record<string, unknown> | null;
|
|
34
|
-
promotions?: string[];
|
|
35
|
-
}
|
|
36
|
-
export interface V1ProsAndCons {
|
|
37
|
-
type: 'prosAndCons';
|
|
38
|
-
payload: {
|
|
39
|
-
pros?: string[];
|
|
40
|
-
cons?: string[];
|
|
41
|
-
product_name?: string;
|
|
42
|
-
[key: string]: unknown;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export declare function adaptBackendEvent(raw: Record<string, unknown>): StreamEvent | null;
|
|
46
|
-
export interface NormalizedProduct {
|
|
47
|
-
sku: string;
|
|
48
|
-
name: string;
|
|
49
|
-
imageUrl?: string;
|
|
50
|
-
images?: string[];
|
|
51
|
-
price?: string;
|
|
52
|
-
originalPrice?: string;
|
|
53
|
-
discountPercent?: number;
|
|
54
|
-
url: string;
|
|
55
|
-
brand?: string;
|
|
56
|
-
rating?: number;
|
|
57
|
-
reviewCount?: number;
|
|
58
|
-
cartCode?: string;
|
|
59
|
-
inStock?: boolean;
|
|
60
|
-
variants?: Array<Record<string, unknown>>;
|
|
61
|
-
discountReason?: string;
|
|
62
|
-
promotions?: string[];
|
|
63
|
-
description?: string;
|
|
64
|
-
descriptionHtml?: string;
|
|
65
|
-
features?: Array<{
|
|
66
|
-
name?: string;
|
|
67
|
-
key?: string;
|
|
68
|
-
value?: string | number | boolean;
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
}>;
|
|
71
|
-
specifications?: Record<string, string> | Array<{
|
|
72
|
-
key: string;
|
|
73
|
-
value: string;
|
|
74
|
-
}>;
|
|
75
|
-
facetHits?: Record<string, unknown>;
|
|
76
|
-
categoryNames?: string[];
|
|
77
|
-
shortName?: string;
|
|
78
|
-
/** Pass-through bag for backend fields not consumed by the SDK. */
|
|
79
|
-
extras?: Record<string, unknown>;
|
|
80
|
-
}
|
|
81
|
-
export declare function productToNormalized(p: V1Product): NormalizedProduct;
|
|
82
|
-
export interface SimilarProductsJsonResponse {
|
|
83
|
-
results: V1Product[];
|
|
84
|
-
count: number;
|
|
85
|
-
source_sku?: string;
|
|
86
|
-
}
|
|
87
|
-
export interface ProductGroupingsJsonResponse {
|
|
88
|
-
intro_message?: string;
|
|
89
|
-
product_groupings: Array<{
|
|
90
|
-
name: string;
|
|
91
|
-
description?: string;
|
|
92
|
-
highlight?: string;
|
|
93
|
-
repr_sku?: string;
|
|
94
|
-
repr_image?: string;
|
|
95
|
-
group_skus?: string[];
|
|
96
|
-
group_products?: V1Product[];
|
|
97
|
-
}>;
|
|
98
|
-
count: number;
|
|
99
|
-
}
|
|
100
|
-
export declare function normalizeSimilarProductsResponse(json: SimilarProductsJsonResponse): NormalizedProduct[];
|
|
101
|
-
export declare function normalizeProductGroupingsResponse(json: ProductGroupingsJsonResponse): Array<{
|
|
102
|
-
name: string;
|
|
103
|
-
highlight?: string;
|
|
104
|
-
products: NormalizedProduct[];
|
|
105
|
-
}>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { UISpecDomUnknownRenderer, RenderUISpecWithRegistryOptions } from './types.js';
|
|
2
|
-
export declare const defaultUnknownUISpecRenderer: UISpecDomUnknownRenderer<unknown>;
|
|
3
|
-
export declare function renderUISpecWithRegistry<TContext>(options: RenderUISpecWithRegistryOptions<TContext>): HTMLElement;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { renderUISpecWithRegistry, defaultUnknownUISpecRenderer } from './dom.js';
|
|
2
|
-
export { mergeUISpecRegistry } from './registry.js';
|
|
3
|
-
export type { UISpecRenderHelpers, UISpecRendererOverrides } from './overrides.js';
|
|
4
|
-
export type { UISpecDomComponentRenderParams, UISpecDomComponentRenderer, UISpecDomRegistry, UISpecDomUnknownRendererParams, UISpecDomUnknownRenderer, RenderUISpecWithRegistryOptions, } from './types.js';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { UISpec } from '../types.js';
|
|
2
|
-
import { UISpecDomRegistry, UISpecDomUnknownRenderer } from './types.js';
|
|
3
|
-
export interface UISpecRenderHelpers<TContext> {
|
|
4
|
-
registry: UISpecDomRegistry<TContext>;
|
|
5
|
-
unknownRenderer?: UISpecDomUnknownRenderer<TContext>;
|
|
6
|
-
defaultRender: (spec: UISpec, context: TContext) => HTMLElement;
|
|
7
|
-
}
|
|
8
|
-
export interface UISpecRendererOverrides<TContext> {
|
|
9
|
-
/**
|
|
10
|
-
* Component-level overrides. Merged on top of the widget's default registry.
|
|
11
|
-
*/
|
|
12
|
-
registry?: Partial<UISpecDomRegistry<TContext>>;
|
|
13
|
-
/**
|
|
14
|
-
* Optional fallback for unknown component types.
|
|
15
|
-
* Defaults to the widget's built-in unknown renderer.
|
|
16
|
-
*/
|
|
17
|
-
unknownRenderer?: UISpecDomUnknownRenderer<TContext>;
|
|
18
|
-
/**
|
|
19
|
-
* Full UISpec rendering override.
|
|
20
|
-
* Use this to replace the default rendering methodology entirely.
|
|
21
|
-
*/
|
|
22
|
-
renderUISpec?: (spec: UISpec, context: TContext, helpers: UISpecRenderHelpers<TContext>) => HTMLElement;
|
|
23
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { UISpec, UIElement } from '../types.js';
|
|
2
|
-
export interface UISpecDomComponentRenderParams<TContext> {
|
|
3
|
-
elementId: string;
|
|
4
|
-
element: UIElement;
|
|
5
|
-
spec: UISpec;
|
|
6
|
-
context: TContext;
|
|
7
|
-
renderElement: (elementId: string) => HTMLElement | null;
|
|
8
|
-
}
|
|
9
|
-
export type UISpecDomComponentRenderer<TContext> = (params: UISpecDomComponentRenderParams<TContext>) => HTMLElement | null;
|
|
10
|
-
export type UISpecDomRegistry<TContext> = Record<string, UISpecDomComponentRenderer<TContext>>;
|
|
11
|
-
export type UISpecDomUnknownRendererParams<TContext> = UISpecDomComponentRenderParams<TContext>;
|
|
12
|
-
export type UISpecDomUnknownRenderer<TContext> = (params: UISpecDomUnknownRendererParams<TContext>) => HTMLElement | null;
|
|
13
|
-
export interface RenderUISpecWithRegistryOptions<TContext> {
|
|
14
|
-
spec: UISpec;
|
|
15
|
-
context: TContext;
|
|
16
|
-
registry: UISpecDomRegistry<TContext>;
|
|
17
|
-
containerClassName: string;
|
|
18
|
-
unknownRenderer?: UISpecDomUnknownRenderer<TContext>;
|
|
19
|
-
}
|