@knocklabs/client 0.21.10 → 0.21.12

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.
@@ -1,87 +1,35 @@
1
- var C = Object.defineProperty;
2
- var w = (a, e, s) => e in a ? C(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
3
- var h = (a, e, s) => w(a, typeof e != "symbol" ? e + "" : e, s);
4
- import { Store as R } from "@tanstack/store";
1
+ var _ = Object.defineProperty;
2
+ var C = (u, e, s) => e in u ? _(u, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : u[e] = s;
3
+ var h = (u, e, s) => C(u, typeof e != "symbol" ? e + "" : e, s);
4
+ import { Store as I } from "@tanstack/store";
5
5
  import { URLPattern as A } from "urlpattern-polyfill";
6
- import { byKey as S, mockDefaultGroup as P, formatFilters as b, formatState as v, checkStateIfThrottled as _, formatGroupStage as m, DEFAULT_GROUP_KEY as D, getToolbarRunConfigFromUrl as K, newUrl as L, predicateUrlRules as T, predicateUrlPatterns as $, findDefaultGroup as O } from "./helpers.mjs";
7
- import { SelectionResult as F } from "./types.mjs";
8
- const U = 50, N = 30 * 1e3, q = 3, f = {
9
- GUIDE_KEY: "knock_guide_key",
10
- PREVIEW_SESSION_ID: "knock_preview_session_id"
11
- }, y = "knock_guide_debug", p = () => {
6
+ import { byKey as y, mockDefaultGroup as E, formatFilters as G, formatState as S, checkStateIfThrottled as b, formatGroupStage as p, DEFAULT_GROUP_KEY as R, getToolbarRunConfigFromUrl as T, newUrl as $, predicateUrlRules as L, predicateUrlPatterns as w, findDefaultGroup as F } from "./helpers.mjs";
7
+ import { SelectionResult as P } from "./types.mjs";
8
+ const D = 50, K = 30 * 1e3, O = 3, f = () => {
12
9
  if (typeof window < "u")
13
10
  return window;
14
- }, j = (a) => `/v1/users/${a}/guides`, I = () => {
15
- const a = p();
16
- if (!a || !a.location)
17
- return { forcedGuideKey: null, previewSessionId: null };
18
- const e = new URLSearchParams(a.location.search), s = e.get(f.GUIDE_KEY), t = e.get(
19
- f.PREVIEW_SESSION_ID
20
- );
21
- if (s || t) {
22
- if (a.localStorage)
23
- try {
24
- const n = {
25
- forcedGuideKey: s,
26
- previewSessionId: t
27
- };
28
- a.localStorage.setItem(y, JSON.stringify(n));
29
- } catch {
30
- }
31
- return {
32
- forcedGuideKey: s,
33
- previewSessionId: t
34
- };
35
- }
36
- let i = null, r = null;
37
- if (a.localStorage)
38
- try {
39
- const n = a.localStorage.getItem(y);
40
- if (n) {
41
- const u = B(n);
42
- i = u.forcedGuideKey, r = u.previewSessionId;
43
- }
44
- } catch {
45
- }
46
- return {
47
- forcedGuideKey: i,
48
- previewSessionId: r
49
- };
50
- }, B = (a) => {
51
- try {
52
- const e = JSON.parse(a);
53
- return {
54
- forcedGuideKey: (e == null ? void 0 : e.forcedGuideKey) ?? null,
55
- previewSessionId: (e == null ? void 0 : e.previewSessionId) ?? null
56
- };
57
- } catch {
58
- return {
59
- forcedGuideKey: null,
60
- previewSessionId: null
61
- };
62
- }
63
- }, E = (a, e, s) => {
64
- const t = new F(), i = O(a.guideGroups);
11
+ }, U = (u) => `/v1/users/${u}/guides`, v = (u, e, s) => {
12
+ const t = new P(), i = F(u.guideGroups);
65
13
  if (!i) return t;
66
- const r = i.display_sequence, n = a.location;
67
- for (const [u, o] of r.entries()) {
68
- const c = a.previewGuides[o] || a.guides[o];
69
- !c || !M(c, e, {
14
+ const r = i.display_sequence, n = u.location;
15
+ for (const [a, o] of r.entries()) {
16
+ const c = u.previewGuides[o] || u.guides[o];
17
+ !c || !q(c, e, {
70
18
  location: n,
71
- ineligibleGuides: a.ineligibleGuides,
72
- debug: a.debug
73
- }) || t.set(u, c);
19
+ ineligibleGuides: u.ineligibleGuides,
20
+ debug: u.debug
21
+ }) || t.set(a, c);
74
22
  }
75
23
  return t.metadata = { guideGroup: i, filters: e, ...s }, t;
76
- }, M = (a, e, { location: s, ineligibleGuides: t = {}, debug: i = {} }) => e.type && e.type !== a.type || e.key && e.key !== a.key ? !1 : i.focusedGuideKeys && Object.keys(i.focusedGuideKeys).length > 0 ? !!i.focusedGuideKeys[a.key] : i.forcedGuideKey ? i.forcedGuideKey === a.key : t[a.key] || !a.active || a.steps.every((n) => !!n.message.archived_at) ? !1 : Q(a, s), Q = (a, e) => {
77
- const s = e ? L(e) : void 0, t = a.activation_url_rules || [], i = a.activation_url_patterns || [];
24
+ }, q = (u, e, { location: s, ineligibleGuides: t = {}, debug: i = {} }) => e.type && e.type !== u.type || e.key && e.key !== u.key ? !1 : i.focusedGuideKeys && Object.keys(i.focusedGuideKeys).length > 0 ? !!i.focusedGuideKeys[u.key] : i.forcedGuideKey ? i.forcedGuideKey === u.key : t[u.key] || !u.active || u.steps.every((n) => !!n.message.archived_at) ? !1 : j(u, s), j = (u, e) => {
25
+ const s = e ? $(e) : void 0, t = u.activation_url_rules || [], i = u.activation_url_patterns || [];
78
26
  if (s && t.length > 0) {
79
- if (!T(s, t)) return !1;
80
- } else if (s && i.length > 0 && !$(s, i))
27
+ if (!L(s, t)) return !1;
28
+ } else if (s && i.length > 0 && !w(s, i))
81
29
  return !1;
82
30
  return !0;
83
31
  };
84
- class z {
32
+ class J {
85
33
  constructor(e, s, t = {}, i = {}) {
86
34
  h(this, "store");
87
35
  // Phoenix channels for real time guide updates over websocket
@@ -93,8 +41,7 @@ class z {
93
41
  "guide.updated",
94
42
  "guide.removed",
95
43
  "guide_group.added",
96
- "guide_group.updated",
97
- "guide.live_preview_updated"
44
+ "guide_group.updated"
98
45
  ]);
99
46
  h(this, "subscribeRetryCount", 0);
100
47
  // Original history methods to monkey patch, or restore in cleanups.
@@ -108,45 +55,30 @@ class z {
108
55
  // Define as an arrow func property to always bind this to the class instance.
109
56
  h(this, "handleLocationChange", () => {
110
57
  this.knock.log("[Guide] .handleLocationChange");
111
- const e = p();
58
+ const e = f();
112
59
  if (!(e != null && e.location)) return;
113
60
  const s = e.location.href;
114
- if (this.store.state.location === s) return;
115
- if (this.knock.log(`[Guide] Detected a location change: ${s}`), !this.options.trackDebugParams) {
116
- this.setLocation(s);
117
- return;
118
- }
119
- const t = this.store.state.debug || {}, i = I();
120
- this.setLocation(s, { debug: i }), this.checkDebugStateChanged(
121
- t,
122
- i
123
- ) && (this.knock.log(
124
- "[Guide] Debug state changed, refetching guides and resubscribing to the websocket channel"
125
- ), this.fetch(), this.subscribe());
61
+ this.store.state.location !== s && (this.knock.log(`[Guide] Detected a location change: ${s}`), this.setLocation(s));
126
62
  });
127
- var l;
63
+ var d;
128
64
  this.knock = e, this.channelId = s, this.targetParams = t, this.options = i;
129
65
  const {
130
66
  trackLocationFromWindow: r = !0,
131
- // TODO(KNO-11523): Remove once we ship guide toolbar v2, and offload as
132
- // much debugging specific logic and responsibilities to toolbar.
133
- trackDebugParams: n = !1,
134
- throttleCheckInterval: u = N
135
- } = i, o = p(), c = r ? (l = o == null ? void 0 : o.location) == null ? void 0 : l.href : void 0, d = n ? I() : void 0;
136
- this.store = new R({
67
+ throttleCheckInterval: n = K
68
+ } = i, a = f(), o = r ? (d = a == null ? void 0 : a.location) == null ? void 0 : d.href : void 0;
69
+ this.store = new I({
137
70
  guideGroups: [],
138
71
  guideGroupDisplayLogs: {},
139
72
  guides: {},
140
73
  ineligibleGuides: {},
141
74
  previewGuides: {},
142
75
  queries: {},
143
- location: c,
76
+ location: o,
144
77
  // Increment to update the state store and trigger re-selection.
145
- counter: 0,
146
- debug: d
78
+ counter: 0
147
79
  });
148
- const { socket: g } = this.knock.client();
149
- this.socket = g, this.socketChannelTopic = `guides:${s}`, r && this.listenForLocationChangesFromWindow(), u && this.startCounterInterval(u), this.knock.log("[Guide] Initialized a guide client");
80
+ const { socket: c } = this.knock.client();
81
+ this.socket = c, this.socketChannelTopic = `guides:${s}`, r && this.listenForLocationChangesFromWindow(), n && this.startCounterInterval(n), this.knock.log("[Guide] Initialized a guide client");
150
82
  }
151
83
  incrementCounter() {
152
84
  this.knock.log("[Guide] Incrementing the counter"), this.store.setState((e) => ({ ...e, counter: e.counter + 1 }));
@@ -177,23 +109,23 @@ class z {
177
109
  const n = await this.knock.user.getGuides(this.channelId, s);
178
110
  r = { status: "ok" };
179
111
  const {
180
- entries: u,
112
+ entries: a,
181
113
  guide_groups: o,
182
114
  guide_group_display_logs: c,
183
115
  ineligible_guides: d
184
116
  } = n;
185
- this.stage && this.clearGroupStage(), this.knock.log("[Guide] Loading fetched guides"), this.store.setState((g) => ({
186
- ...g,
187
- guideGroups: (o == null ? void 0 : o.length) > 0 ? o : [P(u)],
117
+ this.stage && this.clearGroupStage(), this.knock.log("[Guide] Loading fetched guides"), this.store.setState((l) => ({
118
+ ...l,
119
+ guideGroups: (o == null ? void 0 : o.length) > 0 ? o : [E(a)],
188
120
  guideGroupDisplayLogs: c || {},
189
- guides: S(u.map((l) => this.localCopy(l))),
190
- ineligibleGuides: S(d || []),
191
- queries: { ...g.queries, [t]: r }
121
+ guides: y(a.map((k) => this.localCopy(k))),
122
+ ineligibleGuides: y(d || []),
123
+ queries: { ...l.queries, [t]: r }
192
124
  }));
193
125
  } catch (n) {
194
- r = { status: "error", error: n }, this.store.setState((u) => ({
195
- ...u,
196
- queries: { ...u.queries, [t]: r }
126
+ r = { status: "error", error: n }, this.store.setState((a) => ({
127
+ ...a,
128
+ queries: { ...a.queries, [t]: r }
197
129
  }));
198
130
  }
199
131
  return r;
@@ -220,7 +152,7 @@ class z {
220
152
  })), this.socketChannel = t;
221
153
  }
222
154
  handleChannelJoinError() {
223
- if (this.subscribeRetryCount >= q) {
155
+ if (this.subscribeRetryCount >= O) {
224
156
  this.knock.log(
225
157
  `[Guide] Channel join max retry limit reached: ${this.subscribeRetryCount}`
226
158
  ), this.unsubscribe();
@@ -248,8 +180,6 @@ class z {
248
180
  case "guide_group.added":
249
181
  case "guide_group.updated":
250
182
  return this.addOrReplaceGuideGroup(e);
251
- case "guide.live_preview_updated":
252
- return this.updatePreviewGuide(e);
253
183
  default:
254
184
  return;
255
185
  }
@@ -266,28 +196,6 @@ class z {
266
196
  };
267
197
  });
268
198
  }
269
- exitDebugMode() {
270
- this.knock.log("[Guide] Exiting debug mode");
271
- const e = p();
272
- if (e != null && e.localStorage)
273
- try {
274
- e.localStorage.removeItem(y);
275
- } catch {
276
- }
277
- if (this.store.setState((s) => ({
278
- ...s,
279
- debug: {
280
- forcedGuideKey: null,
281
- previewSessionId: null,
282
- focusedGuideKeys: {}
283
- },
284
- previewGuides: {}
285
- // Clear preview guides when exiting debug mode
286
- })), e != null && e.location) {
287
- const s = new URL(e.location.href);
288
- (s.searchParams.has(f.GUIDE_KEY) || s.searchParams.has(f.PREVIEW_SESSION_ID)) && (s.searchParams.delete(f.GUIDE_KEY), s.searchParams.delete(f.PREVIEW_SESSION_ID), e.location.href = s.toString());
289
- }
290
- }
291
199
  setDebug(e) {
292
200
  var t;
293
201
  if (this.knock.log("[Guide] .setDebug()"), !this.knock.isAuthenticated()) {
@@ -326,7 +234,7 @@ class z {
326
234
  selectGuides(e, s = {}, t = {}) {
327
235
  var c;
328
236
  this.knock.log(
329
- `[Guide] .selectGuides (filters: ${b(s)}; state: ${v(e)})`
237
+ `[Guide] .selectGuides (filters: ${G(s)}; state: ${S(e)})`
330
238
  );
331
239
  const i = this.selectGuide(e, s, {
332
240
  ...t,
@@ -335,75 +243,75 @@ class z {
335
243
  }), { recordSelectQuery: r = !!((c = e.debug) != null && c.debugging) } = t, n = {
336
244
  limit: "all",
337
245
  opts: { ...t, recordSelectQuery: r }
338
- }, u = E(e, s, n);
339
- if (this.maybeRecordSelectResult(u), !i && !t.includeThrottled)
246
+ }, a = v(e, s, n);
247
+ if (this.maybeRecordSelectResult(a), !i && !t.includeThrottled)
340
248
  return [];
341
- const o = [...u.values()];
342
- if (!t.includeThrottled && _(e)) {
249
+ const o = [...a.values()];
250
+ if (!t.includeThrottled && b(e)) {
343
251
  const d = o.filter(
344
- (l) => l.bypass_global_group_limit
345
- ), g = o.length - d.length;
252
+ (k) => k.bypass_global_group_limit
253
+ ), l = o.length - d.length;
346
254
  return this.knock.log(
347
- `[Guide] Throttling ${g} guides from selection, and returning ${d.length} guides`
255
+ `[Guide] Throttling ${l} guides from selection, and returning ${d.length} guides`
348
256
  ), d;
349
257
  }
350
258
  return this.knock.log(`[Guide] Returning ${o.length} guides from selection`), o;
351
259
  }
352
260
  selectGuide(e, s = {}, t = {}) {
353
- var g, l, G;
261
+ var l, k, m;
354
262
  if (this.knock.log(
355
- `[Guide] .selectGuide (filters: ${b(s)}; state: ${v(e)})`
263
+ `[Guide] .selectGuide (filters: ${G(s)}; state: ${S(e)})`
356
264
  ), Object.keys(e.guides).length === 0 && Object.keys(e.previewGuides).length === 0) {
357
265
  this.knock.log("[Guide] Exiting selection (no guides)");
358
266
  return;
359
267
  }
360
268
  this.stage || (this.stage = this.openGroupStage());
361
- const { recordSelectQuery: i = !!((g = e.debug) != null && g.debugging) } = t, r = {
269
+ const { recordSelectQuery: i = !!((l = e.debug) != null && l.debugging) } = t, r = {
362
270
  limit: "one",
363
271
  opts: { ...t, recordSelectQuery: i }
364
- }, n = E(e, s, r);
272
+ }, n = v(e, s, r);
365
273
  if (this.maybeRecordSelectResult(n), n.size === 0) {
366
274
  this.knock.log("[Guide] Selection found zero result");
367
275
  return;
368
276
  }
369
- const [u, o] = [...n][0];
277
+ const [a, o] = [...n][0];
370
278
  if (this.knock.log(
371
279
  `[Guide] Selection found: \`${o.key}\` (total: ${n.size})`
372
280
  ), o.bypass_global_group_limit)
373
281
  return this.knock.log(`[Guide] Returning the unthrottled guide: ${o.key}`), o;
374
- const c = (G = (l = e.debug) == null ? void 0 : l.focusedGuideKeys) == null ? void 0 : G[o.key], d = !t.includeThrottled && _(e);
282
+ const c = (m = (k = e.debug) == null ? void 0 : k.focusedGuideKeys) == null ? void 0 : m[o.key], d = !t.includeThrottled && b(e);
375
283
  switch (this.stage.status) {
376
284
  case "open": {
377
- this.knock.log(`[Guide] Adding to the group stage: ${o.key}`), this.stage.ordered[u] = o.key;
285
+ this.knock.log(`[Guide] Adding to the group stage: ${o.key}`), this.stage.ordered[a] = o.key;
378
286
  return;
379
287
  }
380
288
  case "patch": {
381
- if (this.knock.log(`[Guide] Patching the group stage: ${o.key}`), this.stage.ordered[u] = o.key, c)
289
+ if (this.knock.log(`[Guide] Patching the group stage: ${o.key}`), this.stage.ordered[a] = o.key, c)
382
290
  return this.knock.log(
383
- `[Guide] Focused to return \`${o.key}\` (stage: ${m(this.stage)})`
291
+ `[Guide] Focused to return \`${o.key}\` (stage: ${p(this.stage)})`
384
292
  ), o;
385
293
  if (d) {
386
294
  this.knock.log(`[Guide] Throttling the selected guide: ${o.key}`);
387
295
  return;
388
296
  }
389
- const k = this.stage.resolved === o.key ? o : void 0;
297
+ const g = this.stage.resolved === o.key ? o : void 0;
390
298
  return this.knock.log(
391
- `[Guide] Returning \`${k == null ? void 0 : k.key}\` (stage: ${m(this.stage)})`
392
- ), k;
299
+ `[Guide] Returning \`${g == null ? void 0 : g.key}\` (stage: ${p(this.stage)})`
300
+ ), g;
393
301
  }
394
302
  case "closed": {
395
303
  if (c)
396
304
  return this.knock.log(
397
- `[Guide] Focused to return \`${o.key}\` (stage: ${m(this.stage)})`
305
+ `[Guide] Focused to return \`${o.key}\` (stage: ${p(this.stage)})`
398
306
  ), o;
399
307
  if (d) {
400
308
  this.knock.log(`[Guide] Throttling the selected guide: ${o.key}`);
401
309
  return;
402
310
  }
403
- const k = this.stage.resolved === o.key ? o : void 0;
311
+ const g = this.stage.resolved === o.key ? o : void 0;
404
312
  return this.knock.log(
405
- `[Guide] Returning \`${k == null ? void 0 : k.key}\` (stage: ${m(this.stage)})`
406
- ), k;
313
+ `[Guide] Returning \`${g == null ? void 0 : g.key}\` (stage: ${p(this.stage)})`
314
+ ), g;
407
315
  }
408
316
  }
409
317
  }
@@ -413,18 +321,18 @@ class z {
413
321
  if (!e.metadata) return;
414
322
  const { opts: s, filters: t, limit: i } = e.metadata;
415
323
  if (!s.recordSelectQuery || !t.key && !t.type || !this.stage || this.stage.status === "closed") return;
416
- const r = this.stage.results.key || {};
324
+ const r = this.stage.results.byKey || {};
417
325
  t.key && (r[t.key] = {
418
326
  ...r[t.key] || {},
419
327
  [i]: e
420
328
  });
421
- const n = this.stage.results.type || {};
329
+ const n = this.stage.results.byType || {};
422
330
  t.type && (n[t.type] = {
423
331
  ...n[t.type] || {},
424
332
  [i]: e
425
333
  }), this.stage = {
426
334
  ...this.stage,
427
- results: { key: r, type: n }
335
+ results: { byKey: r, byType: n }
428
336
  };
429
337
  }
430
338
  getStage() {
@@ -433,7 +341,7 @@ class z {
433
341
  openGroupStage() {
434
342
  this.knock.log("[Guide] Opening a new group stage");
435
343
  const {
436
- orderResolutionDuration: e = U
344
+ orderResolutionDuration: e = D
437
345
  } = this.options, s = setTimeout(() => {
438
346
  this.closePendingGroupStage(), this.incrementCounter();
439
347
  }, e);
@@ -582,7 +490,7 @@ class z {
582
490
  // Get the next unarchived step.
583
491
  getStep() {
584
492
  var i, r, n;
585
- return ((i = s.store.state.debug) == null ? void 0 : i.forcedGuideKey) === this.key || (n = (r = s.store.state.debug) == null ? void 0 : r.focusedGuideKeys) != null && n[this.key] ? this.steps[0] : this.steps.find((u) => !u.message.archived_at);
493
+ return ((i = s.store.state.debug) == null ? void 0 : i.forcedGuideKey) === this.key || (n = (r = s.store.state.debug) == null ? void 0 : r.focusedGuideKeys) != null && n[this.key] ? this.steps[0] : this.steps.find((a) => !a.message.archived_at);
586
494
  },
587
495
  // Check whether any of its steps have an engagement timestamp.
588
496
  hasEngagement() {
@@ -598,8 +506,8 @@ class z {
598
506
  markAsSeen() {
599
507
  return s.markAsSeen(t, this);
600
508
  },
601
- markAsInteracted({ metadata: u } = {}) {
602
- return s.markAsInteracted(t, this, u);
509
+ markAsInteracted({ metadata: a } = {}) {
510
+ return s.markAsInteracted(t, this, a);
603
511
  },
604
512
  markAsArchived() {
605
513
  return s.markAsArchived(t, this);
@@ -630,7 +538,7 @@ class z {
630
538
  formatQueryKey(e) {
631
539
  const t = Object.keys(e).sort().map(
632
540
  (r) => `${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`
633
- ).join("&"), i = j(this.knock.userId);
541
+ ).join("&"), i = U(this.knock.userId);
634
542
  return t ? `${i}?${t}` : i;
635
543
  }
636
544
  setStepMessageAttrs(e, s, t) {
@@ -638,11 +546,11 @@ class z {
638
546
  return t.archived_at && this.clearGroupStage(), this.store.setState((r) => {
639
547
  let n = r.guides[e];
640
548
  if (!n) return r;
641
- const u = n.steps.map((d) => (d.ref !== s || (d.message = { ...d.message, ...t }, i = d), d));
642
- n = i ? { ...n, steps: u } : n;
549
+ const a = n.steps.map((d) => (d.ref !== s || (d.message = { ...d.message, ...t }, i = d), d));
550
+ n = i ? { ...n, steps: a } : n;
643
551
  const o = { ...r.guides, [n.key]: n }, c = t.archived_at && !n.bypass_global_group_limit ? {
644
552
  ...r.guideGroupDisplayLogs,
645
- [D]: t.archived_at
553
+ [R]: t.archived_at
646
554
  } : r.guideGroupDisplayLogs;
647
555
  return { ...r, guides: o, guideGroupDisplayLogs: c };
648
556
  }), i;
@@ -677,31 +585,19 @@ class z {
677
585
  this.patchClosedGroupStage(), this.store.setState((s) => {
678
586
  const t = [e.guide_group], i = e.guide_group.display_sequence_unthrottled || [], r = e.guide_group.display_sequence_throttled || [];
679
587
  let n = s.guides;
680
- return n = i.reduce((u, o) => {
681
- if (!u[o]) return u;
682
- const c = { ...u[o], bypass_global_group_limit: !0 };
683
- return { ...u, [o]: c };
684
- }, n), n = r.reduce((u, o) => {
685
- if (!u[o]) return u;
686
- const c = { ...u[o], bypass_global_group_limit: !1 };
687
- return { ...u, [o]: c };
588
+ return n = i.reduce((a, o) => {
589
+ if (!a[o]) return a;
590
+ const c = { ...a[o], bypass_global_group_limit: !0 };
591
+ return { ...a, [o]: c };
592
+ }, n), n = r.reduce((a, o) => {
593
+ if (!a[o]) return a;
594
+ const c = { ...a[o], bypass_global_group_limit: !1 };
595
+ return { ...a, [o]: c };
688
596
  }, n), { ...s, guides: n, guideGroups: t };
689
597
  });
690
598
  }
691
- updatePreviewGuide({ data: e }) {
692
- const s = this.localCopy(e.guide);
693
- this.store.setState((t) => {
694
- const i = { ...t.previewGuides, [s.key]: s };
695
- return { ...t, previewGuides: i };
696
- });
697
- }
698
- // Returns whether debug params have changed. For guide key, we only check
699
- // presence since the exact value has no impact on fetch/subscribe
700
- checkDebugStateChanged(e, s) {
701
- return !!e.forcedGuideKey != !!s.forcedGuideKey || e.previewSessionId !== s.previewSessionId;
702
- }
703
599
  listenForLocationChangesFromWindow() {
704
- const e = p();
600
+ const e = f();
705
601
  if (e != null && e.history && (e != null && e.addEventListener)) {
706
602
  e.addEventListener("popstate", this.handleLocationChange), e.addEventListener("hashchange", this.handleLocationChange);
707
603
  const s = e.history.pushState, t = e.history.replaceState;
@@ -724,17 +620,16 @@ class z {
724
620
  );
725
621
  }
726
622
  removeLocationChangeEventListeners() {
727
- const e = p();
623
+ const e = f();
728
624
  !(e != null && e.history) || !(e != null && e.removeEventListener) || (e.removeEventListener("popstate", this.handleLocationChange), e.removeEventListener("hashchange", this.handleLocationChange), this.pushStateFn && (e.history.pushState = this.pushStateFn, this.pushStateFn = void 0), this.replaceStateFn && (e.history.replaceState = this.replaceStateFn, this.replaceStateFn = void 0));
729
625
  }
730
626
  static getToolbarRunConfigFromUrl() {
731
- return K();
627
+ return T();
732
628
  }
733
629
  }
734
630
  export {
735
- f as DEBUG_QUERY_PARAMS,
736
- z as KnockGuideClient,
737
- Q as checkActivatable,
738
- j as guidesApiRootPath
631
+ J as KnockGuideClient,
632
+ j as checkActivatable,
633
+ U as guidesApiRootPath
739
634
  };
740
635
  //# sourceMappingURL=client.mjs.map