@opencx/widget-react-headless 4.0.60 → 5.0.0-beta.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/index.cjs +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4739 -180
- package/dist/index.js.map +1 -1
- package/dist/package.json.d.ts +53 -0
- package/dist/src/WidgetProvider.d.ts +9 -2
- package/dist/src/WidgetProvider.d.ts.map +1 -1
- package/dist/src/__tests__/WidgetProvider.initialization.spec.d.ts +2 -0
- package/dist/src/__tests__/WidgetProvider.initialization.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/AgentChatContext.d.ts +58 -0
- package/dist/src/agent-chat/AgentChatContext.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/WidgetProvider.agent-chat.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/WidgetProvider.agent-chat.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/agent-chat-queue.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/agent-chat-queue.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/agent-chat-stream.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/agent-chat-stream.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/agent-chat-transport.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/agent-chat-transport.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/agent-turn-sources.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/agent-turn-sources.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/ask-questions.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/ask-questions.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/pending-clarification.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/pending-clarification.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/stop-agent-chat-turn.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/stop-agent-chat-turn.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.client-context.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.client-context.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.drain-order.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.drain-order.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.failed-turn.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.failed-turn.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.feature-narrowing.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.feature-narrowing.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.send-features.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.send-features.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.steer.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.steer.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.stop-partial.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.stop-partial.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.stream-handoff.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.stream-handoff.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.turn-retention.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-agent-chat.turn-retention.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/__tests__/use-chat-post-finish-data-part.spec.d.ts +2 -0
- package/dist/src/agent-chat/__tests__/use-chat-post-finish-data-part.spec.d.ts.map +1 -0
- package/dist/src/agent-chat/agent-chat-queue.d.ts +29 -0
- package/dist/src/agent-chat/agent-chat-queue.d.ts.map +1 -0
- package/dist/src/agent-chat/agent-chat-stream.d.ts +74 -0
- package/dist/src/agent-chat/agent-chat-stream.d.ts.map +1 -0
- package/dist/src/agent-chat/agent-chat-transport.d.ts +29 -0
- package/dist/src/agent-chat/agent-chat-transport.d.ts.map +1 -0
- package/dist/src/agent-chat/agent-turn-sources.d.ts +23 -0
- package/dist/src/agent-chat/agent-turn-sources.d.ts.map +1 -0
- package/dist/src/agent-chat/ask-questions.d.ts +51 -0
- package/dist/src/agent-chat/ask-questions.d.ts.map +1 -0
- package/dist/src/agent-chat/pending-clarification.d.ts +27 -0
- package/dist/src/agent-chat/pending-clarification.d.ts.map +1 -0
- package/dist/src/agent-chat/steer-into-live-turn.d.ts +35 -0
- package/dist/src/agent-chat/steer-into-live-turn.d.ts.map +1 -0
- package/dist/src/agent-chat/stop-agent-chat-turn.d.ts +12 -0
- package/dist/src/agent-chat/stop-agent-chat-turn.d.ts.map +1 -0
- package/dist/src/agent-chat/useAgentChat.d.ts +54 -0
- package/dist/src/agent-chat/useAgentChat.d.ts.map +1 -0
- package/dist/src/hooks/__tests__/use-display-mode.spec.d.ts +2 -0
- package/dist/src/hooks/__tests__/use-display-mode.spec.d.ts.map +1 -0
- package/dist/src/hooks/__tests__/use-widget-layout.spec.d.ts +2 -0
- package/dist/src/hooks/__tests__/use-widget-layout.spec.d.ts.map +1 -0
- package/dist/src/hooks/__tests__/useHostLocation.spec.d.ts +2 -0
- package/dist/src/hooks/__tests__/useHostLocation.spec.d.ts.map +1 -0
- package/dist/src/hooks/useBot.d.ts +8 -0
- package/dist/src/hooks/useBot.d.ts.map +1 -0
- package/dist/src/hooks/useCsat.d.ts +1 -1
- package/dist/src/hooks/useCsat.d.ts.map +1 -1
- package/dist/src/hooks/useDictation.d.ts +22 -0
- package/dist/src/hooks/useDictation.d.ts.map +1 -0
- package/dist/src/hooks/useDisplayMode.d.ts +7 -0
- package/dist/src/hooks/useDisplayMode.d.ts.map +1 -0
- package/dist/src/hooks/useHostLocation.d.ts +17 -0
- package/dist/src/hooks/useHostLocation.d.ts.map +1 -0
- package/dist/src/hooks/useIsAwaitingBotReply.d.ts.map +1 -1
- package/dist/src/hooks/useMessages.d.ts +3 -6
- package/dist/src/hooks/useMessages.d.ts.map +1 -1
- package/dist/src/hooks/useModes.d.ts +5 -12
- package/dist/src/hooks/useModes.d.ts.map +1 -1
- package/dist/src/hooks/useSessions.d.ts.map +1 -1
- package/dist/src/hooks/useUploadFiles.d.ts +1 -1
- package/dist/src/hooks/useWidgetLayout.d.ts +60 -0
- package/dist/src/hooks/useWidgetLayout.d.ts.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-agent-chat-turn.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/stop-agent-chat-turn.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,GAAG,EACH,SAAS,EACT,QAAQ,GACT,EAAE;IACD,GAAG,EAAE;QAAE,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC;IAC1D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { WidgetConfig, WidgetCtx, WidgetMessageU } from '@opencx/widget-core';
|
|
2
|
+
import { StreamingTurnItem } from './agent-chat-stream';
|
|
3
|
+
import { TurnRenderSource } from './agent-turn-sources';
|
|
4
|
+
/** A normalized browser effect for a styled renderer to perform on its host. */
|
|
5
|
+
export type AgentChatPageEffect = {
|
|
6
|
+
key: string;
|
|
7
|
+
type: 'highlight-element';
|
|
8
|
+
input: unknown;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The agent-chat engine, powered by the AI SDK `useChat`.
|
|
12
|
+
*
|
|
13
|
+
* - **Streaming** is driven by `status` ('submitted' | 'streaming' | 'ready').
|
|
14
|
+
* - **Resume** is native (`resume: true` reconnects to a live turn on mount).
|
|
15
|
+
* - **Steering**: a message sent while a turn is STREAMING enters the
|
|
16
|
+
* transcript at once and is POSTed at once; the backend steers it into the
|
|
17
|
+
* live turn (`data-turn-steered`), whose single reply — still rendering on
|
|
18
|
+
* this engine's stream, untouched — answers both messages. When the live
|
|
19
|
+
* turn cannot take it (already over), the backend opens a new turn for it
|
|
20
|
+
* on that request's stream, which is replayed here via resume.
|
|
21
|
+
* - **Multi-send queues** cover the gaps steering cannot: a turn that has
|
|
22
|
+
* not started streaming yet, a stop awaiting its ACK, and the post-turn
|
|
23
|
+
* reconcile window. A queued message is held in a queue pill above the
|
|
24
|
+
* composer and enters the transcript when its own turn starts.
|
|
25
|
+
* - **Stop cancels the RESPONSE, not the conversation**: it aborts the client
|
|
26
|
+
* stream and POSTs `/stop` so the server cancels generation, then the next
|
|
27
|
+
* queued message (if any) is sent to the API immediately. The queue is
|
|
28
|
+
* never discarded.
|
|
29
|
+
*
|
|
30
|
+
* The completed transcript stays owned by the shared persisted `messages`
|
|
31
|
+
* (history + polling — so human-agent handoff replies still appear); on finish
|
|
32
|
+
* we poll the canonical rows and the live overlay hands off to them.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useAgentChat({ widgetCtx, config, sessionId, persistedMessages, }: {
|
|
35
|
+
widgetCtx: WidgetCtx;
|
|
36
|
+
config: WidgetConfig;
|
|
37
|
+
sessionId: string | null;
|
|
38
|
+
persistedMessages: WidgetMessageU[];
|
|
39
|
+
}): {
|
|
40
|
+
isStreaming: boolean;
|
|
41
|
+
liveItems: StreamingTurnItem[];
|
|
42
|
+
/** Finished turns' render sources — see `TurnRenderSource`. */
|
|
43
|
+
turnSources: TurnRenderSource[];
|
|
44
|
+
/** The live turn's node key (stable through the retained promotion). */
|
|
45
|
+
liveTurnKey: string | null;
|
|
46
|
+
/** The last turn failed — the transcript renders a visible error row. */
|
|
47
|
+
turnFailed: boolean;
|
|
48
|
+
retryFailedTurn: () => void;
|
|
49
|
+
queuedUserMessages: import('@opencx/widget-core').WidgetUserMessage[];
|
|
50
|
+
removeQueued: (messageId: string) => void;
|
|
51
|
+
stop: () => void;
|
|
52
|
+
pageEffects: AgentChatPageEffect[];
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=useAgentChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgentChat.d.ts","sourceRoot":"","sources":["../../../src/agent-chat/useAgentChat.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAS9B,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAqBF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,MAAM,EACN,SAAS,EACT,iBAAiB,GAClB,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,cAAc,EAAE,CAAC;CACrC;;;IAwsBG,+DAA+D;;IAE/D,wEAAwE;;IAExE,yEAAyE;;;;8BA7M9B,MAAM;;;EAqNpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-display-mode.spec.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__tests__/use-display-mode.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-widget-layout.spec.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__tests__/use-widget-layout.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHostLocation.spec.d.ts","sourceRoot":"","sources":["../../../../src/hooks/__tests__/useHostLocation.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Agent } from '@opencx/widget-core';
|
|
2
|
+
/**
|
|
3
|
+
* The AI agent as the transcript shows it: the org's agent name/avatar
|
|
4
|
+
* (resolved by the backend at init), overridden field by field by the
|
|
5
|
+
* embedder's `bot` option.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useBot(): Agent;
|
|
8
|
+
//# sourceMappingURL=useBot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBot.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAIjD;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,KAAK,CAc9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCsat.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCsat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,qBAAqB,CAAC;AAK7B,wBAAgB,OAAO;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useCsat.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCsat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,qBAAqB,CAAC;AAK7B,wBAAgB,OAAO;;;;;;;;;;;;kBAec,CAAC;;;sBAElC,CAAF;mBACsB,CAAC;iBACnB,CAAL;;;;;;;;;EAuBA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DictationTarget } from '@opencx/widget-core';
|
|
2
|
+
/**
|
|
3
|
+
* Voice dictation for a composer. `enabled` is the server's decision narrowed
|
|
4
|
+
* by the embed (`widgetCtx.features.dictation`); the rest drives the one DictationCtx
|
|
5
|
+
* session. The target callbacks are read through refs so a re-render never
|
|
6
|
+
* restarts a live session.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useDictation(target: DictationTarget): {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
status: import('@opencx/widget-core').DictationStatus;
|
|
11
|
+
error: import('@opencx/widget-core').DictationErrorCode | null;
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
/** 0..1 mic level — read inside a rAF loop, not a render. */
|
|
14
|
+
levelRef: {
|
|
15
|
+
current: number;
|
|
16
|
+
};
|
|
17
|
+
start: () => void;
|
|
18
|
+
stop: () => void;
|
|
19
|
+
toggle: () => void;
|
|
20
|
+
prewarm: () => void;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useDictation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictation.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDictation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe;;;;;IA6BhD,6DAA6D;;;;;;;;EAOhE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WidgetDisplayModeU } from '@opencx/widget-core';
|
|
2
|
+
/**
|
|
3
|
+
* Effective display mode for the widget shell: `config.displayMode`, falling
|
|
4
|
+
* back to the classic `popover`. Embedders opt into `companion` explicitly.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useDisplayMode(): WidgetDisplayModeU;
|
|
7
|
+
//# sourceMappingURL=useDisplayMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDisplayMode.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDisplayMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D;;;GAGG;AACH,wBAAgB,cAAc,IAAI,kBAAkB,CAGnD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A host page fires this on its window after changing what `config.context`
|
|
3
|
+
* would resolve to, when nothing in the URL says so (a tab switch inside one
|
|
4
|
+
* page, a record loaded by id). The URL watch below covers route changes on
|
|
5
|
+
* its own.
|
|
6
|
+
*/
|
|
7
|
+
export declare const HOST_CONTEXT_CHANGED_EVENT = "opencx:context-changed";
|
|
8
|
+
/**
|
|
9
|
+
* A token that changes whenever the host page's situation may have: the
|
|
10
|
+
* visitor navigated without a reload (an SPA route change, back/forward, a
|
|
11
|
+
* hash), or the host fired `opencx:context-changed`. Anything derived from
|
|
12
|
+
* `config.context` that describes "where the visitor is" — the entity pill —
|
|
13
|
+
* keys on it, so it follows the page instead of showing the one the widget
|
|
14
|
+
* was opened on.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useHostLocation(): string;
|
|
17
|
+
//# sourceMappingURL=useHostLocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHostLocation.d.ts","sourceRoot":"","sources":["../../../src/hooks/useHostLocation.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AA8CnE;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsAwaitingBotReply.d.ts","sourceRoot":"","sources":["../../../src/hooks/useIsAwaitingBotReply.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIsAwaitingBotReply.d.ts","sourceRoot":"","sources":["../../../src/hooks/useIsAwaitingBotReply.ts"],"names":[],"mappings":"AAGA,wBAAgB,qBAAqB;;EAqBpC"}
|
|
@@ -6,11 +6,8 @@ export declare function useMessages(): {
|
|
|
6
6
|
lastAIResMightSolveUserIssue: boolean;
|
|
7
7
|
isInitialFetchLoading: boolean;
|
|
8
8
|
};
|
|
9
|
-
sendMessage: (input:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
customData?: import('@opencx/widget-core').SendMessageDto["custom_data"];
|
|
13
|
-
exitModePrompt?: string;
|
|
14
|
-
}) => Promise<void>;
|
|
9
|
+
sendMessage: (input: import('@opencx/widget-core').SendMessageInput) => Promise<void>;
|
|
10
|
+
rememberSentText: (text: string) => void;
|
|
11
|
+
getSentTextHistory: () => readonly string[];
|
|
15
12
|
};
|
|
16
13
|
//# sourceMappingURL=useMessages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessages.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMessages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMessages.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMessages.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW;;;;;;;;;;;EAkB1B"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
+
import { ModeComponent, ModeDto } from '@opencx/widget-core';
|
|
1
2
|
export declare function useModes(): {
|
|
2
|
-
modes:
|
|
3
|
-
|
|
4
|
-
name: string;
|
|
5
|
-
slug?: string | null;
|
|
6
|
-
}[];
|
|
7
|
-
modesComponents: import('@opencx/widget-core').ModeComponent[] | undefined;
|
|
3
|
+
modes: ModeDto[];
|
|
4
|
+
modesComponents: ModeComponent[] | undefined;
|
|
8
5
|
activeModeId: string | null | undefined;
|
|
9
|
-
activeMode:
|
|
10
|
-
|
|
11
|
-
name: string;
|
|
12
|
-
slug?: string | null;
|
|
13
|
-
} | undefined;
|
|
14
|
-
Component: ((props: import('@opencx/widget-core').ModeComponentProps) => ReturnType<typeof React.createElement>) | undefined;
|
|
6
|
+
activeMode: ModeDto | undefined;
|
|
7
|
+
Component: ModeComponent['component'] | undefined;
|
|
15
8
|
};
|
|
16
9
|
//# sourceMappingURL=useModes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModes.d.ts","sourceRoot":"","sources":["../../../src/hooks/useModes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useModes.d.ts","sourceRoot":"","sources":["../../../src/hooks/useModes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKlE,wBAAgB,QAAQ,IAAI;IAC1B,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC7C,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;CACnD,CAyBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessions.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSessions.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW;;;;;;;;;;;;;;;;;qBA+
|
|
1
|
+
{"version":3,"file":"useSessions.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSessions.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW;;;;;;;;;;;;;;;;;qBA+BmuD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAA2lC,CAAC;;;;sBAAwG,CAAC;mBAA6B,CAAC;iBAA2B,CAAC;;qBAA0C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EADxiG"}
|
|
@@ -14,7 +14,7 @@ declare function useUploadFiles(): {
|
|
|
14
14
|
emptyTheFiles: () => void;
|
|
15
15
|
getFileById: (id: string) => FileWithProgress | undefined;
|
|
16
16
|
getUploadProgress: (id: string) => number;
|
|
17
|
-
getUploadStatus: (id: string) => "
|
|
17
|
+
getUploadStatus: (id: string) => "success" | "error" | "pending" | "uploading" | undefined;
|
|
18
18
|
hasErrors: boolean;
|
|
19
19
|
isUploading: boolean;
|
|
20
20
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { default as React, Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
import { WidgetCompanionDefaultLayoutU, WidgetCompanionLayoutU, WidgetSidebarModeU, WidgetSidebarSideResolvedU } from '@opencx/widget-core';
|
|
3
|
+
type CompanionPreferenceStorage = {
|
|
4
|
+
getCompanionLayout: () => Promise<WidgetCompanionDefaultLayoutU | null>;
|
|
5
|
+
setCompanionLayout: (layout: WidgetCompanionDefaultLayoutU) => Promise<void>;
|
|
6
|
+
getCompanionSidebarSide: () => Promise<WidgetSidebarSideResolvedU | null>;
|
|
7
|
+
setCompanionSidebarSide: (side: WidgetSidebarSideResolvedU) => Promise<void>;
|
|
8
|
+
getCompanionSidebarMode: () => Promise<WidgetSidebarModeU | null>;
|
|
9
|
+
setCompanionSidebarMode: (mode: WidgetSidebarModeU) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
type WidgetLayoutCtx = {
|
|
12
|
+
layout: WidgetCompanionLayoutU;
|
|
13
|
+
setLayout: Dispatch<SetStateAction<WidgetCompanionLayoutU>>;
|
|
14
|
+
/**
|
|
15
|
+
* The visitor CHOOSING a layout, as opposed to the shell moving them
|
|
16
|
+
* between layouts on their behalf (leaving fullscreen, opening history).
|
|
17
|
+
* Only a deliberate pick is remembered for the next visit — otherwise a
|
|
18
|
+
* trip through fullscreen would quietly rewrite the saved preference to
|
|
19
|
+
* whatever the shell relaxed back to.
|
|
20
|
+
*/
|
|
21
|
+
setLayoutPreference: (layout: WidgetCompanionLayoutU) => void;
|
|
22
|
+
allowedLayouts: readonly WidgetCompanionLayoutU[];
|
|
23
|
+
defaultLayout: WidgetCompanionLayoutU;
|
|
24
|
+
/**
|
|
25
|
+
* Sidebar side/mode live HERE rather than in the companion shell because the
|
|
26
|
+
* two surfaces that need them sit on opposite sides of the content iframe:
|
|
27
|
+
* the shell (host DOM) positions the panel and frames the page, while the
|
|
28
|
+
* layout picker (inside the iframe) is what the visitor clicks. A shared
|
|
29
|
+
* context is the only thing both can read.
|
|
30
|
+
*/
|
|
31
|
+
sidebarSide: WidgetSidebarSideResolvedU;
|
|
32
|
+
setSidebarSide: (side: WidgetSidebarSideResolvedU) => void;
|
|
33
|
+
sidebarMode: WidgetSidebarModeU;
|
|
34
|
+
setSidebarMode: (mode: WidgetSidebarModeU) => void;
|
|
35
|
+
};
|
|
36
|
+
export declare function WidgetLayoutProvider({ children }: {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
}): React.JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* Layout state keyed to the CONFIGURED options. `useConfig()` is live — hosts
|
|
41
|
+
* like the dashboard playground edit options on an already-mounted widget —
|
|
42
|
+
* so the default and allowed layouts can change after mount. The effective
|
|
43
|
+
* default is always allowed. A changed effective default is applied; removing
|
|
44
|
+
* the current manual layout falls back to it; otherwise manual header toggles
|
|
45
|
+
* survive unrelated config edits.
|
|
46
|
+
*
|
|
47
|
+
* Exported separately so tests can drive the configured values as props
|
|
48
|
+
* without standing up the whole `WidgetProvider`/`WidgetCtx` stack.
|
|
49
|
+
*/
|
|
50
|
+
export declare function WidgetLayoutStateProvider({ configuredDefaultLayout, configuredLayouts, configuredSidebarSide, configuredSidebarMode, storage, children, }: {
|
|
51
|
+
configuredDefaultLayout?: WidgetCompanionLayoutU;
|
|
52
|
+
configuredLayouts?: readonly WidgetCompanionLayoutU[];
|
|
53
|
+
configuredSidebarSide: WidgetSidebarSideResolvedU;
|
|
54
|
+
configuredSidebarMode: WidgetSidebarModeU;
|
|
55
|
+
storage?: CompanionPreferenceStorage | undefined;
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
}): React.JSX.Element;
|
|
58
|
+
export declare function useWidgetLayout(): WidgetLayoutCtx;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=useWidgetLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWidgetLayout.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWidgetLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAK7B,KAAK,0BAA0B,GAAG;IAChC,kBAAkB,EAAE,MAAM,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC,CAAC;IACxE,kBAAkB,EAAE,CAAC,MAAM,EAAE,6BAA6B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,uBAAuB,EAAE,MAAM,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;IAC1E,uBAAuB,EAAE,CAAC,IAAI,EAAE,0BAA0B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,uBAAuB,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAClE,uBAAuB,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE,CAAC;AASF,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC5D;;;;;;OAMG;IACH,mBAAmB,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC9D,cAAc,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAClD,aAAa,EAAE,sBAAsB,CAAC;IACtC;;;;;;OAMG;IACH,WAAW,EAAE,0BAA0B,CAAC;IACxC,cAAc,EAAE,CAAC,IAAI,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACpD,CAAC;AAIF,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBAgBzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,OAAO,EACP,QAAQ,GACT,EAAE;IACD,uBAAuB,CAAC,EAAE,sBAAsB,CAAC;IACjD,iBAAiB,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACtD,qBAAqB,EAAE,0BAA0B,CAAC;IAClD,qBAAqB,EAAE,kBAAkB,CAAC;IAC1C,OAAO,CAAC,EAAE,0BAA0B,GAAG,SAAS,CAAC;IACjD,QAAQ,EAAE,SAAS,CAAC;CACrB,qBAgJA;AAED,wBAAgB,eAAe,oBAQ9B"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
export type { WidgetComponentType, WidgetComponentProps, } from './types/components';
|
|
2
2
|
export { WidgetProvider, useWidget } from './WidgetProvider';
|
|
3
|
+
export { useAgentChatUi } from './agent-chat/AgentChatContext';
|
|
4
|
+
export type { SpecDataPart, StreamingStep, StreamingTurnState, StreamingTurnItem, } from './agent-chat/agent-chat-stream';
|
|
5
|
+
export type { TurnRenderSource } from './agent-chat/agent-turn-sources';
|
|
6
|
+
export { formatAskQuestionsAnswers } from './agent-chat/ask-questions';
|
|
7
|
+
export type { AskQuestionsRequest } from './agent-chat/ask-questions';
|
|
8
|
+
export { useBot } from './hooks/useBot';
|
|
3
9
|
export { useConfig } from './hooks/useConfig';
|
|
10
|
+
export { useDisplayMode } from './hooks/useDisplayMode';
|
|
4
11
|
export { useContact } from './hooks/useContact';
|
|
5
12
|
export { useDocumentDir } from './hooks/useDocumentDir';
|
|
13
|
+
export { HOST_CONTEXT_CHANGED_EVENT, useHostLocation, } from './hooks/useHostLocation';
|
|
6
14
|
export { useIsAwaitingBotReply } from './hooks/useIsAwaitingBotReply';
|
|
7
15
|
export { useMessages } from './hooks/useMessages';
|
|
8
16
|
export { usePrimitiveState } from './hooks/usePrimitiveState';
|
|
@@ -10,6 +18,8 @@ export { useSessions } from './hooks/useSessions';
|
|
|
10
18
|
export { useWidgetRouter } from './hooks/useWidgetRouter';
|
|
11
19
|
export { type FileWithProgress, useUploadFiles } from './hooks/useUploadFiles';
|
|
12
20
|
export { useWidgetTrigger, WidgetTriggerProvider, } from './hooks/useWidgetTrigger';
|
|
21
|
+
export { useWidgetLayout, WidgetLayoutProvider } from './hooks/useWidgetLayout';
|
|
13
22
|
export { useModes } from './hooks/useModes';
|
|
14
23
|
export { useCsat } from './hooks/useCsat';
|
|
24
|
+
export { useDictation } from './hooks/useDictation';
|
|
15
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EACL,0BAA0B,EAC1B,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,KAAK,gBAAgB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencx/widget-react-headless",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0-beta.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"swr": "^2.2.5",
|
|
22
21
|
"uuid": "^11.0.4",
|
|
23
|
-
"
|
|
22
|
+
"zod": "^4.3.6",
|
|
23
|
+
"@opencx/widget-core": "5.0.0-beta.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@types/react": ">=18 <20",
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
"react-dom": ">=18 <20"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
+
"@ai-sdk/react": "4.0.34",
|
|
33
|
+
"@types/react": "^19.2.18",
|
|
34
|
+
"@types/react-dom": "^19.2.5",
|
|
35
|
+
"ai": "^7.0.31",
|
|
36
|
+
"react": "^19.2.8",
|
|
37
|
+
"react-dom": "^19.2.8",
|
|
32
38
|
"@opencx/eslint-config": "0.0.1",
|
|
33
39
|
"@opencx/tsconfig": "0.0.2"
|
|
34
40
|
},
|