@knocklabs/react 0.11.4 → 0.11.5

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 (48) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js +1 -1
  4. package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js.map +1 -1
  5. package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js +2 -0
  6. package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js.map +1 -0
  7. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js +1 -1
  8. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js.map +1 -1
  9. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js +1 -1
  10. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js.map +1 -1
  11. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js +1 -1
  12. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js.map +1 -1
  13. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js +1 -1
  14. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js.map +1 -1
  15. package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.js +2 -0
  16. package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.js.map +1 -0
  17. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js +1 -1
  18. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
  19. package/dist/esm/index.mjs +98 -97
  20. package/dist/esm/index.mjs.map +1 -1
  21. package/dist/esm/modules/guide/components/Toolbar/KnockButton.mjs +14 -8
  22. package/dist/esm/modules/guide/components/Toolbar/KnockButton.mjs.map +1 -1
  23. package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs +20 -0
  24. package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs.map +1 -0
  25. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +26 -11
  26. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
  27. package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs +46 -16
  28. package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs.map +1 -1
  29. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +48 -30
  30. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
  31. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +53 -36
  32. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
  33. package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs +74 -0
  34. package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs.map +1 -0
  35. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +73 -88
  36. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
  37. package/dist/types/modules/guide/components/Toolbar/KnockButton.d.ts +2 -1
  38. package/dist/types/modules/guide/components/Toolbar/KnockButton.d.ts.map +1 -1
  39. package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts +9 -0
  40. package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts.map +1 -0
  41. package/dist/types/modules/guide/components/Toolbar/V2/GuideContextDetails.d.ts.map +1 -1
  42. package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts.map +1 -1
  43. package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
  44. package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
  45. package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts +26 -0
  46. package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts.map +1 -0
  47. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
  48. package/package.json +4 -3
@@ -1,120 +1,105 @@
1
1
  import { checkStateIfThrottled as p, checkActivatable as y } from "@knocklabs/client";
2
2
  import { useGuideContext as _, useStore as b } from "@knocklabs/react-core";
3
- const g = (e) => e.reduce((r, s) => ({
4
- ...r,
3
+ const g = (e) => e.reduce((t, s) => ({
4
+ ...t,
5
5
  [s.key]: s
6
- }), {}), v = (e, r, s, n) => {
7
- var u, t, o, a, l, c, d, f;
8
- const i = !!((a = (o = (t = (u = n.key) == null ? void 0 : u.one) == null ? void 0 : t.metadata) == null ? void 0 : o.opts) != null && a.includeThrottled) || !!((f = (d = (c = (l = n.key) == null ? void 0 : l.all) == null ? void 0 : c.metadata) == null ? void 0 : d.opts) != null && f.includeThrottled);
9
- return e.bypass_global_group_limit ? "returned" : e.key === s.resolved ? r.throttled && !i ? "throttled" : "returned" : "queried";
10
- }, k = (e, r, s, n) => {
11
- var t, o, a, l;
12
- const i = !!((l = (a = (o = (t = n.type) == null ? void 0 : t.one) == null ? void 0 : o.metadata) == null ? void 0 : a.opts) != null && l.includeThrottled), u = n.type.one;
6
+ }), {}), v = (e, t, s, r) => {
7
+ var u, n, o, l, a, c, d, f;
8
+ const i = !!((l = (o = (n = (u = r.key) == null ? void 0 : u.one) == null ? void 0 : n.metadata) == null ? void 0 : o.opts) != null && l.includeThrottled) || !!((f = (d = (c = (a = r.key) == null ? void 0 : a.all) == null ? void 0 : c.metadata) == null ? void 0 : d.opts) != null && f.includeThrottled);
9
+ return e.bypass_global_group_limit ? "returned" : e.key === s.resolved ? t.throttled && !i ? "throttled" : "returned" : "queried";
10
+ }, h = (e, t, s, r) => {
11
+ var n, o, l, a;
12
+ const i = !!((a = (l = (o = (n = r.type) == null ? void 0 : n.one) == null ? void 0 : o.metadata) == null ? void 0 : l.opts) != null && a.includeThrottled), u = r.type.one;
13
13
  if (u.size === 0)
14
14
  return "queried";
15
15
  if (e.bypass_global_group_limit) {
16
16
  const d = [...u.values()][0];
17
17
  return e.key !== d.key ? "queried" : "returned";
18
18
  }
19
- return e.key === s.resolved ? r.throttled && !i ? "throttled" : "returned" : "queried";
20
- }, h = (e, r, s, n) => {
21
- var l, c, d, f;
22
- const i = n.type.all;
19
+ return e.key === s.resolved ? t.throttled && !i ? "throttled" : "returned" : "queried";
20
+ }, G = (e, t, s, r) => {
21
+ var a, c, d, f;
22
+ const i = r.type.all;
23
23
  if (i.size === 0)
24
24
  return "queried";
25
- const u = [...i.values()], t = u[0], o = g(u);
26
- return (f = (d = (c = (l = n.type) == null ? void 0 : l.all) == null ? void 0 : c.metadata) == null ? void 0 : d.opts) != null && f.includeThrottled ? o[e.key] ? "returned" : "queried" : (t.bypass_global_group_limit || t.key === s.resolved) && o[e.key] ? r.throttled ? e.bypass_global_group_limit ? "returned" : "throttled" : "returned" : "queried";
27
- }, m = (e, r, s, n) => {
25
+ const u = [...i.values()], n = u[0], o = g(u);
26
+ return (f = (d = (c = (a = r.type) == null ? void 0 : a.all) == null ? void 0 : c.metadata) == null ? void 0 : d.opts) != null && f.includeThrottled ? o[e.key] ? "returned" : "queried" : (n.bypass_global_group_limit || n.key === s.resolved) && o[e.key] ? t.throttled ? e.bypass_global_group_limit ? "returned" : "throttled" : "returned" : "queried";
27
+ }, S = (e, t, s, r) => {
28
28
  var i, u;
29
- if (n.key)
30
- return v(e, r, s, n);
31
- if ((i = n.type) != null && i.all)
32
- return h(e, r, s, n);
33
- if ((u = n.type) != null && u.one)
34
- return k(e, r, s, n);
35
- }, G = (e, r, s) => {
29
+ if (r.key)
30
+ return v(e, t, s, r);
31
+ if ((i = r.type) != null && i.all)
32
+ return G(e, t, s, r);
33
+ if ((u = r.type) != null && u.one)
34
+ return h(e, t, s, r);
35
+ }, T = (e, t, s) => {
36
36
  if (!s || s.status === "open")
37
37
  return {
38
38
  status: void 0
39
39
  };
40
- const n = {
40
+ const r = {
41
41
  key: (s.results.key || {})[e.key],
42
42
  type: (s.results.type || {})[e.type]
43
43
  };
44
- if (!!!(n.key || n.type))
44
+ if (!!!(r.key || r.type))
45
45
  return {
46
46
  status: void 0
47
47
  };
48
- const u = m(e, r, s, n);
48
+ const u = S(e, t, s, r);
49
49
  return u ? {
50
50
  status: u,
51
- query: n
51
+ query: r
52
52
  } : {
53
53
  status: void 0
54
54
  };
55
- }, S = (e) => {
56
- switch (e.reason) {
57
- case "not_in_target_audience":
58
- case "target_conditions_not_met":
59
- return {
60
- targetable: {
61
- status: !1,
62
- reason: e.reason,
63
- message: e.message
64
- }
65
- };
66
- case "marked_as_archived":
67
- return {
68
- archived: {
69
- status: !0
70
- }
71
- };
72
- case "guide_not_active":
73
- return {
74
- active: {
75
- status: !1
76
- }
77
- };
78
- default:
79
- return;
80
- }
81
- }, T = ({
55
+ }, w = (e, t) => {
56
+ const s = {};
57
+ return ((t == null ? void 0 : t.reason) === "not_in_target_audience" || (t == null ? void 0 : t.reason) === "target_conditions_not_met") && (s.targetable = {
58
+ status: !1,
59
+ reason: t.reason,
60
+ message: t.message
61
+ }), ((t == null ? void 0 : t.reason) === "marked_as_archived" || (e.steps || []).every((r) => !!r.message.archived_at)) && (s.archived = {
62
+ status: !0
63
+ }), (t == null ? void 0 : t.reason) === "guide_not_active" && (s.active = {
64
+ status: !1
65
+ }), s;
66
+ }, B = ({
82
67
  active: e,
83
- targetable: r,
68
+ targetable: t,
84
69
  archived: s
85
- }) => !(!e.status || !r.status || s.status), w = ({
70
+ }) => !(!e.status || !t.status || s.status), I = ({
86
71
  activatable: e,
87
- selectable: r
88
- }) => !(!e.status || !r.status), B = (e, r, s) => {
72
+ selectable: t
73
+ }) => !(!e.status || !t.status), q = (e, t, s) => {
89
74
  const {
90
- ineligibleGuides: n,
75
+ ineligibleGuides: r,
91
76
  location: i
92
- } = r, u = n[e.key], t = u ? S(u) : void 0, o = {
77
+ } = t, u = r[e.key], n = w(e, u), o = {
93
78
  // isEligible:
94
- active: (t == null ? void 0 : t.active) || {
79
+ active: (n == null ? void 0 : n.active) || {
95
80
  status: !0
96
81
  },
97
- targetable: (t == null ? void 0 : t.targetable) || {
82
+ targetable: (n == null ? void 0 : n.targetable) || {
98
83
  status: !0
99
84
  },
100
- archived: (t == null ? void 0 : t.archived) || {
85
+ archived: (n == null ? void 0 : n.archived) || {
101
86
  status: !1
102
87
  },
103
88
  // isQualified:
104
89
  activatable: {
105
90
  status: y(e, i)
106
91
  },
107
- selectable: G(e, r, s)
108
- }, a = {
92
+ selectable: T(e, t, s)
93
+ }, l = {
109
94
  ...o,
110
- isEligible: T(o),
111
- isQualified: w(o)
95
+ isEligible: B(o),
96
+ isQualified: I(o)
112
97
  };
113
98
  return {
114
99
  ...e,
115
- annotation: a
100
+ annotation: l
116
101
  };
117
- }, I = (e) => ({
102
+ }, R = (e) => ({
118
103
  __typename: "UnknownGuide",
119
104
  key: e,
120
105
  active: !1,
@@ -126,41 +111,41 @@ const g = (e) => e.reduce((r, s) => ({
126
111
  status: void 0
127
112
  }
128
113
  }
129
- }), U = () => {
114
+ }), E = () => {
130
115
  var u;
131
116
  const {
132
117
  client: e
133
- } = _(), r = b(e.store, (t) => {
134
- const o = p(t);
118
+ } = _(), t = b(e.store, (n) => {
119
+ const o = p(n);
135
120
  return {
136
- location: t.location,
137
- guides: t.guides,
138
- guideGroups: t.guideGroups,
139
- ineligibleGuides: t.ineligibleGuides,
140
- debug: t.debug,
141
- counter: t.counter,
121
+ location: n.location,
122
+ guides: n.guides,
123
+ guideGroups: n.guideGroups,
124
+ ineligibleGuides: n.ineligibleGuides,
125
+ debug: n.debug,
126
+ counter: n.counter,
142
127
  throttled: o
143
128
  };
144
129
  });
145
- if (!((u = r.debug) != null && u.debugging))
130
+ if (!((u = t.debug) != null && u.debugging))
146
131
  return;
147
- const s = r.guideGroups[0];
132
+ const s = t.guideGroups[0];
148
133
  if (!s)
149
134
  return {
150
135
  error: "no_guide_group",
151
136
  guides: []
152
137
  };
153
- const n = e.getStage();
138
+ const r = e.getStage();
154
139
  return {
155
- guides: s.display_sequence.map((t) => {
156
- const o = r.guides[t];
157
- return o ? B(o, r, n) : I(t);
140
+ guides: s.display_sequence.map((n) => {
141
+ const o = t.guides[n];
142
+ return o ? q(o, t, r) : R(n);
158
143
  })
159
144
  };
160
- }, E = (e) => typeof e == "object" && e !== null && "__typename" in e && e.__typename === "UnknownGuide";
145
+ }, Q = (e) => typeof e == "object" && e !== null && "__typename" in e && e.__typename === "UnknownGuide";
161
146
  export {
162
- E as isUnknownGuide,
163
- w as resolveIsQualified,
164
- U as useInspectGuideClientStore
147
+ Q as isUnknownGuide,
148
+ I as resolveIsQualified,
149
+ E as useInspectGuideClientStore
165
150
  };
166
151
  //# sourceMappingURL=useInspectGuideClientStore.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInspectGuideClientStore.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideClientGroupStage,\n KnockGuideClientStoreState,\n KnockGuideIneligibilityMarker,\n KnockGuideSelectionResult,\n checkActivatable,\n checkStateIfThrottled,\n} from \"@knocklabs/client\";\nimport { useGuideContext, useStore } from \"@knocklabs/react-core\";\n\nconst byKey = <T extends { key: string }>(items: T[]) => {\n return items.reduce((acc, item) => ({ ...acc, [item.key]: item }), {});\n};\n\n/**\n * This is the main module that will house core logic for the toolbar. It hooks\n * into the guide client state store, extracts relevant data for debugging, and\n * transforms it into easily consumable data for the toolbar - namely\n * \"annotating\" guides for its various statuses to display.\n */\n\n// Active: `true` status = good\ntype ActiveStatus = {\n status: boolean;\n};\n\n// Targetable: `true` status = good\ntype TargetableStatusTrue = {\n status: true;\n};\ntype TargetableStatusFalse = {\n status: false;\n reason: string;\n message: string;\n};\ntype TargetableStatus = TargetableStatusTrue | TargetableStatusFalse;\n\ntype ActivatableStatus = {\n status: boolean;\n};\n\n// Archived: `false` status = good\ntype ArchivedStatus = {\n status: boolean;\n};\n\n// Selectable:\n// - \"returned\": Queried and resolved to return the guide from useGuide(s).\n// - \"throttled\": Queried and resolved but being throttled, so not yet returned.\n// - \"queried\": Queried but not resolved, because there are other higher\n// priority guides that are ahead of this guide in the query result.\n// - undefined: Not reachable with any of the given queries and filters.\ntype SelectionResultByLimit = {\n one?: KnockGuideSelectionResult;\n all?: KnockGuideSelectionResult;\n};\ntype SelectionResultByQuery = {\n key?: SelectionResultByLimit;\n type?: SelectionResultByLimit;\n};\ntype SelectableStatusPresent = {\n status: \"returned\" | \"throttled\" | \"queried\";\n query: SelectionResultByQuery;\n};\ntype SelectableStatusAbsent = {\n status: undefined;\n};\ntype SelectableStatus = SelectableStatusPresent | SelectableStatusAbsent;\n\ntype AnnotatedStatuses = {\n // Individual eligibility statuses:\n active: ActiveStatus;\n targetable: TargetableStatus;\n archived: ArchivedStatus;\n // Individual qualified statuses:\n activatable: ActivatableStatus;\n selectable: SelectableStatus;\n};\n\ntype GuideAnnotation = AnnotatedStatuses & {\n // Resolved eligibility based on active, targetable and archived statuses,\n // which are backend driven evaluation results that are exposed for debugging.\n isEligible: boolean;\n\n // Resolved display qualification based on an activatable status, which\n // informs \"when\" and \"where\" an eligible guide can be displayed to user.\n isQualified: boolean;\n};\n\nexport type AnnotatedGuide = KnockGuide & {\n annotation: GuideAnnotation;\n\n // Legacy fields, typed only to make tsc happy when we prune these out.\n activation_location_rules?: KnockGuide[\"activation_url_patterns\"];\n priority?: number;\n};\n\n// Exists and ordered in control but absent in switchboard (therefore not\n// included in the api response), which implies a newly created guide that has\n// never been published to switchboard.\nexport type UnknownGuide = {\n __typename: \"UnknownGuide\";\n key: KnockGuide[\"key\"];\n active: false;\n bypass_global_group_limit: false;\n annotation: {\n isEligible: false;\n isQualified: false;\n selectable: {\n status: undefined;\n };\n };\n};\n\nexport type InspectionResult = {\n guides: (AnnotatedGuide | UnknownGuide)[];\n error?: \"no_guide_group\";\n};\n\ntype StoreStateSnapshot = Pick<\n KnockGuideClientStoreState,\n | \"location\"\n | \"guides\"\n | \"guideGroups\"\n | \"ineligibleGuides\"\n | \"debug\"\n | \"counter\"\n> & {\n throttled: boolean;\n};\n\nconst inferSelectByKeyReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled =\n !!query.key?.one?.metadata?.opts?.includeThrottled ||\n !!query.key?.all?.metadata?.opts?.includeThrottled;\n\n // If unthrottled, then it should always be returned.\n if (guide.bypass_global_group_limit) {\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectOneByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled = !!query.type?.one?.metadata?.opts?.includeThrottled;\n\n const result = query.type!.one!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n // There may be multiple unthrottled guides of the same type, being queried\n // by type to return a single guide, for example: useGuide({ type: \"card\" }).\n //\n // So it is possible for an unthrottled guide to be shadowed by another\n // unthrottled guide of the same type with higher priority, so we need to\n // look at the query result to determine its return status.\n if (guide.bypass_global_group_limit) {\n const guides = [...result.values()];\n const first = guides[0]!;\n\n if (guide.key !== first.key) {\n // Being shadowed by another guide with higher priority.\n return \"queried\";\n }\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectAllByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const result = query.type!.all!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n const guides = [...result.values()];\n const first = guides[0]!;\n\n // Might want to consider moving this up to do once.\n const guidesByKey: Record<KnockGuide[\"key\"], KnockGuide> = byKey(guides);\n\n // If includeThrottled given, then expect all selected guides to be returned.\n const includeThrottled = !!query.type?.all?.metadata?.opts?.includeThrottled;\n if (includeThrottled) {\n return guidesByKey[guide.key] ? \"returned\" : \"queried\";\n }\n\n // If the first selected guide is unthrottled or resolved, then we should\n // have at minimum one guide to return, and potentially more based on whether\n // we are throttling currently and which other guides are unthrottled.\n if (first.bypass_global_group_limit || first.key === stage.resolved) {\n if (!guidesByKey[guide.key]) {\n return \"queried\";\n }\n if (snapshot.throttled) {\n return guide.bypass_global_group_limit ? \"returned\" : \"throttled\";\n }\n return \"returned\";\n }\n\n return \"queried\";\n};\n\nconst inferSelectReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n) => {\n // Querying by key can only return up to a max of one guide, regardless of\n // useGuide or useGuides, and should take precedence in status designation.\n if (query.key) {\n return inferSelectByKeyReturnStatus(guide, snapshot, stage, query);\n }\n\n if (query.type?.all) {\n return inferSelectAllByTypeReturnStatus(guide, snapshot, stage, query);\n }\n if (query.type?.one) {\n return inferSelectOneByTypeReturnStatus(guide, snapshot, stage, query);\n }\n\n // Should not happen but just for completeness.\n return undefined;\n};\n\nconst toSelectableStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): SelectableStatus => {\n if (!stage || stage.status === \"open\") {\n return { status: undefined };\n }\n\n const query = {\n key: (stage.results.key || {})[guide.key],\n type: (stage.results.type || {})[guide.type],\n };\n\n const queried = Boolean(query.key || query.type);\n if (!queried) {\n // No present query in the current location can select this guide.\n return { status: undefined };\n }\n\n const status = inferSelectReturnStatus(guide, snapshot, stage, query);\n if (!status) {\n return { status: undefined };\n }\n\n return { status, query };\n};\n\nconst toIneligibilityStatus = (\n marker: KnockGuideIneligibilityMarker,\n): Partial<AnnotatedStatuses> | undefined => {\n switch (marker.reason) {\n case \"not_in_target_audience\":\n case \"target_conditions_not_met\":\n return {\n targetable: {\n status: false,\n reason: marker.reason,\n message: marker.message,\n },\n };\n\n case \"marked_as_archived\":\n return {\n archived: {\n status: true,\n },\n };\n\n case \"guide_not_active\":\n return {\n active: {\n status: false,\n },\n };\n\n default:\n return undefined;\n }\n};\n\nconst resolveIsEligible = ({\n active,\n targetable,\n archived,\n}: AnnotatedStatuses) => {\n if (!active.status) return false;\n if (!targetable.status) return false;\n if (archived.status) return false;\n return true;\n};\n\nexport const resolveIsQualified = ({\n activatable,\n selectable,\n}: AnnotatedStatuses) => {\n if (!activatable.status) return false;\n if (!selectable.status) return false;\n return true;\n};\n\nconst annotateGuide = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): AnnotatedGuide => {\n const { ineligibleGuides, location } = snapshot;\n const marker = ineligibleGuides[guide.key];\n const ineligiblity = marker ? toIneligibilityStatus(marker) : undefined;\n\n const statuses: AnnotatedStatuses = {\n // isEligible:\n active: ineligiblity?.active || { status: true },\n targetable: ineligiblity?.targetable || { status: true },\n archived: ineligiblity?.archived || { status: false },\n // isQualified:\n activatable: { status: checkActivatable(guide, location) },\n selectable: toSelectableStatus(guide, snapshot, stage),\n };\n\n const annotation: GuideAnnotation = {\n ...statuses,\n isEligible: resolveIsEligible(statuses),\n isQualified: resolveIsQualified(statuses),\n };\n\n return {\n ...guide,\n annotation,\n };\n};\n\nconst newUnknownGuide = (key: KnockGuide[\"key\"]) =>\n ({\n __typename: \"UnknownGuide\",\n key,\n active: false,\n bypass_global_group_limit: false,\n annotation: {\n isEligible: false,\n isQualified: false,\n selectable: {\n status: undefined,\n },\n },\n }) as UnknownGuide;\n\nexport const useInspectGuideClientStore = (): InspectionResult | undefined => {\n const { client } = useGuideContext();\n\n // Extract a snapshot of the client store state for debugging.\n const snapshot: StoreStateSnapshot = useStore(client.store, (state) => {\n const throttled = checkStateIfThrottled(state);\n\n return {\n location: state.location,\n guides: state.guides,\n guideGroups: state.guideGroups,\n ineligibleGuides: state.ineligibleGuides,\n debug: state.debug,\n counter: state.counter,\n throttled,\n };\n });\n\n // Not in debugging session, so noop.\n if (!snapshot.debug?.debugging) {\n return undefined;\n }\n\n // Only for completeness, as there should always be a default group so this\n // should never happen.\n const defaultGroup = snapshot.guideGroups[0];\n if (!defaultGroup) {\n return {\n error: \"no_guide_group\",\n guides: [],\n };\n }\n\n const groupStage = client.getStage();\n\n // Annotate guides for various eligibility, activation and query statuses\n // that are useful for debugging purposes.\n const orderedGuides = defaultGroup.display_sequence.map((guideKey) => {\n const guide = snapshot.guides[guideKey];\n if (!guide) {\n return newUnknownGuide(guideKey);\n }\n\n return annotateGuide(guide, snapshot, groupStage);\n });\n\n return {\n guides: orderedGuides,\n };\n};\n\nexport const isUnknownGuide = (input: unknown): input is UnknownGuide =>\n typeof input === \"object\" &&\n input !== null &&\n \"__typename\" in input &&\n (input as UnknownGuide).__typename === \"UnknownGuide\";\n"],"names":["byKey","items","reduce","acc","item","key","inferSelectByKeyReturnStatus","guide","snapshot","stage","query","includeThrottled","one","metadata","opts","all","bypass_global_group_limit","resolved","throttled","inferSelectOneByTypeReturnStatus","type","result","size","first","values","inferSelectAllByTypeReturnStatus","guides","guidesByKey","inferSelectReturnStatus","toSelectableStatus","status","undefined","results","Boolean","toIneligibilityStatus","marker","reason","targetable","message","archived","active","resolveIsEligible","resolveIsQualified","activatable","selectable","annotateGuide","ineligibleGuides","location","ineligiblity","statuses","checkActivatable","annotation","isEligible","isQualified","newUnknownGuide","__typename","useInspectGuideClientStore","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","debugging","defaultGroup","error","groupStage","getStage","display_sequence","map","guideKey","isUnknownGuide","input"],"mappings":";;AAWA,MAAMA,IAAQ,CAA4BC,MACjCA,EAAMC,OAAO,CAACC,GAAKC,OAAU;AAAA,EAAE,GAAGD;AAAAA,EAAK,CAACC,EAAKC,GAAG,GAAGD;AAAK,IAAI,CAAA,CAAE,GAwHjEE,IAA+BA,CACnCC,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IACJ,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QAANK,gBAAAA,EAAWE,QAAXF,gBAAAA,EAAgBG,aAAhBH,gBAAAA,EAA0BI,SAA1BJ,QAAAA,EAAgCC,qBAClC,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QAANK,gBAAAA,EAAWK,QAAXL,gBAAAA,EAAgBG,aAAhBH,gBAAAA,EAA0BI,SAA1BJ,QAAAA,EAAgCC;AAGpC,SAAIJ,EAAMS,4BACD,aAILT,EAAMF,QAAQI,EAAMQ,WAClBT,EAASU,aAAa,CAACP,IAClB,cAEF,aAMF;AACT,GAEMQ,IAAmCA,CACvCZ,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IAAmB,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAMU,SAANV,gBAAAA,EAAYE,QAAZF,gBAAAA,EAAiBG,aAAjBH,gBAAAA,EAA2BI,SAA3BJ,QAAAA,EAAiCC,mBAEtDU,IAASX,EAAMU,KAAMR;AACvBS,MAAAA,EAAOC,SAAS;AACX,WAAA;AAST,MAAIf,EAAMS,2BAA2B;AAE7BO,UAAAA,IADS,CAAC,GAAGF,EAAOG,QAAQ,EACb,CAAC;AAElBjB,WAAAA,EAAMF,QAAQkB,EAAMlB,MAEf,YAEF;AAAA,EAAA;AAILE,SAAAA,EAAMF,QAAQI,EAAMQ,WAClBT,EAASU,aAAa,CAACP,IAClB,cAEF,aAMF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AAA,IAAe3D,EAASuD,YAAY,CAAC;AAC3C,MAAI,CAACI;AACI,WAAA;AAAA,MACLC,OAAO;AAAA,MACP1C,QAAQ,CAAA;AAAA,IACV;AAGI2C,QAAAA,IAAaZ,EAAOa,SAAS;AAa5B,SAAA;AAAA,IACL5C,QAVoByC,EAAaI,iBAAiBC,IAAKC,CAAaA,MAAA;AAC9DlE,YAAAA,IAAQC,EAASkB,OAAO+C,CAAQ;AACtC,aAAKlE,IAIEsC,EAActC,GAAOC,GAAU6D,CAAU,IAHvCf,EAAgBmB,CAAQ;AAAA,IAGe,CACjD;AAAA,EAID;AACF,GAEaC,IAAiBA,CAACC,MAC7B,OAAOA,KAAU,YACjBA,MAAU,QACV,gBAAgBA,KACfA,EAAuBpB,eAAe;"}
1
+ {"version":3,"file":"useInspectGuideClientStore.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideClientGroupStage,\n KnockGuideClientStoreState,\n KnockGuideIneligibilityMarker,\n KnockGuideSelectionResult,\n checkActivatable,\n checkStateIfThrottled,\n} from \"@knocklabs/client\";\nimport { useGuideContext, useStore } from \"@knocklabs/react-core\";\n\nconst byKey = <T extends { key: string }>(items: T[]) => {\n return items.reduce((acc, item) => ({ ...acc, [item.key]: item }), {});\n};\n\n/**\n * This is the main module that will house core logic for the toolbar. It hooks\n * into the guide client state store, extracts relevant data for debugging, and\n * transforms it into easily consumable data for the toolbar - namely\n * \"annotating\" guides for its various statuses to display.\n */\n\n// Active: `true` status = good\ntype ActiveStatus = {\n status: boolean;\n};\n\n// Targetable: `true` status = good\ntype TargetableStatusTrue = {\n status: true;\n};\ntype TargetableStatusFalse = {\n status: false;\n reason: string;\n message: string;\n};\ntype TargetableStatus = TargetableStatusTrue | TargetableStatusFalse;\n\ntype ActivatableStatus = {\n status: boolean;\n};\n\n// Archived: `false` status = good\ntype ArchivedStatus = {\n status: boolean;\n};\n\n// Selectable:\n// - \"returned\": Queried and resolved to return the guide from useGuide(s).\n// - \"throttled\": Queried and resolved but being throttled, so not yet returned.\n// - \"queried\": Queried but not resolved, because there are other higher\n// priority guides that are ahead of this guide in the query result.\n// - undefined: Not reachable with any of the given queries and filters.\ntype SelectionResultByLimit = {\n one?: KnockGuideSelectionResult;\n all?: KnockGuideSelectionResult;\n};\ntype SelectionResultByQuery = {\n key?: SelectionResultByLimit;\n type?: SelectionResultByLimit;\n};\ntype SelectableStatusPresent = {\n status: \"returned\" | \"throttled\" | \"queried\";\n query: SelectionResultByQuery;\n};\ntype SelectableStatusAbsent = {\n status: undefined;\n};\ntype SelectableStatus = SelectableStatusPresent | SelectableStatusAbsent;\n\ntype AnnotatedStatuses = {\n // Individual eligibility statuses:\n active: ActiveStatus;\n targetable: TargetableStatus;\n archived: ArchivedStatus;\n // Individual qualified statuses:\n activatable: ActivatableStatus;\n selectable: SelectableStatus;\n};\n\ntype GuideAnnotation = AnnotatedStatuses & {\n // Resolved eligibility based on active, targetable and archived statuses,\n // which are backend driven evaluation results that are exposed for debugging.\n isEligible: boolean;\n\n // Resolved display qualification based on an activatable status, which\n // informs \"when\" and \"where\" an eligible guide can be displayed to user.\n isQualified: boolean;\n};\n\nexport type AnnotatedGuide = KnockGuide & {\n annotation: GuideAnnotation;\n\n // Legacy fields, typed only to make tsc happy when we prune these out.\n activation_location_rules?: KnockGuide[\"activation_url_patterns\"];\n priority?: number;\n};\n\n// Exists and ordered in control but absent in switchboard (therefore not\n// included in the api response), which implies a newly created guide that has\n// never been published to switchboard.\nexport type UnknownGuide = {\n __typename: \"UnknownGuide\";\n key: KnockGuide[\"key\"];\n active: false;\n bypass_global_group_limit: false;\n annotation: {\n isEligible: false;\n isQualified: false;\n selectable: {\n status: undefined;\n };\n };\n};\n\nexport type InspectionResult = {\n guides: (AnnotatedGuide | UnknownGuide)[];\n error?: \"no_guide_group\";\n};\n\ntype StoreStateSnapshot = Pick<\n KnockGuideClientStoreState,\n | \"location\"\n | \"guides\"\n | \"guideGroups\"\n | \"ineligibleGuides\"\n | \"debug\"\n | \"counter\"\n> & {\n throttled: boolean;\n};\n\nconst inferSelectByKeyReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled =\n !!query.key?.one?.metadata?.opts?.includeThrottled ||\n !!query.key?.all?.metadata?.opts?.includeThrottled;\n\n // If unthrottled, then it should always be returned.\n if (guide.bypass_global_group_limit) {\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectOneByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled = !!query.type?.one?.metadata?.opts?.includeThrottled;\n\n const result = query.type!.one!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n // There may be multiple unthrottled guides of the same type, being queried\n // by type to return a single guide, for example: useGuide({ type: \"card\" }).\n //\n // So it is possible for an unthrottled guide to be shadowed by another\n // unthrottled guide of the same type with higher priority, so we need to\n // look at the query result to determine its return status.\n if (guide.bypass_global_group_limit) {\n const guides = [...result.values()];\n const first = guides[0]!;\n\n if (guide.key !== first.key) {\n // Being shadowed by another guide with higher priority.\n return \"queried\";\n }\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectAllByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const result = query.type!.all!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n const guides = [...result.values()];\n const first = guides[0]!;\n\n // Might want to consider moving this up to do once.\n const guidesByKey: Record<KnockGuide[\"key\"], KnockGuide> = byKey(guides);\n\n // If includeThrottled given, then expect all selected guides to be returned.\n const includeThrottled = !!query.type?.all?.metadata?.opts?.includeThrottled;\n if (includeThrottled) {\n return guidesByKey[guide.key] ? \"returned\" : \"queried\";\n }\n\n // If the first selected guide is unthrottled or resolved, then we should\n // have at minimum one guide to return, and potentially more based on whether\n // we are throttling currently and which other guides are unthrottled.\n if (first.bypass_global_group_limit || first.key === stage.resolved) {\n if (!guidesByKey[guide.key]) {\n return \"queried\";\n }\n if (snapshot.throttled) {\n return guide.bypass_global_group_limit ? \"returned\" : \"throttled\";\n }\n return \"returned\";\n }\n\n return \"queried\";\n};\n\nconst inferSelectReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n) => {\n // Querying by key can only return up to a max of one guide, regardless of\n // useGuide or useGuides, and should take precedence in status designation.\n if (query.key) {\n return inferSelectByKeyReturnStatus(guide, snapshot, stage, query);\n }\n\n if (query.type?.all) {\n return inferSelectAllByTypeReturnStatus(guide, snapshot, stage, query);\n }\n if (query.type?.one) {\n return inferSelectOneByTypeReturnStatus(guide, snapshot, stage, query);\n }\n\n // Should not happen but just for completeness.\n return undefined;\n};\n\nconst toSelectableStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): SelectableStatus => {\n if (!stage || stage.status === \"open\") {\n return { status: undefined };\n }\n\n const query = {\n key: (stage.results.key || {})[guide.key],\n type: (stage.results.type || {})[guide.type],\n };\n\n const queried = Boolean(query.key || query.type);\n if (!queried) {\n // No present query in the current location can select this guide.\n return { status: undefined };\n }\n\n const status = inferSelectReturnStatus(guide, snapshot, stage, query);\n if (!status) {\n return { status: undefined };\n }\n\n return { status, query };\n};\n\nconst toIneligibilityStatus = (\n guide: KnockGuide,\n marker?: KnockGuideIneligibilityMarker,\n): Partial<AnnotatedStatuses> => {\n const statuses: Partial<AnnotatedStatuses> = {};\n\n if (\n marker?.reason === \"not_in_target_audience\" ||\n marker?.reason === \"target_conditions_not_met\"\n ) {\n statuses.targetable = {\n status: false,\n reason: marker.reason,\n message: marker.message,\n };\n }\n\n if (\n marker?.reason === \"marked_as_archived\" ||\n (guide.steps || []).every((s) => !!s.message.archived_at)\n ) {\n statuses.archived = {\n status: true,\n };\n }\n\n if (marker?.reason === \"guide_not_active\") {\n statuses.active = {\n status: false,\n };\n }\n\n return statuses;\n};\n\nconst resolveIsEligible = ({\n active,\n targetable,\n archived,\n}: AnnotatedStatuses) => {\n if (!active.status) return false;\n if (!targetable.status) return false;\n if (archived.status) return false;\n return true;\n};\n\nexport const resolveIsQualified = ({\n activatable,\n selectable,\n}: AnnotatedStatuses) => {\n if (!activatable.status) return false;\n if (!selectable.status) return false;\n return true;\n};\n\nconst annotateGuide = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): AnnotatedGuide => {\n const { ineligibleGuides, location } = snapshot;\n const marker = ineligibleGuides[guide.key];\n const ineligiblity = toIneligibilityStatus(guide, marker);\n\n const statuses: AnnotatedStatuses = {\n // isEligible:\n active: ineligiblity?.active || { status: true },\n targetable: ineligiblity?.targetable || { status: true },\n archived: ineligiblity?.archived || { status: false },\n // isQualified:\n activatable: { status: checkActivatable(guide, location) },\n selectable: toSelectableStatus(guide, snapshot, stage),\n };\n\n const annotation: GuideAnnotation = {\n ...statuses,\n isEligible: resolveIsEligible(statuses),\n isQualified: resolveIsQualified(statuses),\n };\n\n return {\n ...guide,\n annotation,\n };\n};\n\nconst newUnknownGuide = (key: KnockGuide[\"key\"]) =>\n ({\n __typename: \"UnknownGuide\",\n key,\n active: false,\n bypass_global_group_limit: false,\n annotation: {\n isEligible: false,\n isQualified: false,\n selectable: {\n status: undefined,\n },\n },\n }) as UnknownGuide;\n\nexport const useInspectGuideClientStore = (): InspectionResult | undefined => {\n const { client } = useGuideContext();\n\n // Extract a snapshot of the client store state for debugging.\n const snapshot: StoreStateSnapshot = useStore(client.store, (state) => {\n const throttled = checkStateIfThrottled(state);\n\n return {\n location: state.location,\n guides: state.guides,\n guideGroups: state.guideGroups,\n ineligibleGuides: state.ineligibleGuides,\n debug: state.debug,\n counter: state.counter,\n throttled,\n };\n });\n\n // Not in debugging session, so noop.\n if (!snapshot.debug?.debugging) {\n return undefined;\n }\n\n // Only for completeness, as there should always be a default group so this\n // should never happen.\n const defaultGroup = snapshot.guideGroups[0];\n if (!defaultGroup) {\n return {\n error: \"no_guide_group\",\n guides: [],\n };\n }\n\n const groupStage = client.getStage();\n\n // Annotate guides for various eligibility, activation and query statuses\n // that are useful for debugging purposes.\n const orderedGuides = defaultGroup.display_sequence.map((guideKey) => {\n const guide = snapshot.guides[guideKey];\n if (!guide) {\n return newUnknownGuide(guideKey);\n }\n\n return annotateGuide(guide, snapshot, groupStage);\n });\n\n return {\n guides: orderedGuides,\n };\n};\n\nexport const isUnknownGuide = (input: unknown): input is UnknownGuide =>\n typeof input === \"object\" &&\n input !== null &&\n \"__typename\" in input &&\n (input as UnknownGuide).__typename === \"UnknownGuide\";\n"],"names":["byKey","items","reduce","acc","item","key","inferSelectByKeyReturnStatus","guide","snapshot","stage","query","includeThrottled","one","metadata","opts","all","bypass_global_group_limit","resolved","throttled","inferSelectOneByTypeReturnStatus","type","result","size","first","values","inferSelectAllByTypeReturnStatus","guides","guidesByKey","inferSelectReturnStatus","toSelectableStatus","status","undefined","results","Boolean","toIneligibilityStatus","marker","statuses","reason","targetable","message","steps","every","s","archived_at","archived","active","resolveIsEligible","resolveIsQualified","activatable","selectable","annotateGuide","ineligibleGuides","location","ineligiblity","checkActivatable","annotation","isEligible","isQualified","newUnknownGuide","__typename","useInspectGuideClientStore","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","debugging","defaultGroup","error","groupStage","getStage","display_sequence","map","guideKey","isUnknownGuide","input"],"mappings":";;AAWA,MAAMA,IAAQ,CAA4BC,MACjCA,EAAMC,OAAO,CAACC,GAAKC,OAAU;AAAA,EAAE,GAAGD;AAAAA,EAAK,CAACC,EAAKC,GAAG,GAAGD;AAAK,IAAI,CAAA,CAAE,GAwHjEE,IAA+BA,CACnCC,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IACJ,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QAANK,gBAAAA,EAAWE,QAAXF,gBAAAA,EAAgBG,aAAhBH,gBAAAA,EAA0BI,SAA1BJ,QAAAA,EAAgCC,qBAClC,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QAANK,gBAAAA,EAAWK,QAAXL,gBAAAA,EAAgBG,aAAhBH,gBAAAA,EAA0BI,SAA1BJ,QAAAA,EAAgCC;AAGpC,SAAIJ,EAAMS,4BACD,aAILT,EAAMF,QAAQI,EAAMQ,WAClBT,EAASU,aAAa,CAACP,IAClB,cAEF,aAMF;AACT,GAEMQ,IAAmCA,CACvCZ,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IAAmB,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAMU,SAANV,gBAAAA,EAAYE,QAAZF,gBAAAA,EAAiBG,aAAjBH,gBAAAA,EAA2BI,SAA3BJ,QAAAA,EAAiCC,mBAEtDU,IAASX,EAAMU,KAAMR;AACvBS,MAAAA,EAAOC,SAAS;AACX,WAAA;AAST,MAAIf,EAAMS,2BAA2B;AAE7BO,UAAAA,IADS,CAAC,GAAGF,EAAOG,QAAQ,EACb,CAAC;AAElBjB,WAAAA,EAAMF,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ME;AAAAA,MACnBhB,kBAAkBc,EAAMd;AAAAA,MACxBiB,OAAOH,EAAMG;AAAAA,MACbC,SAASJ,EAAMI;AAAAA,MACfnD,WAAAA;AAAAA,IACF;AAAA,EAAA,CACD;AAGG,MAAA,GAACV,IAAAA,EAAS4D,UAAT5D,QAAAA,EAAgB8D;AACZvC;AAKHwC,QAAAA,IAAe/D,EAAS2D,YAAY,CAAC;AAC3C,MAAI,CAACI;AACI,WAAA;AAAA,MACLC,OAAO;AAAA,MACP9C,QAAQ,CAAA;AAAA,IACV;AAGI+C,QAAAA,IAAaZ,EAAOa,SAAS;AAa5B,SAAA;AAAA,IACLhD,QAVoB6C,EAAaI,iBAAiBC,IAAKC,CAAaA,MAAA;AAC9DtE,YAAAA,IAAQC,EAASkB,OAAOmD,CAAQ;AACtC,aAAKtE,IAIE2C,EAAc3C,GAAOC,GAAUiE,CAAU,IAHvCf,EAAgBmB,CAAQ;AAAA,IAGe,CACjD;AAAA,EAID;AACF,GAEaC,IAAiBA,CAACC,MAC7B,OAAOA,KAAU,YACjBA,MAAU,QACV,gBAAgBA,KACfA,EAAuBpB,eAAe;"}
@@ -1,6 +1,7 @@
1
1
  type Props = {
2
2
  onClick: () => void;
3
+ positioned?: boolean;
3
4
  };
4
- export declare const KnockButton: ({ onClick }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const KnockButton: ({ onClick, positioned }: Props) => import("react/jsx-runtime").JSX.Element;
5
6
  export {};
6
7
  //# sourceMappingURL=KnockButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KnockButton.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/guide/components/Toolbar/KnockButton.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,CAAC;AAEtB,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,aAAa,KAAK,4CAyC7C,CAAC"}
1
+ {"version":3,"file":"KnockButton.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/guide/components/Toolbar/KnockButton.tsx"],"names":[],"mappings":"AAGA,OAAO,cAAc,CAAC;AAEtB,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,yBAAgC,KAAK,4CA2ChE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ export declare const DRAG_HANDLE_OVERHANG = 16;
3
+ type DragHandleProps = {
4
+ onPointerDown: (e: React.PointerEvent) => void;
5
+ isDragging: boolean;
6
+ };
7
+ export declare const DragHandle: ({ onPointerDown, isDragging }: DragHandleProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=DragHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/DragHandle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,KAAK,eAAe,GAAG;IACrB,aAAa,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,+BAA+B,eAAe,4CAmBxE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GuideContextDetails.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,+CA6F/B,CAAC"}
1
+ {"version":3,"file":"GuideContextDetails.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB,+CA2J/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GuideHoverCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideHoverCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAEtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,cAAc,GAAG,YAAY,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,sBAG5B,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,4CA6ChC,CAAC"}
1
+ {"version":3,"file":"GuideHoverCard.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideHoverCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAEtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,cAAc,GAAG,YAAY,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,sBAG5B,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,4CAmEhC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GuideRow.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,cAAc,EACd,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAQtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,YAAY,GAAG,cAAc,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,uBAAuB,KAAK,4CAkIpD,CAAC"}
1
+ {"version":3,"file":"GuideRow.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"names":[],"mappings":"AAkBA,OAAO,EACL,cAAc,EACd,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAQtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,YAAY,GAAG,cAAc,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,uBAAuB,KAAK,4CA2KpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"V2.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"names":[],"mappings":"AAQA,OAAO,eAAe,CAAC;AAwCvB,eAAO,MAAM,EAAE,sDAoFd,CAAC"}
1
+ {"version":3,"file":"V2.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"names":[],"mappings":"AASA,OAAO,eAAe,CAAC;AA0CvB,eAAO,MAAM,EAAE,sDA2Gd,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ type Position = {
3
+ top: number;
4
+ right: number;
5
+ };
6
+ type UseDraggableOptions = {
7
+ elementRef: React.RefObject<HTMLElement | null>;
8
+ initialPosition?: Position;
9
+ reclampDeps?: React.DependencyList;
10
+ /** Extra space to reserve beyond the element's right edge (px). */
11
+ rightPadding?: number;
12
+ };
13
+ type UseDraggableReturn = {
14
+ position: Position;
15
+ isDragging: boolean;
16
+ handlePointerDown: (e: React.PointerEvent) => void;
17
+ };
18
+ /**
19
+ * @param rightPadding Extra space to reserve on the right edge (e.g. for a
20
+ * drag handle that protrudes beyond the element). The element's left edge
21
+ * is clamped so that `elementWidth + rightPadding` stays within the viewport.
22
+ */
23
+ export declare function clampPosition(pos: Position, elementWidth: number, elementHeight: number, rightPadding?: number): Position;
24
+ export declare function useDraggable({ elementRef, initialPosition, reclampDeps, rightPadding, }: UseDraggableOptions): UseDraggableReturn;
25
+ export {};
26
+ //# sourceMappingURL=useDraggable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC;IACnC,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;CACpD,CAAC;AAIF;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,SAAI,GACf,QAAQ,CAcV;AAED,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,eAAkC,EAClC,WAAgB,EAChB,YAAgB,GACjB,EAAE,mBAAmB,GAAG,kBAAkB,CAwG1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"useInspectGuideClientStore.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,yBAAyB,EAG1B,MAAM,mBAAmB,CAAC;AAO3B;;;;;GAKG;AAGH,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF,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U,EAAE,eAAe,CAAC;IAG5B,yBAAyB,CAAC,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAKF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,cAAc,CAAC;IAC3B,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC;IACd,yBAAyB,EAAE,KAAK,CAAC;IACjC,UAAU,EAAE;QACV,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;QACnB,UAAU,EAAE;YACV,MAAM,EAAE,SAAS,CAAC;SACnB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAC;IAC1C,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AA6NF,eAAO,MAAM,kBAAkB,GAAI,8BAGhC,iBAAiB,YAInB,CAAC;AAgDF,eAAO,MAAM,0BAA0B,QAAO,gBAAgB,GAAG,SAiDhE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,YAIF,CAAC"}
1
+ {"version":3,"file":"useInspectGuideClientStore.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,yBAAyB,EAG1B,MAAM,mBAAmB,CAAC;AAO3B;;;;;GAKG;AAGH,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,IAAI,CAAC;CACd,CAAC;AACF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OA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AAG;IACzB,UAAU,EAAE,cAAc,CAAC;IAC3B,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC;IACd,yBAAyB,EAAE,KAAK,CAAC;IACjC,UAAU,EAAE;QACV,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;QACnB,UAAU,EAAE;YACV,MAAM,EAAE,SAAS,CAAC;SACnB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAC;IAC1C,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AA+NF,eAAO,MAAM,kBAAkB,GAAI,8BAGhC,iBAAiB,YAInB,CAAC;AAgDF,eAAO,MAAM,0BAA0B,QAAO,gBAAgB,GAAG,SAiDhE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,YAIF,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@knocklabs/react",
3
3
  "description": "A set of React components to build notification experiences powered by Knock",
4
4
  "author": "@knocklabs",
5
- "version": "0.11.4",
5
+ "version": "0.11.5",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",
8
8
  "module": "dist/esm/index.mjs",
@@ -72,11 +72,12 @@
72
72
  }
73
73
  },
74
74
  "dependencies": {
75
- "@knocklabs/client": "^0.21.2",
76
- "@knocklabs/react-core": "^0.13.2",
75
+ "@knocklabs/client": "^0.21.3",
76
+ "@knocklabs/react-core": "^0.13.3",
77
77
  "@popperjs/core": "^2.11.8",
78
78
  "@radix-ui/react-dialog": "^1.1.15",
79
79
  "@radix-ui/react-hover-card": "^1.1.15",
80
+ "@telegraph/button": "^0.4.0",
80
81
  "@telegraph/combobox": "^0.2.1",
81
82
  "@telegraph/icon": "^0.4.0",
82
83
  "@telegraph/layout": "^0.4.0",