@shiva004/surveys 0.3.0 → 0.4.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,23 @@
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: [
1
+ import { jsxs as r, jsx as e, Fragment as ae } from "react/jsx-runtime";
2
+ import ge, { useState as y, useMemo as Y, useRef as _, useCallback as L, useLayoutEffect as xe, useEffect as B, useContext as je, useSyncExternalStore as Ce, createContext as Te } from "react";
3
+ import { createPortal as ve } from "react-dom";
4
+ const q = ({ label: t, value: a, color: n = "#7c3aed" }) => /* @__PURE__ */ r("div", { className: "stat", style: { borderTopColor: n }, children: [
4
5
  /* @__PURE__ */ e("div", { className: "stat-label", children: t }),
5
- /* @__PURE__ */ e("div", { className: "stat-value", children: r })
6
- ] }), q = ({ items: t, value: r, onChange: n }) => /* @__PURE__ */ e("div", { className: "tabs", children: t.map((s) => /* @__PURE__ */ e("button", { type: "button", className: s.id === r ? "tab active" : "tab", onClick: () => n(s.id), children: s.label }, s.id)) }), E = ({ pct: t, color: r = "#7c3aed" }) => /* @__PURE__ */ e("div", { className: "bar", children: /* @__PURE__ */ e("div", { className: "bar-fill", style: { width: `${Math.max(0, Math.min(100, t))}%`, background: r } }) }), I = ({ title: t, subtitle: r, actions: n, children: s }) => /* @__PURE__ */ a("section", { children: [
7
- /* @__PURE__ */ a("div", { className: "page-head", children: [
8
- /* @__PURE__ */ a("div", { children: [
6
+ /* @__PURE__ */ e("div", { className: "stat-value", children: a })
7
+ ] }), fe = ({ items: t, value: a, onChange: n }) => /* @__PURE__ */ e("div", { className: "tabs", children: t.map((s) => /* @__PURE__ */ e("button", { type: "button", className: s.id === a ? "tab active" : "tab", onClick: () => n(s.id), children: s.label }, s.id)) }), K = ({ pct: t, color: a = "#7c3aed" }) => /* @__PURE__ */ e("div", { className: "bar", children: /* @__PURE__ */ e("div", { className: "bar-fill", style: { width: `${Math.max(0, Math.min(100, t))}%`, background: a } }) }), ee = ({ title: t, subtitle: a, actions: n, children: s }) => /* @__PURE__ */ r("section", { children: [
8
+ /* @__PURE__ */ r("div", { className: "page-head", children: [
9
+ /* @__PURE__ */ r("div", { children: [
9
10
  /* @__PURE__ */ e("h2", { children: t }),
10
- r && /* @__PURE__ */ e("p", { className: "muted", children: r })
11
+ a && /* @__PURE__ */ e("p", { className: "muted", children: a })
11
12
  ] }),
12
13
  /* @__PURE__ */ e("div", { className: "actions", children: n })
13
14
  ] }),
14
15
  s
15
- ] }), B = (t) => () => {
16
+ ] }), be = (t) => () => {
16
17
  t |= 0, t = t + 1831565813 | 0;
17
- let r = Math.imul(t ^ t >>> 15, 1 | t);
18
- return r = r + Math.imul(r ^ r >>> 7, 61 | r) ^ r, ((r ^ r >>> 14) >>> 0) / 4294967296;
19
- }, M = (t) => `${t}_${Math.random().toString(36).slice(2, 8)}`, z = ["/home", "/pricing", "/features", "/docs", "/signup", "/dashboard", "/checkout"], K = [["/home", 0.55], ["/pricing", 0.15], ["/features", 0.15], ["/docs", 0.15]], Z = {
18
+ let a = Math.imul(t ^ t >>> 15, 1 | t);
19
+ return a = a + Math.imul(a ^ a >>> 7, 61 | a) ^ a, ((a ^ a >>> 14) >>> 0) / 4294967296;
20
+ }, Z = (t) => `${t}_${Math.random().toString(36).slice(2, 8)}`, Ie = ["/home", "/pricing", "/features", "/docs", "/signup", "/dashboard", "/checkout"], Me = [["/home", 0.55], ["/pricing", 0.15], ["/features", 0.15], ["/docs", 0.15]], Ee = {
20
21
  "/home": [["/pricing", 0.3], ["/features", 0.3], ["/docs", 0.1], ["/signup", 0.1], ["EXIT", 0.2]],
21
22
  "/pricing": [["/signup", 0.3], ["/features", 0.15], ["/home", 0.1], ["EXIT", 0.45]],
22
23
  "/features": [["/pricing", 0.3], ["/signup", 0.15], ["/docs", 0.15], ["EXIT", 0.4]],
@@ -24,63 +25,63 @@ const C = ({ label: t, value: r, color: n = "#7c3aed" }) => /* @__PURE__ */ a("d
24
25
  "/signup": [["/dashboard", 0.6], ["EXIT", 0.4]],
25
26
  "/dashboard": [["/checkout", 0.25], ["/docs", 0.15], ["/features", 0.1], ["EXIT", 0.5]],
26
27
  "/checkout": [["EXIT", 1]]
27
- }, L = (t, r) => {
28
+ }, he = (t, a) => {
28
29
  let n = 0;
29
30
  for (const [s, i] of t)
30
- if (n += i, r < n) return s;
31
+ if (n += i, a < n) return s;
31
32
  return t[t.length - 1][0];
32
33
  };
33
- function G(t, r) {
34
+ function we(t, a) {
34
35
  return Array.from({ length: t }, () => {
35
- let n = L(K, r());
36
+ let n = he(Me, a());
36
37
  const s = [n];
37
38
  for (; s.length < 8; ) {
38
- const i = L(Z[n], r());
39
+ const i = he(Ee[n], a());
39
40
  if (i === "EXIT") break;
40
41
  s.push(i), n = i;
41
42
  }
42
43
  return s;
43
44
  });
44
45
  }
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));
46
+ const Ae = () => we(400, be(42));
47
+ function Pe(t) {
48
+ const a = /* @__PURE__ */ new Map(), n = (s) => (a.has(s) || a.set(s, { views: 0, entries: 0, bounces: 0, exits: 0 }), a.get(s));
48
49
  for (const s of t)
49
50
  s.forEach((i) => {
50
51
  n(i).views += 1;
51
52
  }), 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
+ return [...a.entries()].map(([s, i]) => ({
53
54
  page: s,
54
55
  views: i.views,
55
56
  bounceRate: i.entries ? i.bounces / i.entries * 100 : 0,
56
57
  exitRate: i.views ? i.exits / i.views * 100 : 0
57
58
  })).sort((s, i) => i.views - s.views);
58
59
  }
59
- function ae(t, r = 8) {
60
+ function Re(t, a = 8) {
60
61
  const n = /* @__PURE__ */ new Map();
61
62
  for (const s of t) {
62
- const i = s.slice(0, 4), g = i.join(">"), b = n.get(g) ?? { steps: i, users: 0, conv: 0 };
63
- b.users += 1, s.includes("/signup") && (b.conv += 1), n.set(g, b);
63
+ const i = s.slice(0, 4), m = i.join(">"), f = n.get(m) ?? { steps: i, users: 0, conv: 0 };
64
+ f.users += 1, s.includes("/signup") && (f.conv += 1), n.set(m, f);
64
65
  }
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
+ 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, a);
66
67
  }
67
- function se(t) {
68
- const r = /* @__PURE__ */ new Map();
68
+ function $e(t) {
69
+ const a = /* @__PURE__ */ new Map();
69
70
  for (const n of t)
70
71
  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);
72
+ const i = a.get(n[s]) ?? /* @__PURE__ */ new Map();
73
+ i.set(n[s + 1], (i.get(n[s + 1]) ?? 0) + 1), a.set(n[s], i);
73
74
  }
74
- return [...r.entries()].map(([n, s]) => {
75
- const i = [...s.values()].reduce((g, b) => g + b, 0);
75
+ return [...a.entries()].map(([n, s]) => {
76
+ const i = [...s.values()].reduce((m, f) => m + f, 0);
76
77
  return {
77
78
  from: n,
78
79
  total: i,
79
- destinations: [...s.entries()].map(([g, b]) => ({ to: g, pct: b / i * 100 })).sort((g, b) => b.pct - g.pct)
80
+ destinations: [...s.entries()].map(([m, f]) => ({ to: m, pct: f / i * 100 })).sort((m, f) => f.pct - m.pct)
80
81
  };
81
82
  }).sort((n, s) => s.total - n.total);
82
83
  }
83
- const oe = (t, r) => t.length ? t.filter((n) => n.some((s) => r.includes(s))).length / t.length * 100 : 0, ne = {
84
+ const Le = (t, a) => t.length ? t.filter((n) => n.some((s) => a.includes(s))).length / t.length * 100 : 0, qe = {
84
85
  id: "jm1",
85
86
  name: "New customer journey",
86
87
  stages: [
@@ -90,158 +91,158 @@ const oe = (t, r) => t.length ? t.filter((n) => n.some((s) => r.includes(s))).le
90
91
  { id: "st4", name: "Activation", emotion: "engaged", pages: ["/dashboard"] },
91
92
  { id: "st5", name: "Purchase", emotion: "satisfied", pages: ["/checkout"] }
92
93
  ]
93
- }, re = [
94
+ }, Oe = [
94
95
  { id: "nav", label: "Navigation Analysis" },
95
96
  { id: "paths", label: "Paths" },
96
97
  { id: "flows", label: "Userflows" },
97
98
  { id: "maps", label: "Journey Maps" }
98
- ], W = { curious: "#adc6ff", analytical: "#7c3aed", confident: "#4edea3", engaged: "#d2bbff", satisfied: "#ffcc6b", cautious: "#ffb4ab" }, ie = (t) => t.split("/").filter(Boolean).pop() ?? t, le = (t) => t > 25 ? "#ffb4ab" : t > 15 ? "#ffcc6b" : "#4edea3", ce = () => {
99
- var d;
100
- const [t, r] = y("nav"), [n, s] = y(ee), [i, g] = y(ne), b = S(() => te(n), [n]), v = S(() => ae(n), [n]), f = S(() => se(n), [n]), m = b.reduce((u, c) => u + c.views, 0), p = n.length, l = n.filter((u) => u.length === 1).length;
101
- return /* @__PURE__ */ a(
102
- I,
99
+ ], ue = { curious: "#adc6ff", analytical: "#7c3aed", confident: "#4edea3", engaged: "#d2bbff", satisfied: "#ffcc6b", cautious: "#ffb4ab" }, _e = (t) => t.split("/").filter(Boolean).pop() ?? t, Fe = (t) => t > 25 ? "#ffb4ab" : t > 15 ? "#ffcc6b" : "#4edea3", De = () => {
100
+ var u;
101
+ const [t, a] = y("nav"), [n, s] = y(Ae), [i, m] = y(qe), f = Y(() => Pe(n), [n]), g = Y(() => Re(n), [n]), w = Y(() => $e(n), [n]), c = f.reduce((h, l) => h + l.views, 0), d = n.length, o = n.filter((h) => h.length === 1).length;
102
+ return /* @__PURE__ */ r(
103
+ ee,
103
104
  {
104
105
  title: "User Journey",
105
106
  subtitle: "One stream of page views feeds every view below.",
106
- actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => s((u) => [...u, ...G(50, Math.random)]), children: "+ Simulate 50 sessions" }),
107
+ actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => s((h) => [...h, ...we(50, Math.random)]), children: "+ Simulate 50 sessions" }),
107
108
  children: [
108
- /* @__PURE__ */ a("div", { className: "stats", children: [
109
- /* @__PURE__ */ e(C, { label: "Sessions", value: p.toLocaleString(), color: "#6366f1" }),
110
- /* @__PURE__ */ e(C, { label: "Page views", value: m.toLocaleString(), color: "#0ea5e9" }),
111
- /* @__PURE__ */ e(C, { label: "Bounce rate", value: `${p ? (l / p * 100).toFixed(1) : 0}%`, color: "#f59e0b" }),
112
- /* @__PURE__ */ e(C, { label: "Top page", value: ((d = b[0]) == null ? void 0 : d.page) ?? "—", color: "#10b981" })
109
+ /* @__PURE__ */ r("div", { className: "stats", children: [
110
+ /* @__PURE__ */ e(q, { label: "Sessions", value: d.toLocaleString(), color: "#6366f1" }),
111
+ /* @__PURE__ */ e(q, { label: "Page views", value: c.toLocaleString(), color: "#0ea5e9" }),
112
+ /* @__PURE__ */ e(q, { label: "Bounce rate", value: `${d ? (o / d * 100).toFixed(1) : 0}%`, color: "#f59e0b" }),
113
+ /* @__PURE__ */ e(q, { label: "Top page", value: ((u = f[0]) == null ? void 0 : u.page) ?? "—", color: "#10b981" })
113
114
  ] }),
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: [
115
+ /* @__PURE__ */ e(fe, { items: Oe, value: t, onChange: a }),
116
+ t === "nav" && /* @__PURE__ */ r("table", { className: "table", children: [
117
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
117
118
  /* @__PURE__ */ e("th", { children: "Page" }),
118
119
  /* @__PURE__ */ e("th", { children: "Views" }),
119
120
  /* @__PURE__ */ e("th", { children: "Share" }),
120
121
  /* @__PURE__ */ e("th", { children: "Bounce rate" }),
121
122
  /* @__PURE__ */ e("th", { children: "Exit rate" })
122
123
  ] }) }),
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),
124
+ /* @__PURE__ */ e("tbody", { children: f.map((h) => /* @__PURE__ */ r("tr", { children: [
125
+ /* @__PURE__ */ e("td", { className: "mono", children: h.page }),
126
+ /* @__PURE__ */ e("td", { className: "mono", children: h.views }),
127
+ /* @__PURE__ */ e("td", { style: { minWidth: 120 }, children: /* @__PURE__ */ e(K, { pct: h.views / c * 100 }) }),
128
+ /* @__PURE__ */ r("td", { className: "mono", style: { color: Fe(h.bounceRate) }, children: [
129
+ h.bounceRate.toFixed(1),
129
130
  "%"
130
131
  ] }),
131
- /* @__PURE__ */ a("td", { className: "mono", children: [
132
- u.exitRate.toFixed(1),
132
+ /* @__PURE__ */ r("td", { className: "mono", children: [
133
+ h.exitRate.toFixed(1),
133
134
  "%"
134
135
  ] })
135
- ] }, u.page)) })
136
+ ] }, h.page)) })
136
137
  ] }),
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: [
138
+ t === "paths" && /* @__PURE__ */ e("div", { className: "grid", children: g.map((h, l) => /* @__PURE__ */ r("div", { className: "card", children: [
139
+ /* @__PURE__ */ r("div", { className: "row", children: [
140
+ /* @__PURE__ */ r("span", { className: "pill passive", children: [
140
141
  "#",
141
- c + 1
142
+ l + 1
142
143
  ] }),
143
144
  /* @__PURE__ */ e("span", { className: "grow" }),
144
- /* @__PURE__ */ a("span", { className: "mono small", children: [
145
- u.convRate.toFixed(1),
145
+ /* @__PURE__ */ r("span", { className: "mono small", children: [
146
+ h.convRate.toFixed(1),
146
147
  "% reach signup"
147
148
  ] })
148
149
  ] }),
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,
150
+ /* @__PURE__ */ e("div", { className: "steps", title: h.steps.join(" → "), children: h.steps.map((k, v) => /* @__PURE__ */ r(ge.Fragment, { children: [
151
+ v > 0 && /* @__PURE__ */ e("span", { className: "muted", children: "→" }),
152
+ /* @__PURE__ */ e("span", { className: "chip static", children: _e(k) })
153
+ ] }, v)) }),
154
+ /* @__PURE__ */ r("div", { className: "small muted", children: [
155
+ h.users,
155
156
  " users"
156
157
  ] }),
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 }),
158
+ /* @__PURE__ */ e(K, { pct: h.convRate, color: "#10b981" })
159
+ ] }, h.steps.join(">"))) }),
160
+ t === "flows" && /* @__PURE__ */ e("div", { className: "grid", children: w.map((h) => /* @__PURE__ */ r("div", { className: "card", children: [
161
+ /* @__PURE__ */ r("div", { className: "row", children: [
162
+ /* @__PURE__ */ e("strong", { className: "mono", children: h.from }),
162
163
  /* @__PURE__ */ e("span", { className: "grow" }),
163
- /* @__PURE__ */ a("span", { className: "small muted", children: [
164
- u.total,
164
+ /* @__PURE__ */ r("span", { className: "small muted", children: [
165
+ h.total,
165
166
  " transitions"
166
167
  ] })
167
168
  ] }),
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: [
169
+ h.destinations.slice(0, 4).map((l) => /* @__PURE__ */ r("div", { children: [
170
+ /* @__PURE__ */ r("div", { className: "row small", children: [
171
+ /* @__PURE__ */ r("span", { className: "mono", children: [
171
172
  "→ ",
172
- c.to
173
+ l.to
173
174
  ] }),
174
175
  /* @__PURE__ */ e("span", { className: "grow" }),
175
- /* @__PURE__ */ a("span", { className: "mono", children: [
176
- c.pct.toFixed(0),
176
+ /* @__PURE__ */ r("span", { className: "mono", children: [
177
+ l.pct.toFixed(0),
177
178
  "%"
178
179
  ] })
179
180
  ] }),
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 })
181
+ /* @__PURE__ */ e(K, { pct: l.pct })
182
+ ] }, l.to))
183
+ ] }, h.from)) }),
184
+ t === "maps" && /* @__PURE__ */ e(Je, { map: i, setMap: m, sessions: n })
184
185
  ]
185
186
  }
186
187
  );
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("");
188
+ }, Je = ({ map: t, setMap: a, sessions: n }) => {
189
+ const [s, i] = y(""), [m, f] = y("curious"), [g, w] = y([]), [c, d] = y(""), o = () => {
190
+ if (!s.trim()) return d("Stage name is required.");
191
+ if (g.length === 0) return d("Pick at least one touchpoint page.");
192
+ const u = { id: Z("st"), name: s.trim(), emotion: m, pages: g };
193
+ a({ ...t, stages: [...t.stages, u] }), i(""), w([]), d("");
193
194
  };
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 }),
195
+ return /* @__PURE__ */ r("div", { className: "stack", children: [
196
+ /* @__PURE__ */ e("input", { className: "input", value: t.name, onChange: (u) => a({ ...t, name: u.target.value }), "aria-label": "Journey name" }),
197
+ /* @__PURE__ */ r("div", { className: "stages", children: [
198
+ t.stages.map((u, h) => {
199
+ const l = Le(n, u.pages), k = ue[u.emotion] ?? "#7c3aed";
200
+ return /* @__PURE__ */ r("div", { className: "card stage", children: [
201
+ /* @__PURE__ */ r("div", { className: "row", children: [
202
+ /* @__PURE__ */ e("span", { className: "badge", style: { background: `${k}30`, color: k }, children: h + 1 }),
203
+ /* @__PURE__ */ e("strong", { children: u.name }),
203
204
  /* @__PURE__ */ e("span", { className: "grow" }),
204
- /* @__PURE__ */ e("button", { className: "btn danger", "aria-label": `Remove ${d.name}`, onClick: () => r({ ...t, stages: t.stages.filter((o) => o.id !== d.id) }), children: "✕" })
205
+ /* @__PURE__ */ e("button", { className: "btn danger", "aria-label": `Remove ${u.name}`, onClick: () => a({ ...t, stages: t.stages.filter((v) => v.id !== u.id) }), children: "✕" })
205
206
  ] }),
206
- d.pages.map((o) => /* @__PURE__ */ a("div", { className: "small mono muted", children: [
207
+ u.pages.map((v) => /* @__PURE__ */ r("div", { className: "small mono muted", children: [
207
208
  "✓ ",
208
- o
209
- ] }, o)),
210
- /* @__PURE__ */ a("div", { className: "small", style: { color: w }, children: [
209
+ v
210
+ ] }, v)),
211
+ /* @__PURE__ */ r("div", { className: "small", style: { color: k }, children: [
211
212
  "Emotion: ",
212
- d.emotion
213
+ u.emotion
213
214
  ] }),
214
- /* @__PURE__ */ e(E, { pct: c }),
215
- /* @__PURE__ */ a("div", { className: "small mono muted", children: [
216
- c.toFixed(0),
215
+ /* @__PURE__ */ e(K, { pct: l }),
216
+ /* @__PURE__ */ r("div", { className: "small mono muted", children: [
217
+ l.toFixed(0),
217
218
  "% reach"
218
219
  ] })
219
- ] }, d.id);
220
+ ] }, u.id);
220
221
  }),
221
222
  t.stages.length === 0 && /* @__PURE__ */ e("div", { className: "muted", children: "No stages yet. Add one below." })
222
223
  ] }),
223
- /* @__PURE__ */ a("div", { className: "card form", children: [
224
+ /* @__PURE__ */ r("div", { className: "card form", children: [
224
225
  /* @__PURE__ */ e("strong", { children: "Add stage" }),
225
- /* @__PURE__ */ a("div", { className: "row", children: [
226
- /* @__PURE__ */ e("input", { className: "input", placeholder: "Stage name", value: s, onChange: (d) => i(d.target.value) }),
227
- /* @__PURE__ */ e("select", { className: "input slim", value: g, onChange: (d) => b(d.target.value), children: Object.keys(W).map((d) => /* @__PURE__ */ e("option", { children: d }, d)) })
226
+ /* @__PURE__ */ r("div", { className: "row", children: [
227
+ /* @__PURE__ */ e("input", { className: "input", placeholder: "Stage name", value: s, onChange: (u) => i(u.target.value) }),
228
+ /* @__PURE__ */ e("select", { className: "input slim", value: m, onChange: (u) => f(u.target.value), children: Object.keys(ue).map((u) => /* @__PURE__ */ e("option", { children: u }, u)) })
228
229
  ] }),
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: [
230
+ /* @__PURE__ */ e("div", { className: "scale", children: Ie.map((u) => /* @__PURE__ */ e("button", { type: "button", className: g.includes(u) ? "chip active" : "chip", onClick: () => w((h) => h.includes(u) ? h.filter((l) => l !== u) : [...h, u]), children: u }, u)) }),
231
+ /* @__PURE__ */ r("div", { className: "row", children: [
231
232
  /* @__PURE__ */ e("span", { className: "grow" }),
232
- m && /* @__PURE__ */ e("span", { className: "error", children: m }),
233
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: l, children: "+ Add stage" })
233
+ c && /* @__PURE__ */ e("span", { className: "error", children: c }),
234
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: o, children: "+ Add stage" })
234
235
  ] })
235
236
  ] })
236
237
  ] });
237
- }, F = (t) => new Date(Date.UTC(2026, 10, 6) - t * 864e5).toISOString(), he = [
238
+ }, oe = (t) => new Date(Date.UTC(2026, 10, 6) - t * 864e5).toISOString(), Be = [
238
239
  {
239
240
  id: "s1",
240
241
  name: "Q4 Product Satisfaction",
241
242
  description: "How do users feel about the product right now?",
242
243
  status: "active",
243
244
  target: 100,
244
- createdAt: F(30),
245
+ createdAt: oe(30),
245
246
  questions: [
246
247
  { id: "s1q1", type: "nps", text: "How likely are you to recommend us to a colleague?", required: !0 },
247
248
  { id: "s1q2", type: "rating", text: "How satisfied are you with the product?", required: !0 },
@@ -255,95 +256,95 @@ const oe = (t, r) => t.length ? t.filter((n) => n.some((s) => r.includes(s))).le
255
256
  description: "First-week feedback from new accounts.",
256
257
  status: "draft",
257
258
  target: 50,
258
- createdAt: F(5),
259
+ createdAt: oe(5),
259
260
  questions: [
260
261
  { id: "s2q1", type: "nps", text: "How likely are you to recommend our onboarding?", required: !0 },
261
262
  { id: "s2q2", type: "open_text", text: "What was confusing?", required: !1 }
262
263
  ]
263
264
  }
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) => {
265
+ ], me = ["Love the rollout controls", "Dashboards load slowly", "Needs better docs", "Great support", "Too many clicks to create a flag"];
266
+ function We() {
267
+ const t = be(7);
268
+ return Array.from({ length: 36 }, (a, n) => {
268
269
  const s = Math.min(10, Math.floor(t() * t() * 4 + t() * 8 + 3));
269
270
  return {
270
271
  id: `r${n}`,
271
272
  surveyId: "s1",
272
273
  userId: `user_${100 + n}`,
273
- createdAt: F(Math.floor(t() * 28)),
274
+ createdAt: oe(Math.floor(t() * 28)),
274
275
  answers: [
275
276
  { questionId: "s1q1", value: s },
276
277
  { questionId: "s1q2", value: Math.max(1, Math.min(5, Math.round(s / 2))) },
277
278
  { questionId: "s1q3", value: ["Feature Flags", "Experiments", "Segments", "Audit Log"][Math.floor(t() * 4)] },
278
- { questionId: "s1q4", value: _[Math.floor(t() * _.length)] }
279
+ { questionId: "s1q4", value: me[Math.floor(t() * me.length)] }
279
280
  ]
280
281
  };
281
282
  });
282
283
  }
283
- const H = (t) => t >= 9 ? "promoter" : t >= 7 ? "passive" : "detractor";
284
- function $(t) {
284
+ const pe = (t) => t >= 9 ? "promoter" : t >= 7 ? "passive" : "detractor";
285
+ function le(t) {
285
286
  if (t.length === 0) return null;
286
- const r = t.filter((s) => s >= 9).length, n = t.filter((s) => s <= 6).length;
287
+ const a = t.filter((s) => s >= 9).length, n = t.filter((s) => s <= 6).length;
287
288
  return {
288
- score: Math.round((r - n) / t.length * 100),
289
- promoters: r,
290
- passives: t.length - r - n,
289
+ score: Math.round((a - n) / t.length * 100),
290
+ promoters: a,
291
+ passives: t.length - a - n,
291
292
  detractors: n,
292
293
  total: t.length
293
294
  };
294
295
  }
295
- function J(t, r) {
296
+ function ce(t, a) {
296
297
  const n = t.questions.find((s) => s.type === "nps");
297
- return n ? r.filter((s) => s.surveyId === t.id).map((s) => {
298
+ return n ? a.filter((s) => s.surveyId === t.id).map((s) => {
298
299
  var i;
299
- return (i = s.answers.find((g) => g.questionId === n.id)) == null ? void 0 : i.value;
300
+ return (i = s.answers.find((m) => m.questionId === n.id)) == null ? void 0 : i.value;
300
301
  }).filter((s) => typeof s == "number") : [];
301
302
  }
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" });
303
+ const He = ["nps", "rating", "multiple_choice", "open_text"], ye = (t) => new Date(t).toLocaleDateString(void 0, { day: "2-digit", month: "short", year: "numeric" }), Xe = () => {
304
+ const [t, a] = y(Be), [n, s] = y(We), [i, m] = y({ name: "list" }), f = (o) => t.find((u) => u.id === o), g = () => m({ name: "list" });
304
305
  if (i.name === "create")
305
306
  return /* @__PURE__ */ e(
306
- ge,
307
+ Ue,
307
308
  {
308
- onCancel: v,
309
- onSave: (l) => {
310
- r((d) => [l, ...d]), v();
309
+ onCancel: g,
310
+ onSave: (o) => {
311
+ a((u) => [o, ...u]), g();
311
312
  }
312
313
  }
313
314
  );
314
315
  if (i.name === "take") {
315
- const l = b(i.id);
316
- return l ? /* @__PURE__ */ e(
317
- ve,
316
+ const o = f(i.id);
317
+ return o ? /* @__PURE__ */ e(
318
+ Ve,
318
319
  {
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 });
320
+ survey: o,
321
+ onCancel: g,
322
+ onSubmit: (u) => {
323
+ s((h) => [{ id: Z("r"), surveyId: o.id, userId: `user_${900 + h.length}`, createdAt: (/* @__PURE__ */ new Date()).toISOString(), answers: u }, ...h]), m({ name: "results", id: o.id });
323
324
  }
324
325
  }
325
326
  ) : null;
326
327
  }
327
328
  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;
329
+ const o = f(i.id);
330
+ return o ? /* @__PURE__ */ e(Ye, { survey: o, responses: n.filter((u) => u.surveyId === o.id), onBack: g, onTake: () => m({ name: "take", id: o.id }) }) : null;
330
331
  }
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,
332
+ const w = n.length, c = t.filter((o) => o.status === "active").length, d = le(t.flatMap((o) => ce(o, n)));
333
+ return /* @__PURE__ */ r(
334
+ ee,
334
335
  {
335
336
  title: "Surveys",
336
337
  subtitle: "Create, run and measure user surveys.",
337
- actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => g({ name: "create" }), children: "+ Create Survey" }),
338
+ actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => m({ name: "create" }), children: "+ Create Survey" }),
338
339
  children: [
339
- /* @__PURE__ */ a("div", { className: "stats", children: [
340
- /* @__PURE__ */ e(C, { label: "Total surveys", value: t.length, color: "#6366f1" }),
341
- /* @__PURE__ */ e(C, { label: "Active", value: m, color: "#10b981" }),
342
- /* @__PURE__ */ e(C, { label: "Total responses", value: f }),
343
- /* @__PURE__ */ e(C, { label: "Overall NPS", value: p ? p.score : "—", color: "#f59e0b" })
340
+ /* @__PURE__ */ r("div", { className: "stats", children: [
341
+ /* @__PURE__ */ e(q, { label: "Total surveys", value: t.length, color: "#6366f1" }),
342
+ /* @__PURE__ */ e(q, { label: "Active", value: c, color: "#10b981" }),
343
+ /* @__PURE__ */ e(q, { label: "Total responses", value: w }),
344
+ /* @__PURE__ */ e(q, { label: "Overall NPS", value: d ? d.score : "—", color: "#f59e0b" })
344
345
  ] }),
345
- /* @__PURE__ */ a("table", { className: "table", children: [
346
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
346
+ /* @__PURE__ */ r("table", { className: "table", children: [
347
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
347
348
  /* @__PURE__ */ e("th", { children: "Survey" }),
348
349
  /* @__PURE__ */ e("th", { children: "Status" }),
349
350
  /* @__PURE__ */ e("th", { children: "Progress" }),
@@ -351,13 +352,13 @@ const me = ["nps", "rating", "multiple_choice", "open_text"], Q = (t) => new Dat
351
352
  /* @__PURE__ */ e("th", { children: "Created" }),
352
353
  /* @__PURE__ */ e("th", {})
353
354
  ] }) }),
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,
355
+ /* @__PURE__ */ e("tbody", { children: t.map((o) => {
356
+ const u = n.filter((l) => l.surveyId === o.id).length, h = le(ce(o, n));
357
+ return /* @__PURE__ */ r("tr", { children: [
358
+ /* @__PURE__ */ r("td", { children: [
359
+ /* @__PURE__ */ e("strong", { children: o.name }),
360
+ /* @__PURE__ */ r("div", { className: "muted small", children: [
361
+ o.questions.length,
361
362
  " questions"
362
363
  ] })
363
364
  ] }),
@@ -365,814 +366,809 @@ const me = ["nps", "rating", "multiple_choice", "open_text"], Q = (t) => new Dat
365
366
  "select",
366
367
  {
367
368
  className: "input slim",
368
- value: l.status,
369
- onChange: (c) => r((w) => w.map((o) => o.id === l.id ? { ...o, status: c.target.value } : o)),
370
- children: ["draft", "active", "paused", "closed"].map((c) => /* @__PURE__ */ e("option", { children: c }, c))
369
+ value: o.status,
370
+ onChange: (l) => a((k) => k.map((v) => v.id === o.id ? { ...v, status: l.target.value } : v)),
371
+ children: ["draft", "active", "paused", "closed"].map((l) => /* @__PURE__ */ e("option", { children: l }, l))
371
372
  }
372
373
  ) }),
373
- /* @__PURE__ */ a("td", { style: { minWidth: 140 }, children: [
374
- /* @__PURE__ */ a("div", { className: "small mono", children: [
375
- d,
374
+ /* @__PURE__ */ r("td", { style: { minWidth: 140 }, children: [
375
+ /* @__PURE__ */ r("div", { className: "small mono", children: [
376
+ u,
376
377
  " / ",
377
- l.target
378
+ o.target
378
379
  ] }),
379
- /* @__PURE__ */ e(E, { pct: d / l.target * 100 })
380
+ /* @__PURE__ */ e(K, { pct: u / o.target * 100 })
380
381
  ] }),
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" }),
382
+ /* @__PURE__ */ e("td", { className: "mono", children: h ? h.score : "—" }),
383
+ /* @__PURE__ */ e("td", { className: "muted small", children: ye(o.createdAt) }),
384
+ /* @__PURE__ */ r("td", { className: "right", children: [
385
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => m({ name: "results", id: o.id }), children: "Results" }),
385
386
  " ",
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
+ /* @__PURE__ */ e("button", { className: "btn", disabled: o.status !== "active", title: o.status !== "active" ? "Set status to active to collect answers" : "", onClick: () => m({ name: "take", id: o.id }), children: "Take" }),
387
388
  " ",
388
389
  /* @__PURE__ */ e(
389
390
  "button",
390
391
  {
391
392
  className: "btn danger",
392
393
  onClick: () => {
393
- window.confirm(`Delete "${l.name}" and its responses?`) && (r((c) => c.filter((w) => w.id !== l.id)), s((c) => c.filter((w) => w.surveyId !== l.id)));
394
+ window.confirm(`Delete "${o.name}" and its responses?`) && (a((l) => l.filter((k) => k.id !== o.id)), s((l) => l.filter((k) => k.surveyId !== o.id)));
394
395
  },
395
396
  children: "Delete"
396
397
  }
397
398
  )
398
399
  ] })
399
- ] }, l.id);
400
+ ] }, o.id);
400
401
  }) })
401
402
  ] })
402
403
  ]
403
404
  }
404
405
  );
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.");
406
+ }, Ue = ({ onSave: t, onCancel: a }) => {
407
+ const [n, s] = y(""), [i, m] = y(""), [f, g] = y(100), [w, c] = y([{ id: Z("q"), type: "nps", text: "How likely are you to recommend us?", required: !0 }]), [d, o] = y(""), u = (l, k) => c((v) => v.map((I) => I.id === l ? { ...I, ...k } : I)), h = () => {
408
+ if (!n.trim()) return o("Survey name is required.");
409
+ if (w.length === 0) return o("Add at least one question.");
410
+ if (w.some((l) => !l.text.trim())) return o("Every question needs text.");
411
+ if (w.some((l) => l.type === "multiple_choice" && (l.options ?? []).filter((k) => k.trim()).length < 2)) return o("Multiple choice needs at least two options.");
411
412
  t({
412
- id: M("s"),
413
+ id: Z("s"),
413
414
  name: n.trim(),
414
415
  description: i.trim(),
415
416
  status: "active",
416
- target: b,
417
+ target: f,
417
418
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
418
- questions: f.map((c) => ({ ...c, text: c.text.trim(), options: c.type === "multiple_choice" ? (c.options ?? []).filter((w) => w.trim()) : void 0 }))
419
+ questions: w.map((l) => ({ ...l, text: l.text.trim(), options: l.type === "multiple_choice" ? (l.options ?? []).filter((k) => k.trim()) : void 0 }))
419
420
  });
420
421
  };
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: [
422
+ return /* @__PURE__ */ r(ee, { title: "Create Survey", subtitle: "Build a new survey.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: a, children: "Back" }), children: [
423
+ /* @__PURE__ */ r("div", { className: "card form", children: [
424
+ /* @__PURE__ */ r("label", { children: [
424
425
  "Name",
425
- /* @__PURE__ */ e("input", { className: "input", value: n, onChange: (c) => s(c.target.value), placeholder: "e.g. Q1 Product Satisfaction" })
426
+ /* @__PURE__ */ e("input", { className: "input", value: n, onChange: (l) => s(l.target.value), placeholder: "e.g. Q1 Product Satisfaction" })
426
427
  ] }),
427
- /* @__PURE__ */ a("label", { children: [
428
+ /* @__PURE__ */ r("label", { children: [
428
429
  "Description",
429
- /* @__PURE__ */ e("input", { className: "input", value: i, onChange: (c) => g(c.target.value) })
430
+ /* @__PURE__ */ e("input", { className: "input", value: i, onChange: (l) => m(l.target.value) })
430
431
  ] }),
431
- /* @__PURE__ */ a("label", { children: [
432
+ /* @__PURE__ */ r("label", { children: [
432
433
  "Target responses",
433
- /* @__PURE__ */ e("input", { className: "input narrow", type: "number", min: 1, value: b, onChange: (c) => v(Math.max(1, parseInt(c.target.value, 10) || 1)) })
434
+ /* @__PURE__ */ e("input", { className: "input narrow", type: "number", min: 1, value: f, onChange: (l) => g(Math.max(1, parseInt(l.target.value, 10) || 1)) })
434
435
  ] })
435
436
  ] }),
436
- /* @__PURE__ */ a("h3", { children: [
437
+ /* @__PURE__ */ r("h3", { children: [
437
438
  "Questions (",
438
- f.length,
439
+ w.length,
439
440
  ")"
440
441
  ] }),
441
- f.map((c, w) => /* @__PURE__ */ a("div", { className: "card form", children: [
442
- /* @__PURE__ */ a("div", { className: "row", children: [
443
- /* @__PURE__ */ a("strong", { children: [
442
+ w.map((l, k) => /* @__PURE__ */ r("div", { className: "card form", children: [
443
+ /* @__PURE__ */ r("div", { className: "row", children: [
444
+ /* @__PURE__ */ r("strong", { children: [
444
445
  "Q",
445
- w + 1
446
+ k + 1
446
447
  ] }),
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 }) }),
448
+ /* @__PURE__ */ e("select", { className: "input slim", value: l.type, onChange: (v) => u(l.id, { type: v.target.value, options: v.target.value === "multiple_choice" ? ["Option 1", "Option 2"] : void 0 }), children: He.map((v) => /* @__PURE__ */ e("option", { value: v, children: v.replace("_", " ") }, v)) }),
449
+ /* @__PURE__ */ r("label", { className: "inline", children: [
450
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: l.required, onChange: (v) => u(l.id, { required: v.target.checked }) }),
450
451
  " required"
451
452
  ] }),
452
453
  /* @__PURE__ */ e("span", { className: "grow" }),
453
- /* @__PURE__ */ e("button", { className: "btn danger", onClick: () => m((o) => o.filter((h) => h.id !== c.id)), children: "Remove" })
454
+ /* @__PURE__ */ e("button", { className: "btn danger", onClick: () => c((v) => v.filter((I) => I.id !== l.id)), children: "Remove" })
454
455
  ] }),
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" })
456
+ /* @__PURE__ */ e("input", { className: "input", value: l.text, onChange: (v) => u(l.id, { text: v.target.value }), placeholder: "Enter your question…" }),
457
+ l.type === "multiple_choice" && /* @__PURE__ */ r("div", { className: "stack", children: [
458
+ (l.options ?? []).map((v, I) => /* @__PURE__ */ e("input", { className: "input slim", value: v, onChange: (P) => u(l.id, { options: (l.options ?? []).map((R, p) => p === I ? P.target.value : R) }) }, I)),
459
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => u(l.id, { options: [...l.options ?? [], `Option ${(l.options ?? []).length + 1}`] }), children: "+ Add option" })
459
460
  ] })
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" }),
461
+ ] }, l.id)),
462
+ /* @__PURE__ */ r("div", { className: "row", children: [
463
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => c((l) => [...l, { id: Z("q"), type: "rating", text: "", required: !1 }]), children: "+ Add question" }),
463
464
  /* @__PURE__ */ e("span", { className: "grow" }),
464
- p && /* @__PURE__ */ e("span", { className: "error", children: p }),
465
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: u, children: "Create Survey" })
465
+ d && /* @__PURE__ */ e("span", { className: "error", children: d }),
466
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: h, children: "Create Survey" })
466
467
  ] })
467
468
  ] });
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] })));
469
+ }, Ve = ({ survey: t, onSubmit: a, onCancel: n }) => {
470
+ const [s, i] = y({}), [m, f] = y(""), g = (c, d) => i((o) => ({ ...o, [c]: d })), w = () => {
471
+ const c = t.questions.find((d) => d.required && (s[d.id] === void 0 || s[d.id] === ""));
472
+ if (c) return f(`"${c.text}" is required.`);
473
+ f(""), a(t.questions.filter((d) => s[d.id] !== void 0 && s[d.id] !== "").map((d) => ({ questionId: d.id, value: s[d.id] })));
473
474
  };
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,
475
+ return /* @__PURE__ */ r(ee, { title: t.name, subtitle: t.description || "Answer the questions below.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: n, children: "Cancel" }), children: [
476
+ t.questions.map((c, d) => /* @__PURE__ */ r("div", { className: "card form", children: [
477
+ /* @__PURE__ */ r("strong", { children: [
478
+ d + 1,
478
479
  ". ",
479
- m.text,
480
- m.required && /* @__PURE__ */ e("span", { className: "error", children: " *" })
480
+ c.text,
481
+ c.required && /* @__PURE__ */ e("span", { className: "error", children: " *" })
481
482
  ] }),
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,
483
+ c.type === "nps" && /* @__PURE__ */ e("div", { className: "scale", children: Array.from({ length: 11 }, (o, u) => /* @__PURE__ */ e("button", { className: s[c.id] === u ? "chip active" : "chip", onClick: () => g(c.id, u), children: u }, u)) }),
484
+ c.type === "rating" && /* @__PURE__ */ e("div", { className: "scale", children: [1, 2, 3, 4, 5].map((o) => /* @__PURE__ */ r("button", { className: s[c.id] === o ? "chip active" : "chip", onClick: () => g(c.id, o), children: [
485
+ o,
485
486
  " ★"
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: [
487
+ ] }, o)) }),
488
+ c.type === "multiple_choice" && /* @__PURE__ */ e("div", { className: "scale", children: (c.options ?? []).map((o) => /* @__PURE__ */ e("button", { className: s[c.id] === o ? "chip active" : "chip", onClick: () => g(c.id, o), children: o }, o)) }),
489
+ c.type === "open_text" && /* @__PURE__ */ e("textarea", { className: "input", rows: 2, value: String(s[c.id] ?? ""), onChange: (o) => g(c.id, o.target.value) })
490
+ ] }, c.id)),
491
+ /* @__PURE__ */ r("div", { className: "row", children: [
491
492
  /* @__PURE__ */ e("span", { className: "grow" }),
492
- g && /* @__PURE__ */ e("span", { className: "error", children: g }),
493
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: f, children: "Submit response" })
493
+ m && /* @__PURE__ */ e("span", { className: "error", children: m }),
494
+ /* @__PURE__ */ e("button", { className: "btn primary", onClick: w, children: "Submit response" })
494
495
  ] })
495
496
  ] });
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,
497
+ }, Ye = ({ survey: t, responses: a, onBack: n, onTake: s }) => {
498
+ const i = Y(() => le(ce(t, a)), [t, a]), m = t.questions.find((g) => g.type === "nps"), f = (g) => i ? Math.round(g / i.total * 100) : 0;
499
+ return /* @__PURE__ */ r(
500
+ ee,
500
501
  {
501
502
  title: t.name,
502
- subtitle: `${r.length} responses`,
503
- actions: /* @__PURE__ */ a(j, { children: [
503
+ subtitle: `${a.length} responses`,
504
+ actions: /* @__PURE__ */ r(ae, { children: [
504
505
  /* @__PURE__ */ e("button", { className: "btn", onClick: n, children: "Back" }),
505
506
  /* @__PURE__ */ e("button", { className: "btn primary", disabled: t.status !== "active", onClick: s, children: "Take survey" })
506
507
  ] }),
507
508
  children: [
508
- /* @__PURE__ */ a("div", { className: "stats", children: [
509
- /* @__PURE__ */ e(C, { label: "NPS", value: i ? i.score : "—", color: "#f59e0b" }),
510
- /* @__PURE__ */ e(C, { label: "Promoters", value: i ? `${b(i.promoters)}%` : "—", color: "#4edea3" }),
511
- /* @__PURE__ */ e(C, { label: "Passives", value: i ? `${b(i.passives)}%` : "—", color: "#ffcc6b" }),
512
- /* @__PURE__ */ e(C, { label: "Detractors", value: i ? `${b(i.detractors)}%` : "—", color: "#ffb4ab" })
509
+ /* @__PURE__ */ r("div", { className: "stats", children: [
510
+ /* @__PURE__ */ e(q, { label: "NPS", value: i ? i.score : "—", color: "#f59e0b" }),
511
+ /* @__PURE__ */ e(q, { label: "Promoters", value: i ? `${f(i.promoters)}%` : "—", color: "#4edea3" }),
512
+ /* @__PURE__ */ e(q, { label: "Passives", value: i ? `${f(i.passives)}%` : "—", color: "#ffcc6b" }),
513
+ /* @__PURE__ */ e(q, { label: "Detractors", value: i ? `${f(i.detractors)}%` : "—", color: "#ffb4ab" })
513
514
  ] }),
514
- /* @__PURE__ */ a("table", { className: "table", children: [
515
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
515
+ /* @__PURE__ */ r("table", { className: "table", children: [
516
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
516
517
  /* @__PURE__ */ e("th", { children: "User" }),
517
518
  /* @__PURE__ */ e("th", { children: "NPS" }),
518
- t.questions.filter((v) => v.type !== "nps").map((v) => /* @__PURE__ */ e("th", { children: v.text }, v.id)),
519
+ t.questions.filter((g) => g.type !== "nps").map((g) => /* @__PURE__ */ e("th", { children: g.text }, g.id)),
519
520
  /* @__PURE__ */ e("th", { children: "Date" })
520
521
  ] }) }),
521
- /* @__PURE__ */ a("tbody", { children: [
522
- r.length === 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 9, className: "muted", children: "No responses yet." }) }),
523
- r.map((v) => {
524
- var m;
525
- const f = g ? (m = v.answers.find((p) => p.questionId === g.id)) == null ? void 0 : m.value : void 0;
526
- return /* @__PURE__ */ a("tr", { children: [
527
- /* @__PURE__ */ e("td", { className: "mono", children: v.userId }),
528
- /* @__PURE__ */ e("td", { children: typeof f == "number" ? /* @__PURE__ */ a("span", { className: `pill ${H(f)}`, children: [
529
- f,
522
+ /* @__PURE__ */ r("tbody", { children: [
523
+ a.length === 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 9, className: "muted", children: "No responses yet." }) }),
524
+ a.map((g) => {
525
+ var c;
526
+ const w = m ? (c = g.answers.find((d) => d.questionId === m.id)) == null ? void 0 : c.value : void 0;
527
+ return /* @__PURE__ */ r("tr", { children: [
528
+ /* @__PURE__ */ e("td", { className: "mono", children: g.userId }),
529
+ /* @__PURE__ */ e("td", { children: typeof w == "number" ? /* @__PURE__ */ r("span", { className: `pill ${pe(w)}`, children: [
530
+ w,
530
531
  " · ",
531
- H(f)
532
+ pe(w)
532
533
  ] }) : "—" }),
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);
534
+ t.questions.filter((d) => d.type !== "nps").map((d) => {
535
+ var o;
536
+ return /* @__PURE__ */ e("td", { children: String(((o = g.answers.find((u) => u.questionId === d.id)) == null ? void 0 : o.value) ?? "—") }, d.id);
536
537
  }),
537
- /* @__PURE__ */ e("td", { className: "muted small", children: Q(v.createdAt) })
538
- ] }, v.id);
538
+ /* @__PURE__ */ e("td", { className: "muted small", children: ye(g.createdAt) })
539
+ ] }, g.id);
539
540
  })
540
541
  ] })
541
542
  ] })
542
543
  ]
543
544
  }
544
545
  );
545
- }, Me = () => {
546
- const [t, r] = y("survey");
547
- return /* @__PURE__ */ a("div", { className: "shell", children: [
548
- /* @__PURE__ */ a("header", { className: "topbar", children: [
546
+ }, ht = () => {
547
+ const [t, a] = y("survey");
548
+ return /* @__PURE__ */ r("div", { className: "shell", children: [
549
+ /* @__PURE__ */ r("header", { className: "topbar", children: [
549
550
  /* @__PURE__ */ e("strong", { children: "POC" }),
550
- /* @__PURE__ */ e(q, { items: [{ id: "survey", label: "Survey" }, { id: "journey", label: "User Journey" }], value: t, onChange: r })
551
+ /* @__PURE__ */ e(fe, { items: [{ id: "survey", label: "Survey" }, { id: "journey", label: "User Journey" }], value: t, onChange: a })
551
552
  ] }),
552
- /* @__PURE__ */ e("main", { children: t === "survey" ? /* @__PURE__ */ e(pe, {}) : /* @__PURE__ */ e(ce, {}) })
553
+ /* @__PURE__ */ e("main", { children: t === "survey" ? /* @__PURE__ */ e(Xe, {}) : /* @__PURE__ */ e(De, {}) })
553
554
  ] });
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"
555
+ }, X = (t, a) => {
556
+ try {
557
+ return t();
558
+ } catch {
559
+ return a;
560
+ }
561
+ }, re = (t) => Math.random().toString(36).slice(2, 2 + t), z = () => location.pathname + location.hash, Qe = ".sj, [data-sj-ignore]", Ge = () => ({
562
+ pages: {},
563
+ scrollMs: 0,
564
+ clicks: 0,
565
+ nav: 0,
566
+ heat: {},
567
+ steps: {},
568
+ started: 0,
569
+ completed: 0,
570
+ skipped: 0,
571
+ drops: {},
572
+ log: []
573
+ });
574
+ class ze {
575
+ constructor(a) {
576
+ this.getCfg = a, this.activeStep = null, this.q = [], this.version = 0, this.subs = /* @__PURE__ */ new Set(), this.navSubs = /* @__PURE__ */ new Set(), this.overrides = {}, this.prev = "", this.booted = !1, this.scrolling = !1, this.scrollTimer = 0, this.lastMove = 0, this.subscribe = (n) => (this.subs.add(n), () => {
577
+ this.subs.delete(n);
578
+ }), this.getVersion = () => this.version, this.uid = X(() => localStorage.getItem("sjU") || (localStorage.setItem("sjU", re(10)), localStorage.getItem("sjU")), "anon"), this.sid = X(() => sessionStorage.getItem("sjS") || (sessionStorage.setItem("sjS", re(8)), sessionStorage.getItem("sjS")), re(8)), this.state = { ...Ge(), ...X(() => JSON.parse(sessionStorage.getItem("sjState") || "null"), null) };
579
+ }
580
+ get cfg() {
581
+ return { ...this.getCfg(), ...this.overrides };
582
+ }
583
+ configure(a) {
584
+ this.overrides = { ...this.overrides, ...a };
585
+ }
586
+ emit() {
587
+ this.version++, this.subs.forEach((a) => a());
588
+ }
589
+ onNavigate(a) {
590
+ return this.navSubs.add(a), () => {
591
+ this.navSubs.delete(a);
592
+ };
593
+ }
594
+ /* ---- data ---- */
595
+ page(a = z()) {
596
+ return this.state.pages[a] || (this.state.pages[a] = { ms: 0, scrollMs: 0, depth: 0, clicks: 0, views: 0, m: {} });
597
+ }
598
+ save() {
599
+ X(() => sessionStorage.setItem("sjState", JSON.stringify({ ...this.state, log: this.state.log.slice(0, 40) })), void 0);
600
+ }
601
+ bin(a, n, s) {
602
+ const i = z(), m = document.documentElement.scrollWidth || 1, f = this.state.heat[i] || (this.state.heat[i] = {}), g = Math.round(a / m * 100) + "," + (n / 20 | 0);
603
+ f[g] = (f[g] || 0) + s;
604
+ }
605
+ track(a, n = {}) {
606
+ const s = { sid: this.sid, uid: this.uid, type: a, t: Date.now(), page: z(), ...n };
607
+ this.q.push(s), this.state.log.unshift(s), this.state.log.length > 60 && this.state.log.pop();
608
+ const i = this.cfg.onEvent;
609
+ i && X(() => i(s), void 0);
610
+ }
611
+ payload(a) {
612
+ const n = this.state;
613
+ return JSON.stringify({
614
+ sessionId: this.sid,
615
+ userId: this.uid,
616
+ tourId: this.cfg.tourId || "default",
617
+ url: location.href,
618
+ viewport: [innerWidth, innerHeight],
619
+ doc: [document.documentElement.scrollWidth, document.documentElement.scrollHeight],
620
+ events: a,
621
+ summary: {
622
+ pages: n.pages,
623
+ scrollMs: n.scrollMs,
624
+ clicks: n.clicks,
625
+ nav: n.nav,
626
+ tour: { started: n.started, completed: n.completed, skipped: n.skipped, drops: n.drops, steps: n.steps },
627
+ heat: n.heat
628
+ }
629
+ });
695
630
  }
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
631
+ flush(a = !1) {
632
+ if (this.save(), !this.q.length) return;
633
+ const n = this.q;
634
+ this.q = [];
635
+ const s = this.cfg;
636
+ if (!s.endpoint) {
637
+ this.state.log.unshift({ type: "flush (dry-run)", t: Date.now(), n: `${n.length} events` });
638
+ return;
639
+ }
640
+ const i = this.payload(n);
641
+ a && navigator.sendBeacon && navigator.sendBeacon(s.endpoint, new Blob([i], { type: "application/json" })) || fetch(s.endpoint, { method: "POST", body: i, keepalive: !0, headers: { "Content-Type": "application/json", ...s.headers || {} } }).then((m) => {
642
+ if (!m.ok) throw new Error("bad status");
643
+ }).catch(() => {
644
+ this.q = n.concat(this.q).slice(-500);
645
+ });
646
+ }
647
+ /* ---- tour funnel ---- */
648
+ tourStart(a, n) {
649
+ n || this.state.started++, this.track(n ? "tour_resume" : "tour_start", { steps: a });
650
+ }
651
+ stepView(a, n, s) {
652
+ const i = this.state.steps[a] || (this.state.steps[a] = { views: 0, ms: 0, title: n });
653
+ i.views++, this.activeStep = a, this.track("step_view", { step: a, title: n, total: s }), this.save();
654
+ }
655
+ tourEnd(a, n, s, i) {
656
+ a === "complete" ? (this.state.completed++, this.track("tour_complete", { steps: i })) : (this.state.skipped++, this.state.drops[n] = (this.state.drops[n] || 0) + 1, this.track("tour_skip", { step: n, title: s })), this.activeStep = null, X(() => sessionStorage.removeItem("sjTour"), void 0), X(() => localStorage.setItem("sjDone", a), void 0), this.flush();
657
+ }
658
+ /* ---- passive listeners; returns a cleanup function (safe under React StrictMode) ---- */
659
+ attach() {
660
+ const a = this.state;
661
+ this.prev = z();
662
+ let n = performance.now();
663
+ this.booted || (this.booted = !0, this.page().views++, this.track("session_start", { ua: navigator.userAgent.slice(0, 60), ref: document.referrer }));
664
+ const s = [], i = (c, d, o, u) => {
665
+ c.addEventListener(d, o, u), s.push(() => c.removeEventListener(d, o, u));
666
+ }, m = window.setInterval(() => {
667
+ const c = performance.now(), d = c - n;
668
+ if (n = c, document.hidden) return;
669
+ const o = this.page();
670
+ o.ms += d, this.scrolling && (o.scrollMs += d, a.scrollMs += d), this.activeStep !== null && a.steps[this.activeStep] && (a.steps[this.activeStep].ms += d);
671
+ }, 250), f = window.setInterval(() => this.emit(), 500), g = window.setInterval(() => this.flush(), this.cfg.flushMs || 5e3);
672
+ s.push(() => {
673
+ clearInterval(m), clearInterval(f), clearInterval(g);
674
+ }), i(window, "scroll", () => {
675
+ this.scrolling = !0, clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
676
+ this.scrolling = !1;
677
+ }, 160);
678
+ const c = this.page(), d = Math.min(100, Math.round((scrollY + innerHeight) / document.documentElement.scrollHeight * 100));
679
+ d > c.depth && (c.depth = d, [25, 50, 75, 100].forEach((o) => {
680
+ d >= o && !c.m[o] && (c.m[o] = 1, this.track("scroll_depth", { pct: o }));
681
+ }));
682
+ }, { passive: !0 }), i(window, "mousemove", (c) => {
683
+ const d = Date.now();
684
+ d - this.lastMove > 120 && (this.lastMove = d, this.bin(c.pageX, c.pageY, 1));
685
+ }, { passive: !0 }), i(document, "click", (c) => {
686
+ const d = c.target;
687
+ if (!d || !d.closest || d.closest(Qe)) return;
688
+ a.clicks++, this.page().clicks++, this.bin(c.pageX, c.pageY, 6);
689
+ const o = d.id ? "#" + d.id : d.tagName.toLowerCase() + (typeof d.className == "string" && d.className ? "." + d.className.trim().split(/\s+/)[0] : "");
690
+ this.track("click", { sel: o, x: c.pageX, y: c.pageY, text: (d.textContent || "").trim().slice(0, 30), step: this.activeStep });
691
+ const u = d.closest("a[href]");
692
+ u && !u.getAttribute("href").startsWith("#") && (this.track("navigate_out", { to: u.href }), this.flush(!0));
693
+ }, !0);
694
+ const w = () => {
695
+ const c = z();
696
+ c !== this.prev && (a.nav++, this.track("navigate", { from: this.prev, to: c }), this.prev = c, this.page().views++, this.navSubs.forEach((d) => d()));
697
+ };
698
+ return ["pushState", "replaceState"].forEach((c) => {
699
+ const d = history[c];
700
+ history[c] = function(...o) {
701
+ const u = d.apply(this, o);
702
+ return setTimeout(w), u;
703
+ }, s.push(() => {
704
+ history[c] = d;
705
+ });
706
+ }), i(window, "popstate", w), i(window, "hashchange", w), i(document, "visibilitychange", () => {
707
+ document.hidden && this.flush(!0);
708
+ }), i(window, "pagehide", () => {
709
+ const c = this.activeStep;
710
+ c !== null && (this.track("tour_abandon", { step: c }), a.drops[c] = (a.drops[c] || 0) + 1, X(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: c, t: Date.now() })), void 0)), this.flush(!0);
711
+ }), () => s.forEach((c) => c());
712
+ }
713
+ }
714
+ const ie = (t) => !!t && t.isConnected && t.getClientRects().length > 0;
715
+ function Ke(t) {
716
+ var s;
717
+ const a = t.dataset, n = (t.getAttribute("aria-label") || t.getAttribute("title") || t.textContent || "").trim().replace(/\s+/g, " ");
718
+ return {
719
+ el: t,
720
+ title: a.sjTitle || t.getAttribute("aria-label") || ((s = t.querySelector("h1,h2,h3")) == null ? void 0 : s.textContent) || n.slice(0, 28) || t.tagName.toLowerCase(),
721
+ body: a.sjBody || n.slice(0, 140),
722
+ placement: a.sjPlace || "auto"
723
+ };
724
+ }
725
+ function Ze(t) {
726
+ const a = (s) => !s.page || s.page === location.pathname;
727
+ let n;
728
+ if (t.steps)
729
+ n = t.steps.map((s) => ({
730
+ ...s,
731
+ placement: s.placement ?? "auto",
732
+ el: s.target && a(s) ? document.querySelector(s.target) : null,
733
+ wait: !!s.target && a(s)
734
+ }));
735
+ else {
736
+ let s = [...document.querySelectorAll("[data-sj-title],[data-sj-step]")];
737
+ s.length || (s = [...document.querySelectorAll("header,nav,main>section,footer")].slice(0, 6)), n = s.filter(ie).sort((i, m) => (+(i.dataset.sjStep || 0) || 99) - (+(m.dataset.sjStep || 0) || 99)).map(Ke);
738
+ }
739
+ return t.welcome && n.unshift({ ...t.welcome, el: null, placement: "auto", welcome: !0 }), t.outro && n.push({ ...t.outro, el: null, placement: "auto", outro: !0 }), n;
740
+ }
741
+ const se = (t, a, n) => Math.max(a, Math.min(n, t)), et = ({ open: t, anim: a, theme: n, steps: s, index: i, startLabel: m, tracker: f, onNext: g, onBack: w, onSkip: c, onTheme: d }) => {
742
+ const o = _(null), u = _(null), h = _(0), [l, k] = y(null), v = s[i], I = L(() => {
743
+ const x = o.current;
744
+ if (!t || !v || !x) return;
745
+ const T = innerWidth, M = innerHeight, E = 12, A = 16;
746
+ let N = { x: T / 2, y: M / 2, w: 0, h: 0 }, D = !0;
747
+ if (ie(v.el)) {
748
+ const C = v.el.getBoundingClientRect(), H = Math.max(C.left - 8, 0), S = Math.max(C.top - 8, 0);
749
+ N = { x: H, y: S, w: Math.min(C.right + 8, T) - H, h: Math.min(C.bottom + 8, M) - S }, D = !1;
750
+ }
751
+ const $ = x.offsetWidth, O = x.offsetHeight;
752
+ let W = (T - $) / 2, J = (M - O) / 2, Q = "c", b = 0, j = 0;
753
+ if (!D) {
754
+ const C = N.x + N.w / 2, H = N.y + N.h / 2, S = {
755
+ top: { x: C - $ / 2, y: N.y - O - A, ok: N.y - O - A >= E },
756
+ bottom: { x: C - $ / 2, y: N.y + N.h + A, ok: N.y + N.h + A + O <= M - E },
757
+ left: { x: N.x - $ - A, y: H - O / 2, ok: N.x - $ - A >= E },
758
+ right: { x: N.x + N.w + A, y: H - O / 2, ok: N.x + N.w + A + $ <= T - E }
759
+ }, G = v.placement !== "auto" && v.placement in S ? v.placement : "bottom", ke = { top: "bottom", bottom: "top", left: "right", right: "left" }[G], te = (v.placement === "auto" ? ["bottom", "top", "right", "left"] : [G, ke, "bottom", "top", "right", "left"]).find((Se) => S[Se].ok);
760
+ te ? (W = S[te].x, J = S[te].y, Q = te) : (J = M - O - E, Q = "in"), W = se(W, E, T - $ - E), J = se(J, E, M - O - E), b = se(C - W, 22, $ - 22), j = se(H - J, 22, O - 22);
761
+ }
762
+ k({ hole: N, centered: D, x: Math.round(W), y: Math.round(J), side: Q, ax: b, ay: j, vw: T, vh: M });
763
+ }, [t, v]), P = L(() => {
764
+ cancelAnimationFrame(h.current), h.current = requestAnimationFrame(I);
765
+ }, [I]);
766
+ if (xe(() => {
767
+ if (!t) return;
768
+ I();
769
+ const x = window.setTimeout(I, 380), T = window.setTimeout(I, 700);
770
+ return () => {
771
+ clearTimeout(x), clearTimeout(T);
772
+ };
773
+ }, [t, i, I]), B(() => {
774
+ if (!t) return;
775
+ addEventListener("scroll", P, { passive: !0 }), addEventListener("resize", P);
776
+ const x = f.onNavigate(P);
777
+ return () => {
778
+ removeEventListener("scroll", P), removeEventListener("resize", P), x(), cancelAnimationFrame(h.current);
779
+ };
780
+ }, [t, P, f]), B(() => {
781
+ var x;
782
+ t && v && ((x = u.current) == null || x.focus({ preventScroll: !0 }));
783
+ }, [t, i, v]), !v) return null;
784
+ const R = i === s.length - 1, p = l, U = p ? [
785
+ [0, 0, p.vw, p.hole.y],
786
+ [p.hole.y + p.hole.h, 0, p.vw, p.vh - p.hole.y - p.hole.h],
787
+ [p.hole.y, 0, p.hole.x, p.hole.h],
788
+ [p.hole.y, p.hole.x + p.hole.w, p.vw - p.hole.x - p.hole.w, p.hole.h]
789
+ ] : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], F = (x) => Math.max(0, x) + "px";
790
+ return ve(
791
+ /* @__PURE__ */ r("div", { className: `sj${t ? " on" : ""}${a ? " anim" : ""}`, "data-theme": n, "data-sj-ignore": !0, children: [
792
+ U.map(([x, T, M, E], A) => /* @__PURE__ */ e("div", { className: "sj-p", style: { top: F(x), left: F(T), width: F(M), height: F(E) } }, A)),
793
+ /* @__PURE__ */ e("div", { className: "sj-ring", style: p ? { top: p.hole.y, left: p.hole.x, width: F(p.hole.w), height: F(p.hole.h), opacity: p.centered ? 0 : 1 } : { opacity: 0 } }),
794
+ /* @__PURE__ */ r(
795
+ "div",
796
+ {
797
+ ref: o,
798
+ className: "sj-pop",
799
+ role: "dialog",
800
+ "aria-modal": "true",
801
+ "aria-live": "polite",
802
+ "data-side": (p == null ? void 0 : p.side) ?? "c",
803
+ style: { transform: p ? `translate(${p.x}px,${p.y}px)` : void 0, "--ax": ((p == null ? void 0 : p.ax) ?? 0) + "px", "--ay": ((p == null ? void 0 : p.ay) ?? 0) + "px" },
804
+ children: [
805
+ /* @__PURE__ */ e("i", { className: "sj-arr" }),
806
+ /* @__PURE__ */ e("div", { className: "sj-bar", children: /* @__PURE__ */ e("b", { style: { width: Math.round((i + 1) / s.length * 100) + "%" } }) }),
807
+ /* @__PURE__ */ r("div", { className: "sj-hd", children: [
808
+ /* @__PURE__ */ e("span", { children: v.welcome ? "Welcome" : `Step ${i + 1} of ${s.length}` }),
809
+ /* @__PURE__ */ r("span", { children: [
810
+ /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Switch light or dark theme", onClick: d, children: "◐" }),
811
+ /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Close tour", onClick: c, children: "×" })
812
+ ] })
813
+ ] }),
814
+ /* @__PURE__ */ e("h3", { children: v.title }),
815
+ /* @__PURE__ */ e("p", { children: v.body }),
816
+ /* @__PURE__ */ r("div", { className: "sj-ft", children: [
817
+ /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: R ? "hidden" : "visible" }, onClick: c, children: "Skip" }),
818
+ /* @__PURE__ */ r("span", { children: [
819
+ /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: i ? "visible" : "hidden" }, onClick: w, children: "Back" }),
820
+ /* @__PURE__ */ e("button", { ref: u, className: "sj-b", onClick: g, children: v.welcome ? m || "Start tour" : R ? "Finish" : "Next" })
821
+ ] })
822
+ ] })
823
+ ]
824
+ }
825
+ )
784
826
  ] }),
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 {
827
+ document.body
828
+ );
829
+ }, tt = ({ tracker: t }) => {
830
+ const a = _(null);
831
+ return B(() => {
832
+ const n = () => {
833
+ const i = a.current;
834
+ if (!i) return;
835
+ const m = i.getContext("2d");
836
+ if (!m) return;
837
+ const f = document.documentElement.scrollWidth, g = t.state.heat[location.pathname + location.hash] || {};
838
+ i.width = innerWidth, i.height = innerHeight, m.globalCompositeOperation = "lighter";
839
+ for (const w in g) {
840
+ const [c, d] = w.split(",").map(Number), o = c / 100 * f - scrollX, u = d * 20 + 10 - scrollY;
841
+ if (o < -40 || u < -40 || o > innerWidth + 40 || u > innerHeight + 40) continue;
842
+ const h = Math.min(1, g[w] / 6), l = m.createRadialGradient(o, u, 0, o, u, 34);
843
+ l.addColorStop(0, `rgba(255,70,50,${0.5 * h + 0.1})`), l.addColorStop(1, "rgba(255,70,50,0)"), m.fillStyle = l, m.fillRect(o - 34, u - 34, 68, 68);
844
+ }
845
+ };
846
+ n();
847
+ const s = window.setInterval(n, 250);
848
+ return addEventListener("scroll", n, { passive: !0 }), addEventListener("resize", n), () => {
849
+ clearInterval(s), removeEventListener("scroll", n), removeEventListener("resize", n);
850
+ };
851
+ }, [t]), ve(/* @__PURE__ */ e("canvas", { ref: a, className: "sj-heat", "data-sj-ignore": !0 }), document.body);
852
+ }, Ne = Te(null);
853
+ function de() {
854
+ const t = je(Ne);
855
+ if (!t) throw new Error("useJourney must be used inside <JourneyProvider>");
856
+ return t;
857
+ }
858
+ function st() {
859
+ const { tracker: t } = de();
860
+ return Ce(t.subscribe, t.getVersion, t.getVersion), t.state;
861
+ }
862
+ const V = (t, a) => {
863
+ try {
864
+ return t();
865
+ } catch {
866
+ return a;
867
+ }
868
+ }, nt = ({ config: t, children: a }) => {
869
+ const n = _(t ?? {});
870
+ n.current = t ?? {};
871
+ const s = Y(() => new ze(() => n.current), []), [i, m] = y(() => V(() => localStorage.getItem("sjTheme"), null) ?? (t == null ? void 0 : t.theme) ?? "auto"), [f, g] = y(() => V(() => matchMedia("(prefers-color-scheme:dark)").matches, !1));
872
+ B(() => {
873
+ const b = matchMedia("(prefers-color-scheme:dark)"), j = () => g(b.matches);
874
+ return b.addEventListener("change", j), () => b.removeEventListener("change", j);
875
+ }, []);
876
+ const w = i === "auto" ? f ? "dark" : "light" : i;
877
+ B(() => {
878
+ document.documentElement.setAttribute("data-sj-theme", w);
879
+ }, [w]);
880
+ const c = L((b) => {
881
+ m(b), V(() => localStorage.setItem("sjTheme", b), void 0), s.track("theme", { theme: b });
882
+ }, [s]);
883
+ B(() => s.attach(), [s]);
884
+ const [d, o] = y(!1), [u, h] = y([]), [l, k] = y(-1), [v, I] = y(!1), P = _([]), R = _(-1), p = _(!1), U = _(!1), F = _(0), x = L((b) => {
885
+ if (!p.current) return;
886
+ const j = P.current[R.current];
887
+ s.tourEnd(b, R.current, (j == null ? void 0 : j.title) ?? "", P.current.length), p.current = !1, o(!1);
888
+ }, [s]), T = L((b, j = 0) => {
889
+ const C = P.current, H = n.current;
890
+ if (b < 0 && (b = 0), b >= C.length) return x("complete");
891
+ const S = C[b];
892
+ if (S.page && S.page !== location.pathname) {
893
+ V(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: b, t: Date.now(), go: 1 })), void 0), s.track("step_navigate", { step: b, to: S.page }), s.flush(!0), location.href = S.page;
894
+ return;
830
895
  }
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 {
896
+ if (S.wait && !S.el && S.target && (S.el = document.querySelector(S.target)), S.target && !ie(S.el)) {
897
+ if (j < (H.waitMs ?? 2500) / 100) {
898
+ window.setTimeout(() => {
899
+ p.current && T(b, j + 1);
900
+ }, 100);
901
+ return;
902
+ }
903
+ s.track("step_missing", { step: b, target: S.target });
904
+ const G = b >= R.current ? 1 : -1;
905
+ return T(b + (b + G < 0 ? 1 : G), 0);
837
906
  }
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
- ] })
907
+ R.current = b, k(b), s.stepView(b, S.title, C.length), U.current && (I(!0), clearTimeout(F.current), F.current = window.setTimeout(() => I(!1), 520)), ie(S.el) && S.el.scrollIntoView({ block: "center", behavior: U.current ? "smooth" : "auto" }), U.current || requestAnimationFrame(() => {
908
+ U.current = !0;
909
+ });
910
+ }, [x, s]), M = L((b = 0, j = !1) => {
911
+ const C = Ze(n.current);
912
+ C.length && (P.current = C, h(C), p.current = !0, U.current = !1, o(!0), s.tourStart(C.length, j), T(b));
913
+ }, [T, s]), E = L(() => M(0), [M]), A = L(() => x("skip"), [x]), N = L(() => {
914
+ p.current && (s.track("step_next", { step: R.current }), T(R.current + 1));
915
+ }, [T, s]), D = L(() => {
916
+ p.current && T(R.current - 1);
917
+ }, [T]);
918
+ B(() => {
919
+ const b = V(() => JSON.parse(sessionStorage.getItem("sjTour") || "null"), null), j = n.current;
920
+ let C;
921
+ return b && Date.now() - b.t < 3e5 ? C = window.setTimeout(() => M(b.i, !0), 400) : j.autoStart !== !1 && !(j.once && V(() => localStorage.getItem("sjDone"), null)) && (C = window.setTimeout(() => M(0), 600)), () => clearTimeout(C);
922
+ }, [M]), B(() => () => {
923
+ p.current = !1;
924
+ }, []), B(() => {
925
+ if (!d) return;
926
+ const b = (j) => {
927
+ j.key === "Escape" ? x("skip") : j.key === "ArrowRight" ? N() : j.key === "ArrowLeft" && D();
928
+ };
929
+ return addEventListener("keydown", b), () => removeEventListener("keydown", b);
930
+ }, [d, x, N, D]);
931
+ const [$, O] = y(!1), W = L(() => O((b) => !b), []), J = L((b) => s.configure(b), [s]), Q = Y(() => ({
932
+ tracker: s,
933
+ theme: i,
934
+ resolvedTheme: w,
935
+ setTheme: c,
936
+ open: d,
937
+ start: E,
938
+ stop: A,
939
+ next: N,
940
+ back: D,
941
+ heat: $,
942
+ toggleHeat: W,
943
+ configure: J
944
+ }), [s, i, w, c, d, E, A, N, D, $, W, J]);
945
+ return /* @__PURE__ */ r(Ne.Provider, { value: Q, children: [
946
+ a,
947
+ u.length > 0 && /* @__PURE__ */ e(
948
+ et,
949
+ {
950
+ open: d,
951
+ anim: v,
952
+ theme: w,
953
+ steps: u,
954
+ index: l,
955
+ startLabel: t == null ? void 0 : t.startLabel,
956
+ tracker: s,
957
+ onNext: N,
958
+ onBack: D,
959
+ onSkip: A,
960
+ onTheme: () => c(w === "dark" ? "light" : "dark")
961
+ }
962
+ ),
963
+ $ && /* @__PURE__ */ e(tt, { tracker: s })
964
+ ] });
965
+ }, ne = (t) => t < 6e4 ? (t / 1e3).toFixed(1) + "s" : Math.floor(t / 6e4) + "m " + Math.round(t % 6e4 / 1e3) + "s", at = `import { JourneyProvider } from '@shiva004/surveys';
966
+
967
+ <JourneyProvider
968
+ config={{
969
+ endpoint: '/api/journey/events',
970
+ theme: 'auto', // auto | light | dark
971
+ welcome: { title: 'Welcome', body: 'Quick tour?' },
972
+ steps: [
973
+ { target: '#menu', title: 'Menu',
974
+ body: 'Your navigation.', placement: 'bottom' },
975
+ { target: '#billing', page: '/billing',
976
+ title: 'Billing', body: 'Next page.' },
977
+ ],
978
+ }}
979
+ >
980
+ <App />
981
+ </JourneyProvider>`, it = ({ open: t, onClose: a }) => {
982
+ const { toggleHeat: n, configure: s } = de(), i = st(), [m, f] = y("m"), g = location.pathname + location.hash, w = i.pages[g] || { ms: 0, depth: 0 }, c = i.started ? Math.round(i.completed / i.started * 100) + "%" : "–", d = [["Time on page", ne(w.ms)], ["Scrolling", ne(i.scrollMs)], ["Scroll depth", w.depth + "%"], ["Clicks", i.clicks], ["Completion", c], ["Navigations", i.nav]], o = Object.entries(i.steps).sort((h, l) => +h[0] - +l[0]), u = Math.max(1, ...o.map((h) => h[1].ms));
983
+ return /* @__PURE__ */ r("aside", { className: `nw-ins${t ? " open" : ""}`, "data-sj-ignore": !0, "aria-label": "Journey insights", children: [
984
+ /* @__PURE__ */ r("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
985
+ /* @__PURE__ */ e("strong", { children: "Journey insights" }),
986
+ /* @__PURE__ */ e("button", { className: "nw-x", onClick: a, "aria-label": "Close", children: "×" })
884
987
  ] }),
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" }),
988
+ /* @__PURE__ */ e("div", { className: "nw-tabs", children: [["m", "Metrics"], ["e", "Events"], ["c", "Embed"]].map(([h, l]) => /* @__PURE__ */ e("button", { className: m === h ? "on" : "", onClick: () => f(h), children: l }, h)) }),
989
+ m === "m" && /* @__PURE__ */ r(ae, { children: [
990
+ /* @__PURE__ */ e("div", { className: "nw-kpis", children: d.map(([h, l]) => /* @__PURE__ */ r("div", { className: "nw-kpi", children: [
991
+ /* @__PURE__ */ e("small", { children: h }),
992
+ /* @__PURE__ */ e("b", { children: l })
993
+ ] }, h)) }),
994
+ /* @__PURE__ */ e("h4", { children: "Time per page" }),
995
+ Object.entries(i.pages).map(([h, l]) => /* @__PURE__ */ r("div", { className: "nw-row", children: [
996
+ /* @__PURE__ */ e("span", { children: h }),
997
+ /* @__PURE__ */ r("span", { children: [
998
+ ne(l.ms),
999
+ " · ",
1000
+ l.depth,
1001
+ "% deep"
1002
+ ] })
1003
+ ] }, h)),
1004
+ /* @__PURE__ */ e("h4", { children: "Walkthrough funnel and drop-offs" }),
1005
+ o.length ? o.map(([h, l]) => /* @__PURE__ */ r(ge.Fragment, { children: [
1006
+ /* @__PURE__ */ r("div", { className: "nw-row", children: [
1007
+ /* @__PURE__ */ r("span", { children: [
1008
+ +h + 1,
955
1009
  ". ",
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."
1010
+ l.title
966
1011
  ] }),
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."
1012
+ /* @__PURE__ */ r("span", { children: [
1013
+ l.views,
1014
+ "× · ",
1015
+ ne(l.ms),
1016
+ i.drops[+h] ? /* @__PURE__ */ r(ae, { children: [
1017
+ " · ",
1018
+ /* @__PURE__ */ r("b", { className: "nw-warn", children: [
1019
+ i.drops[+h],
1020
+ " dropped"
1021
+ ] })
1022
+ ] }) : null
1045
1023
  ] })
1046
1024
  ] }),
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."
1025
+ /* @__PURE__ */ e("div", { className: "nw-meter", children: /* @__PURE__ */ e("i", { style: { width: Math.round(l.ms / u * 100) + "%" } }) })
1026
+ ] }, h)) : /* @__PURE__ */ r("div", { className: "nw-row", children: [
1027
+ /* @__PURE__ */ e("span", { children: "No tour data yet" }),
1028
+ /* @__PURE__ */ e("span", {})
1029
+ ] }),
1030
+ /* @__PURE__ */ e("h4", { children: "Heatmap" }),
1031
+ /* @__PURE__ */ e("button", { className: "nw-btn", onClick: n, children: "Toggle heatmap overlay" })
1032
+ ] }),
1033
+ m === "e" && i.log.slice(0, 30).map((h, l) => /* @__PURE__ */ r("div", { className: "nw-row", children: [
1034
+ /* @__PURE__ */ e("span", { children: h.type }),
1035
+ /* @__PURE__ */ r("span", { children: [
1036
+ String(h.title || h.sel || h.pct || h.n || h.to || h.theme || ""),
1037
+ " · ",
1038
+ new Date(h.t).toLocaleTimeString()
1039
+ ] })
1040
+ ] }, `${h.t}-${l}`)),
1041
+ m === "c" && /* @__PURE__ */ r(ae, { children: [
1042
+ /* @__PURE__ */ e("h4", { children: "Install in a React app" }),
1043
+ /* @__PURE__ */ e("pre", { children: at }),
1044
+ /* @__PURE__ */ r("p", { children: [
1045
+ "No ",
1046
+ /* @__PURE__ */ e("code", { children: "steps" }),
1047
+ "? Add ",
1048
+ /* @__PURE__ */ e("code", { children: "data-sj-title" }),
1049
+ ", ",
1050
+ /* @__PURE__ */ e("code", { children: "data-sj-body" }),
1051
+ ", ",
1052
+ /* @__PURE__ */ e("code", { children: "data-sj-place" }),
1053
+ " and ",
1054
+ /* @__PURE__ */ e("code", { children: "data-sj-step" }),
1055
+ " to any element, or it falls back to the page’s header, nav, sections and footer. A step with ",
1056
+ /* @__PURE__ */ e("code", { children: "page" }),
1057
+ " continues the tour after navigating."
1058
+ ] }),
1059
+ /* @__PURE__ */ e("h4", { children: "Backend endpoint" }),
1060
+ /* @__PURE__ */ e("input", { placeholder: "/api/journey/events", onChange: (h) => s({ endpoint: h.target.value.trim() }) }),
1061
+ /* @__PURE__ */ r("p", { children: [
1062
+ "Run ",
1063
+ /* @__PURE__ */ e("code", { children: "node server.js" }),
1064
+ ", open ",
1065
+ /* @__PURE__ */ e("code", { children: "http://localhost:4000/?api=/api/journey/events" }),
1066
+ ". Without an endpoint it runs in dry-run mode and the Events tab shows each flush."
1067
+ ] })
1068
+ ] })
1069
+ ] });
1070
+ }, rt = () => {
1071
+ const { start: t, setTheme: a, resolvedTheme: n } = de(), [s, i] = y(!1);
1072
+ return /* @__PURE__ */ r("div", { className: "nw", id: "top", children: [
1073
+ /* @__PURE__ */ r("header", { className: "nw-head", "data-sj-step": 1, "data-sj-title": "Main navigation", "data-sj-body": "Jump between Features, Pricing and Contact from here. It stays visible as you scroll.", "data-sj-place": "bottom", children: [
1074
+ /* @__PURE__ */ r("a", { className: "nw-logo", href: "#top", children: [
1075
+ /* @__PURE__ */ e("i", { children: "◆" }),
1076
+ " Northwind"
1077
+ ] }),
1078
+ /* @__PURE__ */ r("nav", { className: "nw-nav", children: [
1079
+ /* @__PURE__ */ e("a", { href: "#features", children: "Features" }),
1080
+ /* @__PURE__ */ e("a", { href: "#pricing", children: "Pricing" }),
1081
+ /* @__PURE__ */ e("a", { href: "#contact", children: "Contact" })
1082
+ ] }),
1083
+ /* @__PURE__ */ e("button", { className: "nw-btn", id: "srch", "data-sj-step": 2, "data-sj-title": "Search", "data-sj-body": "Find any page or help article instantly.", "data-sj-place": "left", children: "Search" })
1084
+ ] }),
1085
+ /* @__PURE__ */ r("main", { className: "nw-wrap", children: [
1086
+ /* @__PURE__ */ r("section", { className: "nw-hero", children: [
1087
+ /* @__PURE__ */ e("h1", { children: "Ship products people actually finish onboarding." }),
1088
+ /* @__PURE__ */ e("p", { children: "Northwind is a sample site. The walkthrough reads each element’s position at runtime, so the same component fits any layout." }),
1089
+ /* @__PURE__ */ r("div", { className: "nw-acts", children: [
1090
+ /* @__PURE__ */ e("a", { className: "nw-btn p", href: "#pricing", "data-sj-step": 3, "data-sj-title": "Primary action", "data-sj-body": "Start here. This button takes new visitors straight to the plans. You can click it while it is highlighted.", "data-sj-place": "right", children: "Get started" }),
1091
+ /* @__PURE__ */ e("a", { className: "nw-btn", href: "#features", children: "See features" })
1092
+ ] })
1093
+ ] }),
1094
+ /* @__PURE__ */ r("section", { id: "features", "data-sj-step": 4, "data-sj-title": "Feature overview", "data-sj-body": "Three things Northwind does best. Large sections are fitted to the screen automatically.", "data-sj-place": "top", children: [
1095
+ /* @__PURE__ */ e("h2", { children: "Features" }),
1096
+ /* @__PURE__ */ r("div", { className: "nw-grid", children: [
1097
+ /* @__PURE__ */ r("div", { className: "nw-card", children: [
1098
+ /* @__PURE__ */ e("h3", { children: "Live analytics" }),
1099
+ /* @__PURE__ */ e("p", { children: "Page time, scroll depth and clicks, collected as people browse." })
1079
1100
  ] }),
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."
1101
+ /* @__PURE__ */ r("div", { className: "nw-card", children: [
1102
+ /* @__PURE__ */ e("h3", { children: "Heatmaps" }),
1103
+ /* @__PURE__ */ e("p", { children: "See where attention gathers and where it never reaches." })
1084
1104
  ] }),
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."
1105
+ /* @__PURE__ */ r("div", { className: "nw-card", children: [
1106
+ /* @__PURE__ */ e("h3", { children: "Guided tours" }),
1107
+ /* @__PURE__ */ e("p", { children: "Spotlight any element with a popup that repositions itself." })
1108
+ ] })
1109
+ ] })
1110
+ ] }),
1111
+ /* @__PURE__ */ r("section", { id: "pricing", children: [
1112
+ /* @__PURE__ */ e("h2", { children: "Pricing" }),
1113
+ /* @__PURE__ */ r("div", { className: "nw-grid", children: [
1114
+ /* @__PURE__ */ r("div", { className: "nw-card", children: [
1115
+ /* @__PURE__ */ e("h3", { children: "Starter" }),
1116
+ /* @__PURE__ */ e("div", { className: "nw-big", children: "$0" }),
1117
+ /* @__PURE__ */ e("p", { children: "For side projects." })
1089
1118
  ] }),
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)."
1119
+ /* @__PURE__ */ r("div", { className: "nw-card", children: [
1120
+ /* @__PURE__ */ e("h3", { children: "Team" }),
1121
+ /* @__PURE__ */ e("div", { className: "nw-big", children: "$29" }),
1122
+ /* @__PURE__ */ e("p", { children: "For growing teams." })
1097
1123
  ] }),
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." })
1124
+ /* @__PURE__ */ r("div", { className: "nw-card hot", "data-sj-step": 5, "data-sj-title": "Recommended plan", "data-sj-body": "Most teams pick this one. The popup flips sides on its own when there is no room.", "data-sj-place": "left", children: [
1125
+ /* @__PURE__ */ e("h3", { children: "Scale" }),
1126
+ /* @__PURE__ */ e("div", { className: "nw-big", children: "$99" }),
1127
+ /* @__PURE__ */ e("p", { children: "Unlimited journeys and exports." })
1129
1128
  ] })
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" } })
1129
+ ] })
1157
1130
  ] }),
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}`)) })
1131
+ /* @__PURE__ */ r("section", { id: "contact", children: [
1132
+ /* @__PURE__ */ e("h2", { children: "Contact" }),
1133
+ /* @__PURE__ */ e("div", { className: "nw-card", children: /* @__PURE__ */ e("p", { children: "hello@northwind.example: we reply within a day." }) })
1161
1134
  ] })
1162
- ] })
1135
+ ] }),
1136
+ /* @__PURE__ */ e("footer", { className: "nw-foot", "data-sj-step": 6, "data-sj-title": "Footer and help", "data-sj-body": "Legal links, support and contact details live down here.", "data-sj-place": "top", children: "© Northwind · Privacy · Terms · Status" }),
1137
+ /* @__PURE__ */ r("div", { className: "nw-dock", "data-sj-ignore": !0, children: [
1138
+ /* @__PURE__ */ e("button", { onClick: t, children: "▶ Tour" }),
1139
+ /* @__PURE__ */ e("button", { onClick: () => a(n === "dark" ? "light" : "dark"), children: "◐ Theme" }),
1140
+ /* @__PURE__ */ e("button", { onClick: () => i((m) => !m), children: "▤ Insights" })
1141
+ ] }),
1142
+ /* @__PURE__ */ e(it, { open: s, onClose: () => i(!1) })
1163
1143
  ] });
1164
- };
1144
+ }, ut = ({ endpoint: t, config: a }) => /* @__PURE__ */ e(
1145
+ nt,
1146
+ {
1147
+ config: {
1148
+ endpoint: t ?? new URLSearchParams(location.search).get("api") ?? "",
1149
+ theme: "auto",
1150
+ welcome: { title: "Welcome to Northwind", body: "Take a 30-second tour of the key parts of this site. Skip any time, or use the arrow keys." },
1151
+ outro: { title: "You’re all set", body: "Open Insights to see the time, scroll depth, clicks and heatmap this session just generated." },
1152
+ ...a
1153
+ },
1154
+ children: /* @__PURE__ */ e(rt, {})
1155
+ }
1156
+ );
1165
1157
  export {
1166
- ce as JourneyApp,
1167
- pe as SurveyApp,
1168
- Me as SurveyJourneyApp,
1169
- Ie as UserJourneyDocs,
1170
- se as flowStats,
1171
- te as navigationStats,
1172
- H as npsCategory,
1173
- $ as npsOf,
1174
- J as npsScores,
1175
- ae as pathStats,
1176
- G as simulate,
1177
- oe as stageReach
1158
+ De as JourneyApp,
1159
+ nt as JourneyProvider,
1160
+ ze as JourneyTracker,
1161
+ Xe as SurveyApp,
1162
+ ht as SurveyJourneyApp,
1163
+ ut as WalkthroughDemo,
1164
+ $e as flowStats,
1165
+ Pe as navigationStats,
1166
+ pe as npsCategory,
1167
+ le as npsOf,
1168
+ ce as npsScores,
1169
+ Re as pathStats,
1170
+ we as simulate,
1171
+ Le as stageReach,
1172
+ de as useJourney,
1173
+ st as useJourneyStats
1178
1174
  };