@syntrologie/adapt-chatbot 2.8.0-canary.62 → 2.8.0-canary.621
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/AdaptiveChatBar.composer.test.d.ts +2 -0
- package/dist/AdaptiveChatBar.composer.test.d.ts.map +1 -0
- package/dist/AdaptiveChatBar.d.ts +248 -0
- package/dist/AdaptiveChatBar.d.ts.map +1 -0
- package/dist/AdaptiveChatBar.interleave.test.d.ts +9 -0
- package/dist/AdaptiveChatBar.interleave.test.d.ts.map +1 -0
- package/dist/AdaptiveChatBar.js +12 -0
- package/dist/AdaptiveChatBar.js.map +7 -0
- package/dist/AdaptiveChatBarMountable.d.ts +93 -0
- package/dist/AdaptiveChatBarMountable.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.d.ts +539 -0
- package/dist/AdaptiveChatTrail.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.follow-bottom.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.follow-bottom.test.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.js +12 -0
- package/dist/AdaptiveChatTrail.js.map +7 -0
- package/dist/AdaptiveChatTrail.live-region.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.live-region.test.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.test.d.ts.map +1 -0
- package/dist/AdaptiveChipsStrip.d.ts +1156 -0
- package/dist/AdaptiveChipsStrip.d.ts.map +1 -0
- package/dist/AdaptiveChipsStrip.js +11 -0
- package/dist/AdaptiveChipsStrip.js.map +7 -0
- package/dist/AdaptiveChipsStripMountable.d.ts +24 -0
- package/dist/AdaptiveChipsStripMountable.d.ts.map +1 -0
- package/dist/ChatAssistantLit.d.ts +64 -0
- package/dist/ChatAssistantLit.d.ts.map +1 -0
- package/dist/ChatAssistantLit.js +14 -0
- package/dist/ChatAssistantLit.js.map +7 -0
- package/dist/ChatSession.d.ts +275 -0
- package/dist/ChatSession.d.ts.map +1 -0
- package/dist/ChatTransport.d.ts +448 -0
- package/dist/ChatTransport.d.ts.map +1 -0
- package/dist/InlineRegistryWidgetMount.test.d.ts +2 -0
- package/dist/InlineRegistryWidgetMount.test.d.ts.map +1 -0
- package/dist/InlineWidgetLiveMount.test.d.ts +2 -0
- package/dist/InlineWidgetLiveMount.test.d.ts.map +1 -0
- package/dist/LeaveAMessage.leadconnector.integration.test.d.ts +2 -0
- package/dist/LeaveAMessage.leadconnector.integration.test.d.ts.map +1 -0
- package/dist/LeaveAMessageLit.d.ts +329 -0
- package/dist/LeaveAMessageLit.d.ts.map +1 -0
- package/dist/LeaveAMessageLit.test.d.ts +2 -0
- package/dist/LeaveAMessageLit.test.d.ts.map +1 -0
- package/dist/LeaveAMessageMountable.test.d.ts +2 -0
- package/dist/LeaveAMessageMountable.test.d.ts.map +1 -0
- package/dist/NavLinkMountable.d.ts +25 -0
- package/dist/NavLinkMountable.d.ts.map +1 -0
- package/dist/NavLinkMountable.test.d.ts +2 -0
- package/dist/NavLinkMountable.test.d.ts.map +1 -0
- package/dist/TextAnswerMountable.d.ts +17 -0
- package/dist/TextAnswerMountable.d.ts.map +1 -0
- package/dist/TextAnswerMountable.test.d.ts +2 -0
- package/dist/TextAnswerMountable.test.d.ts.map +1 -0
- package/dist/Turnstile.d.ts +101 -0
- package/dist/Turnstile.d.ts.map +1 -0
- package/dist/cdn.d.ts +16 -8
- package/dist/cdn.d.ts.map +1 -1
- package/dist/chunk-4V5L7IRV.js +4711 -0
- package/dist/chunk-4V5L7IRV.js.map +7 -0
- package/dist/chunk-EWPPVPJ4.js +14 -0
- package/dist/chunk-EWPPVPJ4.js.map +7 -0
- package/dist/chunk-HD2NXGYO.js +8445 -0
- package/dist/chunk-HD2NXGYO.js.map +7 -0
- package/dist/chunk-HV52LYST.js +641 -0
- package/dist/chunk-HV52LYST.js.map +7 -0
- package/dist/chunk-LY5AGXVD.js +21 -0
- package/dist/chunk-LY5AGXVD.js.map +7 -0
- package/dist/chunk-T6VEDUXD.js +694 -0
- package/dist/chunk-T6VEDUXD.js.map +7 -0
- package/dist/chunk-UFTSEIQP.js +1877 -0
- package/dist/chunk-UFTSEIQP.js.map +7 -0
- package/dist/chunk-VIRIVP7H.js +898 -0
- package/dist/chunk-VIRIVP7H.js.map +7 -0
- package/dist/chunk-YFZCMLV6.js +4078 -0
- package/dist/chunk-YFZCMLV6.js.map +7 -0
- package/dist/editor-lit.d.ts +37 -0
- package/dist/editor-lit.d.ts.map +1 -0
- package/dist/editor-lit.js +134 -0
- package/dist/editor-lit.js.map +7 -0
- package/dist/editorToken.d.ts +23 -0
- package/dist/editorToken.d.ts.map +1 -0
- package/dist/element-session.d.ts +3 -0
- package/dist/element-session.d.ts.map +1 -0
- package/dist/element-session.js +9 -0
- package/dist/element-session.js.map +7 -0
- package/dist/elements/ActionHandler.d.ts +34 -0
- package/dist/elements/ActionHandler.d.ts.map +1 -0
- package/dist/elements/ElementInstanceStore.d.ts +232 -0
- package/dist/elements/ElementInstanceStore.d.ts.map +1 -0
- package/dist/elements/ElementInstanceStore.test.d.ts +2 -0
- package/dist/elements/ElementInstanceStore.test.d.ts.map +1 -0
- package/dist/elements/ElementSessionController.d.ts +37 -0
- package/dist/elements/ElementSessionController.d.ts.map +1 -0
- package/dist/elements/ElementSessionController.test.d.ts +2 -0
- package/dist/elements/ElementSessionController.test.d.ts.map +1 -0
- package/dist/elements/ElementTypeHandler.d.ts +77 -0
- package/dist/elements/ElementTypeHandler.d.ts.map +1 -0
- package/dist/elements/ItemHandler.d.ts +60 -0
- package/dist/elements/ItemHandler.d.ts.map +1 -0
- package/dist/elements/ItemHandler.test.d.ts +2 -0
- package/dist/elements/ItemHandler.test.d.ts.map +1 -0
- package/dist/elements/TileHandler.d.ts +52 -0
- package/dist/elements/TileHandler.d.ts.map +1 -0
- package/dist/elements/TileHandler.test.d.ts +2 -0
- package/dist/elements/TileHandler.test.d.ts.map +1 -0
- package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts +2 -0
- package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts.map +1 -0
- package/dist/elements/blockRenderer.d.ts +46 -0
- package/dist/elements/blockRenderer.d.ts.map +1 -0
- package/dist/elements/blockRenderer.test.d.ts +13 -0
- package/dist/elements/blockRenderer.test.d.ts.map +1 -0
- package/dist/elements/blocks.d.ts +58 -0
- package/dist/elements/blocks.d.ts.map +1 -0
- package/dist/elements/createElementStore.d.ts +11 -0
- package/dist/elements/createElementStore.d.ts.map +1 -0
- package/dist/elements/envelope.d.ts +24 -0
- package/dist/elements/envelope.d.ts.map +1 -0
- package/dist/elements/fetcher.d.ts +43 -0
- package/dist/elements/fetcher.d.ts.map +1 -0
- package/dist/elements/index.d.ts +33 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/elements/store-singleton.d.ts +4 -0
- package/dist/elements/store-singleton.d.ts.map +1 -0
- package/dist/elements/tileLifecycleProps.d.ts +13 -0
- package/dist/elements/tileLifecycleProps.d.ts.map +1 -0
- package/dist/elements/types.d.ts +117 -0
- package/dist/elements/types.d.ts.map +1 -0
- package/dist/findSmartCanvas.d.ts +19 -0
- package/dist/findSmartCanvas.d.ts.map +1 -0
- package/dist/hostAgentController.d.ts +65 -0
- package/dist/hostAgentController.d.ts.map +1 -0
- package/dist/hostAgentController.test.d.ts +2 -0
- package/dist/hostAgentController.test.d.ts.map +1 -0
- package/dist/observer/__tests__/allowlist.test.d.ts +9 -0
- package/dist/observer/__tests__/allowlist.test.d.ts.map +1 -0
- package/dist/observer/__tests__/bus-translate.test.d.ts +16 -0
- package/dist/observer/__tests__/bus-translate.test.d.ts.map +1 -0
- package/dist/observer/__tests__/detector-observation-contract.test.d.ts +25 -0
- package/dist/observer/__tests__/detector-observation-contract.test.d.ts.map +1 -0
- package/dist/observer/__tests__/lifecycle.test.d.ts +2 -0
- package/dist/observer/__tests__/lifecycle.test.d.ts.map +1 -0
- package/dist/observer/__tests__/observer-enrich.test.d.ts +10 -0
- package/dist/observer/__tests__/observer-enrich.test.d.ts.map +1 -0
- package/dist/observer/__tests__/observer-isolation.test.d.ts +13 -0
- package/dist/observer/__tests__/observer-isolation.test.d.ts.map +1 -0
- package/dist/observer/__tests__/queue.test.d.ts +2 -0
- package/dist/observer/__tests__/queue.test.d.ts.map +1 -0
- package/dist/observer/__tests__/transport.test.d.ts +2 -0
- package/dist/observer/__tests__/transport.test.d.ts.map +1 -0
- package/dist/observer/allowlist.d.ts +32 -0
- package/dist/observer/allowlist.d.ts.map +1 -0
- package/dist/observer/bus-translate.d.ts +33 -0
- package/dist/observer/bus-translate.d.ts.map +1 -0
- package/dist/observer/index.d.ts +44 -0
- package/dist/observer/index.d.ts.map +1 -0
- package/dist/observer/queue.d.ts +63 -0
- package/dist/observer/queue.d.ts.map +1 -0
- package/dist/observer/transport.d.ts +27 -0
- package/dist/observer/transport.d.ts.map +1 -0
- package/dist/observer/wire.d.ts +54 -0
- package/dist/observer/wire.d.ts.map +1 -0
- package/dist/observer/wire.test.d.ts +2 -0
- package/dist/observer/wire.test.d.ts.map +1 -0
- package/dist/personas.d.ts +30 -0
- package/dist/personas.d.ts.map +1 -0
- package/dist/runtime-lit.d.ts +8 -0
- package/dist/runtime-lit.d.ts.map +1 -0
- package/dist/runtime.d.ts +63 -5
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +4439 -28
- package/dist/runtime.js.map +7 -0
- package/dist/schema.d.ts +3688 -11
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +578 -30
- package/dist/schema.js.map +7 -0
- package/dist/support-chat/__tests__/lc-fetch-stub.d.ts +52 -0
- package/dist/support-chat/__tests__/lc-fetch-stub.d.ts.map +1 -0
- package/dist/support-chat/boot.d.ts +47 -0
- package/dist/support-chat/boot.d.ts.map +1 -0
- package/dist/support-chat/boot.test.d.ts +2 -0
- package/dist/support-chat/boot.test.d.ts.map +1 -0
- package/dist/support-chat/crisp.d.ts +4 -0
- package/dist/support-chat/crisp.d.ts.map +1 -0
- package/dist/support-chat/crisp.test.d.ts +2 -0
- package/dist/support-chat/crisp.test.d.ts.map +1 -0
- package/dist/support-chat/inbox.d.ts +57 -0
- package/dist/support-chat/inbox.d.ts.map +1 -0
- package/dist/support-chat/inbox.test.d.ts +2 -0
- package/dist/support-chat/inbox.test.d.ts.map +1 -0
- package/dist/support-chat/leadconnector.d.ts +13 -0
- package/dist/support-chat/leadconnector.d.ts.map +1 -0
- package/dist/support-chat/leadconnector.test.d.ts +2 -0
- package/dist/support-chat/leadconnector.test.d.ts.map +1 -0
- package/dist/support-chat/registry.d.ts +5 -0
- package/dist/support-chat/registry.d.ts.map +1 -0
- package/dist/support-chat/registry.test.d.ts +2 -0
- package/dist/support-chat/registry.test.d.ts.map +1 -0
- package/dist/support-chat/schema-widgetid.test.d.ts +2 -0
- package/dist/support-chat/schema-widgetid.test.d.ts.map +1 -0
- package/dist/support-chat/types.d.ts +19 -0
- package/dist/support-chat/types.d.ts.map +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/types.d.ts +89 -40
- package/dist/types.d.ts.map +1 -1
- package/package.json +49 -24
- package/dist/ChatAssistant.d.ts +0 -18
- package/dist/ChatAssistant.d.ts.map +0 -1
- package/dist/ChatAssistant.js +0 -178
- package/dist/SyntroChatbot.d.ts +0 -14
- package/dist/SyntroChatbot.d.ts.map +0 -1
- package/dist/SyntroChatbot.js +0 -56
- package/dist/actionParser.d.ts +0 -15
- package/dist/actionParser.d.ts.map +0 -1
- package/dist/actionParser.js +0 -52
- package/dist/apiClient.d.ts +0 -23
- package/dist/apiClient.d.ts.map +0 -1
- package/dist/apiClient.js +0 -51
- package/dist/cdn.js +0 -37
- package/dist/editor.d.ts +0 -17
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js +0 -36
- package/dist/tools/bridge.d.ts +0 -26
- package/dist/tools/bridge.d.ts.map +0 -1
- package/dist/tools/bridge.js +0 -25
- package/dist/tools/expanders.d.ts +0 -17
- package/dist/tools/expanders.d.ts.map +0 -1
- package/dist/tools/expanders.js +0 -41
- package/dist/tools/index.d.ts +0 -14
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -11
- package/dist/tools/registrations/GetContextTool.d.ts +0 -7
- package/dist/tools/registrations/GetContextTool.d.ts.map +0 -1
- package/dist/tools/registrations/GetContextTool.js +0 -18
- package/dist/tools/registrations/ScrollToTool.d.ts +0 -7
- package/dist/tools/registrations/ScrollToTool.d.ts.map +0 -1
- package/dist/tools/registrations/ScrollToTool.js +0 -38
- package/dist/tools/registrations/ShowOverlayTool.d.ts +0 -7
- package/dist/tools/registrations/ShowOverlayTool.d.ts.map +0 -1
- package/dist/tools/registrations/ShowOverlayTool.js +0 -47
- package/dist/tools/registrations/index.d.ts +0 -19
- package/dist/tools/registrations/index.d.ts.map +0 -1
- package/dist/tools/registrations/index.js +0 -7
- package/dist/types.js +0 -6
- package/dist/useChat.d.ts +0 -25
- package/dist/useChat.d.ts.map +0 -1
- package/dist/useChat.js +0 -106
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <syntro-leave-a-message> — escalation-only async human handoff
|
|
3
|
+
* (spec: docs/superpowers/specs/2026-08-13-async-handoff-crisp-design.md).
|
|
4
|
+
* Five states: form (compose only) → email (optional, fallback framing) →
|
|
5
|
+
* sent → mail ("You got mail!") → flipped (reply + inline follow-up). All
|
|
6
|
+
* delivery through an injected SupportChatBridge; fail closed when the
|
|
7
|
+
* bridge is absent or the vendor SDK undetected.
|
|
8
|
+
*
|
|
9
|
+
* REDESIGN (owner brief, 2026-08-13): the compose step used to bundle an
|
|
10
|
+
* email input + message textarea + one Send button into a single
|
|
11
|
+
* "required everything up front" form. That's backwards — the message is
|
|
12
|
+
* the thing that matters (it's already drafted for the visitor); email is
|
|
13
|
+
* a nice-to-have fallback for if they leave the page before a reply
|
|
14
|
+
* arrives. So: send the message FIRST (compose step, message box only),
|
|
15
|
+
* THEN ask for email as a distinct, skippable second step. Every visitor-
|
|
16
|
+
* facing string moved to `copy` (workspace configuration) — the bundle
|
|
17
|
+
* ships no English fallback text anywhere; absent copy means that piece
|
|
18
|
+
* does not render (mirrors the pre-existing `replyToast` precedent).
|
|
19
|
+
*
|
|
20
|
+
* FINAL LAYOUT CORRECTION (owner, same day): the send/submit control lives
|
|
21
|
+
* INSIDE the field's own border — bottom-right, exactly like
|
|
22
|
+
* `<syntro-chat>`'s composer — never below the field, never beside it as a
|
|
23
|
+
* sibling button. And nothing renders below the field's box at all: one
|
|
24
|
+
* line of framing/prompt copy above it, then the box, full stop (the card
|
|
25
|
+
* is clamped to ~276px by the deck it lives in). See `fieldWrapStyles` /
|
|
26
|
+
* `embeddedIconButtonStyles` below for the mechanics, and `srOnlyStyles`
|
|
27
|
+
* for how a field still gets a REAL accessible label without spending any
|
|
28
|
+
* of that vertical budget.
|
|
29
|
+
*
|
|
30
|
+
* SECOND CORRECTION (owner, same day): "why is it reinventing the wheel"
|
|
31
|
+
* — the live-chat face mounts the REAL `<adaptive-chat-trail>` transcript
|
|
32
|
+
* renderer (`./AdaptiveChatTrail.ts`) instead of hand-rolled bubble
|
|
33
|
+
* markup. It is explicitly NOT bound to the concierge's shared
|
|
34
|
+
* `chatSession` singleton (`./ChatSession.ts`) — this file never imports
|
|
35
|
+
* that module, directly or transitively (the trail's own import graph is
|
|
36
|
+
* `@syntrologie/chat` + `lit` only). Each card owns its own
|
|
37
|
+
* `_transcript` instance field and feeds it to its own
|
|
38
|
+
* `<adaptive-chat-trail>` element; see `LeaveAMessageLit.test.ts`'s
|
|
39
|
+
* singleton-isolation suite for the mutation-proven guarantee.
|
|
40
|
+
*/
|
|
41
|
+
import { LitElement, nothing } from 'lit';
|
|
42
|
+
import './AdaptiveChatTrail.js';
|
|
43
|
+
import type { SupportChatBridge } from './support-chat/types';
|
|
44
|
+
/** One line of the visitor↔operator conversation, persisted so a page
|
|
45
|
+
* remount can rebuild the exact transcript in order. */
|
|
46
|
+
export interface TranscriptEntry {
|
|
47
|
+
role: 'visitor' | 'operator';
|
|
48
|
+
text: string;
|
|
49
|
+
}
|
|
50
|
+
/** Namespace + key the widget persists {state, transcript, email} under
|
|
51
|
+
* via `runtime.state.ns()` (I2, final-review fixes 2026-08-13) —
|
|
52
|
+
* see `LeaveAMessageLit#_loadPersisted` / `#_persist`. The page-level
|
|
53
|
+
* inbox (support-chat/inbox.ts) writes the same record when a team
|
|
54
|
+
* message arrives with no card mounted, so the next card picks it up. */
|
|
55
|
+
export declare const LEAVE_A_MESSAGE_PERSIST_NAMESPACE = "supportchat";
|
|
56
|
+
export declare const LEAVE_A_MESSAGE_PERSIST_KEY = "leave-a-message";
|
|
57
|
+
export type LeaveAMessageState = 'form' | 'email' | 'sent' | 'mail' | 'flipped';
|
|
58
|
+
export declare function liveLeaveAMessageCards(): ReadonlySet<LeaveAMessageLit>;
|
|
59
|
+
/**
|
|
60
|
+
* Every visitor-facing string on this card — authored entirely by the
|
|
61
|
+
* workspace (`default_widget_props.copy`), same pattern as `replyToast`.
|
|
62
|
+
* The bundle ships NO English fallback for any of these: absent copy means
|
|
63
|
+
* that piece of UI does not render. For the icon-only send/submit
|
|
64
|
+
* controls this isn't just a style choice — an icon button with no
|
|
65
|
+
* accessible name is a real usability defect, so `sendLabel` /
|
|
66
|
+
* `emailSubmitLabel` / `replySendLabel` double as BOTH the control's
|
|
67
|
+
* aria-label AND the gate on whether the control renders at all.
|
|
68
|
+
*/
|
|
69
|
+
export interface LeaveAMessageCopy {
|
|
70
|
+
/** Framing line above the message box (form step) — explains the
|
|
71
|
+
* message was drafted from the conversation and remains editable. */
|
|
72
|
+
framing?: string;
|
|
73
|
+
/** Accessible (visually-hidden) label for the message textarea. */
|
|
74
|
+
messageLabel?: string;
|
|
75
|
+
/** Accessible name for the compose step's embedded send control.
|
|
76
|
+
* Absence removes the control (see interface doc above). */
|
|
77
|
+
sendLabel?: string;
|
|
78
|
+
/** Prompt shown on the email step — frames the address as optional, a
|
|
79
|
+
* fallback for a reply if the visitor leaves the page. */
|
|
80
|
+
emailPrompt?: string;
|
|
81
|
+
/** Accessible (visually-hidden) label for the email input. */
|
|
82
|
+
emailLabel?: string;
|
|
83
|
+
/** Placeholder for the email input — distinct copy from the label, never
|
|
84
|
+
* doubling as it. */
|
|
85
|
+
emailPlaceholder?: string;
|
|
86
|
+
/** Accessible name for the email step's embedded submit control.
|
|
87
|
+
* Absence removes the control. */
|
|
88
|
+
emailSubmitLabel?: string;
|
|
89
|
+
/** Quiet inline decline text, beside the email field. Absence removes
|
|
90
|
+
* the control — the visitor can still get the same effect by
|
|
91
|
+
* submitting a blank field. */
|
|
92
|
+
emailSkipLabel?: string;
|
|
93
|
+
/** Confirmation paragraph shown in the 'sent' state. */
|
|
94
|
+
sentBody?: string;
|
|
95
|
+
/** Button text for the 'mail' state ("You got mail!" tap target). */
|
|
96
|
+
mailLabel?: string;
|
|
97
|
+
/** Accessible (visually-hidden) label for the reply input. */
|
|
98
|
+
replyLabel?: string;
|
|
99
|
+
/** Placeholder for the reply input (flipped state). */
|
|
100
|
+
replyPlaceholder?: string;
|
|
101
|
+
/** Accessible name for the flipped state's embedded send control.
|
|
102
|
+
* Absence removes the control. */
|
|
103
|
+
replySendLabel?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Minimal runtime slice the widget needs to raise the "You got mail!"
|
|
107
|
+
* toast — mirrors adaptive-nav's `NavWidgetRuntime.events` shape (see
|
|
108
|
+
* `NavWidgetLit#publishEvent`) so tile `notifications` rules (which
|
|
109
|
+
* subscribe to the runtime EventBus, not DOM CustomEvents) can match
|
|
110
|
+
* on `supportchat:reply_received`.
|
|
111
|
+
*/
|
|
112
|
+
export interface LeaveAMessageRuntime {
|
|
113
|
+
events: {
|
|
114
|
+
publish: (name: string, props?: Record<string, unknown>) => void;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Optional persistence seam (I2, final-review fixes 2026-08-13) — mirrors
|
|
118
|
+
* adaptive-overlays' `WorkflowWidgetLit.runtimeRef?.state?.ns?.(...)`
|
|
119
|
+
* pattern exactly. On an MPA the tile unmounts and remounts fresh per
|
|
120
|
+
* page; without this, a visitor who already sent a message and is
|
|
121
|
+
* waiting on a reply loses that thread on their very next click (state
|
|
122
|
+
* resets to 'form', the operator's reply becomes invisible). Optional
|
|
123
|
+
* because older host bundles / the playground don't inject it — the
|
|
124
|
+
* widget still works, it just can't survive navigation.
|
|
125
|
+
*/
|
|
126
|
+
state?: {
|
|
127
|
+
ns?: (namespace: string) => {
|
|
128
|
+
get: (key: string) => unknown;
|
|
129
|
+
set: (key: string, value: unknown) => void;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** Shape persisted under `runtime.state.ns('supportchat')`. */
|
|
134
|
+
export interface PersistedLeaveAMessage {
|
|
135
|
+
state?: LeaveAMessageState;
|
|
136
|
+
transcript?: TranscriptEntry[];
|
|
137
|
+
email?: string;
|
|
138
|
+
}
|
|
139
|
+
export declare class LeaveAMessageLit extends LitElement {
|
|
140
|
+
static properties: {
|
|
141
|
+
bridge: {
|
|
142
|
+
attribute: boolean;
|
|
143
|
+
};
|
|
144
|
+
message: {
|
|
145
|
+
type: StringConstructor;
|
|
146
|
+
};
|
|
147
|
+
contextSummary: {
|
|
148
|
+
attribute: boolean;
|
|
149
|
+
};
|
|
150
|
+
state: {
|
|
151
|
+
type: StringConstructor;
|
|
152
|
+
};
|
|
153
|
+
runtime: {
|
|
154
|
+
attribute: boolean;
|
|
155
|
+
};
|
|
156
|
+
replyToast: {
|
|
157
|
+
attribute: boolean;
|
|
158
|
+
};
|
|
159
|
+
copy: {
|
|
160
|
+
attribute: boolean;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
bridge: SupportChatBridge | undefined;
|
|
164
|
+
message: string;
|
|
165
|
+
contextSummary: string;
|
|
166
|
+
state: LeaveAMessageState;
|
|
167
|
+
/** Runtime plumbing injected by the mountable — undefined outside a live SDK mount. */
|
|
168
|
+
runtime: LeaveAMessageRuntime | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Visitor-facing toast copy, authored by the WORKSPACE CONFIG
|
|
171
|
+
* (`default_widget_props.replyToast`) — presentation belongs to
|
|
172
|
+
* configuration, not to this bundle: every workspace has its own voice
|
|
173
|
+
* and language. The built-in fallback below exists only so an
|
|
174
|
+
* unconfigured mount still says something truthful.
|
|
175
|
+
*/
|
|
176
|
+
replyToast: {
|
|
177
|
+
title?: string;
|
|
178
|
+
body?: string;
|
|
179
|
+
} | undefined;
|
|
180
|
+
/** Every OTHER visitor-facing string on this card — see
|
|
181
|
+
* `LeaveAMessageCopy` doc. */
|
|
182
|
+
copy: LeaveAMessageCopy | undefined;
|
|
183
|
+
/** Unique per-instance id prefix so `<label for>` never collides across
|
|
184
|
+
* more than one card mounted on the same page. */
|
|
185
|
+
private readonly _uid;
|
|
186
|
+
private _email;
|
|
187
|
+
private _reply;
|
|
188
|
+
/**
|
|
189
|
+
* Has the VISITOR typed something not yet consumed? Set only by the fields'
|
|
190
|
+
* own `@input` handlers, cleared on every state transition (the input has
|
|
191
|
+
* either been sent or explicitly declined). Drives the Escape guard
|
|
192
|
+
* (BUG-1787284155).
|
|
193
|
+
*
|
|
194
|
+
* Deliberately a flag and NOT "current value vs. a baseline captured at
|
|
195
|
+
* mount". The card mounts PREFILLED, and `LeaveAMessageMountable.update()`
|
|
196
|
+
* patches `message` in place mid-conversation whenever the agent rewrites
|
|
197
|
+
* the prefill — which is the case that method exists for. A captured
|
|
198
|
+
* baseline goes stale on exactly that patch, and every later Escape gets
|
|
199
|
+
* swallowed on a card the visitor never touched (adversarial review F1).
|
|
200
|
+
* An `@input` event is the only thing that means a person typed.
|
|
201
|
+
*/
|
|
202
|
+
private _touched;
|
|
203
|
+
/** Visitor↔operator conversation, in order — rendered as a chat
|
|
204
|
+
* transcript once the visitor taps into the mail state (see render()'s
|
|
205
|
+
* 'flipped' branch). Seeded with the visitor's own compose-step message
|
|
206
|
+
* in `_submitMessage`. */
|
|
207
|
+
private _transcript;
|
|
208
|
+
private _unsubscribe;
|
|
209
|
+
private _readyUnsub;
|
|
210
|
+
createRenderRoot(): HTMLElement;
|
|
211
|
+
connectedCallback(): void;
|
|
212
|
+
updated(): void;
|
|
213
|
+
disconnectedCallback(): void;
|
|
214
|
+
/** Is this card's own vendor subscription delivering replies? While it
|
|
215
|
+
* is, the page-level inbox leaves every message to the card. */
|
|
216
|
+
get isListening(): boolean;
|
|
217
|
+
/** Hand the card a team message that arrived through the page-level
|
|
218
|
+
* inbox (support-chat/inbox.ts) while the card was mounted but not yet
|
|
219
|
+
* listening — a compose-step card the concierge put up moments before
|
|
220
|
+
* the team's own message landed. */
|
|
221
|
+
receiveOperatorMessage(text: string): void;
|
|
222
|
+
/** Open the thread face — what tapping the mail face or an announcement
|
|
223
|
+
* does. Used by the page-level inbox when its announcement is tapped
|
|
224
|
+
* after a card has already mounted and hydrated the thread. */
|
|
225
|
+
showThread(): void;
|
|
226
|
+
/** Read the injected persistence store, if any (I2). */
|
|
227
|
+
private _persistStore;
|
|
228
|
+
/** Hydrate {state, transcript, email} from a prior page's mount. */
|
|
229
|
+
private _loadPersisted;
|
|
230
|
+
/** Snapshot {state, transcript, email} so the NEXT mount (a fresh page
|
|
231
|
+
* in the same session) can pick the thread back up. */
|
|
232
|
+
private _persist;
|
|
233
|
+
/** The pending reply announcement, if the canvas gave us a handle to it. */
|
|
234
|
+
private _noticeHandle;
|
|
235
|
+
/**
|
|
236
|
+
* Is the visitor LOOKING at this card right now? True only when the card
|
|
237
|
+
* has a laid-out box inside the viewport, the document is visible, and a
|
|
238
|
+
* hit-test at the card's center lands on the card itself — so a deck card
|
|
239
|
+
* stacked behind another, a card under a maximized chat, or a closed
|
|
240
|
+
* canvas all read as "not on screen". The hit-test descends through open
|
|
241
|
+
* shadow roots (`document.elementFromPoint` stops at the outermost host).
|
|
242
|
+
* Canvas-agnostic on purpose: the card never asks a canvas which tile is
|
|
243
|
+
* front. Anything this can't evaluate (jsdom, no layout) is "not on
|
|
244
|
+
* screen": when unsure, announce — a missed reply costs more than an
|
|
245
|
+
* extra toast.
|
|
246
|
+
*/
|
|
247
|
+
private _isOnScreen;
|
|
248
|
+
/** The tile id sc-mount stamps on every widget's container, so the card can
|
|
249
|
+
* name itself to the canvas when the visitor taps its announcement. */
|
|
250
|
+
private _instanceId;
|
|
251
|
+
/**
|
|
252
|
+
* Tap on the reply announcement: open the thread and ask the canvas to
|
|
253
|
+
* bring this tile to the front. `tile-recall` is the same composed event
|
|
254
|
+
* AdaptiveChatBar already raises for its own recalls — velvet cycles the
|
|
255
|
+
* deck to the card and un-maximizes the chat; the host opens the canvas
|
|
256
|
+
* if it was closed.
|
|
257
|
+
*/
|
|
258
|
+
private _recall;
|
|
259
|
+
/**
|
|
260
|
+
* Announce a reply through the canvas element. Pierces shadow roots to
|
|
261
|
+
* find `<smart-canvas>` (same resolution AdaptiveChatBarMountable uses), and
|
|
262
|
+
* no-ops when no canvas is present — the tile's own "You got mail!" face is
|
|
263
|
+
* always the durable signal. The announcement is PERSISTENT: a human's
|
|
264
|
+
* reply is the one thing the visitor was waiting on, so it stays until
|
|
265
|
+
* tapped or until the visitor opens the thread themselves (`_flip`).
|
|
266
|
+
*/
|
|
267
|
+
private _announceReply;
|
|
268
|
+
/** Paint our own focus ring from the theme. The border now lives on the
|
|
269
|
+
* field SHELL (`data-lam-field-wrap`), not the borderless inner
|
|
270
|
+
* textarea/input, so the ring targets that ancestor via `closest()`. */
|
|
271
|
+
private _focusOn;
|
|
272
|
+
private _focusOff;
|
|
273
|
+
private _onReply;
|
|
274
|
+
/** Compose step → email step. Delivers the message immediately; email
|
|
275
|
+
* capture is a SEPARATE, later, optional step (owner redesign). Seeds
|
|
276
|
+
* the chat transcript with the visitor's OWN plain message text (not
|
|
277
|
+
* the context-prefixed string sent to the bridge — that prefix is
|
|
278
|
+
* internal plumbing for the human agent, not something the visitor
|
|
279
|
+
* should see echoed back at themselves). */
|
|
280
|
+
private _submitMessage;
|
|
281
|
+
/** Email step → sent. Blank email is a valid submission (the field is
|
|
282
|
+
* optional) and simply skips `setVisitorEmail`; an invalid non-blank
|
|
283
|
+
* email blocks advancing so a mistyped address doesn't silently vanish. */
|
|
284
|
+
private _submitEmail;
|
|
285
|
+
/** Explicit decline — advances regardless of whatever is typed, without
|
|
286
|
+
* ever calling `setVisitorEmail`. Distinct from submitting a blank
|
|
287
|
+
* field only in that it discards partial input the visitor may not
|
|
288
|
+
* have meant to send. */
|
|
289
|
+
private _skipEmail;
|
|
290
|
+
private _flip;
|
|
291
|
+
/** Maps this card's OWN `_transcript` (never the concierge's) to the
|
|
292
|
+
* shape `<adaptive-chat-trail>` renders. `visitor` → `'user'` (right-
|
|
293
|
+
* aligned, branded) and `operator` → `'assistant'` (left-aligned,
|
|
294
|
+
* neutral) purely for the trail's existing visual treatment — no
|
|
295
|
+
* claim that a human Crisp operator IS the AI assistant. Freshly
|
|
296
|
+
* computed on every render from local state; nothing here reads from
|
|
297
|
+
* or writes to `chatSession`. */
|
|
298
|
+
private _trailMessages;
|
|
299
|
+
private _sendReply;
|
|
300
|
+
/** Does the visitor have text here that closing the card would destroy? */
|
|
301
|
+
private _hasUnsavedInput;
|
|
302
|
+
/**
|
|
303
|
+
* Escape must not silently discard a draft (BUG-1787284155).
|
|
304
|
+
*
|
|
305
|
+
* The runtime's canvas Escape handler (`CanvasDialogA11y`,
|
|
306
|
+
* `packages/runtime-sdk/src/a11y/canvasDialog.ts`) closes the surface from a
|
|
307
|
+
* document-level listener — but stands down on `e.defaultPrevented`,
|
|
308
|
+
* explicitly so an inner component that owns unsaved state can claim the
|
|
309
|
+
* key. That seam is what this uses; the widget owns the decision, not the
|
|
310
|
+
* runtime, because only the widget knows whether anything is at stake.
|
|
311
|
+
*
|
|
312
|
+
* A CLEAN card lets Escape through and the canvas closes — normal dialog
|
|
313
|
+
* behaviour, and the reflex the visitor expects. A DIRTY one swallows the
|
|
314
|
+
* first Escape and blurs the field: visible feedback that the key did
|
|
315
|
+
* something, the text still on screen, and a second Escape (focus now
|
|
316
|
+
* outside the field) closes as usual. Defended once, not held hostage.
|
|
317
|
+
* WCAG 3.3.4 in spirit — losing typed input to a reflex keystroke, with no
|
|
318
|
+
* prompt and no undo, is the failure this prevents.
|
|
319
|
+
*
|
|
320
|
+
* Scope is the card's own subtree (see the host binding in
|
|
321
|
+
* `connectedCallback`). A visitor whose focus has moved on to the host page
|
|
322
|
+
* gets the normal dismiss — the widget claims only keys that reach it.
|
|
323
|
+
*/
|
|
324
|
+
private _onKeyDown;
|
|
325
|
+
render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
326
|
+
}
|
|
327
|
+
/** Idempotent registration — called by the mountable on first mount. */
|
|
328
|
+
export declare function registerLeaveAMessageLit(): void;
|
|
329
|
+
//# sourceMappingURL=LeaveAMessageLit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LeaveAMessageLit.d.ts","sourceRoot":"","sources":["../src/LeaveAMessageLit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAQ,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAmQ9D;yDACyD;AACzD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;0EAI0E;AAC1E,eAAO,MAAM,iCAAiC,gBAAgB,CAAC;AAC/D,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAI7D,MAAM,MAAM,kBAAkB,GAAG,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AAU,IAAI,IAAI;IAIlB,wDAAwD;IACxD,OAAO,CAAC,aAAa;IAIrB,oEAAoE;IACpE,OAAO,CAAC,cAAc;IAUtB;4DACwD;IACxD,OAAO,CAAC,QAAQ;IAahB,4EAA4E;IAC5E,OAAO,CAAC,aAAa,CAAsC;IAE3D;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,WAAW;IAwBnB;4EACwE;IACxE,OAAO,CAAC,WAAW;IAInB;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,CAOb;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;IA2BtB;;6EAEyE;IACzE,OAAO,CAAC,QAAQ,CAKd;IAEF,OAAO,CAAC,SAAS,CAIf;IAEF,OAAO,CAAC,QAAQ,CAmCd;IAEF;;;;;iDAK6C;IAC7C,OAAO,CAAC,cAAc,CAQpB;IAEF;;gFAE4E;IAC5E,OAAO,CAAC,YAAY,CAQlB;IAEF;;;8BAG0B;IAC1B,OAAO,CAAC,UAAU,CAIhB;IAEF,OAAO,CAAC,KAAK,CAQX;IAEF;;;;;;sCAMkC;IAClC,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,UAAU,CAWhB;IAEF,2EAA2E;IAC3E,OAAO,CAAC,gBAAgB;IAIxB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,UAAU,CAKhB;IAEO,MAAM;CAkNhB;AAED,wEAAwE;AACxE,wBAAgB,wBAAwB,IAAI,IAAI,CAI/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LeaveAMessageLit.test.d.ts","sourceRoot":"","sources":["../src/LeaveAMessageLit.test.ts"],"names":[],"mappings":"AAKA,OAAO,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LeaveAMessageMountable.test.d.ts","sourceRoot":"","sources":["../src/LeaveAMessageMountable.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NavLinkMountable — `MountableWidget` used as the payload of an
|
|
3
|
+
* LLM-authored navigation chip.
|
|
4
|
+
*
|
|
5
|
+
* Flow:
|
|
6
|
+
* LLM mounts `suggest-navigation` ItemTemplate with `{title, url}`
|
|
7
|
+
* → backend builds chip with payload `{widget: 'adaptive-chatbot:nav-link', props: {url}}`
|
|
8
|
+
* → user clicks the chip → chips-strip mounts THIS widget into the
|
|
9
|
+
* chip's drawer
|
|
10
|
+
* → user clicks the "Go to <url>" button this widget renders
|
|
11
|
+
* → same-origin SPA navigation via pushState + popstate (matches
|
|
12
|
+
* `adaptive-nav`'s `executeNavigate` path for SPA-router compatibility)
|
|
13
|
+
*
|
|
14
|
+
* Registered as widget id `adaptive-chatbot:nav-link`.
|
|
15
|
+
*
|
|
16
|
+
* Security note: only http(s), same-origin destinations are honored.
|
|
17
|
+
* `javascript:`, `data:`, and cross-origin URLs are silently dropped at
|
|
18
|
+
* URL construction. The ItemTemplate's EnumField allowlist is the
|
|
19
|
+
* primary constraint; this is defense-in-depth.
|
|
20
|
+
*/
|
|
21
|
+
export declare const NavLinkMountable: {
|
|
22
|
+
mount(container: HTMLElement, mountConfig?: Record<string, unknown>): () => void;
|
|
23
|
+
update(container: HTMLElement, mountConfig?: Record<string, unknown>): void;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=NavLinkMountable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavLinkMountable.d.ts","sourceRoot":"","sources":["../src/NavLinkMountable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAoFH,eAAO,MAAM,gBAAgB;qBACV,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,IAAI;sBAkB9D,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAO5E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavLinkMountable.test.d.ts","sourceRoot":"","sources":["../src/NavLinkMountable.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextAnswerMountable — `MountableWidget` for the simplest chip payload
|
|
3
|
+
* kind: a single paragraph of body text.
|
|
4
|
+
*
|
|
5
|
+
* Registered as widget id `adaptive-chatbot:text-answer`. Used by
|
|
6
|
+
* `AdaptiveChipsStrip` when a chip's payload references it.
|
|
7
|
+
*
|
|
8
|
+
* Replaces the old hand-rolled resolver path. Customers wanting richer
|
|
9
|
+
* payloads (markdown, mini-product cards, embedded charts, etc.) ship
|
|
10
|
+
* their own mountable through the same registry — no special
|
|
11
|
+
* resolver-map seam.
|
|
12
|
+
*/
|
|
13
|
+
export declare const TextAnswerMountable: {
|
|
14
|
+
mount(container: HTMLElement, mountConfig?: Record<string, unknown>): () => void;
|
|
15
|
+
update(container: HTMLElement, mountConfig?: Record<string, unknown>): void;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=TextAnswerMountable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAnswerMountable.d.ts","sourceRoot":"","sources":["../src/TextAnswerMountable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwBH,eAAO,MAAM,mBAAmB;qBACb,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,IAAI;sBAqB9D,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAO5E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAnswerMountable.test.d.ts","sourceRoot":"","sources":["../src/TextAnswerMountable.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turnstile — shared Cloudflare bot-check helpers.
|
|
3
|
+
*
|
|
4
|
+
* Originally lived inline in ChatAssistantLit. Extracted so the new
|
|
5
|
+
* ChatTransport adapter can use the same managed-challenge flow
|
|
6
|
+
* without duplicating the panel-portal logic.
|
|
7
|
+
*
|
|
8
|
+
* Verify-panel is mounted to `document.body` (NOT into the calling
|
|
9
|
+
* widget's shadow-rooted container). Cloudflare Turnstile crashes
|
|
10
|
+
* with `Cannot read properties of undefined (reading 'toLowerCase')`
|
|
11
|
+
* when its host element lives inside a shadow root (verified on
|
|
12
|
+
* healthmaxxer 2026-05-22 — chat tile inside `<smart-canvas>`'s open
|
|
13
|
+
* shadow root). So we portal the host out and position it as a fixed
|
|
14
|
+
* overlay at the bottom-center of the viewport.
|
|
15
|
+
*
|
|
16
|
+
* The panel is ALWAYS mounted (CF needs a DOM target in case it
|
|
17
|
+
* decides to challenge) but is off-screen by default. For clean
|
|
18
|
+
* traffic, CF passive-grades silently with
|
|
19
|
+
* `appearance: 'interaction-only'` — nothing is ever visible. For
|
|
20
|
+
* flagged sessions, CF's `before-interactive-callback` fires and the
|
|
21
|
+
* orchestration helper reveals the panel.
|
|
22
|
+
*
|
|
23
|
+
* Copy is intentionally generic — customer end-users see this when CF
|
|
24
|
+
* flags their session, regardless of customer.
|
|
25
|
+
*/
|
|
26
|
+
export declare const TURNSTILE_SITEKEY = "0x4AAAAAADSzPbGWxeguF4YJ";
|
|
27
|
+
export interface AcquireTurnstileOptions {
|
|
28
|
+
/** Widget size. `flexible` (default for managed-mode sitekeys). */
|
|
29
|
+
size?: 'flexible' | 'normal' | 'compact' | 'invisible';
|
|
30
|
+
/** `interaction-only` keeps the widget invisible during passive grading. */
|
|
31
|
+
appearance?: 'always' | 'execute' | 'interaction-only';
|
|
32
|
+
/** Where to mount the widget. Off-screen host created when omitted. */
|
|
33
|
+
host?: HTMLElement;
|
|
34
|
+
/** Fires when CF decides a challenge is needed — surface "verifying" copy. */
|
|
35
|
+
onBeforeInteractive?: () => void;
|
|
36
|
+
/** Cancels an in-flight acquisition. Required for clean unmount-during-challenge. */
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Acquire a Cloudflare Turnstile token. Returns null when:
|
|
41
|
+
* • TURNSTILE_SITEKEY is empty (Turnstile disabled at build time)
|
|
42
|
+
* • the script fails to load (customer CSP blocks Cloudflare, etc.)
|
|
43
|
+
* • the render callback doesn't fire within TURNSTILE_ACQUIRE_TIMEOUT_MS
|
|
44
|
+
* • Cloudflare returns an error-callback (e.g., rate-limited, bad sitekey)
|
|
45
|
+
*
|
|
46
|
+
* Calls `turnstile.remove(widgetId)` on settle so CF's internal widget
|
|
47
|
+
* registry doesn't leak across re-mounts.
|
|
48
|
+
*
|
|
49
|
+
* Exported for tests and for the higher-level acquireTokenWithChallenge
|
|
50
|
+
* helper below.
|
|
51
|
+
*/
|
|
52
|
+
export declare function acquireTurnstileToken(opts?: AcquireTurnstileOptions): Promise<string | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Mount the off-screen verify-panel that hosts the managed Turnstile
|
|
55
|
+
* widget. Returns the panel element; callers MUST call panel.remove()
|
|
56
|
+
* when done (the panel is mounted on document.body and won't be
|
|
57
|
+
* garbage-collected with their widget).
|
|
58
|
+
*/
|
|
59
|
+
export declare function renderVerifyPanel(): HTMLElement;
|
|
60
|
+
/**
|
|
61
|
+
* Move the verify panel on-screen when CF signals via
|
|
62
|
+
* `before-interactive-callback` that the checkbox is about to appear.
|
|
63
|
+
* No-op if the panel was already torn down (race with token resolution).
|
|
64
|
+
*/
|
|
65
|
+
export declare function revealVerifyPanel(panel: HTMLElement | null): void;
|
|
66
|
+
export interface AcquireWithChallengeResult {
|
|
67
|
+
token: string | null;
|
|
68
|
+
outcome: 'disabled' | 'silent_succeeded' | 'interactive_succeeded' | 'acquisition_failed';
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Orchestrated acquire: mount the verify panel, ask CF for a token,
|
|
72
|
+
* reveal the panel if CF decides to challenge interactively, then
|
|
73
|
+
* clean up regardless of outcome.
|
|
74
|
+
*
|
|
75
|
+
* `outcome` is set so callers can distinguish silent-pass from
|
|
76
|
+
* interactive-pass from failure — useful telemetry for "how many
|
|
77
|
+
* sessions actually saw the checkbox?". `disabled` means
|
|
78
|
+
* TURNSTILE_SITEKEY was empty at build time.
|
|
79
|
+
*/
|
|
80
|
+
export declare function acquireTokenWithChallenge(options?: {
|
|
81
|
+
signal?: AbortSignal;
|
|
82
|
+
}): Promise<AcquireWithChallengeResult>;
|
|
83
|
+
export type BotCheckMode = 'off' | 'soft' | 'hard';
|
|
84
|
+
/** Test seam: forget cached modes (the cache is per page load). */
|
|
85
|
+
export declare function resetBotCheckModeCache(): void;
|
|
86
|
+
/**
|
|
87
|
+
* The backend's bot-check mode, read once per backend per page load.
|
|
88
|
+
* `null` means it could not be read.
|
|
89
|
+
*/
|
|
90
|
+
export declare function fetchBotCheckMode(backendUrl: string): Promise<BotCheckMode | null>;
|
|
91
|
+
/**
|
|
92
|
+
* Acquire a bot-check token for a visitor SEND. Call this from the send path
|
|
93
|
+
* only — never from mount, configure, or a passive stream.
|
|
94
|
+
*
|
|
95
|
+
* Resolves `{ token: null, outcome: 'disabled' }` without touching Cloudflare
|
|
96
|
+
* when the build has no sitekey or the backend reports `off`.
|
|
97
|
+
*/
|
|
98
|
+
export declare function acquireBotCheckTokenForSend(backendUrl: string, options?: {
|
|
99
|
+
signal?: AbortSignal;
|
|
100
|
+
}): Promise<AcquireWithChallengeResult>;
|
|
101
|
+
//# sourceMappingURL=Turnstile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Turnstile.d.ts","sourceRoot":"","sources":["../src/Turnstile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAwBH,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAmE5D,MAAM,WAAW,uBAAuB;IACtC,mEAAmE;IACnE,IAAI,CAAC,EAAE,UAAU,GAAG,QAA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AC,CAKrC"}
|
package/dist/cdn.d.ts
CHANGED
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
* This module is bundled for CDN delivery and self-registers with the global
|
|
5
5
|
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
8
|
-
/**
|
|
9
|
-
* App manifest for registry registration.
|
|
10
|
-
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
|
11
|
-
*/
|
|
7
|
+
import { ChatbotEditorLit } from './editor-lit';
|
|
12
8
|
export declare const manifest: {
|
|
13
9
|
id: string;
|
|
14
10
|
version: string;
|
|
@@ -16,7 +12,7 @@ export declare const manifest: {
|
|
|
16
12
|
description: string;
|
|
17
13
|
runtime: {
|
|
18
14
|
actions: never[];
|
|
19
|
-
widgets: {
|
|
15
|
+
widgets: ({
|
|
20
16
|
id: string;
|
|
21
17
|
component: {
|
|
22
18
|
mount(container: HTMLElement, mountConfig?: Record<string, unknown>): () => void;
|
|
@@ -26,10 +22,22 @@ export declare const manifest: {
|
|
|
26
22
|
description: string;
|
|
27
23
|
icon: string;
|
|
28
24
|
};
|
|
29
|
-
}
|
|
25
|
+
} | {
|
|
26
|
+
id: string;
|
|
27
|
+
component: {
|
|
28
|
+
mount(container: HTMLElement, config?: (Record<string, unknown> & import("packages/sdk-contracts/dist").MountPlumbing) | null): () => void;
|
|
29
|
+
update(container: HTMLElement, config?: (Record<string, unknown> & import("packages/sdk-contracts/dist").MountPlumbing) | null): void;
|
|
30
|
+
};
|
|
31
|
+
metadata: {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
icon: string;
|
|
35
|
+
};
|
|
36
|
+
})[];
|
|
37
|
+
onActivate: typeof import("./hostAgentController").activateHostAgent;
|
|
30
38
|
};
|
|
31
39
|
editor: {
|
|
32
|
-
component: typeof
|
|
40
|
+
component: typeof ChatbotEditorLit;
|
|
33
41
|
panel: {
|
|
34
42
|
title: string;
|
|
35
43
|
icon: string;
|
package/dist/cdn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqBpB,CAAC;AAaF,eAAe,QAAQ,CAAC"}
|