@40rty/ams-ui 0.5.14 → 0.5.16
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/conversation.js +506 -336
- package/dist/css/conversation/conversation.css +1 -0
- package/dist/types/conversation/ConversationCanvas.d.ts +3 -2
- package/dist/types/conversation/PageComposer.d.ts +2 -1
- package/dist/types/conversation/TurnHeader.d.ts +10 -3
- package/dist/types/conversation/follow-ups-place.d.ts +4 -0
- package/dist/types/conversation/index.d.ts +1 -1
- package/dist/types/conversation/presence-parts.d.ts +30 -2
- package/dist/types/conversation/steady-line.d.ts +21 -0
- package/dist/types/conversation/turn-header-parts.d.ts +51 -0
- package/dist/types/conversation/turn-text.d.ts +4 -10
- package/package.json +2 -2
package/dist/conversation.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-ZP27BQQE.js";
|
|
26
26
|
|
|
27
27
|
// src/conversation/ConversationCanvas.tsx
|
|
28
|
-
import { CanvasArrangementProvider, CanvasMotionStyleProvider, SpacefrontCanvas } from "@40rty/ams-sdk";
|
|
28
|
+
import { CanvasArrangementProvider, CanvasLeadProvider, CanvasMotionStyleProvider, SpacefrontCanvas } from "@40rty/ams-sdk";
|
|
29
29
|
|
|
30
30
|
// src/conversation/ResultSheet.tsx
|
|
31
31
|
import * as React from "react";
|
|
@@ -55,150 +55,54 @@ function ResultSheet({ children }) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// src/conversation/TurnHeader.tsx
|
|
58
|
-
import * as
|
|
59
|
-
import { useConversationPage as useConversationPage2 } from "@40rty/ams-sdk";
|
|
58
|
+
import * as React8 from "react";
|
|
59
|
+
import { CanvasLeadSlot, turnAskAnswers, useCanvasLead, useConversationPage as useConversationPage2 } from "@40rty/ams-sdk";
|
|
60
60
|
|
|
61
61
|
// src/conversation/presence-parts.tsx
|
|
62
|
+
import * as React4 from "react";
|
|
62
63
|
import { useScanning } from "@40rty/ams-sdk";
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
className: "relative flex flex-col gap-1 pb-1.5",
|
|
74
|
-
initial: reduce === true ? false : { opacity: 0, y: 4 },
|
|
75
|
-
animate: { opacity: 1, y: 0 },
|
|
76
|
-
transition: { duration: 0.3, ease: EASE },
|
|
77
|
-
children: [
|
|
78
|
-
/* @__PURE__ */ jsx2("span", { className: "text-xs leading-[1.125rem] text-[var(--fourty-convo-muted)]", children: fact.label }),
|
|
79
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-medium leading-5", children: [
|
|
80
|
-
fact.value,
|
|
81
|
-
onClear !== void 0 && /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": clearLabel(fact.label), onClick: onClear, className: "cursor-pointer border-0 bg-transparent p-0 text-[var(--fourty-convo-muted)] hover:text-[var(--fourty-convo-ink)]", children: "\xD7" })
|
|
82
|
-
] }),
|
|
83
|
-
/* @__PURE__ */ jsx2(
|
|
84
|
-
motion.span,
|
|
85
|
-
{
|
|
86
|
-
"aria-hidden": true,
|
|
87
|
-
className: "absolute bottom-0 inset-x-0 h-0.5 origin-left rtl:origin-right bg-[var(--fourty-convo-ink)]",
|
|
88
|
-
initial: reduce === true ? false : { scaleX: 0 },
|
|
89
|
-
animate: { scaleX: 1 },
|
|
90
|
-
transition: { duration: 0.5, ease: EASE, delay: 0.15 }
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
function Facts({ facts: facts2, onForget }) {
|
|
98
|
-
const labels = useLabels().conversation;
|
|
99
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
100
|
-
/* @__PURE__ */ jsx2(AnimatePresence, { initial: false, children: facts2.map((f) => /* @__PURE__ */ jsx2(FactChip, { fact: f, onClear: onForget === void 0 ? void 0 : () => onForget(f) }, f.label.toLowerCase())) }),
|
|
101
|
-
onForget !== void 0 && facts2.length > 1 && /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => facts2.forEach((f) => onForget(f)), className: "cursor-pointer border-0 bg-transparent pb-1.5 text-sm leading-5 text-[var(--fourty-convo-muted)] underline hover:text-[var(--fourty-convo-ink)]", children: labels.clearFacts })
|
|
102
|
-
] });
|
|
64
|
+
|
|
65
|
+
// src/conversation/steady-line.ts
|
|
66
|
+
import * as React2 from "react";
|
|
67
|
+
var MIN_HOLD_MS = 1400;
|
|
68
|
+
function lineChange(shown, next, generic, shownForMs) {
|
|
69
|
+
if (next === shown) return "ignore";
|
|
70
|
+
if (next === generic) return "ignore";
|
|
71
|
+
if (shown === generic) return "replace";
|
|
72
|
+
if (next.startsWith(shown)) return "extend";
|
|
73
|
+
return shownForMs >= MIN_HOLD_MS ? "replace" : "hold";
|
|
103
74
|
}
|
|
104
|
-
function
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
className: `grid ${facts2.length > 0 ? "grid-cols-[auto_minmax(0,1fr)_auto]" : "grid-cols-[minmax(0,1fr)_auto]"} items-center gap-6 py-2`,
|
|
116
|
-
children: [
|
|
117
|
-
facts2.length > 0 && /* @__PURE__ */ jsx2(Facts, { facts: facts2 }),
|
|
118
|
-
/* @__PURE__ */ jsx2("span", { className: "relative min-w-0 text-2xl font-bold leading-7 text-[var(--fourty-convo-ink)]", "aria-live": "polite", children: /* @__PURE__ */ jsx2(AnimatePresence, { mode: "popLayout", initial: false, children: /* @__PURE__ */ jsxs(
|
|
119
|
-
motion.span,
|
|
120
|
-
{
|
|
121
|
-
className: "line-clamp-2 block",
|
|
122
|
-
initial: { opacity: 0, y: 6 },
|
|
123
|
-
animate: { opacity: 1, y: 0 },
|
|
124
|
-
exit: { opacity: 0, y: -6 },
|
|
125
|
-
transition: { duration: 0.35, ease: EASE },
|
|
126
|
-
children: [
|
|
127
|
-
status,
|
|
128
|
-
/* @__PURE__ */ jsx2("span", { "aria-hidden": true, className: "ms-2 inline-block h-3 w-3 animate-pulse bg-[var(--fourty-convo-accent)]" })
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
|
-
status
|
|
132
|
-
) }) }),
|
|
133
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2.5", children: [
|
|
134
|
-
/* @__PURE__ */ jsx2("span", { className: "flex", children: /* @__PURE__ */ jsx2(AnimatePresence, { initial: false, children: thumbs.map((t, i) => /* @__PURE__ */ jsx2(
|
|
135
|
-
motion.img,
|
|
136
|
-
{
|
|
137
|
-
src: t.url,
|
|
138
|
-
alt: "",
|
|
139
|
-
initial: { opacity: 0, scale: 0.6 },
|
|
140
|
-
animate: { opacity: 1, scale: 1 },
|
|
141
|
-
transition: { duration: 0.3, ease: EASE, delay: 0.05 * i },
|
|
142
|
-
className: `h-9 w-9 border-2 border-[var(--fourty-convo-sheet)] bg-[var(--fourty-convo-surface)] object-contain ${i > 0 ? "-ms-3" : ""}`
|
|
143
|
-
},
|
|
144
|
-
t.id
|
|
145
|
-
)) }) }),
|
|
146
|
-
scanning !== null && scanning.count > 0 && /* @__PURE__ */ jsx2("span", { className: "whitespace-nowrap text-[12px] text-[var(--fourty-convo-muted)]", children: labels.lookedAt(scanning.count) })
|
|
147
|
-
] })
|
|
148
|
-
]
|
|
75
|
+
function useSteadyLine(line, generic) {
|
|
76
|
+
const [shown, setShown] = React2.useState({ text: line, key: 0 });
|
|
77
|
+
const shownAt = React2.useRef(Date.now());
|
|
78
|
+
const latest = React2.useRef(line);
|
|
79
|
+
latest.current = line;
|
|
80
|
+
React2.useEffect(() => {
|
|
81
|
+
const change = lineChange(shown.text, line, generic, Date.now() - shownAt.current);
|
|
82
|
+
if (change === "ignore") return void 0;
|
|
83
|
+
if (change === "extend") {
|
|
84
|
+
setShown((s) => ({ text: line, key: s.key }));
|
|
85
|
+
return void 0;
|
|
149
86
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return /* @__PURE__ */ jsx2(
|
|
155
|
-
motion.div,
|
|
156
|
-
{
|
|
157
|
-
"aria-busy": "true",
|
|
158
|
-
className: "grid grid-cols-12 gap-4",
|
|
159
|
-
initial: { opacity: 0 },
|
|
160
|
-
animate: { opacity: 1 },
|
|
161
|
-
exit: { opacity: 0, transition: { duration: 0.25, ease: EASE } },
|
|
162
|
-
children: cells.map((c, i) => /* @__PURE__ */ jsx2(
|
|
163
|
-
motion.div,
|
|
164
|
-
{
|
|
165
|
-
initial: { opacity: 0, y: 8 },
|
|
166
|
-
animate: { opacity: 1, y: 0 },
|
|
167
|
-
transition: { duration: 0.35, ease: EASE, delay: 0.08 * i },
|
|
168
|
-
className: `${c} animate-pulse rounded-[var(--fourty-convo-card-radius)] bg-[var(--fourty-convo-surface)]`
|
|
169
|
-
},
|
|
170
|
-
c
|
|
171
|
-
))
|
|
87
|
+
if (change === "replace") {
|
|
88
|
+
shownAt.current = Date.now();
|
|
89
|
+
setShown((s) => ({ text: line, key: s.key + 1 }));
|
|
90
|
+
return void 0;
|
|
172
91
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return /* @__PURE__ */ jsxs2("p", { className: "m-0 flex max-w-[880px] items-baseline gap-3 text-2xl font-bold leading-[1.2] text-[var(--fourty-convo-ink)] [text-wrap:balance] max-[768px]:text-xl", children: [
|
|
182
|
-
/* @__PURE__ */ jsx3("span", { children: turnAskSegments(ask).map(
|
|
183
|
-
(segment, i) => segment.kind === "text" || !answerable ? /* @__PURE__ */ jsx3(React2.Fragment, { children: segment.text }, i) : /* @__PURE__ */ jsx3(
|
|
184
|
-
"button",
|
|
185
|
-
{
|
|
186
|
-
type: "button",
|
|
187
|
-
onClick: () => onReply(segment.text),
|
|
188
|
-
className: "cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-inherit underline decoration-[var(--fourty-convo-accent)] decoration-2 underline-offset-[6px] hover:text-[var(--fourty-convo-accent)]",
|
|
189
|
-
children: segment.text
|
|
190
|
-
},
|
|
191
|
-
i
|
|
192
|
-
)
|
|
193
|
-
) }),
|
|
194
|
-
/* @__PURE__ */ jsx3("span", { "aria-hidden": true, className: "flex-none text-[var(--fourty-convo-accent)] rtl:-scale-x-100", children: "\u2192" })
|
|
195
|
-
] });
|
|
92
|
+
const t = setTimeout(() => {
|
|
93
|
+
if (latest.current === generic) return;
|
|
94
|
+
shownAt.current = Date.now();
|
|
95
|
+
setShown((s) => ({ text: latest.current, key: s.key + 1 }));
|
|
96
|
+
}, MIN_HOLD_MS - (Date.now() - shownAt.current));
|
|
97
|
+
return () => clearTimeout(t);
|
|
98
|
+
}, [line, generic, shown.text]);
|
|
99
|
+
return shown;
|
|
196
100
|
}
|
|
197
101
|
|
|
198
102
|
// src/conversation/turn-text.tsx
|
|
199
103
|
import * as React3 from "react";
|
|
200
|
-
import { useProductCard } from "@40rty/ams-sdk";
|
|
201
|
-
import { Fragment as
|
|
104
|
+
import { proseRuns, useProductCard } from "@40rty/ams-sdk";
|
|
105
|
+
import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime";
|
|
202
106
|
var CRUMB_MAX_CHARS = 26;
|
|
203
107
|
function crumbLabel(visitorText) {
|
|
204
108
|
const text = visitorText.trim().replace(/[.?!]+$/, "");
|
|
@@ -216,7 +120,7 @@ function productNamed(name, products) {
|
|
|
216
120
|
}
|
|
217
121
|
function ProductLink({ product, children }) {
|
|
218
122
|
const { onCardClick } = useProductCard(product);
|
|
219
|
-
return /* @__PURE__ */
|
|
123
|
+
return /* @__PURE__ */ jsx2(
|
|
220
124
|
"span",
|
|
221
125
|
{
|
|
222
126
|
role: "link",
|
|
@@ -230,13 +134,20 @@ function ProductLink({ product, children }) {
|
|
|
230
134
|
}
|
|
231
135
|
);
|
|
232
136
|
}
|
|
137
|
+
var LINK_CLASS = "underline underline-offset-4 [color:inherit] hover:text-[var(--fourty-convo-accent)]";
|
|
138
|
+
function ProseLink({ href, children }) {
|
|
139
|
+
return /* @__PURE__ */ jsx2("a", { href, target: "_blank", rel: "noopener noreferrer", className: LINK_CLASS, children });
|
|
140
|
+
}
|
|
233
141
|
function Rich({ text, products }) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
142
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: proseRuns(text).map((run, r) => {
|
|
143
|
+
if (run.href !== void 0 && products !== void 0) return /* @__PURE__ */ jsx2(ProseLink, { href: run.href, children: run.text }, r);
|
|
144
|
+
return run.text.split("**").map((part, i) => {
|
|
145
|
+
const key = `${String(r)}:${String(i)}`;
|
|
146
|
+
if (i % 2 === 0) return /* @__PURE__ */ jsx2(React3.Fragment, { children: part }, key);
|
|
147
|
+
const product = products === void 0 ? void 0 : productNamed(part, products);
|
|
148
|
+
if (product !== void 0) return /* @__PURE__ */ jsx2(ProductLink, { product, children: part }, key);
|
|
149
|
+
return /* @__PURE__ */ jsx2("strong", { className: "text-[var(--fourty-convo-ink)]", children: part }, key);
|
|
150
|
+
});
|
|
240
151
|
}) });
|
|
241
152
|
}
|
|
242
153
|
var WORD_EASE = [0.2, 0.75, 0.2, 1];
|
|
@@ -257,20 +168,26 @@ function planCascade(count) {
|
|
|
257
168
|
function commitCascade(plan, count) {
|
|
258
169
|
cascadeEndS = Math.max(cascadeEndS, plan.atS + plan.offsetS + Math.max(count - 1, 0) * plan.staggerS);
|
|
259
170
|
}
|
|
171
|
+
var WORD_FACE = { fontFamily: "inherit" };
|
|
260
172
|
function RisingWords({ text, products, delayS = 0 }) {
|
|
261
173
|
const shownRef = React3.useRef(/* @__PURE__ */ new Set());
|
|
262
174
|
const reduce = useReducedMotion();
|
|
263
175
|
const words = [];
|
|
264
176
|
let gap = false;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
177
|
+
let bold = false;
|
|
178
|
+
let runs = 0;
|
|
179
|
+
for (const link of proseRuns(text)) {
|
|
180
|
+
link.text.split("**").forEach((part, i) => {
|
|
181
|
+
if (i > 0) bold = !bold;
|
|
182
|
+
runs += 1;
|
|
183
|
+
const product = bold && link.href === void 0 ? productNamed(part, products) : void 0;
|
|
184
|
+
for (const m of part.matchAll(/(\s*)(\S+)/g)) {
|
|
185
|
+
words.push({ w: m[2], bold, spaced: words.length > 0 && (gap || m[1].length > 0), run: runs, product, href: link.href });
|
|
186
|
+
gap = false;
|
|
187
|
+
}
|
|
188
|
+
if (/\s$/.test(part)) gap = true;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
274
191
|
const keyOf = (i) => `${String(i)}:${words[i].w}`;
|
|
275
192
|
const keys = words.map((_, i) => keyOf(i));
|
|
276
193
|
const animated = reduce !== true;
|
|
@@ -285,17 +202,18 @@ function RisingWords({ text, products, delayS = 0 }) {
|
|
|
285
202
|
shownRef.current = new Set(keys);
|
|
286
203
|
});
|
|
287
204
|
const word = (i) => {
|
|
288
|
-
const { w, bold, product } = words[i];
|
|
205
|
+
const { w, bold: bold2, product, href } = words[i];
|
|
289
206
|
const key = keyOf(i);
|
|
290
207
|
const order = rank.get(key);
|
|
291
208
|
const fresh = order !== void 0;
|
|
292
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ jsx2(
|
|
293
210
|
motion.span,
|
|
294
211
|
{
|
|
295
|
-
className: `inline-block ${
|
|
212
|
+
className: `inline-block ${bold2 ? "font-[var(--font-weight-strong,_700)] text-[var(--fourty-convo-ink)]" : ""} ${product !== void 0 || href !== void 0 ? "underline underline-offset-[0.12em] [color:inherit]" : ""}`,
|
|
296
213
|
initial: fresh ? { opacity: 0, y: "0.5em", filter: "blur(8px)" } : false,
|
|
297
214
|
animate: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
298
215
|
transition: { duration: WORD_RISE_S, ease: WORD_EASE, delay: delayS + (order !== void 0 ? plan.offsetS + order * plan.staggerS : 0) },
|
|
216
|
+
style: WORD_FACE,
|
|
299
217
|
children: w
|
|
300
218
|
},
|
|
301
219
|
key
|
|
@@ -303,9 +221,9 @@ function RisingWords({ text, products, delayS = 0 }) {
|
|
|
303
221
|
};
|
|
304
222
|
const out = [];
|
|
305
223
|
for (let i = 0; i < words.length; ) {
|
|
306
|
-
const { product, run, spaced } = words[i];
|
|
224
|
+
const { product, href, run, spaced } = words[i];
|
|
307
225
|
if (spaced) out.push(" ");
|
|
308
|
-
if (product === void 0) {
|
|
226
|
+
if (product === void 0 && href === void 0) {
|
|
309
227
|
out.push(word(i));
|
|
310
228
|
i += 1;
|
|
311
229
|
continue;
|
|
@@ -316,9 +234,127 @@ function RisingWords({ text, products, delayS = 0 }) {
|
|
|
316
234
|
if (i > start && words[i].spaced) name.push(" ");
|
|
317
235
|
name.push(word(i));
|
|
318
236
|
}
|
|
319
|
-
out.push(/* @__PURE__ */
|
|
237
|
+
if (product !== void 0) out.push(/* @__PURE__ */ jsx2(ProductLink, { product, children: name }, `link-${String(start)}`));
|
|
238
|
+
else if (href !== void 0) out.push(/* @__PURE__ */ jsx2(ProseLink, { href, children: name }, `link-${String(start)}`));
|
|
320
239
|
}
|
|
321
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: out });
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// src/conversation/presence-parts.tsx
|
|
244
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
245
|
+
var MAX_THUMBS = 5;
|
|
246
|
+
var EASE = [0.22, 1, 0.36, 1];
|
|
247
|
+
function FactChip({ fact, onClear }) {
|
|
248
|
+
const reduce = useReducedMotion();
|
|
249
|
+
const clearLabel = useLabels().conversation.clearFact;
|
|
250
|
+
return /* @__PURE__ */ jsxs(
|
|
251
|
+
motion.span,
|
|
252
|
+
{
|
|
253
|
+
layout: true,
|
|
254
|
+
className: "relative flex flex-col gap-1 pb-1.5",
|
|
255
|
+
initial: reduce === true ? false : { opacity: 0, y: 4 },
|
|
256
|
+
animate: { opacity: 1, y: 0 },
|
|
257
|
+
transition: { duration: 0.3, ease: EASE },
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ jsx3("span", { className: "text-xs leading-[1.125rem] text-[var(--fourty-convo-muted)]", children: fact.label }),
|
|
260
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-medium leading-5", children: [
|
|
261
|
+
fact.value,
|
|
262
|
+
onClear !== void 0 && /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": clearLabel(fact.label), onClick: onClear, className: "cursor-pointer border-0 bg-transparent p-0 text-[var(--fourty-convo-muted)] hover:text-[var(--fourty-convo-ink)]", children: "\xD7" })
|
|
263
|
+
] }),
|
|
264
|
+
/* @__PURE__ */ jsx3(
|
|
265
|
+
motion.span,
|
|
266
|
+
{
|
|
267
|
+
"aria-hidden": true,
|
|
268
|
+
className: "absolute bottom-0 inset-x-0 h-0.5 origin-left rtl:origin-right bg-[var(--fourty-convo-ink)]",
|
|
269
|
+
initial: reduce === true ? false : { scaleX: 0 },
|
|
270
|
+
animate: { scaleX: 1 },
|
|
271
|
+
transition: { duration: 0.5, ease: EASE, delay: 0.15 }
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
function Facts({ facts: facts2, onForget }) {
|
|
279
|
+
const labels = useLabels().conversation;
|
|
280
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
281
|
+
/* @__PURE__ */ jsx3(AnimatePresence, { initial: false, children: facts2.map((f) => /* @__PURE__ */ jsx3(FactChip, { fact: f, onClear: onForget === void 0 ? void 0 : () => onForget(f) }, f.label.toLowerCase())) }),
|
|
282
|
+
onForget !== void 0 && facts2.length > 1 && /* @__PURE__ */ jsx3("button", { type: "button", onClick: () => facts2.forEach((f) => onForget(f)), className: "cursor-pointer border-0 bg-transparent pb-1.5 text-sm leading-5 text-[var(--fourty-convo-muted)] underline hover:text-[var(--fourty-convo-ink)]", children: labels.clearFacts })
|
|
283
|
+
] });
|
|
284
|
+
}
|
|
285
|
+
var NO_PRODUCTS = [];
|
|
286
|
+
function ReadingRow({ scan }) {
|
|
287
|
+
const labels = useLabels().conversation;
|
|
288
|
+
const thumbs = scan === null ? [] : scan.thumbnails.slice(0, MAX_THUMBS);
|
|
289
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex h-7 items-center gap-2.5", children: [
|
|
290
|
+
/* @__PURE__ */ jsx3("span", { className: "flex", children: /* @__PURE__ */ jsx3(AnimatePresence, { initial: false, children: thumbs.map((t, i) => /* @__PURE__ */ jsx3(
|
|
291
|
+
motion.img,
|
|
292
|
+
{
|
|
293
|
+
src: t.url,
|
|
294
|
+
alt: "",
|
|
295
|
+
initial: { opacity: 0 },
|
|
296
|
+
animate: { opacity: 1 },
|
|
297
|
+
transition: { duration: 0.6, ease: EASE, delay: 0.08 * i },
|
|
298
|
+
className: `h-7 w-7 border-2 border-[var(--fourty-convo-sheet)] bg-[var(--fourty-convo-surface)] object-contain ${i > 0 ? "-ms-2.5" : ""}`
|
|
299
|
+
},
|
|
300
|
+
t.id
|
|
301
|
+
)) }) }),
|
|
302
|
+
scan !== null && scan.count > 0 && /* @__PURE__ */ jsx3("span", { className: "whitespace-nowrap text-[12px] text-[var(--fourty-convo-muted)]", children: labels.lookedAt(scan.count) })
|
|
303
|
+
] });
|
|
304
|
+
}
|
|
305
|
+
function useTurnScan(turnKey) {
|
|
306
|
+
const live = useScanning();
|
|
307
|
+
const held = React4.useRef({ turnKey, scan: null });
|
|
308
|
+
if (held.current.turnKey !== turnKey) held.current = { turnKey, scan: null };
|
|
309
|
+
if (live !== null && live.count > 0) held.current.scan = live;
|
|
310
|
+
return held.current.scan;
|
|
311
|
+
}
|
|
312
|
+
function ThinkingLine({ status }) {
|
|
313
|
+
const labels = useLabels().conversation;
|
|
314
|
+
const line = useSteadyLine(status, labels.working);
|
|
315
|
+
return /* @__PURE__ */ jsx3(
|
|
316
|
+
motion.div,
|
|
317
|
+
{
|
|
318
|
+
"aria-live": "polite",
|
|
319
|
+
className: "min-w-0 text-xl font-medium leading-[1.4] text-[var(--fourty-convo-ink)]",
|
|
320
|
+
initial: { opacity: 0 },
|
|
321
|
+
animate: { opacity: 1 },
|
|
322
|
+
exit: { opacity: 0, transition: { duration: 0.2, ease: EASE } },
|
|
323
|
+
transition: { duration: 0.4, ease: EASE },
|
|
324
|
+
children: /* @__PURE__ */ jsx3(AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ jsx3(motion.p, { className: "m-0 min-h-[1.4em]", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3, ease: EASE }, children: line.text !== labels.working && /* @__PURE__ */ jsx3(RisingWords, { text: line.text, products: NO_PRODUCTS }) }, line.key) })
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
function ThinkingBand({ facts: facts2, status }) {
|
|
329
|
+
const scan = useScanning();
|
|
330
|
+
return /* @__PURE__ */ jsxs(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.4, ease: EASE }, className: "flex min-w-0 flex-col gap-4 py-1", children: [
|
|
331
|
+
facts2.length > 0 && /* @__PURE__ */ jsx3(Facts, { facts: facts2 }),
|
|
332
|
+
/* @__PURE__ */ jsx3(ReadingRow, { scan }),
|
|
333
|
+
/* @__PURE__ */ jsx3(ThinkingLine, { status })
|
|
334
|
+
] });
|
|
335
|
+
}
|
|
336
|
+
function BentoSkeleton() {
|
|
337
|
+
const cells = ["col-span-8 h-[320px]", "col-span-4 h-[320px]", "col-span-12 h-[200px]"];
|
|
338
|
+
return /* @__PURE__ */ jsx3(
|
|
339
|
+
motion.div,
|
|
340
|
+
{
|
|
341
|
+
"aria-busy": "true",
|
|
342
|
+
className: "grid grid-cols-12 gap-4",
|
|
343
|
+
initial: { opacity: 0 },
|
|
344
|
+
animate: { opacity: 1 },
|
|
345
|
+
exit: { opacity: 0, transition: { duration: 0.25, ease: EASE } },
|
|
346
|
+
children: cells.map((c, i) => /* @__PURE__ */ jsx3(
|
|
347
|
+
motion.div,
|
|
348
|
+
{
|
|
349
|
+
initial: { opacity: 0, y: 8 },
|
|
350
|
+
animate: { opacity: 1, y: 0 },
|
|
351
|
+
transition: { duration: 0.35, ease: EASE, delay: 0.08 * i },
|
|
352
|
+
className: `${c} animate-pulse rounded-[var(--fourty-convo-card-radius)] bg-[var(--fourty-convo-surface)]`
|
|
353
|
+
},
|
|
354
|
+
c
|
|
355
|
+
))
|
|
356
|
+
}
|
|
357
|
+
);
|
|
322
358
|
}
|
|
323
359
|
|
|
324
360
|
// src/conversation/activity-line.ts
|
|
@@ -330,17 +366,19 @@ function useActivityLine(activity) {
|
|
|
330
366
|
}
|
|
331
367
|
|
|
332
368
|
// src/conversation/use-page-products.ts
|
|
333
|
-
import * as
|
|
369
|
+
import * as React5 from "react";
|
|
334
370
|
import { collectLayoutGids, useComponentCatalog, useDisplayedLayout, useProducts } from "@40rty/ams-sdk";
|
|
335
371
|
function usePageProducts() {
|
|
336
372
|
const layout = useDisplayedLayout();
|
|
337
373
|
const catalog = useComponentCatalog();
|
|
338
|
-
const ids =
|
|
374
|
+
const ids = React5.useMemo(() => [...collectLayoutGids(layout, catalog)].filter((id) => id.includes("/Product/")), [layout, catalog]);
|
|
339
375
|
return useProducts(ids).data;
|
|
340
376
|
}
|
|
341
377
|
|
|
342
|
-
// src/conversation/
|
|
343
|
-
import
|
|
378
|
+
// src/conversation/turn-header-parts.tsx
|
|
379
|
+
import * as React6 from "react";
|
|
380
|
+
import { turnAskSegments } from "@40rty/ams-sdk";
|
|
381
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
344
382
|
var MAX_CRUMBS = 5;
|
|
345
383
|
function wordCrumbs(crumbs, home, here) {
|
|
346
384
|
return crumbs.map((c) => ({
|
|
@@ -352,16 +390,16 @@ function wordCrumbs(crumbs, home, here) {
|
|
|
352
390
|
function Breadcrumbs({ crumbs }) {
|
|
353
391
|
const shown = crumbs.length > MAX_CRUMBS ? [crumbs[0], { key: "gap", label: "\u2026", onClick: null }, ...crumbs.slice(crumbs.length - (MAX_CRUMBS - 2))] : crumbs;
|
|
354
392
|
const navLabel = useLabels().nav.conversation;
|
|
355
|
-
return /* @__PURE__ */
|
|
356
|
-
i > 0 && /* @__PURE__ */
|
|
357
|
-
c.onClick === null ? /* @__PURE__ */
|
|
393
|
+
return /* @__PURE__ */ jsx4("nav", { "aria-label": navLabel, className: "flex flex-wrap items-center gap-2 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: shown.map((c, i) => /* @__PURE__ */ jsxs2(React6.Fragment, { children: [
|
|
394
|
+
i > 0 && /* @__PURE__ */ jsx4("span", { "aria-hidden": true, children: "/" }),
|
|
395
|
+
c.onClick === null ? /* @__PURE__ */ jsx4("span", { className: i === shown.length - 1 ? "font-medium text-[var(--fourty-convo-ink)]" : "", children: c.label }) : /* @__PURE__ */ jsx4("button", { type: "button", onClick: c.onClick, className: "cursor-pointer border-0 bg-transparent p-0 text-inherit underline hover:text-[var(--fourty-convo-ink)]", children: c.label })
|
|
358
396
|
] }, c.key)) });
|
|
359
397
|
}
|
|
360
398
|
function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
361
|
-
const [open, setOpen] =
|
|
399
|
+
const [open, setOpen] = React6.useState(false);
|
|
362
400
|
const products = usePageProducts();
|
|
363
401
|
const reduce = useReducedMotion();
|
|
364
|
-
return /* @__PURE__ */
|
|
402
|
+
return /* @__PURE__ */ jsxs2(
|
|
365
403
|
motion.header,
|
|
366
404
|
{
|
|
367
405
|
initial: reduce === true ? false : { opacity: 0, y: -8 },
|
|
@@ -369,14 +407,14 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
369
407
|
transition: { duration: 0.36, ease: EASE },
|
|
370
408
|
className: "mb-2 flex flex-col gap-3 rounded-lg bg-[var(--fourty-convo-sheet)] px-8 py-4 text-[var(--fourty-convo-ink)] max-[1025px]:px-4",
|
|
371
409
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
411
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
|
|
412
|
+
/* @__PURE__ */ jsx4("span", { "aria-hidden": true, className: "h-3 w-3 flex-none bg-[var(--fourty-convo-accent)]" }),
|
|
413
|
+
/* @__PURE__ */ jsx4(Breadcrumbs, { crumbs: trail })
|
|
376
414
|
] }),
|
|
377
415
|
right
|
|
378
416
|
] }),
|
|
379
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ jsxs2(
|
|
380
418
|
"button",
|
|
381
419
|
{
|
|
382
420
|
type: "button",
|
|
@@ -384,17 +422,17 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
384
422
|
onClick: () => setOpen((o) => !o),
|
|
385
423
|
className: "flex w-full cursor-pointer items-baseline gap-4 border-0 bg-transparent p-0 pt-1 text-start text-inherit",
|
|
386
424
|
children: [
|
|
387
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex-none text-base font-medium leading-6 text-[var(--fourty-convo-muted)]", children: [
|
|
388
426
|
"\u201C",
|
|
389
427
|
question,
|
|
390
428
|
"\u201D"
|
|
391
429
|
] }),
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
430
|
+
/* @__PURE__ */ jsx4("span", { className: `min-w-0 flex-1 text-xl font-bold leading-7 ${open ? "" : "truncate"}`, children: /* @__PURE__ */ jsx4(Rich, { text: headline }) }),
|
|
431
|
+
/* @__PURE__ */ jsx4("span", { "aria-hidden": true, className: "flex-none text-xl leading-7", children: open ? "\u2212" : "+" })
|
|
394
432
|
]
|
|
395
433
|
}
|
|
396
434
|
),
|
|
397
|
-
/* @__PURE__ */
|
|
435
|
+
/* @__PURE__ */ jsx4(AnimatePresence, { initial: false, children: open && body.length > 0 && /* @__PURE__ */ jsx4(
|
|
398
436
|
motion.div,
|
|
399
437
|
{
|
|
400
438
|
initial: reduce === true ? false : { height: 0, opacity: 0 },
|
|
@@ -402,7 +440,7 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
402
440
|
exit: { height: 0, opacity: 0 },
|
|
403
441
|
transition: { duration: 0.3, ease: EASE },
|
|
404
442
|
className: "overflow-hidden",
|
|
405
|
-
children: /* @__PURE__ */
|
|
443
|
+
children: /* @__PURE__ */ jsx4("p", { className: "m-0 max-w-[880px] pb-1 text-base leading-[1.375rem] text-[var(--fourty-convo-muted)]", children: /* @__PURE__ */ jsx4(Rich, { text: body, products }) })
|
|
406
444
|
},
|
|
407
445
|
"answer"
|
|
408
446
|
) })
|
|
@@ -410,6 +448,108 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
410
448
|
}
|
|
411
449
|
);
|
|
412
450
|
}
|
|
451
|
+
function LeadReserve() {
|
|
452
|
+
const plate = "rounded bg-[var(--fourty-convo-surface)]";
|
|
453
|
+
return /* @__PURE__ */ jsxs2("div", { "aria-hidden": true, className: "flex min-w-0 animate-pulse flex-col gap-3 motion-reduce:animate-none max-[880px]:hidden", children: [
|
|
454
|
+
/* @__PURE__ */ jsx4("div", { className: `h-7 w-2/5 ${plate}` }),
|
|
455
|
+
/* @__PURE__ */ jsx4("div", { className: `h-4 w-3/5 ${plate}` }),
|
|
456
|
+
/* @__PURE__ */ jsx4("div", { className: "mt-3 grid grid-cols-3 gap-4", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx4("div", { className: `aspect-[4/5] w-full ${plate}` }, i)) })
|
|
457
|
+
] });
|
|
458
|
+
}
|
|
459
|
+
function FollowUps({ actions, onTake }) {
|
|
460
|
+
const reduce = useReducedMotion();
|
|
461
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-2", "data-testid": "turn-follow-ups", children: actions.map((a, i) => /* @__PURE__ */ jsx4(
|
|
462
|
+
motion.button,
|
|
463
|
+
{
|
|
464
|
+
type: "button",
|
|
465
|
+
onClick: () => onTake(a),
|
|
466
|
+
initial: reduce === true ? false : { opacity: 0, y: 6 },
|
|
467
|
+
animate: { opacity: 1, y: 0 },
|
|
468
|
+
transition: { duration: 0.36, ease: EASE, delay: 0.1 + i * 0.08 },
|
|
469
|
+
className: "h-[34px] cursor-pointer rounded-full border border-solid border-[var(--fourty-convo-rule)] bg-[var(--fourty-convo-sheet)] px-3.5 text-[13.5px] leading-none text-[var(--fourty-convo-ink)] transition-colors hover:border-[var(--fourty-convo-ink)]",
|
|
470
|
+
children: a.label
|
|
471
|
+
},
|
|
472
|
+
a.id
|
|
473
|
+
)) });
|
|
474
|
+
}
|
|
475
|
+
function FactPills({ facts: facts2, onForget }) {
|
|
476
|
+
const labels = useLabels();
|
|
477
|
+
const reduce = useReducedMotion();
|
|
478
|
+
return /* @__PURE__ */ jsxs2("ul", { className: "m-0 flex min-w-0 list-none flex-wrap items-center gap-1.5 p-0", "data-testid": "turn-facts", children: [
|
|
479
|
+
/* @__PURE__ */ jsx4(AnimatePresence, { initial: false, children: facts2.map((f) => /* @__PURE__ */ jsxs2(
|
|
480
|
+
motion.li,
|
|
481
|
+
{
|
|
482
|
+
layout: reduce !== true,
|
|
483
|
+
initial: reduce === true ? false : { opacity: 0, scale: 0.85 },
|
|
484
|
+
animate: { opacity: 1, scale: 1 },
|
|
485
|
+
exit: reduce === true ? void 0 : { opacity: 0, scale: 0.85 },
|
|
486
|
+
transition: { duration: 0.24, ease: EASE },
|
|
487
|
+
title: f.label,
|
|
488
|
+
className: "flex h-7 items-center gap-1 rounded-full border border-solid border-[var(--fourty-convo-rule)] bg-[var(--fourty-convo-sheet)] ps-3 pe-1 text-[13px] font-medium text-[var(--fourty-convo-ink)]",
|
|
489
|
+
children: [
|
|
490
|
+
f.value,
|
|
491
|
+
/* @__PURE__ */ jsx4(
|
|
492
|
+
"button",
|
|
493
|
+
{
|
|
494
|
+
type: "button",
|
|
495
|
+
onClick: () => onForget(f),
|
|
496
|
+
"aria-label": labels.live.forgetFact(f.label, f.value),
|
|
497
|
+
className: "flex h-[18px] w-[18px] cursor-pointer items-center justify-center rounded-full border-0 bg-transparent p-0 text-[13px] leading-none text-[var(--fourty-convo-muted)] hover:bg-[var(--fourty-convo-rule)] hover:text-[var(--fourty-convo-ink)]",
|
|
498
|
+
children: "\xD7"
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
]
|
|
502
|
+
},
|
|
503
|
+
f.label.toLowerCase()
|
|
504
|
+
)) }),
|
|
505
|
+
facts2.length > 1 && /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsx4("button", { type: "button", onClick: () => facts2.forEach((f) => onForget(f)), className: "cursor-pointer border-0 bg-transparent px-1.5 text-[13px] text-[var(--fourty-convo-muted)] hover:text-[var(--fourty-convo-ink)] hover:underline", children: labels.conversation.clearFacts }) })
|
|
506
|
+
] });
|
|
507
|
+
}
|
|
508
|
+
function StartOverButton({ label, onClick }) {
|
|
509
|
+
return /* @__PURE__ */ jsx4("button", { type: "button", onClick, "aria-label": label, title: label, className: "flex h-8 w-8 flex-none cursor-pointer items-center justify-center rounded-full border border-solid border-[var(--fourty-convo-rule)] bg-transparent p-0 text-[var(--fourty-convo-ink)] transition-colors hover:bg-[var(--fourty-convo-sheet)]", children: /* @__PURE__ */ jsxs2("svg", { width: 15, height: 15, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
510
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 12a9 9 0 1 0 3-6.7" }),
|
|
511
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 4v5h5" })
|
|
512
|
+
] }) });
|
|
513
|
+
}
|
|
514
|
+
function AskLine({ ask, answerable, onReply }) {
|
|
515
|
+
return /* @__PURE__ */ jsx4("p", { className: "m-0 text-base font-semibold leading-normal text-[var(--fourty-convo-ink)] [text-wrap:pretty]", children: turnAskSegments(ask).map(
|
|
516
|
+
(segment, i) => segment.kind === "text" || !answerable ? /* @__PURE__ */ jsx4(React6.Fragment, { children: segment.text }, i) : /* @__PURE__ */ jsx4(
|
|
517
|
+
"button",
|
|
518
|
+
{
|
|
519
|
+
type: "button",
|
|
520
|
+
onClick: () => onReply(segment.text),
|
|
521
|
+
className: "cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-inherit underline decoration-[var(--fourty-convo-highlight)] decoration-[3px] underline-offset-4 transition-colors hover:bg-[var(--fourty-convo-highlight)] hover:text-[var(--fourty-convo-on-highlight)]",
|
|
522
|
+
children: segment.text
|
|
523
|
+
},
|
|
524
|
+
i
|
|
525
|
+
)
|
|
526
|
+
) });
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// src/conversation/follow-ups-place.ts
|
|
530
|
+
import * as React7 from "react";
|
|
531
|
+
var drawnInPage = 0;
|
|
532
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
533
|
+
function set(next) {
|
|
534
|
+
drawnInPage = next;
|
|
535
|
+
listeners.forEach((listener) => listener());
|
|
536
|
+
}
|
|
537
|
+
function subscribe(listener) {
|
|
538
|
+
listeners.add(listener);
|
|
539
|
+
return () => listeners.delete(listener);
|
|
540
|
+
}
|
|
541
|
+
function useDrawFollowUpsInPage() {
|
|
542
|
+
React7.useEffect(() => {
|
|
543
|
+
set(drawnInPage + 1);
|
|
544
|
+
return () => set(drawnInPage - 1);
|
|
545
|
+
}, []);
|
|
546
|
+
}
|
|
547
|
+
function useFollowUpsDrawnInPage() {
|
|
548
|
+
return React7.useSyncExternalStore(subscribe, () => drawnInPage > 0, () => false);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// src/conversation/TurnHeader.tsx
|
|
552
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
413
553
|
function TurnHeader() {
|
|
414
554
|
const page = useConversationPage2();
|
|
415
555
|
const reduce = useReducedMotion();
|
|
@@ -417,6 +557,18 @@ function TurnHeader() {
|
|
|
417
557
|
const labels = useLabels().conversation;
|
|
418
558
|
const { turn, presence } = page;
|
|
419
559
|
const status = useActivityLine(presence.activity);
|
|
560
|
+
const { present: leadPresent } = useCanvasLead();
|
|
561
|
+
useDrawFollowUpsInPage();
|
|
562
|
+
const [leadDue, setLeadDue] = React8.useState(false);
|
|
563
|
+
const turnKey = turn === null ? null : turn.key;
|
|
564
|
+
const scan = useTurnScan(turnKey);
|
|
565
|
+
const leadArrived = leadPresent && page.phase !== "thinking";
|
|
566
|
+
React8.useEffect(() => {
|
|
567
|
+
setLeadDue(false);
|
|
568
|
+
if (!leadArrived) return void 0;
|
|
569
|
+
const t = setTimeout(() => setLeadDue(true), wordsSettleInMs());
|
|
570
|
+
return () => clearTimeout(t);
|
|
571
|
+
}, [leadArrived, turnKey]);
|
|
420
572
|
if (turn === null) return null;
|
|
421
573
|
const facts2 = presence.facts;
|
|
422
574
|
const startOver = /* @__PURE__ */ jsx5("button", { type: "button", onClick: page.startOver, className: "cursor-pointer border-0 bg-transparent p-0 pb-1.5 text-sm font-medium leading-5 text-[var(--fourty-convo-ink)] underline", children: labels.startOver });
|
|
@@ -437,73 +589,64 @@ function TurnHeader() {
|
|
|
437
589
|
);
|
|
438
590
|
}
|
|
439
591
|
const thinking = turn.headline.length === 0 && presence.running;
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
/* @__PURE__ */ jsx5("div", {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
),
|
|
478
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 max-w-[1100px] flex-col gap-4", children: [
|
|
479
|
-
/* @__PURE__ */ jsx5("h1", { className: "m-0 text-5xl font-bold leading-12 max-[1025px]:text-[2rem] max-[1025px]:leading-8", children: /* @__PURE__ */ jsx5(RisingWords, { text: turn.headline, products }) }),
|
|
480
|
-
turn.body.length > 0 && /* @__PURE__ */ jsx5(
|
|
481
|
-
motion.p,
|
|
482
|
-
{
|
|
483
|
-
className: "m-0 max-w-[880px] text-xl leading-[1.625rem] text-[var(--fourty-convo-muted)]",
|
|
484
|
-
initial: reduce === true ? false : { opacity: 0, y: 6 },
|
|
485
|
-
animate: { opacity: 1, y: 0 },
|
|
486
|
-
transition: { duration: 0.46, ease: EASE },
|
|
487
|
-
children: /* @__PURE__ */ jsx5(Rich, { text: turn.body, products })
|
|
488
|
-
}
|
|
489
|
-
),
|
|
490
|
-
turn.ask !== void 0 && /* @__PURE__ */ jsx5(
|
|
491
|
-
motion.div,
|
|
592
|
+
const showLead = leadArrived && leadDue;
|
|
593
|
+
const noLead = page.phase !== "thinking" && !leadPresent && (page.hasPage || page.phase === "idle");
|
|
594
|
+
const leadPending = !showLead && !noLead;
|
|
595
|
+
const askAnswers = turn.ask === void 0 ? [] : turnAskAnswers(turn.ask).map((x) => x.trim().toLowerCase());
|
|
596
|
+
const followUps = page.followUps.filter((a) => !askAnswers.includes(a.label.trim().toLowerCase()));
|
|
597
|
+
const showFollowUps = followUps.length > 0;
|
|
598
|
+
const rise = { initial: reduce === true ? false : { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.46, ease: EASE } };
|
|
599
|
+
const answerRest = /* @__PURE__ */ jsxs3("section", { className: "flex min-w-0 flex-col max-[880px]:order-3", children: [
|
|
600
|
+
turn.body.length > 0 && /* @__PURE__ */ jsx5(motion.p, { className: "m-0 max-w-[40ch] text-base leading-[1.65] text-[var(--fourty-convo-muted)]", ...rise, children: /* @__PURE__ */ jsx5(RisingWords, { text: turn.body, products }) }),
|
|
601
|
+
(turn.ask !== void 0 || showFollowUps) && /* @__PURE__ */ jsxs3(motion.div, { className: "mt-7 flex flex-col gap-3.5 border-0 border-t border-solid border-[var(--fourty-convo-rule)] pt-6", ...rise, children: [
|
|
602
|
+
turn.ask !== void 0 && /* @__PURE__ */ jsx5(AskLine, { ask: turn.ask, answerable: turn.answerable, onReply: page.reply }),
|
|
603
|
+
showFollowUps && /* @__PURE__ */ jsx5(FollowUps, { actions: followUps, onTake: page.followUp })
|
|
604
|
+
] })
|
|
605
|
+
] });
|
|
606
|
+
return /* @__PURE__ */ jsxs3(
|
|
607
|
+
motion.header,
|
|
608
|
+
{
|
|
609
|
+
initial: reduce === true ? false : { opacity: 0, y: -14 },
|
|
610
|
+
animate: { opacity: 1, y: 0 },
|
|
611
|
+
transition: { duration: 0.46, ease: EASE },
|
|
612
|
+
className: "relative mx-auto flex w-full max-w-[1440px] flex-col gap-8 box-border px-8 pb-12 pt-2 max-[1025px]:px-4 max-[768px]:gap-5",
|
|
613
|
+
children: [
|
|
614
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-h-8 flex-wrap items-center gap-x-5 gap-y-2", children: [
|
|
615
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-none text-[13px]", children: /* @__PURE__ */ jsx5(Breadcrumbs, { crumbs: wordCrumbs(page.crumbs, labels.home, labels.thisPage) }) }),
|
|
616
|
+
/* @__PURE__ */ jsx5("div", { className: "min-w-0 flex-1", children: facts2.length > 0 && /* @__PURE__ */ jsx5(FactPills, { facts: facts2, onForget: presence.forgetFact }) }),
|
|
617
|
+
/* @__PURE__ */ jsx5(StartOverButton, { label: labels.startOver, onClick: page.startOver })
|
|
618
|
+
] }),
|
|
619
|
+
/* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-[minmax(0,400px)_minmax(0,1fr)] items-start gap-x-16 gap-y-3 max-[1200px]:grid-cols-[minmax(0,340px)_minmax(0,1fr)] max-[1200px]:gap-x-10 max-[880px]:flex max-[880px]:flex-col max-[880px]:items-stretch", children: [
|
|
620
|
+
/* @__PURE__ */ jsxs3("div", { className: `flex min-w-0 flex-col gap-4 self-start max-[880px]:contents ${showLead ? "sticky top-6" : ""}`, children: [
|
|
621
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col max-[880px]:order-1", children: [
|
|
622
|
+
/* @__PURE__ */ jsx5("p", { className: "m-0 mb-3 border-0 border-s-2 border-solid border-[var(--fourty-convo-rule)] ps-3 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: turn.question }),
|
|
623
|
+
/* @__PURE__ */ jsx5("div", { className: "mb-3", children: /* @__PURE__ */ jsx5(ReadingRow, { scan }) }),
|
|
624
|
+
/* @__PURE__ */ jsx5(AnimatePresence, { mode: "wait", initial: false, children: thinking ? /* @__PURE__ */ jsx5(ThinkingLine, { status }, "thinking") : (
|
|
625
|
+
// The page's one loud line, in the brand's heading face (its own `h1`
|
|
626
|
+
// rule), every word at one weight and in that face (`RisingWords`).
|
|
627
|
+
/* @__PURE__ */ jsx5(
|
|
628
|
+
motion.h1,
|
|
492
629
|
{
|
|
493
|
-
initial:
|
|
494
|
-
animate: { opacity: 1
|
|
495
|
-
transition: { duration: 0.
|
|
496
|
-
|
|
497
|
-
|
|
630
|
+
initial: { opacity: 0 },
|
|
631
|
+
animate: { opacity: 1 },
|
|
632
|
+
transition: { duration: 0.2 },
|
|
633
|
+
className: "m-0 min-w-0 text-[31px] font-medium leading-[1.18] tracking-[-0.015em] text-[var(--fourty-convo-ink)] [text-wrap:balance] [--font-weight-strong:500] max-[640px]:text-[26px]",
|
|
634
|
+
children: /* @__PURE__ */ jsx5(RisingWords, { text: turn.headline, products })
|
|
635
|
+
},
|
|
636
|
+
"answer"
|
|
498
637
|
)
|
|
499
|
-
|
|
500
|
-
] },
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
638
|
+
) })
|
|
639
|
+
] }),
|
|
640
|
+
!thinking && !noLead && answerRest
|
|
641
|
+
] }),
|
|
642
|
+
/* @__PURE__ */ jsx5(CanvasLeadSlot, { className: showLead ? "min-w-0 @container max-[880px]:order-2" : "hidden" }),
|
|
643
|
+
leadPending && /* @__PURE__ */ jsx5(LeadReserve, {}),
|
|
644
|
+
!thinking && noLead && /* @__PURE__ */ jsx5("div", { className: "min-w-0 pt-12 max-[880px]:contents", children: answerRest })
|
|
645
|
+
] }),
|
|
646
|
+
/* @__PURE__ */ jsx5("div", { className: "absolute inset-x-0 top-full px-8 pt-8 max-[1025px]:px-4", children: /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(AnimatePresence, { initial: false, children: page.phase === "thinking" && !page.hasPage && /* @__PURE__ */ jsx5(BentoSkeleton, {}, "skeleton") }) }) })
|
|
647
|
+
]
|
|
648
|
+
},
|
|
649
|
+
turn.key
|
|
507
650
|
);
|
|
508
651
|
}
|
|
509
652
|
|
|
@@ -528,16 +671,17 @@ function TurnCanvas({ children }) {
|
|
|
528
671
|
// src/conversation/ConversationCanvas.tsx
|
|
529
672
|
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
530
673
|
var CONVERSATION_MOTION = { entrance: "rise", timings: { entranceDurationS: 0.78, rowStaggerS: 0.12 } };
|
|
531
|
-
|
|
532
|
-
|
|
674
|
+
var DEFAULT_LEAD = { except: ["productDetail"] };
|
|
675
|
+
function ConversationCanvas({ motion: motion2 = CONVERSATION_MOTION, lead = DEFAULT_LEAD }) {
|
|
676
|
+
return /* @__PURE__ */ jsx7(CanvasLeadProvider, { ...lead, children: /* @__PURE__ */ jsxs4(ResultSheet, { children: [
|
|
533
677
|
/* @__PURE__ */ jsx7(TurnHeader, {}),
|
|
534
678
|
/* @__PURE__ */ jsx7(TurnCanvas, { children: /* @__PURE__ */ jsx7(CanvasArrangementProvider, { arrangement: "bento", turnPages: true, children: /* @__PURE__ */ jsx7(CanvasMotionStyleProvider, { style: motion2, children: /* @__PURE__ */ jsx7(SpacefrontCanvas, {}) }) }) })
|
|
535
|
-
] });
|
|
679
|
+
] }) });
|
|
536
680
|
}
|
|
537
681
|
|
|
538
682
|
// src/conversation/PageComposer.tsx
|
|
539
|
-
import * as
|
|
540
|
-
import { turnAskAnswers, useComposerChipSelect, useConversationPage as useConversationPage4 } from "@40rty/ams-sdk";
|
|
683
|
+
import * as React9 from "react";
|
|
684
|
+
import { turnAskAnswers as turnAskAnswers2, useComposerChipSelect, useConversationPage as useConversationPage4 } from "@40rty/ams-sdk";
|
|
541
685
|
|
|
542
686
|
// src/conversation/sent-words.tsx
|
|
543
687
|
import { createPortal } from "react-dom";
|
|
@@ -569,16 +713,17 @@ function SentWords() {
|
|
|
569
713
|
}
|
|
570
714
|
|
|
571
715
|
// src/conversation/PageComposer.tsx
|
|
572
|
-
import { Fragment as
|
|
716
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
573
717
|
var PAGE_COMPOSER_INPUT_ID = "fourty-page-composer";
|
|
574
718
|
function PageComposer({ placeholder, starters, followUpsInPage = false }) {
|
|
575
|
-
const originRef =
|
|
719
|
+
const originRef = React9.useRef(null);
|
|
576
720
|
const { value, setValue, attachments, dictation, onPaste, canSend, submit } = usePromptComposer({ origin: originRef });
|
|
577
721
|
const onChipSelect = useComposerChipSelect();
|
|
578
722
|
const { presence, turn, place } = useConversationPage4();
|
|
579
723
|
const isRunning = presence.running;
|
|
580
|
-
const pageAsksForReply = turn !== null && turn.ask !== void 0 &&
|
|
581
|
-
const
|
|
724
|
+
const pageAsksForReply = turn !== null && turn.ask !== void 0 && turnAskAnswers2(turn.ask).length > 0;
|
|
725
|
+
const inPage = useFollowUpsDrawnInPage() || followUpsInPage;
|
|
726
|
+
const showFollowUps = inPage ? place === "welcome" : !isRunning && !pageAsksForReply;
|
|
582
727
|
const status = useActivityLine(presence.activity);
|
|
583
728
|
const labels = useLabels().conversation;
|
|
584
729
|
const onKeyDown = (e) => {
|
|
@@ -589,20 +734,20 @@ function PageComposer({ placeholder, starters, followUpsInPage = false }) {
|
|
|
589
734
|
};
|
|
590
735
|
return (
|
|
591
736
|
// It floats over the page: no band, wash or blur behind it — the page stays
|
|
592
|
-
// sharp under it, and only the chips and the
|
|
737
|
+
// sharp under it, and only the chips and the near-opaque bar sit on top.
|
|
593
738
|
/* @__PURE__ */ jsxs5("div", { className: "relative px-[var(--fourty-canvas-gutter)] pb-5 pt-3", children: [
|
|
594
739
|
/* @__PURE__ */ jsx9(SentWords, {}),
|
|
595
740
|
/* @__PURE__ */ jsxs5("div", { className: "fourty-convo-composer relative mx-auto flex max-w-[920px] flex-col gap-2.5", children: [
|
|
596
741
|
showFollowUps && /* @__PURE__ */ jsx9(ComposerChipStrip, { value, starterSuggestions: starters, onStarterClick: setValue, onChipSelect, orientation: "row" }),
|
|
597
742
|
attachments.attachments.length > 0 && /* @__PURE__ */ jsx9(AttachmentStrip, { attachments: attachments.attachments, onRemove: attachments.remove }),
|
|
598
|
-
/* @__PURE__ */ jsx9("div", { className: "flex items-center gap-3 rounded-[var(--fourty-convo-composer-radius)] border border-[
|
|
743
|
+
/* @__PURE__ */ jsx9("div", { className: "flex items-center gap-3 rounded-[var(--fourty-convo-composer-radius)] border border-[var(--fourty-convo-rule)] bg-[rgb(255_255_255/0.97)] py-2 ps-3.5 pe-2 shadow-[0_12px_32px_rgb(0_0_0/0.10),0_2px_6px_rgb(0_0_0/0.06)] backdrop-blur-xl backdrop-saturate-150", children: isRunning ? /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
599
744
|
/* @__PURE__ */ jsxs5("span", { "aria-hidden": true, className: "flex flex-none gap-1", children: [
|
|
600
745
|
/* @__PURE__ */ jsx9("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)]" }),
|
|
601
746
|
/* @__PURE__ */ jsx9("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)] [animation-delay:200ms]" }),
|
|
602
747
|
/* @__PURE__ */ jsx9("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)] [animation-delay:400ms]" })
|
|
603
748
|
] }),
|
|
604
749
|
/* @__PURE__ */ jsx9("span", { className: "relative min-w-0 flex-1 py-2 text-[14.5px] text-[var(--color-text-muted)]", children: /* @__PURE__ */ jsx9(AnimatePresence, { mode: "popLayout", initial: false, children: /* @__PURE__ */ jsx9(motion.span, { className: "block truncate", initial: { opacity: 0, y: 4 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -4 }, transition: { duration: 0.3 }, children: status }, status) }) })
|
|
605
|
-
] }) : /* @__PURE__ */ jsxs5(
|
|
750
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
606
751
|
/* @__PURE__ */ jsx9(AttachButton, { onFiles: attachments.addFiles }),
|
|
607
752
|
/* @__PURE__ */ jsx9(
|
|
608
753
|
"textarea",
|
|
@@ -637,8 +782,30 @@ function PageComposer({ placeholder, starters, followUpsInPage = false }) {
|
|
|
637
782
|
);
|
|
638
783
|
}
|
|
639
784
|
|
|
785
|
+
// src/conversation/ClosingQuestion.tsx
|
|
786
|
+
import * as React10 from "react";
|
|
787
|
+
import { turnAskSegments as turnAskSegments2 } from "@40rty/ams-sdk";
|
|
788
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
789
|
+
function ClosingQuestion({ ask, answerable, onReply }) {
|
|
790
|
+
return /* @__PURE__ */ jsxs6("p", { className: "m-0 flex max-w-[880px] items-baseline gap-3 text-2xl font-bold leading-[1.2] text-[var(--fourty-convo-ink)] [text-wrap:balance] max-[768px]:text-xl", children: [
|
|
791
|
+
/* @__PURE__ */ jsx10("span", { children: turnAskSegments2(ask).map(
|
|
792
|
+
(segment, i) => segment.kind === "text" || !answerable ? /* @__PURE__ */ jsx10(React10.Fragment, { children: segment.text }, i) : /* @__PURE__ */ jsx10(
|
|
793
|
+
"button",
|
|
794
|
+
{
|
|
795
|
+
type: "button",
|
|
796
|
+
onClick: () => onReply(segment.text),
|
|
797
|
+
className: "cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-inherit underline decoration-[var(--fourty-convo-accent)] decoration-2 underline-offset-[6px] hover:text-[var(--fourty-convo-accent)]",
|
|
798
|
+
children: segment.text
|
|
799
|
+
},
|
|
800
|
+
i
|
|
801
|
+
)
|
|
802
|
+
) }),
|
|
803
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": true, className: "flex-none text-[var(--fourty-convo-accent)] rtl:-scale-x-100", children: "\u2192" })
|
|
804
|
+
] });
|
|
805
|
+
}
|
|
806
|
+
|
|
640
807
|
// src/conversation/blocks/blocks.tsx
|
|
641
|
-
import * as
|
|
808
|
+
import * as React12 from "react";
|
|
642
809
|
import { catalogComponent, useAction } from "@40rty/ams-sdk";
|
|
643
810
|
|
|
644
811
|
// src/conversation/blocks/schemas.ts
|
|
@@ -703,23 +870,23 @@ var noteProps = {
|
|
|
703
870
|
};
|
|
704
871
|
|
|
705
872
|
// src/conversation/blocks/ProductTile.tsx
|
|
706
|
-
import * as
|
|
873
|
+
import * as React11 from "react";
|
|
707
874
|
import { useHydrationState, useProductCard as useProductCard2 } from "@40rty/ams-sdk";
|
|
708
|
-
import { jsx as
|
|
709
|
-
var TileContext =
|
|
875
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
876
|
+
var TileContext = React11.createContext(null);
|
|
710
877
|
function ConversationProvider({ tile, children }) {
|
|
711
|
-
return /* @__PURE__ */
|
|
878
|
+
return /* @__PURE__ */ jsx11(TileContext.Provider, { value: tile, children });
|
|
712
879
|
}
|
|
713
880
|
function PlainTile({ product, badge, blurb }) {
|
|
714
881
|
const { primaryImage, priceLabel, onCardClick } = useProductCard2(product);
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
primaryImage !== void 0 && /* @__PURE__ */
|
|
718
|
-
badge !== void 0 && /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ jsxs7("button", { type: "button", onClick: onCardClick, className: "flex h-full w-full cursor-pointer flex-col gap-2 border-0 bg-transparent p-0 text-start text-inherit", children: [
|
|
883
|
+
/* @__PURE__ */ jsxs7("span", { className: "relative block aspect-square bg-[var(--fourty-convo-surface)]", children: [
|
|
884
|
+
primaryImage !== void 0 && /* @__PURE__ */ jsx11("img", { src: primaryImage.url, alt: primaryImage.altText, className: "block h-full w-full object-contain p-4" }),
|
|
885
|
+
badge !== void 0 && /* @__PURE__ */ jsx11("span", { className: "absolute start-3 top-3 bg-[var(--fourty-convo-accent)] px-2 py-1 text-xs font-bold text-[var(--fourty-convo-on-accent)]", children: badge })
|
|
719
886
|
] }),
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
blurb !== void 0 && /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ jsx11("span", { className: "text-base leading-5", children: product.title }),
|
|
888
|
+
blurb !== void 0 && /* @__PURE__ */ jsx11("span", { className: "text-sm leading-5 text-[var(--fourty-convo-muted)]", children: blurb }),
|
|
889
|
+
/* @__PURE__ */ jsx11("span", { className: "text-base", children: priceLabel })
|
|
723
890
|
] });
|
|
724
891
|
}
|
|
725
892
|
function useReserved(items) {
|
|
@@ -730,26 +897,26 @@ function useReserved(items) {
|
|
|
730
897
|
return out;
|
|
731
898
|
}
|
|
732
899
|
function ProductTile(props) {
|
|
733
|
-
const Tile =
|
|
734
|
-
return /* @__PURE__ */
|
|
900
|
+
const Tile = React11.useContext(TileContext);
|
|
901
|
+
return /* @__PURE__ */ jsx11("div", { className: "@container h-full", children: Tile === null ? /* @__PURE__ */ jsx11(PlainTile, { ...props }) : /* @__PURE__ */ jsx11(Tile, { ...props }) });
|
|
735
902
|
}
|
|
736
903
|
function TileReserve({ blurb }) {
|
|
737
|
-
return /* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
blurb !== void 0 && /* @__PURE__ */
|
|
904
|
+
return /* @__PURE__ */ jsxs7("div", { "aria-hidden": true, className: "flex h-full flex-col gap-2", children: [
|
|
905
|
+
/* @__PURE__ */ jsx11("div", { className: "aspect-square animate-pulse bg-[var(--fourty-convo-surface)]" }),
|
|
906
|
+
/* @__PURE__ */ jsx11("span", { className: "h-5 w-3/4 animate-pulse bg-[var(--fourty-convo-surface)]" }),
|
|
907
|
+
blurb !== void 0 && /* @__PURE__ */ jsx11("p", { className: "m-0 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: blurb })
|
|
741
908
|
] });
|
|
742
909
|
}
|
|
743
910
|
function useLanded(reserved) {
|
|
744
|
-
const [landed, setLanded] =
|
|
745
|
-
|
|
911
|
+
const [landed, setLanded] = React11.useState(false);
|
|
912
|
+
React11.useEffect(() => {
|
|
746
913
|
if (!reserved && !landed) setLanded(true);
|
|
747
914
|
}, [reserved, landed]);
|
|
748
915
|
return landed || !reserved;
|
|
749
916
|
}
|
|
750
917
|
|
|
751
918
|
// src/conversation/blocks/blocks.tsx
|
|
752
|
-
import { jsx as
|
|
919
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
753
920
|
var PILL = "inline-flex h-12 min-h-12 items-center justify-center whitespace-nowrap rounded-[var(--fourty-convo-radius)] [text-transform:var(--fourty-convo-button-transform)] px-5 text-sm font-medium leading-5 cursor-pointer [transition:background-color_0.3s,color_0.3s,border-color_0.3s,opacity_0.3s]";
|
|
754
921
|
var PILL_SOLID = `${PILL} border border-[var(--fourty-convo-ink)] bg-[var(--fourty-convo-ink)] text-[var(--fourty-convo-sheet)] hover:bg-[var(--fourty-convo-sheet)] hover:text-[var(--fourty-convo-ink)] disabled:cursor-default disabled:opacity-40`;
|
|
755
922
|
var PILL_OUTLINE = `${PILL} border border-current bg-transparent text-current hover:border-[var(--fourty-convo-ink)] hover:bg-[var(--fourty-convo-ink)] hover:text-[var(--fourty-convo-sheet)]`;
|
|
@@ -762,47 +929,47 @@ var CARD_SKIN = {
|
|
|
762
929
|
accent: "bg-[var(--fourty-convo-accent)] text-[var(--fourty-convo-on-accent)]"
|
|
763
930
|
};
|
|
764
931
|
function Card({ children, tone = "plain" }) {
|
|
765
|
-
return /* @__PURE__ */
|
|
932
|
+
return /* @__PURE__ */ jsx12("div", { className: `@container box-border flex h-full flex-col gap-4 p-8 max-[1025px]:p-4 ${CARD_SKIN[tone]}`, children });
|
|
766
933
|
}
|
|
767
934
|
function Eyebrow({ children }) {
|
|
768
|
-
return /* @__PURE__ */
|
|
935
|
+
return /* @__PURE__ */ jsx12("p", { className: "m-0 text-sm font-medium leading-5 opacity-60", children });
|
|
769
936
|
}
|
|
770
937
|
function Title({ children }) {
|
|
771
|
-
return /* @__PURE__ */
|
|
938
|
+
return /* @__PURE__ */ jsx12("h3", { className: "m-0 text-2xl font-bold leading-7 @[560px]:text-[2rem] @[560px]:leading-[2.1875rem]", children });
|
|
772
939
|
}
|
|
773
940
|
function AskChip({ label, text }) {
|
|
774
|
-
const action =
|
|
941
|
+
const action = React12.useMemo(() => ({ id: `ask-${label}`, type: "message", payload: { text } }), [label, text]);
|
|
775
942
|
const onClick = useAction(label, action);
|
|
776
|
-
return /* @__PURE__ */
|
|
943
|
+
return /* @__PURE__ */ jsx12("button", { type: "button", onClick: onClick !== null ? onClick : void 0, className: PILL_OUTLINE, children: label });
|
|
777
944
|
}
|
|
778
945
|
var arr = (v) => Array.isArray(v) ? v : [];
|
|
779
946
|
function GuidedPick(p) {
|
|
780
|
-
return /* @__PURE__ */
|
|
781
|
-
p.eyebrow !== void 0 && /* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
948
|
+
p.eyebrow !== void 0 && /* @__PURE__ */ jsx12(Eyebrow, { children: p.eyebrow }),
|
|
949
|
+
/* @__PURE__ */ jsx12(Title, { children: p.question }),
|
|
950
|
+
/* @__PURE__ */ jsx12("div", { className: "flex flex-wrap gap-2", children: arr(p.options).map((o) => /* @__PURE__ */ jsx12(AskChip, { label: o.hint !== void 0 ? `${o.label} \u2014 ${o.hint}` : o.label, text: o.label }, o.label)) })
|
|
784
951
|
] });
|
|
785
952
|
}
|
|
786
953
|
function Paths(p) {
|
|
787
954
|
const labels = useLabels().conversation;
|
|
788
|
-
return /* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
-
/* @__PURE__ */
|
|
955
|
+
return /* @__PURE__ */ jsxs8(Card, { tone: "accent", children: [
|
|
956
|
+
/* @__PURE__ */ jsx12(Title, { children: p.title !== void 0 ? p.title : labels.pathsTitle }),
|
|
957
|
+
/* @__PURE__ */ jsx12("div", { className: "flex flex-wrap gap-2", children: arr(p.paths).map((x) => /* @__PURE__ */ jsx12(AskChip, { label: x.label, text: x.prompt }, x.label)) })
|
|
791
958
|
] });
|
|
792
959
|
}
|
|
793
960
|
function Note(p) {
|
|
794
961
|
const labels = useLabels().conversation;
|
|
795
|
-
return /* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
/* @__PURE__ */
|
|
962
|
+
return /* @__PURE__ */ jsxs8(Card, { tone: "highlight", children: [
|
|
963
|
+
/* @__PURE__ */ jsx12(Eyebrow, { children: p.eyebrow !== void 0 ? p.eyebrow : labels.noteEyebrow }),
|
|
964
|
+
/* @__PURE__ */ jsx12("div", { className: "text-2xl font-bold leading-7 @[560px]:text-[2rem] @[560px]:leading-[2.1875rem]", children: p.text })
|
|
798
965
|
] });
|
|
799
966
|
}
|
|
800
967
|
function Facts2(p) {
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
p.title !== void 0 && /* @__PURE__ */
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
968
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
969
|
+
p.title !== void 0 && /* @__PURE__ */ jsx12(Eyebrow, { children: p.title }),
|
|
970
|
+
/* @__PURE__ */ jsx12("dl", { className: "m-0 grid grid-cols-2 gap-x-4 gap-y-3", children: arr(p.items).map((f) => /* @__PURE__ */ jsxs8("div", { className: "min-w-0", children: [
|
|
971
|
+
/* @__PURE__ */ jsx12("dt", { className: "text-sm leading-5 text-[var(--fourty-convo-muted)]", children: f.label }),
|
|
972
|
+
/* @__PURE__ */ jsx12("dd", { className: "m-0 text-base font-bold leading-6", children: f.value })
|
|
806
973
|
] }, f.label)) })
|
|
807
974
|
] });
|
|
808
975
|
}
|
|
@@ -811,13 +978,13 @@ function Explain(p) {
|
|
|
811
978
|
const products = useReserved(arr(p.products));
|
|
812
979
|
const s = p.scale;
|
|
813
980
|
const pct = s !== void 0 && s.max > s.min ? (s.value - s.min) / (s.max - s.min) * 100 : null;
|
|
814
|
-
return /* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
s !== void 0 && pct !== null && /* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
981
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
982
|
+
/* @__PURE__ */ jsx12(Title, { children: p.term }),
|
|
983
|
+
/* @__PURE__ */ jsx12("div", { className: "text-base leading-[1.375rem] text-[var(--fourty-convo-muted)]", children: p.definition }),
|
|
984
|
+
s !== void 0 && pct !== null && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", children: [
|
|
985
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative h-2 rounded-full bg-[var(--fourty-convo-surface)]", children: [
|
|
986
|
+
/* @__PURE__ */ jsx12("div", { className: "absolute inset-y-0 start-0 rounded-full bg-[var(--fourty-convo-ink)]", style: { width: `${pct}%` } }),
|
|
987
|
+
/* @__PURE__ */ jsx12(
|
|
821
988
|
"div",
|
|
822
989
|
{
|
|
823
990
|
className: "absolute top-1/2 h-5 w-5 -translate-y-1/2 -translate-x-1/2 rtl:translate-x-1/2 rounded-full border-2 border-[var(--fourty-convo-ink)] bg-[var(--fourty-convo-sheet)]",
|
|
@@ -825,16 +992,16 @@ function Explain(p) {
|
|
|
825
992
|
}
|
|
826
993
|
)
|
|
827
994
|
] }),
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
995
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex justify-between text-sm leading-5 text-[var(--fourty-convo-muted)]", children: [
|
|
996
|
+
/* @__PURE__ */ jsx12("span", { children: s.minLabel }),
|
|
997
|
+
/* @__PURE__ */ jsx12("span", { children: s.value }),
|
|
998
|
+
/* @__PURE__ */ jsx12("span", { children: s.maxLabel })
|
|
832
999
|
] })
|
|
833
1000
|
] }),
|
|
834
|
-
p.forYou !== void 0 && /* @__PURE__ */
|
|
835
|
-
products.length > 0 && /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
1001
|
+
p.forYou !== void 0 && /* @__PURE__ */ jsx12("p", { className: "m-0 text-base font-bold leading-6", children: p.forYou }),
|
|
1002
|
+
products.length > 0 && /* @__PURE__ */ jsxs8("div", { className: "mt-2 flex flex-col gap-3 pt-2", children: [
|
|
1003
|
+
/* @__PURE__ */ jsx12(Eyebrow, { children: labels.explainProducts }),
|
|
1004
|
+
/* @__PURE__ */ jsx12("div", { className: "grid grid-cols-3 gap-4", children: products.map((prod, i) => prod === null ? /* @__PURE__ */ jsx12(TileReserve, {}, `reserve-${i}`) : /* @__PURE__ */ jsx12(ProductTile, { product: prod }, prod.id)) })
|
|
838
1005
|
] })
|
|
839
1006
|
] });
|
|
840
1007
|
}
|
|
@@ -893,22 +1060,22 @@ var explain = catalogComponent(
|
|
|
893
1060
|
);
|
|
894
1061
|
|
|
895
1062
|
// src/conversation/blocks/product-blocks.tsx
|
|
896
|
-
import * as
|
|
1063
|
+
import * as React13 from "react";
|
|
897
1064
|
import { ItemTransitionGroup } from "@40rty/ams-sdk";
|
|
898
1065
|
import { catalogComponent as catalogComponent2 } from "@40rty/ams-sdk";
|
|
899
|
-
import { jsx as
|
|
1066
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
900
1067
|
var arr2 = (v) => Array.isArray(v) ? v : [];
|
|
901
1068
|
function Verdict(p) {
|
|
902
1069
|
const labels = useLabels().conversation;
|
|
903
1070
|
const [pick] = useReserved(p.product !== void 0 ? [p.product] : []);
|
|
904
|
-
return /* @__PURE__ */
|
|
905
|
-
/* @__PURE__ */
|
|
906
|
-
/* @__PURE__ */
|
|
907
|
-
pick === void 0 ? /* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
p.caveat !== void 0 && /* @__PURE__ */
|
|
1071
|
+
return /* @__PURE__ */ jsxs9(Card, { children: [
|
|
1072
|
+
/* @__PURE__ */ jsx13(Eyebrow, { children: labels.verdict }),
|
|
1073
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-1 items-start gap-8 @[640px]:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", children: [
|
|
1074
|
+
pick === void 0 ? /* @__PURE__ */ jsx13("div", {}) : pick === null ? /* @__PURE__ */ jsx13(TileReserve, {}) : /* @__PURE__ */ jsx13(ProductTile, { product: pick, badge: labels.ourPick }),
|
|
1075
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-3", children: [
|
|
1076
|
+
/* @__PURE__ */ jsx13(Title, { children: p.headline }),
|
|
1077
|
+
/* @__PURE__ */ jsx13("ul", { className: "m-0 flex list-none flex-col p-0", children: arr2(p.reasons).map((r) => /* @__PURE__ */ jsx13("li", { className: "py-1.5 text-base leading-[1.375rem] first:pt-0", children: r }, r)) }),
|
|
1078
|
+
p.caveat !== void 0 && /* @__PURE__ */ jsx13("p", { className: "m-0 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: labels.tradeoffCaveat(p.caveat) })
|
|
912
1079
|
] })
|
|
913
1080
|
] })
|
|
914
1081
|
] });
|
|
@@ -917,33 +1084,33 @@ function Shortlist(p) {
|
|
|
917
1084
|
const notes = arr2(p.notes);
|
|
918
1085
|
const products = useReserved(arr2(p.products));
|
|
919
1086
|
const landed = useLanded(products.some((x) => x === null));
|
|
920
|
-
return /* @__PURE__ */
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
!landed ? /* @__PURE__ */
|
|
1087
|
+
return /* @__PURE__ */ jsxs9(Card, { children: [
|
|
1088
|
+
/* @__PURE__ */ jsx13(Title, { children: p.title }),
|
|
1089
|
+
!landed ? /* @__PURE__ */ jsx13("div", { className: FEED_GRID, children: products.map((prod, i) => /* @__PURE__ */ jsx13(React13.Fragment, { children: prod === null ? /* @__PURE__ */ jsx13(TileReserve, { blurb: i < notes.length ? notes[i] : void 0 }) : /* @__PURE__ */ jsx13(ProductTile, { product: prod, blurb: i < notes.length ? notes[i] : void 0 }) }, prod === null ? `reserve-${i}` : prod.id)) }) : /* @__PURE__ */ jsx13(ItemTransitionGroup, { className: FEED_GRID, items: arr2(p.products), getId: (prod) => prod.id, children: (prod) => {
|
|
923
1090
|
const i = arr2(p.products).indexOf(prod);
|
|
924
|
-
return /* @__PURE__ */
|
|
1091
|
+
return /* @__PURE__ */ jsx13(ProductTile, { product: prod, blurb: i >= 0 && i < notes.length ? notes[i] : void 0 });
|
|
925
1092
|
} })
|
|
926
1093
|
] });
|
|
927
1094
|
}
|
|
928
1095
|
function SideCol({ side: side2, product }) {
|
|
929
|
-
if (side2 === void 0) return /* @__PURE__ */
|
|
930
|
-
return /* @__PURE__ */
|
|
931
|
-
product === null ? /* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
1096
|
+
if (side2 === void 0) return /* @__PURE__ */ jsx13("div", {});
|
|
1097
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2 min-w-0", children: [
|
|
1098
|
+
product === null ? /* @__PURE__ */ jsx13(TileReserve, {}) : product !== void 0 && /* @__PURE__ */ jsx13(ProductTile, { product }),
|
|
1099
|
+
/* @__PURE__ */ jsx13("p", { className: "m-0 mt-2 text-xl font-bold leading-[1.625rem]", children: side2.label }),
|
|
1100
|
+
/* @__PURE__ */ jsx13("ul", { className: "m-0 flex flex-col gap-1 ps-4 text-base leading-[1.375rem] text-[var(--fourty-convo-muted)]", children: arr2(side2.points).map((pt) => /* @__PURE__ */ jsx13("li", { children: pt }, pt)) })
|
|
934
1101
|
] });
|
|
935
1102
|
}
|
|
936
1103
|
function Tradeoff(p) {
|
|
937
1104
|
const labels = useLabels().conversation;
|
|
938
1105
|
const products = useReserved(arr2(p.products));
|
|
939
|
-
return /* @__PURE__ */
|
|
940
|
-
/* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
1106
|
+
return /* @__PURE__ */ jsxs9(Card, { children: [
|
|
1107
|
+
/* @__PURE__ */ jsx13(Eyebrow, { children: labels.tradeoff }),
|
|
1108
|
+
/* @__PURE__ */ jsx13(Title, { children: p.title }),
|
|
1109
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-2 gap-6", children: [
|
|
1110
|
+
/* @__PURE__ */ jsx13(SideCol, { side: p.left, product: products.length > 0 ? products[0] : void 0 }),
|
|
1111
|
+
/* @__PURE__ */ jsx13(SideCol, { side: p.right, product: products.length > 1 ? products[1] : void 0 })
|
|
945
1112
|
] }),
|
|
946
|
-
p.lean !== void 0 && /* @__PURE__ */
|
|
1113
|
+
p.lean !== void 0 && /* @__PURE__ */ jsx13("p", { className: "m-0 pt-2 text-base font-bold leading-6", children: p.lean })
|
|
947
1114
|
] });
|
|
948
1115
|
}
|
|
949
1116
|
var verdict = catalogComponent2(
|
|
@@ -993,10 +1160,12 @@ export {
|
|
|
993
1160
|
PILL_SOLID,
|
|
994
1161
|
PageComposer,
|
|
995
1162
|
ProductTile,
|
|
1163
|
+
ReadingRow,
|
|
996
1164
|
ResultSheet,
|
|
997
1165
|
Rich,
|
|
998
1166
|
RisingWords,
|
|
999
1167
|
ThinkingBand,
|
|
1168
|
+
ThinkingLine,
|
|
1000
1169
|
TileReserve,
|
|
1001
1170
|
Title,
|
|
1002
1171
|
TurnCanvas,
|
|
@@ -1015,6 +1184,7 @@ export {
|
|
|
1015
1184
|
useLanded,
|
|
1016
1185
|
usePageProducts,
|
|
1017
1186
|
useReserved,
|
|
1187
|
+
useTurnScan,
|
|
1018
1188
|
verdict,
|
|
1019
1189
|
wordsSettleInMs
|
|
1020
1190
|
};
|