@shiva004/surveys 0.1.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1178 @@
1
+ import { jsxs as a, jsx as e, Fragment as j } from "react/jsx-runtime";
2
+ import V, { useState as y, useMemo as S, useRef as X, useCallback as Y, useEffect as U } from "react";
3
+ const C = ({ label: t, value: r, color: n = "#7c3aed" }) => /* @__PURE__ */ a("div", { className: "stat", style: { borderTopColor: n }, children: [
4
+ /* @__PURE__ */ e("div", { className: "stat-label", children: t }),
5
+ /* @__PURE__ */ e("div", { className: "stat-value", children: r })
6
+ ] }), q = ({ items: t, value: r, onChange: n }) => /* @__PURE__ */ e("div", { className: "tabs", children: t.map((s) => /* @__PURE__ */ e("button", { type: "button", className: s.id === r ? "tab active" : "tab", onClick: () => n(s.id), children: s.label }, s.id)) }), E = ({ pct: t, color: r = "#7c3aed" }) => /* @__PURE__ */ e("div", { className: "bar", children: /* @__PURE__ */ e("div", { className: "bar-fill", style: { width: `${Math.max(0, Math.min(100, t))}%`, background: r } }) }), I = ({ title: t, subtitle: r, actions: n, children: s }) => /* @__PURE__ */ a("section", { children: [
7
+ /* @__PURE__ */ a("div", { className: "page-head", children: [
8
+ /* @__PURE__ */ a("div", { children: [
9
+ /* @__PURE__ */ e("h2", { children: t }),
10
+ r && /* @__PURE__ */ e("p", { className: "muted", children: r })
11
+ ] }),
12
+ /* @__PURE__ */ e("div", { className: "actions", children: n })
13
+ ] }),
14
+ s
15
+ ] }), B = (t) => () => {
16
+ t |= 0, t = t + 1831565813 | 0;
17
+ let r = Math.imul(t ^ t >>> 15, 1 | t);
18
+ return r = r + Math.imul(r ^ r >>> 7, 61 | r) ^ r, ((r ^ r >>> 14) >>> 0) / 4294967296;
19
+ }, M = (t) => `${t}_${Math.random().toString(36).slice(2, 8)}`, z = ["/home", "/pricing", "/features", "/docs", "/signup", "/dashboard", "/checkout"], K = [["/home", 0.55], ["/pricing", 0.15], ["/features", 0.15], ["/docs", 0.15]], Z = {
20
+ "/home": [["/pricing", 0.3], ["/features", 0.3], ["/docs", 0.1], ["/signup", 0.1], ["EXIT", 0.2]],
21
+ "/pricing": [["/signup", 0.3], ["/features", 0.15], ["/home", 0.1], ["EXIT", 0.45]],
22
+ "/features": [["/pricing", 0.3], ["/signup", 0.15], ["/docs", 0.15], ["EXIT", 0.4]],
23
+ "/docs": [["/features", 0.2], ["/signup", 0.15], ["/home", 0.1], ["EXIT", 0.55]],
24
+ "/signup": [["/dashboard", 0.6], ["EXIT", 0.4]],
25
+ "/dashboard": [["/checkout", 0.25], ["/docs", 0.15], ["/features", 0.1], ["EXIT", 0.5]],
26
+ "/checkout": [["EXIT", 1]]
27
+ }, L = (t, r) => {
28
+ let n = 0;
29
+ for (const [s, i] of t)
30
+ if (n += i, r < n) return s;
31
+ return t[t.length - 1][0];
32
+ };
33
+ function G(t, r) {
34
+ return Array.from({ length: t }, () => {
35
+ let n = L(K, r());
36
+ const s = [n];
37
+ for (; s.length < 8; ) {
38
+ const i = L(Z[n], r());
39
+ if (i === "EXIT") break;
40
+ s.push(i), n = i;
41
+ }
42
+ return s;
43
+ });
44
+ }
45
+ const ee = () => G(400, B(42));
46
+ function te(t) {
47
+ const r = /* @__PURE__ */ new Map(), n = (s) => (r.has(s) || r.set(s, { views: 0, entries: 0, bounces: 0, exits: 0 }), r.get(s));
48
+ for (const s of t)
49
+ s.forEach((i) => {
50
+ n(i).views += 1;
51
+ }), n(s[0]).entries += 1, s.length === 1 && (n(s[0]).bounces += 1), n(s[s.length - 1]).exits += 1;
52
+ return [...r.entries()].map(([s, i]) => ({
53
+ page: s,
54
+ views: i.views,
55
+ bounceRate: i.entries ? i.bounces / i.entries * 100 : 0,
56
+ exitRate: i.views ? i.exits / i.views * 100 : 0
57
+ })).sort((s, i) => i.views - s.views);
58
+ }
59
+ function ae(t, r = 8) {
60
+ const n = /* @__PURE__ */ new Map();
61
+ for (const s of t) {
62
+ const i = s.slice(0, 4), g = i.join(">"), b = n.get(g) ?? { steps: i, users: 0, conv: 0 };
63
+ b.users += 1, s.includes("/signup") && (b.conv += 1), n.set(g, b);
64
+ }
65
+ return [...n.values()].map((s) => ({ steps: s.steps, users: s.users, convRate: s.conv / s.users * 100 })).sort((s, i) => i.users - s.users).slice(0, r);
66
+ }
67
+ function se(t) {
68
+ const r = /* @__PURE__ */ new Map();
69
+ for (const n of t)
70
+ for (let s = 0; s < n.length - 1; s++) {
71
+ const i = r.get(n[s]) ?? /* @__PURE__ */ new Map();
72
+ i.set(n[s + 1], (i.get(n[s + 1]) ?? 0) + 1), r.set(n[s], i);
73
+ }
74
+ return [...r.entries()].map(([n, s]) => {
75
+ const i = [...s.values()].reduce((g, b) => g + b, 0);
76
+ return {
77
+ from: n,
78
+ total: i,
79
+ destinations: [...s.entries()].map(([g, b]) => ({ to: g, pct: b / i * 100 })).sort((g, b) => b.pct - g.pct)
80
+ };
81
+ }).sort((n, s) => s.total - n.total);
82
+ }
83
+ const oe = (t, r) => t.length ? t.filter((n) => n.some((s) => r.includes(s))).length / t.length * 100 : 0, ne = {
84
+ id: "jm1",
85
+ name: "New customer journey",
86
+ stages: [
87
+ { id: "st1", name: "Awareness", emotion: "curious", pages: ["/home"] },
88
+ { id: "st2", name: "Consideration", emotion: "analytical", pages: ["/pricing", "/features"] },
89
+ { id: "st3", name: "Sign up", emotion: "confident", pages: ["/signup"] },
90
+ { id: "st4", name: "Activation", emotion: "engaged", pages: ["/dashboard"] },
91
+ { id: "st5", name: "Purchase", emotion: "satisfied", pages: ["/checkout"] }
92
+ ]
93
+ }, re = [
94
+ { id: "nav", label: "Navigation Analysis" },
95
+ { id: "paths", label: "Paths" },
96
+ { id: "flows", label: "Userflows" },
97
+ { id: "maps", label: "Journey Maps" }
98
+ ], W = { curious: "#adc6ff", analytical: "#7c3aed", confident: "#4edea3", engaged: "#d2bbff", satisfied: "#ffcc6b", cautious: "#ffb4ab" }, ie = (t) => t.split("/").filter(Boolean).pop() ?? t, le = (t) => t > 25 ? "#ffb4ab" : t > 15 ? "#ffcc6b" : "#4edea3", ce = () => {
99
+ var d;
100
+ const [t, r] = y("nav"), [n, s] = y(ee), [i, g] = y(ne), b = S(() => te(n), [n]), v = S(() => ae(n), [n]), f = S(() => se(n), [n]), m = b.reduce((u, c) => u + c.views, 0), p = n.length, l = n.filter((u) => u.length === 1).length;
101
+ return /* @__PURE__ */ a(
102
+ I,
103
+ {
104
+ title: "User Journey",
105
+ subtitle: "One stream of page views feeds every view below.",
106
+ actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => s((u) => [...u, ...G(50, Math.random)]), children: "+ Simulate 50 sessions" }),
107
+ children: [
108
+ /* @__PURE__ */ a("div", { className: "stats", children: [
109
+ /* @__PURE__ */ e(C, { label: "Sessions", value: p.toLocaleString(), color: "#6366f1" }),
110
+ /* @__PURE__ */ e(C, { label: "Page views", value: m.toLocaleString(), color: "#0ea5e9" }),
111
+ /* @__PURE__ */ e(C, { label: "Bounce rate", value: `${p ? (l / p * 100).toFixed(1) : 0}%`, color: "#f59e0b" }),
112
+ /* @__PURE__ */ e(C, { label: "Top page", value: ((d = b[0]) == null ? void 0 : d.page) ?? "—", color: "#10b981" })
113
+ ] }),
114
+ /* @__PURE__ */ e(q, { items: re, value: t, onChange: r }),
115
+ t === "nav" && /* @__PURE__ */ a("table", { className: "table", children: [
116
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
117
+ /* @__PURE__ */ e("th", { children: "Page" }),
118
+ /* @__PURE__ */ e("th", { children: "Views" }),
119
+ /* @__PURE__ */ e("th", { children: "Share" }),
120
+ /* @__PURE__ */ e("th", { children: "Bounce rate" }),
121
+ /* @__PURE__ */ e("th", { children: "Exit rate" })
122
+ ] }) }),
123
+ /* @__PURE__ */ e("tbody", { children: b.map((u) => /* @__PURE__ */ a("tr", { children: [
124
+ /* @__PURE__ */ e("td", { className: "mono", children: u.page }),
125
+ /* @__PURE__ */ e("td", { className: "mono", children: u.views }),
126
+ /* @__PURE__ */ e("td", { style: { minWidth: 120 }, children: /* @__PURE__ */ e(E, { pct: u.views / m * 100 }) }),
127
+ /* @__PURE__ */ a("td", { className: "mono", style: { color: le(u.bounceRate) }, children: [
128
+ u.bounceRate.toFixed(1),
129
+ "%"
130
+ ] }),
131
+ /* @__PURE__ */ a("td", { className: "mono", children: [
132
+ u.exitRate.toFixed(1),
133
+ "%"
134
+ ] })
135
+ ] }, u.page)) })
136
+ ] }),
137
+ t === "paths" && /* @__PURE__ */ e("div", { className: "grid", children: v.map((u, c) => /* @__PURE__ */ a("div", { className: "card", children: [
138
+ /* @__PURE__ */ a("div", { className: "row", children: [
139
+ /* @__PURE__ */ a("span", { className: "pill passive", children: [
140
+ "#",
141
+ c + 1
142
+ ] }),
143
+ /* @__PURE__ */ e("span", { className: "grow" }),
144
+ /* @__PURE__ */ a("span", { className: "mono small", children: [
145
+ u.convRate.toFixed(1),
146
+ "% reach signup"
147
+ ] })
148
+ ] }),
149
+ /* @__PURE__ */ e("div", { className: "steps", title: u.steps.join(" → "), children: u.steps.map((w, o) => /* @__PURE__ */ a(V.Fragment, { children: [
150
+ o > 0 && /* @__PURE__ */ e("span", { className: "muted", children: "→" }),
151
+ /* @__PURE__ */ e("span", { className: "chip static", children: ie(w) })
152
+ ] }, o)) }),
153
+ /* @__PURE__ */ a("div", { className: "small muted", children: [
154
+ u.users,
155
+ " users"
156
+ ] }),
157
+ /* @__PURE__ */ e(E, { pct: u.convRate, color: "#10b981" })
158
+ ] }, u.steps.join(">"))) }),
159
+ t === "flows" && /* @__PURE__ */ e("div", { className: "grid", children: f.map((u) => /* @__PURE__ */ a("div", { className: "card", children: [
160
+ /* @__PURE__ */ a("div", { className: "row", children: [
161
+ /* @__PURE__ */ e("strong", { className: "mono", children: u.from }),
162
+ /* @__PURE__ */ e("span", { className: "grow" }),
163
+ /* @__PURE__ */ a("span", { className: "small muted", children: [
164
+ u.total,
165
+ " transitions"
166
+ ] })
167
+ ] }),
168
+ u.destinations.slice(0, 4).map((c) => /* @__PURE__ */ a("div", { children: [
169
+ /* @__PURE__ */ a("div", { className: "row small", children: [
170
+ /* @__PURE__ */ a("span", { className: "mono", children: [
171
+ "→ ",
172
+ c.to
173
+ ] }),
174
+ /* @__PURE__ */ e("span", { className: "grow" }),
175
+ /* @__PURE__ */ a("span", { className: "mono", children: [
176
+ c.pct.toFixed(0),
177
+ "%"
178
+ ] })
179
+ ] }),
180
+ /* @__PURE__ */ e(E, { pct: c.pct })
181
+ ] }, c.to))
182
+ ] }, u.from)) }),
183
+ t === "maps" && /* @__PURE__ */ e(de, { map: i, setMap: g, sessions: n })
184
+ ]
185
+ }
186
+ );
187
+ }, de = ({ map: t, setMap: r, sessions: n }) => {
188
+ const [s, i] = y(""), [g, b] = y("curious"), [v, f] = y([]), [m, p] = y(""), l = () => {
189
+ if (!s.trim()) return p("Stage name is required.");
190
+ if (v.length === 0) return p("Pick at least one touchpoint page.");
191
+ const d = { id: M("st"), name: s.trim(), emotion: g, pages: v };
192
+ r({ ...t, stages: [...t.stages, d] }), i(""), f([]), p("");
193
+ };
194
+ return /* @__PURE__ */ a("div", { className: "stack", children: [
195
+ /* @__PURE__ */ e("input", { className: "input", value: t.name, onChange: (d) => r({ ...t, name: d.target.value }), "aria-label": "Journey name" }),
196
+ /* @__PURE__ */ a("div", { className: "stages", children: [
197
+ t.stages.map((d, u) => {
198
+ const c = oe(n, d.pages), w = W[d.emotion] ?? "#7c3aed";
199
+ return /* @__PURE__ */ a("div", { className: "card stage", children: [
200
+ /* @__PURE__ */ a("div", { className: "row", children: [
201
+ /* @__PURE__ */ e("span", { className: "badge", style: { background: `${w}30`, color: w }, children: u + 1 }),
202
+ /* @__PURE__ */ e("strong", { children: d.name }),
203
+ /* @__PURE__ */ e("span", { className: "grow" }),
204
+ /* @__PURE__ */ e("button", { className: "btn danger", "aria-label": `Remove ${d.name}`, onClick: () => r({ ...t, stages: t.stages.filter((o) => o.id !== d.id) }), children: "✕" })
205
+ ] }),
206
+ d.pages.map((o) => /* @__PURE__ */ a("div", { className: "small mono muted", children: [
207
+ "✓ ",
208
+ o
209
+ ] }, o)),
210
+ /* @__PURE__ */ a("div", { className: "small", style: { color: w }, children: [
211
+ "Emotion: ",
212
+ d.emotion
213
+ ] }),
214
+ /* @__PURE__ */ e(E, { pct: c }),
215
+ /* @__PURE__ */ a("div", { className: "small mono muted", children: [
216
+ c.toFixed(0),
217
+ "% reach"
218
+ ] })
219
+ ] }, d.id);
220
+ }),
221
+ t.stages.length === 0 && /* @__PURE__ */ e("div", { className: "muted", children: "No stages yet. Add one below." })
222
+ ] }),
223
+ /* @__PURE__ */ a("div", { className: "card form", children: [
224
+ /* @__PURE__ */ e("strong", { children: "Add stage" }),
225
+ /* @__PURE__ */ a("div", { className: "row", children: [
226
+ /* @__PURE__ */ e("input", { className: "input", placeholder: "Stage name", value: s, onChange: (d) => i(d.target.value) }),
227
+ /* @__PURE__ */ e("select", { className: "input slim", value: g, onChange: (d) => b(d.target.value), children: Object.keys(W).map((d) => /* @__PURE__ */ e("option", { children: d }, d)) })
228
+ ] }),
229
+ /* @__PURE__ */ e("div", { className: "scale", children: z.map((d) => /* @__PURE__ */ e("button", { type: "button", className: v.includes(d) ? "chip active" : "chip", onClick: () => f((u) => u.includes(d) ? u.filter((c) => c !== d) : [...u, d]), children: d }, d)) }),
230
+ /* @__PURE__ */ a("div", { className: "row", children: [
231
+ /* @__PURE__ */ e("span", { className: "grow" }),
232
+ m && /* @__PURE__ */ e("span", { className: "error", children: m }),
233
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: l, children: "+ Add stage" })
234
+ ] })
235
+ ] })
236
+ ] });
237
+ }, F = (t) => new Date(Date.UTC(2026, 10, 6) - t * 864e5).toISOString(), he = [
238
+ {
239
+ id: "s1",
240
+ name: "Q4 Product Satisfaction",
241
+ description: "How do users feel about the product right now?",
242
+ status: "active",
243
+ target: 100,
244
+ createdAt: F(30),
245
+ questions: [
246
+ { id: "s1q1", type: "nps", text: "How likely are you to recommend us to a colleague?", required: !0 },
247
+ { id: "s1q2", type: "rating", text: "How satisfied are you with the product?", required: !0 },
248
+ { id: "s1q3", type: "multiple_choice", text: "Which feature do you use most?", required: !1, options: ["Feature Flags", "Experiments", "Segments", "Audit Log"] },
249
+ { id: "s1q4", type: "open_text", text: "What is one thing we should improve?", required: !1 }
250
+ ]
251
+ },
252
+ {
253
+ id: "s2",
254
+ name: "Onboarding Experience",
255
+ description: "First-week feedback from new accounts.",
256
+ status: "draft",
257
+ target: 50,
258
+ createdAt: F(5),
259
+ questions: [
260
+ { id: "s2q1", type: "nps", text: "How likely are you to recommend our onboarding?", required: !0 },
261
+ { id: "s2q2", type: "open_text", text: "What was confusing?", required: !1 }
262
+ ]
263
+ }
264
+ ], _ = ["Love the rollout controls", "Dashboards load slowly", "Needs better docs", "Great support", "Too many clicks to create a flag"];
265
+ function ue() {
266
+ const t = B(7);
267
+ return Array.from({ length: 36 }, (r, n) => {
268
+ const s = Math.min(10, Math.floor(t() * t() * 4 + t() * 8 + 3));
269
+ return {
270
+ id: `r${n}`,
271
+ surveyId: "s1",
272
+ userId: `user_${100 + n}`,
273
+ createdAt: F(Math.floor(t() * 28)),
274
+ answers: [
275
+ { questionId: "s1q1", value: s },
276
+ { questionId: "s1q2", value: Math.max(1, Math.min(5, Math.round(s / 2))) },
277
+ { questionId: "s1q3", value: ["Feature Flags", "Experiments", "Segments", "Audit Log"][Math.floor(t() * 4)] },
278
+ { questionId: "s1q4", value: _[Math.floor(t() * _.length)] }
279
+ ]
280
+ };
281
+ });
282
+ }
283
+ const H = (t) => t >= 9 ? "promoter" : t >= 7 ? "passive" : "detractor";
284
+ function $(t) {
285
+ if (t.length === 0) return null;
286
+ const r = t.filter((s) => s >= 9).length, n = t.filter((s) => s <= 6).length;
287
+ return {
288
+ score: Math.round((r - n) / t.length * 100),
289
+ promoters: r,
290
+ passives: t.length - r - n,
291
+ detractors: n,
292
+ total: t.length
293
+ };
294
+ }
295
+ function J(t, r) {
296
+ const n = t.questions.find((s) => s.type === "nps");
297
+ return n ? r.filter((s) => s.surveyId === t.id).map((s) => {
298
+ var i;
299
+ return (i = s.answers.find((g) => g.questionId === n.id)) == null ? void 0 : i.value;
300
+ }).filter((s) => typeof s == "number") : [];
301
+ }
302
+ const me = ["nps", "rating", "multiple_choice", "open_text"], Q = (t) => new Date(t).toLocaleDateString(void 0, { day: "2-digit", month: "short", year: "numeric" }), pe = () => {
303
+ const [t, r] = y(he), [n, s] = y(ue), [i, g] = y({ name: "list" }), b = (l) => t.find((d) => d.id === l), v = () => g({ name: "list" });
304
+ if (i.name === "create")
305
+ return /* @__PURE__ */ e(
306
+ ge,
307
+ {
308
+ onCancel: v,
309
+ onSave: (l) => {
310
+ r((d) => [l, ...d]), v();
311
+ }
312
+ }
313
+ );
314
+ if (i.name === "take") {
315
+ const l = b(i.id);
316
+ return l ? /* @__PURE__ */ e(
317
+ ve,
318
+ {
319
+ survey: l,
320
+ onCancel: v,
321
+ onSubmit: (d) => {
322
+ s((u) => [{ id: M("r"), surveyId: l.id, userId: `user_${900 + u.length}`, createdAt: (/* @__PURE__ */ new Date()).toISOString(), answers: d }, ...u]), g({ name: "results", id: l.id });
323
+ }
324
+ }
325
+ ) : null;
326
+ }
327
+ if (i.name === "results") {
328
+ const l = b(i.id);
329
+ return l ? /* @__PURE__ */ e(be, { survey: l, responses: n.filter((d) => d.surveyId === l.id), onBack: v, onTake: () => g({ name: "take", id: l.id }) }) : null;
330
+ }
331
+ const f = n.length, m = t.filter((l) => l.status === "active").length, p = $(t.flatMap((l) => J(l, n)));
332
+ return /* @__PURE__ */ a(
333
+ I,
334
+ {
335
+ title: "Surveys",
336
+ subtitle: "Create, run and measure user surveys.",
337
+ actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => g({ name: "create" }), children: "+ Create Survey" }),
338
+ children: [
339
+ /* @__PURE__ */ a("div", { className: "stats", children: [
340
+ /* @__PURE__ */ e(C, { label: "Total surveys", value: t.length, color: "#6366f1" }),
341
+ /* @__PURE__ */ e(C, { label: "Active", value: m, color: "#10b981" }),
342
+ /* @__PURE__ */ e(C, { label: "Total responses", value: f }),
343
+ /* @__PURE__ */ e(C, { label: "Overall NPS", value: p ? p.score : "—", color: "#f59e0b" })
344
+ ] }),
345
+ /* @__PURE__ */ a("table", { className: "table", children: [
346
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
347
+ /* @__PURE__ */ e("th", { children: "Survey" }),
348
+ /* @__PURE__ */ e("th", { children: "Status" }),
349
+ /* @__PURE__ */ e("th", { children: "Progress" }),
350
+ /* @__PURE__ */ e("th", { children: "NPS" }),
351
+ /* @__PURE__ */ e("th", { children: "Created" }),
352
+ /* @__PURE__ */ e("th", {})
353
+ ] }) }),
354
+ /* @__PURE__ */ e("tbody", { children: t.map((l) => {
355
+ const d = n.filter((c) => c.surveyId === l.id).length, u = $(J(l, n));
356
+ return /* @__PURE__ */ a("tr", { children: [
357
+ /* @__PURE__ */ a("td", { children: [
358
+ /* @__PURE__ */ e("strong", { children: l.name }),
359
+ /* @__PURE__ */ a("div", { className: "muted small", children: [
360
+ l.questions.length,
361
+ " questions"
362
+ ] })
363
+ ] }),
364
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
365
+ "select",
366
+ {
367
+ className: "input slim",
368
+ value: l.status,
369
+ onChange: (c) => r((w) => w.map((o) => o.id === l.id ? { ...o, status: c.target.value } : o)),
370
+ children: ["draft", "active", "paused", "closed"].map((c) => /* @__PURE__ */ e("option", { children: c }, c))
371
+ }
372
+ ) }),
373
+ /* @__PURE__ */ a("td", { style: { minWidth: 140 }, children: [
374
+ /* @__PURE__ */ a("div", { className: "small mono", children: [
375
+ d,
376
+ " / ",
377
+ l.target
378
+ ] }),
379
+ /* @__PURE__ */ e(E, { pct: d / l.target * 100 })
380
+ ] }),
381
+ /* @__PURE__ */ e("td", { className: "mono", children: u ? u.score : "—" }),
382
+ /* @__PURE__ */ e("td", { className: "muted small", children: Q(l.createdAt) }),
383
+ /* @__PURE__ */ a("td", { className: "right", children: [
384
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => g({ name: "results", id: l.id }), children: "Results" }),
385
+ " ",
386
+ /* @__PURE__ */ e("button", { className: "btn", disabled: l.status !== "active", title: l.status !== "active" ? "Set status to active to collect answers" : "", onClick: () => g({ name: "take", id: l.id }), children: "Take" }),
387
+ " ",
388
+ /* @__PURE__ */ e(
389
+ "button",
390
+ {
391
+ className: "btn danger",
392
+ onClick: () => {
393
+ window.confirm(`Delete "${l.name}" and its responses?`) && (r((c) => c.filter((w) => w.id !== l.id)), s((c) => c.filter((w) => w.surveyId !== l.id)));
394
+ },
395
+ children: "Delete"
396
+ }
397
+ )
398
+ ] })
399
+ ] }, l.id);
400
+ }) })
401
+ ] })
402
+ ]
403
+ }
404
+ );
405
+ }, ge = ({ onSave: t, onCancel: r }) => {
406
+ const [n, s] = y(""), [i, g] = y(""), [b, v] = y(100), [f, m] = y([{ id: M("q"), type: "nps", text: "How likely are you to recommend us?", required: !0 }]), [p, l] = y(""), d = (c, w) => m((o) => o.map((h) => h.id === c ? { ...h, ...w } : h)), u = () => {
407
+ if (!n.trim()) return l("Survey name is required.");
408
+ if (f.length === 0) return l("Add at least one question.");
409
+ if (f.some((c) => !c.text.trim())) return l("Every question needs text.");
410
+ if (f.some((c) => c.type === "multiple_choice" && (c.options ?? []).filter((w) => w.trim()).length < 2)) return l("Multiple choice needs at least two options.");
411
+ t({
412
+ id: M("s"),
413
+ name: n.trim(),
414
+ description: i.trim(),
415
+ status: "active",
416
+ target: b,
417
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
418
+ questions: f.map((c) => ({ ...c, text: c.text.trim(), options: c.type === "multiple_choice" ? (c.options ?? []).filter((w) => w.trim()) : void 0 }))
419
+ });
420
+ };
421
+ return /* @__PURE__ */ a(I, { title: "Create Survey", subtitle: "Build a new survey.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: r, children: "Back" }), children: [
422
+ /* @__PURE__ */ a("div", { className: "card form", children: [
423
+ /* @__PURE__ */ a("label", { children: [
424
+ "Name",
425
+ /* @__PURE__ */ e("input", { className: "input", value: n, onChange: (c) => s(c.target.value), placeholder: "e.g. Q1 Product Satisfaction" })
426
+ ] }),
427
+ /* @__PURE__ */ a("label", { children: [
428
+ "Description",
429
+ /* @__PURE__ */ e("input", { className: "input", value: i, onChange: (c) => g(c.target.value) })
430
+ ] }),
431
+ /* @__PURE__ */ a("label", { children: [
432
+ "Target responses",
433
+ /* @__PURE__ */ e("input", { className: "input narrow", type: "number", min: 1, value: b, onChange: (c) => v(Math.max(1, parseInt(c.target.value, 10) || 1)) })
434
+ ] })
435
+ ] }),
436
+ /* @__PURE__ */ a("h3", { children: [
437
+ "Questions (",
438
+ f.length,
439
+ ")"
440
+ ] }),
441
+ f.map((c, w) => /* @__PURE__ */ a("div", { className: "card form", children: [
442
+ /* @__PURE__ */ a("div", { className: "row", children: [
443
+ /* @__PURE__ */ a("strong", { children: [
444
+ "Q",
445
+ w + 1
446
+ ] }),
447
+ /* @__PURE__ */ e("select", { className: "input slim", value: c.type, onChange: (o) => d(c.id, { type: o.target.value, options: o.target.value === "multiple_choice" ? ["Option 1", "Option 2"] : void 0 }), children: me.map((o) => /* @__PURE__ */ e("option", { value: o, children: o.replace("_", " ") }, o)) }),
448
+ /* @__PURE__ */ a("label", { className: "inline", children: [
449
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: c.required, onChange: (o) => d(c.id, { required: o.target.checked }) }),
450
+ " required"
451
+ ] }),
452
+ /* @__PURE__ */ e("span", { className: "grow" }),
453
+ /* @__PURE__ */ e("button", { className: "btn danger", onClick: () => m((o) => o.filter((h) => h.id !== c.id)), children: "Remove" })
454
+ ] }),
455
+ /* @__PURE__ */ e("input", { className: "input", value: c.text, onChange: (o) => d(c.id, { text: o.target.value }), placeholder: "Enter your question…" }),
456
+ c.type === "multiple_choice" && /* @__PURE__ */ a("div", { className: "stack", children: [
457
+ (c.options ?? []).map((o, h) => /* @__PURE__ */ e("input", { className: "input slim", value: o, onChange: (N) => d(c.id, { options: (c.options ?? []).map((x, D) => D === h ? N.target.value : x) }) }, h)),
458
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => d(c.id, { options: [...c.options ?? [], `Option ${(c.options ?? []).length + 1}`] }), children: "+ Add option" })
459
+ ] })
460
+ ] }, c.id)),
461
+ /* @__PURE__ */ a("div", { className: "row", children: [
462
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => m((c) => [...c, { id: M("q"), type: "rating", text: "", required: !1 }]), children: "+ Add question" }),
463
+ /* @__PURE__ */ e("span", { className: "grow" }),
464
+ p && /* @__PURE__ */ e("span", { className: "error", children: p }),
465
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: u, children: "Create Survey" })
466
+ ] })
467
+ ] });
468
+ }, ve = ({ survey: t, onSubmit: r, onCancel: n }) => {
469
+ const [s, i] = y({}), [g, b] = y(""), v = (m, p) => i((l) => ({ ...l, [m]: p })), f = () => {
470
+ const m = t.questions.find((p) => p.required && (s[p.id] === void 0 || s[p.id] === ""));
471
+ if (m) return b(`"${m.text}" is required.`);
472
+ b(""), r(t.questions.filter((p) => s[p.id] !== void 0 && s[p.id] !== "").map((p) => ({ questionId: p.id, value: s[p.id] })));
473
+ };
474
+ return /* @__PURE__ */ a(I, { title: t.name, subtitle: t.description || "Answer the questions below.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: n, children: "Cancel" }), children: [
475
+ t.questions.map((m, p) => /* @__PURE__ */ a("div", { className: "card form", children: [
476
+ /* @__PURE__ */ a("strong", { children: [
477
+ p + 1,
478
+ ". ",
479
+ m.text,
480
+ m.required && /* @__PURE__ */ e("span", { className: "error", children: " *" })
481
+ ] }),
482
+ m.type === "nps" && /* @__PURE__ */ e("div", { className: "scale", children: Array.from({ length: 11 }, (l, d) => /* @__PURE__ */ e("button", { className: s[m.id] === d ? "chip active" : "chip", onClick: () => v(m.id, d), children: d }, d)) }),
483
+ m.type === "rating" && /* @__PURE__ */ e("div", { className: "scale", children: [1, 2, 3, 4, 5].map((l) => /* @__PURE__ */ a("button", { className: s[m.id] === l ? "chip active" : "chip", onClick: () => v(m.id, l), children: [
484
+ l,
485
+ " ★"
486
+ ] }, l)) }),
487
+ m.type === "multiple_choice" && /* @__PURE__ */ e("div", { className: "scale", children: (m.options ?? []).map((l) => /* @__PURE__ */ e("button", { className: s[m.id] === l ? "chip active" : "chip", onClick: () => v(m.id, l), children: l }, l)) }),
488
+ m.type === "open_text" && /* @__PURE__ */ e("textarea", { className: "input", rows: 2, value: String(s[m.id] ?? ""), onChange: (l) => v(m.id, l.target.value) })
489
+ ] }, m.id)),
490
+ /* @__PURE__ */ a("div", { className: "row", children: [
491
+ /* @__PURE__ */ e("span", { className: "grow" }),
492
+ g && /* @__PURE__ */ e("span", { className: "error", children: g }),
493
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: f, children: "Submit response" })
494
+ ] })
495
+ ] });
496
+ }, be = ({ survey: t, responses: r, onBack: n, onTake: s }) => {
497
+ const i = S(() => $(J(t, r)), [t, r]), g = t.questions.find((v) => v.type === "nps"), b = (v) => i ? Math.round(v / i.total * 100) : 0;
498
+ return /* @__PURE__ */ a(
499
+ I,
500
+ {
501
+ title: t.name,
502
+ subtitle: `${r.length} responses`,
503
+ actions: /* @__PURE__ */ a(j, { children: [
504
+ /* @__PURE__ */ e("button", { className: "btn", onClick: n, children: "Back" }),
505
+ /* @__PURE__ */ e("button", { className: "btn primary", disabled: t.status !== "active", onClick: s, children: "Take survey" })
506
+ ] }),
507
+ children: [
508
+ /* @__PURE__ */ a("div", { className: "stats", children: [
509
+ /* @__PURE__ */ e(C, { label: "NPS", value: i ? i.score : "—", color: "#f59e0b" }),
510
+ /* @__PURE__ */ e(C, { label: "Promoters", value: i ? `${b(i.promoters)}%` : "—", color: "#4edea3" }),
511
+ /* @__PURE__ */ e(C, { label: "Passives", value: i ? `${b(i.passives)}%` : "—", color: "#ffcc6b" }),
512
+ /* @__PURE__ */ e(C, { label: "Detractors", value: i ? `${b(i.detractors)}%` : "—", color: "#ffb4ab" })
513
+ ] }),
514
+ /* @__PURE__ */ a("table", { className: "table", children: [
515
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
516
+ /* @__PURE__ */ e("th", { children: "User" }),
517
+ /* @__PURE__ */ e("th", { children: "NPS" }),
518
+ t.questions.filter((v) => v.type !== "nps").map((v) => /* @__PURE__ */ e("th", { children: v.text }, v.id)),
519
+ /* @__PURE__ */ e("th", { children: "Date" })
520
+ ] }) }),
521
+ /* @__PURE__ */ a("tbody", { children: [
522
+ r.length === 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 9, className: "muted", children: "No responses yet." }) }),
523
+ r.map((v) => {
524
+ var m;
525
+ const f = g ? (m = v.answers.find((p) => p.questionId === g.id)) == null ? void 0 : m.value : void 0;
526
+ return /* @__PURE__ */ a("tr", { children: [
527
+ /* @__PURE__ */ e("td", { className: "mono", children: v.userId }),
528
+ /* @__PURE__ */ e("td", { children: typeof f == "number" ? /* @__PURE__ */ a("span", { className: `pill ${H(f)}`, children: [
529
+ f,
530
+ " · ",
531
+ H(f)
532
+ ] }) : "—" }),
533
+ t.questions.filter((p) => p.type !== "nps").map((p) => {
534
+ var l;
535
+ return /* @__PURE__ */ e("td", { children: String(((l = v.answers.find((d) => d.questionId === p.id)) == null ? void 0 : l.value) ?? "—") }, p.id);
536
+ }),
537
+ /* @__PURE__ */ e("td", { className: "muted small", children: Q(v.createdAt) })
538
+ ] }, v.id);
539
+ })
540
+ ] })
541
+ ] })
542
+ ]
543
+ }
544
+ );
545
+ }, Me = () => {
546
+ const [t, r] = y("survey");
547
+ return /* @__PURE__ */ a("div", { className: "shell", children: [
548
+ /* @__PURE__ */ a("header", { className: "topbar", children: [
549
+ /* @__PURE__ */ e("strong", { children: "POC" }),
550
+ /* @__PURE__ */ e(q, { items: [{ id: "survey", label: "Survey" }, { id: "journey", label: "User Journey" }], value: t, onChange: r })
551
+ ] }),
552
+ /* @__PURE__ */ e("main", { children: t === "survey" ? /* @__PURE__ */ e(pe, {}) : /* @__PURE__ */ e(ce, {}) })
553
+ ] });
554
+ }, A = [
555
+ {
556
+ id: "journey-maps",
557
+ title: "Journey Maps",
558
+ route: "/app/journeymap",
559
+ nav: "Journey Maps (order 1)",
560
+ icon: "🗺️",
561
+ lead: "Visual journey maps with emotional context. Each map is a named journey made of ordered stages, and each stage has an emotion, a completion percentage and touchpoints.",
562
+ explain: [
563
+ "A journey map describes an experience from the user's point of view, for example “New User Onboarding”. It is split into <strong>stages</strong> in order (Discover, Sign up, First flag…). Inside each stage you list the <strong>touchpoints</strong>, the places the user meets the product, and tag how the user feels with an <strong>emotion</strong>.",
564
+ "Unlike the other three pages, which are generated from tracked traffic, Journey Maps are authored by your team. They give context to the numbers on Paths, User Flows and Navigation Analysis."
565
+ ],
566
+ questions: ["Where in the experience do users feel cautious or frustrated?", "Which stage has the lowest completion?", "Which touchpoints belong to each stage?"],
567
+ header: "Title “Journey Maps”, subtitle “analytics · visual journey maps with emotional context”. Actions: Refresh (refetches the list) and Create journey (opens the Create Journey modal).",
568
+ stats: [["Total journeys", "Map", "Count of all journey maps"], ["Total stages", "Layers", "Stages across all loaded maps"], ["Avg completion", "CheckCircle2", "Average stage completion %, “—” when there are no stages"]],
569
+ controls: [
570
+ "Cards instead of a table: one card per journey map, showing its stages with the emotion colour",
571
+ "Infinite loading with a cursor (page size 20)",
572
+ "Search and status are sent to the API as <code>search</code> and <code>status</code>",
573
+ "Delete icon on each card opens a “Delete journey map?” confirmation; the card disappears instantly and comes back if the call fails",
574
+ "Create journey opens the modal described below"
575
+ ],
576
+ columns: null,
577
+ states: ["<strong>Loading:</strong> a skeleton of cards (<code>JourneySkeleton</code>); stat cards show “—”", "<strong>Error:</strong> “Failed to load journey maps” with a retry (Refresh) action", "<strong>Empty:</strong> “No journey maps yet”, with a hint to create one to visualise user experiences with emotional context"],
578
+ colors: [
579
+ "Stage chip: emotion colour as text, the same colour at about 15% opacity as background; falls back to accent <code>#7c3aed</code>",
580
+ "Emotion presets and colours: Curious <code>#adc6ff</code>, Engaged <code>#7c3aed</code>, Excited <code>#4edea3</code>, Satisfied <code>#ffcc6b</code>, Loyal <code>#d2bbff</code>, Cautious <code>#ffcc6b</code>, Confident <code>#4edea3</code>, Analytical <code>#7c3aed</code>"
581
+ ],
582
+ extraTitle: "Create Journey modal",
583
+ extra: [
584
+ "<strong>Name</strong> (placeholder “e.g. New User Onboarding”) and <strong>Description</strong> (“Describe this journey…”)",
585
+ "<strong>Stages</strong>: add as many as needed. Each has a name (“Stage 1 name”), one emotion preset and one or more touchpoints",
586
+ "Each new stage starts as Curious with one empty touchpoint",
587
+ "Saving calls <code>createMap</code>, refreshes the list and shows a success toast; a failure shows an error toast and keeps the modal data"
588
+ ],
589
+ api: [["GET", "/JSON/events/GetJourneyMapsQuery.json", "listMaps({cursor, pageSize, search, status})"], ["POST", "/journeys/maps", "createMap({name, description, stages[]})"], ["DELETE", "/journeys/maps/:id", "deleteMap(id)"]],
590
+ types: [["JourneyMapItem", "id, name, description, userCount, avgTime, status, createdAt, updatedAt, stages[]"], ["JourneyStageItem", "id, position, name, emotion, emotionColor, completionPct, touchpoints[]"], ["JourneyTouchpointItem", "id, position, label"]],
591
+ hooks: "useJourneyMaps, useCreateJourneyMap, useDeleteJourneyMap"
592
+ },
593
+ {
594
+ id: "navigation-analysis",
595
+ title: "Navigation Analysis",
596
+ route: "/app/navigationanalysis",
597
+ nav: "Navigation Analysis (order 2)",
598
+ icon: "🧭",
599
+ lead: "Page performance and navigation patterns. One row per page path with views, time on page, bounce rate, exit rate and trend.",
600
+ explain: [
601
+ "This page answers “how is each page performing?”. Every row is one page path, with how often it was viewed, how long people stay, how many leave after one page (<strong>bounce</strong>) and how many leave the product from it (<strong>exit</strong>).",
602
+ "The four stat cards summarise the whole list, and the table lets you find the pages that need attention by sorting on bounce or exit."
603
+ ],
604
+ questions: ["Which pages get the most views?", "Which pages lose users (high bounce or exit rate)?", "Is a page getting better or worse over time (trend)?"],
605
+ header: "Title “Navigation Analysis”, subtitle “Page performance and navigation patterns.”. Secondary action: Refresh.",
606
+ stats: [["Total pages", "Navigation", "Number of tracked pages"], ["Total views", "Eye", "Sum of views, shown short (1,200 → 1.2K)"], ["Avg bounce rate", "LogOut", "Average bounce %; the card colour follows the bounce rule below"], ["Top page", "Star", "Page with the most views"]],
607
+ controls: [
608
+ "Search by page path",
609
+ "Sort: Views high→low, Bounce rate high→low, Exit rate high→low, Page A–Z",
610
+ "Filter Trend: All, Improving, Declining, Stable",
611
+ "Filter Bounce: All, High (&gt; 25%), Medium (15–25%), Low (≤ 15%)",
612
+ "Table sits in the page's split layout, which can show a 320px detail drawer on wide screens"
613
+ ],
614
+ columns: [["Page", "pagePath", "UJNavPageCell"], ["Views", "viewCount", "UJNavViewsCell"], ["Avg time", "avgTimeFormatted", "UJNavAvgTimeCell"], ["Bounce rate", "bounceRate", "UJBounceCell"], ["Exit rate", "exitRate", "UJExitRateCell"], ["Trend", "trend", "UJTrendCell"]],
615
+ states: ["<strong>Loading:</strong> the DataTable shows its loading state; stat cards show “—”", "<strong>Empty:</strong> “No navigation data yet.”"],
616
+ colors: [
617
+ "Bounce rule: above 25% red <code>#ffb4ab</code>, above 15% amber <code>#ffcc6b</code>, otherwise green <code>#4edea3</code>",
618
+ "Bounce cell is a small bar (width = rate, capped at 100%) plus the percentage in the same colour",
619
+ "Trend: improving = trending-up icon in the success colour, declining = trending-down in the soft danger colour, stable = a muted dash",
620
+ "Exit rate is plain muted text"
621
+ ],
622
+ extraTitle: null,
623
+ extra: null,
624
+ api: [["GET", "/JSON/events/GetNavigationAnalysisQuery.json", "getNavigation({sortBy, sortOrder})"]],
625
+ types: [["NavigationPageItem", "id, pagePath, viewCount, avgTimeFormatted, bounceRate, exitRate, trend (up | down | stable), date"], ["NavigationSummary", "totalPages, totalViews, avgBounceRate, topPage"], ["NavigationAnalysisResponse", "pages[], summary"]],
626
+ hooks: "useNavigationAnalysis (with useTableData / useTableConfig)"
627
+ },
628
+ {
629
+ id: "paths",
630
+ title: "Paths",
631
+ route: "/app/path",
632
+ nav: "Path (order 3)",
633
+ icon: "🔀",
634
+ lead: "Top user navigation paths. Each path is an ordered list of pages with how many users took it, how many converted and how long it took.",
635
+ explain: [
636
+ "A <strong>path</strong> is the exact sequence of pages a group of users visited, for example <code>home → flags → create</code>. The page ranks paths so you can see which routes are popular and which ones actually end in a conversion.",
637
+ "You can read the data two ways: as a dense <strong>Table</strong> for comparing numbers, or as a <strong>List</strong> of cards that is faster to scan. Both views share the same search, sort and filters and the same selected path."
638
+ ],
639
+ questions: ["What are the most common routes through the product?", "Which route converts best?", "Do the popular paths also convert, or do they just take a lot of time?"],
640
+ header: "Title “Paths”, subtitle “Top user navigation paths.”. Secondary action: Refresh. A Table / List toggle sits above the content.",
641
+ stats: [["Total paths", "Route", "Number of distinct paths"], ["Users in paths", "Users", "Total users, shown in thousands (K)"], ["Best conversion", "MousePointer", "Highest conversion % among paths"]],
642
+ controls: [
643
+ "Table / List toggle: the table uses the shared DataTable, the list is a scrollable card grid in the accent colour <code>#7c3aed</code>",
644
+ "Search by path",
645
+ "Sort: Users high→low, Conversion high→low, Avg time longest first",
646
+ "Filter Conversion: High (≥ 50%), Medium (20–50%), Low (&lt; 20%)",
647
+ "List cards show a pulsing status dot, a conversion pill, short step names (first 3, then +N) and a sparkline when trend data exists; the full path is in the tooltip",
648
+ "Click a row or card to select it; the selected card gets an accent border"
649
+ ],
650
+ columns: [["Path", "steps", "UJPathStepsCell"], ["Users", "userCount", "UJPathUsersCell"], ["Conversion", "convRate", "UJPathConvCell"], ["Avg time", "avgTimeFormatted", "UJPathAvgTimeCell"]],
651
+ states: ["<strong>Loading:</strong> “Loading…” in the list view; the table shows its loading state", "<strong>Empty:</strong> “No path data yet.”"],
652
+ colors: [
653
+ "Step dots cycle green, blue, purple (<code>78, 222, 163</code>, <code>173, 198, 255</code>, <code>210, 187, 255</code>)",
654
+ "Conversion bar and text use the colour supplied with each path (<code>color</code> field)",
655
+ "The active card uses the accent border and a light accent background"
656
+ ],
657
+ extraTitle: null,
658
+ extra: null,
659
+ api: [["GET", "/JSON/events/GetPathsQuery.json", "getPaths({sortBy, sortOrder})"]],
660
+ types: [["UserPathItem (PathRow)", "id, pathLabel, color, userCount, convRate, avgTimeFormatted, steps[], date"], ["PathsSummary", "totalPaths, totalUsers, bestConvRate, bestConvPath"], ["PathsResponse", "paths[], summary"]],
661
+ hooks: "usePaths"
662
+ },
663
+ {
664
+ id: "user-flows",
665
+ title: "User Flows",
666
+ route: "/app/userflows",
667
+ nav: "Userflows (order 3)",
668
+ icon: "🔁",
669
+ lead: "Where users go next from each page. Every source page lists its destination pages with the share of users going to each.",
670
+ explain: [
671
+ "Paths follow a whole route; <strong>User Flows</strong> look one step ahead. For each source page you see the pages users go to next and what percentage goes to each, sorted from the biggest share to the smallest.",
672
+ "A page with one dominant destination has a clear next step. A page where the shares are spread out has users unsure where to go."
673
+ ],
674
+ questions: ["Where do users go after this page?", "Is there one clear next step, or do users scatter?", "Which pages send users to the most different destinations?"],
675
+ header: "Title “User Flows”, subtitle “analytics · where users go next from each page”. Table / List toggle as on Paths.",
676
+ stats: [["Source pages", "GitFork", "Number of source pages"], ["Total destinations", "Footprints", "All destination links across flows"], ["Avg top share", "CheckCircle2", "Average share of each page's top destination"]],
677
+ controls: [
678
+ "Table / List toggle with the same card design as Paths; the list view has its own sort bar (Top share, Destinations, Page) because DataTable sorting only applies to the table",
679
+ "Search by page or destination (destination names are part of the search text)",
680
+ "Sort: Top share high→low, Destinations most first, Page A–Z",
681
+ "Filter Top destination share: High (≥ 60%), Medium (30–60%), Low (&lt; 30%)",
682
+ "List cards show the page name, its top destination and a bar per destination with a tooltip “page · percentage”"
683
+ ],
684
+ columns: [["From page", "fromPage", "UJFlowFromCell"], ["Top destinations", "destinations", "UJFlowDestsCell"], ["Destinations", "destinationCount", "UJFlowCountCell"], ["Top share", "topPercentage", "UJFlowShareCell"]],
685
+ states: ["<strong>Loading:</strong> stat cards show “—” and the view shows its loading state", "<strong>Empty:</strong> the stat cards stay empty and the avg top share shows “—” when there are no flows"],
686
+ colors: [
687
+ "Top share rule: 60% or more purple <code>#7c3aed</code>, 30% or more indigo <code>#6366f1</code>, otherwise sky <code>#0ea5e9</code>",
688
+ "Destination bars cycle green, blue, purple like the path steps"
689
+ ],
690
+ extraTitle: null,
691
+ extra: null,
692
+ api: [["GET", "/JSON/events/GetUserFlowsQuery.json", "getFlows()"]],
693
+ types: [["UserFlowItem", "fromPage, destinations[]"], ["FlowDestination", "toPage, percentage, position"], ["FlowRow", "id, fromPage, destinations (sorted high→low), destinationCount, topDestination, topPercentage, destinationsText"]],
694
+ hooks: "useFlows"
695
+ }
696
+ ], T = (t) => `<span class="ujd-sw" style="background:${t}"></span>`, fe = [
697
+ ['<a data-go="journey-maps">Journey Maps</a>', "The designed experience: stages, touchpoints and emotions", "One journey map"],
698
+ ['<a data-go="navigation-analysis">Navigation Analysis</a>', "How each page performs", "One page path"],
699
+ ['<a data-go="paths">Paths</a>', "The full routes users take", "One path (a list of steps)"],
700
+ ['<a data-go="user-flows">User Flows</a>', "What users do next from a page", "One source page and its destinations"]
701
+ ], we = [
702
+ ["Header", "Title, subtitle and actions", "Refresh uses the <code>RefreshCw</code> icon"],
703
+ ["StatCard", "One summary number", "Props: <code>icon</code>, <code>label</code>, <code>value</code>, <code>color</code>, <code>trendDirection</code>; all four pages use <code>neutral</code>"],
704
+ ["DataTable", "Search, sort, filter and columns", "Configured by each page's <code>*Table.config.ts</code>"],
705
+ ["Card", "Surface for panels and list cards", "Reads the card theme tokens"],
706
+ ["Layout (SCSS)", "<code>userjourneyPage.module.scss</code>", "Wrapper, stats grid (auto-fit, min 210px) and an optional 320px detail drawer shown at 1280px and wider"]
707
+ ], ye = [
708
+ ["<code>--th-text-1</code>", "Main text", "black", "light grey-white"],
709
+ ["<code>--th-text-3</code>", "Muted text, labels, empty states", "mid grey", "soft grey"],
710
+ ["<code>--th-surface-2</code>", "Inputs and the toggle background", "light grey", "slightly lighter than the card"],
711
+ ["<code>--th-border-2</code>", "Input and divider borders", "light grey line", "subtle light line"],
712
+ ["<code>--th-accent-soft</code>", "Pills and highlights on the accent", "deep purple", "pale purple"],
713
+ ["<code>--th-ov-base</code>", "Base for hover and track overlays (mixed at 3–15% opacity)", "black", "white"],
714
+ ["<code>--th-success</code> / <code>--th-danger-soft</code>", "Trend icons", "green / soft red", "green / soft red"]
715
+ ], Ne = [
716
+ ["<code>--card-bg</code>", "<code>#ffffff</code>", "<code>var(--bg-card, #161922)</code>"],
717
+ ["<code>--card-border</code>", "transparent", "<code>rgba(255,255,255,0.08)</code>"],
718
+ ["<code>--card-ring</code>", "none", "1px ring of the same white 8%"],
719
+ ["<code>--card-shadow</code>", "soft two-layer shadow", "darker shadow so cards lift off the page"],
720
+ ["<code>--card-shadow-hover</code>", "shadow with a faint indigo glow", "deeper shadow"]
721
+ ], ke = [
722
+ [`${T("#7c3aed")}Accent`, "<code>#7c3aed</code>", "Active toggle, selected card border, high top share, primary buttons"],
723
+ [`${T("#4edea3")}Good`, "<code>#4edea3</code>", "Low bounce, first step dot, Excited / Confident"],
724
+ [`${T("#ffcc6b")}Warning`, "<code>#ffcc6b</code>", "Medium bounce, Satisfied / Cautious"],
725
+ [`${T("#ffb4ab")}Alert`, "<code>#ffb4ab</code>", "High bounce"],
726
+ [`${T("#adc6ff")}Blue`, "<code>#adc6ff</code>", "Second step dot, Curious"],
727
+ [`${T("#d2bbff")}Lilac`, "<code>#d2bbff</code>", "Third step dot, Loyal"],
728
+ [`${T("#6366f1")}Indigo / ${T("#0ea5e9")}Sky`, "<code>#6366f1</code> / <code>#0ea5e9</code>", "Medium and low top share; stat card icons"]
729
+ ], Ce = [
730
+ ["<code>--text-caption</code>", "12px", "Table headers, meta labels, timestamps"],
731
+ ["<code>--text-body-sm</code>", "13px", "Table cells, toolbar text"],
732
+ ["<code>--text-body</code>", "14px", "Paragraph text"],
733
+ ["<code>--text-subhead</code>", "15px", "Section headings, card titles"],
734
+ ["<code>--text-title</code>", "16px", "Stat values"],
735
+ ["<code>--text-heading</code>", "20px", "Page titles"]
736
+ ], Te = [
737
+ ["Why do the stat cards show “—”?", "The data is still loading, or the response has no rows. They fill in once the summary arrives."],
738
+ ["A page gives a 404", "Register its route in <code>routes.ts</code> and its menu item in <code>nav.ts</code>."],
739
+ ["A table cell is empty", "The column's <code>cellType</code> does not match a registered renderer name. They must match exactly."],
740
+ ["Cards look flat or have no border in a theme", "Make sure <code>card-theme.css</code> is imported once in the global entry."],
741
+ ["Why does User Flows list view have its own sort bar?", "DataTable sorting only applies to the table view, so the list view needs its own controls."],
742
+ ["The numbers never change", "The API currently reads static JSON files; switch to the real endpoints to see live data."],
743
+ ["Colours look wrong after a theme change", "Check that the colour reads a <code>--th-*</code> or <code>--card-*</code> variable instead of a fixed value."]
744
+ ], xe = [
745
+ ["Path", "The ordered list of pages a group of users visited"],
746
+ ["Step", "One page inside a path"],
747
+ ["Conversion rate", "Share of users on a path who reached the goal"],
748
+ ["Bounce rate", "Share of visits that leave after viewing only one page"],
749
+ ["Exit rate", "Share of views of a page that were the last page of the visit"],
750
+ ["Top share", "The percentage of users going to a page's most common next destination"],
751
+ ["Touchpoint", "A place in a stage where the user meets the product"],
752
+ ["Emotion", "How users feel at a stage; shown with a preset colour"],
753
+ ["Stage completion", "Percentage that completes a journey stage"]
754
+ ], Se = `userjourney/
755
+ ├─ pages/
756
+ │ ├─ Journeymaps/ Journey Maps
757
+ │ ├─ Navigationanalysis/ Navigation Analysis
758
+ │ ├─ Path/ Paths
759
+ │ └─ Userflows/ User Flows
760
+ ├─ Hooks/ useJourneys, useTableConfig, useTableData
761
+ ├─ services/api/ journeys.api.ts, TableConfigDto.ts
762
+ ├─ types/ journeys.types.ts
763
+ ├─ cells/ UserjourneyCells.tsx, FlowCells.tsx
764
+ ├─ Components/ CreateJourneyModal.tsx
765
+ ├─ nav.ts · routes.ts`, R = ({ html: t, as: r = "span" }) => /* @__PURE__ */ e(r, { dangerouslySetInnerHTML: { __html: t } }), k = ({ head: t, rows: r }) => /* @__PURE__ */ e("div", { className: "ujd-table-wrap", children: /* @__PURE__ */ a("table", { className: "ujd-table", children: [
766
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: t.map((n) => /* @__PURE__ */ e("th", { children: n }, n)) }) }),
767
+ /* @__PURE__ */ e("tbody", { children: r.map((n, s) => /* @__PURE__ */ e("tr", { children: n.map((i, g) => /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(R, { html: i }) }, g)) }, s)) })
768
+ ] }) }), O = ({ items: t }) => /* @__PURE__ */ e("ul", { children: t.map((r, n) => /* @__PURE__ */ e(R, { as: "li", html: r }, n)) }), Ae = (t) => t === "GET" ? "ujd-get" : t === "POST" ? "ujd-post" : t === "DELETE" ? "ujd-del" : "", P = (t) => `<code>${t}</code>`, je = ({ p: t }) => {
769
+ const r = [], n = (s, i, g) => (r.push([`${t.id}-${s}`, i]), /* @__PURE__ */ a(j, { children: [
770
+ /* @__PURE__ */ e("h3", { id: `${t.id}-${s}`, children: i }),
771
+ g
772
+ ] }));
773
+ return /* @__PURE__ */ a("section", { id: t.id, children: [
774
+ /* @__PURE__ */ e("h2", { children: t.title }),
775
+ /* @__PURE__ */ e("p", { className: "ujd-lead", children: t.lead }),
776
+ /* @__PURE__ */ a("div", { className: "ujd-callout", children: [
777
+ /* @__PURE__ */ e("strong", { children: "Route" }),
778
+ " ",
779
+ /* @__PURE__ */ e("code", { children: t.route }),
780
+ "  ·  ",
781
+ /* @__PURE__ */ e("strong", { children: "Menu" }),
782
+ " ",
783
+ t.nav
784
+ ] }),
785
+ n("what", "What this page is", /* @__PURE__ */ a(j, { children: [
786
+ t.explain.map((s, i) => /* @__PURE__ */ e(R, { as: "p", html: s }, i)),
787
+ /* @__PURE__ */ e("p", { children: /* @__PURE__ */ e("strong", { children: "Questions it helps answer" }) }),
788
+ /* @__PURE__ */ e("ul", { children: t.questions.map((s) => /* @__PURE__ */ e("li", { children: s }, s)) })
789
+ ] })),
790
+ n("header", "Header", /* @__PURE__ */ e(R, { as: "p", html: t.header })),
791
+ n("stats", "Stat cards", /* @__PURE__ */ e(k, { head: ["Label", "Icon", "Shows"], rows: t.stats.map((s) => [s[0], P(s[1]), s[2]]) })),
792
+ n("controls", "Controls and behaviour", /* @__PURE__ */ e(O, { items: t.controls })),
793
+ t.columns && n("columns", "Table columns", /* @__PURE__ */ e(k, { head: ["Column", "Field", "Cell renderer"], rows: t.columns.map((s) => [s[0], P(s[1]), P(s[2])]) })),
794
+ t.extra && n("modal", t.extraTitle ?? "Details", /* @__PURE__ */ e(O, { items: t.extra })),
795
+ n("states", "Loading, empty and error states", /* @__PURE__ */ e(O, { items: t.states })),
796
+ n("colors", "Colours on this page", /* @__PURE__ */ a(j, { children: [
797
+ /* @__PURE__ */ e(O, { items: t.colors }),
798
+ /* @__PURE__ */ a("p", { className: "ujd-small", children: [
799
+ "All surface, border and text colours switch with the theme; see ",
800
+ /* @__PURE__ */ e("a", { "data-go": "theming", children: "Dark / light theme" }),
801
+ "."
802
+ ] })
803
+ ] })),
804
+ n("data", "Data and API", /* @__PURE__ */ a(j, { children: [
805
+ /* @__PURE__ */ e("div", { className: "ujd-table-wrap", children: /* @__PURE__ */ a("table", { className: "ujd-table", children: [
806
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
807
+ /* @__PURE__ */ e("th", { children: "Method" }),
808
+ /* @__PURE__ */ e("th", { children: "Endpoint" }),
809
+ /* @__PURE__ */ e("th", { children: "Client call" })
810
+ ] }) }),
811
+ /* @__PURE__ */ e("tbody", { children: t.api.map((s, i) => /* @__PURE__ */ a("tr", { children: [
812
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("span", { className: `ujd-verb ${Ae(s[0])}`, children: s[0] }) }),
813
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: s[1] }) }),
814
+ /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e("code", { children: s[2] }) })
815
+ ] }, i)) })
816
+ ] }) }),
817
+ /* @__PURE__ */ e(k, { head: ["Type", "Fields"], rows: t.types.map((s) => [P(s[0]), s[1]]) }),
818
+ /* @__PURE__ */ a("p", { className: "ujd-small", children: [
819
+ "Hooks: ",
820
+ /* @__PURE__ */ e("code", { children: t.hooks })
821
+ ] })
822
+ ] }))
823
+ ] });
824
+ }, Ie = ({ defaultTheme: t, githubUrl: r = "#", className: n }) => {
825
+ const s = X(null), [i, g] = y(() => {
826
+ try {
827
+ const o = localStorage.getItem("ujd-theme");
828
+ if (o === "dark" || o === "light") return o;
829
+ } catch {
830
+ }
831
+ return t ?? "light";
832
+ }), [b, v] = y("introduction"), [f, m] = y({ "Getting started": !0 }), p = (o) => {
833
+ g(o);
834
+ try {
835
+ localStorage.setItem("ujd-theme", o);
836
+ } catch {
837
+ }
838
+ }, l = S(() => [
839
+ { title: "Getting started", links: [["introduction", "Introduction"], ["overview", "Overview"], ["how-it-works", "How it works"], ["quick-start", "Quick start"], ["add-a-page", "Adding a new page"], ["contents", "Contents"]] },
840
+ ...A.map((o) => {
841
+ const h = [[o.id, "Overview"], [`${o.id}-what`, "What this page is"], [`${o.id}-header`, "Header"], [`${o.id}-stats`, "Stat cards"], [`${o.id}-controls`, "Controls and behaviour"]];
842
+ return o.columns && h.push([`${o.id}-columns`, "Table columns"]), o.extra && h.push([`${o.id}-modal`, o.extraTitle ?? "Details"]), h.push([`${o.id}-states`, "Loading, empty and error states"], [`${o.id}-colors`, "Colours on this page"], [`${o.id}-data`, "Data and API"]), { title: o.title, links: h };
843
+ }),
844
+ { title: "Shared", links: [["shared-components", "Components"], ["shared-hooks", "Hooks and loading"], ["shared-cells", "Cell renderers"]] },
845
+ { title: "Theme and design", links: [["theming", "Dark / light theme"], ["theme-switch", "Switching the theme"], ["theme-preview", "Side by side"], ["theme-tokens", "Theme tokens"], ["theme-cards", "Card tokens"], ["theme-colors", "Status colours"], ["theme-typography", "Typography"], ["theme-custom", "Customising"]] },
846
+ { title: "More", links: [["responsive", "Layout and responsive"], ["accessibility", "Accessibility"], ["faq", "Troubleshooting and FAQ"], ["glossary", "Glossary"]] }
847
+ ], []), d = S(() => {
848
+ const o = [["introduction", "Introduction", 0], ["overview", "Overview", 0], ["how-it-works", "How it works", 1], ["quick-start", "Quick start", 0], ["add-a-page", "Adding a new page", 1], ["contents", "Contents", 0]];
849
+ return l.slice(1, 1 + A.length).forEach((h, N) => h.links.forEach((x, D) => o.push([x[0], D === 0 ? h.title : x[1], D === 0 ? 0 : 1]))), o.push(["shared", "Shared pieces", 0], ["shared-components", "Components", 1], ["shared-hooks", "Hooks and loading", 1], ["shared-cells", "Cell renderers", 1]), l[l.length - 2].links.forEach((h, N) => o.push([h[0], h[1], N === 0 ? 0 : 1])), l[l.length - 1].links.forEach((h) => o.push([h[0], h[1], 0])), o;
850
+ }, [l]), u = Y((o) => {
851
+ var N;
852
+ const h = (N = s.current) == null ? void 0 : N.querySelector(`#${CSS.escape(o)}`);
853
+ h && (h.scrollIntoView({ behavior: "smooth", block: "start" }), v(o));
854
+ }, []), c = (o) => {
855
+ const h = o.target.closest("[data-go]");
856
+ h && (o.preventDefault(), u(h.dataset.go));
857
+ };
858
+ U(() => {
859
+ const o = s.current;
860
+ if (!o || typeof IntersectionObserver > "u") return;
861
+ const h = new IntersectionObserver((N) => N.forEach((x) => {
862
+ x.isIntersecting && v(x.target.id);
863
+ }), { rootMargin: "-10% 0px -80% 0px" });
864
+ return o.querySelectorAll("main [id]").forEach((N) => h.observe(N)), () => h.disconnect();
865
+ }, []), U(() => {
866
+ const o = l.find((h) => h.links.some((N) => N[0] === b));
867
+ o && m((h) => h[o.title] ? h : { ...h, [o.title]: !0 });
868
+ }, [b, l]);
869
+ const w = ({ id: o, children: h }) => /* @__PURE__ */ e("a", { href: `#${o}`, onClick: (N) => {
870
+ N.preventDefault(), u(o);
871
+ }, children: h });
872
+ return /* @__PURE__ */ a("div", { ref: s, className: `ujd ${n ?? ""}`, "data-theme": i, onClick: c, children: [
873
+ /* @__PURE__ */ a("nav", { className: "ujd-nav", children: [
874
+ /* @__PURE__ */ a("a", { className: "ujd-brand", href: "#introduction", onClick: (o) => {
875
+ o.preventDefault(), u("introduction");
876
+ }, children: [
877
+ "⎇ Sonnaga ",
878
+ /* @__PURE__ */ e("span", { children: "Docs" })
879
+ ] }),
880
+ /* @__PURE__ */ a("div", { className: "ujd-nav-actions", children: [
881
+ /* @__PURE__ */ e("a", { className: "ujd-btn ujd-hide-sm", href: r, target: "_blank", rel: "noreferrer", children: "View on GitHub" }),
882
+ /* @__PURE__ */ e("button", { className: "ujd-btn", "aria-label": "Toggle theme", onClick: () => p(i === "dark" ? "light" : "dark"), children: i === "dark" ? "☀️" : "🌙" })
883
+ ] })
884
+ ] }),
885
+ /* @__PURE__ */ a("div", { className: "ujd-layout", children: [
886
+ /* @__PURE__ */ e("aside", { className: "ujd-side", children: l.map((o) => /* @__PURE__ */ a("div", { children: [
887
+ /* @__PURE__ */ a("button", { className: "ujd-group", "aria-expanded": !!f[o.title], onClick: () => m((h) => ({ ...h, [o.title]: !h[o.title] })), children: [
888
+ /* @__PURE__ */ e("span", { className: "ujd-chev", children: "›" }),
889
+ o.title
890
+ ] }),
891
+ f[o.title] && /* @__PURE__ */ e("ul", { children: o.links.map((h) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e("a", { href: `#${h[0]}`, className: b === h[0] ? "active" : "", onClick: (N) => {
892
+ N.preventDefault(), u(h[0]);
893
+ }, children: h[1] }) }, h[0])) })
894
+ ] }, o.title)) }),
895
+ /* @__PURE__ */ a("main", { children: [
896
+ /* @__PURE__ */ a("div", { className: "ujd-titlebar", children: [
897
+ /* @__PURE__ */ e("h1", { id: "introduction", children: "Introduction" }),
898
+ /* @__PURE__ */ e("a", { className: "ujd-btn", href: r, target: "_blank", rel: "noreferrer", children: "View on GitHub" })
899
+ ] }),
900
+ /* @__PURE__ */ e("p", { className: "ujd-lead", children: "Everything about the User Journey module: four analytics pages that show how people move through the product, built on shared Header, StatCard and DataTable components, with a dark and a light theme." }),
901
+ /* @__PURE__ */ a("section", { id: "overview", children: [
902
+ /* @__PURE__ */ e("h2", { children: "Overview" }),
903
+ /* @__PURE__ */ a("p", { children: [
904
+ "User Journey answers one question from four angles: ",
905
+ /* @__PURE__ */ e("em", { children: "how do people move through the product, and where do they succeed or drop off?" })
906
+ ] }),
907
+ /* @__PURE__ */ e(k, { head: ["Page", "Angle", "Unit of data"], rows: fe }),
908
+ /* @__PURE__ */ a("div", { className: "ujd-callout", children: [
909
+ /* @__PURE__ */ e("strong", { children: "Suggested reading order." }),
910
+ " Start with Navigation Analysis to find weak pages, use Paths and User Flows to see how users reach and leave them, then record what you learn in a Journey Map."
911
+ ] }),
912
+ /* @__PURE__ */ e("h3", { id: "how-it-works", children: "How it works" }),
913
+ /* @__PURE__ */ a("ol", { children: [
914
+ /* @__PURE__ */ a("li", { children: [
915
+ "The page mounts and its hook (for example ",
916
+ /* @__PURE__ */ e("code", { children: "usePaths" }),
917
+ ") requests data through ",
918
+ /* @__PURE__ */ e("code", { children: "journeysApi" }),
919
+ "."
920
+ ] }),
921
+ /* @__PURE__ */ a("li", { children: [
922
+ "The response holds the rows and, for most pages, a ",
923
+ /* @__PURE__ */ e("code", { children: "summary" }),
924
+ ". The summary feeds the stat cards and the rows feed the table or list."
925
+ ] }),
926
+ /* @__PURE__ */ a("li", { children: [
927
+ "The page's config file adds search, sort, filters and columns to the shared DataTable. Cell renderers in ",
928
+ /* @__PURE__ */ e("code", { children: "cells/" }),
929
+ " draw the bars, pills and icons."
930
+ ] }),
931
+ /* @__PURE__ */ e("li", { children: "Theme variables decide every colour, so nothing is re-drawn when the theme changes." })
932
+ ] }),
933
+ /* @__PURE__ */ a("div", { className: "ujd-callout ujd-warn", children: [
934
+ /* @__PURE__ */ e("strong", { children: "Mock data today." }),
935
+ " ",
936
+ /* @__PURE__ */ e("code", { children: "journeys.api.ts" }),
937
+ " currently reads static JSON files from ",
938
+ /* @__PURE__ */ e("code", { children: "/JSON/events/*.json" }),
939
+ ". The real endpoints (",
940
+ /* @__PURE__ */ e("code", { children: "/journeys/maps" }),
941
+ ", ",
942
+ /* @__PURE__ */ e("code", { children: "/journeys/navigation" }),
943
+ ", ",
944
+ /* @__PURE__ */ e("code", { children: "/journeys/paths" }),
945
+ ", ",
946
+ /* @__PURE__ */ e("code", { children: "/journeys/flows" }),
947
+ ") are kept as comments next to each call. Swap them back when the backend is ready."
948
+ ] })
949
+ ] }),
950
+ /* @__PURE__ */ a("section", { id: "quick-start", children: [
951
+ /* @__PURE__ */ e("h2", { children: "Quick start" }),
952
+ /* @__PURE__ */ a("p", { children: [
953
+ "The module lives in ",
954
+ /* @__PURE__ */ e("code", { children: "modules/userjourney" }),
955
+ ". ",
956
+ /* @__PURE__ */ e("code", { children: "nav.ts" }),
957
+ " adds the menu items and ",
958
+ /* @__PURE__ */ e("code", { children: "routes.ts" }),
959
+ " lazy-loads each page behind ",
960
+ /* @__PURE__ */ e("code", { children: "withPageLoader" }),
961
+ ". Every page has the same shape: a ",
962
+ /* @__PURE__ */ e("strong", { children: "Header" }),
963
+ ", a row of ",
964
+ /* @__PURE__ */ e("strong", { children: "StatCards" }),
965
+ ", then the content."
966
+ ] }),
967
+ /* @__PURE__ */ e("pre", { children: /* @__PURE__ */ e("code", { children: Se }) }),
968
+ /* @__PURE__ */ e("h3", { id: "add-a-page", children: "Adding a new page" }),
969
+ /* @__PURE__ */ a("ol", { children: [
970
+ /* @__PURE__ */ a("li", { children: [
971
+ "Create ",
972
+ /* @__PURE__ */ e("code", { children: "pages/MyPage/MyPage.tsx" }),
973
+ " and ",
974
+ /* @__PURE__ */ e("code", { children: "index.ts" }),
975
+ "."
976
+ ] }),
977
+ /* @__PURE__ */ a("li", { children: [
978
+ "Build it with ",
979
+ /* @__PURE__ */ e("code", { children: "Header" }),
980
+ ", ",
981
+ /* @__PURE__ */ e("code", { children: "StatCard" }),
982
+ " and ",
983
+ /* @__PURE__ */ e("code", { children: "DataTable" }),
984
+ ", and take the wrapper and grid classes from ",
985
+ /* @__PURE__ */ e("code", { children: "userjourneyPage.module.scss" }),
986
+ "."
987
+ ] }),
988
+ /* @__PURE__ */ a("li", { children: [
989
+ "Put columns, filters, search and sort in ",
990
+ /* @__PURE__ */ e("code", { children: "myPageTable.config.ts" }),
991
+ ". Every column's ",
992
+ /* @__PURE__ */ e("code", { children: "cellType" }),
993
+ " must match a renderer name exactly."
994
+ ] }),
995
+ /* @__PURE__ */ a("li", { children: [
996
+ "Register the route in ",
997
+ /* @__PURE__ */ e("code", { children: "routes.ts" }),
998
+ " and the menu item in ",
999
+ /* @__PURE__ */ e("code", { children: "nav.ts" }),
1000
+ ". A page missing from either shows a 404 or no menu entry."
1001
+ ] })
1002
+ ] })
1003
+ ] }),
1004
+ /* @__PURE__ */ a("section", { id: "contents", children: [
1005
+ /* @__PURE__ */ e("h2", { children: "Contents" }),
1006
+ /* @__PURE__ */ e("div", { className: "ujd-cards", children: A.map((o) => /* @__PURE__ */ a("a", { href: `#${o.id}`, className: "ujd-card", onClick: (h) => {
1007
+ h.preventDefault(), u(o.id);
1008
+ }, children: [
1009
+ /* @__PURE__ */ a("h5", { children: [
1010
+ /* @__PURE__ */ e("span", { className: "ujd-accent", children: o.icon }),
1011
+ " ",
1012
+ o.title
1013
+ ] }),
1014
+ /* @__PURE__ */ a("p", { children: [
1015
+ o.lead.split(". ")[0],
1016
+ "."
1017
+ ] })
1018
+ ] }, o.id)) }),
1019
+ /* @__PURE__ */ e(k, { head: ["Page", "Route", "Content"], rows: A.map((o) => [
1020
+ `<a data-go="${o.id}">${o.title}</a>`,
1021
+ P(o.route),
1022
+ (o.columns ? "DataTable" : "Cards") + (o.id === "paths" || o.id === "user-flows" ? " + List view" : "")
1023
+ ]) })
1024
+ ] }),
1025
+ A.map((o) => /* @__PURE__ */ e(je, { p: o }, o.id)),
1026
+ /* @__PURE__ */ a("section", { id: "shared", children: [
1027
+ /* @__PURE__ */ e("h2", { children: "Shared pieces" }),
1028
+ /* @__PURE__ */ e("h3", { id: "shared-components", children: "Components" }),
1029
+ /* @__PURE__ */ e(k, { head: ["Component", "Purpose", "Notes"], rows: we }),
1030
+ /* @__PURE__ */ e("h3", { id: "shared-hooks", children: "Hooks and loading" }),
1031
+ /* @__PURE__ */ a("p", { children: [
1032
+ "Data is fetched with TanStack Query. ",
1033
+ /* @__PURE__ */ e("code", { children: "useJourneyMaps" }),
1034
+ " is an infinite query with cursor paging and a 5 minute stale time. Create and delete are mutations: create refreshes the list, delete updates the cache optimistically and rolls back on error. Both show toasts."
1035
+ ] }),
1036
+ /* @__PURE__ */ e("h3", { id: "shared-cells", children: "Cell renderers" }),
1037
+ /* @__PURE__ */ a("p", { children: [
1038
+ "Renderers live in ",
1039
+ /* @__PURE__ */ e("code", { children: "cells/UserjourneyCells.tsx" }),
1040
+ " and ",
1041
+ /* @__PURE__ */ e("code", { children: "cells/FlowCells.tsx" }),
1042
+ " and are registered by name. The ",
1043
+ /* @__PURE__ */ e("code", { children: "cellType" }),
1044
+ " string in a column config must match the registered name exactly, otherwise the cell stays empty."
1045
+ ] })
1046
+ ] }),
1047
+ /* @__PURE__ */ a("section", { id: "theming", children: [
1048
+ /* @__PURE__ */ e("h2", { children: "Dark / light theme" }),
1049
+ /* @__PURE__ */ e("p", { className: "ujd-lead", children: "Both themes are driven by CSS variables. A page never hard-codes “dark” or “light” colours for surfaces, borders or text; it reads a variable, and the theme decides its value." }),
1050
+ /* @__PURE__ */ e("h3", { id: "theme-switch", children: "Switching the theme" }),
1051
+ /* @__PURE__ */ e("p", { children: "In the React app a header switch changes the theme attribute on the document, and every variable takes its dark or light value. In this documentation, use the moon/sun button in the top bar or the buttons below." }),
1052
+ /* @__PURE__ */ a("div", { className: "ujd-row", children: [
1053
+ /* @__PURE__ */ e("button", { className: "ujd-btn", onClick: () => p("light"), children: "☀️ Light" }),
1054
+ /* @__PURE__ */ e("button", { className: "ujd-btn", onClick: () => p("dark"), children: "🌙 Dark" })
1055
+ ] }),
1056
+ /* @__PURE__ */ e("pre", { children: /* @__PURE__ */ e("code", { children: `// React app (data-theme)
1057
+ document.documentElement.setAttribute('data-theme', 'dark'); // or 'light'
1058
+
1059
+ // Bootstrap pages (data-bs-theme)
1060
+ document.documentElement.setAttribute('data-bs-theme', 'dark'); // or 'light'` }) }),
1061
+ /* @__PURE__ */ e("h3", { id: "theme-preview", children: "Light and dark side by side" }),
1062
+ /* @__PURE__ */ e("div", { className: "ujd-demo", children: ["l", "d"].map((o) => /* @__PURE__ */ a("div", { className: `ujd-mini ${o}`, children: [
1063
+ /* @__PURE__ */ e("strong", { children: o === "l" ? "Light" : "Dark" }),
1064
+ /* @__PURE__ */ e("br", {}),
1065
+ /* @__PURE__ */ e("small", { children: o === "l" ? "White cards on a light grey page, black text" : "Dark cards with a hairline border, light text" }),
1066
+ /* @__PURE__ */ a("div", { className: "ujd-card-in", children: [
1067
+ /* @__PURE__ */ e("small", { children: "Avg conversion" }),
1068
+ /* @__PURE__ */ e("div", { className: "ujd-big", children: "38.0%" }),
1069
+ /* @__PURE__ */ e("span", { className: "ujd-pill", children: "62.4% conv" })
1070
+ ] })
1071
+ ] }, o)) }),
1072
+ /* @__PURE__ */ e("h3", { id: "theme-tokens", children: "Theme tokens" }),
1073
+ /* @__PURE__ */ e("p", { children: "These are the variables the User Journey pages read." }),
1074
+ /* @__PURE__ */ e(k, { head: ["Token", "Used for", "Light", "Dark"], rows: ye }),
1075
+ /* @__PURE__ */ a("p", { className: "ujd-small", children: [
1076
+ "The ",
1077
+ /* @__PURE__ */ e("code", { children: "--th-*" }),
1078
+ " variables are defined in the app's global theme, outside this module. The values above describe how the pages use them."
1079
+ ] }),
1080
+ /* @__PURE__ */ e("h3", { id: "theme-cards", children: "Card tokens" }),
1081
+ /* @__PURE__ */ a("p", { children: [
1082
+ /* @__PURE__ */ e("code", { children: "modules/common/card-theme.css" }),
1083
+ " must be imported once in the global entry. Every card class then reads these variables."
1084
+ ] }),
1085
+ /* @__PURE__ */ e(k, { head: ["Token", "Light", "Dark"], rows: Ne }),
1086
+ /* @__PURE__ */ a("div", { className: "ujd-callout", children: [
1087
+ /* @__PURE__ */ e("strong", { children: "Why a border in dark and a shadow in light?" }),
1088
+ " Shadows are hard to see on a dark background, so dark cards use a hairline border for separation. On a light background a soft shadow is enough."
1089
+ ] }),
1090
+ /* @__PURE__ */ e("h3", { id: "theme-colors", children: "Colours that stay the same" }),
1091
+ /* @__PURE__ */ e("p", { children: "Status and brand colours are not tied to the theme, so a green bar is the same green in light and dark." }),
1092
+ /* @__PURE__ */ e(k, { head: ["Colour", "Value", "Where"], rows: ke }),
1093
+ /* @__PURE__ */ e("h3", { id: "theme-typography", children: "Typography" }),
1094
+ /* @__PURE__ */ a("p", { children: [
1095
+ /* @__PURE__ */ e("code", { children: "modules/common/typography.css" }),
1096
+ " defines one type scale and font stack for all pages (Inter, then system fonts; monospace for code)."
1097
+ ] }),
1098
+ /* @__PURE__ */ e(k, { head: ["Token", "Size", "Used for"], rows: Ce }),
1099
+ /* @__PURE__ */ e("h3", { id: "theme-custom", children: "Customising the theme" }),
1100
+ /* @__PURE__ */ a("ol", { children: [
1101
+ /* @__PURE__ */ e("li", { children: "Change a token value in the dark or light block. Never edit a component to fix a colour." }),
1102
+ /* @__PURE__ */ a("li", { children: [
1103
+ "Use ",
1104
+ /* @__PURE__ */ e("code", { children: "color-mix" }),
1105
+ " with ",
1106
+ /* @__PURE__ */ e("code", { children: "--th-ov-base" }),
1107
+ " for subtle overlays so they work in both themes."
1108
+ ] }),
1109
+ /* @__PURE__ */ e("li", { children: "Check both themes after every change: text contrast, borders on cards and the selected-row tint." }),
1110
+ /* @__PURE__ */ a("li", { children: [
1111
+ "For a client brand colour, replace the accent ",
1112
+ /* @__PURE__ */ e("code", { children: "#7c3aed" }),
1113
+ " in one place (in the Bootstrap pages, ",
1114
+ /* @__PURE__ */ e("code", { children: "--bs-primary" }),
1115
+ " and ",
1116
+ /* @__PURE__ */ e("code", { children: "--acc" }),
1117
+ ")."
1118
+ ] })
1119
+ ] })
1120
+ ] }),
1121
+ /* @__PURE__ */ a("section", { id: "responsive", children: [
1122
+ /* @__PURE__ */ e("h2", { children: "Layout and responsive behaviour" }),
1123
+ /* @__PURE__ */ a("ul", { children: [
1124
+ /* @__PURE__ */ e("li", { children: "The page wrapper is a column with a 16px gap and 20px padding." }),
1125
+ /* @__PURE__ */ e("li", { children: "Stat cards use an auto-fit grid, at least 210px wide each, so they wrap on small screens." }),
1126
+ /* @__PURE__ */ e("li", { children: "The table and the optional detail drawer sit side by side; the 320px drawer only appears at 1280px and wider." }),
1127
+ /* @__PURE__ */ e("li", { children: "This documentation hides the right-hand “On this page” list below 1200px and the sidebar below 992px." }),
1128
+ /* @__PURE__ */ e("li", { children: "Wide tables scroll inside their own container so the page itself never scrolls sideways." })
1129
+ ] })
1130
+ ] }),
1131
+ /* @__PURE__ */ a("section", { id: "accessibility", children: [
1132
+ /* @__PURE__ */ e("h2", { children: "Accessibility" }),
1133
+ /* @__PURE__ */ a("ul", { children: [
1134
+ /* @__PURE__ */ a("li", { children: [
1135
+ "Table / List toggle buttons expose ",
1136
+ /* @__PURE__ */ e("code", { children: "aria-pressed" }),
1137
+ "."
1138
+ ] }),
1139
+ /* @__PURE__ */ a("li", { children: [
1140
+ "Icon-only buttons such as delete and refresh have an ",
1141
+ /* @__PURE__ */ e("code", { children: "aria-label" }),
1142
+ " and a tooltip."
1143
+ ] }),
1144
+ /* @__PURE__ */ e("li", { children: "Meaning is never carried by colour alone: bounce and share also show a percentage, and trend also uses an icon." }),
1145
+ /* @__PURE__ */ e("li", { children: "Full paths are available in tooltips where the UI shows short step names." })
1146
+ ] })
1147
+ ] }),
1148
+ /* @__PURE__ */ a("section", { id: "faq", children: [
1149
+ /* @__PURE__ */ e("h2", { children: "Troubleshooting and FAQ" }),
1150
+ /* @__PURE__ */ e(k, { head: ["Question", "Answer"], rows: Te })
1151
+ ] }),
1152
+ /* @__PURE__ */ a("section", { id: "glossary", children: [
1153
+ /* @__PURE__ */ e("h2", { children: "Glossary" }),
1154
+ /* @__PURE__ */ e(k, { head: ["Term", "Meaning"], rows: xe })
1155
+ ] }),
1156
+ /* @__PURE__ */ e("div", { style: { height: "30vh" } })
1157
+ ] }),
1158
+ /* @__PURE__ */ a("aside", { className: "ujd-toc", children: [
1159
+ /* @__PURE__ */ e("h6", { children: "On this page" }),
1160
+ /* @__PURE__ */ e("nav", { children: d.map((o, h) => /* @__PURE__ */ e(w, { id: o[0], children: /* @__PURE__ */ e("span", { className: `${o[2] ? "sub" : ""} ${b === o[0] ? "active" : ""}`, children: o[1] }) }, `${o[0]}-${h}`)) })
1161
+ ] })
1162
+ ] })
1163
+ ] });
1164
+ };
1165
+ export {
1166
+ ce as JourneyApp,
1167
+ pe as SurveyApp,
1168
+ Me as SurveyJourneyApp,
1169
+ Ie as UserJourneyDocs,
1170
+ se as flowStats,
1171
+ te as navigationStats,
1172
+ H as npsCategory,
1173
+ $ as npsOf,
1174
+ J as npsScores,
1175
+ ae as pathStats,
1176
+ G as simulate,
1177
+ oe as stageReach
1178
+ };