@knocklabs/react 0.11.18 → 0.11.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/Kbd.js +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/Kbd.js.map +1 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs +89 -57
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/Kbd.mjs +14 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/Kbd.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +39 -46
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +69 -65
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/Kbd.d.ts +5 -0
- package/dist/types/modules/guide/components/Toolbar/V2/Kbd.d.ts.map +1 -0
- package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import { checkStateIfThrottled as
|
|
2
|
-
import { useGuideContext as
|
|
1
|
+
import { checkStateIfThrottled as p, checkActivatable as _ } from "@knocklabs/client";
|
|
2
|
+
import { useGuideContext as g, useStore as v } from "@knocklabs/react-core";
|
|
3
|
+
import * as h from "react";
|
|
3
4
|
import { FOCUS_ERRORS as y } from "./helpers.mjs";
|
|
4
|
-
const
|
|
5
|
+
const m = (e) => e.reduce((t, s) => ({
|
|
5
6
|
...t,
|
|
6
7
|
[s.key]: s
|
|
7
|
-
}), {}),
|
|
8
|
-
var u,
|
|
9
|
-
const
|
|
10
|
-
return e.bypass_global_group_limit ? "returned" : e.key === s.resolved ? t.throttled && !
|
|
11
|
-
},
|
|
12
|
-
var
|
|
13
|
-
const
|
|
8
|
+
}), {}), G = (e, t, s, r) => {
|
|
9
|
+
var u, i, n, a, l, f, o, c;
|
|
10
|
+
const d = !!((a = (n = (i = (u = r.byKey) == null ? void 0 : u.one) == null ? void 0 : i.metadata) == null ? void 0 : n.opts) != null && a.includeThrottled) || !!((c = (o = (f = (l = r.byKey) == null ? void 0 : l.all) == null ? void 0 : f.metadata) == null ? void 0 : o.opts) != null && c.includeThrottled);
|
|
11
|
+
return e.bypass_global_group_limit ? "returned" : e.key === s.resolved ? t.throttled && !d ? "throttled" : "returned" : "queried";
|
|
12
|
+
}, T = (e, t, s, r) => {
|
|
13
|
+
var i, n, a, l;
|
|
14
|
+
const d = !!((l = (a = (n = (i = r.byType) == null ? void 0 : i.one) == null ? void 0 : n.metadata) == null ? void 0 : a.opts) != null && l.includeThrottled), u = r.byType.one;
|
|
14
15
|
if (u.size === 0)
|
|
15
16
|
return "queried";
|
|
16
17
|
if (e.bypass_global_group_limit) {
|
|
17
|
-
const
|
|
18
|
-
return e.key !==
|
|
18
|
+
const o = [...u.values()][0];
|
|
19
|
+
return e.key !== o.key ? "queried" : "returned";
|
|
19
20
|
}
|
|
20
|
-
return e.key === s.resolved ? t.throttled && !
|
|
21
|
-
},
|
|
22
|
-
var
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
21
|
+
return e.key === s.resolved ? t.throttled && !d ? "throttled" : "returned" : "queried";
|
|
22
|
+
}, S = (e, t, s, r) => {
|
|
23
|
+
var l, f, o, c;
|
|
24
|
+
const d = r.byType.all;
|
|
25
|
+
if (d.size === 0)
|
|
25
26
|
return "queried";
|
|
26
|
-
const u = [...
|
|
27
|
-
return (
|
|
28
|
-
},
|
|
29
|
-
var
|
|
27
|
+
const u = [...d.values()], i = u[0], n = m(u);
|
|
28
|
+
return (c = (o = (f = (l = r.byType) == null ? void 0 : l.all) == null ? void 0 : f.metadata) == null ? void 0 : o.opts) != null && c.includeThrottled ? n[e.key] ? "returned" : "queried" : (i.bypass_global_group_limit || i.key === s.resolved) && n[e.key] ? t.throttled ? e.bypass_global_group_limit ? "returned" : "throttled" : "returned" : "queried";
|
|
29
|
+
}, U = (e, t, s, r) => {
|
|
30
|
+
var d, u;
|
|
30
31
|
if (r.byKey)
|
|
31
|
-
return h(e, t, s, r);
|
|
32
|
-
if ((i = r.byType) != null && i.all)
|
|
33
|
-
return m(e, t, s, r);
|
|
34
|
-
if ((u = r.byType) != null && u.one)
|
|
35
32
|
return G(e, t, s, r);
|
|
36
|
-
|
|
33
|
+
if ((d = r.byType) != null && d.all)
|
|
34
|
+
return S(e, t, s, r);
|
|
35
|
+
if ((u = r.byType) != null && u.one)
|
|
36
|
+
return T(e, t, s, r);
|
|
37
|
+
}, K = (e, t, s) => {
|
|
37
38
|
if (!s || s.status === "open")
|
|
38
39
|
return {
|
|
39
40
|
status: void 0
|
|
@@ -46,14 +47,14 @@ const v = (e) => e.reduce((t, s) => ({
|
|
|
46
47
|
return {
|
|
47
48
|
status: void 0
|
|
48
49
|
};
|
|
49
|
-
const u =
|
|
50
|
+
const u = U(e, t, s, r);
|
|
50
51
|
return u ? {
|
|
51
52
|
status: u,
|
|
52
53
|
query: r
|
|
53
54
|
} : {
|
|
54
55
|
status: void 0
|
|
55
56
|
};
|
|
56
|
-
},
|
|
57
|
+
}, R = (e, t) => {
|
|
57
58
|
const s = {};
|
|
58
59
|
return ((t == null ? void 0 : t.reason) === "not_in_target_audience" || (t == null ? void 0 : t.reason) === "target_conditions_not_met") && (s.targetable = {
|
|
59
60
|
status: !1,
|
|
@@ -64,18 +65,18 @@ const v = (e) => e.reduce((t, s) => ({
|
|
|
64
65
|
}), (t == null ? void 0 : t.reason) === "guide_not_active" && (s.active = {
|
|
65
66
|
status: !1
|
|
66
67
|
}), s;
|
|
67
|
-
},
|
|
68
|
+
}, q = ({
|
|
68
69
|
active: e,
|
|
69
70
|
targetable: t,
|
|
70
71
|
archived: s
|
|
71
|
-
}) => !(!e.status || !t.status || s.status),
|
|
72
|
+
}) => !(!e.status || !t.status || s.status), w = ({
|
|
72
73
|
activatable: e,
|
|
73
74
|
selectable: t
|
|
74
|
-
}) => !(!e.status || !t.status),
|
|
75
|
+
}) => !(!e.status || !t.status), C = (e, t, s, r) => {
|
|
75
76
|
const {
|
|
76
|
-
ineligibleGuides:
|
|
77
|
+
ineligibleGuides: d,
|
|
77
78
|
location: u
|
|
78
|
-
} = s,
|
|
79
|
+
} = s, i = d[e.key], n = R(e, i), a = {
|
|
79
80
|
// isEligible:
|
|
80
81
|
active: (n == null ? void 0 : n.active) || {
|
|
81
82
|
status: !0
|
|
@@ -90,18 +91,18 @@ const v = (e) => e.reduce((t, s) => ({
|
|
|
90
91
|
activatable: {
|
|
91
92
|
status: _(e, u)
|
|
92
93
|
},
|
|
93
|
-
selectable:
|
|
94
|
-
},
|
|
95
|
-
...
|
|
96
|
-
isEligible:
|
|
97
|
-
isQualified:
|
|
94
|
+
selectable: K(e, s, r)
|
|
95
|
+
}, l = {
|
|
96
|
+
...a,
|
|
97
|
+
isEligible: q(a),
|
|
98
|
+
isQualified: w(a)
|
|
98
99
|
};
|
|
99
100
|
return {
|
|
100
101
|
...e,
|
|
101
102
|
orderIndex: t,
|
|
102
|
-
annotation:
|
|
103
|
+
annotation: l
|
|
103
104
|
};
|
|
104
|
-
},
|
|
105
|
+
}, $ = (e, t) => ({
|
|
105
106
|
__typename: "UncommittedGuide",
|
|
106
107
|
key: e,
|
|
107
108
|
orderIndex: t,
|
|
@@ -117,12 +118,12 @@ const v = (e) => e.reduce((t, s) => ({
|
|
|
117
118
|
status: void 0
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
|
-
}),
|
|
121
|
-
var
|
|
121
|
+
}), L = (e) => {
|
|
122
|
+
var f;
|
|
122
123
|
const {
|
|
123
124
|
client: t
|
|
124
|
-
} =
|
|
125
|
-
const
|
|
125
|
+
} = g(), s = v(t.store, (o) => {
|
|
126
|
+
const c = p(o);
|
|
126
127
|
return {
|
|
127
128
|
location: o.location,
|
|
128
129
|
guides: o.guides,
|
|
@@ -131,58 +132,61 @@ const v = (e) => e.reduce((t, s) => ({
|
|
|
131
132
|
debug: o.debug,
|
|
132
133
|
counter: o.counter,
|
|
133
134
|
queries: o.queries,
|
|
134
|
-
throttled:
|
|
135
|
+
throttled: c
|
|
135
136
|
};
|
|
136
|
-
});
|
|
137
|
-
if (!((
|
|
137
|
+
}), r = h.useRef(void 0);
|
|
138
|
+
if (!((f = s.debug) != null && f.debugging))
|
|
138
139
|
return;
|
|
139
|
-
const
|
|
140
|
-
if (!
|
|
140
|
+
const d = Object.entries(s.queries)[0];
|
|
141
|
+
if (!d || d[1].status === "loading")
|
|
141
142
|
return {
|
|
142
143
|
status: "error",
|
|
143
144
|
error: "no_guides_fetched",
|
|
144
145
|
message: "Loading..."
|
|
145
146
|
};
|
|
146
|
-
const
|
|
147
|
-
if (!
|
|
147
|
+
const u = s.guideGroups[0];
|
|
148
|
+
if (!u)
|
|
148
149
|
return {
|
|
149
150
|
status: "error",
|
|
150
151
|
error: "no_guide_group",
|
|
151
152
|
message: "No guide group found"
|
|
152
153
|
};
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
const i = t.getStage(), n = !i || i.status === "open";
|
|
155
|
+
let a;
|
|
156
|
+
n && r.current ? a = r.current : (a = u.display_sequence.map((o, c) => {
|
|
157
|
+
const b = s.guides[o];
|
|
158
|
+
return b ? C(b, c, s, i) : $(o, c);
|
|
159
|
+
}), n || (r.current = a));
|
|
160
|
+
const l = Object.keys(e.focusedGuideKeys || {})[0];
|
|
161
|
+
if ((i == null ? void 0 : i.status) === "closed" && l) {
|
|
162
|
+
const o = a.find((c) => c.key === l);
|
|
159
163
|
if (!o)
|
|
160
164
|
return {
|
|
161
165
|
status: "error",
|
|
162
166
|
error: "focus_unknown_guide",
|
|
163
|
-
message: `Unable to display \`${
|
|
167
|
+
message: `Unable to display \`${l}\`, ${y.focusUnknownGuide.toLowerCase()}.`
|
|
164
168
|
};
|
|
165
|
-
if (
|
|
169
|
+
if (B(o))
|
|
166
170
|
return {
|
|
167
171
|
status: "error",
|
|
168
172
|
error: "focus_uncommitted_guide",
|
|
169
|
-
message: `Unable to display \`${
|
|
173
|
+
message: `Unable to display \`${l}\`, ${y.focusUncommittedGuide.toLowerCase()}.`
|
|
170
174
|
};
|
|
171
175
|
if (!o.annotation.selectable.status)
|
|
172
176
|
return {
|
|
173
177
|
status: "error",
|
|
174
178
|
error: "focus_unselectable_guide",
|
|
175
|
-
message: `Unable to display \`${
|
|
179
|
+
message: `Unable to display \`${l}\`, ${y.focusUnselectableGuide.toLowerCase()}.`
|
|
176
180
|
};
|
|
177
181
|
}
|
|
178
182
|
return {
|
|
179
183
|
status: "ok",
|
|
180
184
|
guides: a
|
|
181
185
|
};
|
|
182
|
-
},
|
|
186
|
+
}, B = (e) => typeof e == "object" && e !== null && "__typename" in e && e.__typename === "UncommittedGuide";
|
|
183
187
|
export {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
B as isUncommittedGuide,
|
|
189
|
+
w as resolveIsQualified,
|
|
190
|
+
L as useInspectGuideClientStore
|
|
187
191
|
};
|
|
188
192
|
//# 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 type ToolbarV2RunConfig,\n checkActivatable,\n checkStateIfThrottled,\n} from \"@knocklabs/client\";\nimport { useGuideContext, useStore } from \"@knocklabs/react-core\";\n\nimport { FOCUS_ERRORS } from \"./helpers\";\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 byKey?: SelectionResultByLimit;\n byType?: SelectionResultByLimit;\n};\ntype SelectableStatusPresent = {\n status: \"returned\" | \"throttled\" | \"queried\";\n query: SelectionResultByQuery;\n};\ntype SelectableStatusAbsent = {\n status: undefined;\n};\ntype SelectableStatus = SelectableStatusPresent | SelectableStatusAbsent;\n\nexport type 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 orderIndex: number;\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 UncommittedGuide = {\n __typename: \"UncommittedGuide\";\n orderIndex: number;\n key: KnockGuide[\"key\"];\n active: false;\n bypass_global_group_limit: false;\n annotation: {\n isEligible: false;\n isQualified: false;\n active: {\n status: false;\n };\n selectable: {\n status: undefined;\n };\n };\n};\n\nexport type InspectionResultOk = {\n status: \"ok\";\n guides: (AnnotatedGuide | UncommittedGuide)[];\n};\ntype InspectionResultError = {\n status: \"error\";\n error:\n | \"no_guides_fetched\"\n | \"no_guide_group\"\n | \"focus_unknown_guide\"\n | \"focus_uncommitted_guide\"\n | \"focus_unselectable_guide\";\n message: string;\n};\ntype InspectionResult = InspectionResultOk | InspectionResultError;\n\ntype StoreStateSnapshot = Pick<\n KnockGuideClientStoreState,\n | \"location\"\n | \"guides\"\n | \"guideGroups\"\n | \"ineligibleGuides\"\n | \"debug\"\n | \"counter\"\n | \"queries\"\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.byKey?.one?.metadata?.opts?.includeThrottled ||\n !!query.byKey?.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 =\n !!query.byType?.one?.metadata?.opts?.includeThrottled;\n\n const result = query.byType!.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.byType!.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 =\n !!query.byType?.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.byKey) {\n return inferSelectByKeyReturnStatus(guide, snapshot, stage, query);\n }\n\n if (query.byType?.all) {\n return inferSelectAllByTypeReturnStatus(guide, snapshot, stage, query);\n }\n if (query.byType?.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 byKey: (stage.results.byKey || {})[guide.key],\n byType: (stage.results.byType || {})[guide.type],\n };\n\n const queried = Boolean(query.byKey || query.byType);\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 orderIndex: number,\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 orderIndex,\n annotation,\n };\n};\n\nconst newUncommittedGuide = (key: KnockGuide[\"key\"], orderIndex: number) =>\n ({\n __typename: \"UncommittedGuide\",\n key,\n orderIndex,\n active: false,\n bypass_global_group_limit: false,\n annotation: {\n isEligible: false,\n isQualified: false,\n active: {\n status: false,\n },\n selectable: {\n status: undefined,\n },\n },\n }) as UncommittedGuide;\n\nexport const useInspectGuideClientStore = (\n runConfig: ToolbarV2RunConfig,\n): 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 queries: state.queries,\n throttled,\n };\n });\n\n // Not in debugging session, so noop.\n if (!snapshot.debug?.debugging) {\n return undefined;\n }\n\n // No recorded fetch requests, which implies an inflight request loading.\n const req = Object.entries(snapshot.queries)[0];\n if (!req || req[1].status === \"loading\") {\n return {\n status: \"error\",\n error: \"no_guides_fetched\",\n message: \"Loading...\",\n };\n }\n\n // Should always be a default group so this should never happen.\n const defaultGroup = snapshot.guideGroups[0];\n if (!defaultGroup) {\n return {\n status: \"error\",\n error: \"no_guide_group\",\n message: \"No guide group found\",\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, index) => {\n const guide = snapshot.guides[guideKey];\n if (!guide) {\n return newUncommittedGuide(guideKey, index);\n }\n\n return annotateGuide(guide, index, snapshot, groupStage);\n });\n\n // Check if the focused guide actually exists and is selectable on the page.\n const focusedGuideKey = Object.keys(runConfig.focusedGuideKeys || {})[0];\n if (groupStage?.status === \"closed\" && focusedGuideKey) {\n const foundGuide = orderedGuides.find((g) => g.key === focusedGuideKey);\n\n // No such guide exists for the given focused guide key.\n if (!foundGuide) {\n return {\n status: \"error\",\n error: \"focus_unknown_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUnknownGuide.toLowerCase()}.`,\n };\n }\n\n // This guide exists but has never been committed and published, so it is\n // not present in the API response.\n if (isUncommittedGuide(foundGuide)) {\n return {\n status: \"error\",\n error: \"focus_uncommitted_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUncommittedGuide.toLowerCase()}.`,\n };\n }\n\n // This guide exists and is present in the response, but it is not queried\n // in the current page so it is impossible to force render this guide.\n if (!foundGuide.annotation.selectable.status) {\n return {\n status: \"error\",\n error: \"focus_unselectable_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUnselectableGuide.toLowerCase()}.`,\n };\n }\n }\n\n return {\n status: \"ok\",\n guides: orderedGuides,\n };\n};\n\nexport const isUncommittedGuide = (input: unknown): input is UncommittedGuide =>\n typeof input === \"object\" &&\n input !== null &&\n \"__typename\" in input &&\n (input as UncommittedGuide).__typename === \"UncommittedGuide\";\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","byType","result","size","first","values","inferSelectAllByTypeReturnStatus","guides","guidesByKey","inferSelectReturnStatus","toSelectableStatus","status","undefined","results","type","Boolean","toIneligibilityStatus","marker","statuses","reason","targetable","message","steps","every","s","archived_at","archived","active","resolveIsEligible","resolveIsQualified","activatable","selectable","annotateGuide","orderIndex","ineligibleGuides","location","ineligiblity","checkActivatable","annotation","isEligible","isQualified","newUncommittedGuide","__typename","useInspectGuideClientStore","runConfig","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","queries","debugging","req","Object","entries","error","defaultGroup","groupStage","getStage","orderedGuides","display_sequence","map","guideKey","index","focusedGuideKey","keys","focusedGuideKeys","foundGuide","find","g","FOCUS_ERRORS","focusUnknownGuide","toLowerCase","isUncommittedGuide","focusUncommittedGuide","focusUnselectableGuide","input"],"mappings":";;;AAcA,MAAMA,IAAQ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AKF,QAAI,CAACL,EAAWjC,WAAWP,WAAWpB;AAC7B,aAAA;AAAA,QACLA,QAAQ;AAAA,QACRgD,OAAO;AAAA,QACPtC,SAAS,uBAAuB+C,CAAe,OAAOM,EAAaK,uBAAuBH,aAAa;AAAA,MACzG;AAAA,EACF;AAGK,SAAA;AAAA,IACLjE,QAAQ;AAAA,IACRJ,QAAQwD;AAAAA,EACV;AACF,GAEac,IAAqBA,CAACG,MACjC,OAAOA,KAAU,YACjBA,MAAU,QACV,gBAAgBA,KACfA,EAA2BtC,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 type ToolbarV2RunConfig,\n checkActivatable,\n checkStateIfThrottled,\n} from \"@knocklabs/client\";\nimport { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport * as React from \"react\";\n\nimport { FOCUS_ERRORS } from \"./helpers\";\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 byKey?: SelectionResultByLimit;\n byType?: SelectionResultByLimit;\n};\ntype SelectableStatusPresent = {\n status: \"returned\" | \"throttled\" | \"queried\";\n query: SelectionResultByQuery;\n};\ntype SelectableStatusAbsent = {\n status: undefined;\n};\ntype SelectableStatus = SelectableStatusPresent | SelectableStatusAbsent;\n\nexport type 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 orderIndex: number;\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 UncommittedGuide = {\n __typename: \"UncommittedGuide\";\n orderIndex: number;\n key: KnockGuide[\"key\"];\n active: false;\n bypass_global_group_limit: false;\n annotation: {\n isEligible: false;\n isQualified: false;\n active: {\n status: false;\n };\n selectable: {\n status: undefined;\n };\n };\n};\n\nexport type InspectionResultOk = {\n status: \"ok\";\n guides: (AnnotatedGuide | UncommittedGuide)[];\n};\ntype InspectionResultError = {\n status: \"error\";\n error:\n | \"no_guides_fetched\"\n | \"no_guide_group\"\n | \"focus_unknown_guide\"\n | \"focus_uncommitted_guide\"\n | \"focus_unselectable_guide\";\n message: string;\n};\ntype InspectionResult = InspectionResultOk | InspectionResultError;\n\ntype StoreStateSnapshot = Pick<\n KnockGuideClientStoreState,\n | \"location\"\n | \"guides\"\n | \"guideGroups\"\n | \"ineligibleGuides\"\n | \"debug\"\n | \"counter\"\n | \"queries\"\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.byKey?.one?.metadata?.opts?.includeThrottled ||\n !!query.byKey?.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 =\n !!query.byType?.one?.metadata?.opts?.includeThrottled;\n\n const result = query.byType!.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.byType!.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 =\n !!query.byType?.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.byKey) {\n return inferSelectByKeyReturnStatus(guide, snapshot, stage, query);\n }\n\n if (query.byType?.all) {\n return inferSelectAllByTypeReturnStatus(guide, snapshot, stage, query);\n }\n if (query.byType?.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 byKey: (stage.results.byKey || {})[guide.key],\n byType: (stage.results.byType || {})[guide.type],\n };\n\n const queried = Boolean(query.byKey || query.byType);\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 orderIndex: number,\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 orderIndex,\n annotation,\n };\n};\n\nconst newUncommittedGuide = (key: KnockGuide[\"key\"], orderIndex: number) =>\n ({\n __typename: \"UncommittedGuide\",\n key,\n orderIndex,\n active: false,\n bypass_global_group_limit: false,\n annotation: {\n isEligible: false,\n isQualified: false,\n active: {\n status: false,\n },\n selectable: {\n status: undefined,\n },\n },\n }) as UncommittedGuide;\n\nexport const useInspectGuideClientStore = (\n runConfig: ToolbarV2RunConfig,\n): 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 queries: state.queries,\n throttled,\n };\n });\n\n // Cache of the last settled orderedGuides, used to keep the toolbar stable\n // while the group stage is transiently cleared or re-opening.\n const orderedGuidesRef = React.useRef<\n (AnnotatedGuide | UncommittedGuide)[] | undefined\n >(undefined);\n\n // Not in debugging session, so noop.\n if (!snapshot.debug?.debugging) {\n return undefined;\n }\n\n // No recorded fetch requests, which implies an inflight request loading.\n const req = Object.entries(snapshot.queries)[0];\n if (!req || req[1].status === \"loading\") {\n return {\n status: \"error\",\n error: \"no_guides_fetched\",\n message: \"Loading...\",\n };\n }\n\n // Should always be a default group so this should never happen.\n const defaultGroup = snapshot.guideGroups[0];\n if (!defaultGroup) {\n return {\n status: \"error\",\n error: \"no_guide_group\",\n message: \"No guide group found\",\n };\n }\n\n const groupStage = client.getStage();\n\n // The stage is transient while it is undefined (just cleared) or \"open\"\n // (new stage with empty results); during these windows the computed\n // selectable status collapses to undefined for every guide. \"closed\" and\n // \"patch\" both preserve results, so we treat them as settled.\n const isTransient = !groupStage || groupStage.status === \"open\";\n\n // Annotate guides for various eligibility, activation and query statuses\n // that are useful for debugging purposes. Serve the last settled result\n // during transient windows to avoid flashing status dots.\n let orderedGuides: (AnnotatedGuide | UncommittedGuide)[];\n if (isTransient && orderedGuidesRef.current) {\n orderedGuides = orderedGuidesRef.current;\n } else {\n orderedGuides = defaultGroup.display_sequence.map((guideKey, index) => {\n const guide = snapshot.guides[guideKey];\n if (!guide) {\n return newUncommittedGuide(guideKey, index);\n }\n return annotateGuide(guide, index, snapshot, groupStage);\n });\n\n if (!isTransient) {\n orderedGuidesRef.current = orderedGuides;\n }\n }\n\n // Check if the focused guide actually exists and is selectable on the page.\n const focusedGuideKey = Object.keys(runConfig.focusedGuideKeys || {})[0];\n if (groupStage?.status === \"closed\" && focusedGuideKey) {\n const foundGuide = orderedGuides.find((g) => g.key === focusedGuideKey);\n\n // No such guide exists for the given focused guide key.\n if (!foundGuide) {\n return {\n status: \"error\",\n error: \"focus_unknown_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUnknownGuide.toLowerCase()}.`,\n };\n }\n\n // This guide exists but has never been committed and published, so it is\n // not present in the API response.\n if (isUncommittedGuide(foundGuide)) {\n return {\n status: \"error\",\n error: \"focus_uncommitted_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUncommittedGuide.toLowerCase()}.`,\n };\n }\n\n // This guide exists and is present in the response, but it is not queried\n // in the current page so it is impossible to force render this guide.\n if (!foundGuide.annotation.selectable.status) {\n return {\n status: \"error\",\n error: \"focus_unselectable_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUnselectableGuide.toLowerCase()}.`,\n };\n }\n }\n\n return {\n status: \"ok\",\n guides: orderedGuides,\n };\n};\n\nexport const isUncommittedGuide = (input: unknown): input is UncommittedGuide =>\n typeof input === \"object\" &&\n input !== null &&\n \"__typename\" in input &&\n (input as UncommittedGuide).__typename === \"UncommittedGuide\";\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","byType","result","size","first","values","inferSelectAllByTypeReturnStatus","guides","guidesByKey","inferSelectReturnStatus","toSelectableStatus","status","undefined","results","type","Boolean","toIneligibilityStatus","marker","statuses","reason","targetable","message","steps","every","s","archived_at","archived","active","resolveIsEligible","resolveIsQualified","activatable","selectable","annotateGuide","orderIndex","ineligibleGuides","location","ineligiblity","checkActivatable","annotation","isEligible","isQualified","newUncommittedGuide","__typename","useInspectGuideClientStore","runConfig","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","queries","orderedGuidesRef","React","useRef","debugging","req","Object","entries","error","defaultGroup","groupStage","getStage","isTransient","orderedGuides","current","display_sequence","map","guideKey","index","focusedGuideKey","keys","focusedGuideKeys","foundGuide","find","g","FOCUS_ERRORS","focusUnknownGuide","toLowerCase","isUncommittedGuide","focusUncommittedGuide","focusUnselectableGuide","input"],"mappings":";;;;AAeA,MAAMA,IAAQ,CAA4BC,MACjCA,EAAMC,OAAO,CAACC,GAAKC,OAAU;AAAA,EAAE,GAAGD;AAAAA,EAAK,CAACC,EAAKC,GAAG,GAAGD;AAAK,IAAI,CAAA,CAAE,GAyIjEE,IAA+BA,CACnCC,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IACJ,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAMV,UAANU,gBAAAA,EAAaE,QAAbF,gBAAAA,EAAkBG,aAAlBH,gBAAAA,EAA4BI,SAA5BJ,QAAAA,EAAkCC,qBACpC,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAMV,UAANU,gBAAAA,EAAaK,QAAbL,gBAAAA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,EACV;AACF,GAEae,IAAqBA,CAACG,MACjC,OAAOA,KAAU,YACjBA,MAAU,QACV,gBAAgBA,KACfA,EAA2B3C,eAAe;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusChin.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/FocusChin.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FocusChin.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/FocusChin.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAmFlE,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACtD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,0BAA0B,KAAK,mDAiIxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kbd.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/Kbd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,GAAG,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAc9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V2.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"names":[],"mappings":"AAoBA,OAAO,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"V2.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"names":[],"mappings":"AAoBA,OAAO,eAAe,CAAC;AAoDvB,KAAK,KAAK,GAAG;IACX,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,EAAE,GAAI,qCAAqC,KAAK,mDAqV5D,CAAC"}
|
|
@@ -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,EACzB,KAAK,kBAAkB,EAGxB,MAAM,mBAAmB,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,EACzB,KAAK,kBAAkB,EAGxB,MAAM,mBAAmB,CAAC;AAU3B;;;;;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,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,KAAK,gBAAgB,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAErE,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAQF,KAAK,sBAAsB,GAAG;IAC5B,GAAG,CAAC,EAAE,yBAAyB,CAAC;IAChC,GAAG,CAAC,EAAE,yBAAyB,CAAC;CACjC,CAAC;AACF,K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CAAC;QACF,UAAU,EAAE;YACV,MAAM,EAAE,SAAS,CAAC;SACnB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,CAAC,cAAc,GAAG,gBAAgB,CAAC,EAAE,CAAC;CAC/C,CAAC;AACF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EACD,mBAAmB,GACnB,gBAAgB,GAChB,qBAAqB,GACrB,yBAAyB,GACzB,0BAA0B,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,KAAK,gBAAgB,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAkOnE,eAAO,MAAM,kBAAkB,GAAI,8BAGhC,iBAAiB,YAInB,CAAC;AAsDF,eAAO,MAAM,0BAA0B,GACrC,WAAW,kBAAkB,KAC5B,gBAAgB,GAAG,SAqHrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,gBAIE,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.
|
|
5
|
+
"version": "0.11.19",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
8
8
|
"module": "dist/esm/index.mjs",
|