@shiva004/surveys 0.1.8 → 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 CHANGED
@@ -1,22 +1,22 @@
1
- import { jsxs as n, jsx as e, Fragment as B } from "react/jsx-runtime";
2
- import X, { useState as N, useMemo as x } from "react";
3
- const y = ({ label: t, value: i, color: a = "#7c3aed" }) => /* @__PURE__ */ n("div", { className: "stat", style: { borderTopColor: a }, children: [
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
4
  /* @__PURE__ */ e("div", { className: "stat-label", children: t }),
5
- /* @__PURE__ */ e("div", { className: "stat-value", children: i })
6
- ] }), j = ({ items: t, value: i, onChange: a }) => /* @__PURE__ */ e("div", { className: "tabs", children: t.map((s) => /* @__PURE__ */ e("button", { type: "button", className: s.id === i ? "tab active" : "tab", onClick: () => a(s.id), children: s.label }, s.id)) }), S = ({ pct: t, color: i = "#7c3aed" }) => /* @__PURE__ */ e("div", { className: "bar", children: /* @__PURE__ */ e("div", { className: "bar-fill", style: { width: `${Math.max(0, Math.min(100, t))}%`, background: i } }) }), C = ({ title: t, subtitle: i, actions: a, children: s }) => /* @__PURE__ */ n("section", { children: [
7
- /* @__PURE__ */ n("div", { className: "page-head", children: [
8
- /* @__PURE__ */ n("div", { children: [
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
9
  /* @__PURE__ */ e("h2", { children: t }),
10
- i && /* @__PURE__ */ e("p", { className: "muted", children: i })
10
+ r && /* @__PURE__ */ e("p", { className: "muted", children: r })
11
11
  ] }),
12
- /* @__PURE__ */ e("div", { className: "actions", children: a })
12
+ /* @__PURE__ */ e("div", { className: "actions", children: n })
13
13
  ] }),
14
14
  s
15
- ] }), _ = (t) => () => {
15
+ ] }), B = (t) => () => {
16
16
  t |= 0, t = t + 1831565813 | 0;
17
- let i = Math.imul(t ^ t >>> 15, 1 | t);
18
- return i = i + Math.imul(i ^ i >>> 7, 61 | i) ^ i, ((i ^ i >>> 14) >>> 0) / 4294967296;
19
- }, k = (t) => `${t}_${Math.random().toString(36).slice(2, 8)}`, Q = ["/home", "/pricing", "/features", "/docs", "/signup", "/dashboard", "/checkout"], L = [["/home", 0.55], ["/pricing", 0.15], ["/features", 0.15], ["/docs", 0.15]], H = {
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
20
  "/home": [["/pricing", 0.3], ["/features", 0.3], ["/docs", 0.1], ["/signup", 0.1], ["EXIT", 0.2]],
21
21
  "/pricing": [["/signup", 0.3], ["/features", 0.15], ["/home", 0.1], ["EXIT", 0.45]],
22
22
  "/features": [["/pricing", 0.3], ["/signup", 0.15], ["/docs", 0.15], ["EXIT", 0.4]],
@@ -24,63 +24,63 @@ const y = ({ label: t, value: i, color: a = "#7c3aed" }) => /* @__PURE__ */ n("d
24
24
  "/signup": [["/dashboard", 0.6], ["EXIT", 0.4]],
25
25
  "/dashboard": [["/checkout", 0.25], ["/docs", 0.15], ["/features", 0.1], ["EXIT", 0.5]],
26
26
  "/checkout": [["EXIT", 1]]
27
- }, T = (t, i) => {
28
- let a = 0;
29
- for (const [s, o] of t)
30
- if (a += o, i < a) return s;
27
+ }, L = (t, r) => {
28
+ let n = 0;
29
+ for (const [s, i] of t)
30
+ if (n += i, r < n) return s;
31
31
  return t[t.length - 1][0];
32
32
  };
33
- function $(t, i) {
33
+ function G(t, r) {
34
34
  return Array.from({ length: t }, () => {
35
- let a = T(L, i());
36
- const s = [a];
35
+ let n = L(K, r());
36
+ const s = [n];
37
37
  for (; s.length < 8; ) {
38
- const o = T(H[a], i());
39
- if (o === "EXIT") break;
40
- s.push(o), a = o;
38
+ const i = L(Z[n], r());
39
+ if (i === "EXIT") break;
40
+ s.push(i), n = i;
41
41
  }
42
42
  return s;
43
43
  });
44
44
  }
45
- const W = () => $(400, _(42));
46
- function J(t) {
47
- const i = /* @__PURE__ */ new Map(), a = (s) => (i.has(s) || i.set(s, { views: 0, entries: 0, bounces: 0, exits: 0 }), i.get(s));
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
48
  for (const s of t)
49
- s.forEach((o) => {
50
- a(o).views += 1;
51
- }), a(s[0]).entries += 1, s.length === 1 && (a(s[0]).bounces += 1), a(s[s.length - 1]).exits += 1;
52
- return [...i.entries()].map(([s, o]) => ({
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
53
  page: s,
54
- views: o.views,
55
- bounceRate: o.entries ? o.bounces / o.entries * 100 : 0,
56
- exitRate: o.views ? o.exits / o.views * 100 : 0
57
- })).sort((s, o) => o.views - s.views);
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
58
  }
59
- function U(t, i = 8) {
60
- const a = /* @__PURE__ */ new Map();
59
+ function ae(t, r = 8) {
60
+ const n = /* @__PURE__ */ new Map();
61
61
  for (const s of t) {
62
- const o = s.slice(0, 4), p = o.join(">"), g = a.get(p) ?? { steps: o, users: 0, conv: 0 };
63
- g.users += 1, s.includes("/signup") && (g.conv += 1), a.set(p, g);
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
64
  }
65
- return [...a.values()].map((s) => ({ steps: s.steps, users: s.users, convRate: s.conv / s.users * 100 })).sort((s, o) => o.users - s.users).slice(0, i);
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
66
  }
67
- function V(t) {
68
- const i = /* @__PURE__ */ new Map();
69
- for (const a of t)
70
- for (let s = 0; s < a.length - 1; s++) {
71
- const o = i.get(a[s]) ?? /* @__PURE__ */ new Map();
72
- o.set(a[s + 1], (o.get(a[s + 1]) ?? 0) + 1), i.set(a[s], o);
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
73
  }
74
- return [...i.entries()].map(([a, s]) => {
75
- const o = [...s.values()].reduce((p, g) => p + g, 0);
74
+ return [...r.entries()].map(([n, s]) => {
75
+ const i = [...s.values()].reduce((g, b) => g + b, 0);
76
76
  return {
77
- from: a,
78
- total: o,
79
- destinations: [...s.entries()].map(([p, g]) => ({ to: p, pct: g / o * 100 })).sort((p, g) => g.pct - p.pct)
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
80
  };
81
- }).sort((a, s) => s.total - a.total);
81
+ }).sort((n, s) => s.total - n.total);
82
82
  }
83
- const G = (t, i) => t.length ? t.filter((a) => a.some((s) => i.includes(s))).length / t.length * 100 : 0, Y = {
83
+ const oe = (t, r) => t.length ? t.filter((n) => n.some((s) => r.includes(s))).length / t.length * 100 : 0, ne = {
84
84
  id: "jm1",
85
85
  name: "New customer journey",
86
86
  stages: [
@@ -90,158 +90,158 @@ const G = (t, i) => t.length ? t.filter((a) => a.some((s) => i.includes(s))).len
90
90
  { id: "st4", name: "Activation", emotion: "engaged", pages: ["/dashboard"] },
91
91
  { id: "st5", name: "Purchase", emotion: "satisfied", pages: ["/checkout"] }
92
92
  ]
93
- }, z = [
93
+ }, re = [
94
94
  { id: "nav", label: "Navigation Analysis" },
95
95
  { id: "paths", label: "Paths" },
96
96
  { id: "flows", label: "Userflows" },
97
97
  { id: "maps", label: "Journey Maps" }
98
- ], E = { curious: "#adc6ff", analytical: "#7c3aed", confident: "#4edea3", engaged: "#d2bbff", satisfied: "#ffcc6b", cautious: "#ffb4ab" }, K = (t) => t.split("/").filter(Boolean).pop() ?? t, Z = (t) => t > 25 ? "#ffb4ab" : t > 15 ? "#ffcc6b" : "#4edea3", ce = () => {
99
- var c;
100
- const [t, i] = N("nav"), [a, s] = N(W), [o, p] = N(Y), g = x(() => J(a), [a]), h = x(() => U(a), [a]), f = x(() => V(a), [a]), u = g.reduce((d, l) => d + l.views, 0), m = a.length, r = a.filter((d) => d.length === 1).length;
101
- return /* @__PURE__ */ n(
102
- C,
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
103
  {
104
104
  title: "User Journey",
105
105
  subtitle: "One stream of page views feeds every view below.",
106
- actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => s((d) => [...d, ...$(50, Math.random)]), children: "+ Simulate 50 sessions" }),
106
+ actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => s((u) => [...u, ...G(50, Math.random)]), children: "+ Simulate 50 sessions" }),
107
107
  children: [
108
- /* @__PURE__ */ n("div", { className: "stats", children: [
109
- /* @__PURE__ */ e(y, { label: "Sessions", value: m.toLocaleString(), color: "#6366f1" }),
110
- /* @__PURE__ */ e(y, { label: "Page views", value: u.toLocaleString(), color: "#0ea5e9" }),
111
- /* @__PURE__ */ e(y, { label: "Bounce rate", value: `${m ? (r / m * 100).toFixed(1) : 0}%`, color: "#f59e0b" }),
112
- /* @__PURE__ */ e(y, { label: "Top page", value: ((c = g[0]) == null ? void 0 : c.page) ?? "—", color: "#10b981" })
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
113
  ] }),
114
- /* @__PURE__ */ e(j, { items: z, value: t, onChange: i }),
115
- t === "nav" && /* @__PURE__ */ n("table", { className: "table", children: [
116
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
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
117
  /* @__PURE__ */ e("th", { children: "Page" }),
118
118
  /* @__PURE__ */ e("th", { children: "Views" }),
119
119
  /* @__PURE__ */ e("th", { children: "Share" }),
120
120
  /* @__PURE__ */ e("th", { children: "Bounce rate" }),
121
121
  /* @__PURE__ */ e("th", { children: "Exit rate" })
122
122
  ] }) }),
123
- /* @__PURE__ */ e("tbody", { children: g.map((d) => /* @__PURE__ */ n("tr", { children: [
124
- /* @__PURE__ */ e("td", { className: "mono", children: d.page }),
125
- /* @__PURE__ */ e("td", { className: "mono", children: d.views }),
126
- /* @__PURE__ */ e("td", { style: { minWidth: 120 }, children: /* @__PURE__ */ e(S, { pct: d.views / u * 100 }) }),
127
- /* @__PURE__ */ n("td", { className: "mono", style: { color: Z(d.bounceRate) }, children: [
128
- d.bounceRate.toFixed(1),
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
129
  "%"
130
130
  ] }),
131
- /* @__PURE__ */ n("td", { className: "mono", children: [
132
- d.exitRate.toFixed(1),
131
+ /* @__PURE__ */ a("td", { className: "mono", children: [
132
+ u.exitRate.toFixed(1),
133
133
  "%"
134
134
  ] })
135
- ] }, d.page)) })
135
+ ] }, u.page)) })
136
136
  ] }),
137
- t === "paths" && /* @__PURE__ */ e("div", { className: "grid", children: h.map((d, l) => /* @__PURE__ */ n("div", { className: "card", children: [
138
- /* @__PURE__ */ n("div", { className: "row", children: [
139
- /* @__PURE__ */ n("span", { className: "pill passive", children: [
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
140
  "#",
141
- l + 1
141
+ c + 1
142
142
  ] }),
143
143
  /* @__PURE__ */ e("span", { className: "grow" }),
144
- /* @__PURE__ */ n("span", { className: "mono small", children: [
145
- d.convRate.toFixed(1),
144
+ /* @__PURE__ */ a("span", { className: "mono small", children: [
145
+ u.convRate.toFixed(1),
146
146
  "% reach signup"
147
147
  ] })
148
148
  ] }),
149
- /* @__PURE__ */ e("div", { className: "steps", title: d.steps.join(" → "), children: d.steps.map((b, v) => /* @__PURE__ */ n(X.Fragment, { children: [
150
- v > 0 && /* @__PURE__ */ e("span", { className: "muted", children: "→" }),
151
- /* @__PURE__ */ e("span", { className: "chip static", children: K(b) })
152
- ] }, v)) }),
153
- /* @__PURE__ */ n("div", { className: "small muted", children: [
154
- d.users,
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
155
  " users"
156
156
  ] }),
157
- /* @__PURE__ */ e(S, { pct: d.convRate, color: "#10b981" })
158
- ] }, d.steps.join(">"))) }),
159
- t === "flows" && /* @__PURE__ */ e("div", { className: "grid", children: f.map((d) => /* @__PURE__ */ n("div", { className: "card", children: [
160
- /* @__PURE__ */ n("div", { className: "row", children: [
161
- /* @__PURE__ */ e("strong", { className: "mono", children: d.from }),
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
162
  /* @__PURE__ */ e("span", { className: "grow" }),
163
- /* @__PURE__ */ n("span", { className: "small muted", children: [
164
- d.total,
163
+ /* @__PURE__ */ a("span", { className: "small muted", children: [
164
+ u.total,
165
165
  " transitions"
166
166
  ] })
167
167
  ] }),
168
- d.destinations.slice(0, 4).map((l) => /* @__PURE__ */ n("div", { children: [
169
- /* @__PURE__ */ n("div", { className: "row small", children: [
170
- /* @__PURE__ */ n("span", { className: "mono", children: [
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
171
  "→ ",
172
- l.to
172
+ c.to
173
173
  ] }),
174
174
  /* @__PURE__ */ e("span", { className: "grow" }),
175
- /* @__PURE__ */ n("span", { className: "mono", children: [
176
- l.pct.toFixed(0),
175
+ /* @__PURE__ */ a("span", { className: "mono", children: [
176
+ c.pct.toFixed(0),
177
177
  "%"
178
178
  ] })
179
179
  ] }),
180
- /* @__PURE__ */ e(S, { pct: l.pct })
181
- ] }, l.to))
182
- ] }, d.from)) }),
183
- t === "maps" && /* @__PURE__ */ e(ee, { map: o, setMap: p, sessions: a })
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
184
  ]
185
185
  }
186
186
  );
187
- }, ee = ({ map: t, setMap: i, sessions: a }) => {
188
- const [s, o] = N(""), [p, g] = N("curious"), [h, f] = N([]), [u, m] = N(""), r = () => {
189
- if (!s.trim()) return m("Stage name is required.");
190
- if (h.length === 0) return m("Pick at least one touchpoint page.");
191
- const c = { id: k("st"), name: s.trim(), emotion: p, pages: h };
192
- i({ ...t, stages: [...t.stages, c] }), o(""), f([]), m("");
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
193
  };
194
- return /* @__PURE__ */ n("div", { className: "stack", children: [
195
- /* @__PURE__ */ e("input", { className: "input", value: t.name, onChange: (c) => i({ ...t, name: c.target.value }), "aria-label": "Journey name" }),
196
- /* @__PURE__ */ n("div", { className: "stages", children: [
197
- t.stages.map((c, d) => {
198
- const l = G(a, c.pages), b = E[c.emotion] ?? "#7c3aed";
199
- return /* @__PURE__ */ n("div", { className: "card stage", children: [
200
- /* @__PURE__ */ n("div", { className: "row", children: [
201
- /* @__PURE__ */ e("span", { className: "badge", style: { background: `${b}30`, color: b }, children: d + 1 }),
202
- /* @__PURE__ */ e("strong", { children: c.name }),
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
203
  /* @__PURE__ */ e("span", { className: "grow" }),
204
- /* @__PURE__ */ e("button", { className: "btn danger", "aria-label": `Remove ${c.name}`, onClick: () => i({ ...t, stages: t.stages.filter((v) => v.id !== c.id) }), children: "✕" })
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
205
  ] }),
206
- c.pages.map((v) => /* @__PURE__ */ n("div", { className: "small mono muted", children: [
206
+ d.pages.map((o) => /* @__PURE__ */ a("div", { className: "small mono muted", children: [
207
207
  "✓ ",
208
- v
209
- ] }, v)),
210
- /* @__PURE__ */ n("div", { className: "small", style: { color: b }, children: [
208
+ o
209
+ ] }, o)),
210
+ /* @__PURE__ */ a("div", { className: "small", style: { color: w }, children: [
211
211
  "Emotion: ",
212
- c.emotion
212
+ d.emotion
213
213
  ] }),
214
- /* @__PURE__ */ e(S, { pct: l }),
215
- /* @__PURE__ */ n("div", { className: "small mono muted", children: [
216
- l.toFixed(0),
214
+ /* @__PURE__ */ e(E, { pct: c }),
215
+ /* @__PURE__ */ a("div", { className: "small mono muted", children: [
216
+ c.toFixed(0),
217
217
  "% reach"
218
218
  ] })
219
- ] }, c.id);
219
+ ] }, d.id);
220
220
  }),
221
221
  t.stages.length === 0 && /* @__PURE__ */ e("div", { className: "muted", children: "No stages yet. Add one below." })
222
222
  ] }),
223
- /* @__PURE__ */ n("div", { className: "card form", children: [
223
+ /* @__PURE__ */ a("div", { className: "card form", children: [
224
224
  /* @__PURE__ */ e("strong", { children: "Add stage" }),
225
- /* @__PURE__ */ n("div", { className: "row", children: [
226
- /* @__PURE__ */ e("input", { className: "input", placeholder: "Stage name", value: s, onChange: (c) => o(c.target.value) }),
227
- /* @__PURE__ */ e("select", { className: "input slim", value: p, onChange: (c) => g(c.target.value), children: Object.keys(E).map((c) => /* @__PURE__ */ e("option", { children: c }, c)) })
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
228
  ] }),
229
- /* @__PURE__ */ e("div", { className: "scale", children: Q.map((c) => /* @__PURE__ */ e("button", { type: "button", className: h.includes(c) ? "chip active" : "chip", onClick: () => f((d) => d.includes(c) ? d.filter((l) => l !== c) : [...d, c]), children: c }, c)) }),
230
- /* @__PURE__ */ n("div", { className: "row", children: [
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
231
  /* @__PURE__ */ e("span", { className: "grow" }),
232
- u && /* @__PURE__ */ e("span", { className: "error", children: u }),
233
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: r, children: "+ Add stage" })
232
+ m && /* @__PURE__ */ e("span", { className: "error", children: m }),
233
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: l, children: "+ Add stage" })
234
234
  ] })
235
235
  ] })
236
236
  ] });
237
- }, I = (t) => new Date(Date.UTC(2026, 10, 6) - t * 864e5).toISOString(), te = [
237
+ }, F = (t) => new Date(Date.UTC(2026, 10, 6) - t * 864e5).toISOString(), he = [
238
238
  {
239
239
  id: "s1",
240
240
  name: "Q4 Product Satisfaction",
241
241
  description: "How do users feel about the product right now?",
242
242
  status: "active",
243
243
  target: 100,
244
- createdAt: I(30),
244
+ createdAt: F(30),
245
245
  questions: [
246
246
  { id: "s1q1", type: "nps", text: "How likely are you to recommend us to a colleague?", required: !0 },
247
247
  { id: "s1q2", type: "rating", text: "How satisfied are you with the product?", required: !0 },
@@ -255,95 +255,95 @@ const G = (t, i) => t.length ? t.filter((a) => a.some((s) => i.includes(s))).len
255
255
  description: "First-week feedback from new accounts.",
256
256
  status: "draft",
257
257
  target: 50,
258
- createdAt: I(5),
258
+ createdAt: F(5),
259
259
  questions: [
260
260
  { id: "s2q1", type: "nps", text: "How likely are you to recommend our onboarding?", required: !0 },
261
261
  { id: "s2q2", type: "open_text", text: "What was confusing?", required: !1 }
262
262
  ]
263
263
  }
264
- ], P = ["Love the rollout controls", "Dashboards load slowly", "Needs better docs", "Great support", "Too many clicks to create a flag"];
265
- function se() {
266
- const t = _(7);
267
- return Array.from({ length: 36 }, (i, a) => {
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
268
  const s = Math.min(10, Math.floor(t() * t() * 4 + t() * 8 + 3));
269
269
  return {
270
- id: `r${a}`,
270
+ id: `r${n}`,
271
271
  surveyId: "s1",
272
- userId: `user_${100 + a}`,
273
- createdAt: I(Math.floor(t() * 28)),
272
+ userId: `user_${100 + n}`,
273
+ createdAt: F(Math.floor(t() * 28)),
274
274
  answers: [
275
275
  { questionId: "s1q1", value: s },
276
276
  { questionId: "s1q2", value: Math.max(1, Math.min(5, Math.round(s / 2))) },
277
277
  { questionId: "s1q3", value: ["Feature Flags", "Experiments", "Segments", "Audit Log"][Math.floor(t() * 4)] },
278
- { questionId: "s1q4", value: P[Math.floor(t() * P.length)] }
278
+ { questionId: "s1q4", value: _[Math.floor(t() * _.length)] }
279
279
  ]
280
280
  };
281
281
  });
282
282
  }
283
- const R = (t) => t >= 9 ? "promoter" : t >= 7 ? "passive" : "detractor";
284
- function A(t) {
283
+ const H = (t) => t >= 9 ? "promoter" : t >= 7 ? "passive" : "detractor";
284
+ function $(t) {
285
285
  if (t.length === 0) return null;
286
- const i = t.filter((s) => s >= 9).length, a = t.filter((s) => s <= 6).length;
286
+ const r = t.filter((s) => s >= 9).length, n = t.filter((s) => s <= 6).length;
287
287
  return {
288
- score: Math.round((i - a) / t.length * 100),
289
- promoters: i,
290
- passives: t.length - i - a,
291
- detractors: a,
288
+ score: Math.round((r - n) / t.length * 100),
289
+ promoters: r,
290
+ passives: t.length - r - n,
291
+ detractors: n,
292
292
  total: t.length
293
293
  };
294
294
  }
295
- function M(t, i) {
296
- const a = t.questions.find((s) => s.type === "nps");
297
- return a ? i.filter((s) => s.surveyId === t.id).map((s) => {
298
- var o;
299
- return (o = s.answers.find((p) => p.questionId === a.id)) == null ? void 0 : o.value;
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
300
  }).filter((s) => typeof s == "number") : [];
301
301
  }
302
- const ae = ["nps", "rating", "multiple_choice", "open_text"], q = (t) => new Date(t).toLocaleDateString(void 0, { day: "2-digit", month: "short", year: "numeric" }), de = () => {
303
- const [t, i] = N(te), [a, s] = N(se), [o, p] = N({ name: "list" }), g = (r) => t.find((c) => c.id === r), h = () => p({ name: "list" });
304
- if (o.name === "create")
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
305
  return /* @__PURE__ */ e(
306
- ne,
306
+ ge,
307
307
  {
308
- onCancel: h,
309
- onSave: (r) => {
310
- i((c) => [r, ...c]), h();
308
+ onCancel: v,
309
+ onSave: (l) => {
310
+ r((d) => [l, ...d]), v();
311
311
  }
312
312
  }
313
313
  );
314
- if (o.name === "take") {
315
- const r = g(o.id);
316
- return r ? /* @__PURE__ */ e(
317
- ie,
314
+ if (i.name === "take") {
315
+ const l = b(i.id);
316
+ return l ? /* @__PURE__ */ e(
317
+ ve,
318
318
  {
319
- survey: r,
320
- onCancel: h,
321
- onSubmit: (c) => {
322
- s((d) => [{ id: k("r"), surveyId: r.id, userId: `user_${900 + d.length}`, createdAt: (/* @__PURE__ */ new Date()).toISOString(), answers: c }, ...d]), p({ name: "results", id: r.id });
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
323
  }
324
324
  }
325
325
  ) : null;
326
326
  }
327
- if (o.name === "results") {
328
- const r = g(o.id);
329
- return r ? /* @__PURE__ */ e(re, { survey: r, responses: a.filter((c) => c.surveyId === r.id), onBack: h, onTake: () => p({ name: "take", id: r.id }) }) : null;
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
330
  }
331
- const f = a.length, u = t.filter((r) => r.status === "active").length, m = A(t.flatMap((r) => M(r, a)));
332
- return /* @__PURE__ */ n(
333
- C,
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
334
  {
335
335
  title: "Surveys",
336
336
  subtitle: "Create, run and measure user surveys.",
337
- actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => p({ name: "create" }), children: "+ Create Survey" }),
337
+ actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => g({ name: "create" }), children: "+ Create Survey" }),
338
338
  children: [
339
- /* @__PURE__ */ n("div", { className: "stats", children: [
340
- /* @__PURE__ */ e(y, { label: "Total surveys", value: t.length, color: "#6366f1" }),
341
- /* @__PURE__ */ e(y, { label: "Active", value: u, color: "#10b981" }),
342
- /* @__PURE__ */ e(y, { label: "Total responses", value: f }),
343
- /* @__PURE__ */ e(y, { label: "Overall NPS", value: m ? m.score : "—", color: "#f59e0b" })
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
344
  ] }),
345
- /* @__PURE__ */ n("table", { className: "table", children: [
346
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
345
+ /* @__PURE__ */ a("table", { className: "table", children: [
346
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
347
347
  /* @__PURE__ */ e("th", { children: "Survey" }),
348
348
  /* @__PURE__ */ e("th", { children: "Status" }),
349
349
  /* @__PURE__ */ e("th", { children: "Progress" }),
@@ -351,13 +351,13 @@ const ae = ["nps", "rating", "multiple_choice", "open_text"], q = (t) => new Dat
351
351
  /* @__PURE__ */ e("th", { children: "Created" }),
352
352
  /* @__PURE__ */ e("th", {})
353
353
  ] }) }),
354
- /* @__PURE__ */ e("tbody", { children: t.map((r) => {
355
- const c = a.filter((l) => l.surveyId === r.id).length, d = A(M(r, a));
356
- return /* @__PURE__ */ n("tr", { children: [
357
- /* @__PURE__ */ n("td", { children: [
358
- /* @__PURE__ */ e("strong", { children: r.name }),
359
- /* @__PURE__ */ n("div", { className: "muted small", children: [
360
- r.questions.length,
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
361
  " questions"
362
362
  ] })
363
363
  ] }),
@@ -365,188 +365,814 @@ const ae = ["nps", "rating", "multiple_choice", "open_text"], q = (t) => new Dat
365
365
  "select",
366
366
  {
367
367
  className: "input slim",
368
- value: r.status,
369
- onChange: (l) => i((b) => b.map((v) => v.id === r.id ? { ...v, status: l.target.value } : v)),
370
- children: ["draft", "active", "paused", "closed"].map((l) => /* @__PURE__ */ e("option", { children: l }, l))
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
371
  }
372
372
  ) }),
373
- /* @__PURE__ */ n("td", { style: { minWidth: 140 }, children: [
374
- /* @__PURE__ */ n("div", { className: "small mono", children: [
375
- c,
373
+ /* @__PURE__ */ a("td", { style: { minWidth: 140 }, children: [
374
+ /* @__PURE__ */ a("div", { className: "small mono", children: [
375
+ d,
376
376
  " / ",
377
- r.target
377
+ l.target
378
378
  ] }),
379
- /* @__PURE__ */ e(S, { pct: c / r.target * 100 })
379
+ /* @__PURE__ */ e(E, { pct: d / l.target * 100 })
380
380
  ] }),
381
- /* @__PURE__ */ e("td", { className: "mono", children: d ? d.score : "—" }),
382
- /* @__PURE__ */ e("td", { className: "muted small", children: q(r.createdAt) }),
383
- /* @__PURE__ */ n("td", { className: "right", children: [
384
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => p({ name: "results", id: r.id }), children: "Results" }),
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
385
  " ",
386
- /* @__PURE__ */ e("button", { className: "btn", disabled: r.status !== "active", title: r.status !== "active" ? "Set status to active to collect answers" : "", onClick: () => p({ name: "take", id: r.id }), children: "Take" }),
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
387
  " ",
388
388
  /* @__PURE__ */ e(
389
389
  "button",
390
390
  {
391
391
  className: "btn danger",
392
392
  onClick: () => {
393
- window.confirm(`Delete "${r.name}" and its responses?`) && (i((l) => l.filter((b) => b.id !== r.id)), s((l) => l.filter((b) => b.surveyId !== r.id)));
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
394
  },
395
395
  children: "Delete"
396
396
  }
397
397
  )
398
398
  ] })
399
- ] }, r.id);
399
+ ] }, l.id);
400
400
  }) })
401
401
  ] })
402
402
  ]
403
403
  }
404
404
  );
405
- }, ne = ({ onSave: t, onCancel: i }) => {
406
- const [a, s] = N(""), [o, p] = N(""), [g, h] = N(100), [f, u] = N([{ id: k("q"), type: "nps", text: "How likely are you to recommend us?", required: !0 }]), [m, r] = N(""), c = (l, b) => u((v) => v.map((w) => w.id === l ? { ...w, ...b } : w)), d = () => {
407
- if (!a.trim()) return r("Survey name is required.");
408
- if (f.length === 0) return r("Add at least one question.");
409
- if (f.some((l) => !l.text.trim())) return r("Every question needs text.");
410
- if (f.some((l) => l.type === "multiple_choice" && (l.options ?? []).filter((b) => b.trim()).length < 2)) return r("Multiple choice needs at least two options.");
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
411
  t({
412
- id: k("s"),
413
- name: a.trim(),
414
- description: o.trim(),
412
+ id: M("s"),
413
+ name: n.trim(),
414
+ description: i.trim(),
415
415
  status: "active",
416
- target: g,
416
+ target: b,
417
417
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
418
- questions: f.map((l) => ({ ...l, text: l.text.trim(), options: l.type === "multiple_choice" ? (l.options ?? []).filter((b) => b.trim()) : void 0 }))
418
+ questions: f.map((c) => ({ ...c, text: c.text.trim(), options: c.type === "multiple_choice" ? (c.options ?? []).filter((w) => w.trim()) : void 0 }))
419
419
  });
420
420
  };
421
- return /* @__PURE__ */ n(C, { title: "Create Survey", subtitle: "Build a new survey.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: i, children: "Back" }), children: [
422
- /* @__PURE__ */ n("div", { className: "card form", children: [
423
- /* @__PURE__ */ n("label", { children: [
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
424
  "Name",
425
- /* @__PURE__ */ e("input", { className: "input", value: a, onChange: (l) => s(l.target.value), placeholder: "e.g. Q1 Product Satisfaction" })
425
+ /* @__PURE__ */ e("input", { className: "input", value: n, onChange: (c) => s(c.target.value), placeholder: "e.g. Q1 Product Satisfaction" })
426
426
  ] }),
427
- /* @__PURE__ */ n("label", { children: [
427
+ /* @__PURE__ */ a("label", { children: [
428
428
  "Description",
429
- /* @__PURE__ */ e("input", { className: "input", value: o, onChange: (l) => p(l.target.value) })
429
+ /* @__PURE__ */ e("input", { className: "input", value: i, onChange: (c) => g(c.target.value) })
430
430
  ] }),
431
- /* @__PURE__ */ n("label", { children: [
431
+ /* @__PURE__ */ a("label", { children: [
432
432
  "Target responses",
433
- /* @__PURE__ */ e("input", { className: "input narrow", type: "number", min: 1, value: g, onChange: (l) => h(Math.max(1, parseInt(l.target.value, 10) || 1)) })
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
434
  ] })
435
435
  ] }),
436
- /* @__PURE__ */ n("h3", { children: [
436
+ /* @__PURE__ */ a("h3", { children: [
437
437
  "Questions (",
438
438
  f.length,
439
439
  ")"
440
440
  ] }),
441
- f.map((l, b) => /* @__PURE__ */ n("div", { className: "card form", children: [
442
- /* @__PURE__ */ n("div", { className: "row", children: [
443
- /* @__PURE__ */ n("strong", { children: [
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
444
  "Q",
445
- b + 1
445
+ w + 1
446
446
  ] }),
447
- /* @__PURE__ */ e("select", { className: "input slim", value: l.type, onChange: (v) => c(l.id, { type: v.target.value, options: v.target.value === "multiple_choice" ? ["Option 1", "Option 2"] : void 0 }), children: ae.map((v) => /* @__PURE__ */ e("option", { value: v, children: v.replace("_", " ") }, v)) }),
448
- /* @__PURE__ */ n("label", { className: "inline", children: [
449
- /* @__PURE__ */ e("input", { type: "checkbox", checked: l.required, onChange: (v) => c(l.id, { required: v.target.checked }) }),
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
450
  " required"
451
451
  ] }),
452
452
  /* @__PURE__ */ e("span", { className: "grow" }),
453
- /* @__PURE__ */ e("button", { className: "btn danger", onClick: () => u((v) => v.filter((w) => w.id !== l.id)), children: "Remove" })
453
+ /* @__PURE__ */ e("button", { className: "btn danger", onClick: () => m((o) => o.filter((h) => h.id !== c.id)), children: "Remove" })
454
454
  ] }),
455
- /* @__PURE__ */ e("input", { className: "input", value: l.text, onChange: (v) => c(l.id, { text: v.target.value }), placeholder: "Enter your question…" }),
456
- l.type === "multiple_choice" && /* @__PURE__ */ n("div", { className: "stack", children: [
457
- (l.options ?? []).map((v, w) => /* @__PURE__ */ e("input", { className: "input slim", value: v, onChange: (D) => c(l.id, { options: (l.options ?? []).map((F, O) => O === w ? D.target.value : F) }) }, w)),
458
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => c(l.id, { options: [...l.options ?? [], `Option ${(l.options ?? []).length + 1}`] }), children: "+ Add option" })
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
459
  ] })
460
- ] }, l.id)),
461
- /* @__PURE__ */ n("div", { className: "row", children: [
462
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => u((l) => [...l, { id: k("q"), type: "rating", text: "", required: !1 }]), children: "+ Add question" }),
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
463
  /* @__PURE__ */ e("span", { className: "grow" }),
464
- m && /* @__PURE__ */ e("span", { className: "error", children: m }),
465
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: d, children: "Create Survey" })
464
+ p && /* @__PURE__ */ e("span", { className: "error", children: p }),
465
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: u, children: "Create Survey" })
466
466
  ] })
467
467
  ] });
468
- }, ie = ({ survey: t, onSubmit: i, onCancel: a }) => {
469
- const [s, o] = N({}), [p, g] = N(""), h = (u, m) => o((r) => ({ ...r, [u]: m })), f = () => {
470
- const u = t.questions.find((m) => m.required && (s[m.id] === void 0 || s[m.id] === ""));
471
- if (u) return g(`"${u.text}" is required.`);
472
- g(""), i(t.questions.filter((m) => s[m.id] !== void 0 && s[m.id] !== "").map((m) => ({ questionId: m.id, value: s[m.id] })));
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
473
  };
474
- return /* @__PURE__ */ n(C, { title: t.name, subtitle: t.description || "Answer the questions below.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: a, children: "Cancel" }), children: [
475
- t.questions.map((u, m) => /* @__PURE__ */ n("div", { className: "card form", children: [
476
- /* @__PURE__ */ n("strong", { children: [
477
- m + 1,
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
478
  ". ",
479
- u.text,
480
- u.required && /* @__PURE__ */ e("span", { className: "error", children: " *" })
479
+ m.text,
480
+ m.required && /* @__PURE__ */ e("span", { className: "error", children: " *" })
481
481
  ] }),
482
- u.type === "nps" && /* @__PURE__ */ e("div", { className: "scale", children: Array.from({ length: 11 }, (r, c) => /* @__PURE__ */ e("button", { className: s[u.id] === c ? "chip active" : "chip", onClick: () => h(u.id, c), children: c }, c)) }),
483
- u.type === "rating" && /* @__PURE__ */ e("div", { className: "scale", children: [1, 2, 3, 4, 5].map((r) => /* @__PURE__ */ n("button", { className: s[u.id] === r ? "chip active" : "chip", onClick: () => h(u.id, r), children: [
484
- r,
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
485
  " ★"
486
- ] }, r)) }),
487
- u.type === "multiple_choice" && /* @__PURE__ */ e("div", { className: "scale", children: (u.options ?? []).map((r) => /* @__PURE__ */ e("button", { className: s[u.id] === r ? "chip active" : "chip", onClick: () => h(u.id, r), children: r }, r)) }),
488
- u.type === "open_text" && /* @__PURE__ */ e("textarea", { className: "input", rows: 2, value: String(s[u.id] ?? ""), onChange: (r) => h(u.id, r.target.value) })
489
- ] }, u.id)),
490
- /* @__PURE__ */ n("div", { className: "row", children: [
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
491
  /* @__PURE__ */ e("span", { className: "grow" }),
492
- p && /* @__PURE__ */ e("span", { className: "error", children: p }),
492
+ g && /* @__PURE__ */ e("span", { className: "error", children: g }),
493
493
  /* @__PURE__ */ e("button", { className: "btn primary", onClick: f, children: "Submit response" })
494
494
  ] })
495
495
  ] });
496
- }, re = ({ survey: t, responses: i, onBack: a, onTake: s }) => {
497
- const o = x(() => A(M(t, i)), [t, i]), p = t.questions.find((h) => h.type === "nps"), g = (h) => o ? Math.round(h / o.total * 100) : 0;
498
- return /* @__PURE__ */ n(
499
- C,
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
500
  {
501
501
  title: t.name,
502
- subtitle: `${i.length} responses`,
503
- actions: /* @__PURE__ */ n(B, { children: [
504
- /* @__PURE__ */ e("button", { className: "btn", onClick: a, children: "Back" }),
502
+ subtitle: `${r.length} responses`,
503
+ actions: /* @__PURE__ */ a(j, { children: [
504
+ /* @__PURE__ */ e("button", { className: "btn", onClick: n, children: "Back" }),
505
505
  /* @__PURE__ */ e("button", { className: "btn primary", disabled: t.status !== "active", onClick: s, children: "Take survey" })
506
506
  ] }),
507
507
  children: [
508
- /* @__PURE__ */ n("div", { className: "stats", children: [
509
- /* @__PURE__ */ e(y, { label: "NPS", value: o ? o.score : "—", color: "#f59e0b" }),
510
- /* @__PURE__ */ e(y, { label: "Promoters", value: o ? `${g(o.promoters)}%` : "—", color: "#4edea3" }),
511
- /* @__PURE__ */ e(y, { label: "Passives", value: o ? `${g(o.passives)}%` : "—", color: "#ffcc6b" }),
512
- /* @__PURE__ */ e(y, { label: "Detractors", value: o ? `${g(o.detractors)}%` : "—", color: "#ffb4ab" })
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
513
  ] }),
514
- /* @__PURE__ */ n("table", { className: "table", children: [
515
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
514
+ /* @__PURE__ */ a("table", { className: "table", children: [
515
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
516
516
  /* @__PURE__ */ e("th", { children: "User" }),
517
517
  /* @__PURE__ */ e("th", { children: "NPS" }),
518
- t.questions.filter((h) => h.type !== "nps").map((h) => /* @__PURE__ */ e("th", { children: h.text }, h.id)),
518
+ t.questions.filter((v) => v.type !== "nps").map((v) => /* @__PURE__ */ e("th", { children: v.text }, v.id)),
519
519
  /* @__PURE__ */ e("th", { children: "Date" })
520
520
  ] }) }),
521
- /* @__PURE__ */ n("tbody", { children: [
522
- i.length === 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 9, className: "muted", children: "No responses yet." }) }),
523
- i.map((h) => {
524
- var u;
525
- const f = p ? (u = h.answers.find((m) => m.questionId === p.id)) == null ? void 0 : u.value : void 0;
526
- return /* @__PURE__ */ n("tr", { children: [
527
- /* @__PURE__ */ e("td", { className: "mono", children: h.userId }),
528
- /* @__PURE__ */ e("td", { children: typeof f == "number" ? /* @__PURE__ */ n("span", { className: `pill ${R(f)}`, children: [
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
529
  f,
530
530
  " · ",
531
- R(f)
531
+ H(f)
532
532
  ] }) : "—" }),
533
- t.questions.filter((m) => m.type !== "nps").map((m) => {
534
- var r;
535
- return /* @__PURE__ */ e("td", { children: String(((r = h.answers.find((c) => c.questionId === m.id)) == null ? void 0 : r.value) ?? "—") }, m.id);
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
536
  }),
537
- /* @__PURE__ */ e("td", { className: "muted small", children: q(h.createdAt) })
538
- ] }, h.id);
537
+ /* @__PURE__ */ e("td", { className: "muted small", children: Q(v.createdAt) })
538
+ ] }, v.id);
539
539
  })
540
540
  ] })
541
541
  ] })
542
542
  ]
543
543
  }
544
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
+ ] });
545
1164
  };
546
1165
  export {
547
1166
  ce as JourneyApp,
548
- de as SurveyApp,
549
- R as npsCategory,
550
- A as npsOf,
551
- M as npsScores
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
552
1178
  };