@journeeze/sdk 0.1.0-rc.2 → 0.1.0-rc.3

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.
Files changed (72) hide show
  1. package/AGENTS.md +16 -3
  2. package/CHANGELOG.md +12 -1
  3. package/README.md +298 -119
  4. package/dist/anchor-cPvFFTOS.js +1 -0
  5. package/dist/attach-DpioALxW.js +21 -0
  6. package/dist/chat-BgmB0rnW.js +64 -0
  7. package/dist/consent-DckCUvYR.js +1 -0
  8. package/dist/contract.js +1 -1
  9. package/dist/feedback-CtH1a_kQ.js +1 -0
  10. package/dist/help-w0O5Qu-4.js +105 -0
  11. package/dist/hook-DGWypoEO.js +1 -0
  12. package/dist/index-B_nob8S0.js +1 -2091
  13. package/dist/{index-CfCbJJXa.js → index-CwG2LrhO.js} +3 -3
  14. package/dist/index.js +3 -3
  15. package/dist/jobs-CAXbM5-g.js +45 -0
  16. package/dist/loader-BZiIDD1D.js +96 -0
  17. package/dist/mask-audit-Du3NPoG_.js +5 -0
  18. package/dist/react.js +12 -11
  19. package/dist/resolve-BfWByuTp.js +1 -97
  20. package/dist/script.js +10 -9
  21. package/dist/signals-amjMQyOy.js +1 -0
  22. package/dist/telemetry-CyRJDaVs.js +1 -0
  23. package/dist/transport-B64CfIcF.js +1 -0
  24. package/dist/types/chat/capture/attach.d.ts +41 -0
  25. package/dist/types/chat/capture/draw.d.ts +10 -0
  26. package/dist/types/chat/capture/geometry.d.ts +30 -0
  27. package/dist/types/chat/capture/styles.d.ts +1 -0
  28. package/dist/types/chat/shell/chat.d.ts +27 -0
  29. package/dist/types/chat/shell/converse.d.ts +95 -0
  30. package/dist/types/chat/shell/copy.d.ts +8 -0
  31. package/dist/types/chat/shell/model.d.ts +36 -0
  32. package/dist/types/chat/shell/session.d.ts +148 -0
  33. package/dist/types/chat/shell/styles.d.ts +1 -0
  34. package/dist/types/chat/shell/view.d.ts +18 -0
  35. package/dist/types/chat/transport.d.ts +5 -0
  36. package/dist/types/config.d.ts +17 -0
  37. package/dist/types/help/core/controller.d.ts +12 -3
  38. package/dist/types/help/core/events.d.ts +24 -0
  39. package/dist/types/help/core/help.d.ts +1 -0
  40. package/dist/types/help/core/panel.d.ts +16 -0
  41. package/dist/types/help/core/routing.d.ts +21 -0
  42. package/dist/types/help/ui/jobs/jobs.d.ts +24 -0
  43. package/dist/types/help/ui/jobs/model.d.ts +33 -0
  44. package/dist/types/help/ui/jobs/styles.d.ts +1 -0
  45. package/dist/types/loader.d.ts +2 -0
  46. package/dist/types/mask-detector.d.ts +22 -0
  47. package/dist/types/preview/flag.d.ts +2 -0
  48. package/dist/types/preview/mask-audit.d.ts +29 -0
  49. package/dist/types/schemas/feedback.d.ts +76 -0
  50. package/dist/types/schemas/finding.d.ts +22 -0
  51. package/dist/types/schemas/index.d.ts +6 -0
  52. package/dist/types/schemas/turn.d.ts +26 -0
  53. package/dist/types/signals/signals.d.ts +7 -3
  54. package/dist/types/signals/steps.d.ts +33 -0
  55. package/dist/types/telemetry/telemetry.d.ts +10 -0
  56. package/dist/types/types.d.ts +72 -1
  57. package/dist/types/widget/capture.d.ts +12 -1
  58. package/dist/types/widget/upload.d.ts +14 -0
  59. package/dist/types/widget.d.ts +1 -21
  60. package/dist/upload-Fu2qvSJV.js +14 -0
  61. package/dist/widget-B6mR1J3P.js +118 -0
  62. package/package.json +4 -2
  63. package/dist/consent-CoKD33Rm.js +0 -170
  64. package/dist/feedback-C4CYtS2A.js +0 -196
  65. package/dist/help-C1x-y2f9.js +0 -878
  66. package/dist/hook-BdG4UL4k.js +0 -91
  67. package/dist/loader-Ba4X-WNl.js +0 -95
  68. package/dist/signals-E3VEdmWH.js +0 -477
  69. package/dist/telemetry-Cik-cYzw.js +0 -140
  70. package/dist/transport-B5YJFQEF.js +0 -60
  71. package/dist/types/signals/signals.conformance.d.ts +0 -2
  72. package/dist/widget-DQZm8sAC.js +0 -1599
@@ -1,878 +0,0 @@
1
- var W = Object.defineProperty;
2
- var Y = (n, e, t) => e in n ? W(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var k = (n, e, t) => Y(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { d as K, s as Q, F as D, R as X } from "./hook-BdG4UL4k.js";
5
- import { j as J, C as Z, k as q, e as V, b as ee, c as te, D as ne, i as ie, h as se, f as re, d as oe } from "./consent-CoKD33Rm.js";
6
- import { T as ae } from "./context-UnG6_X61.js";
7
- const de = 6e4;
8
- class le {
9
- constructor(e) {
10
- k(this, "opts");
11
- k(this, "indexEntry");
12
- k(this, "guides", /* @__PURE__ */ new Map());
13
- k(this, "inflight", /* @__PURE__ */ new Map());
14
- k(this, "now");
15
- k(this, "freshMs");
16
- this.opts = e, this.now = e.now ?? Date.now, this.freshMs = e.freshMs ?? 6e4;
17
- }
18
- index() {
19
- return this.read("index", "GetHelpIndex", this.body({}), () => this.indexEntry, (e) => this.indexEntry = e, () => !1);
20
- }
21
- guide(e) {
22
- return this.read(
23
- `guide:${e}`,
24
- "GetGuide",
25
- this.body({ journeyId: e }),
26
- () => this.guides.get(e),
27
- (t) => this.guides.set(e, t),
28
- (t) => {
29
- const i = t.linksExpireAt ? Date.parse(t.linksExpireAt) : NaN;
30
- return Number.isFinite(i) && i - this.now() < de;
31
- }
32
- );
33
- }
34
- body(e) {
35
- const t = this.opts.reviewerToken;
36
- return { siteKey: this.opts.siteKey, ...e, ...t && { reviewerToken: t } };
37
- }
38
- read(e, t, i, s, o, v) {
39
- const c = s();
40
- if (c && this.now() - c.at < this.freshMs && !v(c.value)) return Promise.resolve(c.value);
41
- const h = this.inflight.get(e);
42
- if (h) return h;
43
- const g = c && !v(c.value) ? c.etag : void 0, S = J(this.opts.endpoint, t, i, g, this.opts.fetchImpl).then((y) => {
44
- if (y.notModified) {
45
- if (!c) throw new Error("304 without a cached value");
46
- return o({ ...c, at: this.now() }), c.value;
47
- }
48
- return o({ value: y.value, etag: y.etag, at: this.now() }), y.value;
49
- }).finally(() => this.inflight.delete(e));
50
- return this.inflight.set(e, S), S;
51
- }
52
- }
53
- const T = (n) => n.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").split(/[^\p{L}\p{N}]+/u).filter(Boolean);
54
- function $(n, e) {
55
- const t = T(e);
56
- if (t.length === 0) return [...n];
57
- const i = [];
58
- return n.forEach((s, o) => {
59
- const v = T(s.title ?? ""), c = T(s.goal ?? ""), h = (s.stepTitles ?? []).flatMap(T);
60
- let g = 0;
61
- for (const S of t) {
62
- const y = (a) => a.some((b) => b.startsWith(S)), I = y(v) ? 3 : y(c) ? 2 : y(h) ? 1 : 0;
63
- if (I === 0) return;
64
- g += I;
65
- }
66
- i.push([s, g, o]);
67
- }), i.sort((s, o) => o[1] - s[1] || s[2] - o[2]).map(([s]) => s);
68
- }
69
- const ce = 4e3;
70
- function H(n) {
71
- return n instanceof Z && n.code === "failed_precondition";
72
- }
73
- class ue {
74
- constructor(e) {
75
- k(this, "deps");
76
- k(this, "current", { view: "closed" });
77
- k(this, "listeners", /* @__PURE__ */ new Set());
78
- k(this, "entries", []);
79
- k(this, "generation", 0);
80
- k(this, "asked", /* @__PURE__ */ new Set());
81
- k(this, "pending");
82
- k(this, "pendingSignal");
83
- this.deps = e;
84
- }
85
- get state() {
86
- return this.current;
87
- }
88
- subscribe(e) {
89
- return this.listeners.add(e), e(this.current), () => this.listeners.delete(e);
90
- }
91
- probe() {
92
- return this.deps.loadIndex().then(
93
- () => {
94
- },
95
- (e) => {
96
- H(e) && this.disable();
97
- }
98
- );
99
- }
100
- open() {
101
- if (this.current.view === "disabled") return;
102
- const e = ++this.generation;
103
- this.deps.clearHighlight(), this.set({ view: "index", status: "loading", query: "", results: [], total: 0 }), this.deps.loadIndex().then(
104
- (t) => {
105
- if (e !== this.generation) return;
106
- this.entries = (t.guides ?? []).filter((s) => s.journeyId);
107
- const i = this.current.view === "index" ? this.current.query : "";
108
- this.set({ view: "index", status: "ready", query: i, results: $(this.entries, i), total: this.entries.length });
109
- },
110
- (t) => {
111
- if (e !== this.generation) return;
112
- if (H(t)) return this.disable();
113
- const i = this.current.view === "index" ? this.current.query : "";
114
- this.set({ view: "index", status: "error", query: i, results: [], total: 0 });
115
- }
116
- );
117
- }
118
- close() {
119
- this.current.view !== "disabled" && (this.generation++, this.pending = void 0, this.pendingSignal = void 0, this.deps.clearHighlight(), this.set({ view: "closed" }));
120
- }
121
- search(e) {
122
- const t = this.current;
123
- if (t.view !== "index") return;
124
- const i = t.status === "ready" ? $(this.entries, e) : [];
125
- this.set({ ...t, query: e, results: i });
126
- }
127
- openGuide(e) {
128
- if (this.current.view === "disabled") return;
129
- const t = ++this.generation;
130
- this.pending = void 0, this.deps.clearHighlight(), this.set({ view: "guide", status: "loading", journeyId: e, step: 0, anchor: "none", checkin: "idle" }), this.deps.loadGuide(e).then(
131
- (i) => {
132
- if (t !== this.generation) return;
133
- const s = pe(i, e, this.deps.endpoint);
134
- if (s.steps.length === 0) {
135
- this.set({ view: "guide", status: "error", journeyId: e, step: 0, anchor: "none", checkin: "idle" });
136
- return;
137
- }
138
- this.showStep(s, 0);
139
- },
140
- (i) => {
141
- if (t === this.generation) {
142
- if (H(i)) return this.disable();
143
- this.set({ view: "guide", status: "error", journeyId: e, step: 0, anchor: "none", checkin: "idle" });
144
- }
145
- }
146
- );
147
- }
148
- disable() {
149
- this.generation++, this.pending = void 0, this.deps.clearHighlight(), this.set({ view: "disabled" });
150
- }
151
- back() {
152
- const e = this.current;
153
- if (e.view === "finished") return this.showStep(e.guide, e.guide.steps.length - 1);
154
- if (e.view !== "guide" || !e.guide) return this.open();
155
- if (e.step === 0) return this.open();
156
- this.generation++, this.pending = void 0, this.showStep(e.guide, e.step - 1);
157
- }
158
- next() {
159
- const e = this.current;
160
- if (e.view !== "guide" || e.status !== "ready" || !e.guide || e.checkin !== "idle") return;
161
- const t = e.guide.steps[e.step];
162
- if (t && !this.asked.has(U(e.guide, t))) {
163
- this.set({ ...e, checkin: "asking", notice: void 0 });
164
- return;
165
- }
166
- this.advance();
167
- }
168
- answer(e) {
169
- const t = this.current;
170
- if (!(t.view !== "guide" || t.checkin !== "asking" && t.checkin !== "needs-consent")) {
171
- if (!this.deps.hasConsent()) {
172
- this.pending = e, this.set({ ...t, checkin: "needs-consent" });
173
- return;
174
- }
175
- this.send(e);
176
- }
177
- }
178
- skipCheckin() {
179
- const e = this.current;
180
- e.view !== "guide" || e.checkin !== "asking" && e.checkin !== "needs-consent" || (this.pending = void 0, this.markAsked(e), this.set({ ...e, checkin: "idle" }), this.advance());
181
- }
182
- giveConsent() {
183
- const e = this.pendingSignal, t = this.current;
184
- if (e && (t.view === "index" || t.view === "guide") && t.signal === "needs-consent") {
185
- this.pendingSignal = void 0, this.deps.giveConsent(), this.sendSignalNow(e);
186
- return;
187
- }
188
- const i = this.current;
189
- if (i.view !== "guide" || i.checkin !== "needs-consent" || !this.pending) return;
190
- this.deps.giveConsent();
191
- const s = this.pending;
192
- this.pending = void 0, this.send(s);
193
- }
194
- declineConsent() {
195
- const e = this.current;
196
- if (this.pendingSignal && (e.view === "index" || e.view === "guide") && e.signal === "needs-consent") {
197
- this.pendingSignal = void 0, this.patchSignal({ signal: "idle" });
198
- return;
199
- }
200
- this.skipCheckin();
201
- }
202
- canSignal() {
203
- return this.deps.signalsAllowed?.() ?? !0;
204
- }
205
- sendCallout(e) {
206
- if (!this.canSignal()) return;
207
- const t = this.current;
208
- if (t.view !== "guide" || t.status !== "ready" || !t.guide || L(t.signal)) return;
209
- const i = t.guide.steps.find((s) => s.index === e);
210
- i && this.signal({ kind: "callout", guide: t.guide, step: i });
211
- }
212
- sendRequest(e) {
213
- if (!this.canSignal()) return;
214
- const t = e.trim();
215
- if (!t || [...t].length > ce) return;
216
- const i = this.current;
217
- i.view === "index" && !L(i.signal) ? this.signal({ kind: "request", text: t }) : i.view === "guide" && i.status === "ready" && i.guide && !L(i.signal) && this.signal({ kind: "request", text: t, guide: i.guide, step: i.guide.steps[i.step] });
218
- }
219
- signal(e) {
220
- if (!this.deps.hasConsent()) {
221
- this.pendingSignal = e, this.patchSignal({ signal: "needs-consent", signalNotice: void 0 });
222
- return;
223
- }
224
- this.sendSignalNow(e);
225
- }
226
- patchSignal(e) {
227
- const t = this.current;
228
- (t.view === "index" || t.view === "guide") && this.set({ ...t, ...e });
229
- }
230
- async sendSignalNow(e) {
231
- const t = this.generation;
232
- this.patchSignal({ signal: "sending", signalNotice: void 0 });
233
- let i;
234
- try {
235
- i = await this.deps.sendSignal(e);
236
- } catch {
237
- i = "dropped";
238
- }
239
- t === this.generation && this.patchSignal({ signal: "idle", signalNotice: i });
240
- }
241
- async send(e) {
242
- const t = this.current;
243
- if (t.view !== "guide" || !t.guide) return;
244
- const i = t.guide.steps[t.step];
245
- if (!i) return;
246
- this.markAsked(t);
247
- const s = this.generation;
248
- this.set({ ...t, checkin: "sending" });
249
- let o;
250
- try {
251
- o = await this.deps.sendCheckin({ guide: t.guide, step: i, answer: e });
252
- } catch {
253
- o = "dropped";
254
- }
255
- if (s !== this.generation) return;
256
- const v = this.current;
257
- v.view === "guide" && (this.set({ ...v, checkin: "idle" }), this.advance(o));
258
- }
259
- refreshHighlight() {
260
- const e = this.current;
261
- if (e.view !== "guide" || e.status !== "ready" || !e.guide) return;
262
- const t = this.anchorFor(e.guide, e.step);
263
- t !== e.anchor && this.set({ ...e, anchor: t });
264
- }
265
- markAsked(e) {
266
- if (e.view !== "guide" || !e.guide) return;
267
- const t = e.guide.steps[e.step];
268
- t && this.asked.add(U(e.guide, t));
269
- }
270
- advance(e) {
271
- const t = this.current;
272
- if (!(t.view !== "guide" || !t.guide)) {
273
- if (t.step + 1 < t.guide.steps.length) return this.showStep(t.guide, t.step + 1, e);
274
- this.deps.clearHighlight(), this.set({ view: "finished", guide: t.guide, notice: e });
275
- }
276
- }
277
- showStep(e, t, i) {
278
- const s = this.anchorFor(e, t);
279
- this.set({ view: "guide", status: "ready", journeyId: e.journeyId, guide: e, step: t, anchor: s, checkin: "idle", notice: i });
280
- }
281
- anchorFor(e, t) {
282
- const i = this.deps.highlight(e.steps[t]?.targets);
283
- return typeof i == "string" ? i : (i.then((s) => {
284
- const o = this.current;
285
- o.view === "guide" && o.guide === e && o.step === t && o.anchor !== s && this.set({ ...o, anchor: s });
286
- }), "none");
287
- }
288
- set(e) {
289
- this.current = e;
290
- for (const t of this.listeners) t(e);
291
- }
292
- }
293
- const U = (n, e) => `${n.journeyId}/${e.index}`;
294
- function pe(n, e, t) {
295
- const i = (n.steps ?? []).map((s, o) => ({
296
- index: s.index ?? o,
297
- title: s.title ?? "",
298
- instruction: s.instruction ?? "",
299
- tflowId: s.tflowId || void 0,
300
- targets: ge(s),
301
- stepRef: s.stepRef || void 0,
302
- screenshotUrl: q(t, s.screenshotUrl),
303
- videoStartMs: s.videoStartMs,
304
- videoEndMs: s.videoEndMs
305
- })).sort((s, o) => s.index - o.index);
306
- return {
307
- journeyId: n.journeyId ?? e,
308
- slug: n.slug ?? "",
309
- title: n.title ?? "",
310
- goal: n.goal ?? "",
311
- steps: i,
312
- videoUrl: q(t, n.videoUrl),
313
- captionsUrl: q(t, n.captionsUrl),
314
- version: n.contentVersion || void 0
315
- };
316
- }
317
- function L(n) {
318
- return n === "needs-consent" || n === "sending";
319
- }
320
- const he = /^(tflow|testId|role|css)$/;
321
- function ge(n) {
322
- const e = (n.targets ?? []).filter((t) => he.test(t.strategy ?? "") && t.value).map((t) => ({ by: t.strategy, value: t.value, name: t.name || void 0 }));
323
- return e.length || !n.tflowId ? e : [{ by: "tflow", value: n.tflowId }];
324
- }
325
- const fe = () => import("./resolve-BfWByuTp.js");
326
- function ve(n, e = document) {
327
- if (ae.test(n))
328
- for (const t of e.querySelectorAll(`[data-tflow-id="${n}"]`)) {
329
- const i = t.getBoundingClientRect();
330
- if (i.width > 0 || i.height > 0) return t;
331
- }
332
- }
333
- function be(n = window) {
334
- try {
335
- return n.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
336
- } catch {
337
- return !1;
338
- }
339
- }
340
- class xe {
341
- constructor(e, t = window, i = fe) {
342
- k(this, "win");
343
- k(this, "load");
344
- k(this, "target");
345
- k(this, "box");
346
- k(this, "onMove", () => this.place());
347
- k(this, "seq", 0);
348
- this.win = t, this.load = i, this.box = t.document.createElement("div"), this.box.className = "jz-help-highlight", this.box.setAttribute("aria-hidden", "true"), this.box.hidden = !0, e.append(this.box);
349
- }
350
- show(e) {
351
- this.hide();
352
- const t = this.seq, [i] = e ?? [];
353
- return i ? e?.length === 1 && i.by === "tflow" ? this.outline(ve(i.value, this.win.document)) : this.load().then(
354
- (s) => t === this.seq ? this.outline(s.resolveTarget(e ?? [], this.win.document)) : "none",
355
- () => "missing"
356
- ) : "none";
357
- }
358
- outline(e) {
359
- return e ? (this.target = e, e.scrollIntoView?.({ block: "center", inline: "nearest", behavior: be(this.win) ? "auto" : "smooth" }), this.win.addEventListener("scroll", this.onMove, { capture: !0, passive: !0 }), this.win.addEventListener("resize", this.onMove, { passive: !0 }), this.box.hidden = !1, this.place(), "found") : "missing";
360
- }
361
- hide() {
362
- this.seq++, this.target && (this.target = void 0, this.box.hidden = !0, this.win.removeEventListener("scroll", this.onMove, { capture: !0 }), this.win.removeEventListener("resize", this.onMove));
363
- }
364
- dispose() {
365
- this.hide(), this.box.remove();
366
- }
367
- place() {
368
- if (!this.target) return;
369
- if (!this.target.isConnected) return this.hide();
370
- const e = this.target.getBoundingClientRect();
371
- Object.assign(this.box.style, { left: `${e.left - 4}px`, top: `${e.top - 4}px`, width: `${e.width + 8}px`, height: `${e.height + 8}px` });
372
- }
373
- }
374
- function we(n, e, t) {
375
- let i;
376
- return {
377
- start() {
378
- i ?? (i = import("./telemetry-Cik-cYzw.js").then(
379
- (s) => s.startTelemetry({ endpoint: n, siteKey: e, subscribe: (o) => t.subscribe(o) }),
380
- () => {
381
- i = void 0;
382
- }
383
- ));
384
- },
385
- checkin: (s) => {
386
- i?.then((o) => o?.checkin(s));
387
- },
388
- stop: (s) => {
389
- i?.then((o) => o?.stop(s));
390
- }
391
- };
392
- }
393
- const De = `
394
- :host { all: initial; }
395
- .launcher { position:fixed; left:24px; bottom:24px; z-index:2147483646; width:44px; height:44px; border-radius:22px;
396
- border:1px solid #1D2024; background:#1D2024; color:#FFFFFF; font:600 18px/1 system-ui,sans-serif; cursor:pointer; }
397
- .panel { position:fixed; left:24px; bottom:80px; z-index:2147483646; width:min(340px, calc(100vw - 48px));
398
- max-height:min(70vh, 560px); overflow:auto; box-sizing:border-box; padding:16px; border:1px solid rgb(29 32 36/12%);
399
- border-radius:10px; background:#FFFFFF; color:#1D2024; font:14px/1.45 system-ui,sans-serif; box-shadow:0 8px 24px rgb(0 0 0/12%); }
400
- .panel h2 { font-size:15px; margin:0 0 8px; }
401
- .panel p { margin:0 0 8px; }
402
- .panel ul { list-style:none; padding:0; margin:8px 0 0; }
403
- .panel li button { display:block; width:100%; text-align:left; padding:8px; margin:0 0 4px; border:1px solid rgb(29 32 36/12%);
404
- border-radius:6px; background:#FFFFFF; color:inherit; font:inherit; cursor:pointer; }
405
- .panel input { width:100%; box-sizing:border-box; padding:8px; border:1px solid rgb(29 32 36/24%); border-radius:6px; font:inherit; }
406
- .panel .row { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
407
- .panel .row button { padding:6px 12px; border:1px solid #1D2024; border-radius:6px; background:#FFFFFF; color:#1D2024; font:inherit; cursor:pointer; }
408
- .panel .muted { color:#5D636B; font-size:13px; }
409
- .panel img { max-width:100%; border:1px solid rgb(29 32 36/12%); border-radius:6px; }
410
- :focus-visible { outline:2px solid #3D63C9; outline-offset:2px; }
411
- .jz-help-highlight { position:fixed; z-index:2147483645; pointer-events:none; box-sizing:border-box;
412
- border:2px solid #3D63C9; border-radius:6px; box-shadow:0 0 0 4px rgb(61 99 201/20%); }
413
- `;
414
- function p(n, e = {}, ...t) {
415
- const i = document.createElement(n);
416
- for (const [s, o] of Object.entries(e)) i.setAttribute(s, o);
417
- for (const s of t) s && i.append(s);
418
- return i;
419
- }
420
- const G = {
421
- sent: "Thanks. Your answer was sent.",
422
- queued: "Saved. It will send when you're back online.",
423
- dropped: "Your answer couldn't be sent."
424
- }, me = (n, e, t) => {
425
- const i = p("button", { type: "button", class: "launcher", "aria-label": "Help", "aria-expanded": "false", "aria-controls": "jz-help-panel" }, "?"), s = p("div", { id: "jz-help-panel", class: "panel", role: "dialog", "aria-modal": "false", "aria-label": "Help" });
426
- s.hidden = !0, n.append(i, s);
427
- let o = "", v = !1, c;
428
- i.addEventListener("click", () => e.state.view === "closed" ? e.open() : e.close()), s.addEventListener("keydown", (a) => {
429
- a.key === "Escape" && (a.stopPropagation(), e.close());
430
- });
431
- const h = (a, b, f = {}) => {
432
- const C = p("button", { type: "button", ...f }, a);
433
- return C.addEventListener("click", b), C;
434
- };
435
- function g(a) {
436
- const b = n.activeElement, f = b !== null && s.contains(b), C = f ? b.id : "";
437
- i.hidden = a.view === "disabled";
438
- const r = a.view !== "closed" && a.view !== "disabled";
439
- if (i.setAttribute("aria-expanded", String(r)), s.hidden = !r, a.view === "index" && c && s.contains(c.input)) {
440
- y(a), f && b && !b.isConnected && (C && n.getElementById(C) || c.input).focus(), v = r;
441
- return;
442
- }
443
- if (c = void 0, s.replaceChildren(...(r ? S(a) : []).filter((d) => !!d)), r && (!v || f)) {
444
- const u = (C ? n.getElementById(C) : null) ?? s.querySelector("input, [role=group] button, button");
445
- u?.focus(), u instanceof HTMLInputElement && u.setSelectionRange(u.value.length, u.value.length);
446
- }
447
- !r && v && i.focus(), v = r;
448
- }
449
- function S(a) {
450
- if (a.view === "index") {
451
- const d = p("input", { id: "jz-help-search", type: "search", "aria-label": "Search help", placeholder: "How do I…", autocomplete: "off" });
452
- return d.value = a.query, d.addEventListener("input", () => e.search(d.value)), c = {
453
- input: d,
454
- status: p("p", { class: "muted", role: "status" }),
455
- retry: p("div", { class: "row" }, h("Try again", () => e.open())),
456
- list: p("ul", { "aria-label": "Guides" })
457
- }, y(a), [p("h2", {}, "How do I…"), d, c.status, c.retry, c.list, p("div", { class: "row" }, h("Close", () => e.close()))];
458
- }
459
- if (a.view === "finished")
460
- return [
461
- p("h2", {}, `You finished “${a.guide.title}”`),
462
- a.notice && p("p", { class: "muted", role: "status" }, G[a.notice] ?? ""),
463
- p("div", { class: "row" }, h("More guides", () => e.open(), { id: "jz-help-more" }), h("Back", () => e.back()), h("Close", () => e.close()))
464
- ];
465
- if (a.view !== "guide") return [];
466
- if (a.status !== "ready" || !a.guide)
467
- return [
468
- p("p", { role: "status" }, a.status === "loading" ? "Loading guide…" : "This guide isn't available right now."),
469
- p("div", { class: "row" }, h("Back", () => e.open()), h("Close", () => e.close()))
470
- ];
471
- const b = a.guide, f = b.steps[a.step];
472
- if (!f) return [];
473
- const C = a.step + 1 === b.steps.length, r = [
474
- p("h2", {}, b.title),
475
- p("p", { class: "muted" }, `Step ${a.step + 1} of ${b.steps.length}`),
476
- p("p", {}, p("strong", {}, f.title)),
477
- f.instruction && p("p", {}, f.instruction),
478
- a.anchor === "missing" && p("p", { class: "muted" }, "The part of the page this step uses isn't shown here. Follow the steps in the text."),
479
- f.screenshotUrl && p("img", { referrerpolicy: "no-referrer", src: f.screenshotUrl, alt: `Screenshot for: ${f.title}`, loading: "lazy" }),
480
- a.notice && p("p", { class: "muted", role: "status" }, G[a.notice] ?? "")
481
- ];
482
- if (a.checkin === "asking")
483
- r.push(
484
- p("div", { role: "group", "aria-label": "Step check-in" }, p("p", {}, "Did this step make sense?"), p("div", { class: "row" }, h("Understood", () => e.answer("understood"), { id: "jz-help-yes" }), h("Confused", () => e.answer("confused")), h("Skip", () => e.skipCheckin())))
485
- );
486
- else if (a.checkin === "needs-consent") {
487
- const d = p("p", {}, o || "Loading…");
488
- o || t.consentText().then((u) => {
489
- o = u, d.textContent = u;
490
- }), r.push(p("div", { role: "group", "aria-label": "Consent" }, d, p("div", { class: "row" }, h("Allow and send", () => e.giveConsent(), { id: "jz-help-allow" }), h("Not now", () => e.declineConsent()))));
491
- } else a.checkin === "sending" ? r.push(p("p", { role: "status" }, "Sending…")) : r.push(p("div", { class: "row" }, h("Back", () => e.back()), h(C ? "Finish" : "Next", () => e.next(), { id: "jz-help-next" }), h("Close", () => e.close())));
492
- return r;
493
- }
494
- function y(a) {
495
- if (!c) return;
496
- const { input: b, status: f, retry: C, list: r } = c;
497
- b.value !== a.query && n.activeElement !== b && (b.value = a.query), f.textContent = a.status === "loading" ? "Loading guides…" : a.status === "error" ? "Help isn't available right now." : a.results.length === 0 ? a.query ? `No guide matches “${a.query}”.` : "No guides yet." : "", f.hidden = f.textContent === "", C.hidden = a.status !== "error", r.replaceChildren(...a.results.map((d, u) => p("li", {}, h(d.title || "Untitled guide", () => e.openGuide(d.journeyId ?? ""), { id: `jz-help-g${u}` }), d.goal ? p("p", { class: "muted" }, d.goal) : void 0)));
498
- }
499
- const I = e.subscribe(g);
500
- return {
501
- destroy() {
502
- I(), i.remove(), s.remove();
503
- }
504
- };
505
- }, O = "http://www.w3.org/2000/svg", ke = "M6.1 6.2a2 2 0 1 1 2.7 1.9c-.7.3-1 .6-1 1.3v.5H6.4v-.6c0-1.1.4-1.6 1.2-2 .5-.2.8-.5.8-1a1 1 0 0 0-2 0v.1H6.1zM7.2 11.4h1.6V13H7.2z";
506
- function ye(n) {
507
- const e = document.createElementNS(O, "svg");
508
- e.setAttribute("viewBox", "0 0 16 16"), e.setAttribute("width", "14"), e.setAttribute("height", "14"), e.setAttribute("aria-hidden", "true"), e.setAttribute("focusable", "false");
509
- const t = document.createElementNS(O, "path");
510
- return t.setAttribute("d", n), t.setAttribute("fill", "currentColor"), e.append(t), e;
511
- }
512
- function ze(n, e) {
513
- const t = document.createElement("button");
514
- return t.type = "button", t.id = "jz-help-callout", t.className = "callout-btn", t.append(ye(ke), document.createTextNode("This is confusing")), t.addEventListener("click", () => n.sendCallout(e)), t;
515
- }
516
- function je(n, e) {
517
- const t = document.createElement("form");
518
- t.setAttribute("aria-label", "Ask for something you could not find");
519
- const i = document.createElement("p");
520
- i.textContent = "Couldn't find it? Tell us what you were trying to do.";
521
- const s = document.createElement("textarea");
522
- s.id = "jz-help-request", s.setAttribute("aria-label", "What were you trying to do?"), s.maxLength = 4e3, s.rows = 3, s.value = `I couldn't find how to ${e}`;
523
- const o = document.createElement("button");
524
- return o.type = "submit", o.id = "jz-help-request-send", o.textContent = "Send request", t.append(i, s, o), t.addEventListener("submit", (v) => {
525
- v.preventDefault(), n.sendRequest(s.value);
526
- }), t;
527
- }
528
- function l(n, e = {}, ...t) {
529
- const i = document.createElement(n);
530
- for (const [s, o] of Object.entries(e)) i.setAttribute(s, o);
531
- for (const s of t) s && i.append(s);
532
- return i;
533
- }
534
- function M(n, e) {
535
- const t = l(n, { ...e, crossorigin: "anonymous" });
536
- return Object.assign(t, { referrerPolicy: "no-referrer" }), t.setAttribute("referrerpolicy", "no-referrer"), t;
537
- }
538
- const R = "http://www.w3.org/2000/svg";
539
- function Ce(n) {
540
- const e = document.createElementNS(R, "svg");
541
- e.setAttribute("viewBox", "0 0 16 16"), e.setAttribute("width", "14"), e.setAttribute("height", "14"), e.setAttribute("aria-hidden", "true"), e.setAttribute("focusable", "false");
542
- const t = document.createElementNS(R, "path");
543
- return t.setAttribute("d", n), t.setAttribute("fill", "currentColor"), e.append(t), e;
544
- }
545
- const Se = "M6.2 11.4 3 8.2l1.1-1.1 2.1 2.1 4.6-4.6 1.1 1.1z", Ee = "M6.1 6.2a2 2 0 1 1 2.7 1.9c-.7.3-1 .6-1 1.3v.5H6.4v-.6c0-1.1.4-1.6 1.2-2 .5-.2.8-.5.8-1a1 1 0 0 0-2 0v.1H6.1zM7.2 11.4h1.6V13H7.2z", _ = {
546
- sent: "Thanks. Your answer was sent.",
547
- queued: "Saved. It will send when you're back online.",
548
- dropped: "Your answer couldn't be sent."
549
- }, P = {
550
- sent: "Thanks. We'll take a look.",
551
- queued: "Saved. It will send when you're back online.",
552
- dropped: "Your request couldn't be sent."
553
- }, Fe = (n, e, t) => {
554
- const i = l("button", { type: "button", class: "launcher", "aria-label": "Help", "aria-expanded": "false", "aria-controls": "jz-help-panel" }, "?"), s = l("div", { id: "jz-help-panel", class: "panel", role: "dialog", "aria-modal": "false", "aria-label": "Help" });
555
- s.hidden = !0, n.append(i, s);
556
- let o = "", v = !1, c, h;
557
- i.addEventListener("click", () => e.state.view === "closed" ? e.open() : e.close()), s.addEventListener("keydown", (r) => {
558
- r.key === "Escape" && (r.stopPropagation(), e.close());
559
- });
560
- const g = (r, d, u = {}) => {
561
- const z = l("button", { type: "button", ...u }, r);
562
- return z.addEventListener("click", d), z;
563
- }, S = () => {
564
- const r = l("p", {}, o || "Loading…");
565
- return o || t.consentText().then((d) => {
566
- o = d, r.textContent = d;
567
- }), l(
568
- "div",
569
- { class: "checkin", role: "group", "aria-label": "Consent" },
570
- r,
571
- l("div", { class: "row" }, g("Allow and send", () => e.giveConsent(), { id: "jz-help-allow", class: "primary" }), g("Not now", () => e.declineConsent()))
572
- );
573
- }, y = () => l(
574
- "div",
575
- { class: "panel-head" },
576
- l("h2", {}, "Help"),
577
- g("×", () => e.close(), { class: "icon-btn", "aria-label": "Close help" })
578
- ), I = (r, d, u) => {
579
- const z = l("button", { type: "button", id: `jz-help-${d}`, class: `checkin-btn ${d}` });
580
- return z.append(Ce(d === "understood" ? Se : Ee), l("span", {}, r)), z.addEventListener("click", u), z;
581
- };
582
- function a(r) {
583
- const d = n.activeElement, u = d !== null && s.contains(d), z = u ? d.id : "";
584
- i.hidden = r.view === "disabled";
585
- const j = r.view !== "closed" && r.view !== "disabled";
586
- if (i.setAttribute("aria-expanded", String(j)), s.hidden = !j, r.view === "index" && c && s.contains(c.input)) {
587
- f(r), u && d && !d.isConnected && (z && n.getElementById(z) || c.input).focus(), v = j;
588
- return;
589
- }
590
- if (c = void 0, s.replaceChildren(...(j ? b(r) : []).filter((x) => !!x)), j && (!v || u)) {
591
- const F = (z ? n.getElementById(z) : null) ?? s.querySelector("input, [role=group] button, button");
592
- F?.focus(), F instanceof HTMLInputElement && F.setSelectionRange(F.value.length, F.value.length);
593
- }
594
- !j && v && i.focus(), v = j;
595
- }
596
- function b(r) {
597
- if (r.view === "index") {
598
- const E = l("input", { id: "jz-help-search", type: "search", "aria-label": "Search help", placeholder: "How do I…", autocomplete: "off" });
599
- return E.value = r.query, E.addEventListener("input", () => e.search(E.value)), c = {
600
- input: E,
601
- status: l("p", { class: "muted", role: "status" }),
602
- retry: l("div", { class: "row" }, g("Try again", () => e.open())),
603
- request: l("div", { class: "request" }),
604
- signal: l("div", { class: "signal" }),
605
- list: l("ul", { "aria-label": "Guides" })
606
- }, f(r), [y(), E, c.status, c.retry, c.request, c.signal, c.list];
607
- }
608
- if (r.view === "finished")
609
- return [
610
- y(),
611
- l("h2", {}, `You finished “${r.guide.title}”`),
612
- r.notice && l("p", { class: "muted", role: "status" }, _[r.notice] ?? ""),
613
- l("div", { class: "row" }, g("More guides", () => e.open(), { id: "jz-help-more" }), g("Back", () => e.back()), g("Close", () => e.close()))
614
- ];
615
- if (r.view !== "guide") return [];
616
- if (r.status !== "ready" || !r.guide)
617
- return [
618
- y(),
619
- l("p", { role: "status" }, r.status === "loading" ? "Loading guide…" : "This guide isn't available right now."),
620
- l("div", { class: "row" }, g("Back", () => e.open()), g("Close", () => e.close()))
621
- ];
622
- const d = r.guide, u = d.steps[r.step];
623
- if (!u) return [];
624
- const z = r.step + 1 === d.steps.length, j = d.steps.length, x = l("div", { class: "progress", "aria-hidden": "true" }, l("div", { class: "progress-fill" })), F = x.firstElementChild;
625
- F.style.width = `${Math.round((r.step + 1) / j * 100)}%`;
626
- const N = [
627
- l("h2", {}, d.title),
628
- l("p", { class: "muted" }, `Step ${r.step + 1} of ${j}`),
629
- x,
630
- l("p", { class: "step-title" }, u.title),
631
- u.instruction && l("p", {}, u.instruction),
632
- r.anchor === "missing" && l("p", { class: "muted" }, "The part of the page this step uses isn't shown here. Follow the steps in the text."),
633
- u.screenshotUrl && M("img", { src: u.screenshotUrl, alt: `Screenshot for: ${u.title}`, loading: "lazy" })
634
- ];
635
- if (d.videoUrl) {
636
- const E = M("video", { controls: "", preload: "none", src: d.videoUrl });
637
- d.captionsUrl && E.append(M("track", { kind: "captions", src: d.captionsUrl, default: "" })), N.push(E);
638
- }
639
- const w = [y(), l("div", { class: "card" }, ...N), r.notice && l("p", { class: "muted", role: "status" }, _[r.notice] ?? "")];
640
- return r.checkin === "asking" ? w.push(
641
- l(
642
- "div",
643
- { class: "checkin", role: "group", "aria-label": "Step check-in" },
644
- l("p", {}, "Did this step make sense?"),
645
- l(
646
- "div",
647
- { class: "row" },
648
- I("Understood", "understood", () => e.answer("understood")),
649
- I("Confused", "confused", () => e.answer("confused")),
650
- g("Skip", () => e.skipCheckin())
651
- )
652
- )
653
- ) : r.checkin === "needs-consent" ? w.push(S()) : r.checkin === "sending" ? w.push(l("p", { role: "status" }, "Sending…")) : (r.signal === "needs-consent" ? w.push(S()) : r.signal === "sending" ? w.push(l("p", { role: "status" }, "Sending…")) : r.signalNotice && w.push(l("p", { class: "muted", role: "status" }, P[r.signalNotice] ?? "")), e.canSignal() && w.push(ze(e, u.index)), w.push(l("div", { class: "row" }, g("Back", () => e.back()), g(z ? "Finish" : "Next", () => e.next(), { id: "jz-help-next" }), g("Close", () => e.close())))), w;
654
- }
655
- function f(r) {
656
- if (!c) return;
657
- const { input: d, status: u, retry: z, request: j, signal: x, list: F } = c;
658
- if (d.value !== r.query && n.activeElement !== d && (d.value = r.query), u.textContent = r.status === "loading" ? "Loading guides…" : r.status === "error" ? "Help isn't available right now." : r.results.length === 0 ? r.query ? `No guide matches “${r.query}”.` : "No guides yet." : "", u.hidden = u.textContent === "", z.hidden = r.status !== "error", r.status === "ready" && r.query.trim() !== "" && r.results.length === 0 && e.canSignal()) {
659
- const w = r.query.trim();
660
- (h !== w || !j.firstElementChild) && (h = w, j.replaceChildren(je(e, w)));
661
- } else j.firstElementChild && (h = void 0, j.replaceChildren());
662
- r.signal === "needs-consent" ? x.replaceChildren(S()) : r.signal === "sending" ? x.replaceChildren(l("p", { role: "status" }, "Sending…")) : r.signalNotice ? x.replaceChildren(l("p", { class: "muted", role: "status" }, P[r.signalNotice] ?? "")) : x.firstElementChild && x.replaceChildren(), F.replaceChildren(
663
- ...r.results.map(
664
- (w, E) => l(
665
- "li",
666
- {},
667
- g(w.title || "Untitled guide", () => e.openGuide(w.journeyId ?? ""), { id: `jz-help-g${E}` }),
668
- w.goal ? l("p", { class: "muted" }, w.goal) : void 0
669
- )
670
- )
671
- );
672
- }
673
- const C = e.subscribe(a);
674
- return {
675
- destroy() {
676
- C(), i.remove(), s.remove();
677
- }
678
- };
679
- }, Ie = `
680
- :host {
681
- all: initial;
682
- --jz-canvas:#F7F7F5; --jz-surface:#FFFFFF; --jz-raised:#F0F0EC; --jz-ink:#1D2024; --jz-muted:#5D636B;
683
- --jz-faint:#6C727B; --jz-rule:rgb(29 32 36 / 12%); --jz-accent:#3D63C9; --jz-accent-ink:#FFFFFF;
684
- --jz-accent-soft:rgb(61 99 201 / 10%); --jz-polished:#2F7D4F; --jz-confused:#6E4FC2;
685
- --jz-shadow:0 1px 3px rgb(0 0 0 / 12%);
686
- font: 400 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
687
- color: var(--jz-ink); -webkit-font-smoothing: antialiased;
688
- }
689
- @media (prefers-color-scheme: dark) {
690
- :host {
691
- --jz-canvas:#111316; --jz-surface:#181B1F; --jz-raised:#20242A; --jz-ink:#E8EAED; --jz-muted:#A3A9B2;
692
- --jz-faint:#8A919B; --jz-rule:rgb(232 234 237 / 12%); --jz-accent:#7F9CF0; --jz-accent-ink:#111316;
693
- --jz-accent-soft:rgb(127 156 240 / 14%); --jz-polished:#5DBB84; --jz-confused:#A48BEA;
694
- }
695
- }
696
- *, *::before, *::after { box-sizing: border-box; }
697
- button { font: inherit; color: inherit; cursor: pointer; }
698
- :focus-visible { outline: 2px solid var(--jz-accent); outline-offset: 2px; }
699
- button:disabled { opacity: .45; cursor: not-allowed; }
700
- [hidden] { display: none !important; }
701
-
702
- .launcher { position:fixed; left:24px; bottom:24px; z-index:2147483646; width:44px; height:44px; min-width:44px; min-height:44px;
703
- display:flex; align-items:center; justify-content:center; padding:0; border:1px solid var(--jz-accent); border-radius:999px;
704
- background:var(--jz-accent); color:var(--jz-accent-ink); font-size:18px; font-weight:600; box-shadow:var(--jz-shadow);
705
- transition: background 180ms ease-out, transform 180ms ease-out; }
706
- .launcher:hover, .launcher[aria-expanded="true"] { background:var(--jz-ink); border-color:var(--jz-ink); }
707
-
708
- .panel { position:fixed; left:24px; bottom:80px; z-index:2147483646; width:min(360px, calc(100vw - 48px));
709
- max-height:min(75vh, 580px); overflow:auto; padding:16px; border:1px solid var(--jz-rule); border-radius:10px;
710
- background:var(--jz-surface); color:var(--jz-ink); box-shadow:var(--jz-shadow);
711
- transition: opacity 180ms ease-out, transform 180ms ease-out; }
712
- .panel-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
713
- .panel-head h2 { margin:0; font-size:14px; font-weight:600; }
714
- .icon-btn { width:44px; height:44px; min-width:44px; display:flex; align-items:center; justify-content:center; padding:0;
715
- border:0; border-radius:6px; background:transparent; color:var(--jz-faint); transition: color 180ms ease-out, background 180ms ease-out; }
716
- .icon-btn:hover { color:var(--jz-ink); background:var(--jz-raised); }
717
-
718
- .panel input { width:100%; min-height:44px; padding:8px 12px; border:1px solid var(--jz-rule); border-radius:6px;
719
- background:var(--jz-canvas); color:var(--jz-ink); font:inherit; }
720
- .panel input::placeholder { color:var(--jz-faint); }
721
- .panel ul { list-style:none; padding:0; margin:12px 0 0; }
722
- .panel li { margin:0 0 8px; }
723
- .panel li button { display:block; width:100%; min-height:44px; text-align:left; padding:8px 12px; border:1px solid var(--jz-rule);
724
- border-radius:6px; background:var(--jz-surface); color:inherit; font:inherit; transition: background 180ms ease-out, border-color 180ms ease-out; }
725
- .panel li button:hover { background:var(--jz-raised); border-color:var(--jz-accent); }
726
- .muted { color:var(--jz-muted); font-size:12px; margin:4px 0 0; }
727
- .row { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
728
- .row button { min-height:44px; padding:0 16px; border:1px solid var(--jz-rule); border-radius:6px; background:var(--jz-surface);
729
- color:var(--jz-muted); transition: background 180ms ease-out, color 180ms ease-out; }
730
- .row button:hover { color:var(--jz-ink); background:var(--jz-raised); }
731
- .row .primary { border-color:var(--jz-accent); background:var(--jz-accent); color:var(--jz-accent-ink); }
732
-
733
- .card { border:1px solid var(--jz-rule); border-radius:10px; padding:16px; }
734
- .card h2 { margin:0 0 8px; font-size:14px; font-weight:600; }
735
- .progress { height:4px; margin:8px 0 12px; border-radius:999px; background:var(--jz-raised); overflow:hidden; }
736
- .progress-fill { height:100%; border-radius:999px; background:var(--jz-accent); transition: width 180ms ease-out; }
737
- .step-title { margin:0 0 8px; font-weight:600; }
738
- .panel img, .panel video { max-width:100%; margin-top:12px; border:1px solid var(--jz-rule); border-radius:6px; }
739
-
740
- .checkin { margin-top:12px; padding-top:12px; border-top:1px solid var(--jz-rule); }
741
- .checkin p { margin:0 0 8px; }
742
- .callout-btn { display:inline-flex; align-items:center; gap:6px; margin-top:12px; min-height:44px; padding:0 16px;
743
- border:1px solid var(--jz-confused); border-radius:6px; background:var(--jz-surface); color:var(--jz-confused);
744
- transition: background 180ms ease-out, color 180ms ease-out; }
745
- .callout-btn:hover { background:var(--jz-raised); }
746
- .callout-btn svg { flex:none; }
747
- .request { margin-top:12px; }
748
- .request p { margin:0 0 8px; color:var(--jz-muted); font-size:12px; }
749
- .request textarea { display:block; width:100%; padding:8px 12px; border:1px solid var(--jz-rule); border-radius:6px;
750
- background:var(--jz-canvas); color:var(--jz-ink); font:inherit; resize:vertical; }
751
- .request button { margin-top:8px; min-height:44px; padding:0 16px; border:1px solid var(--jz-accent);
752
- border-radius:6px; background:var(--jz-accent); color:var(--jz-accent-ink); }
753
- .checkin-btn { display:inline-flex; align-items:center; gap:6px; }
754
- .checkin-btn.understood { color:var(--jz-polished); border-color:var(--jz-polished); }
755
- .checkin-btn.confused { color:var(--jz-confused); border-color:var(--jz-confused); }
756
- .checkin-btn svg { flex:none; }
757
-
758
- @media (prefers-reduced-motion: reduce) {
759
- :host *, :host *::before, :host *::after { animation-duration:1ms !important; transition-duration:1ms !important; }
760
- }
761
- .jz-help-highlight { position:fixed; z-index:2147483645; pointer-events:none; box-sizing:border-box;
762
- border:2px solid var(--jz-accent); border-radius:6px; box-shadow:0 0 0 4px var(--jz-accent-soft); }
763
- `;
764
- function B(n, e, t, i, s) {
765
- const o = {
766
- journeyId: e.slug || e.journeyId,
767
- journeyStep: String(t.index),
768
- pagePath: V(i),
769
- device: n.device || K(s)
770
- };
771
- return n.persona && (o.persona = n.persona), n.businessType && (o.businessType = n.businessType), n.state && (o.state = n.state), t.tflowId && (o.tflowId = t.tflowId), o;
772
- }
773
- function Ae(n, e, t, i) {
774
- return B(n, e.guide, e.step, t, i);
775
- }
776
- function Ne(n, e, t) {
777
- const i = { pagePath: V(e), device: n.device || K(t) };
778
- return n.persona && (i.persona = n.persona), n.journeyId && (i.journeyId = n.journeyId), n.journeyStep && (i.journeyStep = n.journeyStep), n.businessType && (i.businessType = n.businessType), n.state && (i.state = n.state), i;
779
- }
780
- function Te(n, e, t, i, s) {
781
- if (t.kind === "callout")
782
- return { siteKey: n, consentGiven: !0, kind: D.callout, context: B(e, t.guide, t.step, i, s) };
783
- const o = t.guide && t.step ? B(e, t.guide, t.step, i, s) : Ne(e, i, s);
784
- return { siteKey: n, consentGiven: !0, kind: D.request, comment: t.text, context: o };
785
- }
786
- function qe(n, e, t = me) {
787
- const i = ee(n), s = new le({ endpoint: i, siteKey: n.siteKey, reviewerToken: n.reviewerToken });
788
- let o;
789
- const v = te(i, "GetWidgetConfig", { siteKey: n.siteKey }).then(
790
- (m) => o = m,
791
- () => {
792
- }
793
- ), c = () => !n.reviewerToken && !n.userId, h = () => c() && o?.helpAudience != "reviewers", g = document.createElement("div");
794
- g.setAttribute("data-journeeze-help", "");
795
- const S = g.attachShadow({ mode: "closed" }), y = document.createElement("style");
796
- y.textContent = Ie, n.nonce && (y.nonce = n.nonce), S.append(y);
797
- const I = new xe(S);
798
- document.body.append(g);
799
- let a;
800
- const b = (m) => (a ?? (a = import("./feedback-C4CYtS2A.js").then((A) => A.feedbackChannel(n, i, { memoryOnly: h() })))).then(
801
- (A) => A.outbox.enqueue(m),
802
- () => "dropped"
803
- );
804
- let f, C = !1;
805
- const r = () => re(n), d = () => h() ? null : void 0, u = () => se(r(), d()), z = Q(n, i, e), j = () => {
806
- C && x.state.view !== "disabled" && u() && (f?.start(), z.start(v));
807
- }, x = new ue({
808
- endpoint: i,
809
- loadIndex: () => s.index(),
810
- loadGuide: (m) => s.guide(m),
811
- highlight: (m) => I.show(m),
812
- clearHighlight: () => I.hide(),
813
- hasConsent: u,
814
- giveConsent() {
815
- ie(r(), d()), j();
816
- },
817
- signalsAllowed: () => !c() || o?.anonymousAllowed == !0,
818
- sendCheckin(m) {
819
- return u() ? (f?.checkin(m), b({
820
- siteKey: n.siteKey,
821
- consentGiven: !0,
822
- context: Ae(e(), m, location.href, window.innerWidth),
823
- reaction: X[m.answer]
824
- })) : Promise.resolve("dropped");
825
- },
826
- sendSignal(m) {
827
- return !x.canSignal() || !u() ? Promise.resolve("dropped") : b(Te(n.siteKey, e(), m, location.href, window.innerWidth));
828
- }
829
- });
830
- n.noTelemetry || (f = we(i, n.siteKey, x)), x.subscribe(j);
831
- let F, N = !1, w;
832
- const E = (m) => {
833
- const A = m.available ? "on" : m.reason;
834
- if (!(N || A === w)) {
835
- w = A;
836
- try {
837
- n.onHelpStatus?.(m);
838
- } catch {
839
- }
840
- }
841
- };
842
- return x.subscribe(() => {
843
- w !== void 0 && x.state.view === "disabled" && E({ available: !1, reason: "disabled" });
844
- }), Promise.all([x.probe(), v]).then(() => {
845
- if (!N) {
846
- if (x.state.view === "disabled") return E({ available: !1, reason: "disabled" });
847
- E(o?.helpAudience == "reviewers" && !n.reviewerToken ? { available: !1, reason: "audience" } : { available: !0 }), C = !0, j(), F = t(S, x, {
848
- consentText: () => v.then((m) => m?.consentText || ne)
849
- });
850
- }
851
- }), {
852
- unmount(m) {
853
- N = !0, x.close(), f?.stop(m), z.stop(m), F?.destroy(), I.dispose(), g.remove(), a?.then((A) => A.dispose());
854
- },
855
- contextChanged: () => {
856
- x.refreshHighlight(), z.contextChanged();
857
- }
858
- };
859
- }
860
- const $e = (n, e) => qe(n, () => oe(e()), Fe);
861
- export {
862
- le as HelpClient,
863
- ue as HelpController,
864
- xe as Highlighter,
865
- ce as MAX_REQUEST_CHARS,
866
- De as PANEL_CSS,
867
- Ae as checkinContext,
868
- ve as findAnchor,
869
- B as guideStepContext,
870
- H as isHelpDisabled,
871
- $e as mount,
872
- qe as mountHelp,
873
- Ne as pageContext,
874
- me as placeholderView,
875
- $ as searchGuides,
876
- Te as signalRequest,
877
- pe as toView
878
- };