@shiva004/surveys 0.4.0 → 0.6.1
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/LICENSE +9 -0
- package/README.md +90 -52
- package/dist/feedback/FeedbackApp.d.ts +22 -0
- package/dist/heatmap/HeatmapApp.d.ts +4 -0
- package/dist/heatmap/capture.d.ts +33 -0
- package/dist/heatmap/draw.d.ts +17 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +1879 -931
- package/dist/logs/EnvPanel.d.ts +1 -0
- package/dist/logs/LogsApp.d.ts +5 -0
- package/dist/logs/data.d.ts +49 -0
- package/dist/logs/environment.d.ts +57 -0
- package/dist/style.css +1 -1
- package/dist/ui.d.ts +0 -17
- package/package.json +21 -4
- package/dist/journey/JourneyApp.d.ts +0 -2
- package/dist/journey/analytics.d.ts +0 -29
- package/dist/survey/SurveyApp.d.ts +0 -2
- package/dist/survey/data.d.ts +0 -3
- package/dist/survey/nps.d.ts +0 -12
- package/dist/types.d.ts +0 -40
package/dist/index.js
CHANGED
|
@@ -1,564 +1,1508 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"/dashboard": [["/checkout", 0.25], ["/docs", 0.15], ["/features", 0.1], ["EXIT", 0.5]],
|
|
27
|
-
"/checkout": [["EXIT", 1]]
|
|
28
|
-
}, he = (t, a) => {
|
|
29
|
-
let n = 0;
|
|
30
|
-
for (const [s, i] of t)
|
|
31
|
-
if (n += i, a < n) return s;
|
|
32
|
-
return t[t.length - 1][0];
|
|
33
|
-
};
|
|
34
|
-
function we(t, a) {
|
|
35
|
-
return Array.from({ length: t }, () => {
|
|
36
|
-
let n = he(Me, a());
|
|
37
|
-
const s = [n];
|
|
38
|
-
for (; s.length < 8; ) {
|
|
39
|
-
const i = he(Ee[n], a());
|
|
40
|
-
if (i === "EXIT") break;
|
|
41
|
-
s.push(i), n = i;
|
|
42
|
-
}
|
|
43
|
-
return s;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
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));
|
|
49
|
-
for (const s of t)
|
|
50
|
-
s.forEach((i) => {
|
|
51
|
-
n(i).views += 1;
|
|
52
|
-
}), n(s[0]).entries += 1, s.length === 1 && (n(s[0]).bounces += 1), n(s[s.length - 1]).exits += 1;
|
|
53
|
-
return [...a.entries()].map(([s, i]) => ({
|
|
54
|
-
page: s,
|
|
55
|
-
views: i.views,
|
|
56
|
-
bounceRate: i.entries ? i.bounces / i.entries * 100 : 0,
|
|
57
|
-
exitRate: i.views ? i.exits / i.views * 100 : 0
|
|
58
|
-
})).sort((s, i) => i.views - s.views);
|
|
59
|
-
}
|
|
60
|
-
function Re(t, a = 8) {
|
|
61
|
-
const n = /* @__PURE__ */ new Map();
|
|
62
|
-
for (const s of t) {
|
|
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);
|
|
65
|
-
}
|
|
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);
|
|
67
|
-
}
|
|
68
|
-
function $e(t) {
|
|
69
|
-
const a = /* @__PURE__ */ new Map();
|
|
70
|
-
for (const n of t)
|
|
71
|
-
for (let s = 0; s < n.length - 1; s++) {
|
|
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);
|
|
74
|
-
}
|
|
75
|
-
return [...a.entries()].map(([n, s]) => {
|
|
76
|
-
const i = [...s.values()].reduce((m, f) => m + f, 0);
|
|
77
|
-
return {
|
|
78
|
-
from: n,
|
|
79
|
-
total: i,
|
|
80
|
-
destinations: [...s.entries()].map(([m, f]) => ({ to: m, pct: f / i * 100 })).sort((m, f) => f.pct - m.pct)
|
|
81
|
-
};
|
|
82
|
-
}).sort((n, s) => s.total - n.total);
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import Lt, { useState as x, useRef as q, useEffect as P, useSyncExternalStore as Me, useMemo as te, useCallback as H, useLayoutEffect as it, useContext as It, createContext as Tt } from "react";
|
|
3
|
+
import { createPortal as rt } from "react-dom";
|
|
4
|
+
const Ct = ["Ease of use", "Performance", "Design & appearance", "Features", "Navigation", "Something else"], jt = ["", "Poor", "Fair", "Good", "Very good", "Excellent"];
|
|
5
|
+
function Rt({ rating: e, onRate: n }) {
|
|
6
|
+
const [s, a] = x(0), o = s || e;
|
|
7
|
+
return /* @__PURE__ */ i(B, { children: [
|
|
8
|
+
/* @__PURE__ */ t("div", { className: "rating", role: "radiogroup", "aria-label": "Star rating", onMouseLeave: () => a(0), children: [1, 2, 3, 4, 5].map((c) => /* @__PURE__ */ t(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
type: "button",
|
|
12
|
+
role: "radio",
|
|
13
|
+
"aria-checked": e === c,
|
|
14
|
+
"aria-label": `${c} star${c > 1 ? "s" : ""}`,
|
|
15
|
+
className: `star ${c <= o ? "active" : ""}`,
|
|
16
|
+
onMouseEnter: () => a(c),
|
|
17
|
+
onFocus: () => a(c),
|
|
18
|
+
onBlur: () => a(0),
|
|
19
|
+
onClick: () => n(c),
|
|
20
|
+
children: "★"
|
|
21
|
+
},
|
|
22
|
+
c
|
|
23
|
+
)) }),
|
|
24
|
+
/* @__PURE__ */ t("div", { className: "hint", children: o ? `${o} out of 5 · ${jt[o]}` : "Select a rating to continue" })
|
|
25
|
+
] });
|
|
83
26
|
}
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
{ id: "paths", label: "Paths" },
|
|
97
|
-
{ id: "flows", label: "Userflows" },
|
|
98
|
-
{ id: "maps", label: "Journey Maps" }
|
|
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,
|
|
104
|
-
{
|
|
105
|
-
title: "User Journey",
|
|
106
|
-
subtitle: "One stream of page views feeds every view below.",
|
|
107
|
-
actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => s((h) => [...h, ...we(50, Math.random)]), children: "+ Simulate 50 sessions" }),
|
|
108
|
-
children: [
|
|
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" })
|
|
114
|
-
] }),
|
|
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: [
|
|
118
|
-
/* @__PURE__ */ e("th", { children: "Page" }),
|
|
119
|
-
/* @__PURE__ */ e("th", { children: "Views" }),
|
|
120
|
-
/* @__PURE__ */ e("th", { children: "Share" }),
|
|
121
|
-
/* @__PURE__ */ e("th", { children: "Bounce rate" }),
|
|
122
|
-
/* @__PURE__ */ e("th", { children: "Exit rate" })
|
|
123
|
-
] }) }),
|
|
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),
|
|
130
|
-
"%"
|
|
131
|
-
] }),
|
|
132
|
-
/* @__PURE__ */ r("td", { className: "mono", children: [
|
|
133
|
-
h.exitRate.toFixed(1),
|
|
134
|
-
"%"
|
|
135
|
-
] })
|
|
136
|
-
] }, h.page)) })
|
|
137
|
-
] }),
|
|
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: [
|
|
141
|
-
"#",
|
|
142
|
-
l + 1
|
|
143
|
-
] }),
|
|
144
|
-
/* @__PURE__ */ e("span", { className: "grow" }),
|
|
145
|
-
/* @__PURE__ */ r("span", { className: "mono small", children: [
|
|
146
|
-
h.convRate.toFixed(1),
|
|
147
|
-
"% reach signup"
|
|
148
|
-
] })
|
|
149
|
-
] }),
|
|
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,
|
|
156
|
-
" users"
|
|
157
|
-
] }),
|
|
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 }),
|
|
163
|
-
/* @__PURE__ */ e("span", { className: "grow" }),
|
|
164
|
-
/* @__PURE__ */ r("span", { className: "small muted", children: [
|
|
165
|
-
h.total,
|
|
166
|
-
" transitions"
|
|
167
|
-
] })
|
|
168
|
-
] }),
|
|
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: [
|
|
172
|
-
"→ ",
|
|
173
|
-
l.to
|
|
174
|
-
] }),
|
|
175
|
-
/* @__PURE__ */ e("span", { className: "grow" }),
|
|
176
|
-
/* @__PURE__ */ r("span", { className: "mono", children: [
|
|
177
|
-
l.pct.toFixed(0),
|
|
178
|
-
"%"
|
|
179
|
-
] })
|
|
180
|
-
] }),
|
|
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 })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
);
|
|
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("");
|
|
27
|
+
const Ot = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Je = 500, Te = "Something else";
|
|
28
|
+
function At({ onClose: e, onSubmit: n }) {
|
|
29
|
+
const [s, a] = x(1), [o, c] = x(0), [d, r] = x([]), [p, l] = x(""), [h, g] = x(""), [u, f] = x(""), [v, _] = x(!1), N = (b) => r((R) => R.includes(b) ? R.filter((L) => L !== b) : [...R, b]), M = u.trim(), E = M !== "" && !Ot.test(M), I = d.includes(Te) && !p.trim(), w = () => {
|
|
30
|
+
n == null || n({
|
|
31
|
+
rating: o,
|
|
32
|
+
topics: d,
|
|
33
|
+
otherTopic: d.includes(Te) ? p.trim() : "",
|
|
34
|
+
comment: h.trim(),
|
|
35
|
+
email: M,
|
|
36
|
+
contactOk: v && M !== "",
|
|
37
|
+
submittedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
38
|
+
}), a(4);
|
|
194
39
|
};
|
|
195
|
-
return /* @__PURE__ */
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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 }),
|
|
204
|
-
/* @__PURE__ */ e("span", { className: "grow" }),
|
|
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: "✕" })
|
|
206
|
-
] }),
|
|
207
|
-
u.pages.map((v) => /* @__PURE__ */ r("div", { className: "small mono muted", children: [
|
|
208
|
-
"✓ ",
|
|
209
|
-
v
|
|
210
|
-
] }, v)),
|
|
211
|
-
/* @__PURE__ */ r("div", { className: "small", style: { color: k }, children: [
|
|
212
|
-
"Emotion: ",
|
|
213
|
-
u.emotion
|
|
214
|
-
] }),
|
|
215
|
-
/* @__PURE__ */ e(K, { pct: l }),
|
|
216
|
-
/* @__PURE__ */ r("div", { className: "small mono muted", children: [
|
|
217
|
-
l.toFixed(0),
|
|
218
|
-
"% reach"
|
|
219
|
-
] })
|
|
220
|
-
] }, u.id);
|
|
221
|
-
}),
|
|
222
|
-
t.stages.length === 0 && /* @__PURE__ */ e("div", { className: "muted", children: "No stages yet. Add one below." })
|
|
40
|
+
return /* @__PURE__ */ t("div", { className: "overlay", onClick: (b) => {
|
|
41
|
+
b.target === b.currentTarget && e();
|
|
42
|
+
}, children: /* @__PURE__ */ i("div", { className: "modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "survey-title", children: [
|
|
43
|
+
/* @__PURE__ */ i("header", { className: "modal-head", children: [
|
|
44
|
+
/* @__PURE__ */ t("div", { className: "progress", "aria-hidden": "true", children: [1, 2, 3, 4].map((b) => /* @__PURE__ */ t("span", { className: b <= s ? "done" : "" }, b)) }),
|
|
45
|
+
/* @__PURE__ */ t("button", { className: "close", onClick: e, "aria-label": "Close survey", children: "×" })
|
|
223
46
|
] }),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ i("div", { className: "modal-body", children: [
|
|
48
|
+
s === 1 && /* @__PURE__ */ i(B, { children: [
|
|
49
|
+
/* @__PURE__ */ t("div", { className: "label", children: "Step 1 of 4 · Quick rating" }),
|
|
50
|
+
/* @__PURE__ */ t("h2", { id: "survey-title", children: "How was your experience?" }),
|
|
51
|
+
/* @__PURE__ */ t("p", { className: "desc", children: "Your feedback helps us make things better." }),
|
|
52
|
+
/* @__PURE__ */ t(Rt, { rating: o, onRate: c })
|
|
229
53
|
] }),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
234
|
-
/* @__PURE__ */
|
|
54
|
+
s === 2 && /* @__PURE__ */ i(B, { children: [
|
|
55
|
+
/* @__PURE__ */ t("div", { className: "label", children: "Step 2 of 4 · What matters?" }),
|
|
56
|
+
/* @__PURE__ */ t("h2", { id: "survey-title", children: "What would you like us to improve?" }),
|
|
57
|
+
/* @__PURE__ */ t("p", { className: "desc", children: "Choose all that apply." }),
|
|
58
|
+
/* @__PURE__ */ t("div", { className: "choices", children: Ct.map((b) => /* @__PURE__ */ i("label", { className: `choice ${d.includes(b) ? "checked" : ""}`, children: [
|
|
59
|
+
/* @__PURE__ */ t("input", { type: "checkbox", checked: d.includes(b), onChange: () => N(b) }),
|
|
60
|
+
/* @__PURE__ */ t("span", { children: b })
|
|
61
|
+
] }, b)) }),
|
|
62
|
+
d.includes(Te) && /* @__PURE__ */ t(
|
|
63
|
+
"input",
|
|
64
|
+
{
|
|
65
|
+
className: "input",
|
|
66
|
+
type: "text",
|
|
67
|
+
autoFocus: !0,
|
|
68
|
+
maxLength: 120,
|
|
69
|
+
placeholder: "Tell us what else...",
|
|
70
|
+
"aria-label": "Something else",
|
|
71
|
+
value: p,
|
|
72
|
+
onChange: (b) => l(b.target.value)
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] }),
|
|
76
|
+
s === 3 && /* @__PURE__ */ i(B, { children: [
|
|
77
|
+
/* @__PURE__ */ t("div", { className: "label", children: "Step 3 of 4 · Your thoughts" }),
|
|
78
|
+
/* @__PURE__ */ t("h2", { id: "survey-title", children: "Anything else you'd like to share?" }),
|
|
79
|
+
/* @__PURE__ */ t("p", { className: "desc", children: "Comments and email are optional." }),
|
|
80
|
+
/* @__PURE__ */ t(
|
|
81
|
+
"textarea",
|
|
82
|
+
{
|
|
83
|
+
className: "field",
|
|
84
|
+
maxLength: Je,
|
|
85
|
+
placeholder: "Share your thoughts, ideas, or suggestions...",
|
|
86
|
+
value: h,
|
|
87
|
+
onChange: (b) => g(b.target.value)
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ i("div", { className: "counter", children: [
|
|
91
|
+
h.length,
|
|
92
|
+
" / ",
|
|
93
|
+
Je
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ t("label", { className: "field-label", htmlFor: "fb-email", children: "Email (optional)" }),
|
|
96
|
+
/* @__PURE__ */ t(
|
|
97
|
+
"input",
|
|
98
|
+
{
|
|
99
|
+
id: "fb-email",
|
|
100
|
+
className: `input ${E ? "invalid" : ""}`,
|
|
101
|
+
type: "email",
|
|
102
|
+
inputMode: "email",
|
|
103
|
+
autoComplete: "email",
|
|
104
|
+
placeholder: "you@example.com",
|
|
105
|
+
value: u,
|
|
106
|
+
onChange: (b) => f(b.target.value),
|
|
107
|
+
"aria-invalid": E
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
E && /* @__PURE__ */ t("div", { className: "error", children: "Please enter a valid email address." }),
|
|
111
|
+
/* @__PURE__ */ i("label", { className: `choice small ${M === "" ? "disabled" : ""}`, children: [
|
|
112
|
+
/* @__PURE__ */ t("input", { type: "checkbox", disabled: M === "", checked: v, onChange: (b) => _(b.target.checked) }),
|
|
113
|
+
/* @__PURE__ */ t("span", { children: "You can contact me about this feedback" })
|
|
114
|
+
] })
|
|
115
|
+
] }),
|
|
116
|
+
s === 4 && /* @__PURE__ */ i("div", { className: "success", children: [
|
|
117
|
+
/* @__PURE__ */ t("div", { className: "success-mark", children: "✓" }),
|
|
118
|
+
/* @__PURE__ */ t("div", { className: "label", children: "Step 4 of 4 · Completed" }),
|
|
119
|
+
/* @__PURE__ */ t("h2", { id: "survey-title", children: "Thank you for your feedback!" }),
|
|
120
|
+
/* @__PURE__ */ t("p", { children: n ? `Your ${o} ★ response has been recorded.` : `This is a preview, so your response (${o} ★) isn't sent anywhere.` })
|
|
235
121
|
] })
|
|
122
|
+
] }),
|
|
123
|
+
/* @__PURE__ */ i("footer", { className: "actions", children: [
|
|
124
|
+
s === 1 && /* @__PURE__ */ i(B, { children: [
|
|
125
|
+
/* @__PURE__ */ t("button", { className: "btn secondary", onClick: e, children: "Cancel" }),
|
|
126
|
+
/* @__PURE__ */ t("button", { className: "btn", disabled: !o, onClick: () => a(2), children: "Next →" })
|
|
127
|
+
] }),
|
|
128
|
+
s === 2 && /* @__PURE__ */ i(B, { children: [
|
|
129
|
+
/* @__PURE__ */ t("button", { className: "btn secondary", onClick: () => a(1), children: "← Back" }),
|
|
130
|
+
/* @__PURE__ */ t("button", { className: "btn", disabled: I, onClick: () => a(3), children: "Next →" })
|
|
131
|
+
] }),
|
|
132
|
+
s === 3 && /* @__PURE__ */ i(B, { children: [
|
|
133
|
+
/* @__PURE__ */ t("button", { className: "btn secondary", onClick: () => a(2), children: "← Back" }),
|
|
134
|
+
/* @__PURE__ */ t("button", { className: "btn", disabled: E, onClick: w, children: "Submit →" })
|
|
135
|
+
] }),
|
|
136
|
+
s === 4 && /* @__PURE__ */ t("button", { className: "btn full", onClick: e, children: "Done" })
|
|
236
137
|
] })
|
|
138
|
+
] }) });
|
|
139
|
+
}
|
|
140
|
+
const Pt = ({ autoOpen: e = !0, onClose: n, onSubmit: s }) => {
|
|
141
|
+
const [a, o] = x(e), c = q(n);
|
|
142
|
+
c.current = n;
|
|
143
|
+
const d = () => {
|
|
144
|
+
var r;
|
|
145
|
+
o(!1), (r = c.current) == null || r.call(c);
|
|
146
|
+
};
|
|
147
|
+
return P(() => {
|
|
148
|
+
if (!a) return;
|
|
149
|
+
const r = (l) => {
|
|
150
|
+
var h;
|
|
151
|
+
l.key === "Escape" && (o(!1), (h = c.current) == null || h.call(c));
|
|
152
|
+
};
|
|
153
|
+
document.addEventListener("keydown", r);
|
|
154
|
+
const p = document.body.style.overflow;
|
|
155
|
+
return document.body.style.overflow = "hidden", () => {
|
|
156
|
+
document.removeEventListener("keydown", r), document.body.style.overflow = p;
|
|
157
|
+
};
|
|
158
|
+
}, [a]), /* @__PURE__ */ i("div", { className: "fb-root", children: [
|
|
159
|
+
/* @__PURE__ */ t("main", { className: "page" }),
|
|
160
|
+
a && /* @__PURE__ */ t(At, { onClose: d, onSubmit: s })
|
|
237
161
|
] });
|
|
238
|
-
},
|
|
162
|
+
}, Ft = [
|
|
163
|
+
"ALL",
|
|
164
|
+
"ERROR",
|
|
165
|
+
"WARN",
|
|
166
|
+
"INFO",
|
|
167
|
+
"DEBUG"
|
|
168
|
+
], Ce = (e) => String(e).padStart(2, "0"), Dt = (e) => `${Ce(e.getHours())}:${Ce(e.getMinutes())}:${Ce(e.getSeconds())}`, Ht = [
|
|
169
|
+
{
|
|
170
|
+
key: "console",
|
|
171
|
+
name: "console.log",
|
|
172
|
+
match: () => !0
|
|
173
|
+
},
|
|
239
174
|
{
|
|
240
|
-
|
|
241
|
-
name: "
|
|
242
|
-
|
|
243
|
-
status: "active",
|
|
244
|
-
target: 100,
|
|
245
|
-
createdAt: oe(30),
|
|
246
|
-
questions: [
|
|
247
|
-
{ id: "s1q1", type: "nps", text: "How likely are you to recommend us to a colleague?", required: !0 },
|
|
248
|
-
{ id: "s1q2", type: "rating", text: "How satisfied are you with the product?", required: !0 },
|
|
249
|
-
{ id: "s1q3", type: "multiple_choice", text: "Which feature do you use most?", required: !1, options: ["Feature Flags", "Experiments", "Segments", "Audit Log"] },
|
|
250
|
-
{ id: "s1q4", type: "open_text", text: "What is one thing we should improve?", required: !1 }
|
|
251
|
-
]
|
|
175
|
+
key: "errors",
|
|
176
|
+
name: "errors.log",
|
|
177
|
+
match: (e) => e.l === "ERROR" || e.l === "WARN"
|
|
252
178
|
},
|
|
253
179
|
{
|
|
254
|
-
|
|
255
|
-
name: "
|
|
256
|
-
|
|
257
|
-
status: "draft",
|
|
258
|
-
target: 50,
|
|
259
|
-
createdAt: oe(5),
|
|
260
|
-
questions: [
|
|
261
|
-
{ id: "s2q1", type: "nps", text: "How likely are you to recommend our onboarding?", required: !0 },
|
|
262
|
-
{ id: "s2q2", type: "open_text", text: "What was confusing?", required: !1 }
|
|
263
|
-
]
|
|
180
|
+
key: "debug",
|
|
181
|
+
name: "debug.log",
|
|
182
|
+
match: (e) => e.l === "DEBUG"
|
|
264
183
|
}
|
|
265
|
-
],
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
184
|
+
], Wt = (e) => {
|
|
185
|
+
const n = Array.from(
|
|
186
|
+
new Set(
|
|
187
|
+
e.map((s) => s.src).filter((s) => !!s)
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
return [
|
|
191
|
+
...Ht,
|
|
192
|
+
...n.map((s) => ({
|
|
193
|
+
key: `${s}.logger`,
|
|
194
|
+
name: `${s}.logger.log`,
|
|
195
|
+
match: (a) => a.src === s
|
|
196
|
+
}))
|
|
197
|
+
];
|
|
198
|
+
}, Ue = {
|
|
199
|
+
ERROR: {
|
|
200
|
+
meaning: "Something failed in the application.",
|
|
201
|
+
fix: "Check the error message and stack trace."
|
|
202
|
+
},
|
|
203
|
+
WARN: {
|
|
204
|
+
meaning: "Something unusual happened.",
|
|
205
|
+
fix: "Review the warning and investigate if necessary."
|
|
206
|
+
},
|
|
207
|
+
INFO: {
|
|
208
|
+
meaning: "Normal application activity.",
|
|
209
|
+
fix: "No action is normally required."
|
|
210
|
+
},
|
|
211
|
+
DEBUG: {
|
|
212
|
+
meaning: "Developer debugging information.",
|
|
213
|
+
fix: "Use this information to investigate code behavior."
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
let ke = [], _t = 1;
|
|
217
|
+
const Pe = /* @__PURE__ */ new Set();
|
|
218
|
+
let je = !1;
|
|
219
|
+
const lt = () => {
|
|
220
|
+
je || (je = !0, queueMicrotask(() => {
|
|
221
|
+
je = !1, Pe.forEach((e) => e());
|
|
222
|
+
}));
|
|
223
|
+
}, Ve = /token|secret|pass|pwd|auth|jwt|session|cookie|otp|credential|api[-_]?key/i, ye = (e) => e.replace(
|
|
224
|
+
/\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,
|
|
225
|
+
"$1***"
|
|
226
|
+
).replace(
|
|
227
|
+
/\b(password|passwd|token|secret|api[-_]?key|authorization)\s*[:=]\s*["']?[^"',\s}]+/gi,
|
|
228
|
+
"$1=***"
|
|
229
|
+
), me = (e, n = "") => {
|
|
230
|
+
if (Ve.test(n)) return "***";
|
|
231
|
+
if (typeof e == "string")
|
|
232
|
+
return ye(e);
|
|
233
|
+
if (e instanceof Error)
|
|
234
|
+
return ye(e.message || String(e));
|
|
235
|
+
if (e == null)
|
|
236
|
+
return String(e);
|
|
237
|
+
if (typeof e == "object")
|
|
238
|
+
try {
|
|
239
|
+
const s = /* @__PURE__ */ new WeakSet();
|
|
240
|
+
return JSON.stringify(
|
|
241
|
+
e,
|
|
242
|
+
(a, o) => {
|
|
243
|
+
if (Ve.test(a)) return "***";
|
|
244
|
+
if (typeof o == "string") return ye(o);
|
|
245
|
+
if (typeof o == "object" && o !== null) {
|
|
246
|
+
if (s.has(o)) return "[Circular]";
|
|
247
|
+
s.add(o);
|
|
248
|
+
}
|
|
249
|
+
return o;
|
|
250
|
+
}
|
|
251
|
+
) ?? String(e);
|
|
252
|
+
} catch {
|
|
253
|
+
return "[Unserializable object]";
|
|
254
|
+
}
|
|
255
|
+
return String(e);
|
|
256
|
+
}, Bt = (e) => {
|
|
257
|
+
const n = e[0];
|
|
258
|
+
if (typeof n != "string" || !/%[sdifoOjc%]/.test(n))
|
|
259
|
+
return e.map((o) => me(o)).join(" ");
|
|
260
|
+
let s = 1;
|
|
261
|
+
return [
|
|
262
|
+
n.replace(
|
|
263
|
+
/%([sdifoOjc%])/g,
|
|
264
|
+
(o, c) => {
|
|
265
|
+
if (c === "%") return "%";
|
|
266
|
+
if (s >= e.length) return o;
|
|
267
|
+
const d = e[s++];
|
|
268
|
+
switch (c) {
|
|
269
|
+
case "s":
|
|
270
|
+
return me(d);
|
|
271
|
+
case "d":
|
|
272
|
+
case "i":
|
|
273
|
+
return String(parseInt(String(d), 10));
|
|
274
|
+
case "f":
|
|
275
|
+
return String(parseFloat(String(d)));
|
|
276
|
+
case "c":
|
|
277
|
+
return "";
|
|
278
|
+
default:
|
|
279
|
+
return me(d);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
),
|
|
283
|
+
...e.slice(s).map((o) => me(o))
|
|
284
|
+
].join(" ");
|
|
285
|
+
}, pe = (e, n, s, a) => {
|
|
286
|
+
const o = n.find(
|
|
287
|
+
(h) => h instanceof Error
|
|
288
|
+
), c = /* @__PURE__ */ new Date();
|
|
289
|
+
let d = Bt(n), r = s ?? (o == null ? void 0 : o.stack);
|
|
290
|
+
const p = d.search(/\n\s+at\s/);
|
|
291
|
+
p > 0 && (r || (r = d.slice(p).trim()), d = d.slice(0, p).trim());
|
|
292
|
+
const l = {
|
|
293
|
+
id: _t++,
|
|
294
|
+
at: c.getTime(),
|
|
295
|
+
t: Dt(c),
|
|
296
|
+
l: e,
|
|
297
|
+
m: d,
|
|
298
|
+
stack: r,
|
|
299
|
+
src: a
|
|
300
|
+
};
|
|
301
|
+
ke = [
|
|
302
|
+
...ke,
|
|
303
|
+
l
|
|
304
|
+
].slice(-1e3), lt();
|
|
305
|
+
}, ct = {};
|
|
306
|
+
function qt() {
|
|
307
|
+
if (typeof window > "u" || window.__pulseLogsCapture)
|
|
308
|
+
return;
|
|
309
|
+
window.__pulseLogsCapture = !0, [
|
|
310
|
+
["log", "INFO"],
|
|
311
|
+
["info", "INFO"],
|
|
312
|
+
["warn", "WARN"],
|
|
313
|
+
["error", "ERROR"],
|
|
314
|
+
["debug", "DEBUG"]
|
|
315
|
+
].forEach(([n, s]) => {
|
|
316
|
+
const a = console[n].bind(console);
|
|
317
|
+
ct[n] = a, console[n] = (...o) => {
|
|
318
|
+
a(...o), pe(s, o);
|
|
281
319
|
};
|
|
320
|
+
}), window.addEventListener("error", (n) => {
|
|
321
|
+
var s, a;
|
|
322
|
+
!n.error && !n.message || pe(
|
|
323
|
+
"ERROR",
|
|
324
|
+
[
|
|
325
|
+
`Uncaught ${((s = n.error) == null ? void 0 : s.name) ?? "Error"}: ${n.message}`
|
|
326
|
+
],
|
|
327
|
+
(a = n.error) == null ? void 0 : a.stack
|
|
328
|
+
);
|
|
329
|
+
}), window.addEventListener("unhandledrejection", (n) => {
|
|
330
|
+
const s = n.reason;
|
|
331
|
+
pe(
|
|
332
|
+
"ERROR",
|
|
333
|
+
[`Unhandled promise rejection: ${me(s)}`],
|
|
334
|
+
s instanceof Error ? s.stack : void 0
|
|
335
|
+
);
|
|
282
336
|
});
|
|
283
337
|
}
|
|
284
|
-
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
|
|
338
|
+
qt();
|
|
339
|
+
function Le(e) {
|
|
340
|
+
const n = (o, c) => (...d) => {
|
|
341
|
+
const r = d.map((l) => typeof l == "string" ? ye(l) : l), p = ct[o];
|
|
342
|
+
if (p)
|
|
343
|
+
p(`[${e}]`, ...r);
|
|
344
|
+
else {
|
|
345
|
+
pe(c, r, void 0, e);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
pe(c, r, void 0, e);
|
|
349
|
+
}, s = {
|
|
350
|
+
debug: n("debug", "DEBUG"),
|
|
351
|
+
info: n("info", "INFO"),
|
|
352
|
+
warn: n("warn", "WARN"),
|
|
353
|
+
error: n("error", "ERROR")
|
|
354
|
+
};
|
|
288
355
|
return {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
356
|
+
...s,
|
|
357
|
+
wrap: (o, c, d = {}) => (...r) => {
|
|
358
|
+
const p = performance.now(), l = () => `${Math.round(performance.now() - p)}ms`;
|
|
359
|
+
s.debug(
|
|
360
|
+
`${o} started`,
|
|
361
|
+
...d.logArgs ? [{ args: r }] : []
|
|
362
|
+
);
|
|
363
|
+
const h = (u) => (s.info(
|
|
364
|
+
`${o} succeeded (${l()})`,
|
|
365
|
+
...d.logResult ? [{ result: u }] : []
|
|
366
|
+
), u), g = (u) => {
|
|
367
|
+
throw s.error(
|
|
368
|
+
`${o} failed (${l()}): ${u instanceof Error ? u.message : String(u)}`,
|
|
369
|
+
u
|
|
370
|
+
), u;
|
|
371
|
+
};
|
|
372
|
+
try {
|
|
373
|
+
const u = c(...r);
|
|
374
|
+
return u !== null && (typeof u == "object" || typeof u == "function") && typeof u.then == "function" ? Promise.resolve(u).then(
|
|
375
|
+
h,
|
|
376
|
+
g
|
|
377
|
+
) : h(u);
|
|
378
|
+
} catch (u) {
|
|
379
|
+
return g(u);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
294
382
|
};
|
|
295
383
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
384
|
+
const Dn = Le("app"), Yt = (e) => (Pe.add(e), () => {
|
|
385
|
+
Pe.delete(e);
|
|
386
|
+
}), Ge = () => ke, zt = () => {
|
|
387
|
+
ke = [], lt();
|
|
388
|
+
}, Jt = () => Me(
|
|
389
|
+
Yt,
|
|
390
|
+
Ge,
|
|
391
|
+
Ge
|
|
392
|
+
), Ke = Le("network"), de = Le("storage"), ie = "pulseLogs.", Fe = ie + "networkName", De = ie + "publicLookup", Ut = /token|secret|pass|pwd|auth|jwt|session|cookie|otp|credential|api[-_]?key/i, ne = () => typeof window < "u" && typeof navigator < "u", re = (e) => {
|
|
393
|
+
if (!ne()) return null;
|
|
394
|
+
try {
|
|
395
|
+
return e === "local" ? window.localStorage : window.sessionStorage;
|
|
396
|
+
} catch {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
}, X = (e, n = 2) => String(e).padStart(n, "0"), Be = () => {
|
|
400
|
+
try {
|
|
401
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone || "local";
|
|
402
|
+
} catch {
|
|
403
|
+
return "local";
|
|
404
|
+
}
|
|
405
|
+
}, V = (e = /* @__PURE__ */ new Date()) => {
|
|
406
|
+
const n = new Date(e);
|
|
407
|
+
if (Number.isNaN(n.getTime())) return "Invalid date";
|
|
408
|
+
const s = -n.getTimezoneOffset(), a = Math.abs(s);
|
|
409
|
+
return `${n.getFullYear()}-${X(n.getMonth() + 1)}-${X(n.getDate())} ${X(n.getHours())}:${X(n.getMinutes())}:${X(n.getSeconds())}.${X(n.getMilliseconds(), 3)} (UTC${s >= 0 ? "+" : "-"}${X(Math.floor(a / 60))}:${X(a % 60)})`;
|
|
410
|
+
}, Ie = {
|
|
411
|
+
publicIp: null,
|
|
412
|
+
localIps: [],
|
|
413
|
+
localIpsHidden: !1,
|
|
414
|
+
isp: null,
|
|
415
|
+
location: null
|
|
416
|
+
}, dt = {
|
|
417
|
+
online: !1,
|
|
418
|
+
type: "unknown",
|
|
419
|
+
effectiveType: "unknown",
|
|
420
|
+
downlinkMbps: null,
|
|
421
|
+
rttMs: null,
|
|
422
|
+
connectionName: null,
|
|
423
|
+
...Ie
|
|
424
|
+
}, Xe = (e) => {
|
|
425
|
+
var n;
|
|
426
|
+
try {
|
|
427
|
+
return ((n = re("local")) == null ? void 0 : n.getItem(e)) ?? null;
|
|
428
|
+
} catch {
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
}, C = ne() && window.__pulseEnvStore || {
|
|
432
|
+
state: { net: dt, local: [], session: [] },
|
|
433
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
434
|
+
ip: { ...Ie },
|
|
435
|
+
manualName: Xe(Fe),
|
|
436
|
+
lookupEnabled: Xe(De) !== "0",
|
|
437
|
+
run: 0
|
|
438
|
+
};
|
|
439
|
+
ne() && (window.__pulseEnvStore = C);
|
|
440
|
+
const ht = () => {
|
|
441
|
+
if (!ne()) return;
|
|
442
|
+
const e = navigator;
|
|
443
|
+
return e.connection || e.mozConnection || e.webkitConnection;
|
|
444
|
+
}, Qe = typeof window < "u" && window.fetch ? window.fetch.bind(window) : null, Ze = async (e, n = 3e3) => {
|
|
445
|
+
if (!Qe) throw new Error("Fetch unavailable");
|
|
446
|
+
const s = new AbortController(), a = setTimeout(() => s.abort(), n);
|
|
447
|
+
try {
|
|
448
|
+
const o = await Qe(e, { signal: s.signal });
|
|
449
|
+
if (!o.ok) throw new Error(`HTTP ${o.status}`);
|
|
450
|
+
return await o.json();
|
|
451
|
+
} finally {
|
|
452
|
+
clearTimeout(a);
|
|
453
|
+
}
|
|
454
|
+
}, Vt = async () => {
|
|
455
|
+
var e, n;
|
|
456
|
+
try {
|
|
457
|
+
const s = await Ze("https://ipwho.is/");
|
|
458
|
+
if ((s == null ? void 0 : s.success) !== !1 && typeof (s == null ? void 0 : s.ip) == "string")
|
|
459
|
+
return {
|
|
460
|
+
publicIp: s.ip,
|
|
461
|
+
isp: ((e = s.connection) == null ? void 0 : e.isp) || ((n = s.connection) == null ? void 0 : n.org) || null,
|
|
462
|
+
location: [s.city, s.region, s.country].filter(Boolean).join(", ") || null
|
|
463
|
+
};
|
|
464
|
+
} catch {
|
|
465
|
+
}
|
|
466
|
+
try {
|
|
467
|
+
const s = await Ze("https://api.ipify.org?format=json");
|
|
468
|
+
return { publicIp: (s == null ? void 0 : s.ip) ?? null, isp: null, location: null };
|
|
469
|
+
} catch {
|
|
470
|
+
return { publicIp: null, isp: null, location: null };
|
|
471
|
+
}
|
|
472
|
+
}, Gt = () => new Promise((e) => {
|
|
473
|
+
if (!ne() || typeof RTCPeerConnection > "u") {
|
|
474
|
+
e({ ips: [], hidden: !1 });
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const n = /* @__PURE__ */ new Set();
|
|
478
|
+
let s = !1, a = !1, o, c;
|
|
479
|
+
try {
|
|
480
|
+
c = new RTCPeerConnection({ iceServers: [] });
|
|
481
|
+
} catch {
|
|
482
|
+
e({ ips: [], hidden: !1 });
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const d = () => {
|
|
486
|
+
if (!a) {
|
|
487
|
+
a = !0, clearTimeout(o);
|
|
488
|
+
try {
|
|
489
|
+
c.close();
|
|
490
|
+
} catch {
|
|
313
491
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
492
|
+
e({ ips: [...n], hidden: s });
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
o = setTimeout(d, 1500);
|
|
496
|
+
try {
|
|
497
|
+
c.createDataChannel("pulse"), c.onicecandidate = (r) => {
|
|
498
|
+
var h;
|
|
499
|
+
const p = (h = r.candidate) == null ? void 0 : h.candidate;
|
|
500
|
+
if (!p) {
|
|
501
|
+
d();
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
const l = p.split(" ")[4];
|
|
505
|
+
l && (l.endsWith(".local") ? s = !0 : n.add(l));
|
|
506
|
+
}, c.createOffer().then((r) => c.setLocalDescription(r)).catch(d);
|
|
507
|
+
} catch {
|
|
508
|
+
d();
|
|
509
|
+
}
|
|
510
|
+
}), ut = () => {
|
|
511
|
+
if (!ne()) return { ...dt };
|
|
512
|
+
const e = ht();
|
|
513
|
+
return {
|
|
514
|
+
online: navigator.onLine,
|
|
515
|
+
type: (e == null ? void 0 : e.type) ?? "unknown",
|
|
516
|
+
effectiveType: (e == null ? void 0 : e.effectiveType) ?? "unknown",
|
|
517
|
+
downlinkMbps: typeof (e == null ? void 0 : e.downlink) == "number" ? e.downlink : null,
|
|
518
|
+
rttMs: typeof (e == null ? void 0 : e.rtt) == "number" ? e.rtt : null,
|
|
519
|
+
connectionName: C.manualName,
|
|
520
|
+
...C.ip
|
|
521
|
+
};
|
|
522
|
+
}, mt = (e, n) => {
|
|
523
|
+
if (Ut.test(e)) return "***";
|
|
524
|
+
const s = n ?? "";
|
|
525
|
+
return s.length > 100 ? s.slice(0, 100) + "…" : s;
|
|
526
|
+
}, He = (e) => {
|
|
527
|
+
if (!e) return [];
|
|
528
|
+
try {
|
|
529
|
+
const n = [];
|
|
530
|
+
for (let s = 0; s < e.length; s++) {
|
|
531
|
+
const a = e.key(s);
|
|
532
|
+
if (!a || a.startsWith(ie)) continue;
|
|
533
|
+
const o = e.getItem(a) ?? "";
|
|
534
|
+
n.push({ key: a, size: o.length, value: mt(a, o) });
|
|
535
|
+
}
|
|
536
|
+
return n;
|
|
537
|
+
} catch {
|
|
538
|
+
return [];
|
|
539
|
+
}
|
|
540
|
+
}, Re = (e) => {
|
|
541
|
+
try {
|
|
542
|
+
if (e === window.localStorage) return "localStorage";
|
|
543
|
+
if (e === window.sessionStorage) return "sessionStorage";
|
|
544
|
+
} catch {
|
|
545
|
+
}
|
|
546
|
+
return "storage";
|
|
547
|
+
}, U = () => {
|
|
548
|
+
C.state = {
|
|
549
|
+
net: ut(),
|
|
550
|
+
local: He(re("local")),
|
|
551
|
+
session: He(re("session"))
|
|
552
|
+
}, queueMicrotask(() => {
|
|
553
|
+
C.listeners.forEach((e) => e());
|
|
554
|
+
});
|
|
555
|
+
}, pt = (e) => [
|
|
556
|
+
e.online ? "Online" : "OFFLINE",
|
|
557
|
+
e.connectionName ? `"${e.connectionName}"` : null,
|
|
558
|
+
e.publicIp ? `IP ${e.publicIp}` : null,
|
|
559
|
+
e.localIps.length ? `LAN ${e.localIps.join(", ")}` : e.localIpsHidden ? "LAN hidden by browser" : null,
|
|
560
|
+
e.isp,
|
|
561
|
+
e.type !== "unknown" ? e.type : null,
|
|
562
|
+
e.effectiveType !== "unknown" ? e.effectiveType : null,
|
|
563
|
+
e.downlinkMbps !== null ? `${e.downlinkMbps} Mbps` : null,
|
|
564
|
+
e.rttMs !== null ? `RTT ${e.rttMs}ms` : null
|
|
565
|
+
].filter(Boolean).join(" · "), Se = (e) => {
|
|
566
|
+
const n = ut(), s = { at: V(), timezone: Be(), ...n };
|
|
567
|
+
(n.online ? Ke.info : Ke.warn)(`${e}: ${pt(n)}`, s);
|
|
568
|
+
}, ge = async (e) => {
|
|
569
|
+
if (!ne()) return;
|
|
570
|
+
const n = ++C.run;
|
|
571
|
+
if (!navigator.onLine) {
|
|
572
|
+
C.ip = { ...Ie }, U(), Se(e);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const [s, a] = await Promise.all([
|
|
576
|
+
C.lookupEnabled ? Vt() : Promise.resolve({ publicIp: null, isp: null, location: null }),
|
|
577
|
+
Gt()
|
|
578
|
+
]);
|
|
579
|
+
n === C.run && (C.ip = { ...s, localIps: a.ips, localIpsHidden: a.hidden }, U(), Se(e));
|
|
580
|
+
}, Kt = (e) => {
|
|
581
|
+
C.manualName = e.trim() || null;
|
|
582
|
+
try {
|
|
583
|
+
const n = re("local");
|
|
584
|
+
n && (C.manualName ? n.setItem(Fe, C.manualName) : n.removeItem(Fe));
|
|
585
|
+
} catch {
|
|
586
|
+
}
|
|
587
|
+
U(), Se("network name set");
|
|
588
|
+
}, Xt = (e) => {
|
|
589
|
+
C.lookupEnabled = e;
|
|
590
|
+
try {
|
|
591
|
+
const n = re("local");
|
|
592
|
+
n && (e ? n.removeItem(De) : n.setItem(De, "0"));
|
|
593
|
+
} catch {
|
|
594
|
+
}
|
|
595
|
+
ge(e ? "public lookup enabled" : "public lookup disabled");
|
|
596
|
+
}, Qt = () => C.lookupEnabled, Zt = () => {
|
|
597
|
+
ge("network refreshed");
|
|
598
|
+
};
|
|
599
|
+
function en() {
|
|
600
|
+
var d, r;
|
|
601
|
+
if (!ne() || window.__pulseEnvCapture) return;
|
|
602
|
+
window.__pulseEnvCapture = !0;
|
|
603
|
+
const e = Storage.prototype, n = e.setItem, s = e.removeItem, a = e.clear;
|
|
604
|
+
let o = !1;
|
|
605
|
+
const c = (p) => {
|
|
606
|
+
if (!o) {
|
|
607
|
+
o = !0;
|
|
608
|
+
try {
|
|
609
|
+
p();
|
|
610
|
+
} finally {
|
|
611
|
+
o = !1;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
e.setItem = function(p, l) {
|
|
616
|
+
const h = !o && this.getItem(p) !== null;
|
|
617
|
+
n.call(this, p, l), !(o || p.startsWith(ie)) && c(() => {
|
|
618
|
+
de.info(
|
|
619
|
+
`${Re(this)} ${h ? "update" : "add"} ${p} = ${mt(p, String(l))}`,
|
|
620
|
+
{ size: String(l).length, at: V() }
|
|
621
|
+
), U();
|
|
622
|
+
});
|
|
623
|
+
}, e.removeItem = function(p) {
|
|
624
|
+
const l = !o && this.getItem(p) !== null;
|
|
625
|
+
s.call(this, p), !(o || !l || p.startsWith(ie)) && c(() => {
|
|
626
|
+
de.info(`${Re(this)} remove ${p}`, { at: V() }), U();
|
|
627
|
+
});
|
|
628
|
+
}, e.clear = function() {
|
|
629
|
+
if (o) {
|
|
630
|
+
a.call(this);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
const p = Re(this), l = He(this).length > 0;
|
|
634
|
+
a.call(this), c(() => {
|
|
635
|
+
l && de.warn(`${p} cleared`, { at: V() }), U();
|
|
636
|
+
});
|
|
637
|
+
}, window.addEventListener("storage", (p) => {
|
|
638
|
+
var l;
|
|
639
|
+
(l = p.key) != null && l.startsWith(ie) || c(() => {
|
|
640
|
+
de.info(
|
|
641
|
+
`${p.storageArea === re("session") ? "sessionStorage" : "localStorage"} changed in other tab: ${p.key ?? "(clear)"}`,
|
|
642
|
+
{ at: V() }
|
|
643
|
+
), U();
|
|
644
|
+
});
|
|
645
|
+
}), window.addEventListener("online", () => {
|
|
646
|
+
ge("online");
|
|
647
|
+
}), window.addEventListener("offline", () => {
|
|
648
|
+
C.run++, C.ip = { ...Ie }, U(), Se("offline");
|
|
649
|
+
}), (r = (d = ht()) == null ? void 0 : d.addEventListener) == null || r.call(d, "change", () => {
|
|
650
|
+
ge("connection changed");
|
|
651
|
+
}), U(), c(() => {
|
|
652
|
+
de.info(
|
|
653
|
+
`snapshot: localStorage ${C.state.local.length} keys, sessionStorage ${C.state.session.length} keys`,
|
|
319
654
|
{
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
655
|
+
at: V(),
|
|
656
|
+
timezone: Be(),
|
|
657
|
+
localStorage: C.state.local,
|
|
658
|
+
sessionStorage: C.state.session
|
|
325
659
|
}
|
|
326
|
-
)
|
|
660
|
+
);
|
|
661
|
+
}), ge("network at start");
|
|
662
|
+
}
|
|
663
|
+
const tn = (e) => (C.listeners.add(e), () => {
|
|
664
|
+
C.listeners.delete(e);
|
|
665
|
+
}), et = () => C.state, nn = () => (P(() => {
|
|
666
|
+
en();
|
|
667
|
+
}, []), Me(tn, et, et));
|
|
668
|
+
function tt({ title: e, items: n }) {
|
|
669
|
+
return /* @__PURE__ */ i("div", { className: "env-box", children: [
|
|
670
|
+
/* @__PURE__ */ i("b", { children: [
|
|
671
|
+
e,
|
|
672
|
+
" (",
|
|
673
|
+
n.length,
|
|
674
|
+
" ",
|
|
675
|
+
n.length === 1 ? "key" : "keys",
|
|
676
|
+
")"
|
|
677
|
+
] }),
|
|
678
|
+
n.length === 0 ? /* @__PURE__ */ t("span", { className: "env-muted", children: "Empty." }) : /* @__PURE__ */ t("div", { className: "env-scroll", children: /* @__PURE__ */ t("table", { className: "mono", children: /* @__PURE__ */ t("tbody", { children: n.map((s) => /* @__PURE__ */ i("tr", { children: [
|
|
679
|
+
/* @__PURE__ */ t("td", { title: s.key, children: s.key }),
|
|
680
|
+
/* @__PURE__ */ i("td", { children: [
|
|
681
|
+
s.size,
|
|
682
|
+
" B"
|
|
683
|
+
] }),
|
|
684
|
+
/* @__PURE__ */ t("td", { title: s.value, children: s.value })
|
|
685
|
+
] }, s.key)) }) }) })
|
|
686
|
+
] });
|
|
687
|
+
}
|
|
688
|
+
function sn() {
|
|
689
|
+
const { net: e, local: n, session: s } = nn(), [a, o] = x(!1), [c, d] = x(() => V()), [r, p] = x(e.connectionName ?? ""), [l, h] = x(Qt());
|
|
690
|
+
P(() => {
|
|
691
|
+
if (!a) return;
|
|
692
|
+
d(V());
|
|
693
|
+
const u = setInterval(() => d(V()), 1e3);
|
|
694
|
+
return () => clearInterval(u);
|
|
695
|
+
}, [a]);
|
|
696
|
+
const g = () => Kt(r);
|
|
697
|
+
return /* @__PURE__ */ i("div", { className: "env", "data-tour": "env", children: [
|
|
698
|
+
/* @__PURE__ */ i("button", { className: "env-head", onClick: () => o((u) => !u), "aria-expanded": a, children: [
|
|
699
|
+
/* @__PURE__ */ i("span", { children: [
|
|
700
|
+
a ? "▾" : "▸",
|
|
701
|
+
" Environment"
|
|
702
|
+
] }),
|
|
703
|
+
/* @__PURE__ */ t("span", { className: `env-sum ${e.online ? "" : "off"}`, children: pt(e) })
|
|
704
|
+
] }),
|
|
705
|
+
a && /* @__PURE__ */ i("div", { className: "env-body", children: [
|
|
706
|
+
/* @__PURE__ */ i("div", { className: "env-box", children: [
|
|
707
|
+
/* @__PURE__ */ t("b", { children: "Local time" }),
|
|
708
|
+
/* @__PURE__ */ t("span", { className: "mono", children: c }),
|
|
709
|
+
/* @__PURE__ */ i("span", { className: "env-muted", children: [
|
|
710
|
+
"Time zone: ",
|
|
711
|
+
Be()
|
|
712
|
+
] })
|
|
713
|
+
] }),
|
|
714
|
+
/* @__PURE__ */ i("div", { className: "env-box", children: [
|
|
715
|
+
/* @__PURE__ */ t("b", { children: "Network" }),
|
|
716
|
+
/* @__PURE__ */ t("span", { children: e.online ? "Online" : "Offline" }),
|
|
717
|
+
/* @__PURE__ */ i("span", { className: "env-muted", children: [
|
|
718
|
+
"Public IP: ",
|
|
719
|
+
e.publicIp ?? (l ? "unknown" : "lookup off"),
|
|
720
|
+
e.isp ? ` · ${e.isp}` : "",
|
|
721
|
+
e.location ? ` · ${e.location}` : ""
|
|
722
|
+
] }),
|
|
723
|
+
/* @__PURE__ */ i("span", { className: "env-muted", children: [
|
|
724
|
+
"LAN IP: ",
|
|
725
|
+
e.localIps.length ? e.localIps.join(", ") : e.localIpsHidden ? "hidden by browser" : "unknown"
|
|
726
|
+
] }),
|
|
727
|
+
/* @__PURE__ */ i("span", { className: "env-muted", children: [
|
|
728
|
+
"Connection: ",
|
|
729
|
+
e.type,
|
|
730
|
+
" · ",
|
|
731
|
+
e.effectiveType,
|
|
732
|
+
e.downlinkMbps !== null ? ` · ${e.downlinkMbps} Mbps` : "",
|
|
733
|
+
e.rttMs !== null ? ` · RTT ${e.rttMs} ms` : ""
|
|
734
|
+
] }),
|
|
735
|
+
/* @__PURE__ */ i("div", { className: "env-row", children: [
|
|
736
|
+
/* @__PURE__ */ t(
|
|
737
|
+
"input",
|
|
738
|
+
{
|
|
739
|
+
className: "search",
|
|
740
|
+
placeholder: "Wi-Fi / network name (browsers cannot read it)",
|
|
741
|
+
value: r,
|
|
742
|
+
onChange: (u) => p(u.target.value),
|
|
743
|
+
onKeyDown: (u) => {
|
|
744
|
+
u.key === "Enter" && g();
|
|
745
|
+
},
|
|
746
|
+
"aria-label": "Network name"
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
/* @__PURE__ */ t("button", { className: "btn ghost", onClick: g, children: "Save name" }),
|
|
750
|
+
/* @__PURE__ */ t("button", { className: "btn ghost", onClick: Zt, children: "Refresh" })
|
|
751
|
+
] }),
|
|
752
|
+
/* @__PURE__ */ i("label", { className: "env-muted", style: { display: "flex", gap: 6, alignItems: "center", marginTop: 4 }, children: [
|
|
753
|
+
/* @__PURE__ */ t(
|
|
754
|
+
"input",
|
|
755
|
+
{
|
|
756
|
+
type: "checkbox",
|
|
757
|
+
checked: l,
|
|
758
|
+
onChange: (u) => {
|
|
759
|
+
h(u.target.checked), Xt(u.target.checked);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
),
|
|
763
|
+
"Look up public IP, ISP and location (sends a request to ipwho.is / ipify)"
|
|
764
|
+
] })
|
|
765
|
+
] }),
|
|
766
|
+
/* @__PURE__ */ t(tt, { title: "localStorage", items: n }),
|
|
767
|
+
/* @__PURE__ */ t(tt, { title: "sessionStorage", items: s })
|
|
768
|
+
] })
|
|
769
|
+
] });
|
|
770
|
+
}
|
|
771
|
+
const Ne = [
|
|
772
|
+
{
|
|
773
|
+
target: "titlebar",
|
|
774
|
+
place: "bottom",
|
|
775
|
+
title: "Meet the Log Viewer",
|
|
776
|
+
body: "The Log Viewer shows what your application recorded while it ran. When something breaks, it is the first place to look to find out what happened and why.",
|
|
777
|
+
enter: (e) => {
|
|
778
|
+
e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel(null);
|
|
779
|
+
}
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
target: "files",
|
|
783
|
+
place: "right",
|
|
784
|
+
title: "Open a log file",
|
|
785
|
+
body: "Every log file lives in this list. Click one to open it. console.log holds all console output, errors.log holds only errors and warnings, and debug.log holds debug messages. The number shows how many live lines each holds.",
|
|
786
|
+
enter: (e) => {
|
|
787
|
+
e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel(null);
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
target: "logpane",
|
|
792
|
+
place: "top",
|
|
793
|
+
title: "Inspect console.log",
|
|
794
|
+
body: "This file shows everything this project prints to the browser console, live, one line per event: a line number, the time it happened, a level, and a message. Read it top to bottom to follow what happened in order. Click any line to see more about it.",
|
|
795
|
+
enter: (e) => {
|
|
796
|
+
e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel(null);
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
target: "filters",
|
|
801
|
+
place: "bottom",
|
|
802
|
+
title: "Find console errors fast",
|
|
803
|
+
body: "Press the Error filter. Only the red lines are left, such as an uncaught error or a failed request. The search box narrows it down further.",
|
|
804
|
+
enter: (e) => {
|
|
805
|
+
e.setFile("console"), e.setLevel("ERROR"), e.setQuery(""), e.setSel(null);
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
target: "details",
|
|
810
|
+
place: "left",
|
|
811
|
+
title: "Read errors and warnings",
|
|
812
|
+
body: "Select a line and its details appear here: what the level means, a suggested fix, and the stack trace (when one was captured) showing the exact file and line. Levels tell you how serious a line is.",
|
|
813
|
+
legend: !0,
|
|
814
|
+
enter: (e) => {
|
|
815
|
+
e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel("auto");
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
target: "summary",
|
|
820
|
+
place: "bottom",
|
|
821
|
+
title: "Debug problems with it",
|
|
822
|
+
body: "Use these counters to see how healthy a session was. Start with the errors, read the warnings around them, then follow the debug lines before an error to find the cause. Fix it, reload, and check that the error is gone.",
|
|
823
|
+
enter: (e) => {
|
|
824
|
+
e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel("auto");
|
|
825
|
+
}
|
|
327
826
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
827
|
+
];
|
|
828
|
+
function an({ step: e, total: n, onNext: s, onBack: a, onClose: o }) {
|
|
829
|
+
const c = Ne[e], d = q(null), [r, p] = x(null), [l, h] = x({ w: 340, h: 260 }), [g, u] = x({ w: window.innerWidth, h: window.innerHeight }), f = H(() => {
|
|
830
|
+
const k = document.querySelector(`[data-tour="${c.target}"]`);
|
|
831
|
+
if (u({ w: window.innerWidth, h: window.innerHeight }), !k) {
|
|
832
|
+
p(null);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
const S = k.getBoundingClientRect(), $ = 8, T = 4, m = Math.max(T, S.left - $), W = Math.max(T, S.top - $), D = Math.min(window.innerWidth - T, S.right + $), F = Math.min(window.innerHeight - T, S.bottom + $);
|
|
836
|
+
p({ x: m, y: W, w: Math.max(0, D - m), h: Math.max(0, F - W) });
|
|
837
|
+
}, [c.target]);
|
|
838
|
+
P(() => {
|
|
839
|
+
const S = [
|
|
840
|
+
setTimeout(() => {
|
|
841
|
+
const $ = document.querySelector(`[data-tour="${c.target}"]`);
|
|
842
|
+
$ && $.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
843
|
+
}, 60),
|
|
844
|
+
...[0, 120, 300, 550, 800].map(($) => setTimeout(f, $))
|
|
845
|
+
];
|
|
846
|
+
return () => S.forEach(clearTimeout);
|
|
847
|
+
}, [e, f, c.target]), P(() => (window.addEventListener("resize", f), window.addEventListener("scroll", f, !0), () => {
|
|
848
|
+
window.removeEventListener("resize", f), window.removeEventListener("scroll", f, !0);
|
|
849
|
+
}), [f]), it(() => {
|
|
850
|
+
d.current && h({
|
|
851
|
+
w: d.current.offsetWidth,
|
|
852
|
+
h: d.current.offsetHeight
|
|
853
|
+
});
|
|
854
|
+
}, [e, g.w]), P(() => {
|
|
855
|
+
const k = (S) => {
|
|
856
|
+
S.key === "ArrowRight" ? (S.preventDefault(), s()) : S.key === "ArrowLeft" ? (S.preventDefault(), a()) : S.key === "Escape" && o();
|
|
857
|
+
};
|
|
858
|
+
return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
|
|
859
|
+
}, [s, a, o]), P(() => {
|
|
860
|
+
var k;
|
|
861
|
+
(k = d.current) == null || k.focus({ preventScroll: !0 });
|
|
862
|
+
}, [e]);
|
|
863
|
+
const v = r || { x: g.w / 2, y: g.h / 2, w: 0, h: 0 }, _ = `polygon(0 0, 0 100%, ${v.x}px 100%, ${v.x}px ${v.y}px, ${v.x + v.w}px ${v.y}px, ${v.x + v.w}px ${v.y + v.h}px, ${v.x}px ${v.y + v.h}px, ${v.x}px 100%, 100% 100%, 100% 0)`, N = 14, M = 16, E = g.w < 700, I = Math.min(360, g.w - N * 2), w = l.h;
|
|
864
|
+
let b = { left: (g.w - I) / 2, top: Math.max(N, (g.h - w) / 2) };
|
|
865
|
+
if (r) {
|
|
866
|
+
const k = r.x + r.w / 2 - I / 2, S = r.y + r.h / 2 - w / 2, $ = (F) => Math.min(Math.max(N, F), g.w - I - N), T = (F) => Math.min(Math.max(N, F), g.h - w - N), m = {
|
|
867
|
+
right: {
|
|
868
|
+
ok: r.x + r.w + M + I <= g.w - N,
|
|
869
|
+
left: r.x + r.w + M,
|
|
870
|
+
top: T(S)
|
|
871
|
+
},
|
|
872
|
+
left: {
|
|
873
|
+
ok: r.x - M - I >= N,
|
|
874
|
+
left: r.x - M - I,
|
|
875
|
+
top: T(S)
|
|
876
|
+
},
|
|
877
|
+
bottom: {
|
|
878
|
+
ok: r.y + r.h + M + w <= g.h - N,
|
|
879
|
+
left: $(k),
|
|
880
|
+
top: r.y + r.h + M
|
|
881
|
+
},
|
|
882
|
+
top: {
|
|
883
|
+
ok: r.y - M - w >= N,
|
|
884
|
+
left: $(k),
|
|
885
|
+
top: r.y - M - w
|
|
886
|
+
}
|
|
887
|
+
}, D = (E ? ["bottom", "top"] : [c.place, "right", "left", "bottom", "top"]).find((F) => m[F].ok);
|
|
888
|
+
b = D ? { left: m[D].left, top: m[D].top } : { left: E ? (g.w - I) / 2 : g.w - I - N, top: g.h - w - N };
|
|
331
889
|
}
|
|
332
|
-
const
|
|
333
|
-
return /* @__PURE__ */
|
|
334
|
-
|
|
890
|
+
const R = e === 0, L = e === n - 1;
|
|
891
|
+
return /* @__PURE__ */ i(
|
|
892
|
+
"div",
|
|
335
893
|
{
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
894
|
+
className: "tour-root",
|
|
895
|
+
role: "dialog",
|
|
896
|
+
"aria-modal": "true",
|
|
897
|
+
"aria-labelledby": "tour-title",
|
|
339
898
|
children: [
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
className: "input slim",
|
|
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))
|
|
372
|
-
}
|
|
373
|
-
) }),
|
|
374
|
-
/* @__PURE__ */ r("td", { style: { minWidth: 140 }, children: [
|
|
375
|
-
/* @__PURE__ */ r("div", { className: "small mono", children: [
|
|
376
|
-
u,
|
|
377
|
-
" / ",
|
|
378
|
-
o.target
|
|
899
|
+
/* @__PURE__ */ t(
|
|
900
|
+
"div",
|
|
901
|
+
{
|
|
902
|
+
className: "tour-dim",
|
|
903
|
+
style: { clipPath: _, WebkitClipPath: _ },
|
|
904
|
+
onClick: (k) => k.stopPropagation()
|
|
905
|
+
}
|
|
906
|
+
),
|
|
907
|
+
r && /* @__PURE__ */ t(
|
|
908
|
+
"div",
|
|
909
|
+
{
|
|
910
|
+
className: "tour-ring",
|
|
911
|
+
style: { left: r.x, top: r.y, width: r.w, height: r.h }
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ i(
|
|
915
|
+
"div",
|
|
916
|
+
{
|
|
917
|
+
className: "tour-tip",
|
|
918
|
+
ref: d,
|
|
919
|
+
tabIndex: -1,
|
|
920
|
+
style: { width: I, left: b.left, top: b.top },
|
|
921
|
+
children: [
|
|
922
|
+
/* @__PURE__ */ i("div", { className: "tip-head", children: [
|
|
923
|
+
/* @__PURE__ */ i("span", { className: "counter", "aria-live": "polite", children: [
|
|
924
|
+
e + 1,
|
|
925
|
+
"/",
|
|
926
|
+
n
|
|
379
927
|
] }),
|
|
380
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ t(
|
|
929
|
+
"button",
|
|
930
|
+
{
|
|
931
|
+
className: "xbtn",
|
|
932
|
+
onClick: o,
|
|
933
|
+
"aria-label": "Close tutorial",
|
|
934
|
+
children: "×"
|
|
935
|
+
}
|
|
936
|
+
)
|
|
381
937
|
] }),
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
938
|
+
/* @__PURE__ */ i("div", { className: "tip-body", children: [
|
|
939
|
+
/* @__PURE__ */ t("h2", { id: "tour-title", children: c.title }),
|
|
940
|
+
/* @__PURE__ */ t("p", { children: c.body }),
|
|
941
|
+
c.legend && /* @__PURE__ */ i(B, { children: [
|
|
942
|
+
/* @__PURE__ */ i("div", { className: "legend", children: [
|
|
943
|
+
/* @__PURE__ */ t("span", { className: "lvl ERROR", children: "ERROR" }),
|
|
944
|
+
/* @__PURE__ */ t("span", { className: "lvl WARN", children: "WARN" }),
|
|
945
|
+
/* @__PURE__ */ t("span", { className: "lvl INFO", children: "INFO" }),
|
|
946
|
+
/* @__PURE__ */ t("span", { className: "lvl DEBUG", children: "DEBUG" })
|
|
947
|
+
] }),
|
|
948
|
+
/* @__PURE__ */ t("p", { style: { marginTop: 8, fontSize: 12, color: "#a1a1aa" }, children: "ERROR: something failed. WARN: something unusual, but it kept going. INFO: normal events. DEBUG: developer detail." })
|
|
949
|
+
] })
|
|
950
|
+
] }, e),
|
|
951
|
+
/* @__PURE__ */ t("div", { className: "dots", children: Array.from({ length: n }, (k, S) => /* @__PURE__ */ t("i", { className: S <= e ? "on" : "" }, S)) }),
|
|
952
|
+
/* @__PURE__ */ i("div", { className: "tip-foot", children: [
|
|
953
|
+
/* @__PURE__ */ t("button", { className: "btn ghost", onClick: a, disabled: R, children: "← Back" }),
|
|
954
|
+
/* @__PURE__ */ t("span", { className: "sp" }),
|
|
955
|
+
L && /* @__PURE__ */ t("button", { className: "btn", onClick: o, children: "Finish" }),
|
|
956
|
+
/* @__PURE__ */ t(
|
|
390
957
|
"button",
|
|
391
958
|
{
|
|
392
|
-
className: "btn
|
|
393
|
-
onClick:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
children: "Delete"
|
|
959
|
+
className: L ? "btn ghost" : "btn",
|
|
960
|
+
onClick: s,
|
|
961
|
+
disabled: L,
|
|
962
|
+
children: "Next →"
|
|
397
963
|
}
|
|
398
964
|
)
|
|
965
|
+
] }),
|
|
966
|
+
/* @__PURE__ */ i("div", { className: "kbd", children: [
|
|
967
|
+
/* @__PURE__ */ t("kbd", { children: "←" }),
|
|
968
|
+
" ",
|
|
969
|
+
/* @__PURE__ */ t("kbd", { children: "→" }),
|
|
970
|
+
" to navigate · ",
|
|
971
|
+
/* @__PURE__ */ t("kbd", { children: "Esc" }),
|
|
972
|
+
" to close"
|
|
399
973
|
] })
|
|
400
|
-
]
|
|
401
|
-
}
|
|
402
|
-
|
|
974
|
+
]
|
|
975
|
+
}
|
|
976
|
+
)
|
|
403
977
|
]
|
|
404
978
|
}
|
|
405
979
|
);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
980
|
+
}
|
|
981
|
+
let nt = !1;
|
|
982
|
+
const on = ({
|
|
983
|
+
autoStart: e = !0
|
|
984
|
+
}) => {
|
|
985
|
+
const [n, s] = x("console"), [a, o] = x("ALL"), [c, d] = x(""), [r, p] = x(null), l = Jt(), [h, g] = x(!1), [u, f] = x(0), v = q(0), _ = te(
|
|
986
|
+
() => ({ setFile: s, setLevel: o, setQuery: d, setSel: p }),
|
|
987
|
+
[]
|
|
988
|
+
), N = te(
|
|
989
|
+
() => Wt(l).map((m) => ({
|
|
990
|
+
key: m.key,
|
|
991
|
+
name: m.name,
|
|
992
|
+
lines: l.filter(m.match)
|
|
993
|
+
})),
|
|
994
|
+
[l]
|
|
995
|
+
), M = N.find((m) => m.key === n) ?? N[0], E = M.lines, I = te(
|
|
996
|
+
() => E.map((m, W) => ({ ...m, i: W })).filter(
|
|
997
|
+
(m) => (a === "ALL" || m.l === a) && m.m.toLowerCase().includes(c.toLowerCase())
|
|
998
|
+
),
|
|
999
|
+
[E, a, c]
|
|
1000
|
+
), w = (m) => E.filter((W) => W.l === m).length, b = r === "auto" ? [...E].reverse().find((m) => m.l === "ERROR") ?? E[E.length - 1] ?? null : r != null ? E.find((m) => m.id === r) ?? null : null, R = H(
|
|
1001
|
+
(m) => {
|
|
1002
|
+
v.current = m, f(m), Ne[m].enter(_);
|
|
1003
|
+
},
|
|
1004
|
+
[_]
|
|
1005
|
+
), L = H(() => {
|
|
1006
|
+
v.current < Ne.length - 1 && R(v.current + 1);
|
|
1007
|
+
}, [R]), k = H(() => {
|
|
1008
|
+
v.current > 0 && R(v.current - 1);
|
|
1009
|
+
}, [R]), S = H(() => g(!1), []), $ = H(() => {
|
|
1010
|
+
R(0), g(!0);
|
|
1011
|
+
}, [R]);
|
|
1012
|
+
P(() => {
|
|
1013
|
+
if (!e || nt) return;
|
|
1014
|
+
const m = setTimeout(() => {
|
|
1015
|
+
nt = !0, $();
|
|
1016
|
+
}, 600);
|
|
1017
|
+
return () => clearTimeout(m);
|
|
1018
|
+
}, [e, $]);
|
|
1019
|
+
const T = (m) => {
|
|
1020
|
+
s(m), o("ALL"), d(""), p(null);
|
|
421
1021
|
};
|
|
422
|
-
return /* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
"
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
] }),
|
|
428
|
-
/* @__PURE__ */ r("label", { children: [
|
|
429
|
-
"Description",
|
|
430
|
-
/* @__PURE__ */ e("input", { className: "input", value: i, onChange: (l) => m(l.target.value) })
|
|
1022
|
+
return /* @__PURE__ */ t("div", { className: "lg-root", children: /* @__PURE__ */ i("div", { className: "app", children: [
|
|
1023
|
+
/* @__PURE__ */ i("div", { className: "top", children: [
|
|
1024
|
+
/* @__PURE__ */ i("div", { className: "brand", children: [
|
|
1025
|
+
"pulse",
|
|
1026
|
+
/* @__PURE__ */ t("span", { children: ".logs" })
|
|
431
1027
|
] }),
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
"Target responses",
|
|
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)) })
|
|
435
|
-
] })
|
|
436
|
-
] }),
|
|
437
|
-
/* @__PURE__ */ r("h3", { children: [
|
|
438
|
-
"Questions (",
|
|
439
|
-
w.length,
|
|
440
|
-
")"
|
|
1028
|
+
/* @__PURE__ */ t("button", { className: "btn", onClick: $, children: "▶ Start tutorial" })
|
|
441
1029
|
] }),
|
|
442
|
-
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
445
|
-
"
|
|
446
|
-
|
|
447
|
-
] }),
|
|
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 }) }),
|
|
451
|
-
" required"
|
|
1030
|
+
/* @__PURE__ */ i("div", { className: "viewer", children: [
|
|
1031
|
+
/* @__PURE__ */ i("div", { className: "titlebar", "data-tour": "titlebar", children: [
|
|
1032
|
+
/* @__PURE__ */ i("div", { children: [
|
|
1033
|
+
/* @__PURE__ */ t("h1", { children: "Log Viewer" }),
|
|
1034
|
+
/* @__PURE__ */ t("small", { children: "Inspect application errors, warnings and debug output" })
|
|
452
1035
|
] }),
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
|
|
1036
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
1037
|
+
/* @__PURE__ */ t(
|
|
1038
|
+
"button",
|
|
1039
|
+
{
|
|
1040
|
+
className: "btn ghost",
|
|
1041
|
+
onClick: () => {
|
|
1042
|
+
zt(), p(null);
|
|
1043
|
+
},
|
|
1044
|
+
children: "Clear"
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
/* @__PURE__ */ i("span", { className: "badge live", children: [
|
|
1048
|
+
/* @__PURE__ */ t("i", { className: "dot" }),
|
|
1049
|
+
"LIVE"
|
|
1050
|
+
] })
|
|
1051
|
+
] })
|
|
455
1052
|
] }),
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
1053
|
+
/* @__PURE__ */ i("div", { className: "layout", children: [
|
|
1054
|
+
/* @__PURE__ */ i("aside", { className: "files", "data-tour": "files", children: [
|
|
1055
|
+
/* @__PURE__ */ t("h3", { children: "Log files" }),
|
|
1056
|
+
N.map((m) => /* @__PURE__ */ i(
|
|
1057
|
+
"button",
|
|
1058
|
+
{
|
|
1059
|
+
className: `file mono ${n === m.key ? "on" : ""}`,
|
|
1060
|
+
onClick: () => T(m.key),
|
|
1061
|
+
children: [
|
|
1062
|
+
/* @__PURE__ */ t("span", { children: "📄" }),
|
|
1063
|
+
m.name,
|
|
1064
|
+
/* @__PURE__ */ t("span", { className: "n", children: m.lines.length })
|
|
1065
|
+
]
|
|
1066
|
+
},
|
|
1067
|
+
m.key
|
|
1068
|
+
))
|
|
1069
|
+
] }),
|
|
1070
|
+
/* @__PURE__ */ i("section", { className: "main", children: [
|
|
1071
|
+
/* @__PURE__ */ t(sn, {}),
|
|
1072
|
+
/* @__PURE__ */ i("div", { className: "summary", "data-tour": "summary", children: [
|
|
1073
|
+
/* @__PURE__ */ i("div", { className: "stat e", children: [
|
|
1074
|
+
/* @__PURE__ */ t("b", { children: w("ERROR") }),
|
|
1075
|
+
/* @__PURE__ */ t("span", { children: "Errors" })
|
|
1076
|
+
] }),
|
|
1077
|
+
/* @__PURE__ */ i("div", { className: "stat w", children: [
|
|
1078
|
+
/* @__PURE__ */ t("b", { children: w("WARN") }),
|
|
1079
|
+
/* @__PURE__ */ t("span", { children: "Warnings" })
|
|
1080
|
+
] }),
|
|
1081
|
+
/* @__PURE__ */ i("div", { className: "stat", children: [
|
|
1082
|
+
/* @__PURE__ */ t("b", { children: E.length }),
|
|
1083
|
+
/* @__PURE__ */ t("span", { children: "Total lines" })
|
|
1084
|
+
] })
|
|
1085
|
+
] }),
|
|
1086
|
+
/* @__PURE__ */ i("div", { className: "filters", "data-tour": "filters", children: [
|
|
1087
|
+
Ft.map((m) => /* @__PURE__ */ i(
|
|
1088
|
+
"button",
|
|
1089
|
+
{
|
|
1090
|
+
className: `chip tag ${m} ${a === m ? "on" : ""}`,
|
|
1091
|
+
onClick: () => {
|
|
1092
|
+
o(m), p(null);
|
|
1093
|
+
},
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ t("i", { className: "dot" }),
|
|
1096
|
+
m === "ALL" ? "All" : m[0] + m.slice(1).toLowerCase(),
|
|
1097
|
+
/* @__PURE__ */ t("em", { className: "cnt", children: m === "ALL" ? E.length : w(m) })
|
|
1098
|
+
]
|
|
1099
|
+
},
|
|
1100
|
+
m
|
|
1101
|
+
)),
|
|
1102
|
+
/* @__PURE__ */ t(
|
|
1103
|
+
"input",
|
|
1104
|
+
{
|
|
1105
|
+
className: "search",
|
|
1106
|
+
placeholder: "Search logs…",
|
|
1107
|
+
value: c,
|
|
1108
|
+
onChange: (m) => d(m.target.value),
|
|
1109
|
+
"aria-label": "Search logs"
|
|
1110
|
+
}
|
|
1111
|
+
)
|
|
1112
|
+
] }),
|
|
1113
|
+
/* @__PURE__ */ i("div", { className: "logpane mono", "data-tour": "logpane", children: [
|
|
1114
|
+
/* @__PURE__ */ i("div", { className: "head", children: [
|
|
1115
|
+
M.name,
|
|
1116
|
+
" · ",
|
|
1117
|
+
I.length,
|
|
1118
|
+
" line",
|
|
1119
|
+
I.length !== 1 && "s"
|
|
1120
|
+
] }),
|
|
1121
|
+
I.length === 0 && /* @__PURE__ */ t("div", { className: "empty", children: E.length === 0 ? "No console output captured yet. New console.log, warn, error and debug calls appear here live." : "No lines match this filter." }),
|
|
1122
|
+
I.map((m) => /* @__PURE__ */ i(
|
|
1123
|
+
"button",
|
|
1124
|
+
{
|
|
1125
|
+
className: `line ${(b == null ? void 0 : b.id) === m.id ? "sel" : ""}`,
|
|
1126
|
+
onClick: () => p(m.id),
|
|
1127
|
+
children: [
|
|
1128
|
+
/* @__PURE__ */ t("span", { className: "ln", children: m.i + 1 }),
|
|
1129
|
+
/* @__PURE__ */ t("span", { className: "ts", title: new Date(m.at).toISOString(), children: m.t }),
|
|
1130
|
+
/* @__PURE__ */ t("span", { className: `lvl ${m.l}`, children: m.l }),
|
|
1131
|
+
/* @__PURE__ */ t("span", { className: "msg", "data-lvl": m.l, children: m.m })
|
|
1132
|
+
]
|
|
1133
|
+
},
|
|
1134
|
+
m.id
|
|
1135
|
+
))
|
|
1136
|
+
] })
|
|
1137
|
+
] }),
|
|
1138
|
+
/* @__PURE__ */ i("aside", { className: "details", "data-tour": "details", children: [
|
|
1139
|
+
/* @__PURE__ */ t("h3", { children: "Details" }),
|
|
1140
|
+
!b && /* @__PURE__ */ t("div", { className: "placeholder", children: "Select a log line to see what it means and how to fix it." }),
|
|
1141
|
+
b && /* @__PURE__ */ i(B, { children: [
|
|
1142
|
+
/* @__PURE__ */ i("div", { className: "box", children: [
|
|
1143
|
+
/* @__PURE__ */ t("b", { children: "Message" }),
|
|
1144
|
+
/* @__PURE__ */ t(
|
|
1145
|
+
"span",
|
|
1146
|
+
{
|
|
1147
|
+
className: `lvl ${b.l}`,
|
|
1148
|
+
style: { marginRight: 6 },
|
|
1149
|
+
children: b.l
|
|
1150
|
+
}
|
|
1151
|
+
),
|
|
1152
|
+
b.m
|
|
1153
|
+
] }),
|
|
1154
|
+
/* @__PURE__ */ i("div", { className: "box", children: [
|
|
1155
|
+
/* @__PURE__ */ t("b", { children: "What it means" }),
|
|
1156
|
+
Ue[b.l].meaning
|
|
1157
|
+
] }),
|
|
1158
|
+
/* @__PURE__ */ i("div", { className: "box", children: [
|
|
1159
|
+
/* @__PURE__ */ t("b", { children: "Suggested fix" }),
|
|
1160
|
+
Ue[b.l].fix
|
|
1161
|
+
] }),
|
|
1162
|
+
b.stack && /* @__PURE__ */ i("div", { className: "box", children: [
|
|
1163
|
+
/* @__PURE__ */ t("b", { children: "Stack trace" }),
|
|
1164
|
+
/* @__PURE__ */ t("pre", { className: "mono", children: b.stack })
|
|
1165
|
+
] })
|
|
1166
|
+
] })
|
|
1167
|
+
] })
|
|
460
1168
|
] })
|
|
461
|
-
] }
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
1169
|
+
] }),
|
|
1170
|
+
h && /* @__PURE__ */ t(
|
|
1171
|
+
an,
|
|
1172
|
+
{
|
|
1173
|
+
step: u,
|
|
1174
|
+
total: Ne.length,
|
|
1175
|
+
onNext: L,
|
|
1176
|
+
onBack: k,
|
|
1177
|
+
onClose: S
|
|
1178
|
+
}
|
|
1179
|
+
)
|
|
1180
|
+
] }) });
|
|
1181
|
+
}, gt = Le("heatmap"), fe = 20, ee = 10, rn = 250, ln = 5e3, cn = 3e3, qe = "pulseLogs.heatmap.v1", dn = (e) => ({
|
|
1182
|
+
path: e,
|
|
1183
|
+
visits: 0,
|
|
1184
|
+
activeMs: 0,
|
|
1185
|
+
docW: 0,
|
|
1186
|
+
docH: 0,
|
|
1187
|
+
maxScrollPct: 0,
|
|
1188
|
+
cells: {},
|
|
1189
|
+
clicks: {},
|
|
1190
|
+
clickCount: 0,
|
|
1191
|
+
bands: Array(ee).fill(0),
|
|
1192
|
+
bandReach: Array(ee).fill(0),
|
|
1193
|
+
elements: {},
|
|
1194
|
+
updatedAt: Date.now()
|
|
1195
|
+
});
|
|
1196
|
+
let Y = (() => {
|
|
1197
|
+
try {
|
|
1198
|
+
return JSON.parse(localStorage.getItem(qe) || "{}");
|
|
1199
|
+
} catch {
|
|
1200
|
+
return {};
|
|
1201
|
+
}
|
|
1202
|
+
})(), Ye = Y;
|
|
1203
|
+
const xe = /* @__PURE__ */ new Set();
|
|
1204
|
+
let Oe = null, We = null;
|
|
1205
|
+
const ft = () => {
|
|
1206
|
+
Oe || (Oe = setTimeout(() => {
|
|
1207
|
+
Oe = null, Ye = { ...Y }, xe.forEach((e) => e());
|
|
1208
|
+
}, 1e3));
|
|
1209
|
+
}, st = (e, n) => {
|
|
1210
|
+
const s = Object.keys(e);
|
|
1211
|
+
s.length <= n || s.sort((a, o) => e[a] - e[o]).slice(0, s.length - Math.floor(n / 2)).forEach((a) => delete e[a]);
|
|
1212
|
+
}, wt = () => {
|
|
1213
|
+
We = null, Object.values(Y).forEach((e) => {
|
|
1214
|
+
st(e.cells, 6e3), st(e.clicks, 3e3);
|
|
1215
|
+
const n = Object.entries(e.elements);
|
|
1216
|
+
n.length > 200 && (e.elements = Object.fromEntries(n.sort((s, a) => a[1].ms - s[1].ms).slice(0, 100)));
|
|
1217
|
+
});
|
|
1218
|
+
try {
|
|
1219
|
+
localStorage.setItem(qe, JSON.stringify(Y));
|
|
1220
|
+
} catch {
|
|
1221
|
+
}
|
|
1222
|
+
}, vt = () => {
|
|
1223
|
+
We || (We = setTimeout(wt, 2e3));
|
|
1224
|
+
}, at = () => Ye, hn = () => {
|
|
1225
|
+
Y = {}, Ye = {}, z = null;
|
|
1226
|
+
try {
|
|
1227
|
+
localStorage.removeItem(qe);
|
|
1228
|
+
} catch {
|
|
1229
|
+
}
|
|
1230
|
+
xe.forEach((e) => e());
|
|
1231
|
+
}, un = () => Me((e) => (xe.add(e), () => {
|
|
1232
|
+
xe.delete(e);
|
|
1233
|
+
}), at, at), mn = (e, n = 40) => e.length > n ? e.slice(0, n) + "…" : e, pn = (e) => {
|
|
1234
|
+
const n = e.closest('button, a, [role="button"], input, select, textarea, h1, h2, h3, h4, [data-track]') || e, s = [];
|
|
1235
|
+
let a = n, o = 0;
|
|
1236
|
+
for (; a && a.tagName.toLowerCase() !== "body" && o < 3; ) {
|
|
1237
|
+
let r = a.tagName.toLowerCase();
|
|
1238
|
+
const p = a.getAttribute("data-testid");
|
|
1239
|
+
if (p) {
|
|
1240
|
+
s.unshift(`${r}[data-testid="${p}"]`);
|
|
1241
|
+
break;
|
|
1242
|
+
}
|
|
1243
|
+
if (a.id) {
|
|
1244
|
+
s.unshift(`${r}#${a.id}`);
|
|
1245
|
+
break;
|
|
1246
|
+
}
|
|
1247
|
+
const l = typeof a.className == "string" ? a.className.trim().split(/\s+/).filter(Boolean).slice(0, 2).join(".") : "";
|
|
1248
|
+
s.unshift(l ? `${r}.${l}` : r), a = a.parentElement, o++;
|
|
1249
|
+
}
|
|
1250
|
+
const c = n.tagName.toLowerCase(), d = ["input", "textarea", "select"].includes(c) ? n.getAttribute("aria-label") || n.getAttribute("name") || n.getAttribute("placeholder") || "" : n.getAttribute("aria-label") || n.innerText || "";
|
|
1251
|
+
return { key: s.join(" > ") || c, text: mn(d.trim().replace(/\s+/g, " ")) };
|
|
1252
|
+
}, _e = (e) => !e || !!e.closest("[data-heatmap-ignore]");
|
|
1253
|
+
let z = null, bt = Date.now(), Z = null, Ee = Date.now(), yt = !1;
|
|
1254
|
+
const ot = (e) => {
|
|
1255
|
+
yt = e, Ee = Date.now();
|
|
1256
|
+
}, Nt = (e) => {
|
|
1257
|
+
const n = Object.entries(e.elements).sort((a, o) => o[1].ms - a[1].ms)[0], s = e.bands.indexOf(Math.max(...e.bands));
|
|
1258
|
+
gt.info(`${e.path}: active ${Math.round(e.activeMs / 1e3)}s, max scroll ${Math.round(e.maxScrollPct)}%, most time on page section ${s * 10}-${s * 10 + 10}%${n ? `, most hovered "${n[1].text || n[0]}" ${Math.round(n[1].ms / 1e3)}s` : ""}, clicks ${e.clickCount}`);
|
|
1259
|
+
}, kt = (e) => (Y[e] || (Y[e] = dn(e)), (!z || z.path !== e) && (z && Y[z.path] && Nt(Y[z.path]), z = { path: e, reached: /* @__PURE__ */ new Set() }, Y[e].visits += 1), Y[e]), gn = () => {
|
|
1260
|
+
const e = Date.now(), n = Math.min(e - Ee, 500);
|
|
1261
|
+
if (Ee = e, yt || document.visibilityState !== "visible" || e - bt > ln) return;
|
|
1262
|
+
const s = kt(window.location.pathname);
|
|
1263
|
+
s.activeMs += n, s.updatedAt = e;
|
|
1264
|
+
const a = document.documentElement.scrollWidth, o = Math.max(document.documentElement.scrollHeight, window.innerHeight);
|
|
1265
|
+
s.docW = Math.max(s.docW, a), s.docH = o;
|
|
1266
|
+
const c = window.scrollY, d = window.innerHeight, r = Math.min(ee - 1, Math.floor((c + d / 2) / o * ee));
|
|
1267
|
+
s.bands[r] += n;
|
|
1268
|
+
const p = Math.min(100, (c + d) / o * 100);
|
|
1269
|
+
s.maxScrollPct = Math.max(s.maxScrollPct, p);
|
|
1270
|
+
const l = Math.min(ee - 1, Math.floor((c + d) / o * ee - 1e-4));
|
|
1271
|
+
for (let h = 0; h <= l; h++) z.reached.has(h) || (z.reached.add(h), s.bandReach[h] += 1);
|
|
1272
|
+
if (Z && e - Z.at < cn) {
|
|
1273
|
+
const h = document.elementFromPoint(Z.x, Z.y);
|
|
1274
|
+
if (h && !_e(h)) {
|
|
1275
|
+
const g = `${Math.floor((Z.x + window.scrollX) / fe)},${Math.floor((Z.y + window.scrollY) / fe)}`;
|
|
1276
|
+
s.cells[g] = (s.cells[g] || 0) + n;
|
|
1277
|
+
const u = pn(h), f = s.elements[u.key] || (s.elements[u.key] = { ms: 0, text: u.text });
|
|
1278
|
+
f.ms += n, u.text && (f.text = u.text);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
ft(), vt();
|
|
1282
|
+
};
|
|
1283
|
+
function St() {
|
|
1284
|
+
if (typeof window > "u" || window.__pulseHeatmap) return;
|
|
1285
|
+
window.__pulseHeatmap = !0;
|
|
1286
|
+
const e = () => {
|
|
1287
|
+
bt = Date.now();
|
|
474
1288
|
};
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
]
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
1289
|
+
window.addEventListener("mousemove", (s) => {
|
|
1290
|
+
_e(s.target) || (Z = { x: s.clientX, y: s.clientY, at: Date.now() }, e());
|
|
1291
|
+
}, { passive: !0 }), document.addEventListener("mouseleave", () => {
|
|
1292
|
+
Z = null;
|
|
1293
|
+
}), window.addEventListener("scroll", e, { passive: !0, capture: !0 }), window.addEventListener("keydown", e), window.addEventListener("touchstart", e, { passive: !0 }), document.addEventListener("click", (s) => {
|
|
1294
|
+
e();
|
|
1295
|
+
const a = s.target;
|
|
1296
|
+
if (!a || !(a instanceof Element) || _e(a)) return;
|
|
1297
|
+
const o = kt(window.location.pathname), c = `${Math.floor((s.clientX + window.scrollX) / fe)},${Math.floor((s.clientY + window.scrollY) / fe)}`;
|
|
1298
|
+
o.clicks[c] = (o.clicks[c] || 0) + 1, o.clickCount += 1, ft(), vt();
|
|
1299
|
+
}, !0);
|
|
1300
|
+
const n = () => {
|
|
1301
|
+
z && Y[z.path] && Nt(Y[z.path]), wt();
|
|
1302
|
+
};
|
|
1303
|
+
window.addEventListener("pagehide", n), document.addEventListener("visibilitychange", () => {
|
|
1304
|
+
document.visibilityState === "hidden" ? n() : Ee = Date.now();
|
|
1305
|
+
}), setInterval(gn, rn), gt.info("Heatmap capture started (mouse, clicks, scroll, time per section)");
|
|
1306
|
+
}
|
|
1307
|
+
const ae = fe * 2;
|
|
1308
|
+
function xt(e, n) {
|
|
1309
|
+
const s = n === "time" ? e.cells : e.clicks, a = /* @__PURE__ */ new Map();
|
|
1310
|
+
for (const [d, r] of Object.entries(s)) {
|
|
1311
|
+
const [p, l] = d.split(",").map(Number), h = `${Math.floor(p / 2)},${Math.floor(l / 2)}`;
|
|
1312
|
+
a.set(h, (a.get(h) || 0) + r);
|
|
1313
|
+
}
|
|
1314
|
+
let o = 0;
|
|
1315
|
+
a.forEach((d) => {
|
|
1316
|
+
d > o && (o = d);
|
|
1317
|
+
});
|
|
1318
|
+
const c = [...a.entries()].sort((d, r) => r[1] - d[1]).slice(0, 3).map(([d, r]) => {
|
|
1319
|
+
const [p, l] = d.split(",").map(Number);
|
|
1320
|
+
return { x: p * ae, y: l * ae, v: r };
|
|
1321
|
+
});
|
|
1322
|
+
return { tiles: a, max: o, top: c };
|
|
1323
|
+
}
|
|
1324
|
+
const se = [[0, [40, 90, 255]], [0.33, [0, 200, 150]], [0.66, [255, 220, 0]], [1, [255, 50, 40]]], fn = (e) => {
|
|
1325
|
+
for (let n = 1; n < se.length; n++)
|
|
1326
|
+
if (e <= se[n][0]) {
|
|
1327
|
+
const [s, a] = se[n - 1], [o, c] = se[n], d = (e - s) / (o - s);
|
|
1328
|
+
return [0, 1, 2].map((r) => Math.round(a[r] + (c[r] - a[r]) * d));
|
|
1329
|
+
}
|
|
1330
|
+
return se[se.length - 1][1];
|
|
1331
|
+
}, wn = `linear-gradient(90deg, ${se.map(([e, n]) => `rgb(${n.join(",")}) ${e * 100}%`).join(", ")})`;
|
|
1332
|
+
function vn(e, n, s, a) {
|
|
1333
|
+
const o = Math.max(1, Math.round(n.docW * a)), c = Math.max(1, Math.round(n.docH * a));
|
|
1334
|
+
e.width = o, e.height = c;
|
|
1335
|
+
const d = e.getContext("2d");
|
|
1336
|
+
if (!d) return;
|
|
1337
|
+
d.clearRect(0, 0, o, c);
|
|
1338
|
+
const { tiles: r, max: p, top: l } = xt(n, s);
|
|
1339
|
+
if (!r.size) return;
|
|
1340
|
+
const h = ae * a;
|
|
1341
|
+
r.forEach((g, u) => {
|
|
1342
|
+
const [f, v] = u.split(",").map(Number), _ = Math.min(1, Math.sqrt(g / p)), [N, M, E] = fn(_);
|
|
1343
|
+
d.fillStyle = `rgba(${N},${M},${E},${0.3 + 0.65 * _})`, d.fillRect(f * h + 0.5, v * h + 0.5, h - 1, h - 1);
|
|
1344
|
+
}), l.forEach((g, u) => {
|
|
1345
|
+
const f = (g.x + ae / 2) * a, v = (g.y + ae / 2) * a;
|
|
1346
|
+
d.beginPath(), d.arc(f, v, 11, 0, Math.PI * 2), d.fillStyle = "#fff", d.fill(), d.lineWidth = 2, d.strokeStyle = "#0d0d12", d.stroke(), d.fillStyle = "#0d0d12", d.font = "bold 12px sans-serif", d.textAlign = "center", d.textBaseline = "middle", d.fillText(String(u + 1), f, v + 0.5);
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
const he = (e) => {
|
|
1350
|
+
if (e > 0 && e < 1e4) return `${(e / 1e3).toFixed(1)}s`;
|
|
1351
|
+
const n = Math.round(e / 1e3);
|
|
1352
|
+
return n >= 60 ? `${Math.floor(n / 60)}m ${n % 60}s` : `${n}s`;
|
|
1353
|
+
}, bn = (e) => `${e * 100 / ee}-${(e + 1) * 100 / ee}%`, yn = () => {
|
|
1354
|
+
P(() => (St(), ot(!0), () => ot(!1)), []);
|
|
1355
|
+
const e = un(), n = te(() => Object.keys(e).sort((u, f) => e[f].activeMs - e[u].activeMs), [e]), [s, a] = x(""), [o, c] = x("time"), d = q(null), r = e[s] ?? e[n[0]];
|
|
1356
|
+
P(() => {
|
|
1357
|
+
!r || !d.current || !r.docW || vn(d.current, r, o, Math.min(1, 820 / r.docW));
|
|
1358
|
+
}, [r, o]);
|
|
1359
|
+
const p = te(() => r ? Object.entries(r.elements).sort((u, f) => f[1].ms - u[1].ms) : [], [r]), l = te(() => r ? xt(r, o) : null, [r, o]), h = r ? r.bands.indexOf(Math.max(...r.bands)) : 0, g = (u) => o === "time" ? he(u) : `${u} click${u === 1 ? "" : "s"}`;
|
|
1360
|
+
return /* @__PURE__ */ t("div", { className: "lg-root hm-root", "data-heatmap-ignore": !0, children: /* @__PURE__ */ i("div", { className: "app", children: [
|
|
1361
|
+
/* @__PURE__ */ t("div", { className: "top", children: /* @__PURE__ */ i("div", { className: "brand", children: [
|
|
1362
|
+
"pulse",
|
|
1363
|
+
/* @__PURE__ */ t("span", { children: ".heatmap" })
|
|
1364
|
+
] }) }),
|
|
1365
|
+
/* @__PURE__ */ i("div", { className: "viewer", children: [
|
|
1366
|
+
/* @__PURE__ */ i("div", { className: "titlebar", children: [
|
|
1367
|
+
/* @__PURE__ */ i("div", { children: [
|
|
1368
|
+
/* @__PURE__ */ t("h1", { children: "Heatmap" }),
|
|
1369
|
+
/* @__PURE__ */ t("small", { children: "See where visitors spend time and click" })
|
|
1370
|
+
] }),
|
|
1371
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
|
|
1372
|
+
/* @__PURE__ */ t("button", { className: "btn ghost", onClick: () => {
|
|
1373
|
+
hn(), a("");
|
|
1374
|
+
}, children: "Clear" }),
|
|
1375
|
+
/* @__PURE__ */ i("span", { className: "badge live", children: [
|
|
1376
|
+
/* @__PURE__ */ t("i", { className: "dot" }),
|
|
1377
|
+
"LIVE"
|
|
1378
|
+
] })
|
|
1379
|
+
] })
|
|
507
1380
|
] }),
|
|
508
|
-
children: [
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
-
|
|
1381
|
+
/* @__PURE__ */ i("div", { className: "layout", children: [
|
|
1382
|
+
/* @__PURE__ */ i("aside", { className: "files", children: [
|
|
1383
|
+
/* @__PURE__ */ t("h3", { children: "Pages" }),
|
|
1384
|
+
n.length === 0 && /* @__PURE__ */ t("div", { className: "placeholder", children: "No pages recorded yet." }),
|
|
1385
|
+
n.map((u) => /* @__PURE__ */ i("button", { className: `file mono ${(r == null ? void 0 : r.path) === u ? "on" : ""}`, onClick: () => a(u), title: u, children: [
|
|
1386
|
+
/* @__PURE__ */ t("span", { children: "📄" }),
|
|
1387
|
+
/* @__PURE__ */ t("span", { className: "hm-fname", children: u }),
|
|
1388
|
+
/* @__PURE__ */ t("span", { className: "n", children: he(e[u].activeMs) })
|
|
1389
|
+
] }, u))
|
|
514
1390
|
] }),
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
1391
|
+
/* @__PURE__ */ t("section", { className: "main", children: r ? /* @__PURE__ */ i(B, { children: [
|
|
1392
|
+
/* @__PURE__ */ i("div", { className: "summary", children: [
|
|
1393
|
+
/* @__PURE__ */ i("div", { className: "stat", children: [
|
|
1394
|
+
/* @__PURE__ */ t("b", { children: he(r.activeMs) }),
|
|
1395
|
+
/* @__PURE__ */ t("span", { children: "Active time" })
|
|
1396
|
+
] }),
|
|
1397
|
+
/* @__PURE__ */ i("div", { className: "stat", children: [
|
|
1398
|
+
/* @__PURE__ */ i("b", { children: [
|
|
1399
|
+
Math.round(r.maxScrollPct),
|
|
1400
|
+
"%"
|
|
1401
|
+
] }),
|
|
1402
|
+
/* @__PURE__ */ t("span", { children: "Max scroll depth" })
|
|
1403
|
+
] }),
|
|
1404
|
+
/* @__PURE__ */ i("div", { className: "stat", children: [
|
|
1405
|
+
/* @__PURE__ */ t("b", { children: r.clickCount }),
|
|
1406
|
+
/* @__PURE__ */ t("span", { children: "Clicks" })
|
|
1407
|
+
] }),
|
|
1408
|
+
/* @__PURE__ */ i("div", { className: "stat", children: [
|
|
1409
|
+
/* @__PURE__ */ t("b", { children: r.visits }),
|
|
1410
|
+
/* @__PURE__ */ t("span", { children: "Visits" })
|
|
1411
|
+
] })
|
|
1412
|
+
] }),
|
|
1413
|
+
/* @__PURE__ */ i("div", { className: "filters", children: [
|
|
1414
|
+
/* @__PURE__ */ i("button", { className: `chip tag ${o === "time" ? "on" : ""}`, onClick: () => c("time"), children: [
|
|
1415
|
+
/* @__PURE__ */ t("i", { className: "dot" }),
|
|
1416
|
+
"Mouse time"
|
|
1417
|
+
] }),
|
|
1418
|
+
/* @__PURE__ */ i("button", { className: `chip tag ${o === "clicks" ? "on" : ""}`, onClick: () => c("clicks"), children: [
|
|
1419
|
+
/* @__PURE__ */ t("i", { className: "dot" }),
|
|
1420
|
+
"Clicks"
|
|
1421
|
+
] })
|
|
1422
|
+
] }),
|
|
1423
|
+
/* @__PURE__ */ i("div", { className: "hm-pane", children: [
|
|
1424
|
+
/* @__PURE__ */ i("div", { className: "head mono", children: [
|
|
1425
|
+
r.path,
|
|
1426
|
+
" · ",
|
|
1427
|
+
o === "time" ? "mouse time" : "clicks"
|
|
1428
|
+
] }),
|
|
1429
|
+
/* @__PURE__ */ i("div", { className: "hm-body", children: [
|
|
1430
|
+
l && l.tiles.size === 0 ? /* @__PURE__ */ t("div", { className: "hm-note", children: o === "time" ? "No mouse movement recorded on this page yet." : "No clicks recorded on this page yet." }) : /* @__PURE__ */ t("div", { className: "hm-canvas", children: /* @__PURE__ */ t("canvas", { ref: d }) }),
|
|
1431
|
+
/* @__PURE__ */ i("div", { className: "hm-legend", children: [
|
|
1432
|
+
/* @__PURE__ */ t("span", { children: "Low" }),
|
|
1433
|
+
/* @__PURE__ */ t("i", { style: { background: wn } }),
|
|
1434
|
+
/* @__PURE__ */ i("span", { children: [
|
|
1435
|
+
"High",
|
|
1436
|
+
l && l.max ? ` (${g(l.max)})` : ""
|
|
1437
|
+
] })
|
|
1438
|
+
] }),
|
|
1439
|
+
/* @__PURE__ */ i("small", { className: "hm-muted", children: [
|
|
1440
|
+
"Each square is ",
|
|
1441
|
+
ae,
|
|
1442
|
+
"×",
|
|
1443
|
+
ae,
|
|
1444
|
+
"px of the page (",
|
|
1445
|
+
r.docW,
|
|
1446
|
+
"×",
|
|
1447
|
+
r.docH,
|
|
1448
|
+
"px). Numbers 1-3 mark the strongest spots."
|
|
1449
|
+
] })
|
|
1450
|
+
] })
|
|
1451
|
+
] })
|
|
1452
|
+
] }) : /* @__PURE__ */ t("div", { className: "empty", children: "No data yet. Move the mouse, scroll and click on the other tabs; time is recorded while the tab is active. Recording is paused while this tab is open." }) }),
|
|
1453
|
+
/* @__PURE__ */ i("aside", { className: "details", children: [
|
|
1454
|
+
/* @__PURE__ */ t("h3", { children: "Details" }),
|
|
1455
|
+
!r && /* @__PURE__ */ t("div", { className: "placeholder", children: "Details appear here once a page has been recorded." }),
|
|
1456
|
+
r && l && /* @__PURE__ */ i(B, { children: [
|
|
1457
|
+
/* @__PURE__ */ i("div", { className: "box", children: [
|
|
1458
|
+
/* @__PURE__ */ t("b", { children: "Strongest spots on the map" }),
|
|
1459
|
+
l.top.length === 0 ? "No data yet" : l.top.map((u, f) => /* @__PURE__ */ i("div", { className: "hm-spot", children: [
|
|
1460
|
+
/* @__PURE__ */ t("span", { className: "hm-badge", children: f + 1 }),
|
|
1461
|
+
/* @__PURE__ */ i("span", { className: "mono", children: [
|
|
1462
|
+
"x ",
|
|
1463
|
+
u.x,
|
|
1464
|
+
", y ",
|
|
1465
|
+
u.y
|
|
1466
|
+
] }),
|
|
1467
|
+
/* @__PURE__ */ t("span", { children: g(u.v) })
|
|
1468
|
+
] }, f))
|
|
1469
|
+
] }),
|
|
1470
|
+
/* @__PURE__ */ i("div", { className: "box", children: [
|
|
1471
|
+
/* @__PURE__ */ t("b", { children: "Most time spent (scrolling)" }),
|
|
1472
|
+
r.activeMs ? `${bn(h)} of the page (${he(r.bands[h])})` : "No data yet"
|
|
1473
|
+
] }),
|
|
1474
|
+
/* @__PURE__ */ i("div", { className: "box", children: [
|
|
1475
|
+
/* @__PURE__ */ t("b", { children: "Most hovered element" }),
|
|
1476
|
+
p[0] ? `${p[0][1].text || p[0][0]} (${he(p[0][1].ms)})` : "No hover data yet"
|
|
1477
|
+
] }),
|
|
1478
|
+
/* @__PURE__ */ i("div", { className: "box", children: [
|
|
1479
|
+
/* @__PURE__ */ t("b", { children: "Deepest scroll" }),
|
|
1480
|
+
Math.round(r.maxScrollPct),
|
|
1481
|
+
"% of the page"
|
|
1482
|
+
] })
|
|
541
1483
|
] })
|
|
542
1484
|
] })
|
|
543
|
-
]
|
|
544
|
-
}
|
|
545
|
-
);
|
|
546
|
-
},
|
|
547
|
-
const [
|
|
548
|
-
return
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
1485
|
+
] })
|
|
1486
|
+
] })
|
|
1487
|
+
] }) });
|
|
1488
|
+
}, Nn = ({ items: e, value: n, onChange: s }) => /* @__PURE__ */ t("div", { className: "tabs", children: e.map((a) => /* @__PURE__ */ t("button", { type: "button", className: a.id === n ? "tab active" : "tab", onClick: () => s(a.id), children: a.label }, a.id)) }), Hn = () => {
|
|
1489
|
+
const [e, n] = x("logs");
|
|
1490
|
+
return P(() => {
|
|
1491
|
+
St();
|
|
1492
|
+
}, []), /* @__PURE__ */ i("div", { className: "shell", children: [
|
|
1493
|
+
/* @__PURE__ */ i("header", { className: "topbar", children: [
|
|
1494
|
+
/* @__PURE__ */ t("strong", { children: "POC" }),
|
|
1495
|
+
/* @__PURE__ */ t(Nn, { items: [{ id: "logs", label: "Logs" }, { id: "feedback", label: "Feedback" }, { id: "heatmap", label: "Heatmap" }, { id: "journey", label: "user journey" }], value: e, onChange: n })
|
|
552
1496
|
] }),
|
|
553
|
-
/* @__PURE__ */
|
|
1497
|
+
/* @__PURE__ */ t("main", { children: e === "logs" ? /* @__PURE__ */ t(on, {}) : e === "heatmap" ? /* @__PURE__ */ t(yn, {}) : /* @__PURE__ */ t(Pt, {}) })
|
|
554
1498
|
] });
|
|
555
|
-
},
|
|
1499
|
+
}, Q = (e, n) => {
|
|
556
1500
|
try {
|
|
557
|
-
return
|
|
1501
|
+
return e();
|
|
558
1502
|
} catch {
|
|
559
|
-
return
|
|
1503
|
+
return n;
|
|
560
1504
|
}
|
|
561
|
-
},
|
|
1505
|
+
}, Ae = (e) => Math.random().toString(36).slice(2, 2 + e), ue = () => location.pathname + location.hash, kn = ".sj, [data-sj-ignore]", Sn = () => ({
|
|
562
1506
|
pages: {},
|
|
563
1507
|
scrollMs: 0,
|
|
564
1508
|
clicks: 0,
|
|
@@ -571,45 +1515,45 @@ const He = ["nps", "rating", "multiple_choice", "open_text"], ye = (t) => new Da
|
|
|
571
1515
|
drops: {},
|
|
572
1516
|
log: []
|
|
573
1517
|
});
|
|
574
|
-
class
|
|
575
|
-
constructor(
|
|
576
|
-
this.getCfg =
|
|
577
|
-
this.subs.delete(
|
|
578
|
-
}), this.getVersion = () => this.version, this.uid =
|
|
1518
|
+
class xn {
|
|
1519
|
+
constructor(n) {
|
|
1520
|
+
this.getCfg = n, 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 = (s) => (this.subs.add(s), () => {
|
|
1521
|
+
this.subs.delete(s);
|
|
1522
|
+
}), this.getVersion = () => this.version, this.uid = Q(() => localStorage.getItem("sjU") || (localStorage.setItem("sjU", Ae(10)), localStorage.getItem("sjU")), "anon"), this.sid = Q(() => sessionStorage.getItem("sjS") || (sessionStorage.setItem("sjS", Ae(8)), sessionStorage.getItem("sjS")), Ae(8)), this.state = { ...Sn(), ...Q(() => JSON.parse(sessionStorage.getItem("sjState") || "null"), null) };
|
|
579
1523
|
}
|
|
580
1524
|
get cfg() {
|
|
581
1525
|
return { ...this.getCfg(), ...this.overrides };
|
|
582
1526
|
}
|
|
583
|
-
configure(
|
|
584
|
-
this.overrides = { ...this.overrides, ...
|
|
1527
|
+
configure(n) {
|
|
1528
|
+
this.overrides = { ...this.overrides, ...n };
|
|
585
1529
|
}
|
|
586
1530
|
emit() {
|
|
587
|
-
this.version++, this.subs.forEach((
|
|
1531
|
+
this.version++, this.subs.forEach((n) => n());
|
|
588
1532
|
}
|
|
589
|
-
onNavigate(
|
|
590
|
-
return this.navSubs.add(
|
|
591
|
-
this.navSubs.delete(
|
|
1533
|
+
onNavigate(n) {
|
|
1534
|
+
return this.navSubs.add(n), () => {
|
|
1535
|
+
this.navSubs.delete(n);
|
|
592
1536
|
};
|
|
593
1537
|
}
|
|
594
1538
|
/* ---- data ---- */
|
|
595
|
-
page(
|
|
596
|
-
return this.state.pages[
|
|
1539
|
+
page(n = ue()) {
|
|
1540
|
+
return this.state.pages[n] || (this.state.pages[n] = { ms: 0, scrollMs: 0, depth: 0, clicks: 0, views: 0, m: {} });
|
|
597
1541
|
}
|
|
598
1542
|
save() {
|
|
599
|
-
|
|
1543
|
+
Q(() => sessionStorage.setItem("sjState", JSON.stringify({ ...this.state, log: this.state.log.slice(0, 40) })), void 0);
|
|
600
1544
|
}
|
|
601
|
-
bin(
|
|
602
|
-
const
|
|
603
|
-
|
|
1545
|
+
bin(n, s, a) {
|
|
1546
|
+
const o = ue(), c = document.documentElement.scrollWidth || 1, d = this.state.heat[o] || (this.state.heat[o] = {}), r = Math.round(n / c * 100) + "," + (s / 20 | 0);
|
|
1547
|
+
d[r] = (d[r] || 0) + a;
|
|
604
1548
|
}
|
|
605
|
-
track(
|
|
606
|
-
const
|
|
607
|
-
this.q.push(
|
|
608
|
-
const
|
|
609
|
-
|
|
1549
|
+
track(n, s = {}) {
|
|
1550
|
+
const a = { sid: this.sid, uid: this.uid, type: n, t: Date.now(), page: ue(), ...s };
|
|
1551
|
+
this.q.push(a), this.state.log.unshift(a), this.state.log.length > 60 && this.state.log.pop();
|
|
1552
|
+
const o = this.cfg.onEvent;
|
|
1553
|
+
o && Q(() => o(a), void 0);
|
|
610
1554
|
}
|
|
611
|
-
payload(
|
|
612
|
-
const
|
|
1555
|
+
payload(n) {
|
|
1556
|
+
const s = this.state;
|
|
613
1557
|
return JSON.stringify({
|
|
614
1558
|
sessionId: this.sid,
|
|
615
1559
|
userId: this.uid,
|
|
@@ -617,207 +1561,207 @@ class ze {
|
|
|
617
1561
|
url: location.href,
|
|
618
1562
|
viewport: [innerWidth, innerHeight],
|
|
619
1563
|
doc: [document.documentElement.scrollWidth, document.documentElement.scrollHeight],
|
|
620
|
-
events:
|
|
1564
|
+
events: n,
|
|
621
1565
|
summary: {
|
|
622
|
-
pages:
|
|
623
|
-
scrollMs:
|
|
624
|
-
clicks:
|
|
625
|
-
nav:
|
|
626
|
-
tour: { started:
|
|
627
|
-
heat:
|
|
1566
|
+
pages: s.pages,
|
|
1567
|
+
scrollMs: s.scrollMs,
|
|
1568
|
+
clicks: s.clicks,
|
|
1569
|
+
nav: s.nav,
|
|
1570
|
+
tour: { started: s.started, completed: s.completed, skipped: s.skipped, drops: s.drops, steps: s.steps },
|
|
1571
|
+
heat: s.heat
|
|
628
1572
|
}
|
|
629
1573
|
});
|
|
630
1574
|
}
|
|
631
|
-
flush(
|
|
1575
|
+
flush(n = !1) {
|
|
632
1576
|
if (this.save(), !this.q.length) return;
|
|
633
|
-
const
|
|
1577
|
+
const s = this.q;
|
|
634
1578
|
this.q = [];
|
|
635
|
-
const
|
|
636
|
-
if (!
|
|
637
|
-
this.state.log.unshift({ type: "flush (dry-run)", t: Date.now(), n: `${
|
|
1579
|
+
const a = this.cfg;
|
|
1580
|
+
if (!a.endpoint) {
|
|
1581
|
+
this.state.log.unshift({ type: "flush (dry-run)", t: Date.now(), n: `${s.length} events` });
|
|
638
1582
|
return;
|
|
639
1583
|
}
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
if (!
|
|
1584
|
+
const o = this.payload(s);
|
|
1585
|
+
n && navigator.sendBeacon && navigator.sendBeacon(a.endpoint, new Blob([o], { type: "application/json" })) || fetch(a.endpoint, { method: "POST", body: o, keepalive: !0, headers: { "Content-Type": "application/json", ...a.headers || {} } }).then((c) => {
|
|
1586
|
+
if (!c.ok) throw new Error("bad status");
|
|
643
1587
|
}).catch(() => {
|
|
644
|
-
this.q =
|
|
1588
|
+
this.q = s.concat(this.q).slice(-500);
|
|
645
1589
|
});
|
|
646
1590
|
}
|
|
647
1591
|
/* ---- tour funnel ---- */
|
|
648
|
-
tourStart(
|
|
649
|
-
|
|
1592
|
+
tourStart(n, s) {
|
|
1593
|
+
s || this.state.started++, this.track(s ? "tour_resume" : "tour_start", { steps: n });
|
|
650
1594
|
}
|
|
651
|
-
stepView(
|
|
652
|
-
const
|
|
653
|
-
|
|
1595
|
+
stepView(n, s, a) {
|
|
1596
|
+
const o = this.state.steps[n] || (this.state.steps[n] = { views: 0, ms: 0, title: s });
|
|
1597
|
+
o.views++, this.activeStep = n, this.track("step_view", { step: n, title: s, total: a }), this.save();
|
|
654
1598
|
}
|
|
655
|
-
tourEnd(
|
|
656
|
-
|
|
1599
|
+
tourEnd(n, s, a, o) {
|
|
1600
|
+
n === "complete" ? (this.state.completed++, this.track("tour_complete", { steps: o })) : (this.state.skipped++, this.state.drops[s] = (this.state.drops[s] || 0) + 1, this.track("tour_skip", { step: s, title: a })), this.activeStep = null, Q(() => sessionStorage.removeItem("sjTour"), void 0), Q(() => localStorage.setItem("sjDone", n), void 0), this.flush();
|
|
657
1601
|
}
|
|
658
1602
|
/* ---- passive listeners; returns a cleanup function (safe under React StrictMode) ---- */
|
|
659
1603
|
attach() {
|
|
660
|
-
const
|
|
661
|
-
this.prev =
|
|
662
|
-
let
|
|
1604
|
+
const n = this.state;
|
|
1605
|
+
this.prev = ue();
|
|
1606
|
+
let s = performance.now();
|
|
663
1607
|
this.booted || (this.booted = !0, this.page().views++, this.track("session_start", { ua: navigator.userAgent.slice(0, 60), ref: document.referrer }));
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
},
|
|
667
|
-
const
|
|
668
|
-
if (
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
}, 250),
|
|
672
|
-
|
|
673
|
-
clearInterval(
|
|
674
|
-
}),
|
|
1608
|
+
const a = [], o = (l, h, g, u) => {
|
|
1609
|
+
l.addEventListener(h, g, u), a.push(() => l.removeEventListener(h, g, u));
|
|
1610
|
+
}, c = window.setInterval(() => {
|
|
1611
|
+
const l = performance.now(), h = l - s;
|
|
1612
|
+
if (s = l, document.hidden) return;
|
|
1613
|
+
const g = this.page();
|
|
1614
|
+
g.ms += h, this.scrolling && (g.scrollMs += h, n.scrollMs += h), this.activeStep !== null && n.steps[this.activeStep] && (n.steps[this.activeStep].ms += h);
|
|
1615
|
+
}, 250), d = window.setInterval(() => this.emit(), 500), r = window.setInterval(() => this.flush(), this.cfg.flushMs || 5e3);
|
|
1616
|
+
a.push(() => {
|
|
1617
|
+
clearInterval(c), clearInterval(d), clearInterval(r);
|
|
1618
|
+
}), o(window, "scroll", () => {
|
|
675
1619
|
this.scrolling = !0, clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
|
|
676
1620
|
this.scrolling = !1;
|
|
677
1621
|
}, 160);
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
1622
|
+
const l = this.page(), h = Math.min(100, Math.round((scrollY + innerHeight) / document.documentElement.scrollHeight * 100));
|
|
1623
|
+
h > l.depth && (l.depth = h, [25, 50, 75, 100].forEach((g) => {
|
|
1624
|
+
h >= g && !l.m[g] && (l.m[g] = 1, this.track("scroll_depth", { pct: g }));
|
|
681
1625
|
}));
|
|
682
|
-
}, { passive: !0 }),
|
|
683
|
-
const
|
|
684
|
-
|
|
685
|
-
}, { passive: !0 }),
|
|
686
|
-
const
|
|
687
|
-
if (!
|
|
688
|
-
|
|
689
|
-
const
|
|
690
|
-
this.track("click", { sel:
|
|
691
|
-
const u =
|
|
1626
|
+
}, { passive: !0 }), o(window, "mousemove", (l) => {
|
|
1627
|
+
const h = Date.now();
|
|
1628
|
+
h - this.lastMove > 120 && (this.lastMove = h, this.bin(l.pageX, l.pageY, 1));
|
|
1629
|
+
}, { passive: !0 }), o(document, "click", (l) => {
|
|
1630
|
+
const h = l.target;
|
|
1631
|
+
if (!h || !h.closest || h.closest(kn)) return;
|
|
1632
|
+
n.clicks++, this.page().clicks++, this.bin(l.pageX, l.pageY, 6);
|
|
1633
|
+
const g = h.id ? "#" + h.id : h.tagName.toLowerCase() + (typeof h.className == "string" && h.className ? "." + h.className.trim().split(/\s+/)[0] : "");
|
|
1634
|
+
this.track("click", { sel: g, x: l.pageX, y: l.pageY, text: (h.textContent || "").trim().slice(0, 30), step: this.activeStep });
|
|
1635
|
+
const u = h.closest("a[href]");
|
|
692
1636
|
u && !u.getAttribute("href").startsWith("#") && (this.track("navigate_out", { to: u.href }), this.flush(!0));
|
|
693
1637
|
}, !0);
|
|
694
|
-
const
|
|
695
|
-
const
|
|
696
|
-
|
|
1638
|
+
const p = () => {
|
|
1639
|
+
const l = ue();
|
|
1640
|
+
l !== this.prev && (n.nav++, this.track("navigate", { from: this.prev, to: l }), this.prev = l, this.page().views++, this.navSubs.forEach((h) => h()));
|
|
697
1641
|
};
|
|
698
|
-
return ["pushState", "replaceState"].forEach((
|
|
699
|
-
const
|
|
700
|
-
history[
|
|
701
|
-
const u =
|
|
702
|
-
return setTimeout(
|
|
703
|
-
},
|
|
704
|
-
history[
|
|
1642
|
+
return ["pushState", "replaceState"].forEach((l) => {
|
|
1643
|
+
const h = history[l];
|
|
1644
|
+
history[l] = function(...g) {
|
|
1645
|
+
const u = h.apply(this, g);
|
|
1646
|
+
return setTimeout(p), u;
|
|
1647
|
+
}, a.push(() => {
|
|
1648
|
+
history[l] = h;
|
|
705
1649
|
});
|
|
706
|
-
}),
|
|
1650
|
+
}), o(window, "popstate", p), o(window, "hashchange", p), o(document, "visibilitychange", () => {
|
|
707
1651
|
document.hidden && this.flush(!0);
|
|
708
|
-
}),
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
}), () =>
|
|
1652
|
+
}), o(window, "pagehide", () => {
|
|
1653
|
+
const l = this.activeStep;
|
|
1654
|
+
l !== null && (this.track("tour_abandon", { step: l }), n.drops[l] = (n.drops[l] || 0) + 1, Q(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: l, t: Date.now() })), void 0)), this.flush(!0);
|
|
1655
|
+
}), () => a.forEach((l) => l());
|
|
712
1656
|
}
|
|
713
1657
|
}
|
|
714
|
-
const
|
|
715
|
-
function
|
|
716
|
-
var
|
|
717
|
-
const
|
|
1658
|
+
const $e = (e) => !!e && e.isConnected && e.getClientRects().length > 0;
|
|
1659
|
+
function En(e) {
|
|
1660
|
+
var a;
|
|
1661
|
+
const n = e.dataset, s = (e.getAttribute("aria-label") || e.getAttribute("title") || e.textContent || "").trim().replace(/\s+/g, " ");
|
|
718
1662
|
return {
|
|
719
|
-
el:
|
|
720
|
-
title:
|
|
721
|
-
body:
|
|
722
|
-
placement:
|
|
1663
|
+
el: e,
|
|
1664
|
+
title: n.sjTitle || e.getAttribute("aria-label") || ((a = e.querySelector("h1,h2,h3")) == null ? void 0 : a.textContent) || s.slice(0, 28) || e.tagName.toLowerCase(),
|
|
1665
|
+
body: n.sjBody || s.slice(0, 140),
|
|
1666
|
+
placement: n.sjPlace || "auto"
|
|
723
1667
|
};
|
|
724
1668
|
}
|
|
725
|
-
function
|
|
726
|
-
const
|
|
727
|
-
let
|
|
728
|
-
if (
|
|
729
|
-
|
|
730
|
-
...
|
|
731
|
-
placement:
|
|
732
|
-
el:
|
|
733
|
-
wait: !!
|
|
1669
|
+
function $n(e) {
|
|
1670
|
+
const n = (a) => !a.page || a.page === location.pathname;
|
|
1671
|
+
let s;
|
|
1672
|
+
if (e.steps)
|
|
1673
|
+
s = e.steps.map((a) => ({
|
|
1674
|
+
...a,
|
|
1675
|
+
placement: a.placement ?? "auto",
|
|
1676
|
+
el: a.target && n(a) ? document.querySelector(a.target) : null,
|
|
1677
|
+
wait: !!a.target && n(a)
|
|
734
1678
|
}));
|
|
735
1679
|
else {
|
|
736
|
-
let
|
|
737
|
-
|
|
1680
|
+
let a = [...document.querySelectorAll("[data-sj-title],[data-sj-step]")];
|
|
1681
|
+
a.length || (a = [...document.querySelectorAll("header,nav,main>section,footer")].slice(0, 6)), s = a.filter($e).sort((o, c) => (+(o.dataset.sjStep || 0) || 99) - (+(c.dataset.sjStep || 0) || 99)).map(En);
|
|
738
1682
|
}
|
|
739
|
-
return
|
|
1683
|
+
return e.welcome && s.unshift({ ...e.welcome, el: null, placement: "auto", welcome: !0 }), e.outro && s.push({ ...e.outro, el: null, placement: "auto", outro: !0 }), s;
|
|
740
1684
|
}
|
|
741
|
-
const
|
|
742
|
-
const
|
|
743
|
-
const
|
|
744
|
-
if (!
|
|
745
|
-
const
|
|
746
|
-
let
|
|
747
|
-
if (
|
|
748
|
-
const
|
|
749
|
-
|
|
1685
|
+
const ve = (e, n, s) => Math.max(n, Math.min(s, e)), Mn = ({ open: e, anim: n, theme: s, steps: a, index: o, startLabel: c, tracker: d, onNext: r, onBack: p, onSkip: l, onTheme: h }) => {
|
|
1686
|
+
const g = q(null), u = q(null), f = q(0), [v, _] = x(null), N = a[o], M = H(() => {
|
|
1687
|
+
const L = g.current;
|
|
1688
|
+
if (!e || !N || !L) return;
|
|
1689
|
+
const k = innerWidth, S = innerHeight, $ = 12, T = 16;
|
|
1690
|
+
let m = { x: k / 2, y: S / 2, w: 0, h: 0 }, W = !0;
|
|
1691
|
+
if ($e(N.el)) {
|
|
1692
|
+
const A = N.el.getBoundingClientRect(), K = Math.max(A.left - 8, 0), j = Math.max(A.top - 8, 0);
|
|
1693
|
+
m = { x: K, y: j, w: Math.min(A.right + 8, k) - K, h: Math.min(A.bottom + 8, S) - j }, W = !1;
|
|
750
1694
|
}
|
|
751
|
-
const
|
|
752
|
-
let
|
|
753
|
-
if (!
|
|
754
|
-
const
|
|
755
|
-
top: { x:
|
|
756
|
-
bottom: { x:
|
|
757
|
-
left: { x:
|
|
758
|
-
right: { x:
|
|
759
|
-
},
|
|
760
|
-
|
|
1695
|
+
const D = L.offsetWidth, F = L.offsetHeight;
|
|
1696
|
+
let G = (k - D) / 2, J = (S - F) / 2, le = "c", y = 0, O = 0;
|
|
1697
|
+
if (!W) {
|
|
1698
|
+
const A = m.x + m.w / 2, K = m.y + m.h / 2, j = {
|
|
1699
|
+
top: { x: A - D / 2, y: m.y - F - T, ok: m.y - F - T >= $ },
|
|
1700
|
+
bottom: { x: A - D / 2, y: m.y + m.h + T, ok: m.y + m.h + T + F <= S - $ },
|
|
1701
|
+
left: { x: m.x - D - T, y: K - F / 2, ok: m.x - D - T >= $ },
|
|
1702
|
+
right: { x: m.x + m.w + T, y: K - F / 2, ok: m.x + m.w + T + D <= k - $ }
|
|
1703
|
+
}, ce = N.placement !== "auto" && N.placement in j ? N.placement : "bottom", $t = { top: "bottom", bottom: "top", left: "right", right: "left" }[ce], we = (N.placement === "auto" ? ["bottom", "top", "right", "left"] : [ce, $t, "bottom", "top", "right", "left"]).find((Mt) => j[Mt].ok);
|
|
1704
|
+
we ? (G = j[we].x, J = j[we].y, le = we) : (J = S - F - $, le = "in"), G = ve(G, $, k - D - $), J = ve(J, $, S - F - $), y = ve(A - G, 22, D - 22), O = ve(K - J, 22, F - 22);
|
|
761
1705
|
}
|
|
762
|
-
|
|
763
|
-
}, [
|
|
764
|
-
cancelAnimationFrame(
|
|
765
|
-
}, [
|
|
766
|
-
if (
|
|
767
|
-
if (!
|
|
768
|
-
|
|
769
|
-
const
|
|
1706
|
+
_({ hole: m, centered: W, x: Math.round(G), y: Math.round(J), side: le, ax: y, ay: O, vw: k, vh: S });
|
|
1707
|
+
}, [e, N]), E = H(() => {
|
|
1708
|
+
cancelAnimationFrame(f.current), f.current = requestAnimationFrame(M);
|
|
1709
|
+
}, [M]);
|
|
1710
|
+
if (it(() => {
|
|
1711
|
+
if (!e) return;
|
|
1712
|
+
M();
|
|
1713
|
+
const L = window.setTimeout(M, 380), k = window.setTimeout(M, 700);
|
|
770
1714
|
return () => {
|
|
771
|
-
clearTimeout(
|
|
1715
|
+
clearTimeout(L), clearTimeout(k);
|
|
772
1716
|
};
|
|
773
|
-
}, [
|
|
774
|
-
if (!
|
|
775
|
-
addEventListener("scroll",
|
|
776
|
-
const
|
|
1717
|
+
}, [e, o, M]), P(() => {
|
|
1718
|
+
if (!e) return;
|
|
1719
|
+
addEventListener("scroll", E, { passive: !0 }), addEventListener("resize", E);
|
|
1720
|
+
const L = d.onNavigate(E);
|
|
777
1721
|
return () => {
|
|
778
|
-
removeEventListener("scroll",
|
|
1722
|
+
removeEventListener("scroll", E), removeEventListener("resize", E), L(), cancelAnimationFrame(f.current);
|
|
779
1723
|
};
|
|
780
|
-
}, [
|
|
781
|
-
var
|
|
782
|
-
|
|
783
|
-
}, [
|
|
784
|
-
const
|
|
785
|
-
[0, 0,
|
|
786
|
-
[
|
|
787
|
-
[
|
|
788
|
-
[
|
|
789
|
-
] : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
|
|
790
|
-
return
|
|
791
|
-
/* @__PURE__ */
|
|
792
|
-
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
1724
|
+
}, [e, E, d]), P(() => {
|
|
1725
|
+
var L;
|
|
1726
|
+
e && N && ((L = u.current) == null || L.focus({ preventScroll: !0 }));
|
|
1727
|
+
}, [e, o, N]), !N) return null;
|
|
1728
|
+
const I = o === a.length - 1, w = v, b = w ? [
|
|
1729
|
+
[0, 0, w.vw, w.hole.y],
|
|
1730
|
+
[w.hole.y + w.hole.h, 0, w.vw, w.vh - w.hole.y - w.hole.h],
|
|
1731
|
+
[w.hole.y, 0, w.hole.x, w.hole.h],
|
|
1732
|
+
[w.hole.y, w.hole.x + w.hole.w, w.vw - w.hole.x - w.hole.w, w.hole.h]
|
|
1733
|
+
] : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], R = (L) => Math.max(0, L) + "px";
|
|
1734
|
+
return rt(
|
|
1735
|
+
/* @__PURE__ */ i("div", { className: `sj${e ? " on" : ""}${n ? " anim" : ""}`, "data-theme": s, "data-sj-ignore": !0, children: [
|
|
1736
|
+
b.map(([L, k, S, $], T) => /* @__PURE__ */ t("div", { className: "sj-p", style: { top: R(L), left: R(k), width: R(S), height: R($) } }, T)),
|
|
1737
|
+
/* @__PURE__ */ t("div", { className: "sj-ring", style: w ? { top: w.hole.y, left: w.hole.x, width: R(w.hole.w), height: R(w.hole.h), opacity: w.centered ? 0 : 1 } : { opacity: 0 } }),
|
|
1738
|
+
/* @__PURE__ */ i(
|
|
795
1739
|
"div",
|
|
796
1740
|
{
|
|
797
|
-
ref:
|
|
1741
|
+
ref: g,
|
|
798
1742
|
className: "sj-pop",
|
|
799
1743
|
role: "dialog",
|
|
800
1744
|
"aria-modal": "true",
|
|
801
1745
|
"aria-live": "polite",
|
|
802
|
-
"data-side": (
|
|
803
|
-
style: { transform:
|
|
1746
|
+
"data-side": (w == null ? void 0 : w.side) ?? "c",
|
|
1747
|
+
style: { transform: w ? `translate(${w.x}px,${w.y}px)` : void 0, "--ax": ((w == null ? void 0 : w.ax) ?? 0) + "px", "--ay": ((w == null ? void 0 : w.ay) ?? 0) + "px" },
|
|
804
1748
|
children: [
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */
|
|
1749
|
+
/* @__PURE__ */ t("i", { className: "sj-arr" }),
|
|
1750
|
+
/* @__PURE__ */ t("div", { className: "sj-bar", children: /* @__PURE__ */ t("b", { style: { width: Math.round((o + 1) / a.length * 100) + "%" } }) }),
|
|
1751
|
+
/* @__PURE__ */ i("div", { className: "sj-hd", children: [
|
|
1752
|
+
/* @__PURE__ */ t("span", { children: N.welcome ? "Welcome" : `Step ${o + 1} of ${a.length}` }),
|
|
1753
|
+
/* @__PURE__ */ i("span", { children: [
|
|
1754
|
+
/* @__PURE__ */ t("button", { className: "sj-x", "aria-label": "Switch light or dark theme", onClick: h, children: "◐" }),
|
|
1755
|
+
/* @__PURE__ */ t("button", { className: "sj-x", "aria-label": "Close tour", onClick: l, children: "×" })
|
|
812
1756
|
] })
|
|
813
1757
|
] }),
|
|
814
|
-
/* @__PURE__ */
|
|
815
|
-
/* @__PURE__ */
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
/* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
1758
|
+
/* @__PURE__ */ t("h3", { children: N.title }),
|
|
1759
|
+
/* @__PURE__ */ t("p", { children: N.body }),
|
|
1760
|
+
/* @__PURE__ */ i("div", { className: "sj-ft", children: [
|
|
1761
|
+
/* @__PURE__ */ t("button", { className: "sj-g", style: { visibility: I ? "hidden" : "visible" }, onClick: l, children: "Skip" }),
|
|
1762
|
+
/* @__PURE__ */ i("span", { children: [
|
|
1763
|
+
/* @__PURE__ */ t("button", { className: "sj-g", style: { visibility: o ? "visible" : "hidden" }, onClick: p, children: "Back" }),
|
|
1764
|
+
/* @__PURE__ */ t("button", { ref: u, className: "sj-b", onClick: r, children: N.welcome ? c || "Start tour" : I ? "Finish" : "Next" })
|
|
821
1765
|
] })
|
|
822
1766
|
] })
|
|
823
1767
|
]
|
|
@@ -826,143 +1770,143 @@ const se = (t, a, n) => Math.max(a, Math.min(n, t)), et = ({ open: t, anim: a, t
|
|
|
826
1770
|
] }),
|
|
827
1771
|
document.body
|
|
828
1772
|
);
|
|
829
|
-
},
|
|
830
|
-
const
|
|
831
|
-
return
|
|
832
|
-
const
|
|
833
|
-
const
|
|
834
|
-
if (!
|
|
835
|
-
const
|
|
836
|
-
if (!
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
for (const
|
|
840
|
-
const [
|
|
841
|
-
if (
|
|
842
|
-
const
|
|
843
|
-
|
|
1773
|
+
}, Ln = ({ tracker: e }) => {
|
|
1774
|
+
const n = q(null);
|
|
1775
|
+
return P(() => {
|
|
1776
|
+
const s = () => {
|
|
1777
|
+
const o = n.current;
|
|
1778
|
+
if (!o) return;
|
|
1779
|
+
const c = o.getContext("2d");
|
|
1780
|
+
if (!c) return;
|
|
1781
|
+
const d = document.documentElement.scrollWidth, r = e.state.heat[location.pathname + location.hash] || {};
|
|
1782
|
+
o.width = innerWidth, o.height = innerHeight, c.globalCompositeOperation = "lighter";
|
|
1783
|
+
for (const p in r) {
|
|
1784
|
+
const [l, h] = p.split(",").map(Number), g = l / 100 * d - scrollX, u = h * 20 + 10 - scrollY;
|
|
1785
|
+
if (g < -40 || u < -40 || g > innerWidth + 40 || u > innerHeight + 40) continue;
|
|
1786
|
+
const f = Math.min(1, r[p] / 6), v = c.createRadialGradient(g, u, 0, g, u, 34);
|
|
1787
|
+
v.addColorStop(0, `rgba(255,70,50,${0.5 * f + 0.1})`), v.addColorStop(1, "rgba(255,70,50,0)"), c.fillStyle = v, c.fillRect(g - 34, u - 34, 68, 68);
|
|
844
1788
|
}
|
|
845
1789
|
};
|
|
846
|
-
|
|
847
|
-
const
|
|
848
|
-
return addEventListener("scroll",
|
|
849
|
-
clearInterval(
|
|
1790
|
+
s();
|
|
1791
|
+
const a = window.setInterval(s, 250);
|
|
1792
|
+
return addEventListener("scroll", s, { passive: !0 }), addEventListener("resize", s), () => {
|
|
1793
|
+
clearInterval(a), removeEventListener("scroll", s), removeEventListener("resize", s);
|
|
850
1794
|
};
|
|
851
|
-
}, [
|
|
852
|
-
},
|
|
853
|
-
function
|
|
854
|
-
const
|
|
855
|
-
if (!
|
|
856
|
-
return
|
|
1795
|
+
}, [e]), rt(/* @__PURE__ */ t("canvas", { ref: n, className: "sj-heat", "data-sj-ignore": !0 }), document.body);
|
|
1796
|
+
}, Et = Tt(null);
|
|
1797
|
+
function ze() {
|
|
1798
|
+
const e = It(Et);
|
|
1799
|
+
if (!e) throw new Error("useJourney must be used inside <JourneyProvider>");
|
|
1800
|
+
return e;
|
|
857
1801
|
}
|
|
858
|
-
function
|
|
859
|
-
const { tracker:
|
|
860
|
-
return
|
|
1802
|
+
function In() {
|
|
1803
|
+
const { tracker: e } = ze();
|
|
1804
|
+
return Me(e.subscribe, e.getVersion, e.getVersion), e.state;
|
|
861
1805
|
}
|
|
862
|
-
const
|
|
1806
|
+
const oe = (e, n) => {
|
|
863
1807
|
try {
|
|
864
|
-
return
|
|
1808
|
+
return e();
|
|
865
1809
|
} catch {
|
|
866
|
-
return
|
|
1810
|
+
return n;
|
|
867
1811
|
}
|
|
868
|
-
},
|
|
869
|
-
const
|
|
870
|
-
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
const
|
|
874
|
-
return
|
|
1812
|
+
}, Tn = ({ config: e, children: n }) => {
|
|
1813
|
+
const s = q(e ?? {});
|
|
1814
|
+
s.current = e ?? {};
|
|
1815
|
+
const a = te(() => new xn(() => s.current), []), [o, c] = x(() => oe(() => localStorage.getItem("sjTheme"), null) ?? (e == null ? void 0 : e.theme) ?? "auto"), [d, r] = x(() => oe(() => matchMedia("(prefers-color-scheme:dark)").matches, !1));
|
|
1816
|
+
P(() => {
|
|
1817
|
+
const y = matchMedia("(prefers-color-scheme:dark)"), O = () => r(y.matches);
|
|
1818
|
+
return y.addEventListener("change", O), () => y.removeEventListener("change", O);
|
|
875
1819
|
}, []);
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
document.documentElement.setAttribute("data-sj-theme",
|
|
879
|
-
}, [
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
}, [
|
|
883
|
-
|
|
884
|
-
const [
|
|
885
|
-
if (!
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
}, [
|
|
889
|
-
const
|
|
890
|
-
if (
|
|
891
|
-
const
|
|
892
|
-
if (
|
|
893
|
-
|
|
1820
|
+
const p = o === "auto" ? d ? "dark" : "light" : o;
|
|
1821
|
+
P(() => {
|
|
1822
|
+
document.documentElement.setAttribute("data-sj-theme", p);
|
|
1823
|
+
}, [p]);
|
|
1824
|
+
const l = H((y) => {
|
|
1825
|
+
c(y), oe(() => localStorage.setItem("sjTheme", y), void 0), a.track("theme", { theme: y });
|
|
1826
|
+
}, [a]);
|
|
1827
|
+
P(() => a.attach(), [a]);
|
|
1828
|
+
const [h, g] = x(!1), [u, f] = x([]), [v, _] = x(-1), [N, M] = x(!1), E = q([]), I = q(-1), w = q(!1), b = q(!1), R = q(0), L = H((y) => {
|
|
1829
|
+
if (!w.current) return;
|
|
1830
|
+
const O = E.current[I.current];
|
|
1831
|
+
a.tourEnd(y, I.current, (O == null ? void 0 : O.title) ?? "", E.current.length), w.current = !1, g(!1);
|
|
1832
|
+
}, [a]), k = H((y, O = 0) => {
|
|
1833
|
+
const A = E.current, K = s.current;
|
|
1834
|
+
if (y < 0 && (y = 0), y >= A.length) return L("complete");
|
|
1835
|
+
const j = A[y];
|
|
1836
|
+
if (j.page && j.page !== location.pathname) {
|
|
1837
|
+
oe(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: y, t: Date.now(), go: 1 })), void 0), a.track("step_navigate", { step: y, to: j.page }), a.flush(!0), location.href = j.page;
|
|
894
1838
|
return;
|
|
895
1839
|
}
|
|
896
|
-
if (
|
|
897
|
-
if (
|
|
1840
|
+
if (j.wait && !j.el && j.target && (j.el = document.querySelector(j.target)), j.target && !$e(j.el)) {
|
|
1841
|
+
if (O < (K.waitMs ?? 2500) / 100) {
|
|
898
1842
|
window.setTimeout(() => {
|
|
899
|
-
|
|
1843
|
+
w.current && k(y, O + 1);
|
|
900
1844
|
}, 100);
|
|
901
1845
|
return;
|
|
902
1846
|
}
|
|
903
|
-
|
|
904
|
-
const
|
|
905
|
-
return
|
|
1847
|
+
a.track("step_missing", { step: y, target: j.target });
|
|
1848
|
+
const ce = y >= I.current ? 1 : -1;
|
|
1849
|
+
return k(y + (y + ce < 0 ? 1 : ce), 0);
|
|
906
1850
|
}
|
|
907
|
-
|
|
908
|
-
|
|
1851
|
+
I.current = y, _(y), a.stepView(y, j.title, A.length), b.current && (M(!0), clearTimeout(R.current), R.current = window.setTimeout(() => M(!1), 520)), $e(j.el) && j.el.scrollIntoView({ block: "center", behavior: b.current ? "smooth" : "auto" }), b.current || requestAnimationFrame(() => {
|
|
1852
|
+
b.current = !0;
|
|
909
1853
|
});
|
|
910
|
-
}, [
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
}, [
|
|
914
|
-
|
|
915
|
-
}, [
|
|
916
|
-
|
|
917
|
-
}, [
|
|
918
|
-
|
|
919
|
-
const
|
|
920
|
-
let
|
|
921
|
-
return
|
|
922
|
-
}, [
|
|
923
|
-
|
|
924
|
-
}, []),
|
|
925
|
-
if (!
|
|
926
|
-
const
|
|
927
|
-
|
|
1854
|
+
}, [L, a]), S = H((y = 0, O = !1) => {
|
|
1855
|
+
const A = $n(s.current);
|
|
1856
|
+
A.length && (E.current = A, f(A), w.current = !0, b.current = !1, g(!0), a.tourStart(A.length, O), k(y));
|
|
1857
|
+
}, [k, a]), $ = H(() => S(0), [S]), T = H(() => L("skip"), [L]), m = H(() => {
|
|
1858
|
+
w.current && (a.track("step_next", { step: I.current }), k(I.current + 1));
|
|
1859
|
+
}, [k, a]), W = H(() => {
|
|
1860
|
+
w.current && k(I.current - 1);
|
|
1861
|
+
}, [k]);
|
|
1862
|
+
P(() => {
|
|
1863
|
+
const y = oe(() => JSON.parse(sessionStorage.getItem("sjTour") || "null"), null), O = s.current;
|
|
1864
|
+
let A;
|
|
1865
|
+
return y && Date.now() - y.t < 3e5 ? A = window.setTimeout(() => S(y.i, !0), 400) : O.autoStart !== !1 && !(O.once && oe(() => localStorage.getItem("sjDone"), null)) && (A = window.setTimeout(() => S(0), 600)), () => clearTimeout(A);
|
|
1866
|
+
}, [S]), P(() => () => {
|
|
1867
|
+
w.current = !1;
|
|
1868
|
+
}, []), P(() => {
|
|
1869
|
+
if (!h) return;
|
|
1870
|
+
const y = (O) => {
|
|
1871
|
+
O.key === "Escape" ? L("skip") : O.key === "ArrowRight" ? m() : O.key === "ArrowLeft" && W();
|
|
928
1872
|
};
|
|
929
|
-
return addEventListener("keydown",
|
|
930
|
-
}, [
|
|
931
|
-
const [
|
|
932
|
-
tracker:
|
|
933
|
-
theme:
|
|
934
|
-
resolvedTheme:
|
|
935
|
-
setTheme:
|
|
936
|
-
open:
|
|
937
|
-
start:
|
|
938
|
-
stop:
|
|
939
|
-
next:
|
|
940
|
-
back:
|
|
941
|
-
heat:
|
|
942
|
-
toggleHeat:
|
|
1873
|
+
return addEventListener("keydown", y), () => removeEventListener("keydown", y);
|
|
1874
|
+
}, [h, L, m, W]);
|
|
1875
|
+
const [D, F] = x(!1), G = H(() => F((y) => !y), []), J = H((y) => a.configure(y), [a]), le = te(() => ({
|
|
1876
|
+
tracker: a,
|
|
1877
|
+
theme: o,
|
|
1878
|
+
resolvedTheme: p,
|
|
1879
|
+
setTheme: l,
|
|
1880
|
+
open: h,
|
|
1881
|
+
start: $,
|
|
1882
|
+
stop: T,
|
|
1883
|
+
next: m,
|
|
1884
|
+
back: W,
|
|
1885
|
+
heat: D,
|
|
1886
|
+
toggleHeat: G,
|
|
943
1887
|
configure: J
|
|
944
|
-
}), [
|
|
945
|
-
return /* @__PURE__ */
|
|
946
|
-
|
|
947
|
-
u.length > 0 && /* @__PURE__ */
|
|
948
|
-
|
|
1888
|
+
}), [a, o, p, l, h, $, T, m, W, D, G, J]);
|
|
1889
|
+
return /* @__PURE__ */ i(Et.Provider, { value: le, children: [
|
|
1890
|
+
n,
|
|
1891
|
+
u.length > 0 && /* @__PURE__ */ t(
|
|
1892
|
+
Mn,
|
|
949
1893
|
{
|
|
950
|
-
open:
|
|
951
|
-
anim:
|
|
952
|
-
theme:
|
|
1894
|
+
open: h,
|
|
1895
|
+
anim: N,
|
|
1896
|
+
theme: p,
|
|
953
1897
|
steps: u,
|
|
954
|
-
index:
|
|
955
|
-
startLabel:
|
|
956
|
-
tracker:
|
|
957
|
-
onNext:
|
|
958
|
-
onBack:
|
|
959
|
-
onSkip:
|
|
960
|
-
onTheme: () =>
|
|
1898
|
+
index: v,
|
|
1899
|
+
startLabel: e == null ? void 0 : e.startLabel,
|
|
1900
|
+
tracker: a,
|
|
1901
|
+
onNext: m,
|
|
1902
|
+
onBack: W,
|
|
1903
|
+
onSkip: T,
|
|
1904
|
+
onTheme: () => l(p === "dark" ? "light" : "dark")
|
|
961
1905
|
}
|
|
962
1906
|
),
|
|
963
|
-
|
|
1907
|
+
D && /* @__PURE__ */ t(Ln, { tracker: a })
|
|
964
1908
|
] });
|
|
965
|
-
},
|
|
1909
|
+
}, be = (e) => e < 6e4 ? (e / 1e3).toFixed(1) + "s" : Math.floor(e / 6e4) + "m " + Math.round(e % 6e4 / 1e3) + "s", Cn = `import { JourneyProvider } from '@shiva004/surveys';
|
|
966
1910
|
|
|
967
1911
|
<JourneyProvider
|
|
968
1912
|
config={{
|
|
@@ -978,197 +1922,201 @@ const V = (t, a) => {
|
|
|
978
1922
|
}}
|
|
979
1923
|
>
|
|
980
1924
|
<App />
|
|
981
|
-
</JourneyProvider>`,
|
|
982
|
-
const { toggleHeat:
|
|
983
|
-
return /* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
986
|
-
/* @__PURE__ */
|
|
1925
|
+
</JourneyProvider>`, jn = ({ open: e, onClose: n }) => {
|
|
1926
|
+
const { toggleHeat: s, configure: a } = ze(), o = In(), [c, d] = x("m"), r = location.pathname + location.hash, p = o.pages[r] || { ms: 0, depth: 0 }, l = o.started ? Math.round(o.completed / o.started * 100) + "%" : "–", h = [["Time on page", be(p.ms)], ["Scrolling", be(o.scrollMs)], ["Scroll depth", p.depth + "%"], ["Clicks", o.clicks], ["Completion", l], ["Navigations", o.nav]], g = Object.entries(o.steps).sort((f, v) => +f[0] - +v[0]), u = Math.max(1, ...g.map((f) => f[1].ms));
|
|
1927
|
+
return /* @__PURE__ */ i("aside", { className: `nw-ins${e ? " open" : ""}`, "data-sj-ignore": !0, "aria-label": "Journey insights", children: [
|
|
1928
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
1929
|
+
/* @__PURE__ */ t("strong", { children: "Journey insights" }),
|
|
1930
|
+
/* @__PURE__ */ t("button", { className: "nw-x", onClick: n, "aria-label": "Close", children: "×" })
|
|
987
1931
|
] }),
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
] },
|
|
994
|
-
/* @__PURE__ */
|
|
995
|
-
Object.entries(
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
|
|
1932
|
+
/* @__PURE__ */ t("div", { className: "nw-tabs", children: [["m", "Metrics"], ["e", "Events"], ["c", "Embed"]].map(([f, v]) => /* @__PURE__ */ t("button", { className: c === f ? "on" : "", onClick: () => d(f), children: v }, f)) }),
|
|
1933
|
+
c === "m" && /* @__PURE__ */ i(B, { children: [
|
|
1934
|
+
/* @__PURE__ */ t("div", { className: "nw-kpis", children: h.map(([f, v]) => /* @__PURE__ */ i("div", { className: "nw-kpi", children: [
|
|
1935
|
+
/* @__PURE__ */ t("small", { children: f }),
|
|
1936
|
+
/* @__PURE__ */ t("b", { children: v })
|
|
1937
|
+
] }, f)) }),
|
|
1938
|
+
/* @__PURE__ */ t("h4", { children: "Time per page" }),
|
|
1939
|
+
Object.entries(o.pages).map(([f, v]) => /* @__PURE__ */ i("div", { className: "nw-row", children: [
|
|
1940
|
+
/* @__PURE__ */ t("span", { children: f }),
|
|
1941
|
+
/* @__PURE__ */ i("span", { children: [
|
|
1942
|
+
be(v.ms),
|
|
999
1943
|
" · ",
|
|
1000
|
-
|
|
1944
|
+
v.depth,
|
|
1001
1945
|
"% deep"
|
|
1002
1946
|
] })
|
|
1003
|
-
] },
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
|
|
1006
|
-
/* @__PURE__ */
|
|
1007
|
-
/* @__PURE__ */
|
|
1008
|
-
+
|
|
1947
|
+
] }, f)),
|
|
1948
|
+
/* @__PURE__ */ t("h4", { children: "Walkthrough funnel and drop-offs" }),
|
|
1949
|
+
g.length ? g.map(([f, v]) => /* @__PURE__ */ i(Lt.Fragment, { children: [
|
|
1950
|
+
/* @__PURE__ */ i("div", { className: "nw-row", children: [
|
|
1951
|
+
/* @__PURE__ */ i("span", { children: [
|
|
1952
|
+
+f + 1,
|
|
1009
1953
|
". ",
|
|
1010
|
-
|
|
1954
|
+
v.title
|
|
1011
1955
|
] }),
|
|
1012
|
-
/* @__PURE__ */
|
|
1013
|
-
|
|
1956
|
+
/* @__PURE__ */ i("span", { children: [
|
|
1957
|
+
v.views,
|
|
1014
1958
|
"× · ",
|
|
1015
|
-
|
|
1016
|
-
|
|
1959
|
+
be(v.ms),
|
|
1960
|
+
o.drops[+f] ? /* @__PURE__ */ i(B, { children: [
|
|
1017
1961
|
" · ",
|
|
1018
|
-
/* @__PURE__ */
|
|
1019
|
-
|
|
1962
|
+
/* @__PURE__ */ i("b", { className: "nw-warn", children: [
|
|
1963
|
+
o.drops[+f],
|
|
1020
1964
|
" dropped"
|
|
1021
1965
|
] })
|
|
1022
1966
|
] }) : null
|
|
1023
1967
|
] })
|
|
1024
1968
|
] }),
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
] },
|
|
1027
|
-
/* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
1969
|
+
/* @__PURE__ */ t("div", { className: "nw-meter", children: /* @__PURE__ */ t("i", { style: { width: Math.round(v.ms / u * 100) + "%" } }) })
|
|
1970
|
+
] }, f)) : /* @__PURE__ */ i("div", { className: "nw-row", children: [
|
|
1971
|
+
/* @__PURE__ */ t("span", { children: "No tour data yet" }),
|
|
1972
|
+
/* @__PURE__ */ t("span", {})
|
|
1029
1973
|
] }),
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
/* @__PURE__ */
|
|
1974
|
+
/* @__PURE__ */ t("h4", { children: "Heatmap" }),
|
|
1975
|
+
/* @__PURE__ */ t("button", { className: "nw-btn", onClick: s, children: "Toggle heatmap overlay" })
|
|
1032
1976
|
] }),
|
|
1033
|
-
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
String(
|
|
1977
|
+
c === "e" && o.log.slice(0, 30).map((f, v) => /* @__PURE__ */ i("div", { className: "nw-row", children: [
|
|
1978
|
+
/* @__PURE__ */ t("span", { children: f.type }),
|
|
1979
|
+
/* @__PURE__ */ i("span", { children: [
|
|
1980
|
+
String(f.title || f.sel || f.pct || f.n || f.to || f.theme || ""),
|
|
1037
1981
|
" · ",
|
|
1038
|
-
new Date(
|
|
1982
|
+
new Date(f.t).toLocaleTimeString()
|
|
1039
1983
|
] })
|
|
1040
|
-
] }, `${
|
|
1041
|
-
|
|
1042
|
-
/* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1984
|
+
] }, `${f.t}-${v}`)),
|
|
1985
|
+
c === "c" && /* @__PURE__ */ i(B, { children: [
|
|
1986
|
+
/* @__PURE__ */ t("h4", { children: "Install in a React app" }),
|
|
1987
|
+
/* @__PURE__ */ t("pre", { children: Cn }),
|
|
1988
|
+
/* @__PURE__ */ i("p", { children: [
|
|
1045
1989
|
"No ",
|
|
1046
|
-
/* @__PURE__ */
|
|
1990
|
+
/* @__PURE__ */ t("code", { children: "steps" }),
|
|
1047
1991
|
"? Add ",
|
|
1048
|
-
/* @__PURE__ */
|
|
1992
|
+
/* @__PURE__ */ t("code", { children: "data-sj-title" }),
|
|
1049
1993
|
", ",
|
|
1050
|
-
/* @__PURE__ */
|
|
1994
|
+
/* @__PURE__ */ t("code", { children: "data-sj-body" }),
|
|
1051
1995
|
", ",
|
|
1052
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ t("code", { children: "data-sj-place" }),
|
|
1053
1997
|
" and ",
|
|
1054
|
-
/* @__PURE__ */
|
|
1998
|
+
/* @__PURE__ */ t("code", { children: "data-sj-step" }),
|
|
1055
1999
|
" to any element, or it falls back to the page’s header, nav, sections and footer. A step with ",
|
|
1056
|
-
/* @__PURE__ */
|
|
2000
|
+
/* @__PURE__ */ t("code", { children: "page" }),
|
|
1057
2001
|
" continues the tour after navigating."
|
|
1058
2002
|
] }),
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
/* @__PURE__ */
|
|
1061
|
-
/* @__PURE__ */
|
|
2003
|
+
/* @__PURE__ */ t("h4", { children: "Backend endpoint" }),
|
|
2004
|
+
/* @__PURE__ */ t("input", { placeholder: "/api/journey/events", onChange: (f) => a({ endpoint: f.target.value.trim() }) }),
|
|
2005
|
+
/* @__PURE__ */ i("p", { children: [
|
|
1062
2006
|
"Run ",
|
|
1063
|
-
/* @__PURE__ */
|
|
2007
|
+
/* @__PURE__ */ t("code", { children: "node server.js" }),
|
|
1064
2008
|
", open ",
|
|
1065
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ t("code", { children: "http://localhost:4000/?api=/api/journey/events" }),
|
|
1066
2010
|
". Without an endpoint it runs in dry-run mode and the Events tab shows each flush."
|
|
1067
2011
|
] })
|
|
1068
2012
|
] })
|
|
1069
2013
|
] });
|
|
1070
|
-
},
|
|
1071
|
-
const { start:
|
|
1072
|
-
return /* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */
|
|
2014
|
+
}, Rn = () => {
|
|
2015
|
+
const { start: e, setTheme: n, resolvedTheme: s } = ze(), [a, o] = x(!1);
|
|
2016
|
+
return /* @__PURE__ */ i("div", { className: "nw", id: "top", children: [
|
|
2017
|
+
/* @__PURE__ */ i("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: [
|
|
2018
|
+
/* @__PURE__ */ i("a", { className: "nw-logo", href: "#top", children: [
|
|
2019
|
+
/* @__PURE__ */ t("i", { children: "◆" }),
|
|
1076
2020
|
" Northwind"
|
|
1077
2021
|
] }),
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
/* @__PURE__ */
|
|
2022
|
+
/* @__PURE__ */ i("nav", { className: "nw-nav", children: [
|
|
2023
|
+
/* @__PURE__ */ t("a", { href: "#features", children: "Features" }),
|
|
2024
|
+
/* @__PURE__ */ t("a", { href: "#pricing", children: "Pricing" }),
|
|
2025
|
+
/* @__PURE__ */ t("a", { href: "#contact", children: "Contact" })
|
|
1082
2026
|
] }),
|
|
1083
|
-
/* @__PURE__ */
|
|
2027
|
+
/* @__PURE__ */ t("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
2028
|
] }),
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1090
|
-
/* @__PURE__ */
|
|
1091
|
-
/* @__PURE__ */
|
|
2029
|
+
/* @__PURE__ */ i("main", { className: "nw-wrap", children: [
|
|
2030
|
+
/* @__PURE__ */ i("section", { className: "nw-hero", children: [
|
|
2031
|
+
/* @__PURE__ */ t("h1", { children: "Ship products people actually finish onboarding." }),
|
|
2032
|
+
/* @__PURE__ */ t("p", { children: "Northwind is a sample site. The walkthrough reads each element’s position at runtime, so the same component fits any layout." }),
|
|
2033
|
+
/* @__PURE__ */ i("div", { className: "nw-acts", children: [
|
|
2034
|
+
/* @__PURE__ */ t("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" }),
|
|
2035
|
+
/* @__PURE__ */ t("a", { className: "nw-btn", href: "#features", children: "See features" })
|
|
1092
2036
|
] })
|
|
1093
2037
|
] }),
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
/* @__PURE__ */
|
|
1097
|
-
/* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
2038
|
+
/* @__PURE__ */ i("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: [
|
|
2039
|
+
/* @__PURE__ */ t("h2", { children: "Features" }),
|
|
2040
|
+
/* @__PURE__ */ i("div", { className: "nw-grid", children: [
|
|
2041
|
+
/* @__PURE__ */ i("div", { className: "nw-card", children: [
|
|
2042
|
+
/* @__PURE__ */ t("h3", { children: "Live analytics" }),
|
|
2043
|
+
/* @__PURE__ */ t("p", { children: "Page time, scroll depth and clicks, collected as people browse." })
|
|
1100
2044
|
] }),
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
2045
|
+
/* @__PURE__ */ i("div", { className: "nw-card", children: [
|
|
2046
|
+
/* @__PURE__ */ t("h3", { children: "Heatmaps" }),
|
|
2047
|
+
/* @__PURE__ */ t("p", { children: "See where attention gathers and where it never reaches." })
|
|
1104
2048
|
] }),
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ i("div", { className: "nw-card", children: [
|
|
2050
|
+
/* @__PURE__ */ t("h3", { children: "Guided tours" }),
|
|
2051
|
+
/* @__PURE__ */ t("p", { children: "Spotlight any element with a popup that repositions itself." })
|
|
1108
2052
|
] })
|
|
1109
2053
|
] })
|
|
1110
2054
|
] }),
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1117
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ i("section", { id: "pricing", children: [
|
|
2056
|
+
/* @__PURE__ */ t("h2", { children: "Pricing" }),
|
|
2057
|
+
/* @__PURE__ */ i("div", { className: "nw-grid", children: [
|
|
2058
|
+
/* @__PURE__ */ i("div", { className: "nw-card", children: [
|
|
2059
|
+
/* @__PURE__ */ t("h3", { children: "Starter" }),
|
|
2060
|
+
/* @__PURE__ */ t("div", { className: "nw-big", children: "$0" }),
|
|
2061
|
+
/* @__PURE__ */ t("p", { children: "For side projects." })
|
|
1118
2062
|
] }),
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */
|
|
1121
|
-
/* @__PURE__ */
|
|
1122
|
-
/* @__PURE__ */
|
|
2063
|
+
/* @__PURE__ */ i("div", { className: "nw-card", children: [
|
|
2064
|
+
/* @__PURE__ */ t("h3", { children: "Team" }),
|
|
2065
|
+
/* @__PURE__ */ t("div", { className: "nw-big", children: "$29" }),
|
|
2066
|
+
/* @__PURE__ */ t("p", { children: "For growing teams." })
|
|
1123
2067
|
] }),
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
2068
|
+
/* @__PURE__ */ i("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: [
|
|
2069
|
+
/* @__PURE__ */ t("h3", { children: "Scale" }),
|
|
2070
|
+
/* @__PURE__ */ t("div", { className: "nw-big", children: "$99" }),
|
|
2071
|
+
/* @__PURE__ */ t("p", { children: "Unlimited journeys and exports." })
|
|
1128
2072
|
] })
|
|
1129
2073
|
] })
|
|
1130
2074
|
] }),
|
|
1131
|
-
/* @__PURE__ */
|
|
1132
|
-
/* @__PURE__ */
|
|
1133
|
-
/* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ i("section", { id: "contact", children: [
|
|
2076
|
+
/* @__PURE__ */ t("h2", { children: "Contact" }),
|
|
2077
|
+
/* @__PURE__ */ t("div", { className: "nw-card", children: /* @__PURE__ */ t("p", { children: "hello@northwind.example: we reply within a day." }) })
|
|
1134
2078
|
] })
|
|
1135
2079
|
] }),
|
|
1136
|
-
/* @__PURE__ */
|
|
1137
|
-
/* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
/* @__PURE__ */
|
|
2080
|
+
/* @__PURE__ */ t("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" }),
|
|
2081
|
+
/* @__PURE__ */ i("div", { className: "nw-dock", "data-sj-ignore": !0, children: [
|
|
2082
|
+
/* @__PURE__ */ t("button", { onClick: e, children: "▶ Tour" }),
|
|
2083
|
+
/* @__PURE__ */ t("button", { onClick: () => n(s === "dark" ? "light" : "dark"), children: "◐ Theme" }),
|
|
2084
|
+
/* @__PURE__ */ t("button", { onClick: () => o((c) => !c), children: "▤ Insights" })
|
|
1141
2085
|
] }),
|
|
1142
|
-
/* @__PURE__ */
|
|
2086
|
+
/* @__PURE__ */ t(jn, { open: a, onClose: () => o(!1) })
|
|
1143
2087
|
] });
|
|
1144
|
-
},
|
|
1145
|
-
|
|
2088
|
+
}, Wn = ({ endpoint: e, config: n }) => /* @__PURE__ */ t(
|
|
2089
|
+
Tn,
|
|
1146
2090
|
{
|
|
1147
2091
|
config: {
|
|
1148
|
-
endpoint:
|
|
2092
|
+
endpoint: e ?? new URLSearchParams(location.search).get("api") ?? "",
|
|
1149
2093
|
theme: "auto",
|
|
1150
2094
|
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
2095
|
outro: { title: "You’re all set", body: "Open Insights to see the time, scroll depth, clicks and heatmap this session just generated." },
|
|
1152
|
-
...
|
|
2096
|
+
...n
|
|
1153
2097
|
},
|
|
1154
|
-
children: /* @__PURE__ */
|
|
2098
|
+
children: /* @__PURE__ */ t(Rn, {})
|
|
1155
2099
|
}
|
|
1156
2100
|
);
|
|
1157
2101
|
export {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
2102
|
+
Pt as FeedbackApp,
|
|
2103
|
+
yn as HeatmapApp,
|
|
2104
|
+
Tn as JourneyProvider,
|
|
2105
|
+
xn as JourneyTracker,
|
|
2106
|
+
on as LogsApp,
|
|
2107
|
+
Hn as LogsFeedbackApp,
|
|
2108
|
+
Wn as WalkthroughDemo,
|
|
2109
|
+
hn as clearHeatmap,
|
|
2110
|
+
Le as createLogger,
|
|
2111
|
+
V as formatLocalTime,
|
|
2112
|
+
at as getHeatmapData,
|
|
2113
|
+
ut as getNetworkInfo,
|
|
2114
|
+
Qt as isPublicLookupEnabled,
|
|
2115
|
+
Dn as logger,
|
|
2116
|
+
Zt as refreshNetwork,
|
|
2117
|
+
Kt as setNetworkName,
|
|
2118
|
+
Xt as setPublicLookup,
|
|
2119
|
+
St as startHeatmapCapture,
|
|
2120
|
+
ze as useJourney,
|
|
2121
|
+
In as useJourneyStats
|
|
1174
2122
|
};
|