@saar-ai/web-widget 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avatar-face.d.ts +4 -1
- package/dist/avatar-face.d.ts.map +1 -1
- package/dist/chunks/{chat-DrpWeT5w.js → chat-BBmFAzkg.js} +57 -1
- package/dist/chunks/{host-widget-D675mXsN.js → host-widget-BARJFMPt.js} +492 -137
- package/dist/concierge-shell.css +1 -1
- package/dist/dock/dock-renderer.d.ts +1 -1
- package/dist/dock/dock-renderer.d.ts.map +1 -1
- package/dist/dock/dock.d.ts +5 -0
- package/dist/dock/dock.d.ts.map +1 -1
- package/dist/generated/concierge-shell-css.d.ts.map +1 -1
- package/dist/generated/widget-css.d.ts.map +1 -1
- package/dist/host-widget.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/messages.d.ts +15 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/next/index.js +1 -1
- package/dist/use-chat-session.d.ts +15 -3
- package/dist/use-chat-session.d.ts.map +1 -1
- package/dist/use-voice-session.d.ts +19 -0
- package/dist/use-voice-session.d.ts.map +1 -1
- package/dist/variant-option-groups.d.ts +44 -0
- package/dist/variant-option-groups.d.ts.map +1 -0
- package/dist/variant-options.d.ts +34 -0
- package/dist/variant-options.d.ts.map +1 -0
- package/dist/voice-widget.d.ts +16 -3
- package/dist/voice-widget.d.ts.map +1 -1
- package/dist/widget/call-view.d.ts +42 -7
- package/dist/widget/call-view.d.ts.map +1 -1
- package/dist/widget/concierge-shell.d.ts +8 -4
- package/dist/widget/concierge-shell.d.ts.map +1 -1
- package/dist/widget/shell-renderer.d.ts +1 -1
- package/dist/widget/shell-renderer.d.ts.map +1 -1
- package/dist/widget.css +1 -1
- package/package.json +1 -1
- package/src/styles/call-view.css +104 -30
- package/src/styles/concierge-shell-entry.css +1 -0
- package/src/styles/mark.css +39 -5
- package/src/styles/widget-panel.css +29 -26
|
@@ -4681,6 +4681,9 @@ var defaultWidgetMessages = {
|
|
|
4681
4681
|
choose_options: "Choose options",
|
|
4682
4682
|
choose_options_label: "Choose options for {title}",
|
|
4683
4683
|
choose_options_after_call: "I’ll ask about options after the call",
|
|
4684
|
+
options_label: "Choose {option} for {title}",
|
|
4685
|
+
options_price_from: "from {price}",
|
|
4686
|
+
options_added: "Added to cart",
|
|
4684
4687
|
cards_label: "Recommended products",
|
|
4685
4688
|
cards_slide: "{n} of {total}",
|
|
4686
4689
|
cards_prev: "Previous products",
|
|
@@ -8451,7 +8454,7 @@ var DEFAULT_LAYOUT = {
|
|
|
8451
8454
|
};
|
|
8452
8455
|
var INTERRUPT_SEEN_STORAGE_KEY = "wgt_dock_interrupt_seen";
|
|
8453
8456
|
function Dock(props) {
|
|
8454
|
-
const { identity, color = DEFAULT_COLOR$1, type = DEFAULT_TYPE$1, layout = DEFAULT_LAYOUT, copy = {}, direction = "ltr", locale = "en", messages = defaultWidgetMessages, voice, escalated = false, offline = false, status, notice, statusKind, operatorLine, operatorName, reconnecting = false, roomDropped = false, partialTranscript, preamble, clause, channel = "text", shelf, transcript, transcriptCount, lastTurn, composing = false, unread = false, sheetExtra, followKey, revealSheet = false, showPrice = true, cardImageAspect = DEFAULT_CARD_ASPECT, bottomOffset = "auto", curationHref, productHref, navigate, draft, onDraftChange, onSubmit, composerDisabled = false, onAttach, attachSlot, attachBusy, proactive, pageKey, conciergeScrollRef, onEndCall, skinStyle, skin, preview = false, announcement, attribution, privacyChoices, initialDraft, initialSelection, initialFocus, initialMinimised, insets, hold, audio, onReady, onShown } = props;
|
|
8457
|
+
const { identity, color = DEFAULT_COLOR$1, type = DEFAULT_TYPE$1, layout = DEFAULT_LAYOUT, copy = {}, direction = "ltr", locale = "en", messages = defaultWidgetMessages, voice, escalated = false, offline = false, status, notice, statusKind, operatorLine, operatorName, reconnecting = false, roomDropped = false, partialTranscript, preamble, clause, channel = "text", shelf, transcript, transcriptCount, lastTurn, composing = false, unread = false, sheetExtra, voiceShelfExtra, followKey, revealSheet = false, showPrice = true, cardImageAspect = DEFAULT_CARD_ASPECT, bottomOffset = "auto", curationHref, productHref, navigate, draft, onDraftChange, onSubmit, composerDisabled = false, onAttach, attachSlot, attachBusy, proactive, pageKey, conciergeScrollRef, onEndCall, skinStyle, skin, preview = false, announcement, attribution, privacyChoices, initialDraft, initialSelection, initialFocus, initialMinimised, insets, hold, audio, onReady, onShown } = props;
|
|
8455
8458
|
const scopeId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
8456
8459
|
const rootRef = useRef(null);
|
|
8457
8460
|
const rowRef = useRef(null);
|
|
@@ -9467,6 +9470,7 @@ function Dock(props) {
|
|
|
9467
9470
|
...productHref ? { productHref } : {},
|
|
9468
9471
|
...navigate ? { navigate } : {}
|
|
9469
9472
|
}) : null,
|
|
9473
|
+
channel === "voice" && !showTranscript ? voiceShelfExtra : null,
|
|
9470
9474
|
channel === "text" || showTranscript ? transcript : null,
|
|
9471
9475
|
sheetExtra,
|
|
9472
9476
|
attribution !== void 0 ? /* @__PURE__ */ jsx("a", {
|
|
@@ -10188,6 +10192,46 @@ function createLucideIcon(iconDataOrName, iconNode = [], aliases = []) {
|
|
|
10188
10192
|
return Component;
|
|
10189
10193
|
}
|
|
10190
10194
|
//#endregion
|
|
10195
|
+
//#region ../../node_modules/.pnpm/lucide-react@1.50.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/audio-lines.mjs
|
|
10196
|
+
/**
|
|
10197
|
+
* @license lucide-react v1.50.0 - ISC
|
|
10198
|
+
*
|
|
10199
|
+
* This source code is licensed under the ISC license.
|
|
10200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10201
|
+
*/
|
|
10202
|
+
var __iconData$6 = {
|
|
10203
|
+
name: "audio-lines",
|
|
10204
|
+
size: 24,
|
|
10205
|
+
node: [
|
|
10206
|
+
["path", {
|
|
10207
|
+
d: "M2 10v3",
|
|
10208
|
+
key: "1fnikh"
|
|
10209
|
+
}],
|
|
10210
|
+
["path", {
|
|
10211
|
+
d: "M6 6v11",
|
|
10212
|
+
key: "11sgs0"
|
|
10213
|
+
}],
|
|
10214
|
+
["path", {
|
|
10215
|
+
d: "M10 3v18",
|
|
10216
|
+
key: "yhl04a"
|
|
10217
|
+
}],
|
|
10218
|
+
["path", {
|
|
10219
|
+
d: "M14 8v7",
|
|
10220
|
+
key: "3a1oy3"
|
|
10221
|
+
}],
|
|
10222
|
+
["path", {
|
|
10223
|
+
d: "M18 5v13",
|
|
10224
|
+
key: "123xd1"
|
|
10225
|
+
}],
|
|
10226
|
+
["path", {
|
|
10227
|
+
d: "M22 10v3",
|
|
10228
|
+
key: "154ddg"
|
|
10229
|
+
}]
|
|
10230
|
+
]
|
|
10231
|
+
};
|
|
10232
|
+
__iconData$6.node;
|
|
10233
|
+
var AudioLines = createLucideIcon(__iconData$6);
|
|
10234
|
+
//#endregion
|
|
10191
10235
|
//#region ../../node_modules/.pnpm/lucide-react@1.50.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/grip-vertical.mjs
|
|
10192
10236
|
/**
|
|
10193
10237
|
* @license lucide-react v1.50.0 - ISC
|
|
@@ -10533,7 +10577,7 @@ var MARK_SIZE = {
|
|
|
10533
10577
|
sm: 48,
|
|
10534
10578
|
lg: 64
|
|
10535
10579
|
};
|
|
10536
|
-
function AvatarFace({ avatar, state, size, label, messageArrived, tightenKey, name, muted, markSize }) {
|
|
10580
|
+
function AvatarFace({ avatar, state, size, label, messageArrived, tightenKey, name, muted, markSize, markState }) {
|
|
10537
10581
|
switch (avatar) {
|
|
10538
10582
|
case "orb": return /* @__PURE__ */ jsx(BotFace, {
|
|
10539
10583
|
state,
|
|
@@ -10551,7 +10595,7 @@ function AvatarFace({ avatar, state, size, label, messageArrived, tightenKey, na
|
|
|
10551
10595
|
case "monogram":
|
|
10552
10596
|
case "dot": return /* @__PURE__ */ jsx(Mark, {
|
|
10553
10597
|
variant: avatar,
|
|
10554
|
-
state: markStateFor(state, { muted }),
|
|
10598
|
+
state: markState ?? markStateFor(state, { muted }),
|
|
10555
10599
|
size: markSize ?? MARK_SIZE[size],
|
|
10556
10600
|
...name !== void 0 ? { name } : {},
|
|
10557
10601
|
...label !== void 0 ? { label } : {}
|
|
@@ -11450,6 +11494,13 @@ var defaultCallMessages = {
|
|
|
11450
11494
|
call_ended: "Call ended",
|
|
11451
11495
|
call_interrupted: "Interrupted",
|
|
11452
11496
|
call_try_saying: "Try saying",
|
|
11497
|
+
call_start: "Start a call",
|
|
11498
|
+
call_agent: "Assistant",
|
|
11499
|
+
call_you: "You",
|
|
11500
|
+
call_thinking: "Thinking…",
|
|
11501
|
+
call_listening: "Listening…",
|
|
11502
|
+
call_mute_short: "Mute",
|
|
11503
|
+
call_end_short: "End",
|
|
11453
11504
|
call_to_text: "Type instead",
|
|
11454
11505
|
call_back_to_call: "Back to call",
|
|
11455
11506
|
call_back_to_chat: "Back to chat",
|
|
@@ -11661,12 +11712,38 @@ function CallTimer({ record, locale }) {
|
|
|
11661
11712
|
});
|
|
11662
11713
|
}
|
|
11663
11714
|
/**
|
|
11664
|
-
* The
|
|
11665
|
-
*
|
|
11666
|
-
*
|
|
11667
|
-
|
|
11715
|
+
* The suggestions the call earns right now (SAA-503). The open capture card's
|
|
11716
|
+
* choices first, unlabelled; else, before the caller has said anything, the
|
|
11717
|
+
* tenant's starters under a "Try saying" label. Nothing fits ⇒ nothing drawn.
|
|
11718
|
+
*/
|
|
11719
|
+
function contextualSuggestions(turns, starters, choices) {
|
|
11720
|
+
if (choices?.length) return {
|
|
11721
|
+
lines: choices,
|
|
11722
|
+
opening: false
|
|
11723
|
+
};
|
|
11724
|
+
const opening = !turns.some((turn) => turn.speaker === "caller" && !turn.shared);
|
|
11725
|
+
return {
|
|
11726
|
+
lines: opening ? starters : [],
|
|
11727
|
+
opening
|
|
11728
|
+
};
|
|
11729
|
+
}
|
|
11730
|
+
/** The mark's state on a call: the room's own states, which `BotState` cannot say. */
|
|
11731
|
+
function callMarkState(state, bot, ended, muted) {
|
|
11732
|
+
if (ended) return "idle";
|
|
11733
|
+
if (state === "connecting" || state === "reconnecting") return "connecting";
|
|
11734
|
+
if (muted && bot !== "speaking") return "muted";
|
|
11735
|
+
return bot;
|
|
11736
|
+
}
|
|
11737
|
+
/**
|
|
11738
|
+
* The widget generation's call, after the Design-canvas prototype: a header
|
|
11739
|
+
* with the agent's name and the timer, the mark large in the middle (its
|
|
11740
|
+
* motion is the state), the call's own turns with each speaker named and the
|
|
11741
|
+
* caller in their own bubble, the pending turn in the stream ("Thinking…",
|
|
11742
|
+
* "Listening…"), an open capture card, the suggestions that fit, and the
|
|
11743
|
+
* labelled controls; then the summary once it ends. Styled by
|
|
11744
|
+
* `styles/call-view.css` (`.wgc`). See docs/CONCIERGE_GENERATIONS.md "Call mode".
|
|
11668
11745
|
*/
|
|
11669
|
-
function CallView({ state, callerSpeaking = false, turns, renderCards, suggestions, onSay, checkout = false, cart, messages, locale, voice, name, actions, record, bot, avatar, hint, onText, onBackToChat, testIds }) {
|
|
11746
|
+
function CallView({ state, callerSpeaking = false, turns, renderCards, renderOptions, suggestions, choices, extras, onSay, checkout = false, cart, messages, locale, voice, name, title, actions, record, bot, avatar, hint, onText, onBackToChat, testIds }) {
|
|
11670
11747
|
const t = (key) => callText(messages, key);
|
|
11671
11748
|
const ended = !record.active;
|
|
11672
11749
|
const { word, explain } = callStatus(state, {
|
|
@@ -11674,7 +11751,9 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11674
11751
|
callerSpeaking
|
|
11675
11752
|
});
|
|
11676
11753
|
const [said, setSaid] = useState([]);
|
|
11677
|
-
const shown = turns.slice(record.from).filter((turn, i, all) => turn.speaker === "event" ? false : turn.filler ? i === all.length - 1 : turn.text.trim() !== "" || (turn.cards?.items.length ?? 0) > 0);
|
|
11754
|
+
const shown = turns.slice(record.from).filter((turn, i, all) => turn.speaker === "event" ? false : turn.filler ? i === all.length - 1 : turn.text.trim() !== "" || (turn.cards?.items.length ?? 0) > 0 || turn.options !== void 0);
|
|
11755
|
+
const last = shown[shown.length - 1];
|
|
11756
|
+
const pending = ended ? null : state === "thinking" && !(last?.speaker === "agent" && last.final === false) ? "agent" : callerSpeaking && !(last?.speaker === "caller" && last.final === false) ? "caller" : null;
|
|
11678
11757
|
const streamRef = useRef(null);
|
|
11679
11758
|
const contentRef = useRef(null);
|
|
11680
11759
|
const rootRef = useRef(null);
|
|
@@ -11683,20 +11762,37 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11683
11762
|
const active = (root?.getRootNode())?.activeElement;
|
|
11684
11763
|
if (root && (!active || active === document.body)) (root.querySelector("button.wgc-mk,[data-end]") ?? root.querySelector(".wgc-ctl button,.wgc-sum button"))?.focus();
|
|
11685
11764
|
}, []);
|
|
11686
|
-
useFollowBottom(streamRef, contentRef, shown.length, void 0, true);
|
|
11765
|
+
useFollowBottom(streamRef, contentRef, shown.length + (pending ? 1 : 0) + (extras ? 1 : 0), void 0, true);
|
|
11687
11766
|
const interrupting = voice.agentSpeaking === true && voice.onInterrupt !== void 0;
|
|
11688
11767
|
const fixable = voice.phase === "blocked" && voice.onFixPermission !== void 0;
|
|
11689
|
-
const lines
|
|
11768
|
+
const { lines: offered, opening } = contextualSuggestions(turns.slice(record.from), suggestions, choices);
|
|
11769
|
+
const lines = !ended && onSay && (state === "muted" || state === "listening" && !callerSpeaking) ? offered.filter((line) => !said.includes(line)) : [];
|
|
11690
11770
|
const say = useScrollRow(t("call_say_prev"), t("call_say_next"), lines.length);
|
|
11691
11771
|
const added = ended ? addedDuringCall(record.cart, cart ?? []) : [];
|
|
11772
|
+
const muted = voice.muted === true && !ended;
|
|
11773
|
+
const big = shown.length === 0 && !extras;
|
|
11774
|
+
const agentName = name ?? title ?? t("call_agent");
|
|
11692
11775
|
const mark = /* @__PURE__ */ jsx(AvatarFace, {
|
|
11693
11776
|
avatar,
|
|
11694
11777
|
state: ended ? "idle" : bot,
|
|
11695
|
-
size: "sm",
|
|
11696
|
-
markSize:
|
|
11697
|
-
|
|
11778
|
+
size: big ? "lg" : "sm",
|
|
11779
|
+
markSize: big ? 112 : 64,
|
|
11780
|
+
markState: callMarkState(state, bot, ended, muted),
|
|
11781
|
+
muted,
|
|
11698
11782
|
...name !== void 0 ? { name } : {}
|
|
11699
11783
|
});
|
|
11784
|
+
const who = (speaker, operator) => /* @__PURE__ */ jsx("span", {
|
|
11785
|
+
className: "wgc-who",
|
|
11786
|
+
dir: "auto",
|
|
11787
|
+
children: speaker === "caller" ? t("call_you") : operator ?? agentName
|
|
11788
|
+
});
|
|
11789
|
+
const control = (button, short) => /* @__PURE__ */ jsxs("div", {
|
|
11790
|
+
className: "wgc-cw",
|
|
11791
|
+
children: [button, /* @__PURE__ */ jsx("span", {
|
|
11792
|
+
"aria-hidden": true,
|
|
11793
|
+
children: short
|
|
11794
|
+
})]
|
|
11795
|
+
});
|
|
11700
11796
|
return /* @__PURE__ */ jsxs("div", {
|
|
11701
11797
|
ref: rootRef,
|
|
11702
11798
|
"data-testid": "widget-call-view",
|
|
@@ -11706,27 +11802,16 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11706
11802
|
/* @__PURE__ */ jsxs("div", {
|
|
11707
11803
|
className: "wgc-hd",
|
|
11708
11804
|
children: [
|
|
11709
|
-
interrupting ? /* @__PURE__ */ jsx("button", {
|
|
11710
|
-
type: "button",
|
|
11711
|
-
"data-testid": "widget-interrupt",
|
|
11712
|
-
"aria-label": voice.labels.interrupt ?? defaultWidgetMessages.dock_interrupt,
|
|
11713
|
-
onClick: () => voice.onInterrupt?.("tap"),
|
|
11714
|
-
className: "wgc-mk",
|
|
11715
|
-
children: mark
|
|
11716
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
11717
|
-
className: "wgc-mk",
|
|
11718
|
-
children: mark
|
|
11719
|
-
}),
|
|
11720
11805
|
/* @__PURE__ */ jsx("p", {
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
children:
|
|
11806
|
+
className: "wgc-nm",
|
|
11807
|
+
dir: "auto",
|
|
11808
|
+
children: title ?? agentName
|
|
11724
11809
|
}),
|
|
11725
11810
|
/* @__PURE__ */ jsx("span", {
|
|
11726
11811
|
role: "status",
|
|
11727
11812
|
"data-testid": "widget-call-announce",
|
|
11728
11813
|
className: "sr-only",
|
|
11729
|
-
children:
|
|
11814
|
+
children: ended || explain && state !== "ducked" && !hint ? t(word) : null
|
|
11730
11815
|
}),
|
|
11731
11816
|
/* @__PURE__ */ jsx(CallTimer, {
|
|
11732
11817
|
record,
|
|
@@ -11735,9 +11820,25 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11735
11820
|
actions
|
|
11736
11821
|
]
|
|
11737
11822
|
}),
|
|
11738
|
-
|
|
11823
|
+
/* @__PURE__ */ jsx("div", {
|
|
11824
|
+
className: "wgc-hero",
|
|
11825
|
+
"data-big": big ? "" : void 0,
|
|
11826
|
+
children: interrupting ? /* @__PURE__ */ jsx("button", {
|
|
11827
|
+
type: "button",
|
|
11828
|
+
"data-testid": "widget-interrupt",
|
|
11829
|
+
"aria-label": voice.labels.interrupt ?? defaultWidgetMessages.dock_interrupt,
|
|
11830
|
+
onClick: () => voice.onInterrupt?.("tap"),
|
|
11831
|
+
className: "wgc-mk",
|
|
11832
|
+
children: mark
|
|
11833
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
11834
|
+
className: "wgc-mk",
|
|
11835
|
+
children: mark
|
|
11836
|
+
})
|
|
11837
|
+
}),
|
|
11838
|
+
explain && !ended || fixable ? /* @__PURE__ */ jsxs("div", {
|
|
11739
11839
|
className: "wgc-hint",
|
|
11740
|
-
|
|
11840
|
+
"data-testid": "widget-voice-state",
|
|
11841
|
+
children: [explain && !ended ? hint ?? /* @__PURE__ */ jsx("span", { children: t(word) }) : null, fixable ? /* @__PURE__ */ jsx("button", {
|
|
11741
11842
|
type: "button",
|
|
11742
11843
|
"data-testid": "widget-fix-permission",
|
|
11743
11844
|
onClick: voice.onFixPermission,
|
|
@@ -11747,41 +11848,66 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11747
11848
|
}) : null,
|
|
11748
11849
|
/* @__PURE__ */ jsx("div", {
|
|
11749
11850
|
ref: streamRef,
|
|
11750
|
-
role: "
|
|
11851
|
+
role: "region",
|
|
11751
11852
|
tabIndex: 0,
|
|
11752
11853
|
"aria-label": messages.conversation,
|
|
11753
11854
|
className: "wgc-log no-scrollbar",
|
|
11754
|
-
children: /* @__PURE__ */
|
|
11855
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
11755
11856
|
ref: contentRef,
|
|
11756
|
-
children:
|
|
11757
|
-
|
|
11758
|
-
|
|
11857
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
11858
|
+
role: "log",
|
|
11859
|
+
children: [shown.map((turn, i) => {
|
|
11860
|
+
const you = turn.speaker === "caller";
|
|
11861
|
+
const prev = shown[i - 1];
|
|
11862
|
+
const opens = prev === void 0 || prev.speaker !== turn.speaker || prev.operatorName !== turn.operatorName;
|
|
11863
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11864
|
+
className: "wgc-t",
|
|
11865
|
+
"data-you": you ? "" : void 0,
|
|
11866
|
+
children: [
|
|
11867
|
+
opens ? who(you ? "caller" : "agent", turn.operatorName) : null,
|
|
11868
|
+
turn.text.trim() !== "" ? /* @__PURE__ */ jsxs("p", {
|
|
11869
|
+
dir: textDirectionFor(turn.locale),
|
|
11870
|
+
lang: turn.locale,
|
|
11871
|
+
"data-testid": you ? "widget-turn-caller" : "widget-turn-agent",
|
|
11872
|
+
"data-cut": turn.cut || turn.filler ? "" : void 0,
|
|
11873
|
+
"data-cur": i === shown.length - 1 && !ended && !pending ? "" : void 0,
|
|
11874
|
+
"data-partial": turn.final === false ? "" : void 0,
|
|
11875
|
+
"aria-hidden": turn.final === false ? true : void 0,
|
|
11876
|
+
className: "wgc-tx",
|
|
11877
|
+
children: [stripBidiControls(turn.text), turn.cut ? /* @__PURE__ */ jsx("span", {
|
|
11878
|
+
className: "wgc-cut",
|
|
11879
|
+
children: t("call_interrupted")
|
|
11880
|
+
}) : null]
|
|
11881
|
+
}) : null,
|
|
11882
|
+
!you && turn.cards && turn.cards.items.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
11883
|
+
className: "wgc-cards",
|
|
11884
|
+
children: renderCards(turn.cards)
|
|
11885
|
+
}) : null,
|
|
11886
|
+
!you && turn.options && renderOptions ? /* @__PURE__ */ jsx("div", {
|
|
11887
|
+
className: "wgc-cards",
|
|
11888
|
+
children: renderOptions(turn.options)
|
|
11889
|
+
}) : null
|
|
11890
|
+
]
|
|
11891
|
+
}, i);
|
|
11892
|
+
}), pending ? /* @__PURE__ */ jsxs("div", {
|
|
11893
|
+
"aria-hidden": true,
|
|
11894
|
+
"data-testid": "widget-call-pending",
|
|
11759
11895
|
className: "wgc-t",
|
|
11760
|
-
"data-you":
|
|
11761
|
-
children: [
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
children: [stripBidiControls(turn.text), turn.cut ? /* @__PURE__ */ jsx("span", {
|
|
11771
|
-
className: "wgc-cut",
|
|
11772
|
-
children: t("call_interrupted")
|
|
11773
|
-
}) : null]
|
|
11774
|
-
}) : null, !you && turn.cards && turn.cards.items.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
11775
|
-
className: "wgc-cards",
|
|
11776
|
-
children: renderCards(turn.cards)
|
|
11777
|
-
}) : null]
|
|
11778
|
-
}, i);
|
|
11779
|
-
})
|
|
11896
|
+
"data-you": pending === "caller" ? "" : void 0,
|
|
11897
|
+
children: [last?.speaker === pending ? null : who(pending), /* @__PURE__ */ jsx("p", {
|
|
11898
|
+
className: "wgc-tx wgc-pend",
|
|
11899
|
+
children: t(pending === "agent" ? "call_thinking" : "call_listening")
|
|
11900
|
+
})]
|
|
11901
|
+
}) : null]
|
|
11902
|
+
}), extras ? /* @__PURE__ */ jsx("div", {
|
|
11903
|
+
className: "wgc-x",
|
|
11904
|
+
children: extras
|
|
11905
|
+
}) : null]
|
|
11780
11906
|
})
|
|
11781
11907
|
}),
|
|
11782
11908
|
lines.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
11783
11909
|
className: "wgc-say",
|
|
11784
|
-
children: [/* @__PURE__ */ jsx("p", { children: t("call_try_saying") }), /* @__PURE__ */ jsxs("div", {
|
|
11910
|
+
children: [opening ? /* @__PURE__ */ jsx("p", { children: t("call_try_saying") }) : null, /* @__PURE__ */ jsxs("div", {
|
|
11785
11911
|
className: "wsr",
|
|
11786
11912
|
children: [/* @__PURE__ */ jsx("ul", {
|
|
11787
11913
|
"data-testid": "widget-suggestions",
|
|
@@ -11805,6 +11931,10 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11805
11931
|
"data-testid": "widget-call-summary",
|
|
11806
11932
|
className: "wgc-sum",
|
|
11807
11933
|
children: [
|
|
11934
|
+
/* @__PURE__ */ jsx("p", {
|
|
11935
|
+
"data-testid": "widget-call-ended",
|
|
11936
|
+
children: t(word)
|
|
11937
|
+
}),
|
|
11808
11938
|
added.length > 0 ? /* @__PURE__ */ jsx("p", { children: formatMessage(t("call_summary_added"), { items: added.join(", ") }) }) : null,
|
|
11809
11939
|
checkout ? /* @__PURE__ */ jsx("p", { children: t("call_summary_checkout") }) : null,
|
|
11810
11940
|
/* @__PURE__ */ jsx("button", {
|
|
@@ -11817,19 +11947,19 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11817
11947
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
11818
11948
|
className: "wgc-ctl",
|
|
11819
11949
|
children: [
|
|
11820
|
-
/* @__PURE__ */ jsx(MicButton, {
|
|
11950
|
+
control(/* @__PURE__ */ jsx(MicButton, {
|
|
11821
11951
|
voice,
|
|
11822
11952
|
testId: testIds?.mic
|
|
11823
|
-
}),
|
|
11824
|
-
voice.onEnd !== void 0 ? /* @__PURE__ */ jsx("button", {
|
|
11953
|
+
}), t("call_mute_short")),
|
|
11954
|
+
voice.onEnd !== void 0 ? control(/* @__PURE__ */ jsx("button", {
|
|
11825
11955
|
type: "button",
|
|
11826
11956
|
"data-testid": testIds?.endCall,
|
|
11827
11957
|
"data-end": "",
|
|
11828
11958
|
onClick: voice.onEnd,
|
|
11829
11959
|
"aria-label": voice.labels.end ?? defaultWidgetMessages.call_end,
|
|
11830
11960
|
children: /* @__PURE__ */ jsx(PhoneOff, {})
|
|
11831
|
-
}) : null,
|
|
11832
|
-
/* @__PURE__ */ jsx("button", {
|
|
11961
|
+
}), t("call_end_short")) : null,
|
|
11962
|
+
control(/* @__PURE__ */ jsx("button", {
|
|
11833
11963
|
type: "button",
|
|
11834
11964
|
"data-testid": "widget-call-to-text",
|
|
11835
11965
|
onClick: onText,
|
|
@@ -11844,7 +11974,7 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11844
11974
|
"aria-hidden": true,
|
|
11845
11975
|
children: /* @__PURE__ */ jsx("path", { d: "M4 20l1.3-4A8 8 0 1 1 8 19z" })
|
|
11846
11976
|
})
|
|
11847
|
-
})
|
|
11977
|
+
}), t("call_to_text"))
|
|
11848
11978
|
]
|
|
11849
11979
|
})
|
|
11850
11980
|
]
|
|
@@ -11852,28 +11982,7 @@ function CallView({ state, callerSpeaking = false, turns, renderCards, suggestio
|
|
|
11852
11982
|
}
|
|
11853
11983
|
//#endregion
|
|
11854
11984
|
//#region src/widget/concierge-shell.tsx
|
|
11855
|
-
|
|
11856
|
-
* Maps the call onto the pill it shows, reusing fields `ConciergeShellVoice`
|
|
11857
|
-
* already carries rather than inventing new plumbing:
|
|
11858
|
-
*
|
|
11859
|
-
* - `'connecting'` → `connecting`
|
|
11860
|
-
* - `'waiting'` (the agent is thinking, between the caller's turn ending and
|
|
11861
|
-
* the reply starting) → `thinking`
|
|
11862
|
-
* - `'live'` + `agentSpeaking` → `speaking`
|
|
11863
|
-
* - `'live'` otherwise → `listening`
|
|
11864
|
-
* - `'idle'` / `'blocked'` → `null`, no pill
|
|
11865
|
-
*
|
|
11866
|
-
* `agentSpeaking` is already a real field on {@link ConciergeShellVoice} —
|
|
11867
|
-
* this function only reads it, it does not require every caller to start
|
|
11868
|
-
* setting it; a caller that never populates it simply never reaches
|
|
11869
|
-
* `'speaking'`, which is exactly the same "renders sensibly with what it is
|
|
11870
|
-
* given" contract every other optional field on this interface follows.
|
|
11871
|
-
*/
|
|
11872
|
-
function voiceStatePillState(voice) {
|
|
11873
|
-
const phase = voice?.phase;
|
|
11874
|
-
return phase === "connecting" ? "connecting" : phase === "waiting" ? "thinking" : phase === "live" ? voice?.agentSpeaking ? "speaking" : "listening" : null;
|
|
11875
|
-
}
|
|
11876
|
-
function ConciergeShell({ open, onOpenChange, state, messageArrived = false, launcher, launcherInitials, launcherVariant, agentName, typing = false, operatorName, avatar = "orb", labels, children, badge, draft, onDraftChange, onSubmit, composerDisabled = false, voice, call, announcement, skin, skinStyle, idPrefix = "concierge", scrollKey, composerLeading, testIds, position = DEFAULT_CONCIERGE_POSITION, onPositionChange, attribution, privacyChoices, focusOnOpen = true }) {
|
|
11985
|
+
function ConciergeShell({ open, onOpenChange, state, messageArrived = false, launcher, launcherInitials, launcherVariant, agentName, typing = false, operatorName, avatar = "orb", labels, children, badge, draft, onDraftChange, onSubmit, composerDisabled = false, voice, callIcon, call, announcement, skin, skinStyle, idPrefix = "concierge", scrollKey, composerLeading, testIds, position = DEFAULT_CONCIERGE_POSITION, onPositionChange, attribution, privacyChoices, focusOnOpen = true }) {
|
|
11877
11986
|
const triggerId = `${idPrefix}-trigger`;
|
|
11878
11987
|
const inputId = `${idPrefix}-input`;
|
|
11879
11988
|
const panelRef = useRef(null);
|
|
@@ -11948,8 +12057,6 @@ function ConciergeShell({ open, onOpenChange, state, messageArrived = false, lau
|
|
|
11948
12057
|
]);
|
|
11949
12058
|
/** A call is running — anything but `idle`, including the phases not speakable yet. */
|
|
11950
12059
|
const inCall = voice !== void 0 && voice.phase !== "idle";
|
|
11951
|
-
/** `null` for `idle` and `blocked` — see `voiceStatePillState`. */
|
|
11952
|
-
const voicePillState = voiceStatePillState(voice);
|
|
11953
12060
|
/** No voice leg to press at all, or a microphone the browser refused. */
|
|
11954
12061
|
const micUnusable = voice !== void 0 && (voice.disabled === true || voice.phase === "blocked");
|
|
11955
12062
|
const showEnd = inCall && voice.onEnd !== void 0;
|
|
@@ -12013,6 +12120,7 @@ function ConciergeShell({ open, onOpenChange, state, messageArrived = false, lau
|
|
|
12013
12120
|
...call,
|
|
12014
12121
|
voice,
|
|
12015
12122
|
...agentName !== void 0 ? { name: agentName } : {},
|
|
12123
|
+
title: labels.title ?? labels.dialog,
|
|
12016
12124
|
checkout: callMode.record.checkout,
|
|
12017
12125
|
actions: closeButton,
|
|
12018
12126
|
record: callMode.record,
|
|
@@ -12055,35 +12163,30 @@ function ConciergeShell({ open, onOpenChange, state, messageArrived = false, lau
|
|
|
12055
12163
|
children: labels.title ?? labels.dialog
|
|
12056
12164
|
}), /* @__PURE__ */ jsxs("div", {
|
|
12057
12165
|
className: "wgp-sub",
|
|
12058
|
-
children: [
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
"aria-hidden": true,
|
|
12064
|
-
"data-live": voicePillState === "speaking" || voicePillState === "listening" ? "" : void 0,
|
|
12065
|
-
className: cn(voicePillState !== "listening" && "animate-pulse motion-reduce:animate-none")
|
|
12066
|
-
}), /* @__PURE__ */ jsx("span", { children: voice?.labels[voicePillState] ?? defaultWidgetMessages[`voice_state_${voicePillState}`] })] }) : null
|
|
12067
|
-
}),
|
|
12068
|
-
operatorName === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
12069
|
-
"data-testid": "widget-operator-name",
|
|
12070
|
-
dir: "auto",
|
|
12071
|
-
children: operatorName
|
|
12072
|
-
}),
|
|
12073
|
-
badge
|
|
12074
|
-
]
|
|
12166
|
+
children: [operatorName === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
12167
|
+
"data-testid": "widget-operator-name",
|
|
12168
|
+
dir: "auto",
|
|
12169
|
+
children: operatorName
|
|
12170
|
+
}), badge]
|
|
12075
12171
|
})]
|
|
12076
12172
|
}),
|
|
12077
12173
|
/* @__PURE__ */ jsxs("div", {
|
|
12078
12174
|
className: "wgp-act",
|
|
12079
|
-
children: [
|
|
12175
|
+
children: [inCall && call ? /* @__PURE__ */ jsx(CallTimer, {
|
|
12176
|
+
record: callMode.record,
|
|
12177
|
+
locale: call.locale
|
|
12178
|
+
}) : voice && !inCall ? /* @__PURE__ */ jsx("button", {
|
|
12080
12179
|
type: "button",
|
|
12081
12180
|
className: "wgp-ib",
|
|
12082
12181
|
"data-testid": "widget-voice-cta",
|
|
12083
|
-
"aria-label": voice.labels.start,
|
|
12084
|
-
title: voice.labels.start,
|
|
12182
|
+
"aria-label": micUnusable ? voice.labels.unavailable ?? voice.labels.start : voice.labels.start,
|
|
12183
|
+
title: micUnusable ? voice.labels.unavailable ?? voice.labels.start : voice.labels.start,
|
|
12184
|
+
disabled: micUnusable,
|
|
12085
12185
|
onClick: voice.onStart,
|
|
12086
|
-
children: /* @__PURE__ */ jsx(
|
|
12186
|
+
children: callIcon ? /* @__PURE__ */ jsx("span", {
|
|
12187
|
+
"aria-hidden": true,
|
|
12188
|
+
children: callIcon
|
|
12189
|
+
}) : /* @__PURE__ */ jsx(AudioLines, {})
|
|
12087
12190
|
}) : null, closeButton]
|
|
12088
12191
|
})
|
|
12089
12192
|
]
|
|
@@ -12104,7 +12207,7 @@ function ConciergeShell({ open, onOpenChange, state, messageArrived = false, lau
|
|
|
12104
12207
|
className: "wgp-typing",
|
|
12105
12208
|
children: [/* @__PURE__ */ jsx("span", {
|
|
12106
12209
|
className: "sr-only",
|
|
12107
|
-
children: defaultWidgetMessages.typing
|
|
12210
|
+
children: labels.typing ?? defaultWidgetMessages.typing
|
|
12108
12211
|
}), [
|
|
12109
12212
|
0,
|
|
12110
12213
|
1,
|
|
@@ -12124,7 +12227,7 @@ function ConciergeShell({ open, onOpenChange, state, messageArrived = false, lau
|
|
|
12124
12227
|
className: "wgp-cz",
|
|
12125
12228
|
onSubmit: submit,
|
|
12126
12229
|
children: [
|
|
12127
|
-
showEnd || interrupting || fixable ||
|
|
12230
|
+
showEnd || interrupting || fixable || inCall ? /* @__PURE__ */ jsxs("div", {
|
|
12128
12231
|
className: "wgp-call",
|
|
12129
12232
|
children: [
|
|
12130
12233
|
fixable ? /* @__PURE__ */ jsx("button", {
|
|
@@ -12155,6 +12258,11 @@ function ConciergeShell({ open, onOpenChange, state, messageArrived = false, lau
|
|
|
12155
12258
|
})
|
|
12156
12259
|
})
|
|
12157
12260
|
}) : null,
|
|
12261
|
+
inCall && voice ? /* @__PURE__ */ jsx(MicButton, {
|
|
12262
|
+
voice,
|
|
12263
|
+
testId: testIds?.mic,
|
|
12264
|
+
className: "wgp-ib"
|
|
12265
|
+
}) : null,
|
|
12158
12266
|
call !== void 0 && inCall ? /* @__PURE__ */ jsx("button", {
|
|
12159
12267
|
type: "button",
|
|
12160
12268
|
onClick: callMode.backToCall,
|
|
@@ -12206,19 +12314,15 @@ function ConciergeShell({ open, onOpenChange, state, messageArrived = false, lau
|
|
|
12206
12314
|
autoComplete: "off",
|
|
12207
12315
|
className: cn("wgp-in", inCall && draft === "" && "opacity-60 focus:opacity-100")
|
|
12208
12316
|
}),
|
|
12209
|
-
|
|
12210
|
-
voice,
|
|
12211
|
-
testId: testIds?.mic,
|
|
12212
|
-
className: "wgp-ib"
|
|
12213
|
-
}) : null,
|
|
12214
|
-
draft.trim() ? /* @__PURE__ */ jsx("button", {
|
|
12317
|
+
/* @__PURE__ */ jsx("button", {
|
|
12215
12318
|
type: "submit",
|
|
12216
12319
|
"aria-label": labels.send,
|
|
12320
|
+
title: labels.send,
|
|
12217
12321
|
"data-testid": testIds?.send,
|
|
12218
|
-
disabled: composerDisabled,
|
|
12322
|
+
disabled: composerDisabled || draft.trim() === "",
|
|
12219
12323
|
className: "wgp-ib wgp-send",
|
|
12220
12324
|
children: /* @__PURE__ */ jsx(Send, { className: "rtl:-scale-x-100" })
|
|
12221
|
-
})
|
|
12325
|
+
})
|
|
12222
12326
|
]
|
|
12223
12327
|
}),
|
|
12224
12328
|
attribution || privacyChoices ? /* @__PURE__ */ jsxs("p", {
|
|
@@ -12537,7 +12641,7 @@ function positionFor(dock) {
|
|
|
12537
12641
|
const align = dock?.layout?.desktopAlign;
|
|
12538
12642
|
return align === "left" || align === "right" ? `bottom-${align}` : DEFAULT_CONCIERGE_POSITION;
|
|
12539
12643
|
}
|
|
12540
|
-
function ShellRenderer({ turns, showMic, callPhase, micOpen, onToggleMic, onEndCall, statusKind, statusLine, escalated, operatorName, humanTyping, composing, replyStreaming, channel, draft, onDraftChange, submit, attaching, onAttach, attachInput, transcript, extras, messages, skinStyle, avatar, attribution, privacyChoices, voice: derivedVoice, renderCards, suggestions, call: callHooks, cart, dock, locale }) {
|
|
12644
|
+
function ShellRenderer({ turns, showMic, callPhase, micOpen, onToggleMic, onEndCall, statusKind, statusLine, escalated, operatorName, humanTyping, composing, replyStreaming, channel, draft, onDraftChange, submit, attaching, onAttach, attachInput, transcript, extras, messages, skinStyle, avatar, attribution, privacyChoices, voice: derivedVoice, renderCards, renderOptions, suggestions, call: callHooks, cart, capturing, showBasket, captureChoices, dock, locale }) {
|
|
12541
12645
|
const [restored] = useState(readOpen);
|
|
12542
12646
|
const [open, setOpen] = useState(dock?.initialMinimised === false || restored);
|
|
12543
12647
|
const onShown = dock?.onShown;
|
|
@@ -12666,9 +12770,9 @@ function ShellRenderer({ turns, showMic, callPhase, micOpen, onToggleMic, onEndC
|
|
|
12666
12770
|
...voiceInput.onFixPermission !== void 0 ? { onFixPermission: voiceInput.onFixPermission } : {},
|
|
12667
12771
|
...voiceUnavailable !== void 0 ? { disabled: true } : {},
|
|
12668
12772
|
labels: {
|
|
12669
|
-
start: messages
|
|
12773
|
+
start: callText(messages, "call_start"),
|
|
12670
12774
|
end: messages.call_end,
|
|
12671
|
-
mute: messages
|
|
12775
|
+
mute: callText(messages, "call_mute_short"),
|
|
12672
12776
|
unmute: messages.mic_start,
|
|
12673
12777
|
connecting: messages.voice_state_connecting,
|
|
12674
12778
|
...messages.dock_fix_browser !== void 0 ? { fixBrowser: messages.dock_fix_browser } : {},
|
|
@@ -12735,6 +12839,7 @@ function ShellRenderer({ turns, showMic, callPhase, micOpen, onToggleMic, onEndC
|
|
|
12735
12839
|
...agentName ? { title: agentName } : {},
|
|
12736
12840
|
composerPlaceholder: messages.type_placeholder,
|
|
12737
12841
|
send: messages.send,
|
|
12842
|
+
typing: messages.typing,
|
|
12738
12843
|
move: messages.move,
|
|
12739
12844
|
...launcherLabel ? { launcher: launcherLabel } : {}
|
|
12740
12845
|
},
|
|
@@ -12744,7 +12849,10 @@ function ShellRenderer({ turns, showMic, callPhase, micOpen, onToggleMic, onEndC
|
|
|
12744
12849
|
callerSpeaking: voiceInput.callerSpeaking === true,
|
|
12745
12850
|
turns,
|
|
12746
12851
|
renderCards,
|
|
12852
|
+
renderOptions,
|
|
12747
12853
|
suggestions,
|
|
12854
|
+
choices: captureChoices,
|
|
12855
|
+
...capturing || attaching !== null || showBasket && (cart?.lines.length ?? 0) > 0 ? { extras } : {},
|
|
12748
12856
|
...callHooks?.sendText !== void 0 ? { onSay: callHooks.sendText } : {},
|
|
12749
12857
|
...checkout !== void 0 ? { checkout } : {},
|
|
12750
12858
|
...cart !== void 0 ? { cart: cart.lines } : {},
|
|
@@ -12785,7 +12893,9 @@ function ShellRenderer({ turns, showMic, callPhase, micOpen, onToggleMic, onEndC
|
|
|
12785
12893
|
* Imported by `cdn/ui.ts` and by `rendererFor`; never by `voice-widget.tsx`,
|
|
12786
12894
|
* so a bundle built around the OTHER renderer does not carry this one.
|
|
12787
12895
|
*/
|
|
12788
|
-
function DockRenderer({ turns, lastTurn, operatorName, composing, onEndCall, voice, statusLine, statusKind, notice, escalated, humanTyping, draft, onDraftChange, submit, showBasket, cart, attaching, capturing, onAttach, attachInput, transcript, extras, messages, locale, navigate, curationHref, productHref, skinStyle, avatar, attribution, privacyChoices, dock }) {
|
|
12896
|
+
function DockRenderer({ turns, lastTurn, operatorName, composing, onEndCall, voice, statusLine, statusKind, notice, escalated, humanTyping, draft, onDraftChange, submit, showBasket, cart, attaching, capturing, onAttach, attachInput, transcript, renderOptions, extras, messages, locale, navigate, curationHref, productHref, skinStyle, avatar, attribution, privacyChoices, dock }) {
|
|
12897
|
+
const asked = turns.findLastIndex((turn) => turn.options !== void 0);
|
|
12898
|
+
const openOptions = asked >= 0 && !turns.slice(asked + 1).some((turn) => turn.speaker === "caller") ? turns[asked]?.options : void 0;
|
|
12789
12899
|
return /* @__PURE__ */ jsx(Dock, {
|
|
12790
12900
|
identity: {
|
|
12791
12901
|
name: "",
|
|
@@ -12813,12 +12923,13 @@ function DockRenderer({ turns, lastTurn, operatorName, composing, onEndCall, voi
|
|
|
12813
12923
|
draft,
|
|
12814
12924
|
onDraftChange,
|
|
12815
12925
|
onSubmit: submit,
|
|
12816
|
-
revealSheet: showBasket && cart !== void 0 && cart.lines.length > 0 || attaching !== null || capturing,
|
|
12817
|
-
followKey: turns.reduce((n, turn) => n + 1 + turn.text.length + (turn.cards?.items.length ?? 0), 0) + (humanTyping ? 1 : 0),
|
|
12926
|
+
revealSheet: showBasket && cart !== void 0 && cart.lines.length > 0 || attaching !== null || capturing || openOptions !== void 0,
|
|
12927
|
+
followKey: turns.reduce((n, turn) => n + 1 + turn.text.length + (turn.cards?.items.length ?? 0) + (turn.options ? 1 : 0), 0) + (humanTyping ? 1 : 0),
|
|
12818
12928
|
...onAttach ? { onAttach } : {},
|
|
12819
12929
|
attachBusy: attaching !== null && !attaching.failed,
|
|
12820
12930
|
...attachInput !== null ? { attachSlot: attachInput } : {},
|
|
12821
12931
|
sheetExtra: extras,
|
|
12932
|
+
...openOptions ? { voiceShelfExtra: renderOptions(openOptions) } : {},
|
|
12822
12933
|
transcript,
|
|
12823
12934
|
transcriptCount: turns.length,
|
|
12824
12935
|
...lastTurn !== void 0 ? { lastTurn } : {},
|
|
@@ -13167,6 +13278,170 @@ function WidgetCardList({ cards, onAddToCart, onChooseOptions, chooseOptionsBusy
|
|
|
13167
13278
|
});
|
|
13168
13279
|
}
|
|
13169
13280
|
//#endregion
|
|
13281
|
+
//#region src/variant-option-groups.ts
|
|
13282
|
+
var valueOf = (variant, name) => name === "" ? variant.title : variant.options.find((o) => o.name === name)?.value;
|
|
13283
|
+
var fits = (variant, selected, skip) => Object.keys(selected).every((n) => n === skip || valueOf(variant, n) === selected[n]);
|
|
13284
|
+
/**
|
|
13285
|
+
* The option names the chips are grouped by, in the first variant's order:
|
|
13286
|
+
* only names every variant carries and whose value varies. Variants that do
|
|
13287
|
+
* not share one set of names (or have none) are one group of titles, so every
|
|
13288
|
+
* variant is still a chip.
|
|
13289
|
+
*/
|
|
13290
|
+
function optionNames(variants) {
|
|
13291
|
+
const names = [...new Set(variants[0]?.options.map((o) => o.name))].filter((n) => variants.every((v) => v.options.length === variants[0]?.options.length && valueOf(v, n)) && new Set(variants.map((v) => valueOf(v, n))).size > 1);
|
|
13292
|
+
return names.length > 0 ? names : [""];
|
|
13293
|
+
}
|
|
13294
|
+
/**
|
|
13295
|
+
* The chips for the current selection. Each group offers the values still
|
|
13296
|
+
* reachable from the choices made in the groups BEFORE it, so a later group
|
|
13297
|
+
* never offers a combination that does not exist; each chip is priced against
|
|
13298
|
+
* every other choice that still fits it.
|
|
13299
|
+
*/
|
|
13300
|
+
function optionGroups(variants, selected) {
|
|
13301
|
+
const names = optionNames(variants);
|
|
13302
|
+
return names.map((name, g) => {
|
|
13303
|
+
const earlier = Object.fromEntries(names.slice(0, g).flatMap((n) => selected[n] === void 0 ? [] : [[n, selected[n]]]));
|
|
13304
|
+
const reachable = variants.filter((v) => fits(v, earlier));
|
|
13305
|
+
return {
|
|
13306
|
+
name,
|
|
13307
|
+
chips: [...new Set(reachable.map((v) => valueOf(v, name)))].map((value) => {
|
|
13308
|
+
const withValue = reachable.filter((v) => valueOf(v, name) === value);
|
|
13309
|
+
const fitting = withValue.filter((v) => fits(v, selected, name));
|
|
13310
|
+
const prices = (fitting.length > 0 ? fitting : withValue).map((v) => v.priceMinor);
|
|
13311
|
+
const priceMinor = Math.min(...prices);
|
|
13312
|
+
return {
|
|
13313
|
+
value,
|
|
13314
|
+
priceMinor,
|
|
13315
|
+
from: prices.some((p) => p !== priceMinor)
|
|
13316
|
+
};
|
|
13317
|
+
})
|
|
13318
|
+
};
|
|
13319
|
+
});
|
|
13320
|
+
}
|
|
13321
|
+
/**
|
|
13322
|
+
* The selection after a tap: that value in that group, every other choice
|
|
13323
|
+
* kept only while some variant still has all of them.
|
|
13324
|
+
*/
|
|
13325
|
+
function selectOption(variants, selected, name, value) {
|
|
13326
|
+
const next = { [name]: value };
|
|
13327
|
+
for (const n of optionNames(variants)) {
|
|
13328
|
+
const kept = selected[n];
|
|
13329
|
+
if (n === name || kept === void 0) continue;
|
|
13330
|
+
if (variants.some((v) => fits(v, {
|
|
13331
|
+
...next,
|
|
13332
|
+
[n]: kept
|
|
13333
|
+
}))) next[n] = kept;
|
|
13334
|
+
}
|
|
13335
|
+
return next;
|
|
13336
|
+
}
|
|
13337
|
+
/** The one variant a complete selection names, or `undefined` while any group is unchosen. */
|
|
13338
|
+
function resolvedVariant(variants, selected) {
|
|
13339
|
+
return optionNames(variants).every((n) => selected[n] !== void 0) ? variants.find((v) => fits(v, selected)) : void 0;
|
|
13340
|
+
}
|
|
13341
|
+
/**
|
|
13342
|
+
* The cart item a chosen variant adds: the product's display fields plus THIS
|
|
13343
|
+
* variant's ids and price. The same shape a card's Add button hands
|
|
13344
|
+
* `resolveAddToCartHandler`, so a chip adds through the one add path.
|
|
13345
|
+
*/
|
|
13346
|
+
function cartItemFor({ product }, { variantId, platformVariantId, priceMinor }) {
|
|
13347
|
+
return {
|
|
13348
|
+
...product,
|
|
13349
|
+
variantId,
|
|
13350
|
+
...platformVariantId !== void 0 ? { platformVariantId } : {},
|
|
13351
|
+
priceMinor,
|
|
13352
|
+
available: true
|
|
13353
|
+
};
|
|
13354
|
+
}
|
|
13355
|
+
//#endregion
|
|
13356
|
+
//#region src/variant-options.tsx
|
|
13357
|
+
/**
|
|
13358
|
+
* SAA-509 — the variant choice as tappable chips under the line that asks
|
|
13359
|
+
* for it ("Which size?"): one row per option (Size, Colour…), each chip a
|
|
13360
|
+
* value and its price. Only in-stock variants reach it, so there is no
|
|
13361
|
+
* sold-out state to draw.
|
|
13362
|
+
*
|
|
13363
|
+
* A tap that completes the choice adds that variant through `onAddToCart`,
|
|
13364
|
+
* the one path every add takes, and the concierge hears of it through the
|
|
13365
|
+
* `cart_add` report that path sends; on a call it is said instead (`onSay`).
|
|
13366
|
+
* A tap that leaves an option unchosen narrows the next row; after an add the
|
|
13367
|
+
* next tap starts a fresh choice, and a tap on the added chip does nothing.
|
|
13368
|
+
* Chips are `aria-pressed` toggles in labelled groups, and stay focusable
|
|
13369
|
+
* while inert (`aria-disabled`, as card buttons do).
|
|
13370
|
+
*/
|
|
13371
|
+
function VariantOptionChips({ options, onAddToCart, messages, locale, showPrice = true, onSay, busy = false }) {
|
|
13372
|
+
const [selected, setSelected] = useState({});
|
|
13373
|
+
const [adding, setAdding] = useState(false);
|
|
13374
|
+
const [added, setAdded] = useState([]);
|
|
13375
|
+
const addingRef = useRef(false);
|
|
13376
|
+
const { variants, product } = options;
|
|
13377
|
+
const chosen = resolvedVariant(variants, selected);
|
|
13378
|
+
const text = (key) => messages[key] ?? defaultWidgetMessages[key];
|
|
13379
|
+
const inert = !onAddToCart && !onSay || adding || busy;
|
|
13380
|
+
const pick = async (name, value) => {
|
|
13381
|
+
if (inert || addingRef.current) return;
|
|
13382
|
+
const done = chosen !== void 0 && added.includes(chosen.variantId);
|
|
13383
|
+
if (done && selected[name] === value) return;
|
|
13384
|
+
const next = selectOption(variants, done ? {} : selected, name, value);
|
|
13385
|
+
setSelected(next);
|
|
13386
|
+
const variant = resolvedVariant(variants, next);
|
|
13387
|
+
if (!variant) return;
|
|
13388
|
+
addingRef.current = true;
|
|
13389
|
+
setAdding(true);
|
|
13390
|
+
try {
|
|
13391
|
+
if (onSay) await onSay([product.title, ...Object.values(next)].join(", "));
|
|
13392
|
+
else {
|
|
13393
|
+
await onAddToCart?.(cartItemFor(options, variant));
|
|
13394
|
+
setAdded((prev) => [...prev, variant.variantId]);
|
|
13395
|
+
}
|
|
13396
|
+
} catch {} finally {
|
|
13397
|
+
addingRef.current = false;
|
|
13398
|
+
setAdding(false);
|
|
13399
|
+
}
|
|
13400
|
+
};
|
|
13401
|
+
const groups = optionGroups(variants, selected);
|
|
13402
|
+
return /* @__PURE__ */ jsx("div", {
|
|
13403
|
+
"data-testid": "widget-variant-options",
|
|
13404
|
+
className: "flex w-full flex-col gap-2 pt-1",
|
|
13405
|
+
children: groups.map((group) => /* @__PURE__ */ jsxs("div", {
|
|
13406
|
+
role: "group",
|
|
13407
|
+
"aria-label": formatMessage(text("options_label"), {
|
|
13408
|
+
option: group.name || product.title,
|
|
13409
|
+
title: product.title
|
|
13410
|
+
}),
|
|
13411
|
+
children: [groups.length > 1 ? /* @__PURE__ */ jsx("p", {
|
|
13412
|
+
"aria-hidden": "true",
|
|
13413
|
+
className: "px-1 pb-1 text-[11px] font-medium text-[var(--widget-foreground-muted)]",
|
|
13414
|
+
children: group.name
|
|
13415
|
+
}) : null, /* @__PURE__ */ jsx("ul", {
|
|
13416
|
+
className: "flex flex-wrap gap-1.5",
|
|
13417
|
+
children: group.chips.map((chip) => {
|
|
13418
|
+
const pressed = selected[group.name] === chip.value;
|
|
13419
|
+
const done = pressed && chosen !== void 0 && added.includes(chosen.variantId);
|
|
13420
|
+
const price = formatMoney(chip.priceMinor, product.currency, locale);
|
|
13421
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
|
|
13422
|
+
type: "button",
|
|
13423
|
+
"data-testid": "widget-variant-option",
|
|
13424
|
+
"data-phase": pressed && adding ? "adding" : done ? "added" : "idle",
|
|
13425
|
+
"aria-pressed": pressed,
|
|
13426
|
+
"aria-disabled": inert,
|
|
13427
|
+
onClick: () => void pick(group.name, chip.value),
|
|
13428
|
+
className: "cursor-pointer rounded-full bg-[var(--widget-chip)] px-3 py-1.5 text-xs font-medium text-[var(--widget-foreground)] ring-1 ring-black/10 transition-colors hover:bg-[var(--widget-accent)] hover:text-[var(--widget-accent-foreground)] focus-visible:ring-2 focus-visible:ring-[var(--widget-accent-ring)] focus-visible:outline-none aria-disabled:cursor-default aria-pressed:bg-[var(--widget-accent)] aria-pressed:text-[var(--widget-accent-foreground)]",
|
|
13429
|
+
children: [
|
|
13430
|
+
done ? "✓ " : "",
|
|
13431
|
+
/* @__PURE__ */ jsx("bdi", { children: chip.value }),
|
|
13432
|
+
showPrice ? ` · ${chip.from ? formatMessage(text("options_price_from"), { price }) : price}` : "",
|
|
13433
|
+
done ? /* @__PURE__ */ jsxs("span", {
|
|
13434
|
+
className: "sr-only",
|
|
13435
|
+
children: [" ", text("options_added")]
|
|
13436
|
+
}) : null
|
|
13437
|
+
]
|
|
13438
|
+
}) }, chip.value);
|
|
13439
|
+
})
|
|
13440
|
+
})]
|
|
13441
|
+
}, group.name))
|
|
13442
|
+
});
|
|
13443
|
+
}
|
|
13444
|
+
//#endregion
|
|
13170
13445
|
//#region src/widget-cart-summary.tsx
|
|
13171
13446
|
/**
|
|
13172
13447
|
* The basket, inside the conversation.
|
|
@@ -13574,7 +13849,7 @@ function readsAsCartViewIntent(text) {
|
|
|
13574
13849
|
* can pass it without conversion.
|
|
13575
13850
|
*/
|
|
13576
13851
|
function basketIntentFromTurns(turns) {
|
|
13577
|
-
const lastCallerLine = [...turns].reverse().find((turn) => turn.speaker === "caller");
|
|
13852
|
+
const lastCallerLine = [...turns].reverse().find((turn) => turn.speaker === "caller" && !turn.shared);
|
|
13578
13853
|
if (lastCallerLine === void 0) return false;
|
|
13579
13854
|
return readsAsCheckoutIntent(lastCallerLine.text) || readsAsCartViewIntent(lastCallerLine.text);
|
|
13580
13855
|
}
|
|
@@ -13619,7 +13894,7 @@ function VoiceWidget({ renderer, generation, ...props }) {
|
|
|
13619
13894
|
});
|
|
13620
13895
|
}
|
|
13621
13896
|
/** `VoiceWidget` with the renderer decided — the component the CDN entries and `ConciergeHost` use. */
|
|
13622
|
-
function VoiceWidgetWithRenderer({ renderer, state, turns, onToggleMic, onEndCall, callPhase = "idle", onSendText, micOpen, status, statusKind, notice, mode = "voice", escalated = false, humanTyping = false, onTyping, onAddToCart, onChooseOptions, chooseOptionsBusy = false, curationHref, productHref, onAttachFile, cart, captureCard, messages = defaultWidgetMessages, suggestions, navigate, locale = "en", skinStyle, avatar, attribution, privacyChoices, call, dock }) {
|
|
13897
|
+
function VoiceWidgetWithRenderer({ renderer, state, turns, onToggleMic, onEndCall, callPhase = "idle", onSendText, micOpen, status, statusKind, notice, mode = "voice", escalated = false, humanTyping = false, onTyping, onAddToCart, onChooseOptions, chooseOptionsBusy = false, curationHref, productHref, onAttachFile, cart, captureCard, captureChoices, messages = defaultWidgetMessages, suggestions, navigate, locale = "en", skinStyle, avatar, attribution, privacyChoices, call, dock }) {
|
|
13623
13898
|
const [draft, setDraft] = useState("");
|
|
13624
13899
|
const [sending, setSending] = useState(false);
|
|
13625
13900
|
/** Roomy mode — see the expand control in the header. Collapses back on close, so a reopened widget starts small. */
|
|
@@ -13727,6 +14002,16 @@ function VoiceWidgetWithRenderer({ renderer, state, turns, onToggleMic, onEndCal
|
|
|
13727
14002
|
...dock?.showPrice !== void 0 ? { showPrice: dock.showPrice } : {},
|
|
13728
14003
|
...dock?.cardImageAspect !== void 0 ? { imageAspect: dock.cardImageAspect } : {}
|
|
13729
14004
|
});
|
|
14005
|
+
const sayOnCall = (callPhase === "live" || callPhase === "waiting") && call?.sendText ? call.sendText : void 0;
|
|
14006
|
+
const renderOptions = (options) => /* @__PURE__ */ jsx(VariantOptionChips, {
|
|
14007
|
+
options,
|
|
14008
|
+
...onAddToCart ? { onAddToCart } : {},
|
|
14009
|
+
...sayOnCall ? { onSay: sayOnCall } : {},
|
|
14010
|
+
busy: chooseOptionsBusy,
|
|
14011
|
+
messages,
|
|
14012
|
+
locale,
|
|
14013
|
+
...dock?.showPrice !== void 0 ? { showPrice: dock.showPrice } : {}
|
|
14014
|
+
}, `${options.product.productId}:${options.variants.map((v) => v.variantId).join()}`);
|
|
13730
14015
|
const openers = suggestions ?? SUGGESTION_KEYS.map((key) => messages[key]);
|
|
13731
14016
|
const renderLog = (shown) => /* @__PURE__ */ jsxs("div", {
|
|
13732
14017
|
role: "log",
|
|
@@ -13775,6 +14060,10 @@ function VoiceWidgetWithRenderer({ renderer, state, turns, onToggleMic, onEndCal
|
|
|
13775
14060
|
className: "w-full",
|
|
13776
14061
|
children: renderCards(turn.cards)
|
|
13777
14062
|
}) : null,
|
|
14063
|
+
turn.options ? /* @__PURE__ */ jsx("div", {
|
|
14064
|
+
className: "w-full",
|
|
14065
|
+
children: renderOptions(turn.options)
|
|
14066
|
+
}) : null,
|
|
13778
14067
|
turn.delivery !== void 0 ? /* @__PURE__ */ jsx(TurnDeliveryStatus, {
|
|
13779
14068
|
delivery: turn.delivery,
|
|
13780
14069
|
messages
|
|
@@ -13940,10 +14229,12 @@ function VoiceWidgetWithRenderer({ renderer, state, turns, onToggleMic, onEndCal
|
|
|
13940
14229
|
cart,
|
|
13941
14230
|
attaching,
|
|
13942
14231
|
capturing: captureCard != null,
|
|
14232
|
+
captureChoices,
|
|
13943
14233
|
onAttach,
|
|
13944
14234
|
attachInput,
|
|
13945
14235
|
transcript: renderLog(turns),
|
|
13946
14236
|
renderCards,
|
|
14237
|
+
renderOptions,
|
|
13947
14238
|
suggestions: openers,
|
|
13948
14239
|
call,
|
|
13949
14240
|
extras,
|
|
@@ -15485,10 +15776,16 @@ function useChatSession(options) {
|
|
|
15485
15776
|
clearDeskTyping();
|
|
15486
15777
|
}, [clearDeskTyping]);
|
|
15487
15778
|
/** See {@link UseChatSessionResult.markCaptureAnswered}. */
|
|
15488
|
-
const markCaptureAnswered = useCallback((outcome) => {
|
|
15779
|
+
const markCaptureAnswered = useCallback((outcome, shown) => {
|
|
15489
15780
|
if (!mountedRef.current) return;
|
|
15490
15781
|
const id = `event-capture-${captureEventCountRef.current += 1}`;
|
|
15491
|
-
setTurns((prev) => [...prev, {
|
|
15782
|
+
setTurns((prev) => [...prev, outcome === "saved" && shown ? {
|
|
15783
|
+
id,
|
|
15784
|
+
speaker: "caller",
|
|
15785
|
+
text: shown,
|
|
15786
|
+
final: true,
|
|
15787
|
+
shared: true
|
|
15788
|
+
} : {
|
|
15492
15789
|
id,
|
|
15493
15790
|
speaker: "event",
|
|
15494
15791
|
event: outcome === "saved" ? "capture_saved" : "capture_declined",
|
|
@@ -16776,6 +17073,21 @@ async function streamReply(args) {
|
|
|
16776
17073
|
onCardsEvent(cardsEvent);
|
|
16777
17074
|
break;
|
|
16778
17075
|
}
|
|
17076
|
+
case "variant-options": {
|
|
17077
|
+
const data = evt.data;
|
|
17078
|
+
const product = data?.product;
|
|
17079
|
+
if (!product || typeof product.title !== "string" || typeof product.currency !== "string") break;
|
|
17080
|
+
if (!Array.isArray(data.variants) || data.variants.length === 0) break;
|
|
17081
|
+
const options = {
|
|
17082
|
+
product,
|
|
17083
|
+
variants: data.variants
|
|
17084
|
+
};
|
|
17085
|
+
setTurns((prev) => prev.map((t) => t.id === agentTurnId ? {
|
|
17086
|
+
...t,
|
|
17087
|
+
options
|
|
17088
|
+
} : t));
|
|
17089
|
+
break;
|
|
17090
|
+
}
|
|
16779
17091
|
case "checkout": {
|
|
16780
17092
|
const data = evt.data;
|
|
16781
17093
|
if (!data?.handoffId || !data.url || !data.itemCount) break;
|
|
@@ -16960,7 +17272,7 @@ function callStartStamp(spoken, others) {
|
|
|
16960
17272
|
* cache makes a second `start()` after `stop()` free).
|
|
16961
17273
|
*/
|
|
16962
17274
|
async function loadVoiceProtocol() {
|
|
16963
|
-
const [telemetry, chat] = await Promise.all([import("./telemetry-ZeV7hBI7.js"), import("./chat-
|
|
17275
|
+
const [telemetry, chat] = await Promise.all([import("./telemetry-ZeV7hBI7.js"), import("./chat-BBmFAzkg.js")]);
|
|
16964
17276
|
return {
|
|
16965
17277
|
decodeTelemetry: telemetry.decodeTelemetry,
|
|
16966
17278
|
encodeCallerText: telemetry.encodeCallerText,
|
|
@@ -19690,6 +20002,7 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
19690
20002
|
}
|
|
19691
20003
|
if (event.type === "capture-card") {
|
|
19692
20004
|
if (open?.card.field === event.field && !closedCapturesRef.current.has(open)) return;
|
|
20005
|
+
let shown;
|
|
19693
20006
|
const options = {
|
|
19694
20007
|
card: event,
|
|
19695
20008
|
locale,
|
|
@@ -19697,11 +20010,12 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
19697
20010
|
submit: async (answer) => {
|
|
19698
20011
|
const status = await session.submitCapture(answer);
|
|
19699
20012
|
if (status === 404) closedCapturesRef.current.add(options);
|
|
20013
|
+
if ("value" in answer) shown = `${event.label} · ${answer.value}`;
|
|
19700
20014
|
return status;
|
|
19701
20015
|
},
|
|
19702
20016
|
onAnswered: (outcome) => {
|
|
19703
20017
|
showCaptureCard(null);
|
|
19704
|
-
session.markCaptureAnswered(outcome);
|
|
20018
|
+
session.markCaptureAnswered(outcome, shown);
|
|
19705
20019
|
if (!inCallRef.current) session.sendReport({
|
|
19706
20020
|
kind: "capture_card",
|
|
19707
20021
|
field: event.field,
|
|
@@ -20070,7 +20384,7 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
20070
20384
|
voice.toggleMic();
|
|
20071
20385
|
return;
|
|
20072
20386
|
}
|
|
20073
|
-
voice.start({ greet: !session.turns.some((t) => t.speaker === "caller") });
|
|
20387
|
+
voice.start({ greet: !session.turns.some((t) => t.speaker === "caller" && !t.shared) });
|
|
20074
20388
|
}, [
|
|
20075
20389
|
voiceEnabled,
|
|
20076
20390
|
escalated,
|
|
@@ -20248,7 +20562,9 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
20248
20562
|
final: turn.final,
|
|
20249
20563
|
...turn.event ? { event: turn.event } : {},
|
|
20250
20564
|
...turn.delivery ? { delivery: turn.delivery } : {},
|
|
20565
|
+
...turn.shared ? { shared: turn.shared } : {},
|
|
20251
20566
|
...turn.cards ? { cards: turn.cards } : {},
|
|
20567
|
+
...turn.options ? { options: turn.options } : {},
|
|
20252
20568
|
...turn.attachments ? { attachments: turn.attachments } : {},
|
|
20253
20569
|
...turn.operatorName ? { operatorName: turn.operatorName } : {}
|
|
20254
20570
|
});
|
|
@@ -20334,14 +20650,32 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
20334
20650
|
existing.items.push(...event.items);
|
|
20335
20651
|
if (existing.curationId !== event.curationId) delete existing.curationId;
|
|
20336
20652
|
}
|
|
20653
|
+
const optionsByTurn = /* @__PURE__ */ new Map();
|
|
20654
|
+
const unboundOptions = [];
|
|
20655
|
+
for (const event of voice.widgetEvents) {
|
|
20656
|
+
if (event.type !== "variant-options") continue;
|
|
20657
|
+
const entry = {
|
|
20658
|
+
stamp: order.stampEvent(event),
|
|
20659
|
+
options: {
|
|
20660
|
+
product: event.product,
|
|
20661
|
+
variants: event.variants
|
|
20662
|
+
}
|
|
20663
|
+
};
|
|
20664
|
+
if (event.turnId === void 0) unboundOptions.push(entry);
|
|
20665
|
+
else optionsByTurn.set(event.turnId, {
|
|
20666
|
+
...entry,
|
|
20667
|
+
stamp: optionsByTurn.get(event.turnId)?.stamp ?? entry.stamp
|
|
20668
|
+
});
|
|
20669
|
+
}
|
|
20337
20670
|
const anchors = /* @__PURE__ */ new Map();
|
|
20338
20671
|
for (const { line, i } of visible) {
|
|
20339
20672
|
const turnId = line.turnId;
|
|
20340
20673
|
if (line.speaker !== "agent" || line.filler === true || turnId === void 0) continue;
|
|
20341
|
-
if (!byTurn.has(turnId) || anchors.has(turnId)) continue;
|
|
20674
|
+
if (!byTurn.has(turnId) && !optionsByTurn.has(turnId) || anchors.has(turnId)) continue;
|
|
20342
20675
|
anchors.set(turnId, i);
|
|
20343
20676
|
}
|
|
20344
20677
|
const orphaned = [...unbound, ...[...byTurn].filter(([turnId]) => !anchors.has(turnId)).map(([, cards]) => cards)];
|
|
20678
|
+
const orphanedOptions = [...unboundOptions, ...[...optionsByTurn].filter(([turnId]) => !anchors.has(turnId)).map(([, o]) => o)];
|
|
20345
20679
|
/**
|
|
20346
20680
|
* ── Why the bound row simply keeps the LINE's stamp ───────────────────
|
|
20347
20681
|
*
|
|
@@ -20379,7 +20713,9 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
20379
20713
|
*/
|
|
20380
20714
|
const spoken = visible.map(({ line, i }) => {
|
|
20381
20715
|
const turnId = line.turnId;
|
|
20382
|
-
const
|
|
20716
|
+
const anchored = turnId !== void 0 && anchors.get(turnId) === i;
|
|
20717
|
+
const bound = anchored ? byTurn.get(turnId) : void 0;
|
|
20718
|
+
const boundOptions = anchored ? optionsByTurn.get(turnId)?.options : void 0;
|
|
20383
20719
|
return {
|
|
20384
20720
|
stamp: spokenStamps[i],
|
|
20385
20721
|
turn: {
|
|
@@ -20392,7 +20728,8 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
20392
20728
|
...bound === void 0 ? {} : { cards: {
|
|
20393
20729
|
...bound.curationId !== void 0 ? { curationId: bound.curationId } : {},
|
|
20394
20730
|
items: bound.items
|
|
20395
|
-
} }
|
|
20731
|
+
} },
|
|
20732
|
+
...boundOptions === void 0 ? {} : { options: boundOptions }
|
|
20396
20733
|
}
|
|
20397
20734
|
};
|
|
20398
20735
|
});
|
|
@@ -20409,12 +20746,27 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
20409
20746
|
}
|
|
20410
20747
|
}
|
|
20411
20748
|
}));
|
|
20749
|
+
const renderedOptions = orphanedOptions.map(({ stamp, options }) => ({
|
|
20750
|
+
stamp,
|
|
20751
|
+
turn: {
|
|
20752
|
+
speaker: "agent",
|
|
20753
|
+
text: "",
|
|
20754
|
+
locale,
|
|
20755
|
+
final: true,
|
|
20756
|
+
options
|
|
20757
|
+
}
|
|
20758
|
+
}));
|
|
20412
20759
|
const callStart = callStartStamp(spoken, [
|
|
20413
20760
|
...typed,
|
|
20414
20761
|
...rendered,
|
|
20762
|
+
...renderedOptions,
|
|
20415
20763
|
...past.rows
|
|
20416
20764
|
]);
|
|
20417
|
-
const rows = [
|
|
20765
|
+
const rows = [
|
|
20766
|
+
...spoken,
|
|
20767
|
+
...rendered,
|
|
20768
|
+
...renderedOptions
|
|
20769
|
+
];
|
|
20418
20770
|
if (callStart !== null) rows.push({
|
|
20419
20771
|
stamp: callStart,
|
|
20420
20772
|
turn: {
|
|
@@ -20857,8 +21209,11 @@ function ConciergeHost({ renderer, embedKey, apiBase, socketUrl, socketPath, bri
|
|
|
20857
21209
|
...attribution !== void 0 ? { attribution } : {},
|
|
20858
21210
|
...privacyChoices !== void 0 ? { privacyChoices } : {},
|
|
20859
21211
|
dock: dockProps,
|
|
20860
|
-
...captureCard !== null ? {
|
|
21212
|
+
...captureCard !== null ? {
|
|
21213
|
+
captureCard: /* @__PURE__ */ jsx(CaptureCardHost, { options: captureCard }),
|
|
21214
|
+
captureChoices: captureCard.card.choices
|
|
21215
|
+
} : {}
|
|
20861
21216
|
});
|
|
20862
21217
|
}
|
|
20863
21218
|
//#endregion
|
|
20864
|
-
export {
|
|
21219
|
+
export { IDLE_SNAPSHOT as $, readStoredMinimised as $t, rendererFor as A, formatMessage as An, MARK as At, textDirectionFor as B, KNOT_PATH as Bn, SHEET_PEEK_MAX as Bt, VoiceWidgetWithRenderer as C, oklchToOklab as Cn, DOCK_ALIGN_STORAGE_KEY as Ct, WidgetCartSummary as D, srgbToLinear as Dn, FLOAT_DUCK_DISMISS_MS as Dt, readsAsCheckoutIntent as E, rotateHue as En, DRAG_TAP_SLOP_PX as Et, CallView as F, MARK_VARIANTS as Fn, RADII$1 as Ft, edgeOf as G, bottomLen as Gt, CONCIERGE_POSITIONS as H, BotFace as Hn, SHEET_TUCK as Ht, IDLE_CALL_RECORD as I, WIDGET_AVATARS as In, ROW_H as It, positionClasses as J, persistAlign as Jt, nearestPosition as K, containerAnchor as Kt, WidgetMarkdown as L, WIDGET_IDENTITY_AVATARS as Ln, SHEET_EXPANDED_DESKTOP_MAX as Lt, ShellRenderer as M, widgetMessagesFromCopy as Mn, PILL_H as Mt, deriveWidgetView as N, MorphingLoader as Nn, PILL_MARK as Nt, VariantOptionChips as O, withAlpha as On, FLOAT_GAP as Ot, ConciergeShell as P, DEFAULT_WIDGET_AVATAR as Pn, PROACTIVE_NUDGE_MS as Pt, Mark as Q, readStoredAlign as Qt, parseBlocks as R, dockAvatarFor as Rn, SHEET_EXPANDED_VH as Rt, VoiceWidget as S, oklchToHex as Sn, DESKTOP_WIDTHS as St, readsAsCartViewIntent as T, relativeLuminance as Tn, DRAG_CLICK_WINDOW_MS as Tt, DEFAULT_CONCIERGE_POSITION as U, labelProps as Un, SHORT_VIEWPORT as Ut, ConciergeLauncher as V, RopeKnot as Vn, SHEET_TOP_CLEARANCE as Vt, alignOf as W, cn as Wn, Z_INDEX as Wt, LAUNCHER_VARIANTS as X, pillAnchor as Xt, positionForArrow as Y, persistMinimised as Yt, MARK_STATES as Z, readStored as Zt, useVoiceSession as _, linearToSrgb as _n, BOTTOM_FLOOR as _t, MAX_REPORTED_CART_LINES as a, SHEET_RADIUS_MAX_PX as an, latencyBetween as at, useChatSession as b, oklabToLinearRgb as bn, DESKTOP_BREAKPOINT as bt, deriveCallPhase as c, deriveTheme as cn, deriveDockState as ct, resolveCheckoutUrl as d, themeToMarkedHostCss as dn, CONCIERGE_STATES as dt, rowWidthLen as en, botStateFor as et, toChatCart as f, contrastRatio as fn, deriveConciergeState as ft, createWidgetVoiceTokenFetcher as g, linearRgbToOklab as gn, ACTIVITY_W as gt, ROOM_EVENTS as h, hexToOklch as hn, WIDGET_MESSAGE_MAX_LENGTH as ht, ConciergeWidget as i, CARD_RADIUS_MAX_PX as in, formatMs as it, DockRenderer as j, resolveWidgetMessages as jn, MOBILE_MARGIN as jt, WidgetCardList as k, defaultWidgetMessages as kn, GLASS_IDLE_MS as kt, mergeAddedCartLine as l, themeToCss as ln, deriveDockView as lt, deriveWidgetTheme as m, hexToOklab as mn, formatMoney as mt, CART_LINE_VARIANT_ID_SHAPE as n, snapAlign as nn, SESSION_EVENTS as nt, cartLinesFromSnapshot as o, SYSTEM_FONT_STACK as on, Dock as ot, WidgetThemeScope as p, formatHex as pn, idleConciergeInput as pt, panelClasses as q, geometryVars as qt, ConciergeHost as r, writeStored as rn, SessionLog as rt, chooseOptionsAction as s, WIDGET_THEME_TOKENS as sn, DOCK_STATES as st, CART_LINE_PLATFORM_VARIANT_ID_SHAPE as t, sheetMaxHeightLen as tn, SseFrameParser as tt, resolveAddToCartHandler as u, themeToInlineStyle as un, idleDockInput as ut, CHECKOUT_CAPTURE_REQUIRED as v, mixToward as vn, CONTROL as vt, basketIntentFromTurns as w, parseHex as wn, DOCK_MINIMISED_STORAGE_KEY as wt, detectPage as x, oklabToOklch as xn, DESKTOP_GUTTER as xt, isSameOriginPath as y, oklabToHex as yn, DESKTOP_BOTTOM as yt, stripBidiControls as z, isWidgetAvatar as zn, SHEET_GAP as zt };
|