@evelan/jexity-widget 0.11.1 → 0.11.8
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.mjs +2378 -2065
- package/dist/index.mjs.map +1 -1
- package/dist/react.mjs +2403 -2090
- package/dist/react.mjs.map +1 -1
- package/dist/types/features/chat/components/BotMessage.d.ts.map +1 -1
- package/dist/types/features/chat/components/ChatScreen.d.ts.map +1 -1
- package/dist/types/features/chat/components/EscalationFormScreen.d.ts.map +1 -1
- package/dist/types/features/chat/components/FormMessage.d.ts.map +1 -1
- package/dist/types/features/chat/components/HumanHandoffAction.d.ts.map +1 -1
- package/dist/types/features/chat/components/MessageList.d.ts.map +1 -1
- package/dist/types/features/chat/components/SourcesRow.d.ts.map +1 -1
- package/dist/types/features/chat/{components → composer/components}/ChatInput.d.ts +1 -1
- package/dist/types/features/chat/composer/components/ChatInput.d.ts.map +1 -0
- package/dist/types/features/chat/composer/components/ComposerRow.d.ts +27 -0
- package/dist/types/features/chat/composer/components/ComposerRow.d.ts.map +1 -0
- package/dist/types/features/chat/composer/components/RateLimitNotice.d.ts +9 -0
- package/dist/types/features/chat/composer/components/RateLimitNotice.d.ts.map +1 -0
- package/dist/types/features/chat/composer/components/SessionErrorNotice.d.ts +11 -0
- package/dist/types/features/chat/composer/components/SessionErrorNotice.d.ts.map +1 -0
- package/dist/types/features/chat/composer/hooks/useComposerInput.d.ts +35 -0
- package/dist/types/features/chat/composer/hooks/useComposerInput.d.ts.map +1 -0
- package/dist/types/features/chat/composer/hooks/useRateLimitCountdown.d.ts +23 -0
- package/dist/types/features/chat/composer/hooks/useRateLimitCountdown.d.ts.map +1 -0
- package/dist/types/features/chat/composer/hooks/useSendMessage.d.ts +27 -0
- package/dist/types/features/chat/composer/hooks/useSendMessage.d.ts.map +1 -0
- package/dist/types/features/chat/composer/index.d.ts +16 -0
- package/dist/types/features/chat/composer/index.d.ts.map +1 -0
- package/dist/types/features/chat/composer/state/attachments.d.ts +26 -0
- package/dist/types/features/chat/composer/state/attachments.d.ts.map +1 -0
- package/dist/types/features/chat/{composer.state.d.ts → composer/state/draft.d.ts} +3 -8
- package/dist/types/features/chat/composer/state/draft.d.ts.map +1 -0
- package/dist/types/features/chat/composer/state/index.d.ts +17 -0
- package/dist/types/features/chat/composer/state/index.d.ts.map +1 -0
- package/dist/types/features/chat/composer/state/rate-limit.d.ts +10 -0
- package/dist/types/features/chat/composer/state/rate-limit.d.ts.map +1 -0
- package/dist/types/features/chat/hooks/useConversation.d.ts +27 -0
- package/dist/types/features/chat/hooks/useConversation.d.ts.map +1 -0
- package/dist/types/features/chat/hooks/useConvexSession.d.ts.map +1 -1
- package/dist/types/features/chat/hooks/useEscalation.d.ts +25 -0
- package/dist/types/features/chat/hooks/useEscalation.d.ts.map +1 -0
- package/dist/types/features/chat/hooks/useHandoff.d.ts +23 -0
- package/dist/types/features/chat/hooks/useHandoff.d.ts.map +1 -0
- package/dist/types/features/chat/index.d.ts +18 -0
- package/dist/types/features/chat/index.d.ts.map +1 -0
- package/dist/types/features/chat/state/index.d.ts +13 -0
- package/dist/types/features/chat/state/index.d.ts.map +1 -0
- package/dist/types/features/chat/state/session-error.d.ts +16 -0
- package/dist/types/features/chat/state/session-error.d.ts.map +1 -0
- package/dist/types/features/chat/types.d.ts +19 -0
- package/dist/types/features/chat/types.d.ts.map +1 -0
- package/dist/types/features/home/components/HomeScreen.d.ts.map +1 -1
- package/dist/types/i18n/locales/de.d.ts.map +1 -1
- package/dist/types/i18n/locales/en.d.ts +23 -0
- package/dist/types/i18n/locales/en.d.ts.map +1 -1
- package/dist/types/lib/refreshBootstrap.d.ts +10 -0
- package/dist/types/lib/refreshBootstrap.d.ts.map +1 -0
- package/dist/types/module/screens/ScreenRouter.d.ts +1 -1
- package/dist/types/module/screens/ScreenRouter.d.ts.map +1 -1
- package/dist/types/module/shell/WidgetShell.d.ts.map +1 -1
- package/dist/types/module/shell/hooks/useBootstrap.d.ts +3 -1
- package/dist/types/module/shell/hooks/useBootstrap.d.ts.map +1 -1
- package/dist/types/module/shell/shell.state.d.ts +10 -0
- package/dist/types/module/shell/shell.state.d.ts.map +1 -1
- package/dist/types/module/visitor/idle-lock.d.ts +27 -0
- package/dist/types/module/visitor/idle-lock.d.ts.map +1 -0
- package/dist/types/module/visitor/visitor.state.d.ts +2 -0
- package/dist/types/module/visitor/visitor.state.d.ts.map +1 -1
- package/dist/types/shared/ui/Header.d.ts +8 -2
- package/dist/types/shared/ui/Header.d.ts.map +1 -1
- package/dist/types/shared/ui/HeaderActions.d.ts +11 -0
- package/dist/types/shared/ui/HeaderActions.d.ts.map +1 -0
- package/dist/types/shared/ui/HeaderCloseButton.d.ts +10 -0
- package/dist/types/shared/ui/HeaderCloseButton.d.ts.map +1 -0
- package/dist/types/shared/ui/HeaderLeft.d.ts +9 -0
- package/dist/types/shared/ui/HeaderLeft.d.ts.map +1 -0
- package/dist/types/shared/ui/HeaderTitle.d.ts +7 -0
- package/dist/types/shared/ui/HeaderTitle.d.ts.map +1 -0
- package/dist/widget.js +47 -39
- package/dist/widget.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/features/chat/components/ChatInput.d.ts.map +0 -1
- package/dist/types/features/chat/components/RateLimitNotice.d.ts +0 -9
- package/dist/types/features/chat/components/RateLimitNotice.d.ts.map +0 -1
- package/dist/types/features/chat/composer.state.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotMessage.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/BotMessage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BotMessage.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/BotMessage.tsx"],"names":[],"mappings":"AAOA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AASD,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,eAAe,gCAsDtH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatScreen.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/ChatScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatScreen.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/ChatScreen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAOnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,OAAO,CAAA;IACxB,YAAY,EAAE,OAAO,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IAClD,UAAU,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;CAChD;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,eAAe,gCAmFnL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EscalationFormScreen.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/EscalationFormScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EscalationFormScreen.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/EscalationFormScreen.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAEnE,UAAU,yBAAyB;IACjC,aAAa,EAAE,EAAE,CAAC,eAAe,CAAC,CAAA;IAClC,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,yBAAyB,gCAkEtG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormMessage.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/FormMessage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormMessage.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/FormMessage.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAExE,UAAU,gBAAgB;IACxB,OAAO,EAAE,GAAG,CAAC,eAAe,CAAC,CAAA;IAC7B,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,gBAAgB,gCA4B9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HumanHandoffAction.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/HumanHandoffAction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HumanHandoffAction.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/HumanHandoffAction.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAEnE,UAAU,uBAAuB;IAC/B,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,uBAAuB,gCAyDnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/MessageList.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAgBxE,UAAU,gBAAgB;IACxB,aAAa,EAAE,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,SAAS,CAAA;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,iDAAiD;IACjD,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,iDAAiD;IACjD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/MessageList.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAgBxE,UAAU,gBAAgB;IACxB,aAAa,EAAE,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,SAAS,CAAA;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,iDAAiD;IACjD,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,iDAAiD;IACjD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,gBAAgB,gCA0J3I"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourcesRow.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/SourcesRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"SourcesRow.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/components/SourcesRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2CAA2C,CAAA;AAGpE,KAAK,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAElE,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AASD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,eAAe,uCAqEtD"}
|
|
@@ -11,7 +11,7 @@ interface ChatInputProps {
|
|
|
11
11
|
} | null>;
|
|
12
12
|
onStartFresh: () => void;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
14
|
+
/** Composer area — stacks inline notices above a single focus-within input row. */
|
|
15
15
|
export declare function ChatInput({ sessionId, visitorId, isLoading, isStreaming, sessionStatus, ensureSession, onStartFresh }: ChatInputProps): import("preact").JSX.Element;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=ChatInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/components/ChatInput.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAEnE,UAAU,cAAc;IACtB,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,IAAI,CAAA;IACtE,aAAa,EAAE,MAAM,OAAO,CAAC;QAAE,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAC5F,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,cAAc,gCAoDrI"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface ComposerRowProps {
|
|
2
|
+
isStreaming: boolean;
|
|
3
|
+
disabled: boolean;
|
|
4
|
+
inputDisabled: boolean;
|
|
5
|
+
onSend: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Composer row — autosize textarea, attach button, staged image chips,
|
|
9
|
+
* and a state-driven send button rendered inside one focus-within card.
|
|
10
|
+
*
|
|
11
|
+
* Pure presentation. All side effects (autosize, file picker proxy,
|
|
12
|
+
* focus-on-empty-click, Enter-to-send) live in `useComposerInput`.
|
|
13
|
+
* The component reads two composer signals (`draftMessage`,
|
|
14
|
+
* `attachedImages`) for render-time conditionals and writes through
|
|
15
|
+
* the hook + `removeAttachedImage`.
|
|
16
|
+
*
|
|
17
|
+
* Design notes:
|
|
18
|
+
* - The whole card owns the border + focus-within highlight so the
|
|
19
|
+
* send button can never overflow at narrow viewports.
|
|
20
|
+
* - Send button has two visual states: "muted" (no draft / images)
|
|
21
|
+
* and "active" (something to send). Streaming locks the textarea
|
|
22
|
+
* via `inputDisabled` upstream; the button stays muted because
|
|
23
|
+
* hasInput is false after clear-on-send.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ComposerRow({ isStreaming, disabled, inputDisabled, onSend }: ComposerRowProps): import("preact").JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=ComposerRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComposerRow.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/components/ComposerRow.tsx"],"names":[],"mappings":"AAKA,UAAU,gBAAgB;IACxB,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;IACjB,aAAa,EAAE,OAAO,CAAA;IACtB,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,gBAAgB,gCA4F7F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline rate-limit countdown rendered above the chat input.
|
|
3
|
+
*
|
|
4
|
+
* Pure render. Timer ownership + auto-clear live in
|
|
5
|
+
* `useRateLimitCountdown` so the notice never has to think about
|
|
6
|
+
* intervals or signals directly.
|
|
7
|
+
*/
|
|
8
|
+
export declare function RateLimitNotice(): import("preact").JSX.Element | null;
|
|
9
|
+
//# sourceMappingURL=RateLimitNotice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RateLimitNotice.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/components/RateLimitNotice.tsx"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,eAAe,wCAY9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline banner rendered above the chat input when session creation fails.
|
|
3
|
+
* Mirrors the RateLimitNotice pattern: module-scope signal, no prop drill,
|
|
4
|
+
* self-clears on the next successful ensureSession() / startFresh() call.
|
|
5
|
+
*
|
|
6
|
+
* Visitor-facing widget — console logs are invisible to operators, so every
|
|
7
|
+
* silent catch in useConvexSession / refreshBootstrap writes a reason here
|
|
8
|
+
* and this component renders it. See state/session-error.ts for the reason enum.
|
|
9
|
+
*/
|
|
10
|
+
export declare function SessionErrorNotice(): import("preact").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=SessionErrorNotice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionErrorNotice.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/components/SessionErrorNotice.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,wCAgBjC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useRef } from 'preact/hooks';
|
|
2
|
+
interface UseComposerInputArgs {
|
|
3
|
+
/** Called when the visitor presses Enter (without Shift). */
|
|
4
|
+
onSend: () => void;
|
|
5
|
+
}
|
|
6
|
+
interface UseComposerInputResult {
|
|
7
|
+
textareaRef: ReturnType<typeof useRef<HTMLTextAreaElement>>;
|
|
8
|
+
fileInputRef: ReturnType<typeof useRef<HTMLInputElement>>;
|
|
9
|
+
/** Enter → send, Shift+Enter → newline. */
|
|
10
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
11
|
+
/** Proxy click into the hidden native file input. */
|
|
12
|
+
onAttachClick: () => void;
|
|
13
|
+
/** Validate + stage selected files, then reset the input value. */
|
|
14
|
+
onFilesPicked: (e: Event) => void;
|
|
15
|
+
/** Focus the textarea when the visitor clicks empty card padding. */
|
|
16
|
+
onCardClick: (e: MouseEvent) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Composer input behaviours — the four side effects that used to live
|
|
20
|
+
* inline in ComposerRow.tsx:
|
|
21
|
+
*
|
|
22
|
+
* 1. Autosize the textarea up to MAX_TEXTAREA_PX, then scroll.
|
|
23
|
+
* 2. Send-on-Enter (preserving Shift+Enter for newline).
|
|
24
|
+
* 3. Attach button → hidden <input type="file"> proxy.
|
|
25
|
+
* 4. Click-on-empty-card → focus the textarea (Intercom pattern).
|
|
26
|
+
*
|
|
27
|
+
* Returning refs + handlers keeps ComposerRow purely declarative —
|
|
28
|
+
* it wires the result onto the DOM and never touches a useEffect or
|
|
29
|
+
* useRef of its own. The hook reads `draftMessage` directly because
|
|
30
|
+
* the autosize effect depends on the draft value, and that
|
|
31
|
+
* dependency is composer-internal.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useComposerInput({ onSend }: UseComposerInputArgs): UseComposerInputResult;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=useComposerInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComposerInput.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/hooks/useComposerInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAE,MAAM,cAAc,CAAA;AAKhD,UAAU,oBAAoB;IAC5B,6DAA6D;IAC7D,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED,UAAU,sBAAsB;IAC9B,WAAW,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAC3D,YAAY,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAA;IACzD,2CAA2C;IAC3C,SAAS,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAA;IACrC,qDAAqD;IACrD,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,mEAAmE;IACnE,aAAa,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;IACjC,qEAAqE;IACrE,WAAW,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;CACrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE,oBAAoB,GAAG,sBAAsB,CAgDzF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface UseRateLimitCountdownResult {
|
|
2
|
+
/** True while a rate-limit window is open. */
|
|
3
|
+
isActive: boolean;
|
|
4
|
+
/** Whole seconds remaining; 0 once the window expires. */
|
|
5
|
+
remainingSeconds: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Rate-limit countdown — owns the per-second tick on `nowMs` and the
|
|
9
|
+
* self-clearing setTimeout that resets `rateLimitedUntilMs` when the
|
|
10
|
+
* retry-after window elapses.
|
|
11
|
+
*
|
|
12
|
+
* Splitting this out of RateLimitNotice puts timer ownership next to
|
|
13
|
+
* the signal it drives (both live under `composer/state` /
|
|
14
|
+
* `composer/hooks`). The notice becomes pure render.
|
|
15
|
+
*
|
|
16
|
+
* Reading both signals inside the hook body subscribes the calling
|
|
17
|
+
* component to their updates, so the consumer re-renders once per
|
|
18
|
+
* tick during a countdown — that is exactly what a countdown display
|
|
19
|
+
* requires.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useRateLimitCountdown(): UseRateLimitCountdownResult;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=useRateLimitCountdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRateLimitCountdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/hooks/useRateLimitCountdown.ts"],"names":[],"mappings":"AAGA,UAAU,2BAA2B;IACnC,8CAA8C;IAC9C,QAAQ,EAAE,OAAO,CAAA;IACjB,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,IAAI,2BAA2B,CAsBnE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Id } from '@repo/backend/convex/_generated/dataModel';
|
|
2
|
+
interface UseSendMessageArgs {
|
|
3
|
+
sessionId: Id<'contactSessions'> | null;
|
|
4
|
+
visitorId: string | null;
|
|
5
|
+
ensureSession: () => Promise<{
|
|
6
|
+
sessionId: Id<'contactSessions'>;
|
|
7
|
+
visitorId: string;
|
|
8
|
+
} | null>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Composer send-message hook — single seam over the Convex `send`
|
|
12
|
+
* mutation.
|
|
13
|
+
*
|
|
14
|
+
* Owns:
|
|
15
|
+
* - ensure-session lazy create (anonymous visitors commit on first send)
|
|
16
|
+
* - rate_limit response → write `rateLimitedUntilMs` signal
|
|
17
|
+
* - success → `markActivity` so the session stays in history list
|
|
18
|
+
* - network / NOT_FOUND throws → log
|
|
19
|
+
*
|
|
20
|
+
* The returned function takes only `content` because the session
|
|
21
|
+
* deps are captured at hook-call time. Composer state mutations
|
|
22
|
+
* (clear draft, clear staged images) remain in the calling component
|
|
23
|
+
* so the component still owns its composer reset.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useSendMessage({ sessionId, visitorId, ensureSession }: UseSendMessageArgs): (content: string) => Promise<void>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=useSendMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSendMessage.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/hooks/useSendMessage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAInE,UAAU,kBAAkB;IAC1B,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,aAAa,EAAE,MAAM,OAAO,CAAC;QAAE,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;CAC7F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,kBAAkB,IAKtD,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CA8ClE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composer sub-feature — public barrel.
|
|
3
|
+
*
|
|
4
|
+
* Everything the rest of the chat feature needs from the composer
|
|
5
|
+
* lives here. Reach-ins are not allowed: outside code must import
|
|
6
|
+
* from `'../composer'`, never `'../composer/components/...'` or
|
|
7
|
+
* `'../composer/state/...'`.
|
|
8
|
+
*
|
|
9
|
+
* Deletability: `rm -rf features/chat/composer/` plus removing the
|
|
10
|
+
* import line in ChatScreen + BotMessage takes the entire composer
|
|
11
|
+
* (input UI, attachment staging, rate-limit + session-error notices,
|
|
12
|
+
* draft signal, tag-agent helper) out of the build.
|
|
13
|
+
*/
|
|
14
|
+
export { ChatInput } from './components/ChatInput';
|
|
15
|
+
export { tagAgent } from './state/draft';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/composer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pending image attachments staged in the composer.
|
|
3
|
+
*
|
|
4
|
+
* Frontend-only state for now. The backend `send` mutation accepts a
|
|
5
|
+
* single `content: string` — image upload + persistence (Convex storage,
|
|
6
|
+
* message-level attachment array, agent vision-input wiring) is a
|
|
7
|
+
* follow-up. When that lands, replace `previewUrl` with the uploaded
|
|
8
|
+
* `storageId` and pass the array in `send(...)`.
|
|
9
|
+
*
|
|
10
|
+
* `previewUrl` is an `URL.createObjectURL(file)` blob — callers MUST
|
|
11
|
+
* revoke it via `removeAttachedImage` / `clearAttachedImages` to avoid
|
|
12
|
+
* leaking memory.
|
|
13
|
+
*/
|
|
14
|
+
export interface AttachedImage {
|
|
15
|
+
id: string;
|
|
16
|
+
file: File;
|
|
17
|
+
previewUrl: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const attachedImages: import("@preact/signals").Signal<AttachedImage[]>;
|
|
20
|
+
/** Appends image files (after size + count guards) and creates blob preview URLs. */
|
|
21
|
+
export declare function addAttachedImages(files: FileList | File[]): void;
|
|
22
|
+
/** Removes one staged image by id and revokes its blob URL. */
|
|
23
|
+
export declare function removeAttachedImage(id: string): void;
|
|
24
|
+
/** Revokes every staged blob URL and resets the list. Call after send + on unmount. */
|
|
25
|
+
export declare function clearAttachedImages(): void;
|
|
26
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/state/attachments.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,IAAI,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,cAAc,mDAA8B,CAAA;AAyBzD,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,IAAI,CAgBhE;AAED,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Visitor's draft message — shared so the reply icon on agent messages
|
|
3
3
|
* can prepend an `@<agent>` mention into the active input. ChatInput
|
|
4
|
-
* binds its <
|
|
4
|
+
* binds its <textarea> to this signal; BotMessage's reply icon writes
|
|
5
|
+
* to it via `tagAgent`.
|
|
5
6
|
*
|
|
6
7
|
* Module-scope signal is fine here: a widget instance has at most one
|
|
7
8
|
* active composer, and visitors never have two widgets on the same page.
|
|
8
9
|
*/
|
|
9
10
|
export declare const draftMessage: import("@preact/signals").Signal<string>;
|
|
10
|
-
/** Wall-clock ms when visitor may send again. null = unsubscribed. */
|
|
11
|
-
export declare const rateLimitedUntilMs: import("@preact/signals").Signal<number | null>;
|
|
12
|
-
/** Module-scope wall-clock ticker. Updated once per second by RateLimitNotice
|
|
13
|
-
* while a rate-limit countdown is active, used to derive remaining seconds.
|
|
14
|
-
* Lives at module scope so multiple consumers share one timer if needed. */
|
|
15
|
-
export declare const nowMs: import("@preact/signals").Signal<number>;
|
|
16
11
|
/**
|
|
17
12
|
* Prepends `@<firstName> ` to the current draft so the visitor can type
|
|
18
13
|
* their question after the mention. If the draft already contains a
|
|
@@ -20,4 +15,4 @@ export declare const nowMs: import("@preact/signals").Signal<number>;
|
|
|
20
15
|
* the existing draft is preserved.
|
|
21
16
|
*/
|
|
22
17
|
export declare function tagAgent(agentName: string | undefined): void;
|
|
23
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/state/draft.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,0CAAa,CAAA;AAEtC;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAgB5D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composer state barrel — three independently deletable slices.
|
|
3
|
+
*
|
|
4
|
+
* - draft.ts → draftMessage signal + tagAgent helper
|
|
5
|
+
* - rate-limit.ts → rateLimitedUntilMs + nowMs ticker
|
|
6
|
+
* - attachments.ts → staged image attachments + blob-URL hygiene
|
|
7
|
+
*
|
|
8
|
+
* Consumers inside `composer/` should import from `../state`. The
|
|
9
|
+
* outer composer barrel (`composer/index.ts`) re-exports only what is
|
|
10
|
+
* meant to cross the composer boundary (currently `tagAgent`, so
|
|
11
|
+
* BotMessage outside the composer can prepend mentions into the
|
|
12
|
+
* draft).
|
|
13
|
+
*/
|
|
14
|
+
export { draftMessage, tagAgent } from './draft';
|
|
15
|
+
export { rateLimitedUntilMs, nowMs } from './rate-limit';
|
|
16
|
+
export { attachedImages, addAttachedImages, removeAttachedImage, clearAttachedImages, type AttachedImage, } from './attachments';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/state/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Wall-clock ms when visitor may send again. null = unsubscribed. */
|
|
2
|
+
export declare const rateLimitedUntilMs: import("@preact/signals").Signal<number | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Module-scope wall-clock ticker. Updated once per second by
|
|
5
|
+
* RateLimitNotice while a rate-limit countdown is active, used to
|
|
6
|
+
* derive remaining seconds. Lives at module scope so multiple
|
|
7
|
+
* consumers share one timer if needed.
|
|
8
|
+
*/
|
|
9
|
+
export declare const nowMs: import("@preact/signals").Signal<number>;
|
|
10
|
+
//# sourceMappingURL=rate-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chat/composer/state/rate-limit.ts"],"names":[],"mappings":"AAEA,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,iDAA8B,CAAA;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,KAAK,0CAA6B,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Doc, Id } from '@repo/backend/convex/_generated/dataModel';
|
|
2
|
+
interface UseConversationArgs {
|
|
3
|
+
sessionId: Id<'contactSessions'> | null;
|
|
4
|
+
visitorId: string | null;
|
|
5
|
+
}
|
|
6
|
+
export type SessionLiveStatus = 'active' | 'escalated' | 'assigned' | 'resolved';
|
|
7
|
+
interface UseConversationResult {
|
|
8
|
+
/** Conversation rows; `undefined` until first server response (loading). */
|
|
9
|
+
conversations: Doc<'conversations'>[] | undefined;
|
|
10
|
+
/** Live status of the contact session, or null while loading / no session. */
|
|
11
|
+
sessionStatus: SessionLiveStatus | null;
|
|
12
|
+
/** True while the conversations query is in flight for a known session. */
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
/** True while any bot/agent message is mid-stream. */
|
|
15
|
+
isStreaming: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Conversation data hook — wraps the two Convex queries ChatScreen
|
|
19
|
+
* needs (message list + live session status) so the component is
|
|
20
|
+
* free of `api.functions.chat.public.*` paths.
|
|
21
|
+
*
|
|
22
|
+
* Both queries use the `'skip'` idle pattern until a session exists,
|
|
23
|
+
* keeping subscription cost at zero before the first send.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useConversation({ sessionId, visitorId }: UseConversationArgs): UseConversationResult;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=useConversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConversation.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/hooks/useConversation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAExE,UAAU,mBAAmB;IAC3B,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAA;AAEhF,UAAU,qBAAqB;IAC7B,4EAA4E;IAC5E,aAAa,EAAE,GAAG,CAAC,eAAe,CAAC,EAAE,GAAG,SAAS,CAAA;IACjD,8EAA8E;IAC9E,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACvC,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAA;IAClB,sDAAsD;IACtD,WAAW,EAAE,OAAO,CAAA;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,qBAAqB,CA0BpG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConvexSession.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/hooks/useConvexSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useConvexSession.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/hooks/useConvexSession.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,2CAA2C,CAAA;AAmDnE,KAAK,aAAa,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,IAAI,CAAA;AAE5F,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,aAAa;IACrB,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAA;IACvC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,kFAAkF;IAClF,eAAe,EAAE,OAAO,CAAA;IACxB,0EAA0E;IAC1E,YAAY,EAAE,OAAO,CAAA;IACrB,8CAA8C;IAC9C,aAAa,EAAE,aAAa,CAAA;IAC5B,wFAAwF;IACxF,YAAY,EAAE,OAAO,CAAA;IACrB,4EAA4E;IAC5E,aAAa,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IAClD,iEAAiE;IACjE,UAAU,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IAC/C;8EAC0E;IAC1E,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,aAAa,CA8IlF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escalation submit hook — single touch point for the
|
|
3
|
+
* `submitEscalation` mutation.
|
|
4
|
+
*
|
|
5
|
+
* Returned function inserts the visitor's name + email onto the
|
|
6
|
+
* escalation form-message row and triggers the backend's inline
|
|
7
|
+
* escalation-confirm BotMessage insertion. Two consumers today
|
|
8
|
+
* (FormMessage + EscalationFormScreen); each owns its own
|
|
9
|
+
* submitting / error UI.
|
|
10
|
+
*
|
|
11
|
+
* Components that want error UI must catch the rejection themselves;
|
|
12
|
+
* this hook intentionally does not encapsulate error state because
|
|
13
|
+
* the two consumers render error differently (inline alert vs.
|
|
14
|
+
* silent log + form-reset).
|
|
15
|
+
*/
|
|
16
|
+
export declare function useEscalation(): import("convex/react").ReactMutation<import("convex/server").FunctionReference<"mutation", "public", {
|
|
17
|
+
visitorId: string;
|
|
18
|
+
visitorName: string;
|
|
19
|
+
visitorEmail: string;
|
|
20
|
+
sessionId: import("convex/values").GenericId<"contactSessions">;
|
|
21
|
+
formMessageId: import("convex/values").GenericId<"conversations">;
|
|
22
|
+
}, {
|
|
23
|
+
ticketRef: string;
|
|
24
|
+
}, string | undefined>>;
|
|
25
|
+
//# sourceMappingURL=useEscalation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEscalation.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/hooks/useEscalation.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa;;;;;;;;wBAE5B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handoff hook — single touch point for the headless
|
|
3
|
+
* `createEscalationRequest` mutation.
|
|
4
|
+
*
|
|
5
|
+
* Returned function fires the request and the backend decides the
|
|
6
|
+
* branch (skipForm vs. requires-form) via its return discriminator.
|
|
7
|
+
* Caller is responsible for navigating + reading the bootstrap
|
|
8
|
+
* token; the hook just abstracts the api path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useHandoff(): import("convex/react").ReactMutation<import("convex/server").FunctionReference<"mutation", "public", {
|
|
11
|
+
visitorId: string;
|
|
12
|
+
sessionId: import("convex/values").GenericId<"contactSessions">;
|
|
13
|
+
bootstrapToken: import("convex/values").GenericId<"widgetBootstrapTokens">;
|
|
14
|
+
}, {
|
|
15
|
+
skipForm: true;
|
|
16
|
+
ticketRef: string;
|
|
17
|
+
formMessageId?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
skipForm: false;
|
|
20
|
+
formMessageId: import("convex/values").GenericId<"conversations">;
|
|
21
|
+
ticketRef?: undefined;
|
|
22
|
+
}, string | undefined>>;
|
|
23
|
+
//# sourceMappingURL=useHandoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandoff.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/hooks/useHandoff.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,UAAU;;;;;;;;;;;;wBAEzB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat feature — public barrel.
|
|
3
|
+
*
|
|
4
|
+
* The shell layer (`module/shell`, `module/screens`) imports from
|
|
5
|
+
* this file. Reach-ins to `components/...`, `composer/...`,
|
|
6
|
+
* `hooks/...`, or `state/...` are not allowed from outside the
|
|
7
|
+
* chat feature.
|
|
8
|
+
*
|
|
9
|
+
* Deletability: `rm -rf features/chat/` plus removing every line
|
|
10
|
+
* in WidgetShell and ScreenRouter that imports from this barrel
|
|
11
|
+
* takes the whole chat experience out of the build.
|
|
12
|
+
*/
|
|
13
|
+
export { ChatScreen } from './components/ChatScreen';
|
|
14
|
+
export { EscalationFormScreen } from './components/EscalationFormScreen';
|
|
15
|
+
export { HumanHandoffAction } from './components/HumanHandoffAction';
|
|
16
|
+
export { useConvexSession } from './hooks/useConvexSession';
|
|
17
|
+
export type { SessionErrorReason, SessionResult } from './types';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat-feature cross-cutting state.
|
|
3
|
+
*
|
|
4
|
+
* State that is written outside the composer sub-feature lives here.
|
|
5
|
+
* Composer-owned state (draft, rate-limit, attachments) lives in
|
|
6
|
+
* `composer/state` and is exported from the composer barrel.
|
|
7
|
+
*
|
|
8
|
+
* - session-error.ts → sessionError + SessionErrorReason
|
|
9
|
+
* (written by hooks/useConvexSession, read by
|
|
10
|
+
* composer/components/SessionErrorNotice)
|
|
11
|
+
*/
|
|
12
|
+
export { sessionError, type SessionErrorReason } from './session-error';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/state/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline notice for session-creation failures. Visitor-facing widget can't
|
|
3
|
+
* rely on console logs — every catch in useConvexSession / refreshBootstrap
|
|
4
|
+
* that returns null must also write a reason here so ChatInput can render
|
|
5
|
+
* a banner the visitor actually sees.
|
|
6
|
+
*
|
|
7
|
+
* - 'no-token' bootstrap token never arrived (initial POST failed,
|
|
8
|
+
* network down, or 10s wait timed out)
|
|
9
|
+
* - 'unauthorized' bootstrap token was rejected and refresh also failed
|
|
10
|
+
* (origin de-authorised, clock skew, domain mis-config)
|
|
11
|
+
* - 'network' transport error talking to Convex
|
|
12
|
+
* - 'unknown' any other thrown error
|
|
13
|
+
*/
|
|
14
|
+
export type SessionErrorReason = 'no-token' | 'unauthorized' | 'network' | 'unknown';
|
|
15
|
+
export declare const sessionError: import("@preact/signals").Signal<SessionErrorReason | null>;
|
|
16
|
+
//# sourceMappingURL=session-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-error.d.ts","sourceRoot":"","sources":["../../../../../src/features/chat/state/session-error.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,GAAG,SAAS,CAAA;AAEpF,eAAO,MAAM,YAAY,6DAA0C,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat-feature public types.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the types that cross the chat-feature boundary. Source
|
|
5
|
+
* definitions live next to their owning state slice or hook, but
|
|
6
|
+
* external consumers should reach for them through this module (or
|
|
7
|
+
* the chat-feature barrel) — never via internal `state/...` or
|
|
8
|
+
* `hooks/...` paths.
|
|
9
|
+
*
|
|
10
|
+
* - SessionErrorReason → defined alongside its signal in
|
|
11
|
+
* state/session-error.ts; consumed by hooks/useConvexSession and
|
|
12
|
+
* composer/components/SessionErrorNotice.
|
|
13
|
+
* - SessionResult → defined alongside the hook that emits it
|
|
14
|
+
* (hooks/useConvexSession); consumed by ScreenRouter to type the
|
|
15
|
+
* ensureSession / startFresh callbacks it threads into screens.
|
|
16
|
+
*/
|
|
17
|
+
export type { SessionErrorReason } from './state/session-error';
|
|
18
|
+
export type { SessionResult } from './hooks/useConvexSession';
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/features/chat/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomeScreen.d.ts","sourceRoot":"","sources":["../../../../../src/features/home/components/HomeScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HomeScreen.d.ts","sourceRoot":"","sources":["../../../../../src/features/home/components/HomeScreen.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAEtE,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IAEb,YAAY,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IAEjD,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,eAAe,gCAgHlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../../../src/i18n/locales/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAEzC,eAAO,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../../../src/i18n/locales/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAEzC,eAAO,MAAM,EAAE,EAAE,aAgFhB,CAAA"}
|
|
@@ -4,11 +4,18 @@ export interface WidgetStrings {
|
|
|
4
4
|
inputPlaceholder: string;
|
|
5
5
|
aiThinking: string;
|
|
6
6
|
sendAriaLabel: string;
|
|
7
|
+
attachImagesAriaLabel: string;
|
|
8
|
+
attachComingSoon: string;
|
|
9
|
+
removeAttachmentAriaLabel: string;
|
|
7
10
|
openChatAriaLabel: string;
|
|
8
11
|
closeChatAriaLabel: string;
|
|
9
12
|
errorNetwork: string;
|
|
10
13
|
errorQuota: string;
|
|
11
14
|
errorRateLimited: string;
|
|
15
|
+
/** Shown when the widget couldn't get a bootstrap token (POST /widget/bootstrap failed or 10s wait timed out). */
|
|
16
|
+
errorSessionNoToken: string;
|
|
17
|
+
/** Shown when the bootstrap token was rejected and a refresh also failed. */
|
|
18
|
+
errorSessionUnauthorized: string;
|
|
12
19
|
localeLabelDe: string;
|
|
13
20
|
localeLabelEn: string;
|
|
14
21
|
resumeConversation: string;
|
|
@@ -46,6 +53,8 @@ export interface WidgetStrings {
|
|
|
46
53
|
escalationPromptSubmit: string;
|
|
47
54
|
escalationSubmitFailed: string;
|
|
48
55
|
sessionNotFoundPrompt: string;
|
|
56
|
+
/** Privacy notice shown on Home after the idle/visibility lock wiped the chat. */
|
|
57
|
+
sessionLocked: string;
|
|
49
58
|
sessionResolved: string;
|
|
50
59
|
tryAgain: string;
|
|
51
60
|
goBack: string;
|
|
@@ -60,6 +69,20 @@ export interface WidgetStrings {
|
|
|
60
69
|
handoffRateLimited: string;
|
|
61
70
|
resumeListLabel: string;
|
|
62
71
|
resumeListTimestamp: string;
|
|
72
|
+
noticeAgentJoined: string;
|
|
73
|
+
noticeHumanRequested: string;
|
|
74
|
+
noticeHumanRequestedForm: string;
|
|
75
|
+
/** Markdown confirmation card. `{name}` `{email}` `{ref}` are interpolated. */
|
|
76
|
+
noticeEscalationConfirmed: string;
|
|
77
|
+
/** Free-tier/quota fallback shown when no AI reply will come. */
|
|
78
|
+
noticeMessageReceived: string;
|
|
79
|
+
/** Shown when a human agent owns the session and the AI is suppressed. */
|
|
80
|
+
noticeAgentHandling: string;
|
|
81
|
+
/** Reply-to-agent button aria-label/title. `{name}` is interpolated. */
|
|
82
|
+
replyTo: string;
|
|
83
|
+
/** Sources pill count. `{count}` is interpolated. */
|
|
84
|
+
sourcesCountOne: string;
|
|
85
|
+
sourcesCountOther: string;
|
|
63
86
|
}
|
|
64
87
|
export declare const en: WidgetStrings;
|
|
65
88
|
//# sourceMappingURL=en.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/locales/en.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IAEZ,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,wBAAwB,EAAE,MAAM,CAAA;IAChC,sBAAsB,EAAE,MAAM,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAE9B,qBAAqB,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/locales/en.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,gBAAgB,EAAE,MAAM,CAAA;IACxB,yBAAyB,EAAE,MAAM,CAAA;IACjC,iBAAiB,EAAE,MAAM,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,kHAAkH;IAClH,mBAAmB,EAAE,MAAM,CAAA;IAC3B,6EAA6E;IAC7E,wBAAwB,EAAE,MAAM,CAAA;IAChC,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IAEZ,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,wBAAwB,EAAE,MAAM,CAAA;IAChC,sBAAsB,EAAE,MAAM,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAE9B,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kFAAkF;IAClF,aAAa,EAAE,MAAM,CAAA;IAErB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,EAAE,MAAM,CAAA;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,oEAAoE;IACpE,qBAAqB,EAAE,MAAM,CAAA;IAE7B,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAE3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,wBAAwB,EAAE,MAAM,CAAA;IAChC,+EAA+E;IAC/E,yBAAyB,EAAE,MAAM,CAAA;IACjC,iEAAiE;IACjE,qBAAqB,EAAE,MAAM,CAAA;IAC7B,0EAA0E;IAC1E,mBAAmB,EAAE,MAAM,CAAA;IAC3B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,eAAO,MAAM,EAAE,EAAE,aAgFhB,CAAA"}
|