@saar-ai/web-widget 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{host-widget-CAPud_Jz.js → host-widget-B97T89b7.js} +615 -101
- package/dist/dock/dock-drag.d.ts +81 -0
- package/dist/dock/dock-drag.d.ts.map +1 -0
- package/dist/dock/dock-pill.d.ts +7 -2
- package/dist/dock/dock-pill.d.ts.map +1 -1
- package/dist/dock/dock-row.d.ts +13 -2
- package/dist/dock/dock-row.d.ts.map +1 -1
- package/dist/dock/dock-sheet.d.ts +11 -1
- package/dist/dock/dock-sheet.d.ts.map +1 -1
- package/dist/dock/dock-state.d.ts +41 -0
- package/dist/dock/dock-state.d.ts.map +1 -1
- package/dist/dock/dock.d.ts +34 -0
- package/dist/dock/dock.d.ts.map +1 -1
- package/dist/dock/geometry.d.ts +74 -2
- package/dist/dock/geometry.d.ts.map +1 -1
- package/dist/generated/widget-css.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/messages.d.ts +14 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/next/index.js +1 -1
- package/dist/styles.d.ts +3 -3
- package/dist/theme/derive.d.ts +1 -1
- package/dist/theme/derive.d.ts.map +1 -1
- package/dist/voice-widget.d.ts.map +1 -1
- package/dist/widget.css +1 -1
- package/package.json +1 -1
- package/src/styles/concierge.css +160 -7
- package/src/styles/tokens.css +6 -0
|
@@ -524,6 +524,7 @@ var defaultWidgetMessages = {
|
|
|
524
524
|
dock_cards: "{count} picks — see",
|
|
525
525
|
dock_voice_failed: "Couldn’t start the call — type instead",
|
|
526
526
|
dock_show_transcript: "Show what was said",
|
|
527
|
+
dock_show_conversation: "Show conversation",
|
|
527
528
|
dock_earbuds: "Earbuds in — talk freely",
|
|
528
529
|
handoff_event: "Handed to a human teammate",
|
|
529
530
|
escalated_banner: "A human teammate will pick this up shortly.",
|
|
@@ -840,11 +841,14 @@ var WIDGET_THEME_TOKENS = [
|
|
|
840
841
|
"--wgt-accent",
|
|
841
842
|
"--wgt-surface",
|
|
842
843
|
"--wgt-surface-2",
|
|
844
|
+
"--wgt-surface-glass",
|
|
845
|
+
"--wgt-surface-glass-blurred",
|
|
843
846
|
"--wgt-text",
|
|
844
847
|
"--wgt-text-muted",
|
|
845
848
|
"--wgt-border",
|
|
846
849
|
"--wgt-ring",
|
|
847
850
|
"--wgt-radius",
|
|
851
|
+
"--wgt-row-radius",
|
|
848
852
|
"--wgt-sheet-radius",
|
|
849
853
|
"--wgt-card-radius",
|
|
850
854
|
"--wgt-font",
|
|
@@ -895,6 +899,60 @@ var MUTED_ALPHA = .62;
|
|
|
895
899
|
var BORDER_ALPHA = .12;
|
|
896
900
|
/** §9.2: `color-mix(in oklch, surface 94%, text)`, computed rather than emitted. */
|
|
897
901
|
var SURFACE_2_MIX = .06;
|
|
902
|
+
/**
|
|
903
|
+
* §3.3 (revised 2026-09-11) — the sheet is translucent, at one of TWO alphas.
|
|
904
|
+
*
|
|
905
|
+
* The sheet overlays the merchant's page and has to read as something the
|
|
906
|
+
* concierge raised over it rather than as a second page pasted on top. How
|
|
907
|
+
* much of the page can show through before it stops being texture and starts
|
|
908
|
+
* being competing content depends entirely on whether a blur is standing
|
|
909
|
+
* between the two, so there are two tokens rather than one:
|
|
910
|
+
*
|
|
911
|
+
* - `--wgt-surface-glass` (97 %) is the DEFAULT, and the one the sheet uses
|
|
912
|
+
* unless something else is established. No blur is helping it, so it faces
|
|
913
|
+
* the merchant's page at full detail. Photographed against a product grid,
|
|
914
|
+
* 92 % left the card titles and prices plainly READABLE through the
|
|
915
|
+
* greeting and the chips; 95 % and 96 % still did; 97 % is the first step
|
|
916
|
+
* where the backdrop stops competing with the text and stays a tint.
|
|
917
|
+
* - `--wgt-surface-glass-blurred` (92 %) is for the one case where a
|
|
918
|
+
* `backdrop-filter` is behind the surface — `pointer: fine`, and only
|
|
919
|
+
* where the browser actually supports the filter (§3.3). A 16 px blur
|
|
920
|
+
* destroys exactly the high-frequency detail that made 92 % illegible, so
|
|
921
|
+
* the extra five per cent buys depth at no cost to the reading surface.
|
|
922
|
+
*
|
|
923
|
+
* The default being the SAFE one is deliberate: every way the blur can fail
|
|
924
|
+
* to apply — an unsupported browser, a stripped declaration, a coarse
|
|
925
|
+
* pointer, a future refactor that moves the rule — lands on the alpha that is
|
|
926
|
+
* legible without it. The pairing is asserted in `concierge-css.test.ts`
|
|
927
|
+
* against the COMPILED bundle, because a `backdrop-filter` that survives the
|
|
928
|
+
* source and not the minifier is exactly how this shipped wrong once.
|
|
929
|
+
*
|
|
930
|
+
* Tokens rather than an `opacity` on the element, because `opacity` on the
|
|
931
|
+
* sheet would fade its contents — the shopper's own words, the prices — and
|
|
932
|
+
* because §7.1 rule 1 wants nothing on that box that a transition could later
|
|
933
|
+
* be attached to. The BUBBLES inside stay opaque (`--wgt-surface-2`) either
|
|
934
|
+
* way: the reading surface is solid and it is the sheet's margins that show
|
|
935
|
+
* the page.
|
|
936
|
+
*
|
|
937
|
+
* The ROW is deliberately not glass at all. It is a control surface: the
|
|
938
|
+
* caption is a field somebody types into and the four slots have to stay
|
|
939
|
+
* legible over whatever the merchant's page happens to be scrolled to.
|
|
940
|
+
*/
|
|
941
|
+
var SURFACE_GLASS_ALPHA = .97;
|
|
942
|
+
/** §3.3 — the alpha that is only safe with a blur behind it. See above. */
|
|
943
|
+
var SURFACE_GLASS_BLURRED_ALPHA = .92;
|
|
944
|
+
/**
|
|
945
|
+
* §2 (revised 2026-09-11) — the row and the pill are ALWAYS a full pill.
|
|
946
|
+
*
|
|
947
|
+
* A constant rather than a derivation, and emitted as a token rather than
|
|
948
|
+
* hard-coded in the two stylesheets, for the reason every other length here
|
|
949
|
+
* is: the dock is drawn twice and the two renderers must not each carry their
|
|
950
|
+
* own 9999. `type.radius` keeps shaping the sheet (`--wgt-sheet-radius`), the
|
|
951
|
+
* cards (`--wgt-card-radius`) and the buttons (`--wgt-radius`) — it stopped
|
|
952
|
+
* shaping the row on 2026-09-11, because a 48 px bar with 12 px corners
|
|
953
|
+
* reads as a dialog that lost its title bar, and the row is not a dialog.
|
|
954
|
+
*/
|
|
955
|
+
var ROW_RADIUS_CSS = "9999px";
|
|
898
956
|
/** §9.3's floor for derived text on the surface. */
|
|
899
957
|
var TEXT_CONTRAST_MIN = 4.5;
|
|
900
958
|
/** §11's floor for the focus ring against the surface it is drawn on. */
|
|
@@ -1037,11 +1095,14 @@ function deriveVars(color, type, surfaceHex) {
|
|
|
1037
1095
|
"--wgt-accent": accent,
|
|
1038
1096
|
"--wgt-surface": surface,
|
|
1039
1097
|
"--wgt-surface-2": mixToward(surface, text, SURFACE_2_MIX),
|
|
1098
|
+
"--wgt-surface-glass": withAlpha(surface, SURFACE_GLASS_ALPHA),
|
|
1099
|
+
"--wgt-surface-glass-blurred": withAlpha(surface, SURFACE_GLASS_BLURRED_ALPHA),
|
|
1040
1100
|
"--wgt-text": text,
|
|
1041
1101
|
"--wgt-text-muted": withAlpha(text, MUTED_ALPHA),
|
|
1042
1102
|
"--wgt-border": withAlpha(text, BORDER_ALPHA),
|
|
1043
1103
|
"--wgt-ring": deriveRing(primary, surface),
|
|
1044
1104
|
"--wgt-radius": `${radiusPx}px`,
|
|
1105
|
+
"--wgt-row-radius": ROW_RADIUS_CSS,
|
|
1045
1106
|
"--wgt-sheet-radius": `${Math.min(radiusPx, 20)}px`,
|
|
1046
1107
|
"--wgt-card-radius": `${Math.min(radiusPx, 12)}px`,
|
|
1047
1108
|
"--wgt-font": lookup({
|
|
@@ -1147,8 +1208,18 @@ var DESKTOP_GUTTER = 16;
|
|
|
1147
1208
|
var BOTTOM_FLOOR = 10;
|
|
1148
1209
|
/** Desktop bottom inset (§3.1). */
|
|
1149
1210
|
var DESKTOP_BOTTOM = 16;
|
|
1150
|
-
/**
|
|
1151
|
-
|
|
1211
|
+
/**
|
|
1212
|
+
* Gap between the sheet's floor and the row above it (§3.3).
|
|
1213
|
+
*
|
|
1214
|
+
* ZERO since 2026-09-11. The 8 px gap read as two unrelated boxes stacked on
|
|
1215
|
+
* a merchant's page rather than as one surface the concierge grew, which is
|
|
1216
|
+
* what §3.3's "a bottom sheet whose floor is the row" was always describing.
|
|
1217
|
+
* The constant stays rather than being deleted: it is the number the sheet's
|
|
1218
|
+
* `bottom` is written from, both renderers have to agree about it, and a
|
|
1219
|
+
* reader who finds `bottom: var(--wgt-row-h)` in the stylesheet needs
|
|
1220
|
+
* somewhere that says why there is nothing added to it.
|
|
1221
|
+
*/
|
|
1222
|
+
var SHEET_GAP = 0;
|
|
1152
1223
|
/** The one breakpoint. Below it the dock is full-width and thumb-anchored. */
|
|
1153
1224
|
var DESKTOP_BREAKPOINT = 768;
|
|
1154
1225
|
/**
|
|
@@ -1199,6 +1270,88 @@ var SHEET_TOP_CLEARANCE = 24;
|
|
|
1199
1270
|
* storage key is two ways for one preference to be lost.
|
|
1200
1271
|
*/
|
|
1201
1272
|
var DOCK_MINIMISED_STORAGE_KEY = "wgt_dock_minimised";
|
|
1273
|
+
/**
|
|
1274
|
+
* §9.1's `layout.draggable` — where a shopper's own horizontal position is
|
|
1275
|
+
* remembered, per visitor and per origin.
|
|
1276
|
+
*
|
|
1277
|
+
* Beside {@link DOCK_MINIMISED_STORAGE_KEY} and for the same reason: the core
|
|
1278
|
+
* dock reads it BEFORE first paint (so a returning shopper never watches the
|
|
1279
|
+
* dock slide across the page to where they left it) and the React dock writes
|
|
1280
|
+
* it when a drag settles. Two copies of a storage key is two ways for one
|
|
1281
|
+
* preference to be lost.
|
|
1282
|
+
*/
|
|
1283
|
+
var DOCK_ALIGN_STORAGE_KEY = "wgt_dock_align";
|
|
1284
|
+
/**
|
|
1285
|
+
* Under this many pixels of travel, a press-and-release is a TAP (§9.1).
|
|
1286
|
+
*
|
|
1287
|
+
* Six rather than the sheet drag's four: the sheet's handle does nothing but
|
|
1288
|
+
* drag, so a hair-trigger costs nothing, while the pill and the mark are the
|
|
1289
|
+
* dock's two most-pressed controls and a mouse that travels three pixels
|
|
1290
|
+
* between press and release is a click in every other piece of software the
|
|
1291
|
+
* shopper uses. Below it the gesture never became a drag at all — no
|
|
1292
|
+
* alignment is written and the press's own click is left to run.
|
|
1293
|
+
*/
|
|
1294
|
+
var DRAG_TAP_SLOP_PX = 6;
|
|
1295
|
+
/**
|
|
1296
|
+
* Where a released drag lands (§9.1): the third of the viewport the dock's
|
|
1297
|
+
* CENTRE finished in.
|
|
1298
|
+
*
|
|
1299
|
+
* Thirds rather than nearest-edge, because `center` is one of the three
|
|
1300
|
+
* answers and an edge-distance rule can never return it. Pure, and shared by
|
|
1301
|
+
* both renderers — the pill's drag is `cdn/dock-dom.ts`'s and the row's is
|
|
1302
|
+
* `dock/dock-drag.ts`'s, and a dock that snapped differently depending on
|
|
1303
|
+
* which one the shopper grabbed would be a bug nobody could describe.
|
|
1304
|
+
*
|
|
1305
|
+
* A degenerate viewport (0 wide, or a `NaN` centre from a `pointercancel`
|
|
1306
|
+
* that carried no coordinates) resolves to `center`: the tenant's own default,
|
|
1307
|
+
* and the only answer that cannot put the dock off the edge of the screen.
|
|
1308
|
+
*/
|
|
1309
|
+
function snapAlign(centreX, viewportWidth) {
|
|
1310
|
+
if (!(viewportWidth > 0)) return "center";
|
|
1311
|
+
if (centreX < viewportWidth / 3) return "left";
|
|
1312
|
+
if (centreX > viewportWidth * 2 / 3) return "right";
|
|
1313
|
+
return "center";
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* `localStorage`, wrapped once for the whole dock.
|
|
1317
|
+
*
|
|
1318
|
+
* Both preferences the dock remembers (§5.4's minimise, §9.1's alignment) are
|
|
1319
|
+
* read by `cdn/dock-dom.ts` before first paint and written by the React dock,
|
|
1320
|
+
* so four near-identical `try`/`catch` blocks were four copies of the same
|
|
1321
|
+
* three lines in an artefact every visitor to every merchant page downloads.
|
|
1322
|
+
*
|
|
1323
|
+
* The `try` is the load-bearing part and is not optional: `localStorage`
|
|
1324
|
+
* THROWS on access — not on use — in a third-party frame with storage access
|
|
1325
|
+
* blocked, in Safari's private mode past its quota, and behind a merchant's
|
|
1326
|
+
* own cookie wall. A dock that took the storefront's script down over a
|
|
1327
|
+
* remembered position is worse than a dock that forgets one.
|
|
1328
|
+
*/
|
|
1329
|
+
function readStored(win, key) {
|
|
1330
|
+
try {
|
|
1331
|
+
return win.localStorage?.getItem(key) ?? void 0;
|
|
1332
|
+
} catch {
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
function writeStored(win, key, value) {
|
|
1337
|
+
try {
|
|
1338
|
+
win.localStorage?.setItem(key, value);
|
|
1339
|
+
} catch {}
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* The shopper's remembered alignment, or `undefined` where there is none.
|
|
1343
|
+
*
|
|
1344
|
+
* Anything that is not one of §9.1's three values is `undefined` rather than
|
|
1345
|
+
* a default: the key is on the MERCHANT's origin, shared with whatever else
|
|
1346
|
+
* their page stores, and a value we did not write is not a preference.
|
|
1347
|
+
*/
|
|
1348
|
+
function readStoredAlign(win) {
|
|
1349
|
+
const raw = readStored(win, DOCK_ALIGN_STORAGE_KEY);
|
|
1350
|
+
return raw === "left" || raw === "center" || raw === "right" ? raw : void 0;
|
|
1351
|
+
}
|
|
1352
|
+
function persistAlign(win, align) {
|
|
1353
|
+
writeStored(win, DOCK_ALIGN_STORAGE_KEY, align);
|
|
1354
|
+
}
|
|
1202
1355
|
/** §5.6 — how long a proactive nudge holds the row open before it recedes. */
|
|
1203
1356
|
var PROACTIVE_NUDGE_MS = 8e3;
|
|
1204
1357
|
/**
|
|
@@ -1878,6 +2031,199 @@ function useDockDurations(motionOff) {
|
|
|
1878
2031
|
}, [motionOff]);
|
|
1879
2032
|
}
|
|
1880
2033
|
//#endregion
|
|
2034
|
+
//#region src/dock/dock-drag.ts
|
|
2035
|
+
/** The one custom property a drag writes (§7.1 rule 5). */
|
|
2036
|
+
var DRAG_VAR = "--wgt-drag-x";
|
|
2037
|
+
function useDockDrag(containerRef, { enabled, published, win, durationMs, pillRef }) {
|
|
2038
|
+
const [stored, setStored] = useState(void 0);
|
|
2039
|
+
const align = (enabled ? stored : void 0) ?? published;
|
|
2040
|
+
/**
|
|
2041
|
+
* The stored alignment is read AFTER MOUNT, in a layout effect, and never
|
|
2042
|
+
* in a `useState` initialiser.
|
|
2043
|
+
*
|
|
2044
|
+
* The initialiser was gated on `enabled`, and `enabled` is false on the
|
|
2045
|
+
* HYDRATION render of every server-rendered host: `useViewport`'s
|
|
2046
|
+
* `useSyncExternalStore` server snapshots are hard-coded `false` (§1 rule 8
|
|
2047
|
+
* — a hydration mismatch on those booleans throws the dock's whole subtree
|
|
2048
|
+
* away), so `isDesktop` and `finePointer` are both false on the render the
|
|
2049
|
+
* initialiser runs in. Nothing re-read it afterwards, so the marketing
|
|
2050
|
+
* preview, the console preview and every npm consumer pinned the shopper's
|
|
2051
|
+
* remembered position `undefined` for the life of the mount — while still
|
|
2052
|
+
* happily WRITING to the same key on every drop. The same hole swallowed
|
|
2053
|
+
* the CDN path whenever the window started under 768 px and was widened
|
|
2054
|
+
* mid-session.
|
|
2055
|
+
*
|
|
2056
|
+
* A LAYOUT effect rather than an ordinary one, because `cdn/dock-dom.ts`
|
|
2057
|
+
* applies this value before its first paint (see that file's `storedAlign`)
|
|
2058
|
+
* and §4.2 gives the handover one frame to disagree in: read after the
|
|
2059
|
+
* paint, the React dock would start at the tenant's alignment and slide to
|
|
2060
|
+
* the shopper's in front of them. `flipFrom` is null on this path, so the
|
|
2061
|
+
* adoption commits the anchor with no settle animation, which is what an
|
|
2062
|
+
* alignment that was never dragged should look like.
|
|
2063
|
+
*
|
|
2064
|
+
* `enabled` still gates the READ as well as the gesture. A tenant who
|
|
2065
|
+
* turned dragging off may have turned it off BECAUSE of where a shopper
|
|
2066
|
+
* could put it, and a remembered position that outlives the setting which
|
|
2067
|
+
* allowed it is a setting that does not work.
|
|
2068
|
+
*/
|
|
2069
|
+
useLayoutEffect(() => {
|
|
2070
|
+
if (!enabled || !win) return;
|
|
2071
|
+
const remembered = readStoredAlign(win);
|
|
2072
|
+
if (remembered !== void 0) setStored(remembered);
|
|
2073
|
+
}, [enabled, win]);
|
|
2074
|
+
const drag = useRef(null);
|
|
2075
|
+
const movedLast = useRef(false);
|
|
2076
|
+
/** Where the container's left edge was at the instant of release — rule 4's FLIP. */
|
|
2077
|
+
const flipFrom = useRef(null);
|
|
2078
|
+
/** Where the PILL's left edge was at the same instant — rule 4's other half. */
|
|
2079
|
+
const pillFlipFrom = useRef(null);
|
|
2080
|
+
const write = useCallback((value) => containerRef.current?.style.setProperty(DRAG_VAR, value), [containerRef]);
|
|
2081
|
+
/**
|
|
2082
|
+
* Rule 4, in the commit that moved the anchor.
|
|
2083
|
+
*
|
|
2084
|
+
* `useLayoutEffect` rather than an effect: this runs BEFORE the browser
|
|
2085
|
+
* paints the new anchor, so the shopper never sees the frame where the dock
|
|
2086
|
+
* has jumped. One frame later the transform is animated away, and the
|
|
2087
|
+
* `data-settling` attribute is what turns the transition on — the container
|
|
2088
|
+
* cannot simply carry one, because `--wgt-kb` rides on the same `transform`
|
|
2089
|
+
* and §7.2 gives the keyboard offset "continuous, no easing".
|
|
2090
|
+
*/
|
|
2091
|
+
useLayoutEffect(() => {
|
|
2092
|
+
const el = containerRef.current;
|
|
2093
|
+
const from = flipFrom.current;
|
|
2094
|
+
const pillFrom = pillFlipFrom.current;
|
|
2095
|
+
flipFrom.current = null;
|
|
2096
|
+
pillFlipFrom.current = null;
|
|
2097
|
+
if (!el || from === null) return;
|
|
2098
|
+
const applied = Number.parseFloat(el.style.getPropertyValue("--wgt-drag-x")) || 0;
|
|
2099
|
+
const dx = from - (el.getBoundingClientRect().left - applied);
|
|
2100
|
+
const pill = pillRef?.current ?? null;
|
|
2101
|
+
const pillDx = pill && pillFrom !== null ? pillFrom - (pill.getBoundingClientRect().left - applied + dx) : 0;
|
|
2102
|
+
if (pill && Math.abs(pillDx) >= .5 && durationMs > 0) pill.animate?.([{ transform: `translateX(${pillDx}px)` }, { transform: "none" }], {
|
|
2103
|
+
duration: durationMs,
|
|
2104
|
+
easing: SWAP_EASING,
|
|
2105
|
+
fill: "none"
|
|
2106
|
+
});
|
|
2107
|
+
if (dx === 0 || durationMs === 0) {
|
|
2108
|
+
write("0px");
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
write(`${dx}px`);
|
|
2112
|
+
el.setAttribute("data-settling", "true");
|
|
2113
|
+
const raf = typeof requestAnimationFrame === "function" ? requestAnimationFrame(() => write("0px")) : (write("0px"), 0);
|
|
2114
|
+
const timer = setTimeout(() => {
|
|
2115
|
+
el.removeAttribute("data-settling");
|
|
2116
|
+
write("0px");
|
|
2117
|
+
}, durationMs + 100);
|
|
2118
|
+
return () => {
|
|
2119
|
+
if (raf) cancelAnimationFrame(raf);
|
|
2120
|
+
clearTimeout(timer);
|
|
2121
|
+
el.removeAttribute("data-settling");
|
|
2122
|
+
};
|
|
2123
|
+
}, [
|
|
2124
|
+
align,
|
|
2125
|
+
containerRef,
|
|
2126
|
+
durationMs,
|
|
2127
|
+
pillRef,
|
|
2128
|
+
write
|
|
2129
|
+
]);
|
|
2130
|
+
const settle = useCallback((endX) => {
|
|
2131
|
+
const state = drag.current;
|
|
2132
|
+
drag.current = null;
|
|
2133
|
+
const el = containerRef.current;
|
|
2134
|
+
if (!state || !el || !win) return;
|
|
2135
|
+
el.removeAttribute("data-dragging");
|
|
2136
|
+
movedLast.current = state.moved;
|
|
2137
|
+
if (!state.moved) {
|
|
2138
|
+
write("0px");
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
const rect = el.getBoundingClientRect();
|
|
2142
|
+
const next = snapAlign(rect.left + rect.width / 2, win.innerWidth || 0);
|
|
2143
|
+
flipFrom.current = rect.left;
|
|
2144
|
+
pillFlipFrom.current = pillRef?.current?.getBoundingClientRect().left ?? null;
|
|
2145
|
+
persistAlign(win, next);
|
|
2146
|
+
setStored(next);
|
|
2147
|
+
if (next === align) {
|
|
2148
|
+
flipFrom.current = null;
|
|
2149
|
+
pillFlipFrom.current = null;
|
|
2150
|
+
write("0px");
|
|
2151
|
+
}
|
|
2152
|
+
}, [
|
|
2153
|
+
align,
|
|
2154
|
+
containerRef,
|
|
2155
|
+
pillRef,
|
|
2156
|
+
win,
|
|
2157
|
+
write
|
|
2158
|
+
]);
|
|
2159
|
+
/**
|
|
2160
|
+
* The three listeners the press in flight has armed, so an UNMOUNT can take
|
|
2161
|
+
* them off.
|
|
2162
|
+
*
|
|
2163
|
+
* `onEnd` disarms them itself on `pointerup`/`pointercancel`, which is every
|
|
2164
|
+
* way a gesture ends — but not every way this hook ends. A dock unmounted
|
|
2165
|
+
* mid-drag (the host swaps routes, the merchant's SPA tears the mount point
|
|
2166
|
+
* down, a test unmounts between cases) left three listeners on the WINDOW
|
|
2167
|
+
* closed over a detached container, for the life of the page.
|
|
2168
|
+
*/
|
|
2169
|
+
const armed = useRef(null);
|
|
2170
|
+
useEffect(() => () => {
|
|
2171
|
+
armed.current?.();
|
|
2172
|
+
armed.current = null;
|
|
2173
|
+
}, []);
|
|
2174
|
+
const onPointerDown = useCallback((event) => {
|
|
2175
|
+
const el = containerRef.current;
|
|
2176
|
+
if (!el || !win || event.button > 0 || drag.current !== null) return;
|
|
2177
|
+
movedLast.current = false;
|
|
2178
|
+
drag.current = {
|
|
2179
|
+
startX: event.clientX,
|
|
2180
|
+
lastX: event.clientX,
|
|
2181
|
+
moved: false
|
|
2182
|
+
};
|
|
2183
|
+
const onMove = (native) => {
|
|
2184
|
+
const state = drag.current;
|
|
2185
|
+
const x = native.clientX;
|
|
2186
|
+
if (!state || !Number.isFinite(x)) return;
|
|
2187
|
+
state.lastX = x;
|
|
2188
|
+
const dx = x - state.startX;
|
|
2189
|
+
if (Math.abs(dx) >= 6) {
|
|
2190
|
+
state.moved = true;
|
|
2191
|
+
el.setAttribute("data-dragging", "true");
|
|
2192
|
+
}
|
|
2193
|
+
if (state.moved) write(`${dx}px`);
|
|
2194
|
+
};
|
|
2195
|
+
const disarm = () => {
|
|
2196
|
+
armed.current = null;
|
|
2197
|
+
win.removeEventListener("pointermove", onMove);
|
|
2198
|
+
win.removeEventListener("pointerup", onEnd);
|
|
2199
|
+
win.removeEventListener("pointercancel", onEnd);
|
|
2200
|
+
};
|
|
2201
|
+
const onEnd = (native) => {
|
|
2202
|
+
disarm();
|
|
2203
|
+
settle(native.clientX ?? NaN);
|
|
2204
|
+
};
|
|
2205
|
+
armed.current?.();
|
|
2206
|
+
win.addEventListener("pointermove", onMove, { passive: true });
|
|
2207
|
+
win.addEventListener("pointerup", onEnd, { passive: true });
|
|
2208
|
+
win.addEventListener("pointercancel", onEnd, { passive: true });
|
|
2209
|
+
armed.current = disarm;
|
|
2210
|
+
}, [
|
|
2211
|
+
containerRef,
|
|
2212
|
+
settle,
|
|
2213
|
+
win,
|
|
2214
|
+
write
|
|
2215
|
+
]);
|
|
2216
|
+
return {
|
|
2217
|
+
align,
|
|
2218
|
+
consumeClick: useCallback(() => {
|
|
2219
|
+
if (!movedLast.current) return false;
|
|
2220
|
+
movedLast.current = false;
|
|
2221
|
+
return true;
|
|
2222
|
+
}, []),
|
|
2223
|
+
handleProps: enabled ? { onPointerDown } : {}
|
|
2224
|
+
};
|
|
2225
|
+
}
|
|
2226
|
+
//#endregion
|
|
1881
2227
|
//#region src/dock/dock-row.tsx
|
|
1882
2228
|
/** Same path data as `rope-knot.tsx`'s `KNOT_PATH` and `cdn/dock-dom.ts`'s copy. */
|
|
1883
2229
|
var KNOT_PATH = "M2 54 C15 54 24 55 31 53 C40 50 44 40 54 41 C64 42 67 51 60 57 C52 64 38 64 33 57 C29 51 34 45 42 46 C50 47 58 52 68 53.5 C80 55 90 54 98 54";
|
|
@@ -1949,7 +2295,7 @@ function DockActivitySlot({ activity }) {
|
|
|
1949
2295
|
}, i)) : activity === "progress" ? /* @__PURE__ */ jsx("span", { className: "wgt-progress" }) : null
|
|
1950
2296
|
});
|
|
1951
2297
|
}
|
|
1952
|
-
function DockRow({ view, identity, form, messages, captionLine, captionSwapKey, captionTestId, draft, onDraftChange, onSubmit, placeholder, composerDisabled, onControl, onMicDown, onMicUp, interruptLabelled, micOpen, micDisabled, micUnavailableReason, attachBusy, rowRef, inputRef, captionDurationMs, markStateLabel, onMarkPress }) {
|
|
2298
|
+
function DockRow({ view, identity, form, messages, captionLine, captionSwapKey, captionTestId, draft, onDraftChange, onSubmit, placeholder, composerDisabled, onControl, onMicDown, onMicUp, interruptLabelled, micOpen, micDisabled, micUnavailableReason, attachBusy, rowRef, inputRef, captionDurationMs, markStateLabel, onMarkPress, sheetOpen, draggable, dragHandleProps }) {
|
|
1953
2299
|
const msg = (key, vars) => formatMessage(messages[key] ?? defaultWidgetMessages[key], vars);
|
|
1954
2300
|
/**
|
|
1955
2301
|
* §5.1 — tap anywhere on the row during `speaking` is an interrupt. A press
|
|
@@ -1968,6 +2314,8 @@ function DockRow({ view, identity, form, messages, captionLine, captionSwapKey,
|
|
|
1968
2314
|
"data-state": view.state,
|
|
1969
2315
|
"data-border": view.border,
|
|
1970
2316
|
"data-form": form,
|
|
2317
|
+
"data-sheet": sheetOpen ? "open" : "closed",
|
|
2318
|
+
"data-draggable": draggable ? "true" : void 0,
|
|
1971
2319
|
"data-testid": "widget-dock-row",
|
|
1972
2320
|
onClick: onRowClick,
|
|
1973
2321
|
children: [
|
|
@@ -1976,6 +2324,7 @@ function DockRow({ view, identity, form, messages, captionLine, captionSwapKey,
|
|
|
1976
2324
|
className: "wgt-mark",
|
|
1977
2325
|
"data-dock-slot": "mark",
|
|
1978
2326
|
"aria-label": markStateLabel,
|
|
2327
|
+
...draggable ? dragHandleProps : {},
|
|
1979
2328
|
onClick: onMarkPress,
|
|
1980
2329
|
children: /* @__PURE__ */ jsx(DockMarkFace, {
|
|
1981
2330
|
identity,
|
|
@@ -2229,7 +2578,7 @@ function ClipGlyph() {
|
|
|
2229
2578
|
}
|
|
2230
2579
|
//#endregion
|
|
2231
2580
|
//#region src/dock/dock-pill.tsx
|
|
2232
|
-
function DockPill({ identity, mark, label, line, expandLabel, form, onPress, pillRef }) {
|
|
2581
|
+
function DockPill({ identity, mark, label, line, expandLabel, form, onPress, draggable, dragHandleProps, pillRef }) {
|
|
2233
2582
|
const text = line !== void 0 && line !== "" ? line : label;
|
|
2234
2583
|
return /* @__PURE__ */ jsxs("button", {
|
|
2235
2584
|
ref: pillRef,
|
|
@@ -2239,7 +2588,9 @@ function DockPill({ identity, mark, label, line, expandLabel, form, onPress, pil
|
|
|
2239
2588
|
"data-concierge-open": "",
|
|
2240
2589
|
"data-form": form,
|
|
2241
2590
|
"data-testid": "widget-dock-pill",
|
|
2591
|
+
"data-draggable": draggable ? "true" : void 0,
|
|
2242
2592
|
"aria-label": `${label} — ${expandLabel}`,
|
|
2593
|
+
...draggable ? dragHandleProps : {},
|
|
2243
2594
|
onClick: onPress,
|
|
2244
2595
|
children: [/* @__PURE__ */ jsx(DockMarkFace, {
|
|
2245
2596
|
identity,
|
|
@@ -2257,7 +2608,7 @@ function DockPill({ identity, mark, label, line, expandLabel, form, onPress, pil
|
|
|
2257
2608
|
var EXPAND_DRAG_PX = 40;
|
|
2258
2609
|
/** Below this, the pointer never left the tap — a thumb resting, not a drag. */
|
|
2259
2610
|
var DRAG_SLOP_PX = 4;
|
|
2260
|
-
function DockSheet({ snap, onSnapChange, label, peekOnly, header, children, onDismiss, followKey, sheetRef, durationMs, dragHandleLabel }) {
|
|
2611
|
+
function DockSheet({ snap, onSnapChange, label, peekOnly, header, children, onDismiss, followKey, historyRevealed = false, sheetRef, durationMs, dragHandleLabel }) {
|
|
2261
2612
|
const localRef = useRef(null);
|
|
2262
2613
|
const ref = sheetRef ?? localRef;
|
|
2263
2614
|
const bodyRef = useRef(null);
|
|
@@ -2287,6 +2638,11 @@ function DockSheet({ snap, onSnapChange, label, peekOnly, header, children, onDi
|
|
|
2287
2638
|
* precisely when a reader who has scrolled away must be left alone.
|
|
2288
2639
|
*/
|
|
2289
2640
|
const rowCount = useRef(-1);
|
|
2641
|
+
/**
|
|
2642
|
+
* Whether the last follow ran on the WHOLE transcript — see
|
|
2643
|
+
* {@link DockSheetProps.historyRevealed}.
|
|
2644
|
+
*/
|
|
2645
|
+
const revealed = useRef(historyRevealed);
|
|
2290
2646
|
const onScroll = useCallback(() => {
|
|
2291
2647
|
const el = bodyRef.current;
|
|
2292
2648
|
if (!el) return;
|
|
@@ -2296,16 +2652,18 @@ function DockSheet({ snap, onSnapChange, label, peekOnly, header, children, onDi
|
|
|
2296
2652
|
const el = bodyRef.current;
|
|
2297
2653
|
if (!el || snap === "closed") return;
|
|
2298
2654
|
const anchorCount = el.querySelectorAll("[data-dock-follow]").length;
|
|
2299
|
-
const
|
|
2655
|
+
const justRevealed = historyRevealed && !revealed.current;
|
|
2656
|
+
revealed.current = historyRevealed;
|
|
2657
|
+
const grew = anchorCount !== rowCount.current && rowCount.current >= 0;
|
|
2300
2658
|
rowCount.current = anchorCount;
|
|
2301
|
-
if (grew) following.current = true;
|
|
2659
|
+
if (grew || justRevealed) following.current = true;
|
|
2302
2660
|
if (!following.current) return;
|
|
2303
2661
|
const settle = () => {
|
|
2304
2662
|
const anchors = el.querySelectorAll("[data-dock-follow]");
|
|
2305
2663
|
const newest = anchors[anchors.length - 1];
|
|
2306
2664
|
const end = Math.max(0, el.scrollHeight - el.clientHeight);
|
|
2307
2665
|
const before = el.scrollTop;
|
|
2308
|
-
el.scrollTop = newest === void 0 ? end : Math.max(0, Math.min(end, el.scrollTop + (newest.getBoundingClientRect().top - el.getBoundingClientRect().top)));
|
|
2666
|
+
el.scrollTop = newest === void 0 || justRevealed ? end : Math.max(0, Math.min(end, el.scrollTop + (newest.getBoundingClientRect().top - el.getBoundingClientRect().top)));
|
|
2309
2667
|
return Math.abs(el.scrollTop - before);
|
|
2310
2668
|
};
|
|
2311
2669
|
settle();
|
|
@@ -2316,7 +2674,11 @@ function DockSheet({ snap, onSnapChange, label, peekOnly, header, children, onDi
|
|
|
2316
2674
|
if (settle() > .5 && passes < 4) raf = requestAnimationFrame(again);
|
|
2317
2675
|
});
|
|
2318
2676
|
return () => cancelAnimationFrame(raf);
|
|
2319
|
-
}, [
|
|
2677
|
+
}, [
|
|
2678
|
+
followKey,
|
|
2679
|
+
snap,
|
|
2680
|
+
historyRevealed
|
|
2681
|
+
]);
|
|
2320
2682
|
const lastSnap = useRef(snap);
|
|
2321
2683
|
const firstSnap = useRef(true);
|
|
2322
2684
|
useEffect(() => {
|
|
@@ -3125,6 +3487,43 @@ function deriveView(input) {
|
|
|
3125
3487
|
}
|
|
3126
3488
|
}
|
|
3127
3489
|
}
|
|
3490
|
+
/**
|
|
3491
|
+
* §3.4 (revised 2026-09-11) — where the LATEST EXCHANGE begins.
|
|
3492
|
+
*
|
|
3493
|
+
* An exchange is the shopper's line and the reply to it. The latest one
|
|
3494
|
+
* therefore starts at the LAST caller turn and runs to the end, so a reply
|
|
3495
|
+
* that arrived as three turns (a filler, the answer, the cards) stays whole.
|
|
3496
|
+
*
|
|
3497
|
+
* Two cases are not that shape and both are real:
|
|
3498
|
+
*
|
|
3499
|
+
* - the shopper has not spoken yet. The concierge opens with a greeting of
|
|
3500
|
+
* its own, and a proactive nudge can add a second line before anybody has
|
|
3501
|
+
* typed; the latest exchange is then the LAST agent turn alone, because
|
|
3502
|
+
* two unanswered agent lines are two things said, not one exchange.
|
|
3503
|
+
* - a `speaker: 'event'` row — §3.4's handoff marker. It is something that
|
|
3504
|
+
* happened TO an exchange rather than a turn in one, so it never starts a
|
|
3505
|
+
* new one and never ends the search for the caller line above it.
|
|
3506
|
+
*/
|
|
3507
|
+
function latestExchangeStart(speakers) {
|
|
3508
|
+
for (let i = speakers.length - 1; i >= 0; i--) if (speakers[i] === "caller") return i;
|
|
3509
|
+
return Math.max(0, speakers.length - 1);
|
|
3510
|
+
}
|
|
3511
|
+
/**
|
|
3512
|
+
* How many exchanges the transcript holds — the number "Show conversation"
|
|
3513
|
+
* is offered on (§3.4: the control exists only when there is more than one).
|
|
3514
|
+
*
|
|
3515
|
+
* A caller line opens an exchange; anything said BEFORE the first one (the
|
|
3516
|
+
* greeting, a proactive nudge) is an exchange of its own, because it is
|
|
3517
|
+
* something the shopper can scroll back to and would otherwise be counted as
|
|
3518
|
+
* nothing at all — leaving a dock that shows a greeting, then an answer, and
|
|
3519
|
+
* claims there is nothing more to see.
|
|
3520
|
+
*/
|
|
3521
|
+
function exchangeCount(speakers) {
|
|
3522
|
+
if (speakers.length === 0) return 0;
|
|
3523
|
+
const opened = speakers.findIndex((s) => s === "caller");
|
|
3524
|
+
if (opened === -1) return speakers.length;
|
|
3525
|
+
return speakers.filter((s) => s === "caller").length + (opened === 0 ? 0 : 1);
|
|
3526
|
+
}
|
|
3128
3527
|
//#endregion
|
|
3129
3528
|
//#region src/dock/dock.tsx
|
|
3130
3529
|
var DEFAULT_COLOR = {
|
|
@@ -3143,7 +3542,7 @@ var DEFAULT_LAYOUT = {
|
|
|
3143
3542
|
};
|
|
3144
3543
|
var INTERRUPT_SEEN_STORAGE_KEY = "wgt_dock_interrupt_seen";
|
|
3145
3544
|
function Dock(props) {
|
|
3146
|
-
const { identity, color = DEFAULT_COLOR, type = DEFAULT_TYPE, layout = DEFAULT_LAYOUT, copy = {}, direction = "ltr", locale = "en", messages = defaultWidgetMessages, voice, escalated = false, offline = false, status, notice, statusKind, operatorLine, reconnecting = false, roomDropped = false, partialTranscript, preamble, clause, channel = "text", shelf, transcript, 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, onEndCall, skinStyle, skin, preview = false, announcement, attribution, initialDraft, initialSelection, initialFocus, initialMinimised, insets, hold, audio, onReady } = props;
|
|
3545
|
+
const { identity, color = DEFAULT_COLOR, type = DEFAULT_TYPE, layout = DEFAULT_LAYOUT, copy = {}, direction = "ltr", locale = "en", messages = defaultWidgetMessages, voice, escalated = false, offline = false, status, notice, statusKind, operatorLine, reconnecting = false, roomDropped = false, partialTranscript, preamble, clause, channel = "text", shelf, transcript, latestExchange, exchangeCount, 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, onEndCall, skinStyle, skin, preview = false, announcement, attribution, initialDraft, initialSelection, initialFocus, initialMinimised, insets, hold, audio, onReady } = props;
|
|
3147
3546
|
const scopeId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
3148
3547
|
const rootRef = useRef(null);
|
|
3149
3548
|
const rowRef = useRef(null);
|
|
@@ -3152,7 +3551,24 @@ function Dock(props) {
|
|
|
3152
3551
|
const setVar = useCssVars(rootRef);
|
|
3153
3552
|
const motionOff = useMotionOff();
|
|
3154
3553
|
const durations = useDockDurations(motionOff);
|
|
3155
|
-
const { isDesktop, shortViewport } = useViewport(rootRef);
|
|
3554
|
+
const { isDesktop, shortViewport, finePointer, win } = useViewport(rootRef);
|
|
3555
|
+
/**
|
|
3556
|
+
* §9.1's `layout.draggable` — desktop only, a real pointer only, and the
|
|
3557
|
+
* tenant's own switch on top.
|
|
3558
|
+
*
|
|
3559
|
+
* Defaulted `true` rather than required, because the config field is
|
|
3560
|
+
* younger than this component: a host still passing a `layout` without it
|
|
3561
|
+
* (the marketing preview, a Next.js embed pinned to an older config) gets
|
|
3562
|
+
* §9.1's default rather than a dock that refuses to move.
|
|
3563
|
+
*/
|
|
3564
|
+
const draggable = isDesktop && finePointer && layout.draggable !== false;
|
|
3565
|
+
const dragging = useDockDrag(rootRef, {
|
|
3566
|
+
enabled: draggable,
|
|
3567
|
+
published: layout.desktopAlign,
|
|
3568
|
+
win,
|
|
3569
|
+
durationMs: durations.swap,
|
|
3570
|
+
pillRef
|
|
3571
|
+
});
|
|
3156
3572
|
const msg = useCallback((key, vars) => formatMessage(messages[key] ?? defaultWidgetMessages[key], vars), [messages]);
|
|
3157
3573
|
const name = identity.name?.trim() || "Concierge";
|
|
3158
3574
|
const [form, setForm] = useState(() => layout.minimised === "never" ? "row" : initialMinimised ?? layout.minimised === "startMinimised" ? "pill" : "row");
|
|
@@ -3175,6 +3591,16 @@ function Dock(props) {
|
|
|
3175
3591
|
const [sheetEverOpened, setSheetEverOpened] = useState(false);
|
|
3176
3592
|
const [ducked, setDucked] = useState(false);
|
|
3177
3593
|
const [showTranscript, setShowTranscript] = useState(false);
|
|
3594
|
+
/**
|
|
3595
|
+
* §3.4 — the shopper asked for the whole conversation, so the sheet holds
|
|
3596
|
+
* the transcript rather than the latest exchange.
|
|
3597
|
+
*
|
|
3598
|
+
* Reset when the sheet CLOSES (see `dismissSheet`) rather than kept for the
|
|
3599
|
+
* session: the sheet's job at `peek` is to show the concierge's answer, and
|
|
3600
|
+
* a shopper who opened the history once should not find every later reply
|
|
3601
|
+
* buried under it.
|
|
3602
|
+
*/
|
|
3603
|
+
const [showConversation, setShowConversation] = useState(false);
|
|
3178
3604
|
const [nudge, setNudge] = useState(void 0);
|
|
3179
3605
|
const [interruptsSeen, setInterruptsSeen] = useState(readInterruptsSeen);
|
|
3180
3606
|
const [engaged, setEngaged] = useState(() => initialFocus !== null && initialFocus !== void 0);
|
|
@@ -3887,10 +4313,14 @@ function Dock(props) {
|
|
|
3887
4313
|
setSheet("closed");
|
|
3888
4314
|
inputRef.current?.focus();
|
|
3889
4315
|
}, []);
|
|
4316
|
+
useEffect(() => {
|
|
4317
|
+
if (sheet === "closed") setShowConversation(false);
|
|
4318
|
+
}, [sheet]);
|
|
4319
|
+
const align = dragging.align;
|
|
3890
4320
|
const rootStyle = useMemo(() => {
|
|
3891
4321
|
const style = { ...geometryVars(isDesktop, layout) };
|
|
3892
4322
|
style["--wgt-row-margin"] = isDesktop ? "0px" : `10px`;
|
|
3893
|
-
const anchor = pillAnchor(direction, isDesktop,
|
|
4323
|
+
const anchor = pillAnchor(direction, isDesktop, align);
|
|
3894
4324
|
style["--wgt-pill-left"] = anchor.side === "left" ? `${anchor.inset}px` : "auto";
|
|
3895
4325
|
style["--wgt-pill-right"] = anchor.side === "right" ? `${anchor.inset}px` : "auto";
|
|
3896
4326
|
style["--wgt-sheet-peek"] = `260px`;
|
|
@@ -3907,8 +4337,8 @@ function Dock(props) {
|
|
|
3907
4337
|
} else {
|
|
3908
4338
|
const width = rowWidthLen(true, layout.desktopWidth);
|
|
3909
4339
|
style.width = width;
|
|
3910
|
-
if (
|
|
3911
|
-
else if (
|
|
4340
|
+
if (align === "left") style.left = `16px`;
|
|
4341
|
+
else if (align === "right") style.right = `16px`;
|
|
3912
4342
|
else {
|
|
3913
4343
|
style.left = "50%";
|
|
3914
4344
|
style.marginLeft = `calc(${width} / -2)`;
|
|
@@ -3921,6 +4351,7 @@ function Dock(props) {
|
|
|
3921
4351
|
}, [
|
|
3922
4352
|
isDesktop,
|
|
3923
4353
|
layout,
|
|
4354
|
+
align,
|
|
3924
4355
|
durations,
|
|
3925
4356
|
direction,
|
|
3926
4357
|
skinStyle,
|
|
@@ -3973,6 +4404,16 @@ function Dock(props) {
|
|
|
3973
4404
|
const greeting = copy.greeting?.trim();
|
|
3974
4405
|
const typedPlaceholder = copy.placeholder?.trim() || msg("type_placeholder");
|
|
3975
4406
|
const placeholder = greeting !== void 0 && greeting !== "" && !hasContent && !sheetEverOpened && view.state === "dormant" ? greeting : typedPlaceholder;
|
|
4407
|
+
/**
|
|
4408
|
+
* §3.4 — is this the one-answer view?
|
|
4409
|
+
*
|
|
4410
|
+
* A TEXT session, a host that supplied the latest view at all, the shopper
|
|
4411
|
+
* has not asked for the history, and the sheet is not already expanded —
|
|
4412
|
+
* because a sheet dragged open by its handle is a shopper asking for room,
|
|
4413
|
+
* and answering that with one exchange and a lot of white space is worse
|
|
4414
|
+
* than answering it with the conversation.
|
|
4415
|
+
*/
|
|
4416
|
+
const showLatestOnly = channel === "text" && latestExchange !== void 0 && !showConversation && sheet !== "expanded";
|
|
3976
4417
|
const sheetHeader = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3977
4418
|
onEndCall !== void 0 && view.callActive ? /* @__PURE__ */ jsx("button", {
|
|
3978
4419
|
type: "button",
|
|
@@ -3988,15 +4429,29 @@ function Dock(props) {
|
|
|
3988
4429
|
onClick: () => setShowTranscript(true),
|
|
3989
4430
|
children: msg("dock_show_transcript")
|
|
3990
4431
|
}) : null,
|
|
4432
|
+
showLatestOnly && (exchangeCount ?? 0) > 1 ? /* @__PURE__ */ jsx("button", {
|
|
4433
|
+
type: "button",
|
|
4434
|
+
className: "wgt-sheet-action",
|
|
4435
|
+
"data-testid": "widget-dock-show-conversation",
|
|
4436
|
+
onClick: (event) => {
|
|
4437
|
+
const handle = event.currentTarget.closest(".wgt-sheet")?.querySelector(".wgt-sheet-handle");
|
|
4438
|
+
setShowConversation(true);
|
|
4439
|
+
if (!shortViewport) setSheet("expanded");
|
|
4440
|
+
handle?.focus();
|
|
4441
|
+
},
|
|
4442
|
+
children: msg("dock_show_conversation")
|
|
4443
|
+
}) : null,
|
|
3991
4444
|
layout.minimised !== "never" ? /* @__PURE__ */ jsx("button", {
|
|
3992
4445
|
type: "button",
|
|
3993
4446
|
className: "wgt-sheet-action",
|
|
3994
4447
|
"data-testid": "widget-dock-minimise",
|
|
4448
|
+
"aria-label": msg("minimize"),
|
|
4449
|
+
title: msg("minimize"),
|
|
3995
4450
|
onClick: () => {
|
|
3996
4451
|
setSheet("closed");
|
|
3997
4452
|
setFormPersisting("pill");
|
|
3998
4453
|
},
|
|
3999
|
-
children:
|
|
4454
|
+
children: /* @__PURE__ */ jsx(ChevronDownGlyph, {})
|
|
4000
4455
|
}) : null
|
|
4001
4456
|
] });
|
|
4002
4457
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -4005,6 +4460,8 @@ function Dock(props) {
|
|
|
4005
4460
|
"data-concierge-dock": "",
|
|
4006
4461
|
"data-wgt-scope": scopeId,
|
|
4007
4462
|
"data-viewport": isDesktop ? "desktop" : "mobile",
|
|
4463
|
+
"data-align": align,
|
|
4464
|
+
"data-draggable": draggable ? "true" : void 0,
|
|
4008
4465
|
"data-state": view.state,
|
|
4009
4466
|
...skin !== void 0 ? { "data-skin": skin } : {},
|
|
4010
4467
|
role: "region",
|
|
@@ -4034,6 +4491,7 @@ function Dock(props) {
|
|
|
4034
4491
|
header: sheetHeader,
|
|
4035
4492
|
onDismiss: dismissSheet,
|
|
4036
4493
|
...followKey !== void 0 ? { followKey } : {},
|
|
4494
|
+
historyRevealed: latestExchange !== void 0 && !showLatestOnly,
|
|
4037
4495
|
durationMs: sheet === "closed" ? durations.sheetClose : durations.sheetOpen,
|
|
4038
4496
|
dragHandleLabel: msg("conversation"),
|
|
4039
4497
|
children: [
|
|
@@ -4046,7 +4504,7 @@ function Dock(props) {
|
|
|
4046
4504
|
...productHref ? { productHref } : {},
|
|
4047
4505
|
...navigate ? { navigate } : {}
|
|
4048
4506
|
}) : null,
|
|
4049
|
-
channel === "text" || showTranscript ? transcript : null,
|
|
4507
|
+
channel === "text" || showTranscript ? showLatestOnly ? latestExchange : transcript : null,
|
|
4050
4508
|
sheetExtra,
|
|
4051
4509
|
attribution !== void 0 ? /* @__PURE__ */ jsx("a", {
|
|
4052
4510
|
className: "wgt-shelf-more",
|
|
@@ -4066,9 +4524,12 @@ function Dock(props) {
|
|
|
4066
4524
|
expandLabel: msg("open"),
|
|
4067
4525
|
form,
|
|
4068
4526
|
onPress: () => {
|
|
4527
|
+
if (dragging.consumeClick()) return;
|
|
4069
4528
|
setEngaged(true);
|
|
4070
4529
|
setFormPersisting("row");
|
|
4071
4530
|
},
|
|
4531
|
+
draggable,
|
|
4532
|
+
dragHandleProps: dragging.handleProps,
|
|
4072
4533
|
pillRef
|
|
4073
4534
|
}),
|
|
4074
4535
|
/* @__PURE__ */ jsx(DockRow, {
|
|
@@ -4100,14 +4561,41 @@ function Dock(props) {
|
|
|
4100
4561
|
captionDurationMs: durations.caption,
|
|
4101
4562
|
markStateLabel: msg(view.border === "primary" ? "state_listening" : "state_idle", { product: name }),
|
|
4102
4563
|
onMarkPress: () => {
|
|
4564
|
+
if (dragging.consumeClick()) return;
|
|
4103
4565
|
setEngaged(true);
|
|
4104
4566
|
setSheet((current) => current === "closed" ? "peek" : "closed");
|
|
4105
|
-
}
|
|
4567
|
+
},
|
|
4568
|
+
sheetOpen: sheet !== "closed",
|
|
4569
|
+
draggable,
|
|
4570
|
+
dragHandleProps: dragging.handleProps
|
|
4106
4571
|
}),
|
|
4107
4572
|
attachSlot
|
|
4108
4573
|
]
|
|
4109
4574
|
});
|
|
4110
4575
|
}
|
|
4576
|
+
/**
|
|
4577
|
+
* §5.4's minimise glyph — a chevron pointing at the row the sheet collapses
|
|
4578
|
+
* onto.
|
|
4579
|
+
*
|
|
4580
|
+
* Inline SVG at 18 px on `currentColor`, exactly like `dock-row.tsx`'s five:
|
|
4581
|
+
* a webfont is a network request on a merchant's page for one shape, and an
|
|
4582
|
+
* `aria-hidden` glyph inside a button that already carries its accessible
|
|
4583
|
+
* name is never read out.
|
|
4584
|
+
*/
|
|
4585
|
+
function ChevronDownGlyph() {
|
|
4586
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
4587
|
+
width: 18,
|
|
4588
|
+
height: 18,
|
|
4589
|
+
viewBox: "0 0 24 24",
|
|
4590
|
+
"aria-hidden": "true",
|
|
4591
|
+
fill: "none",
|
|
4592
|
+
stroke: "currentColor",
|
|
4593
|
+
strokeWidth: 1.8,
|
|
4594
|
+
strokeLinecap: "round",
|
|
4595
|
+
strokeLinejoin: "round",
|
|
4596
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
4597
|
+
});
|
|
4598
|
+
}
|
|
4111
4599
|
/** Turns §5.1's caption spec into the string this locale renders. */
|
|
4112
4600
|
function resolveCaption(view, msg) {
|
|
4113
4601
|
if (view.caption.kind === "field") return void 0;
|
|
@@ -4225,7 +4713,15 @@ function useViewport(rootRef) {
|
|
|
4225
4713
|
const subscribe = useCallback((onChange) => win === null ? () => void 0 : subscribeToViewport(win, onChange), [win]);
|
|
4226
4714
|
return {
|
|
4227
4715
|
isDesktop: useSyncExternalStore(subscribe, () => win !== null && win.innerWidth >= 768, () => false),
|
|
4228
|
-
shortViewport: useSyncExternalStore(subscribe, () => win !== null && win.innerHeight < 500, () => false)
|
|
4716
|
+
shortViewport: useSyncExternalStore(subscribe, () => win !== null && win.innerHeight < 500, () => false),
|
|
4717
|
+
finePointer: useSyncExternalStore(subscribe, () => {
|
|
4718
|
+
try {
|
|
4719
|
+
return win?.matchMedia?.("(pointer: fine)").matches === true;
|
|
4720
|
+
} catch {
|
|
4721
|
+
return false;
|
|
4722
|
+
}
|
|
4723
|
+
}, () => false),
|
|
4724
|
+
win
|
|
4229
4725
|
};
|
|
4230
4726
|
}
|
|
4231
4727
|
//#endregion
|
|
@@ -5441,6 +5937,103 @@ function VoiceWidget({ state, turns, onToggleMic, onEndCall, callPhase = "idle",
|
|
|
5441
5937
|
onStart: onToggleMic,
|
|
5442
5938
|
onToggleMute: onToggleMic
|
|
5443
5939
|
};
|
|
5940
|
+
/**
|
|
5941
|
+
* §3.4 — the transcript, rendered from whichever slice of the turns it is
|
|
5942
|
+
* given.
|
|
5943
|
+
*
|
|
5944
|
+
* A local function rather than a component, and deliberately: it closes
|
|
5945
|
+
* over the dozen things a turn is drawn from (the messages, the locale, the
|
|
5946
|
+
* card handlers, `escalated`, `sending`) and lifting those into props would
|
|
5947
|
+
* be a component with fifteen of them and no second caller. The two slices
|
|
5948
|
+
* it is called with are §3.4's two views.
|
|
5949
|
+
*/
|
|
5950
|
+
const renderLog = (shown, view = "all", offset = 0) => /* @__PURE__ */ jsxs("div", {
|
|
5951
|
+
role: "log",
|
|
5952
|
+
"aria-live": "polite",
|
|
5953
|
+
"aria-relevant": "additions text",
|
|
5954
|
+
className: "flex flex-col gap-1",
|
|
5955
|
+
children: [
|
|
5956
|
+
shown.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
5957
|
+
className: "py-8 text-center text-sm text-[var(--widget-foreground-muted)]",
|
|
5958
|
+
children: messages.empty
|
|
5959
|
+
}) : shown.map((turn, i) => turn.speaker === "event" ? /* @__PURE__ */ jsx(TranscriptEvent, {
|
|
5960
|
+
event: turn.event,
|
|
5961
|
+
messages,
|
|
5962
|
+
awaitingReply: !shown.slice(i + 1).some((t) => t.speaker === "agent" && t.text.trim() !== "")
|
|
5963
|
+
}, `event-${offset + i}`) : /* @__PURE__ */ jsxs("div", {
|
|
5964
|
+
"data-dock-follow": "",
|
|
5965
|
+
className: turn.speaker === "caller" ? "wgt-turn-row flex flex-col items-end" : "wgt-turn-row flex flex-col items-start",
|
|
5966
|
+
children: [
|
|
5967
|
+
turn.text !== "" || turn.speaker === "agent" && turn.final === false ? /* @__PURE__ */ jsx("div", {
|
|
5968
|
+
dir: textDirectionFor(turn.locale),
|
|
5969
|
+
lang: turn.locale,
|
|
5970
|
+
"data-testid": turn.speaker === "caller" ? "widget-turn-caller" : turn.filler === true ? "widget-turn-agent-filler" : "widget-turn-agent",
|
|
5971
|
+
className: `max-w-[85%] px-3.5 py-2 text-[14px] leading-[1.55] shadow-sm ${turn.speaker === "caller" ? "from-brand-plum to-brand-plum/90 text-[var(--widget-accent-foreground)] rounded-2xl rounded-ee-md bg-gradient-to-br" : turn.filler === true ? "rounded-2xl rounded-es-md border border-dashed border-[var(--widget-foreground-muted)]/50 bg-transparent text-[var(--widget-foreground-muted)] shadow-none" : AGENT_BUBBLE_CLASS}`,
|
|
5972
|
+
children: turn.speaker === "agent" && turn.text === "" && turn.final === false ? /* @__PURE__ */ jsx(TypingDots, { label: messages.typing }) : turn.speaker === "agent" && turn.filler === true ? /* @__PURE__ */ jsxs("span", {
|
|
5973
|
+
className: "flex items-center gap-2 italic",
|
|
5974
|
+
children: [/* @__PURE__ */ jsx("span", { children: turn.text }), /* @__PURE__ */ jsx(TypingDots, { label: messages.typing })]
|
|
5975
|
+
}) : turn.speaker === "agent" ? /* @__PURE__ */ jsx(WidgetMarkdown, { text: turn.text }) : /* @__PURE__ */ jsx("span", {
|
|
5976
|
+
className: `whitespace-pre-wrap ${turn.final === false ? "italic opacity-70" : ""}`,
|
|
5977
|
+
children: turn.text
|
|
5978
|
+
})
|
|
5979
|
+
}) : null,
|
|
5980
|
+
turn.attachments && turn.attachments.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
5981
|
+
className: "w-full max-w-[85%]",
|
|
5982
|
+
children: /* @__PURE__ */ jsx(WidgetAttachmentList, {
|
|
5983
|
+
attachments: turn.attachments,
|
|
5984
|
+
messages
|
|
5985
|
+
})
|
|
5986
|
+
}) : null,
|
|
5987
|
+
turn.cards && turn.cards.items.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
5988
|
+
className: "w-full",
|
|
5989
|
+
children: /* @__PURE__ */ jsx(WidgetCardList, {
|
|
5990
|
+
cards: turn.cards,
|
|
5991
|
+
onAddToCart,
|
|
5992
|
+
curationHref,
|
|
5993
|
+
productHref,
|
|
5994
|
+
navigate,
|
|
5995
|
+
locale,
|
|
5996
|
+
messages,
|
|
5997
|
+
roomy: false,
|
|
5998
|
+
...dock?.showPrice !== void 0 ? { showPrice: dock.showPrice } : {},
|
|
5999
|
+
...dock?.cardImageAspect !== void 0 ? { imageAspect: dock.cardImageAspect } : {}
|
|
6000
|
+
})
|
|
6001
|
+
}) : null,
|
|
6002
|
+
turn.delivery !== void 0 ? /* @__PURE__ */ jsx(TurnDeliveryStatus, {
|
|
6003
|
+
delivery: turn.delivery,
|
|
6004
|
+
messages
|
|
6005
|
+
}) : null
|
|
6006
|
+
]
|
|
6007
|
+
}, `${turn.speaker}-${offset + i}`)),
|
|
6008
|
+
humanTyping ? /* @__PURE__ */ jsx("div", {
|
|
6009
|
+
"data-testid": "widget-human-typing",
|
|
6010
|
+
"data-dock-follow": "",
|
|
6011
|
+
className: "wgt-turn-row flex flex-col items-start",
|
|
6012
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
6013
|
+
className: `px-3.5 py-2 text-[14px] leading-[1.55] shadow-sm ${AGENT_BUBBLE_CLASS}`,
|
|
6014
|
+
children: /* @__PURE__ */ jsx(TypingDots, { label: messages.typing })
|
|
6015
|
+
})
|
|
6016
|
+
}) : null,
|
|
6017
|
+
!escalated && turns.every((turn) => turn.speaker !== "caller") ? /* @__PURE__ */ jsx("ul", {
|
|
6018
|
+
"aria-label": messages.suggestions_label,
|
|
6019
|
+
"data-testid": "widget-suggestions",
|
|
6020
|
+
className: "flex flex-wrap gap-2 pt-1",
|
|
6021
|
+
children: SUGGESTION_KEYS.map((key) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("button", {
|
|
6022
|
+
type: "button",
|
|
6023
|
+
"data-testid": "widget-suggestion",
|
|
6024
|
+
disabled: sending,
|
|
6025
|
+
onClick: () => void sendSuggestion(messages[key]),
|
|
6026
|
+
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)] disabled:cursor-default disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-[var(--widget-accent-ring)] focus-visible:outline-none",
|
|
6027
|
+
children: messages[key]
|
|
6028
|
+
}) }, key))
|
|
6029
|
+
}) : null
|
|
6030
|
+
]
|
|
6031
|
+
}, `log-${view}`);
|
|
6032
|
+
/**
|
|
6033
|
+
* The turns' SPEAKERS, which is all §3.4's split looks at
|
|
6034
|
+
* (`dock-state.ts`'s `latestExchangeStart` / `exchangeCount`).
|
|
6035
|
+
*/
|
|
6036
|
+
const speakers = turns.map((turn) => turn.speaker);
|
|
5444
6037
|
return /* @__PURE__ */ jsx(Dock, {
|
|
5445
6038
|
identity: {
|
|
5446
6039
|
name: "",
|
|
@@ -5498,88 +6091,9 @@ function VoiceWidget({ state, turns, onToggleMic, onEndCall, callPhase = "idle",
|
|
|
5498
6091
|
className: `text-xs ${attaching.failed ? "text-destructive" : "text-[var(--widget-foreground-muted)]"}`,
|
|
5499
6092
|
children: attaching.failed ? formatMessage(messages.attach_error, { filename: attaching.filename }) : formatMessage(messages.attach_uploading, { filename: attaching.filename })
|
|
5500
6093
|
}) : null] }),
|
|
5501
|
-
transcript:
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
"aria-relevant": "additions text",
|
|
5505
|
-
className: "flex flex-col gap-1",
|
|
5506
|
-
children: [
|
|
5507
|
-
turns.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
5508
|
-
className: "py-8 text-center text-sm text-[var(--widget-foreground-muted)]",
|
|
5509
|
-
children: messages.empty
|
|
5510
|
-
}) : turns.map((turn, i) => turn.speaker === "event" ? /* @__PURE__ */ jsx(TranscriptEvent, {
|
|
5511
|
-
event: turn.event,
|
|
5512
|
-
messages,
|
|
5513
|
-
awaitingReply: !turns.slice(i + 1).some((t) => t.speaker === "agent" && t.text.trim() !== "")
|
|
5514
|
-
}, `event-${i}`) : /* @__PURE__ */ jsxs("div", {
|
|
5515
|
-
"data-dock-follow": "",
|
|
5516
|
-
className: turn.speaker === "caller" ? "wgt-turn-row flex flex-col items-end" : "wgt-turn-row flex flex-col items-start",
|
|
5517
|
-
children: [
|
|
5518
|
-
turn.text !== "" || turn.speaker === "agent" && turn.final === false ? /* @__PURE__ */ jsx("div", {
|
|
5519
|
-
dir: textDirectionFor(turn.locale),
|
|
5520
|
-
lang: turn.locale,
|
|
5521
|
-
"data-testid": turn.speaker === "caller" ? "widget-turn-caller" : turn.filler === true ? "widget-turn-agent-filler" : "widget-turn-agent",
|
|
5522
|
-
className: `max-w-[85%] px-3.5 py-2 text-[14px] leading-[1.55] shadow-sm ${turn.speaker === "caller" ? "from-brand-plum to-brand-plum/90 text-[var(--widget-accent-foreground)] rounded-2xl rounded-ee-md bg-gradient-to-br" : turn.filler === true ? "rounded-2xl rounded-es-md border border-dashed border-[var(--widget-foreground-muted)]/50 bg-transparent text-[var(--widget-foreground-muted)] shadow-none" : AGENT_BUBBLE_CLASS}`,
|
|
5523
|
-
children: turn.speaker === "agent" && turn.text === "" && turn.final === false ? /* @__PURE__ */ jsx(TypingDots, { label: messages.typing }) : turn.speaker === "agent" && turn.filler === true ? /* @__PURE__ */ jsxs("span", {
|
|
5524
|
-
className: "flex items-center gap-2 italic",
|
|
5525
|
-
children: [/* @__PURE__ */ jsx("span", { children: turn.text }), /* @__PURE__ */ jsx(TypingDots, { label: messages.typing })]
|
|
5526
|
-
}) : turn.speaker === "agent" ? /* @__PURE__ */ jsx(WidgetMarkdown, { text: turn.text }) : /* @__PURE__ */ jsx("span", {
|
|
5527
|
-
className: `whitespace-pre-wrap ${turn.final === false ? "italic opacity-70" : ""}`,
|
|
5528
|
-
children: turn.text
|
|
5529
|
-
})
|
|
5530
|
-
}) : null,
|
|
5531
|
-
turn.attachments && turn.attachments.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
5532
|
-
className: "w-full max-w-[85%]",
|
|
5533
|
-
children: /* @__PURE__ */ jsx(WidgetAttachmentList, {
|
|
5534
|
-
attachments: turn.attachments,
|
|
5535
|
-
messages
|
|
5536
|
-
})
|
|
5537
|
-
}) : null,
|
|
5538
|
-
turn.cards && turn.cards.items.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
5539
|
-
className: "w-full",
|
|
5540
|
-
children: /* @__PURE__ */ jsx(WidgetCardList, {
|
|
5541
|
-
cards: turn.cards,
|
|
5542
|
-
onAddToCart,
|
|
5543
|
-
curationHref,
|
|
5544
|
-
productHref,
|
|
5545
|
-
navigate,
|
|
5546
|
-
locale,
|
|
5547
|
-
messages,
|
|
5548
|
-
roomy: false,
|
|
5549
|
-
...dock?.showPrice !== void 0 ? { showPrice: dock.showPrice } : {},
|
|
5550
|
-
...dock?.cardImageAspect !== void 0 ? { imageAspect: dock.cardImageAspect } : {}
|
|
5551
|
-
})
|
|
5552
|
-
}) : null,
|
|
5553
|
-
turn.delivery !== void 0 ? /* @__PURE__ */ jsx(TurnDeliveryStatus, {
|
|
5554
|
-
delivery: turn.delivery,
|
|
5555
|
-
messages
|
|
5556
|
-
}) : null
|
|
5557
|
-
]
|
|
5558
|
-
}, `${turn.speaker}-${i}`)),
|
|
5559
|
-
humanTyping ? /* @__PURE__ */ jsx("div", {
|
|
5560
|
-
"data-testid": "widget-human-typing",
|
|
5561
|
-
"data-dock-follow": "",
|
|
5562
|
-
className: "wgt-turn-row flex flex-col items-start",
|
|
5563
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
5564
|
-
className: `px-3.5 py-2 text-[14px] leading-[1.55] shadow-sm ${AGENT_BUBBLE_CLASS}`,
|
|
5565
|
-
children: /* @__PURE__ */ jsx(TypingDots, { label: messages.typing })
|
|
5566
|
-
})
|
|
5567
|
-
}) : null,
|
|
5568
|
-
!escalated && turns.every((turn) => turn.speaker !== "caller") ? /* @__PURE__ */ jsx("ul", {
|
|
5569
|
-
"aria-label": messages.suggestions_label,
|
|
5570
|
-
"data-testid": "widget-suggestions",
|
|
5571
|
-
className: "flex flex-wrap gap-2 pt-1",
|
|
5572
|
-
children: SUGGESTION_KEYS.map((key) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("button", {
|
|
5573
|
-
type: "button",
|
|
5574
|
-
"data-testid": "widget-suggestion",
|
|
5575
|
-
disabled: sending,
|
|
5576
|
-
onClick: () => void sendSuggestion(messages[key]),
|
|
5577
|
-
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)] disabled:cursor-default disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-[var(--widget-accent-ring)] focus-visible:outline-none",
|
|
5578
|
-
children: messages[key]
|
|
5579
|
-
}) }, key))
|
|
5580
|
-
}) : null
|
|
5581
|
-
]
|
|
5582
|
-
})
|
|
6094
|
+
transcript: renderLog(turns),
|
|
6095
|
+
latestExchange: renderLog(turns.slice(latestExchangeStart(speakers)), "latest", latestExchangeStart(speakers)),
|
|
6096
|
+
exchangeCount: exchangeCount(speakers)
|
|
5583
6097
|
});
|
|
5584
6098
|
}
|
|
5585
6099
|
new Set([
|
|
@@ -9922,4 +10436,4 @@ function ConciergeWidget({ embedKey, apiBase, socketUrl, socketPath, bridge, col
|
|
|
9922
10436
|
});
|
|
9923
10437
|
}
|
|
9924
10438
|
//#endregion
|
|
9925
|
-
export {
|
|
10439
|
+
export { ROW_H as $, Dock as A, mixToward as At, DESKTOP_BOTTOM as B, withAlpha as Bt, IDLE_SNAPSHOT as C, themeToInlineStyle as Ct, SessionLog as D, hexToOklch as Dt, SESSION_EVENTS as E, hexToOklab as Et, latestExchangeStart as F, oklchToOklab as Ft, DOCK_MINIMISED_STORAGE_KEY as G, DESKTOP_GUTTER as H, formatMessage as Ht, formatMoney as I, parseHex as It, MOBILE_MARGIN as J, DRAG_TAP_SLOP_PX as K, ACTIVITY_W as L, relativeLuminance as Lt, deriveDockState as M, oklabToLinearRgb as Mt, exchangeCount as N, oklabToOklch as Nt, formatMs as O, linearRgbToOklab as Ot, idleDockInput as P, oklchToHex as Pt, RADII as Q, BOTTOM_FLOOR as R, rotateHue as Rt, parseBlocks as S, themeToCss as St, SseFrameParser as T, formatHex as Tt, DESKTOP_WIDTHS as U, resolveWidgetMessages as Ut, DESKTOP_BREAKPOINT as V, defaultWidgetMessages as Vt, DOCK_ALIGN_STORAGE_KEY as W, widgetMessagesFromCopy as Wt, PILL_MARK as X, PILL_H as Y, PROACTIVE_NUDGE_MS as Z, readsAsCheckoutIntent as _, CARD_RADIUS_MAX_PX as _t, mergeAddedCartLine as a, SHORT_VIEWPORT as at, WidgetCardList as b, WIDGET_THEME_TOKENS as bt, toChatCart as c, geometryVars as ct, useVoiceSession as d, readStored as dt, SHEET_EXPANDED_DESKTOP_MAX as et, useChatSession as f, readStoredAlign as ft, readsAsCartViewIntent as g, writeStored as gt, basketIntentFromTurns as h, snapAlign as ht, deriveCallPhase as i, SHEET_TOP_CLEARANCE as it, DOCK_STATES as j, oklabToHex as jt, latencyBetween as k, linearToSrgb as kt, ROOM_EVENTS as l, persistAlign as lt, VoiceWidget as m, sheetMaxHeightLen as mt, MAX_REPORTED_CART_LINES as n, SHEET_GAP as nt, resolveAddToCartHandler as o, Z_INDEX as ot, detectPage as p, rowWidthLen as pt, MARK as q, cartLinesFromSnapshot as r, SHEET_PEEK_MAX as rt, resolveCheckoutUrl as s, bottomLen as st, ConciergeWidget as t, SHEET_EXPANDED_VH as tt, createWidgetVoiceTokenFetcher as u, pillAnchor as ut, textDirectionFor as v, SHEET_RADIUS_MAX_PX as vt, botStateFor as w, contrastRatio as wt, WidgetMarkdown as x, deriveTheme as xt, WidgetCartSummary as y, SYSTEM_FONT_STACK as yt, CONTROL as z, srgbToLinear as zt };
|