@gengage/assistant-fe 0.6.50 → 0.7.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/chat/api.d.ts +1 -1
- package/dist/chat/components/ChatDrawer.d.ts +3 -1
- package/dist/chat/features/beauty-consulting/mode-controller.d.ts +1 -1
- package/dist/chat/features/beauty-consulting/stream-handler.d.ts +7 -1
- package/dist/chat/history-storage.d.ts +36 -4
- package/dist/chat/runtime.d.ts +2 -2
- package/dist/chat/utils/chat-presentation-debug.d.ts +0 -14
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +56 -56
- package/dist/chat.js +1 -1
- package/dist/common/connection-warning.d.ts +10 -0
- package/dist/common/indexed-db.d.ts +35 -2
- package/dist/common/native-webview.d.ts +1 -1
- package/dist/common/streaming.d.ts +6 -1
- package/dist/common/transport.d.ts +2 -1
- package/dist/common/types.d.ts +16 -0
- package/dist/{common-DJFI5t11.js → common-CeuGSwJL.js} +61 -65
- package/dist/common.js +30 -30
- package/dist/{connection-warning-TXqyeFaf.js → connection-warning-C0e2byq5.js} +31 -25
- package/dist/{fastIntent-539wPavr.js → fastIntent-BI7l1oDv.js} +2 -2
- package/dist/global-error-toast-DvaKvPNA.js +798 -0
- package/dist/index.js +29 -29
- package/dist/native-webview-CHKpwixw.js +303 -0
- package/dist/native.iife.js +27 -27
- package/dist/native.js +1 -1
- package/dist/{overlay-BPZEIyo_.js → overlay-C3XzoSKd.js} +51 -32
- package/dist/overlay.js +6 -6
- package/dist/{price-formatter-CHUmYq8I.js → price-formatter-Q3wUKrl1.js} +2 -1
- package/dist/qna/runtime.d.ts +1 -0
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +32 -32
- package/dist/qna.js +1 -1
- package/dist/{request-response-cache-DwADBDeB.js → request-response-cache-BLQy7llq.js} +478 -454
- package/dist/{runtime-Do3qShrH.js → runtime-BC8-a6Ql.js} +231 -219
- package/dist/{runtime-9f9SB4WE.js → runtime-BSIrZhF2.js} +2783 -2692
- package/dist/{runtime-rTw1jMhB.js → runtime-DiONTdBz.js} +230 -212
- package/dist/{simbut-DlWvDoPI.js → simbut-BDbb3nMH.js} +5 -5
- package/dist/simbut.iife.js +2 -2
- package/dist/simbut.js +1 -1
- package/dist/simrel/components/GroupTabs.d.ts +6 -0
- package/dist/simrel/runtime.d.ts +8 -0
- package/dist/{simrel-BFPU2n5p.js → simrel-CdxDIKu3.js} +15 -15
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +22 -22
- package/dist/simrel.js +2 -2
- package/dist/widget-base-Cvxdrqqt.js +141 -0
- package/package.json +1 -1
- package/dist/context-UTzCGyR9.js +0 -543
- package/dist/native-webview-CYX30O3Q.js +0 -273
- package/dist/widget-base-BwU6SI2o.js +0 -365
package/dist/chat/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChatTransportConfig } from '../common/api-paths.js';
|
|
2
2
|
import type { ActionEnrichmentContext, ProcessActionRequest, StreamCallbacks } from '../common/transport.js';
|
|
3
|
-
export type { ActionEnrichmentContext, BackendRequestMeta,
|
|
3
|
+
export type { ActionEnrichmentContext, BackendRequestMeta, ProcessActionRequest, StreamCallbacks, } from '../common/transport.js';
|
|
4
4
|
/**
|
|
5
5
|
* Enriches action payloads with fields the backend expects.
|
|
6
6
|
* Only adds fields that are not already present in the payload.
|
|
@@ -148,6 +148,7 @@ export declare class ChatDrawer {
|
|
|
148
148
|
private _beautyPhotoStepEl;
|
|
149
149
|
private _cartToastEl;
|
|
150
150
|
private _cartToastTimerId;
|
|
151
|
+
private _dragCloseTimerId;
|
|
151
152
|
private _renderPhotoAnalysisCard;
|
|
152
153
|
private _createLegacyHeaderPoweredBy;
|
|
153
154
|
private _createFooterAttribution;
|
|
@@ -326,7 +327,6 @@ export declare class ChatDrawer {
|
|
|
326
327
|
private _createLoadingSequence;
|
|
327
328
|
private _applyLoadingSteps;
|
|
328
329
|
private _normalizeLoadingSteps;
|
|
329
|
-
private _uniqueLoadingSteps;
|
|
330
330
|
private _clearLoadingBindingInterval;
|
|
331
331
|
private _destroyLoadingBinding;
|
|
332
332
|
private _updateSendEnabled;
|
|
@@ -373,6 +373,8 @@ export declare class ChatDrawer {
|
|
|
373
373
|
}>): void;
|
|
374
374
|
/** Clear input-area chips. */
|
|
375
375
|
clearInputAreaChips(): void;
|
|
376
|
+
/** Remove the active focus-trap keydown handler without restoring focus. */
|
|
377
|
+
private _detachTrapHandler;
|
|
376
378
|
/** Activate focus trap — Tab/Shift+Tab cycles within the drawer. */
|
|
377
379
|
trapFocus(): void;
|
|
378
380
|
/** Release the focus trap and restore previously focused element. */
|
|
@@ -40,7 +40,7 @@ export declare class AssistantModeController {
|
|
|
40
40
|
* Returns true if the mode actually switched.
|
|
41
41
|
*/
|
|
42
42
|
handleRedirect(redirectPayload: unknown): boolean;
|
|
43
|
-
/** Switch to a new assistant mode. */
|
|
43
|
+
/** Switch to a new assistant mode. No-op if already in that mode. */
|
|
44
44
|
switchMode(mode: AssistantMode): void;
|
|
45
45
|
/**
|
|
46
46
|
* Derive mode and ui_hints from a backend CONTEXT panel payload.
|
|
@@ -30,7 +30,13 @@ export interface BeautyStreamContext {
|
|
|
30
30
|
ensureRendered: () => void;
|
|
31
31
|
cancelTypewriter: () => void;
|
|
32
32
|
sendSkipMessage: () => void;
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Live getter for stream-completion state. Must be a getter (not a snapshot
|
|
35
|
+
* boolean) because the context is built early — while the stream is still
|
|
36
|
+
* open (streamDone === false) — but onSkip can fire after the stream finishes.
|
|
37
|
+
* A snapshot would always read false and silently drop the post-stream skip.
|
|
38
|
+
*/
|
|
39
|
+
isStreamDone: () => boolean;
|
|
34
40
|
}
|
|
35
41
|
/**
|
|
36
42
|
* Handle a beauty-specific UISpec component during stream processing.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BackendContext, UISpec } from '../common/types.js';
|
|
2
|
+
import type { GengageIndexedDB } from '../common/indexed-db.js';
|
|
2
3
|
import type { ChatMessage } from './types.js';
|
|
3
4
|
import type { PanelSource } from './panel-manager.js';
|
|
4
5
|
type LegacyThumbnailEntry = {
|
|
@@ -72,18 +73,49 @@ export interface SaveHistorySessionParams {
|
|
|
72
73
|
sku?: string | undefined;
|
|
73
74
|
attachmentPlaceholder?: string | undefined;
|
|
74
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The chat-history archive (past chat sessions).
|
|
78
|
+
*
|
|
79
|
+
* Backed by IndexedDB so bulk history is NOT kept in the origin-shared
|
|
80
|
+
* localStorage. A lightweight index is hydrated into memory at init so the
|
|
81
|
+
* history panel can list sessions synchronously; full records are read lazily
|
|
82
|
+
* (async `loadSession`) and writes go through to IndexedDB behind a small mutex.
|
|
83
|
+
* Existing localStorage history is migrated into IndexedDB once, on `hydrate()`.
|
|
84
|
+
*/
|
|
75
85
|
export declare class ChatHistoryStorage {
|
|
76
86
|
private readonly _appId;
|
|
77
87
|
private readonly _userId;
|
|
78
|
-
private readonly
|
|
88
|
+
private readonly _db;
|
|
89
|
+
private readonly _localStorage;
|
|
79
90
|
private readonly _scope;
|
|
80
|
-
|
|
91
|
+
/** Lightweight index, newest-first; the synchronous read surface. */
|
|
92
|
+
private _index;
|
|
93
|
+
private _hydrated;
|
|
94
|
+
/** Serializes write-through so concurrent saves/deletes don't race. */
|
|
95
|
+
private _writeChain;
|
|
96
|
+
constructor(_appId: string, _userId: string, _db: GengageIndexedDB | null, _localStorage?: Storage | null);
|
|
97
|
+
/**
|
|
98
|
+
* Migrate any legacy localStorage history into IndexedDB, then load the index
|
|
99
|
+
* into memory. Idempotent; safe to await once after the DB is open.
|
|
100
|
+
*/
|
|
101
|
+
hydrate(): Promise<void>;
|
|
81
102
|
createHistoryId(): string;
|
|
82
103
|
findSessionId(sourceSessionId: string, createdAt: string): string | null;
|
|
83
104
|
listSessions(): ChatHistoryIndexEntry[];
|
|
84
|
-
|
|
105
|
+
/** Resolves once all queued write-through operations have settled. */
|
|
106
|
+
flush(): Promise<void>;
|
|
107
|
+
loadSession(historyId: string): Promise<ChatHistorySessionRecord | null>;
|
|
108
|
+
/**
|
|
109
|
+
* Build and persist a history record. The record is built synchronously (it
|
|
110
|
+
* reads live panel DOM) and the in-memory index is updated synchronously so
|
|
111
|
+
* callers see it immediately; the IndexedDB write happens asynchronously
|
|
112
|
+
* behind the write mutex. Returns the built record, or null when there is
|
|
113
|
+
* nothing worth saving / no backing store.
|
|
114
|
+
*/
|
|
85
115
|
saveSession(params: SaveHistorySessionParams): ChatHistorySessionRecord | null;
|
|
86
116
|
deleteSession(historyId: string): void;
|
|
87
|
-
|
|
117
|
+
/** Queue a best-effort IndexedDB write; failures are swallowed (persistence is best-effort). */
|
|
118
|
+
private _enqueueWrite;
|
|
119
|
+
private _migrateFromLocalStorage;
|
|
88
120
|
}
|
|
89
121
|
export {};
|
package/dist/chat/runtime.d.ts
CHANGED
|
@@ -314,6 +314,7 @@ export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
|
|
|
314
314
|
private _flushQueuedUserMessages;
|
|
315
315
|
/** Apply ui_hints from the backend CONTEXT event — delegates to mode controller. */
|
|
316
316
|
private _applyUiHints;
|
|
317
|
+
/** Returns true if the redirect actually switched the assistant mode. */
|
|
317
318
|
private _handleRedirectMetadata;
|
|
318
319
|
private _sendAction;
|
|
319
320
|
/** Return messages visible at the current thread cursor. */
|
|
@@ -370,11 +371,10 @@ export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
|
|
|
370
371
|
private _productNumber;
|
|
371
372
|
/** Rewind the conversation to the given thread. */
|
|
372
373
|
private _rollbackToThread;
|
|
373
|
-
private
|
|
374
|
+
private _persistHistory;
|
|
374
375
|
private _persistConversationState;
|
|
375
376
|
private _persistConversationStateForNavigation;
|
|
376
377
|
private _formatHistoryTimestamp;
|
|
377
|
-
private _resolvePanelRestorePreviewLabel;
|
|
378
378
|
private _resolveHistoryPreviewText;
|
|
379
379
|
private _openHistoryPanel;
|
|
380
380
|
private _buildHistoryPageEl;
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Opt-in debug logging for chat presentation (query ?chat_debug=1 or localStorage gengage_chat_debug=1).
|
|
3
3
|
*/
|
|
4
|
-
type Entry = {
|
|
5
|
-
seq: number;
|
|
6
|
-
time: string;
|
|
7
|
-
scope: string;
|
|
8
|
-
message: string;
|
|
9
|
-
payload?: unknown;
|
|
10
|
-
};
|
|
11
|
-
declare global {
|
|
12
|
-
interface Window {
|
|
13
|
-
__gengageChatPresentationDebugLog?: Entry[];
|
|
14
|
-
__gengageChatPresentationDebugSeq?: number;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
4
|
export declare function logChatPresentation(scope: string, message: string, payload?: unknown): void;
|
|
18
|
-
export {};
|
package/dist/chat-runtime.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, d as t, f as r, i as s, l as n, n as i, r as l, s as C, t as c, u as d } from "./runtime-
|
|
1
|
+
import { c as e, d as t, f as r, i as s, l as n, n as i, r as l, s as C, t as c, u as d } from "./runtime-BSIrZhF2.js";
|
|
2
2
|
export {
|
|
3
3
|
d as CHAT_SCROLL_ELEMENT_ID,
|
|
4
4
|
s as ChatPresentationState,
|