@40rty/ams-ui 0.5.13 → 0.5.15
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/{chunk-BILXJCTS.js → chunk-BCQU4UFO.js} +7 -12
- package/dist/conversation.js +478 -321
- package/dist/css/conversation/conversation.css +1 -0
- package/dist/shell.js +1 -1
- 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 +0 -7
- package/package.json +2 -2
package/dist/conversation.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ComposerChipStrip,
|
|
4
4
|
usePromptComposer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BCQU4UFO.js";
|
|
6
6
|
import "./chunk-IFVVYH4T.js";
|
|
7
7
|
import "./chunk-I5QE47QY.js";
|
|
8
8
|
import "./chunk-PYH6XCHQ.js";
|
|
@@ -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
104
|
import { useProductCard } from "@40rty/ams-sdk";
|
|
201
|
-
import { Fragment as
|
|
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",
|
|
@@ -232,11 +136,11 @@ function ProductLink({ product, children }) {
|
|
|
232
136
|
}
|
|
233
137
|
function Rich({ text, products }) {
|
|
234
138
|
const parts = text.split("**");
|
|
235
|
-
return /* @__PURE__ */
|
|
236
|
-
if (i % 2 === 0) return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: parts.map((part, i) => {
|
|
140
|
+
if (i % 2 === 0) return /* @__PURE__ */ jsx2(React3.Fragment, { children: part }, i);
|
|
237
141
|
const product = products === void 0 ? void 0 : productNamed(part, products);
|
|
238
|
-
if (product !== void 0) return /* @__PURE__ */
|
|
239
|
-
return /* @__PURE__ */
|
|
142
|
+
if (product !== void 0) return /* @__PURE__ */ jsx2(ProductLink, { product, children: part }, i);
|
|
143
|
+
return /* @__PURE__ */ jsx2("strong", { className: "text-[var(--fourty-convo-ink)]", children: part }, i);
|
|
240
144
|
}) });
|
|
241
145
|
}
|
|
242
146
|
var WORD_EASE = [0.2, 0.75, 0.2, 1];
|
|
@@ -257,6 +161,7 @@ function planCascade(count) {
|
|
|
257
161
|
function commitCascade(plan, count) {
|
|
258
162
|
cascadeEndS = Math.max(cascadeEndS, plan.atS + plan.offsetS + Math.max(count - 1, 0) * plan.staggerS);
|
|
259
163
|
}
|
|
164
|
+
var WORD_FACE = { fontFamily: "inherit" };
|
|
260
165
|
function RisingWords({ text, products, delayS = 0 }) {
|
|
261
166
|
const shownRef = React3.useRef(/* @__PURE__ */ new Set());
|
|
262
167
|
const reduce = useReducedMotion();
|
|
@@ -289,13 +194,14 @@ function RisingWords({ text, products, delayS = 0 }) {
|
|
|
289
194
|
const key = keyOf(i);
|
|
290
195
|
const order = rank.get(key);
|
|
291
196
|
const fresh = order !== void 0;
|
|
292
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ jsx2(
|
|
293
198
|
motion.span,
|
|
294
199
|
{
|
|
295
200
|
className: `inline-block ${bold ? "font-[var(--font-weight-strong,_700)] text-[var(--fourty-convo-ink)]" : ""} ${product !== void 0 ? "underline underline-offset-[0.12em] [color:inherit]" : ""}`,
|
|
296
201
|
initial: fresh ? { opacity: 0, y: "0.5em", filter: "blur(8px)" } : false,
|
|
297
202
|
animate: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
298
203
|
transition: { duration: WORD_RISE_S, ease: WORD_EASE, delay: delayS + (order !== void 0 ? plan.offsetS + order * plan.staggerS : 0) },
|
|
204
|
+
style: WORD_FACE,
|
|
299
205
|
children: w
|
|
300
206
|
},
|
|
301
207
|
key
|
|
@@ -316,9 +222,126 @@ function RisingWords({ text, products, delayS = 0 }) {
|
|
|
316
222
|
if (i > start && words[i].spaced) name.push(" ");
|
|
317
223
|
name.push(word(i));
|
|
318
224
|
}
|
|
319
|
-
out.push(/* @__PURE__ */
|
|
225
|
+
out.push(/* @__PURE__ */ jsx2(ProductLink, { product, children: name }, `link-${start}`));
|
|
320
226
|
}
|
|
321
|
-
return /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: out });
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/conversation/presence-parts.tsx
|
|
231
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
232
|
+
var MAX_THUMBS = 5;
|
|
233
|
+
var EASE = [0.22, 1, 0.36, 1];
|
|
234
|
+
function FactChip({ fact, onClear }) {
|
|
235
|
+
const reduce = useReducedMotion();
|
|
236
|
+
const clearLabel = useLabels().conversation.clearFact;
|
|
237
|
+
return /* @__PURE__ */ jsxs(
|
|
238
|
+
motion.span,
|
|
239
|
+
{
|
|
240
|
+
layout: true,
|
|
241
|
+
className: "relative flex flex-col gap-1 pb-1.5",
|
|
242
|
+
initial: reduce === true ? false : { opacity: 0, y: 4 },
|
|
243
|
+
animate: { opacity: 1, y: 0 },
|
|
244
|
+
transition: { duration: 0.3, ease: EASE },
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx3("span", { className: "text-xs leading-[1.125rem] text-[var(--fourty-convo-muted)]", children: fact.label }),
|
|
247
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-medium leading-5", children: [
|
|
248
|
+
fact.value,
|
|
249
|
+
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" })
|
|
250
|
+
] }),
|
|
251
|
+
/* @__PURE__ */ jsx3(
|
|
252
|
+
motion.span,
|
|
253
|
+
{
|
|
254
|
+
"aria-hidden": true,
|
|
255
|
+
className: "absolute bottom-0 inset-x-0 h-0.5 origin-left rtl:origin-right bg-[var(--fourty-convo-ink)]",
|
|
256
|
+
initial: reduce === true ? false : { scaleX: 0 },
|
|
257
|
+
animate: { scaleX: 1 },
|
|
258
|
+
transition: { duration: 0.5, ease: EASE, delay: 0.15 }
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
function Facts({ facts: facts2, onForget }) {
|
|
266
|
+
const labels = useLabels().conversation;
|
|
267
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-4", children: [
|
|
268
|
+
/* @__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())) }),
|
|
269
|
+
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 })
|
|
270
|
+
] });
|
|
271
|
+
}
|
|
272
|
+
var NO_PRODUCTS = [];
|
|
273
|
+
function ReadingRow({ scan }) {
|
|
274
|
+
const labels = useLabels().conversation;
|
|
275
|
+
const thumbs = scan === null ? [] : scan.thumbnails.slice(0, MAX_THUMBS);
|
|
276
|
+
return /* @__PURE__ */ jsxs("span", { className: "flex h-7 items-center gap-2.5", children: [
|
|
277
|
+
/* @__PURE__ */ jsx3("span", { className: "flex", children: /* @__PURE__ */ jsx3(AnimatePresence, { initial: false, children: thumbs.map((t, i) => /* @__PURE__ */ jsx3(
|
|
278
|
+
motion.img,
|
|
279
|
+
{
|
|
280
|
+
src: t.url,
|
|
281
|
+
alt: "",
|
|
282
|
+
initial: { opacity: 0 },
|
|
283
|
+
animate: { opacity: 1 },
|
|
284
|
+
transition: { duration: 0.6, ease: EASE, delay: 0.08 * i },
|
|
285
|
+
className: `h-7 w-7 border-2 border-[var(--fourty-convo-sheet)] bg-[var(--fourty-convo-surface)] object-contain ${i > 0 ? "-ms-2.5" : ""}`
|
|
286
|
+
},
|
|
287
|
+
t.id
|
|
288
|
+
)) }) }),
|
|
289
|
+
scan !== null && scan.count > 0 && /* @__PURE__ */ jsx3("span", { className: "whitespace-nowrap text-[12px] text-[var(--fourty-convo-muted)]", children: labels.lookedAt(scan.count) })
|
|
290
|
+
] });
|
|
291
|
+
}
|
|
292
|
+
function useTurnScan(turnKey) {
|
|
293
|
+
const live = useScanning();
|
|
294
|
+
const held = React4.useRef({ turnKey, scan: null });
|
|
295
|
+
if (held.current.turnKey !== turnKey) held.current = { turnKey, scan: null };
|
|
296
|
+
if (live !== null && live.count > 0) held.current.scan = live;
|
|
297
|
+
return held.current.scan;
|
|
298
|
+
}
|
|
299
|
+
function ThinkingLine({ status }) {
|
|
300
|
+
const labels = useLabels().conversation;
|
|
301
|
+
const line = useSteadyLine(status, labels.working);
|
|
302
|
+
return /* @__PURE__ */ jsx3(
|
|
303
|
+
motion.div,
|
|
304
|
+
{
|
|
305
|
+
"aria-live": "polite",
|
|
306
|
+
className: "min-w-0 text-xl font-medium leading-[1.4] text-[var(--fourty-convo-ink)]",
|
|
307
|
+
initial: { opacity: 0 },
|
|
308
|
+
animate: { opacity: 1 },
|
|
309
|
+
exit: { opacity: 0, transition: { duration: 0.2, ease: EASE } },
|
|
310
|
+
transition: { duration: 0.4, ease: EASE },
|
|
311
|
+
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) })
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
function ThinkingBand({ facts: facts2, status }) {
|
|
316
|
+
const scan = useScanning();
|
|
317
|
+
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: [
|
|
318
|
+
facts2.length > 0 && /* @__PURE__ */ jsx3(Facts, { facts: facts2 }),
|
|
319
|
+
/* @__PURE__ */ jsx3(ReadingRow, { scan }),
|
|
320
|
+
/* @__PURE__ */ jsx3(ThinkingLine, { status })
|
|
321
|
+
] });
|
|
322
|
+
}
|
|
323
|
+
function BentoSkeleton() {
|
|
324
|
+
const cells = ["col-span-8 h-[320px]", "col-span-4 h-[320px]", "col-span-12 h-[200px]"];
|
|
325
|
+
return /* @__PURE__ */ jsx3(
|
|
326
|
+
motion.div,
|
|
327
|
+
{
|
|
328
|
+
"aria-busy": "true",
|
|
329
|
+
className: "grid grid-cols-12 gap-4",
|
|
330
|
+
initial: { opacity: 0 },
|
|
331
|
+
animate: { opacity: 1 },
|
|
332
|
+
exit: { opacity: 0, transition: { duration: 0.25, ease: EASE } },
|
|
333
|
+
children: cells.map((c, i) => /* @__PURE__ */ jsx3(
|
|
334
|
+
motion.div,
|
|
335
|
+
{
|
|
336
|
+
initial: { opacity: 0, y: 8 },
|
|
337
|
+
animate: { opacity: 1, y: 0 },
|
|
338
|
+
transition: { duration: 0.35, ease: EASE, delay: 0.08 * i },
|
|
339
|
+
className: `${c} animate-pulse rounded-[var(--fourty-convo-card-radius)] bg-[var(--fourty-convo-surface)]`
|
|
340
|
+
},
|
|
341
|
+
c
|
|
342
|
+
))
|
|
343
|
+
}
|
|
344
|
+
);
|
|
322
345
|
}
|
|
323
346
|
|
|
324
347
|
// src/conversation/activity-line.ts
|
|
@@ -330,17 +353,19 @@ function useActivityLine(activity) {
|
|
|
330
353
|
}
|
|
331
354
|
|
|
332
355
|
// src/conversation/use-page-products.ts
|
|
333
|
-
import * as
|
|
356
|
+
import * as React5 from "react";
|
|
334
357
|
import { collectLayoutGids, useComponentCatalog, useDisplayedLayout, useProducts } from "@40rty/ams-sdk";
|
|
335
358
|
function usePageProducts() {
|
|
336
359
|
const layout = useDisplayedLayout();
|
|
337
360
|
const catalog = useComponentCatalog();
|
|
338
|
-
const ids =
|
|
361
|
+
const ids = React5.useMemo(() => [...collectLayoutGids(layout, catalog)].filter((id) => id.includes("/Product/")), [layout, catalog]);
|
|
339
362
|
return useProducts(ids).data;
|
|
340
363
|
}
|
|
341
364
|
|
|
342
|
-
// src/conversation/
|
|
343
|
-
import
|
|
365
|
+
// src/conversation/turn-header-parts.tsx
|
|
366
|
+
import * as React6 from "react";
|
|
367
|
+
import { turnAskSegments } from "@40rty/ams-sdk";
|
|
368
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
344
369
|
var MAX_CRUMBS = 5;
|
|
345
370
|
function wordCrumbs(crumbs, home, here) {
|
|
346
371
|
return crumbs.map((c) => ({
|
|
@@ -352,16 +377,16 @@ function wordCrumbs(crumbs, home, here) {
|
|
|
352
377
|
function Breadcrumbs({ crumbs }) {
|
|
353
378
|
const shown = crumbs.length > MAX_CRUMBS ? [crumbs[0], { key: "gap", label: "\u2026", onClick: null }, ...crumbs.slice(crumbs.length - (MAX_CRUMBS - 2))] : crumbs;
|
|
354
379
|
const navLabel = useLabels().nav.conversation;
|
|
355
|
-
return /* @__PURE__ */
|
|
356
|
-
i > 0 && /* @__PURE__ */
|
|
357
|
-
c.onClick === null ? /* @__PURE__ */
|
|
380
|
+
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: [
|
|
381
|
+
i > 0 && /* @__PURE__ */ jsx4("span", { "aria-hidden": true, children: "/" }),
|
|
382
|
+
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
383
|
] }, c.key)) });
|
|
359
384
|
}
|
|
360
385
|
function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
361
|
-
const [open, setOpen] =
|
|
386
|
+
const [open, setOpen] = React6.useState(false);
|
|
362
387
|
const products = usePageProducts();
|
|
363
388
|
const reduce = useReducedMotion();
|
|
364
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ jsxs2(
|
|
365
390
|
motion.header,
|
|
366
391
|
{
|
|
367
392
|
initial: reduce === true ? false : { opacity: 0, y: -8 },
|
|
@@ -369,14 +394,14 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
369
394
|
transition: { duration: 0.36, ease: EASE },
|
|
370
395
|
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
396
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
398
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-3", children: [
|
|
399
|
+
/* @__PURE__ */ jsx4("span", { "aria-hidden": true, className: "h-3 w-3 flex-none bg-[var(--fourty-convo-accent)]" }),
|
|
400
|
+
/* @__PURE__ */ jsx4(Breadcrumbs, { crumbs: trail })
|
|
376
401
|
] }),
|
|
377
402
|
right
|
|
378
403
|
] }),
|
|
379
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ jsxs2(
|
|
380
405
|
"button",
|
|
381
406
|
{
|
|
382
407
|
type: "button",
|
|
@@ -384,17 +409,17 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
384
409
|
onClick: () => setOpen((o) => !o),
|
|
385
410
|
className: "flex w-full cursor-pointer items-baseline gap-4 border-0 bg-transparent p-0 pt-1 text-start text-inherit",
|
|
386
411
|
children: [
|
|
387
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ jsxs2("span", { className: "flex-none text-base font-medium leading-6 text-[var(--fourty-convo-muted)]", children: [
|
|
388
413
|
"\u201C",
|
|
389
414
|
question,
|
|
390
415
|
"\u201D"
|
|
391
416
|
] }),
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
/* @__PURE__ */
|
|
417
|
+
/* @__PURE__ */ jsx4("span", { className: `min-w-0 flex-1 text-xl font-bold leading-7 ${open ? "" : "truncate"}`, children: /* @__PURE__ */ jsx4(Rich, { text: headline }) }),
|
|
418
|
+
/* @__PURE__ */ jsx4("span", { "aria-hidden": true, className: "flex-none text-xl leading-7", children: open ? "\u2212" : "+" })
|
|
394
419
|
]
|
|
395
420
|
}
|
|
396
421
|
),
|
|
397
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ jsx4(AnimatePresence, { initial: false, children: open && body.length > 0 && /* @__PURE__ */ jsx4(
|
|
398
423
|
motion.div,
|
|
399
424
|
{
|
|
400
425
|
initial: reduce === true ? false : { height: 0, opacity: 0 },
|
|
@@ -402,7 +427,7 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
402
427
|
exit: { height: 0, opacity: 0 },
|
|
403
428
|
transition: { duration: 0.3, ease: EASE },
|
|
404
429
|
className: "overflow-hidden",
|
|
405
|
-
children: /* @__PURE__ */
|
|
430
|
+
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
431
|
},
|
|
407
432
|
"answer"
|
|
408
433
|
) })
|
|
@@ -410,6 +435,108 @@ function CollapsedTurn({ trail, question, headline, body, right }) {
|
|
|
410
435
|
}
|
|
411
436
|
);
|
|
412
437
|
}
|
|
438
|
+
function LeadReserve() {
|
|
439
|
+
const plate = "rounded bg-[var(--fourty-convo-surface)]";
|
|
440
|
+
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: [
|
|
441
|
+
/* @__PURE__ */ jsx4("div", { className: `h-7 w-2/5 ${plate}` }),
|
|
442
|
+
/* @__PURE__ */ jsx4("div", { className: `h-4 w-3/5 ${plate}` }),
|
|
443
|
+
/* @__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)) })
|
|
444
|
+
] });
|
|
445
|
+
}
|
|
446
|
+
function FollowUps({ actions, onTake }) {
|
|
447
|
+
const reduce = useReducedMotion();
|
|
448
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex flex-wrap gap-2", "data-testid": "turn-follow-ups", children: actions.map((a, i) => /* @__PURE__ */ jsx4(
|
|
449
|
+
motion.button,
|
|
450
|
+
{
|
|
451
|
+
type: "button",
|
|
452
|
+
onClick: () => onTake(a),
|
|
453
|
+
initial: reduce === true ? false : { opacity: 0, y: 6 },
|
|
454
|
+
animate: { opacity: 1, y: 0 },
|
|
455
|
+
transition: { duration: 0.36, ease: EASE, delay: 0.1 + i * 0.08 },
|
|
456
|
+
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)]",
|
|
457
|
+
children: a.label
|
|
458
|
+
},
|
|
459
|
+
a.id
|
|
460
|
+
)) });
|
|
461
|
+
}
|
|
462
|
+
function FactPills({ facts: facts2, onForget }) {
|
|
463
|
+
const labels = useLabels();
|
|
464
|
+
const reduce = useReducedMotion();
|
|
465
|
+
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: [
|
|
466
|
+
/* @__PURE__ */ jsx4(AnimatePresence, { initial: false, children: facts2.map((f) => /* @__PURE__ */ jsxs2(
|
|
467
|
+
motion.li,
|
|
468
|
+
{
|
|
469
|
+
layout: reduce !== true,
|
|
470
|
+
initial: reduce === true ? false : { opacity: 0, scale: 0.85 },
|
|
471
|
+
animate: { opacity: 1, scale: 1 },
|
|
472
|
+
exit: reduce === true ? void 0 : { opacity: 0, scale: 0.85 },
|
|
473
|
+
transition: { duration: 0.24, ease: EASE },
|
|
474
|
+
title: f.label,
|
|
475
|
+
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)]",
|
|
476
|
+
children: [
|
|
477
|
+
f.value,
|
|
478
|
+
/* @__PURE__ */ jsx4(
|
|
479
|
+
"button",
|
|
480
|
+
{
|
|
481
|
+
type: "button",
|
|
482
|
+
onClick: () => onForget(f),
|
|
483
|
+
"aria-label": labels.live.forgetFact(f.label, f.value),
|
|
484
|
+
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)]",
|
|
485
|
+
children: "\xD7"
|
|
486
|
+
}
|
|
487
|
+
)
|
|
488
|
+
]
|
|
489
|
+
},
|
|
490
|
+
f.label.toLowerCase()
|
|
491
|
+
)) }),
|
|
492
|
+
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 }) })
|
|
493
|
+
] });
|
|
494
|
+
}
|
|
495
|
+
function StartOverButton({ label, onClick }) {
|
|
496
|
+
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: [
|
|
497
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 12a9 9 0 1 0 3-6.7" }),
|
|
498
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 4v5h5" })
|
|
499
|
+
] }) });
|
|
500
|
+
}
|
|
501
|
+
function AskLine({ ask, answerable, onReply }) {
|
|
502
|
+
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(
|
|
503
|
+
(segment, i) => segment.kind === "text" || !answerable ? /* @__PURE__ */ jsx4(React6.Fragment, { children: segment.text }, i) : /* @__PURE__ */ jsx4(
|
|
504
|
+
"button",
|
|
505
|
+
{
|
|
506
|
+
type: "button",
|
|
507
|
+
onClick: () => onReply(segment.text),
|
|
508
|
+
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)]",
|
|
509
|
+
children: segment.text
|
|
510
|
+
},
|
|
511
|
+
i
|
|
512
|
+
)
|
|
513
|
+
) });
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// src/conversation/follow-ups-place.ts
|
|
517
|
+
import * as React7 from "react";
|
|
518
|
+
var drawnInPage = 0;
|
|
519
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
520
|
+
function set(next) {
|
|
521
|
+
drawnInPage = next;
|
|
522
|
+
listeners.forEach((listener) => listener());
|
|
523
|
+
}
|
|
524
|
+
function subscribe(listener) {
|
|
525
|
+
listeners.add(listener);
|
|
526
|
+
return () => listeners.delete(listener);
|
|
527
|
+
}
|
|
528
|
+
function useDrawFollowUpsInPage() {
|
|
529
|
+
React7.useEffect(() => {
|
|
530
|
+
set(drawnInPage + 1);
|
|
531
|
+
return () => set(drawnInPage - 1);
|
|
532
|
+
}, []);
|
|
533
|
+
}
|
|
534
|
+
function useFollowUpsDrawnInPage() {
|
|
535
|
+
return React7.useSyncExternalStore(subscribe, () => drawnInPage > 0, () => false);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// src/conversation/TurnHeader.tsx
|
|
539
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
413
540
|
function TurnHeader() {
|
|
414
541
|
const page = useConversationPage2();
|
|
415
542
|
const reduce = useReducedMotion();
|
|
@@ -417,6 +544,18 @@ function TurnHeader() {
|
|
|
417
544
|
const labels = useLabels().conversation;
|
|
418
545
|
const { turn, presence } = page;
|
|
419
546
|
const status = useActivityLine(presence.activity);
|
|
547
|
+
const { present: leadPresent } = useCanvasLead();
|
|
548
|
+
useDrawFollowUpsInPage();
|
|
549
|
+
const [leadDue, setLeadDue] = React8.useState(false);
|
|
550
|
+
const turnKey = turn === null ? null : turn.key;
|
|
551
|
+
const scan = useTurnScan(turnKey);
|
|
552
|
+
const leadArrived = leadPresent && page.phase !== "thinking";
|
|
553
|
+
React8.useEffect(() => {
|
|
554
|
+
setLeadDue(false);
|
|
555
|
+
if (!leadArrived) return void 0;
|
|
556
|
+
const t = setTimeout(() => setLeadDue(true), wordsSettleInMs());
|
|
557
|
+
return () => clearTimeout(t);
|
|
558
|
+
}, [leadArrived, turnKey]);
|
|
420
559
|
if (turn === null) return null;
|
|
421
560
|
const facts2 = presence.facts;
|
|
422
561
|
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 +576,64 @@ function TurnHeader() {
|
|
|
437
576
|
);
|
|
438
577
|
}
|
|
439
578
|
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,
|
|
579
|
+
const showLead = leadArrived && leadDue;
|
|
580
|
+
const noLead = page.phase !== "thinking" && !leadPresent && (page.hasPage || page.phase === "idle");
|
|
581
|
+
const leadPending = !showLead && !noLead;
|
|
582
|
+
const askAnswers = turn.ask === void 0 ? [] : turnAskAnswers(turn.ask).map((x) => x.trim().toLowerCase());
|
|
583
|
+
const followUps = page.followUps.filter((a) => !askAnswers.includes(a.label.trim().toLowerCase()));
|
|
584
|
+
const showFollowUps = followUps.length > 0;
|
|
585
|
+
const rise = { initial: reduce === true ? false : { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.46, ease: EASE } };
|
|
586
|
+
const answerRest = /* @__PURE__ */ jsxs3("section", { className: "flex min-w-0 flex-col max-[880px]:order-3", children: [
|
|
587
|
+
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 }) }),
|
|
588
|
+
(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: [
|
|
589
|
+
turn.ask !== void 0 && /* @__PURE__ */ jsx5(AskLine, { ask: turn.ask, answerable: turn.answerable, onReply: page.reply }),
|
|
590
|
+
showFollowUps && /* @__PURE__ */ jsx5(FollowUps, { actions: followUps, onTake: page.followUp })
|
|
591
|
+
] })
|
|
592
|
+
] });
|
|
593
|
+
return /* @__PURE__ */ jsxs3(
|
|
594
|
+
motion.header,
|
|
595
|
+
{
|
|
596
|
+
initial: reduce === true ? false : { opacity: 0, y: -14 },
|
|
597
|
+
animate: { opacity: 1, y: 0 },
|
|
598
|
+
transition: { duration: 0.46, ease: EASE },
|
|
599
|
+
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",
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-h-8 flex-wrap items-center gap-x-5 gap-y-2", children: [
|
|
602
|
+
/* @__PURE__ */ jsx5("div", { className: "flex-none text-[13px]", children: /* @__PURE__ */ jsx5(Breadcrumbs, { crumbs: wordCrumbs(page.crumbs, labels.home, labels.thisPage) }) }),
|
|
603
|
+
/* @__PURE__ */ jsx5("div", { className: "min-w-0 flex-1", children: facts2.length > 0 && /* @__PURE__ */ jsx5(FactPills, { facts: facts2, onForget: presence.forgetFact }) }),
|
|
604
|
+
/* @__PURE__ */ jsx5(StartOverButton, { label: labels.startOver, onClick: page.startOver })
|
|
605
|
+
] }),
|
|
606
|
+
/* @__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: [
|
|
607
|
+
/* @__PURE__ */ jsxs3("div", { className: `flex min-w-0 flex-col gap-4 self-start max-[880px]:contents ${showLead ? "sticky top-6" : ""}`, children: [
|
|
608
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col max-[880px]:order-1", children: [
|
|
609
|
+
/* @__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 }),
|
|
610
|
+
/* @__PURE__ */ jsx5("div", { className: "mb-3", children: /* @__PURE__ */ jsx5(ReadingRow, { scan }) }),
|
|
611
|
+
/* @__PURE__ */ jsx5(AnimatePresence, { mode: "wait", initial: false, children: thinking ? /* @__PURE__ */ jsx5(ThinkingLine, { status }, "thinking") : (
|
|
612
|
+
// The page's one loud line, in the brand's heading face (its own `h1`
|
|
613
|
+
// rule), every word at one weight and in that face (`RisingWords`).
|
|
614
|
+
/* @__PURE__ */ jsx5(
|
|
615
|
+
motion.h1,
|
|
492
616
|
{
|
|
493
|
-
initial:
|
|
494
|
-
animate: { opacity: 1
|
|
495
|
-
transition: { duration: 0.
|
|
496
|
-
|
|
497
|
-
|
|
617
|
+
initial: { opacity: 0 },
|
|
618
|
+
animate: { opacity: 1 },
|
|
619
|
+
transition: { duration: 0.2 },
|
|
620
|
+
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]",
|
|
621
|
+
children: /* @__PURE__ */ jsx5(RisingWords, { text: turn.headline, products })
|
|
622
|
+
},
|
|
623
|
+
"answer"
|
|
498
624
|
)
|
|
499
|
-
|
|
500
|
-
] },
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
625
|
+
) })
|
|
626
|
+
] }),
|
|
627
|
+
!thinking && !noLead && answerRest
|
|
628
|
+
] }),
|
|
629
|
+
/* @__PURE__ */ jsx5(CanvasLeadSlot, { className: showLead ? "min-w-0 @container max-[880px]:order-2" : "hidden" }),
|
|
630
|
+
leadPending && /* @__PURE__ */ jsx5(LeadReserve, {}),
|
|
631
|
+
!thinking && noLead && /* @__PURE__ */ jsx5("div", { className: "min-w-0 pt-12 max-[880px]:contents", children: answerRest })
|
|
632
|
+
] }),
|
|
633
|
+
/* @__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") }) }) })
|
|
634
|
+
]
|
|
635
|
+
},
|
|
636
|
+
turn.key
|
|
507
637
|
);
|
|
508
638
|
}
|
|
509
639
|
|
|
@@ -528,16 +658,17 @@ function TurnCanvas({ children }) {
|
|
|
528
658
|
// src/conversation/ConversationCanvas.tsx
|
|
529
659
|
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
530
660
|
var CONVERSATION_MOTION = { entrance: "rise", timings: { entranceDurationS: 0.78, rowStaggerS: 0.12 } };
|
|
531
|
-
|
|
532
|
-
|
|
661
|
+
var DEFAULT_LEAD = { except: ["productDetail"] };
|
|
662
|
+
function ConversationCanvas({ motion: motion2 = CONVERSATION_MOTION, lead = DEFAULT_LEAD }) {
|
|
663
|
+
return /* @__PURE__ */ jsx7(CanvasLeadProvider, { ...lead, children: /* @__PURE__ */ jsxs4(ResultSheet, { children: [
|
|
533
664
|
/* @__PURE__ */ jsx7(TurnHeader, {}),
|
|
534
665
|
/* @__PURE__ */ jsx7(TurnCanvas, { children: /* @__PURE__ */ jsx7(CanvasArrangementProvider, { arrangement: "bento", turnPages: true, children: /* @__PURE__ */ jsx7(CanvasMotionStyleProvider, { style: motion2, children: /* @__PURE__ */ jsx7(SpacefrontCanvas, {}) }) }) })
|
|
535
|
-
] });
|
|
666
|
+
] }) });
|
|
536
667
|
}
|
|
537
668
|
|
|
538
669
|
// src/conversation/PageComposer.tsx
|
|
539
|
-
import * as
|
|
540
|
-
import { turnAskAnswers, useComposerChipSelect, useConversationPage as useConversationPage4 } from "@40rty/ams-sdk";
|
|
670
|
+
import * as React9 from "react";
|
|
671
|
+
import { turnAskAnswers as turnAskAnswers2, useComposerChipSelect, useConversationPage as useConversationPage4 } from "@40rty/ams-sdk";
|
|
541
672
|
|
|
542
673
|
// src/conversation/sent-words.tsx
|
|
543
674
|
import { createPortal } from "react-dom";
|
|
@@ -569,16 +700,17 @@ function SentWords() {
|
|
|
569
700
|
}
|
|
570
701
|
|
|
571
702
|
// src/conversation/PageComposer.tsx
|
|
572
|
-
import { Fragment as
|
|
703
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
573
704
|
var PAGE_COMPOSER_INPUT_ID = "fourty-page-composer";
|
|
574
705
|
function PageComposer({ placeholder, starters, followUpsInPage = false }) {
|
|
575
|
-
const originRef =
|
|
706
|
+
const originRef = React9.useRef(null);
|
|
576
707
|
const { value, setValue, attachments, dictation, onPaste, canSend, submit } = usePromptComposer({ origin: originRef });
|
|
577
708
|
const onChipSelect = useComposerChipSelect();
|
|
578
709
|
const { presence, turn, place } = useConversationPage4();
|
|
579
710
|
const isRunning = presence.running;
|
|
580
|
-
const pageAsksForReply = turn !== null && turn.ask !== void 0 &&
|
|
581
|
-
const
|
|
711
|
+
const pageAsksForReply = turn !== null && turn.ask !== void 0 && turnAskAnswers2(turn.ask).length > 0;
|
|
712
|
+
const inPage = useFollowUpsDrawnInPage() || followUpsInPage;
|
|
713
|
+
const showFollowUps = inPage ? place === "welcome" : !isRunning && !pageAsksForReply;
|
|
582
714
|
const status = useActivityLine(presence.activity);
|
|
583
715
|
const labels = useLabels().conversation;
|
|
584
716
|
const onKeyDown = (e) => {
|
|
@@ -589,20 +721,20 @@ function PageComposer({ placeholder, starters, followUpsInPage = false }) {
|
|
|
589
721
|
};
|
|
590
722
|
return (
|
|
591
723
|
// 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
|
|
724
|
+
// sharp under it, and only the chips and the near-opaque bar sit on top.
|
|
593
725
|
/* @__PURE__ */ jsxs5("div", { className: "relative px-[var(--fourty-canvas-gutter)] pb-5 pt-3", children: [
|
|
594
726
|
/* @__PURE__ */ jsx9(SentWords, {}),
|
|
595
727
|
/* @__PURE__ */ jsxs5("div", { className: "fourty-convo-composer relative mx-auto flex max-w-[920px] flex-col gap-2.5", children: [
|
|
596
728
|
showFollowUps && /* @__PURE__ */ jsx9(ComposerChipStrip, { value, starterSuggestions: starters, onStarterClick: setValue, onChipSelect, orientation: "row" }),
|
|
597
729
|
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-[
|
|
730
|
+
/* @__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
731
|
/* @__PURE__ */ jsxs5("span", { "aria-hidden": true, className: "flex flex-none gap-1", children: [
|
|
600
732
|
/* @__PURE__ */ jsx9("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)]" }),
|
|
601
733
|
/* @__PURE__ */ jsx9("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)] [animation-delay:200ms]" }),
|
|
602
734
|
/* @__PURE__ */ jsx9("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)] [animation-delay:400ms]" })
|
|
603
735
|
] }),
|
|
604
736
|
/* @__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(
|
|
737
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
606
738
|
/* @__PURE__ */ jsx9(AttachButton, { onFiles: attachments.addFiles }),
|
|
607
739
|
/* @__PURE__ */ jsx9(
|
|
608
740
|
"textarea",
|
|
@@ -637,8 +769,30 @@ function PageComposer({ placeholder, starters, followUpsInPage = false }) {
|
|
|
637
769
|
);
|
|
638
770
|
}
|
|
639
771
|
|
|
772
|
+
// src/conversation/ClosingQuestion.tsx
|
|
773
|
+
import * as React10 from "react";
|
|
774
|
+
import { turnAskSegments as turnAskSegments2 } from "@40rty/ams-sdk";
|
|
775
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
776
|
+
function ClosingQuestion({ ask, answerable, onReply }) {
|
|
777
|
+
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: [
|
|
778
|
+
/* @__PURE__ */ jsx10("span", { children: turnAskSegments2(ask).map(
|
|
779
|
+
(segment, i) => segment.kind === "text" || !answerable ? /* @__PURE__ */ jsx10(React10.Fragment, { children: segment.text }, i) : /* @__PURE__ */ jsx10(
|
|
780
|
+
"button",
|
|
781
|
+
{
|
|
782
|
+
type: "button",
|
|
783
|
+
onClick: () => onReply(segment.text),
|
|
784
|
+
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)]",
|
|
785
|
+
children: segment.text
|
|
786
|
+
},
|
|
787
|
+
i
|
|
788
|
+
)
|
|
789
|
+
) }),
|
|
790
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": true, className: "flex-none text-[var(--fourty-convo-accent)] rtl:-scale-x-100", children: "\u2192" })
|
|
791
|
+
] });
|
|
792
|
+
}
|
|
793
|
+
|
|
640
794
|
// src/conversation/blocks/blocks.tsx
|
|
641
|
-
import * as
|
|
795
|
+
import * as React12 from "react";
|
|
642
796
|
import { catalogComponent, useAction } from "@40rty/ams-sdk";
|
|
643
797
|
|
|
644
798
|
// src/conversation/blocks/schemas.ts
|
|
@@ -703,23 +857,23 @@ var noteProps = {
|
|
|
703
857
|
};
|
|
704
858
|
|
|
705
859
|
// src/conversation/blocks/ProductTile.tsx
|
|
706
|
-
import * as
|
|
860
|
+
import * as React11 from "react";
|
|
707
861
|
import { useHydrationState, useProductCard as useProductCard2 } from "@40rty/ams-sdk";
|
|
708
|
-
import { jsx as
|
|
709
|
-
var TileContext =
|
|
862
|
+
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
863
|
+
var TileContext = React11.createContext(null);
|
|
710
864
|
function ConversationProvider({ tile, children }) {
|
|
711
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ jsx11(TileContext.Provider, { value: tile, children });
|
|
712
866
|
}
|
|
713
867
|
function PlainTile({ product, badge, blurb }) {
|
|
714
868
|
const { primaryImage, priceLabel, onCardClick } = useProductCard2(product);
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
primaryImage !== void 0 && /* @__PURE__ */
|
|
718
|
-
badge !== void 0 && /* @__PURE__ */
|
|
869
|
+
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: [
|
|
870
|
+
/* @__PURE__ */ jsxs7("span", { className: "relative block aspect-square bg-[var(--fourty-convo-surface)]", children: [
|
|
871
|
+
primaryImage !== void 0 && /* @__PURE__ */ jsx11("img", { src: primaryImage.url, alt: primaryImage.altText, className: "block h-full w-full object-contain p-4" }),
|
|
872
|
+
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
873
|
] }),
|
|
720
|
-
/* @__PURE__ */
|
|
721
|
-
blurb !== void 0 && /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ jsx11("span", { className: "text-base leading-5", children: product.title }),
|
|
875
|
+
blurb !== void 0 && /* @__PURE__ */ jsx11("span", { className: "text-sm leading-5 text-[var(--fourty-convo-muted)]", children: blurb }),
|
|
876
|
+
/* @__PURE__ */ jsx11("span", { className: "text-base", children: priceLabel })
|
|
723
877
|
] });
|
|
724
878
|
}
|
|
725
879
|
function useReserved(items) {
|
|
@@ -730,26 +884,26 @@ function useReserved(items) {
|
|
|
730
884
|
return out;
|
|
731
885
|
}
|
|
732
886
|
function ProductTile(props) {
|
|
733
|
-
const Tile =
|
|
734
|
-
return /* @__PURE__ */
|
|
887
|
+
const Tile = React11.useContext(TileContext);
|
|
888
|
+
return /* @__PURE__ */ jsx11("div", { className: "@container h-full", children: Tile === null ? /* @__PURE__ */ jsx11(PlainTile, { ...props }) : /* @__PURE__ */ jsx11(Tile, { ...props }) });
|
|
735
889
|
}
|
|
736
890
|
function TileReserve({ blurb }) {
|
|
737
|
-
return /* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
blurb !== void 0 && /* @__PURE__ */
|
|
891
|
+
return /* @__PURE__ */ jsxs7("div", { "aria-hidden": true, className: "flex h-full flex-col gap-2", children: [
|
|
892
|
+
/* @__PURE__ */ jsx11("div", { className: "aspect-square animate-pulse bg-[var(--fourty-convo-surface)]" }),
|
|
893
|
+
/* @__PURE__ */ jsx11("span", { className: "h-5 w-3/4 animate-pulse bg-[var(--fourty-convo-surface)]" }),
|
|
894
|
+
blurb !== void 0 && /* @__PURE__ */ jsx11("p", { className: "m-0 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: blurb })
|
|
741
895
|
] });
|
|
742
896
|
}
|
|
743
897
|
function useLanded(reserved) {
|
|
744
|
-
const [landed, setLanded] =
|
|
745
|
-
|
|
898
|
+
const [landed, setLanded] = React11.useState(false);
|
|
899
|
+
React11.useEffect(() => {
|
|
746
900
|
if (!reserved && !landed) setLanded(true);
|
|
747
901
|
}, [reserved, landed]);
|
|
748
902
|
return landed || !reserved;
|
|
749
903
|
}
|
|
750
904
|
|
|
751
905
|
// src/conversation/blocks/blocks.tsx
|
|
752
|
-
import { jsx as
|
|
906
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
753
907
|
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
908
|
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
909
|
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 +916,47 @@ var CARD_SKIN = {
|
|
|
762
916
|
accent: "bg-[var(--fourty-convo-accent)] text-[var(--fourty-convo-on-accent)]"
|
|
763
917
|
};
|
|
764
918
|
function Card({ children, tone = "plain" }) {
|
|
765
|
-
return /* @__PURE__ */
|
|
919
|
+
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
920
|
}
|
|
767
921
|
function Eyebrow({ children }) {
|
|
768
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ jsx12("p", { className: "m-0 text-sm font-medium leading-5 opacity-60", children });
|
|
769
923
|
}
|
|
770
924
|
function Title({ children }) {
|
|
771
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsx12("h3", { className: "m-0 text-2xl font-bold leading-7 @[560px]:text-[2rem] @[560px]:leading-[2.1875rem]", children });
|
|
772
926
|
}
|
|
773
927
|
function AskChip({ label, text }) {
|
|
774
|
-
const action =
|
|
928
|
+
const action = React12.useMemo(() => ({ id: `ask-${label}`, type: "message", payload: { text } }), [label, text]);
|
|
775
929
|
const onClick = useAction(label, action);
|
|
776
|
-
return /* @__PURE__ */
|
|
930
|
+
return /* @__PURE__ */ jsx12("button", { type: "button", onClick: onClick !== null ? onClick : void 0, className: PILL_OUTLINE, children: label });
|
|
777
931
|
}
|
|
778
932
|
var arr = (v) => Array.isArray(v) ? v : [];
|
|
779
933
|
function GuidedPick(p) {
|
|
780
|
-
return /* @__PURE__ */
|
|
781
|
-
p.eyebrow !== void 0 && /* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
935
|
+
p.eyebrow !== void 0 && /* @__PURE__ */ jsx12(Eyebrow, { children: p.eyebrow }),
|
|
936
|
+
/* @__PURE__ */ jsx12(Title, { children: p.question }),
|
|
937
|
+
/* @__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
938
|
] });
|
|
785
939
|
}
|
|
786
940
|
function Paths(p) {
|
|
787
941
|
const labels = useLabels().conversation;
|
|
788
|
-
return /* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
790
|
-
/* @__PURE__ */
|
|
942
|
+
return /* @__PURE__ */ jsxs8(Card, { tone: "accent", children: [
|
|
943
|
+
/* @__PURE__ */ jsx12(Title, { children: p.title !== void 0 ? p.title : labels.pathsTitle }),
|
|
944
|
+
/* @__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
945
|
] });
|
|
792
946
|
}
|
|
793
947
|
function Note(p) {
|
|
794
948
|
const labels = useLabels().conversation;
|
|
795
|
-
return /* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
/* @__PURE__ */
|
|
949
|
+
return /* @__PURE__ */ jsxs8(Card, { tone: "highlight", children: [
|
|
950
|
+
/* @__PURE__ */ jsx12(Eyebrow, { children: p.eyebrow !== void 0 ? p.eyebrow : labels.noteEyebrow }),
|
|
951
|
+
/* @__PURE__ */ jsx12("div", { className: "text-2xl font-bold leading-7 @[560px]:text-[2rem] @[560px]:leading-[2.1875rem]", children: p.text })
|
|
798
952
|
] });
|
|
799
953
|
}
|
|
800
954
|
function Facts2(p) {
|
|
801
|
-
return /* @__PURE__ */
|
|
802
|
-
p.title !== void 0 && /* @__PURE__ */
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
/* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
955
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
956
|
+
p.title !== void 0 && /* @__PURE__ */ jsx12(Eyebrow, { children: p.title }),
|
|
957
|
+
/* @__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: [
|
|
958
|
+
/* @__PURE__ */ jsx12("dt", { className: "text-sm leading-5 text-[var(--fourty-convo-muted)]", children: f.label }),
|
|
959
|
+
/* @__PURE__ */ jsx12("dd", { className: "m-0 text-base font-bold leading-6", children: f.value })
|
|
806
960
|
] }, f.label)) })
|
|
807
961
|
] });
|
|
808
962
|
}
|
|
@@ -811,13 +965,13 @@ function Explain(p) {
|
|
|
811
965
|
const products = useReserved(arr(p.products));
|
|
812
966
|
const s = p.scale;
|
|
813
967
|
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__ */
|
|
968
|
+
return /* @__PURE__ */ jsxs8(Card, { children: [
|
|
969
|
+
/* @__PURE__ */ jsx12(Title, { children: p.term }),
|
|
970
|
+
/* @__PURE__ */ jsx12("div", { className: "text-base leading-[1.375rem] text-[var(--fourty-convo-muted)]", children: p.definition }),
|
|
971
|
+
s !== void 0 && pct !== null && /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", children: [
|
|
972
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative h-2 rounded-full bg-[var(--fourty-convo-surface)]", children: [
|
|
973
|
+
/* @__PURE__ */ jsx12("div", { className: "absolute inset-y-0 start-0 rounded-full bg-[var(--fourty-convo-ink)]", style: { width: `${pct}%` } }),
|
|
974
|
+
/* @__PURE__ */ jsx12(
|
|
821
975
|
"div",
|
|
822
976
|
{
|
|
823
977
|
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 +979,16 @@ function Explain(p) {
|
|
|
825
979
|
}
|
|
826
980
|
)
|
|
827
981
|
] }),
|
|
828
|
-
/* @__PURE__ */
|
|
829
|
-
/* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
982
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex justify-between text-sm leading-5 text-[var(--fourty-convo-muted)]", children: [
|
|
983
|
+
/* @__PURE__ */ jsx12("span", { children: s.minLabel }),
|
|
984
|
+
/* @__PURE__ */ jsx12("span", { children: s.value }),
|
|
985
|
+
/* @__PURE__ */ jsx12("span", { children: s.maxLabel })
|
|
832
986
|
] })
|
|
833
987
|
] }),
|
|
834
|
-
p.forYou !== void 0 && /* @__PURE__ */
|
|
835
|
-
products.length > 0 && /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
988
|
+
p.forYou !== void 0 && /* @__PURE__ */ jsx12("p", { className: "m-0 text-base font-bold leading-6", children: p.forYou }),
|
|
989
|
+
products.length > 0 && /* @__PURE__ */ jsxs8("div", { className: "mt-2 flex flex-col gap-3 pt-2", children: [
|
|
990
|
+
/* @__PURE__ */ jsx12(Eyebrow, { children: labels.explainProducts }),
|
|
991
|
+
/* @__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
992
|
] })
|
|
839
993
|
] });
|
|
840
994
|
}
|
|
@@ -893,22 +1047,22 @@ var explain = catalogComponent(
|
|
|
893
1047
|
);
|
|
894
1048
|
|
|
895
1049
|
// src/conversation/blocks/product-blocks.tsx
|
|
896
|
-
import * as
|
|
1050
|
+
import * as React13 from "react";
|
|
897
1051
|
import { ItemTransitionGroup } from "@40rty/ams-sdk";
|
|
898
1052
|
import { catalogComponent as catalogComponent2 } from "@40rty/ams-sdk";
|
|
899
|
-
import { jsx as
|
|
1053
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
900
1054
|
var arr2 = (v) => Array.isArray(v) ? v : [];
|
|
901
1055
|
function Verdict(p) {
|
|
902
1056
|
const labels = useLabels().conversation;
|
|
903
1057
|
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__ */
|
|
1058
|
+
return /* @__PURE__ */ jsxs9(Card, { children: [
|
|
1059
|
+
/* @__PURE__ */ jsx13(Eyebrow, { children: labels.verdict }),
|
|
1060
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-1 items-start gap-8 @[640px]:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", children: [
|
|
1061
|
+
pick === void 0 ? /* @__PURE__ */ jsx13("div", {}) : pick === null ? /* @__PURE__ */ jsx13(TileReserve, {}) : /* @__PURE__ */ jsx13(ProductTile, { product: pick, badge: labels.ourPick }),
|
|
1062
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-3", children: [
|
|
1063
|
+
/* @__PURE__ */ jsx13(Title, { children: p.headline }),
|
|
1064
|
+
/* @__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)) }),
|
|
1065
|
+
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
1066
|
] })
|
|
913
1067
|
] })
|
|
914
1068
|
] });
|
|
@@ -917,33 +1071,33 @@ function Shortlist(p) {
|
|
|
917
1071
|
const notes = arr2(p.notes);
|
|
918
1072
|
const products = useReserved(arr2(p.products));
|
|
919
1073
|
const landed = useLanded(products.some((x) => x === null));
|
|
920
|
-
return /* @__PURE__ */
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
!landed ? /* @__PURE__ */
|
|
1074
|
+
return /* @__PURE__ */ jsxs9(Card, { children: [
|
|
1075
|
+
/* @__PURE__ */ jsx13(Title, { children: p.title }),
|
|
1076
|
+
!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
1077
|
const i = arr2(p.products).indexOf(prod);
|
|
924
|
-
return /* @__PURE__ */
|
|
1078
|
+
return /* @__PURE__ */ jsx13(ProductTile, { product: prod, blurb: i >= 0 && i < notes.length ? notes[i] : void 0 });
|
|
925
1079
|
} })
|
|
926
1080
|
] });
|
|
927
1081
|
}
|
|
928
1082
|
function SideCol({ side: side2, product }) {
|
|
929
|
-
if (side2 === void 0) return /* @__PURE__ */
|
|
930
|
-
return /* @__PURE__ */
|
|
931
|
-
product === null ? /* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
1083
|
+
if (side2 === void 0) return /* @__PURE__ */ jsx13("div", {});
|
|
1084
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2 min-w-0", children: [
|
|
1085
|
+
product === null ? /* @__PURE__ */ jsx13(TileReserve, {}) : product !== void 0 && /* @__PURE__ */ jsx13(ProductTile, { product }),
|
|
1086
|
+
/* @__PURE__ */ jsx13("p", { className: "m-0 mt-2 text-xl font-bold leading-[1.625rem]", children: side2.label }),
|
|
1087
|
+
/* @__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
1088
|
] });
|
|
935
1089
|
}
|
|
936
1090
|
function Tradeoff(p) {
|
|
937
1091
|
const labels = useLabels().conversation;
|
|
938
1092
|
const products = useReserved(arr2(p.products));
|
|
939
|
-
return /* @__PURE__ */
|
|
940
|
-
/* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
1093
|
+
return /* @__PURE__ */ jsxs9(Card, { children: [
|
|
1094
|
+
/* @__PURE__ */ jsx13(Eyebrow, { children: labels.tradeoff }),
|
|
1095
|
+
/* @__PURE__ */ jsx13(Title, { children: p.title }),
|
|
1096
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-2 gap-6", children: [
|
|
1097
|
+
/* @__PURE__ */ jsx13(SideCol, { side: p.left, product: products.length > 0 ? products[0] : void 0 }),
|
|
1098
|
+
/* @__PURE__ */ jsx13(SideCol, { side: p.right, product: products.length > 1 ? products[1] : void 0 })
|
|
945
1099
|
] }),
|
|
946
|
-
p.lean !== void 0 && /* @__PURE__ */
|
|
1100
|
+
p.lean !== void 0 && /* @__PURE__ */ jsx13("p", { className: "m-0 pt-2 text-base font-bold leading-6", children: p.lean })
|
|
947
1101
|
] });
|
|
948
1102
|
}
|
|
949
1103
|
var verdict = catalogComponent2(
|
|
@@ -993,10 +1147,12 @@ export {
|
|
|
993
1147
|
PILL_SOLID,
|
|
994
1148
|
PageComposer,
|
|
995
1149
|
ProductTile,
|
|
1150
|
+
ReadingRow,
|
|
996
1151
|
ResultSheet,
|
|
997
1152
|
Rich,
|
|
998
1153
|
RisingWords,
|
|
999
1154
|
ThinkingBand,
|
|
1155
|
+
ThinkingLine,
|
|
1000
1156
|
TileReserve,
|
|
1001
1157
|
Title,
|
|
1002
1158
|
TurnCanvas,
|
|
@@ -1015,6 +1171,7 @@ export {
|
|
|
1015
1171
|
useLanded,
|
|
1016
1172
|
usePageProducts,
|
|
1017
1173
|
useReserved,
|
|
1174
|
+
useTurnScan,
|
|
1018
1175
|
verdict,
|
|
1019
1176
|
wordsSettleInMs
|
|
1020
1177
|
};
|