@knocklabs/react 0.11.6 → 0.11.7
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 +6 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js.map +1 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.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/useDraggable.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.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/index.mjs +98 -99
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs +18 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +15 -29
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +167 -49
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +51 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +128 -66
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs +35 -32
- package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +65 -54
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.d.ts +6 -0
- package/dist/types/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.d.ts.map +1 -0
- package/dist/types/modules/guide/components/Toolbar/V2/GuideContextDetails.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts +3 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts +5 -0
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.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/useDraggable.d.ts +2 -0
- package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +9 -3
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js +0 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js.map +0 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js +0 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js.map +0 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.js +0 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.js.map +0 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs +0 -20
- package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs.map +0 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs +0 -57
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs.map +0 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.mjs +0 -17
- package/dist/esm/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.mjs.map +0 -1
- package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts +0 -9
- package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts.map +0 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.d.ts +0 -8
- package/dist/types/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.d.ts.map +0 -1
|
@@ -1,55 +1,173 @@
|
|
|
1
|
-
import { useGuideContext as
|
|
2
|
-
import { Button as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useGuideContext as k, useStore as S } from "@knocklabs/react-core";
|
|
2
|
+
import { Button as _ } from "@telegraph/button";
|
|
3
|
+
import { Icon as x } from "@telegraph/icon";
|
|
4
|
+
import { Box as v, Stack as n } from "@telegraph/layout";
|
|
5
|
+
import { Tag as T } from "@telegraph/tag";
|
|
6
|
+
import { Tooltip as y } from "@telegraph/tooltip";
|
|
7
|
+
import { Text as g } from "@telegraph/typography";
|
|
8
|
+
import { Gauge as N } from "lucide-react";
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
import { GuideAnnotatedStatusDot as c } from "./GuideAnnotatedStatusDot.mjs";
|
|
11
|
+
import { GuideRowDetails as G } from "./GuideRowDetails.mjs";
|
|
12
|
+
import { isUnknownGuide as i } from "./useInspectGuideClientStore.mjs";
|
|
13
|
+
const E = ({
|
|
14
|
+
label: e,
|
|
15
|
+
color: o = "gray",
|
|
16
|
+
children: a
|
|
17
|
+
}) => /* @__PURE__ */ t.createElement(n, { direction: "row", align: "center", gap: "0_5", px: "1", height: "5", bg: "surface-2", rounded: "full", border: "px", borderColor: "gray-4" }, /* @__PURE__ */ t.createElement(g, { as: "span", size: "0", color: o, weight: "medium" }, e), a), C = (e) => {
|
|
18
|
+
if (i(e))
|
|
19
|
+
return {
|
|
20
|
+
color: "red",
|
|
21
|
+
label: "Inactive",
|
|
22
|
+
tooltip: "This guide has never been committed and published yet"
|
|
23
|
+
};
|
|
17
24
|
const {
|
|
18
|
-
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
25
|
+
annotation: o
|
|
26
|
+
} = e;
|
|
27
|
+
return o.active.status ? o.archived.status ? {
|
|
28
|
+
color: "red",
|
|
29
|
+
label: "Archived",
|
|
30
|
+
tooltip: "User has already dismissed this guide"
|
|
31
|
+
} : o.targetable.status ? o.selectable.status === void 0 ? {
|
|
32
|
+
color: "red",
|
|
33
|
+
label: "Not found",
|
|
34
|
+
tooltip: "No component that can query this guide was found"
|
|
35
|
+
} : o.activatable.status ? o.selectable.status === "queried" ? {
|
|
36
|
+
color: "gray",
|
|
37
|
+
label: "Queued",
|
|
38
|
+
tooltip: "This guide is queried but is not ready to display"
|
|
39
|
+
} : o.selectable.status === "throttled" ? {
|
|
40
|
+
color: "yellow",
|
|
41
|
+
label: "Throttled",
|
|
42
|
+
tooltip: "This guide is queried and ready to display, but throttled currently"
|
|
43
|
+
} : o.selectable.status === "returned" ? {
|
|
44
|
+
color: "blue",
|
|
45
|
+
label: "Display",
|
|
46
|
+
tooltip: "This guide is queried and ready to display"
|
|
47
|
+
} : {
|
|
48
|
+
color: "red",
|
|
49
|
+
label: "Unknown status",
|
|
50
|
+
tooltip: "Unknown status"
|
|
51
|
+
} : {
|
|
52
|
+
color: "red",
|
|
53
|
+
label: "Not activated",
|
|
54
|
+
tooltip: "This guide cannot be activated in the current location"
|
|
55
|
+
} : {
|
|
56
|
+
color: "red",
|
|
57
|
+
label: "Not targeted",
|
|
58
|
+
tooltip: o.targetable.message
|
|
47
59
|
} : {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
color: "red",
|
|
61
|
+
label: "Inactive",
|
|
62
|
+
tooltip: "This guide is inactive"
|
|
63
|
+
};
|
|
64
|
+
}, q = (e) => {
|
|
65
|
+
if (i(e))
|
|
66
|
+
return {
|
|
67
|
+
active: {
|
|
68
|
+
color: "gray"
|
|
69
|
+
},
|
|
70
|
+
archived: {
|
|
71
|
+
color: "gray"
|
|
72
|
+
},
|
|
73
|
+
targetable: {
|
|
74
|
+
color: "gray"
|
|
75
|
+
},
|
|
76
|
+
activatable: {
|
|
77
|
+
color: "gray"
|
|
78
|
+
},
|
|
79
|
+
selectable: {
|
|
80
|
+
color: "gray"
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const {
|
|
84
|
+
annotation: o
|
|
85
|
+
} = e, a = {
|
|
86
|
+
color: o.active.status ? "blue" : "red",
|
|
87
|
+
tooltip: `Active: ${o.active.status ? "Yes" : "No"}`
|
|
88
|
+
}, b = {
|
|
89
|
+
color: o.archived.status ? "red" : "blue",
|
|
90
|
+
tooltip: `Not archived: ${o.archived.status ? "No" : "Yes"}`
|
|
91
|
+
}, u = {
|
|
92
|
+
color: o.targetable.status ? "blue" : "red",
|
|
93
|
+
tooltip: `Targeted: ${o.targetable.status ? "Yes" : "No"}`
|
|
94
|
+
}, d = {
|
|
95
|
+
color: o.activatable.status ? "blue" : "red",
|
|
96
|
+
tooltip: `Activated: ${o.activatable.status ? "Yes" : "No"}`
|
|
97
|
+
};
|
|
98
|
+
let l;
|
|
99
|
+
switch (o.selectable.status) {
|
|
100
|
+
case "returned":
|
|
101
|
+
l = {
|
|
102
|
+
color: "blue",
|
|
103
|
+
tooltip: "Ready for display"
|
|
104
|
+
};
|
|
105
|
+
break;
|
|
106
|
+
case "throttled":
|
|
107
|
+
l = {
|
|
108
|
+
color: "yellow",
|
|
109
|
+
tooltip: "Throttled"
|
|
110
|
+
};
|
|
111
|
+
break;
|
|
112
|
+
case "queried":
|
|
113
|
+
l = {
|
|
114
|
+
color: "gray",
|
|
115
|
+
tooltip: "Queued"
|
|
116
|
+
};
|
|
117
|
+
break;
|
|
118
|
+
case void 0:
|
|
119
|
+
default:
|
|
120
|
+
l = {
|
|
121
|
+
color: "red",
|
|
122
|
+
tooltip: "Not found"
|
|
123
|
+
};
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
active: a,
|
|
128
|
+
archived: b,
|
|
129
|
+
targetable: u,
|
|
130
|
+
activatable: d,
|
|
131
|
+
selectable: l
|
|
132
|
+
};
|
|
133
|
+
}, Q = ({
|
|
134
|
+
guide: e,
|
|
135
|
+
orderIndex: o,
|
|
136
|
+
isExpanded: a,
|
|
137
|
+
onClick: b
|
|
138
|
+
}) => {
|
|
139
|
+
const {
|
|
140
|
+
client: u
|
|
141
|
+
} = k(), {
|
|
142
|
+
debugSettings: d
|
|
143
|
+
} = S(u.store, (m) => ({
|
|
144
|
+
debugSettings: m.debug || {}
|
|
145
|
+
})), [l, f] = t.useState(!1), h = d.focusedGuideKeys || {}, w = Object.keys(h).length > 0, s = !!h[e.key], r = q(e), p = C(e);
|
|
146
|
+
return /* @__PURE__ */ t.createElement(v, { rounded: "3", overflow: "hidden", border: "px", borderStyle: "solid", borderColor: a ? "gray-6" : "transparent", onMouseEnter: () => f(!0), onMouseLeave: () => f(!1), style: {
|
|
147
|
+
cursor: "pointer"
|
|
148
|
+
} }, /* @__PURE__ */ t.createElement(n, { h: "7", px: "1", gap: "1", align: "center", justify: "space-between", rounded: "3", overflow: "hidden", border: "px", borderStyle: "solid", borderColor: a ? "transparent" : s ? "gray-6" : l ? "gray-4" : "transparent", backgroundColor: a ? "surface-2" : s ? "gray-2" : l ? "surface-2" : "transparent", onClick: () => b(e.key) }, /* @__PURE__ */ t.createElement(n, { align: "center", gap: "1_5", style: {
|
|
149
|
+
minWidth: 0,
|
|
150
|
+
flex: 1
|
|
151
|
+
} }, /* @__PURE__ */ t.createElement(n, { w: "7", justify: "space-between", align: "center", gap: "0_5" }, /* @__PURE__ */ t.createElement(v, { w: "3" }, !e.bypass_global_group_limit && /* @__PURE__ */ t.createElement(x, { icon: N, size: "0", color: "gray", alt: "Subject to throttling" })), /* @__PURE__ */ t.createElement(g, { as: "span", size: "1", weight: "medium", color: e.bypass_global_group_limit ? "blue" : "default", style: {
|
|
152
|
+
flexShrink: 0
|
|
153
|
+
} }, o + 1)), /* @__PURE__ */ t.createElement(y, { label: `${e.key}${e.bypass_global_group_limit ? " (unthrottled)" : ""}` }, /* @__PURE__ */ t.createElement(g, { as: "code", size: "1", weight: "medium", color: "default", style: {
|
|
154
|
+
display: "block",
|
|
155
|
+
overflow: "hidden",
|
|
156
|
+
textOverflow: "ellipsis",
|
|
157
|
+
whiteSpace: "nowrap",
|
|
158
|
+
maxWidth: "200px"
|
|
159
|
+
} }, e.key))), /* @__PURE__ */ t.createElement(n, { align: "center", gap: "1_5", style: {
|
|
160
|
+
flexShrink: 0
|
|
161
|
+
} }, !w && /* @__PURE__ */ t.createElement(y, { label: p.tooltip }, /* @__PURE__ */ t.createElement(T, { size: "0", variant: "soft", color: p.color }, p.label)), /* @__PURE__ */ t.createElement(E, { label: "Elig:", color: i(e) ? "disabled" : e.annotation.isEligible ? "blue" : "gray" }, /* @__PURE__ */ t.createElement(c, { color: r.active.color, tooltip: r.active.tooltip }), /* @__PURE__ */ t.createElement(c, { color: r.archived.color, tooltip: r.archived.tooltip }), /* @__PURE__ */ t.createElement(c, { color: r.targetable.color, tooltip: r.targetable.tooltip })), /* @__PURE__ */ t.createElement(E, { label: "Vis:", color: i(e) ? "disabled" : e.annotation.isQualified && e.annotation.selectable.status === "returned" ? "blue" : "gray" }, /* @__PURE__ */ t.createElement(c, { color: r.activatable.color, tooltip: r.activatable.tooltip }), /* @__PURE__ */ t.createElement(c, { color: r.selectable.color, tooltip: r.selectable.tooltip })), /* @__PURE__ */ t.createElement(y, { label: i(e) || e.annotation.selectable.status === void 0 ? "No component found that can render this guide" : s ? "Unfocus this guide" : "Focus on this guide" }, /* @__PURE__ */ t.createElement(_, { size: "0", variant: s ? "solid" : "outline", color: s ? "blue" : "gray", disabled: i(e) || e.annotation.selectable.status === void 0, onClick: (m) => {
|
|
162
|
+
m.stopPropagation(), u.setDebug({
|
|
163
|
+
...d,
|
|
164
|
+
focusedGuideKeys: s ? {} : {
|
|
165
|
+
[e.key]: !0
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
} }, "Focus")))), a && /* @__PURE__ */ t.createElement(G, { guide: e }));
|
|
51
169
|
};
|
|
52
170
|
export {
|
|
53
|
-
|
|
171
|
+
Q as GuideRow
|
|
54
172
|
};
|
|
55
173
|
//# sourceMappingURL=GuideRow.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideRow.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tag } from \"@telegraph/tag\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport {\n CheckCircle2,\n CircleDashed,\n Code2,\n Eye,\n LocateFixed,\n Pin,\n UserCircle2,\n} from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { GuideHoverCard } from \"./GuideHoverCard\";\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst Row = ({ children }: React.PropsWithChildren) => (\n <Stack h=\"7\" px=\"2\" borderTop=\"px\" justify=\"space-between\" align=\"center\">\n {children}\n </Stack>\n);\n\ntype Props = {\n guide: UnknownGuide | AnnotatedGuide;\n orderIndex: number;\n};\n\nexport const GuideRow = ({ guide, orderIndex }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n\n const focusedGuideKeys = debugSettings.focusedGuideKeys || {};\n const hasFocus = Object.keys(focusedGuideKeys).length > 0;\n const isFocused = !!focusedGuideKeys[guide.key];\n\n return (\n <Row>\n <GuideHoverCard guide={guide}>\n <Stack h=\"6\" justify=\"flex-start\" align=\"center\" gap=\"2\">\n <Tag\n size=\"0\"\n variant=\"soft\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n >\n {orderIndex + 1}\n </Tag>\n <Text\n as=\"code\"\n size=\"1\"\n color={!hasFocus ? \"default\" : isFocused ? \"blue\" : \"disabled\"}\n >\n {guide.key}\n </Text>\n </Stack>\n </GuideHoverCard>\n\n <Stack justify=\"flex-end\">\n {!isUnknownGuide(guide) && (\n <>\n {guide.annotation.selectable.status !== undefined &&\n (!hasFocus || isFocused) && (\n <>\n <Tooltip\n label={\n isFocused ? \"Unfocus this guide\" : \"Focus on this guide\"\n }\n >\n <Button\n size=\"1\"\n variant=\"ghost\"\n color={isFocused ? \"blue\" : \"gray\"}\n leadingIcon={{ icon: Pin, alt: \"Focus\" }}\n onClick={() =>\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: isFocused\n ? {}\n : { [guide.key]: true },\n })\n }\n />\n </Tooltip>\n <Stack px=\"2\" align=\"center\">\n <Box h=\"3\" borderLeft=\"px\" borderColor=\"gray-6\" />\n </Stack>\n </>\n )}\n <Stack gap=\"1\">\n <Tooltip\n label={\n guide.annotation.selectable.status === \"returned\"\n ? \"This guide was queried and can display\"\n : guide.annotation.selectable.status === \"queried\"\n ? \"This guide was queried but cannot display\"\n : guide.annotation.selectable.status === \"throttled\"\n ? \"This guide was queried and can display but is throttled currently\"\n : \"No component is present in the current location to display this guide\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={\n guide.annotation.selectable.status === \"returned\"\n ? \"green\"\n : guide.annotation.selectable.status === \"queried\"\n ? \"gray\"\n : guide.annotation.selectable.status === \"throttled\"\n ? \"yellow\"\n : \"red\"\n }\n leadingIcon={{ icon: Code2, alt: \"Render\" }}\n />\n </Tooltip>\n <Tooltip\n label={\n guide.annotation.activatable.status\n ? \"This guide can be activated at the current location\"\n : \"This guide cannot be activated at the current location\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.activatable.status ? \"green\" : \"red\"}\n leadingIcon={{ icon: LocateFixed, alt: \"Target\" }}\n />\n </Tooltip>\n </Stack>\n <Stack px=\"2\" align=\"center\">\n <Box h=\"3\" borderLeft=\"px\" borderColor=\"gray-6\" />\n </Stack>\n </>\n )}\n <Stack gap=\"1\">\n {!isUnknownGuide(guide) && (\n <>\n <Tooltip\n label={\n guide.annotation.targetable.status\n ? \"This user is being targeted\"\n : guide.annotation.targetable.message\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.targetable.status ? \"green\" : \"red\"}\n leadingIcon={{ icon: UserCircle2, alt: \"Target\" }}\n />\n </Tooltip>\n <Tooltip\n label={\n guide.annotation.archived.status\n ? \"User has already dismissed this guide\"\n : \"User has not dismissed this guide\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.archived.status ? \"red\" : \"green\"}\n leadingIcon={{ icon: Eye, alt: \"Not archived\" }}\n />\n </Tooltip>\n </>\n )}\n <Tooltip\n label={\n isUnknownGuide(guide)\n ? \"This guide has never been committed and published yet\"\n : !guide.active\n ? \"This guide is not active\"\n : \"This guide is active\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.active ? \"green\" : \"red\"}\n leadingIcon={\n guide.active\n ? { icon: CheckCircle2, alt: \"Active\" }\n : { icon: CircleDashed, alt: \"Inactive\" }\n }\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Row>\n );\n};\n"],"names":["Row","children","React","Stack","GuideRow","guide","orderIndex","client","useGuideContext","debugSettings","useStore","store","state","debug","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","GuideHoverCard","Tag","bypass_global_group_limit","Text","isUnknownGuide","annotation","selectable","status","undefined","Tooltip","Button","icon","Pin","alt","setDebug","Box","Code2","activatable","LocateFixed","targetable","message","UserCircle2","archived","Eye","active","CheckCircle2","CircleDashed"],"mappings":";;;;;;;;;;AAwBA,MAAMA,IAAMA,CAAC;AAAA,EAAEC,UAAAA;AAAkC,MAC9C,gBAAAC,EAAA,cAAAC,GAAA,EAAM,GAAE,KAAI,IAAG,KAAI,WAAU,MAAK,SAAQ,iBAAgB,OAAM,SAAA,GAC9DF,CACH,GAQWG,IAAWA,CAAC;AAAA,EAAEC,OAAAA;AAAAA,EAAOC,YAAAA;AAAkB,MAAM;AAClD,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAC7B;AAAA,IAAEC,eAAAA;AAAAA,E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xB,gCACAvB,EAAMqB,WAAWc,WAAWC,WAGlC,gBAAAvC,EAAA,cAAC6B,GACC,EAAA,IAAG,KACH,MAAK,KACL,SAAQ,QACR,OAAO1B,EAAMqB,WAAWc,WAAWZ,SAAS,UAAU,OACtD,aAAa;AAAA,IAAEI,MAAMU;AAAAA,IAAaR,KAAK;AAAA,EAAA,EAAW,CAAA,CAEtD,GACC,gBAAAhC,EAAA,cAAA4B,GAAA,EACC,OACEzB,EAAMqB,WAAWiB,SAASf,SACtB,0CACA,oCAGN,GAAA,gBAAA1B,EAAA,cAAC6B,GACC,EAAA,IAAG,KACH,MAAK,KACL,SAAQ,QACR,OAAO1B,EAAMqB,WAAWiB,SAASf,SAAS,QAAQ,SAClD,aAAa;AAAA,IAAEI,MAAMY;AAAAA,IAAKV,KAAK;AAAA,EAAA,EAAiB,CAAA,CAEpD,CACF,GAED,gBAAAhC,EAAA,cAAA4B,GAAA,EACC,OACEL,EAAepB,CAAK,IAChB,0DACCA,EAAMwC,SAEL,yBADA,8BAIR,gBAAA3C,EAAA,cAAC6B,GACC,EAAA,IAAG,KACH,MAAK,KACL,SAAQ,QACR,OAAO1B,EAAMwC,SAAS,UAAU,OAChC,aACExC,EAAMwC,SACF;AAAA,IAAEb,MAAMc;AAAAA,IAAcZ,KAAK;AAAA,EAAA,IAC3B;AAAA,IAAEF,MAAMe;AAAAA,IAAcb,KAAK;AAAA,EAAA,EAChC,CAAA,CAEL,CACF,CACF,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"GuideRow.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tag } from \"@telegraph/tag\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { Gauge } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport { GuideRowDetails } from \"./GuideRowDetails\";\nimport {\n AnnotatedGuide,\n AnnotatedStatuses,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst Pill = ({\n label,\n color = \"gray\",\n children,\n}: {\n label: string;\n color?: StatusColor | \"disabled\";\n children: React.ReactNode;\n}) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n gap=\"0_5\"\n px=\"1\"\n height=\"5\"\n bg=\"surface-2\"\n rounded=\"full\"\n border=\"px\"\n borderColor=\"gray-4\"\n >\n <Text as=\"span\" size=\"0\" color={color} weight=\"medium\">\n {label}\n </Text>\n {children}\n </Stack>\n );\n};\n\ntype StatusSummary = {\n color: StatusColor;\n label: string;\n tooltip: string;\n};\n\nconst getStatusSummary = (\n guide: AnnotatedGuide | UnknownGuide,\n): StatusSummary => {\n if (isUnknownGuide(guide)) {\n return {\n color: \"red\",\n label: \"Inactive\",\n tooltip: \"This guide has never been committed and published yet\",\n };\n }\n\n const { annotation } = guide;\n\n if (!annotation.active.status) {\n return {\n color: \"red\",\n label: \"Inactive\",\n tooltip: \"This guide is inactive\",\n };\n }\n if (annotation.archived.status) {\n return {\n color: \"red\",\n label: \"Archived\",\n tooltip: \"User has already dismissed this guide\",\n };\n }\n if (!annotation.targetable.status) {\n return {\n color: \"red\",\n label: \"Not targeted\",\n tooltip: annotation.targetable.message,\n };\n }\n if (annotation.selectable.status === undefined) {\n return {\n color: \"red\",\n label: \"Not found\",\n tooltip: \"No component that can query this guide was found\",\n };\n }\n if (!annotation.activatable.status) {\n return {\n color: \"red\",\n label: \"Not activated\",\n tooltip: \"This guide cannot be activated in the current location\",\n };\n }\n if (annotation.selectable.status === \"queried\") {\n return {\n color: \"gray\",\n label: \"Queued\",\n tooltip: \"This guide is queried but is not ready to display\",\n };\n }\n if (annotation.selectable.status === \"throttled\") {\n return {\n color: \"yellow\",\n label: \"Throttled\",\n tooltip:\n \"This guide is queried and ready to display, but throttled currently\",\n };\n }\n if (annotation.selectable.status === \"returned\") {\n return {\n color: \"blue\",\n label: \"Display\",\n tooltip: \"This guide is queried and ready to display\",\n };\n }\n // Should never happen though.\n return { color: \"red\", label: \"Unknown status\", tooltip: \"Unknown status\" };\n};\n\ntype StatusDot = {\n color: StatusColor;\n tooltip?: string;\n};\n\nconst getStatusDots = (\n guide: AnnotatedGuide | UnknownGuide,\n): Record<keyof AnnotatedStatuses, StatusDot> => {\n if (isUnknownGuide(guide)) {\n return {\n active: { color: \"gray\" },\n archived: { color: \"gray\" },\n targetable: { color: \"gray\" },\n activatable: { color: \"gray\" },\n selectable: { color: \"gray\" },\n };\n }\n\n const { annotation } = guide;\n\n const active: StatusDot = {\n color: annotation.active.status ? \"blue\" : \"red\",\n tooltip: `Active: ${annotation.active.status ? \"Yes\" : \"No\"}`,\n };\n\n const archived: StatusDot = {\n color: !annotation.archived.status ? \"blue\" : \"red\",\n tooltip: `Not archived: ${!annotation.archived.status ? \"Yes\" : \"No\"}`,\n };\n\n const targetable: StatusDot = {\n color: annotation.targetable.status ? \"blue\" : \"red\",\n tooltip: `Targeted: ${annotation.targetable.status ? \"Yes\" : \"No\"}`,\n };\n\n const activatable: StatusDot = {\n color: annotation.activatable.status ? \"blue\" : \"red\",\n tooltip: `Activated: ${annotation.activatable.status ? \"Yes\" : \"No\"}`,\n };\n\n let selectable: StatusDot;\n switch (annotation.selectable.status) {\n case \"returned\":\n selectable = { color: \"blue\", tooltip: \"Ready for display\" };\n break;\n\n case \"throttled\":\n selectable = { color: \"yellow\", tooltip: \"Throttled\" };\n break;\n\n case \"queried\":\n selectable = { color: \"gray\", tooltip: \"Queued\" };\n break;\n\n case undefined:\n default:\n selectable = { color: \"red\", tooltip: \"Not found\" };\n break;\n }\n\n return { active, archived, targetable, activatable, selectable };\n};\n\ntype Props = {\n guide: UnknownGuide | AnnotatedGuide;\n orderIndex: number;\n isExpanded: boolean;\n onClick: (guideKey: string) => void;\n};\n\nexport const GuideRow = ({ guide, orderIndex, isExpanded, onClick }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n const [isHovered, setIsHovered] = React.useState(false);\n\n const focusedGuideKeys = debugSettings.focusedGuideKeys || {};\n const hasFocus = Object.keys(focusedGuideKeys).length > 0;\n const isFocused = !!focusedGuideKeys[guide.key];\n\n const dots = getStatusDots(guide);\n const summary = getStatusSummary(guide);\n\n return (\n <Box\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={isExpanded ? \"gray-6\" : \"transparent\"}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ cursor: \"pointer\" }}\n >\n <Stack\n h=\"7\"\n px=\"1\"\n gap=\"1\"\n align=\"center\"\n justify=\"space-between\"\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={\n isExpanded\n ? \"transparent\"\n : isFocused\n ? \"gray-6\"\n : isHovered\n ? \"gray-4\"\n : \"transparent\"\n }\n backgroundColor={\n isExpanded\n ? \"surface-2\"\n : isFocused\n ? \"gray-2\"\n : isHovered\n ? \"surface-2\"\n : \"transparent\"\n }\n onClick={() => onClick(guide.key)}\n >\n {/* Left section: order + key */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack w=\"7\" justify=\"space-between\" align=\"center\" gap=\"0_5\">\n <Box w=\"3\">\n {!guide.bypass_global_group_limit && (\n <Icon\n icon={Gauge}\n size=\"0\"\n color=\"gray\"\n alt=\"Subject to throttling\"\n />\n )}\n </Box>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n style={{ flexShrink: 0 }}\n >\n {orderIndex + 1}\n </Text>\n </Stack>\n <Tooltip\n label={`${guide.key}${guide.bypass_global_group_limit ? \" (unthrottled)\" : \"\"}`}\n >\n <Text\n as=\"code\"\n size=\"1\"\n weight=\"medium\"\n color=\"default\"\n style={{\n display: \"block\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n maxWidth: \"200px\",\n }}\n >\n {guide.key}\n </Text>\n </Tooltip>\n </Stack>\n\n {/* Right section: verdict + pills + focus */}\n <Stack align=\"center\" gap=\"1_5\" style={{ flexShrink: 0 }}>\n {!hasFocus && (\n <Tooltip label={summary.tooltip}>\n <Tag size=\"0\" variant=\"soft\" color={summary.color}>\n {summary.label}\n </Tag>\n </Tooltip>\n )}\n\n <Pill\n label=\"Elig:\"\n color={\n isUnknownGuide(guide)\n ? \"disabled\"\n : guide.annotation.isEligible\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.active.color}\n tooltip={dots.active.tooltip!}\n />\n <StatusDot\n color={dots.archived.color}\n tooltip={dots.archived.tooltip!}\n />\n <StatusDot\n color={dots.targetable.color}\n tooltip={dots.targetable.tooltip!}\n />\n </Pill>\n <Pill\n label=\"Vis:\"\n color={\n isUnknownGuide(guide)\n ? \"disabled\"\n : guide.annotation.isQualified &&\n guide.annotation.selectable.status === \"returned\"\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.activatable.color}\n tooltip={dots.activatable.tooltip!}\n />\n <StatusDot\n color={dots.selectable.color}\n tooltip={dots.selectable.tooltip!}\n />\n </Pill>\n\n <Tooltip\n label={\n isUnknownGuide(guide) ||\n guide.annotation.selectable.status === undefined\n ? \"No component found that can render this guide\"\n : isFocused\n ? \"Unfocus this guide\"\n : \"Focus on this guide\"\n }\n >\n <Button\n size=\"0\"\n variant={isFocused ? \"solid\" : \"outline\"}\n color={isFocused ? \"blue\" : \"gray\"}\n disabled={\n isUnknownGuide(guide) ||\n guide.annotation.selectable.status === undefined\n }\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: isFocused ? {} : { [guide.key]: true },\n });\n }}\n >\n Focus\n </Button>\n </Tooltip>\n </Stack>\n </Stack>\n\n {isExpanded && <GuideRowDetails guide={guide} />}\n </Box>\n );\n};\n"],"names":["Pill","label","color","children","React","Stack","Text","getStatusSummary","guide","isUnknownGuide","tooltip","annotation","active","status","archived","targetable","selectable","undefined","activatable","message","getStatusDots","GuideRow","orderIndex","isExpanded","onClick","client","useGuideContext","debugSettings","useStore","store","state","debug","isHovered","setIsHovered","useState","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","dots","summary","Box","cursor","minWidth","flex","bypass_global_group_limit","Icon","Gauge","flexShrink","Tooltip","display","overflow","textOverflow","whiteSpace","maxWidth","Tag","isEligible","StatusDot","isQualified","Button","e","stopPropagation","setDebug","GuideRowDetails"],"mappings":";;;;;;;;;;;;AAsBA,MAAMA,IAAOA,CAAC;AAAA,EACZC,OAAAA;AAAAA,EACAC,OAAAA,IAAQ;AAAA,EACRC,UAAAA;AAKF,MAEK,gBAAAC,EAAA,cAAAC,GAAA,EACC,WAAU,OACV,OAAM,UACN,KAAI,OACJ,IAAG,KACH,QAAO,KACP,IAAG,aACH,SAAQ,QACR,QAAO,MACP,aAAY,SAEZ,GAAA,gBAAAD,EAAA,cAACE,KAAK,IAAG,QAAO,MAAK,KAAI,OAAAJ,GAAc,QAAO,YAC3CD,CACH,GACCE,CACH,GAUEI,IAAmBA,CACvBC,MACkB;AACdC,MAAAA,EAAeD,CAAK;AACf,WAAA;AAAA,MACLN,OAAO;AAAA,MACPD,OAAO;AAAA,MACPS,SAAS;AAAA,IACX;AAGI,QAAA;AAAA,IAAEC,YAAAA;AAAAA,EAAAA,IAAeH;AAEnB,SAACG,EAAWC,OAAOC,SAOnBF,EAAWG,SAASD,SACf;AAAA,IACLX,OAAO;AAAA,IACPD,OAAO;AAAA,IACPS,SAAS;AAAA,EACX,IAEGC,EAAWI,WAAW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ACN,OACES,EAAeD,CAAK,IAChB,aACAA,EAAMG,WAAWkD,eACfrD,EAAMG,WAAWK,WAAWH,WAAW,aACvC,SACA,OAAA,GAGP,gBAAAT,EAAA,cAAAwD,GAAA,EACC,OAAOlB,EAAKxB,YAAYhB,OACxB,SAASwC,EAAKxB,YAAYR,QAAS,CAAA,mCAEpCkD,GACC,EAAA,OAAOlB,EAAK1B,WAAWd,OACvB,SAASwC,EAAK1B,WAAWN,QAAAA,CAAS,CAEtC,GAEA,gBAAAN,EAAA,cAACgD,GACC,EAAA,OACE3C,EAAeD,CAAK,KACpBA,EAAMG,WAAWK,WAAWH,WAAWI,SACnC,kDACAuB,IACE,uBACA,sBAAA,GAGP,gBAAApC,EAAA,cAAA0D,GAAA,EACC,MAAK,KACL,SAAStB,IAAY,UAAU,WAC/B,OAAOA,IAAY,SAAS,QAC5B,UACE/B,EAAeD,CAAK,KACpBA,EAAMG,WAAWK,WAAWH,WAAWI,QAEzC,SAAS,CAAC8C,MAAwB;AAChCA,IAAAA,EAAEC,gBAAgB,GAClBvC,EAAOwC,SAAS;AAAA,MACd,GAAGtC;AAAAA,MACHQ,kBAAkBK,IAAY,KAAK;AAAA,QAAE,CAAChC,EAAMiC,GAAG,GAAG;AAAA,MAAA;AAAA,IAAK,CACxD;AAAA,EACH,EAAA,GAAE,OAGJ,CACF,CACF,CACF,GAEClB,KAAc,gBAAAnB,EAAA,cAAC8D,GAAgB,EAAA,OAAA1D,EAAA,CAAgB,CAClD;AAEJ;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import { Box as n, Stack as o } from "@telegraph/layout";
|
|
3
|
+
import { Text as i } from "@telegraph/typography";
|
|
4
|
+
import { GuideAnnotatedStatusDot as c } from "./GuideAnnotatedStatusDot.mjs";
|
|
5
|
+
import { isUnknownGuide as u } from "./useInspectGuideClientStore.mjs";
|
|
6
|
+
const s = ({
|
|
7
|
+
title: a,
|
|
8
|
+
children: t
|
|
9
|
+
}) => /* @__PURE__ */ e.createElement(o, { direction: "column", justify: "flex-start", gap: "1", px: "1_5", py: "1", rounded: "2", bg: "surface-1", border: "px", borderColor: "gray-4", style: {
|
|
10
|
+
flex: 1
|
|
11
|
+
} }, /* @__PURE__ */ e.createElement(i, { as: "span", size: "0", color: "gray", weight: "medium" }, a), /* @__PURE__ */ e.createElement(o, { direction: "column", gap: "1", mt: "1" }, t)), l = ({
|
|
12
|
+
label: a,
|
|
13
|
+
value: t,
|
|
14
|
+
color: r
|
|
15
|
+
}) => /* @__PURE__ */ e.createElement(o, { align: "center", gap: "1" }, /* @__PURE__ */ e.createElement(c, { color: r, tooltip: `${a}: ${t}` }), /* @__PURE__ */ e.createElement(i, { as: "span", size: "1", weight: "medium" }, a, ":"), /* @__PURE__ */ e.createElement(i, { as: "span", size: "1", weight: "medium", color: r }, t)), m = (a) => {
|
|
16
|
+
switch (a) {
|
|
17
|
+
case "returned":
|
|
18
|
+
return {
|
|
19
|
+
value: "Ready to display",
|
|
20
|
+
color: "blue"
|
|
21
|
+
};
|
|
22
|
+
case "throttled":
|
|
23
|
+
return {
|
|
24
|
+
value: "Throttled",
|
|
25
|
+
color: "yellow"
|
|
26
|
+
};
|
|
27
|
+
case "queried":
|
|
28
|
+
return {
|
|
29
|
+
value: "Queued",
|
|
30
|
+
color: "gray"
|
|
31
|
+
};
|
|
32
|
+
default:
|
|
33
|
+
return {
|
|
34
|
+
value: "Not found",
|
|
35
|
+
color: "red"
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}, E = ({
|
|
39
|
+
guide: a
|
|
40
|
+
}) => {
|
|
41
|
+
if (u(a))
|
|
42
|
+
return /* @__PURE__ */ e.createElement(n, { px: "3", py: "2" }, /* @__PURE__ */ e.createElement(i, { as: "span", size: "1", color: "gray" }, "This guide has never been committed and published."));
|
|
43
|
+
const {
|
|
44
|
+
annotation: t
|
|
45
|
+
} = a, r = m(t.selectable.status);
|
|
46
|
+
return /* @__PURE__ */ e.createElement(o, { px: "3", py: "2", gap: "2", direction: "row", align: "flex-start" }, /* @__PURE__ */ e.createElement(s, { title: "Eligibility" }, /* @__PURE__ */ e.createElement(l, { label: "Active", value: t.active.status ? "Yes" : "No", color: t.active.status ? "blue" : "red" }), /* @__PURE__ */ e.createElement(l, { label: "Not archived", value: t.archived.status ? "No" : "Yes", color: t.archived.status ? "red" : "blue" }), /* @__PURE__ */ e.createElement(l, { label: "Targeting", value: t.targetable.status ? "Yes" : "No", color: t.targetable.status ? "blue" : "red" })), /* @__PURE__ */ e.createElement(s, { title: "Visibility" }, /* @__PURE__ */ e.createElement(l, { label: "Activation", value: t.activatable.status ? "Yes" : "No", color: t.activatable.status ? "blue" : "red" }), /* @__PURE__ */ e.createElement(l, { label: "Display", value: r.value, color: r.color })));
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
E as GuideRowDetails
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=GuideRowDetails.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuideRowDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRowDetails.tsx"],"sourcesContent":["import { Box, Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst CardContainer = ({\n title,\n children,\n}: {\n title: string;\n children: React.ReactNode;\n}) => (\n <Stack\n direction=\"column\"\n justify=\"flex-start\"\n gap=\"1\"\n px=\"1_5\"\n py=\"1\"\n rounded=\"2\"\n bg=\"surface-1\"\n border=\"px\"\n borderColor=\"gray-4\"\n style={{ flex: 1 }}\n >\n <Text as=\"span\" size=\"0\" color=\"gray\" weight=\"medium\">\n {title}\n </Text>\n <Stack direction=\"column\" gap=\"1\" mt=\"1\">\n {children}\n </Stack>\n </Stack>\n);\n\nconst StatusRow = ({\n label,\n value,\n color,\n}: {\n label: string;\n value: string;\n color: StatusColor;\n}) => (\n <Stack align=\"center\" gap=\"1\">\n <StatusDot color={color} tooltip={`${label}: ${value}`} />\n <Text as=\"span\" size=\"1\" weight=\"medium\">\n {label}:\n </Text>\n <Text as=\"span\" size=\"1\" weight=\"medium\" color={color}>\n {value}\n </Text>\n </Stack>\n);\n\nconst getDisplayValue = (\n status: \"returned\" | \"throttled\" | \"queried\" | undefined,\n): { value: string; color: StatusColor } => {\n switch (status) {\n case \"returned\":\n return { value: \"Ready to display\", color: \"blue\" };\n case \"throttled\":\n return { value: \"Throttled\", color: \"yellow\" };\n case \"queried\":\n return { value: \"Queued\", color: \"gray\" };\n default:\n return { value: \"Not found\", color: \"red\" };\n }\n};\n\nexport const GuideRowDetails = ({\n guide,\n}: {\n guide: AnnotatedGuide | UnknownGuide;\n}) => {\n if (isUnknownGuide(guide)) {\n return (\n <Box px=\"3\" py=\"2\">\n <Text as=\"span\" size=\"1\" color=\"gray\">\n This guide has never been committed and published.\n </Text>\n </Box>\n );\n }\n\n const { annotation } = guide;\n const display = getDisplayValue(annotation.selectable.status);\n\n return (\n <Stack px=\"3\" py=\"2\" gap=\"2\" direction=\"row\" align=\"flex-start\">\n <CardContainer title=\"Eligibility\">\n <StatusRow\n label=\"Active\"\n value={annotation.active.status ? \"Yes\" : \"No\"}\n color={annotation.active.status ? \"blue\" : \"red\"}\n />\n <StatusRow\n label=\"Not archived\"\n value={!annotation.archived.status ? \"Yes\" : \"No\"}\n color={!annotation.archived.status ? \"blue\" : \"red\"}\n />\n <StatusRow\n label=\"Targeting\"\n value={annotation.targetable.status ? \"Yes\" : \"No\"}\n color={annotation.targetable.status ? \"blue\" : \"red\"}\n />\n </CardContainer>\n\n <CardContainer title=\"Visibility\">\n <StatusRow\n label=\"Activation\"\n value={annotation.activatable.status ? \"Yes\" : \"No\"}\n color={annotation.activatable.status ? \"blue\" : \"red\"}\n />\n <StatusRow\n label=\"Display\"\n value={display.value}\n color={display.color}\n />\n </CardContainer>\n </Stack>\n );\n};\n"],"names":["CardContainer","title","children","React","Stack","flex","Text","StatusRow","label","value","color","StatusDot","getDisplayValue","status","GuideRowDetails","guide","isUnknownGuide","Box","annotation","display","selectable","active","archived","targetable","activatable"],"mappings":";;;;;AAaA,MAAMA,IAAgBA,CAAC;AAAA,EACrBC,OAAAA;AAAAA,EACAC,UAAAA;AAIF,MACEC,gBAAAA,EAAA,cAACC,KACC,WAAU,UACV,SAAQ,cACR,KAAI,KACJ,IAAG,OACH,IAAG,KACH,SAAQ,KACR,IAAG,aACH,QAAO,MACP,aAAY,UACZ,OAAO;AAAA,EAAEC,MAAM;AAAE,EAEjB,GAAAF,gBAAAA,EAAA,cAACG,KAAK,IAAG,QAAO,MAAK,KAAI,OAAM,QAAO,QAAO,SAAA,GAC1CL,CACH,GACAE,gBAAAA,EAAA,cAACC,KAAM,WAAU,UAAS,KAAI,KAAI,IAAG,IAClCF,GAAAA,CACH,CACF,GAGIK,IAAYA,CAAC;AAAA,EACjBC,OAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,OAAAA;AAKF,sCACGN,GAAM,EAAA,OAAM,UAAS,KAAI,OACvBD,gBAAAA,EAAA,cAAAQ,GAAA,EAAU,OAAAD,GAAc,SAAS,GAAGF,CAAK,KAAKC,CAAK,GAAA,CAAG,GACtDN,gBAAAA,EAAA,cAAAG,GAAA,EAAK,IAAG,QAAO,MAAK,KAAI,QAAO,YAC7BE,GAAM,GACT,GACAL,gBAAAA,EAAA,cAACG,GAAK,EAAA,IAAG,QAAO,MAAK,KAAI,QAAO,UAAS,OAAAI,KACtCD,CACH,CACF,GAGIG,IAAkBA,CACtBC,MAC0C;AAC1C,UAAQA,GAAM;AAAA,IACZ,KAAK;AACI,aAAA;AAAA,QAAEJ,OAAO;AAAA,QAAoBC,OAAO;AAAA,MAAO;AAAA,IACpD,KAAK;AACI,aAAA;AAAA,QAAED,OAAO;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M,YAAYX,SAAS,SAAS,OAAM,GAEvDV,gBAAAA,EAAA,cAAAI,GAAA,EACC,OAAM,WACN,OAAOY,EAAQV,OACf,OAAOU,EAAQT,MAAM,CAAA,CAEzB,CACF;AAEJ;"}
|
|
@@ -1,82 +1,144 @@
|
|
|
1
|
-
import { useGuideContext as
|
|
2
|
-
import { Button as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { useGuideContext as v, useStore as I } from "@knocklabs/react-core";
|
|
2
|
+
import { Button as m } from "@telegraph/button";
|
|
3
|
+
import { Icon as R } from "@telegraph/icon";
|
|
4
|
+
import { Box as p, Stack as a } from "@telegraph/layout";
|
|
5
|
+
import { SegmentedControl as f } from "@telegraph/segmented-control";
|
|
6
|
+
import { Tooltip as b } from "@telegraph/tooltip";
|
|
7
|
+
import { Text as z } from "@telegraph/typography";
|
|
8
|
+
import { GripVertical as O, Box as P, Gauge as _, ChevronDown as G, ChevronRight as B, SlidersHorizontal as T, LogOut as A, Minimize2 as V } from "lucide-react";
|
|
6
9
|
import e from "react";
|
|
7
|
-
import { KnockButton as
|
|
8
|
-
import { TOOLBAR_Z_INDEX as
|
|
10
|
+
import { KnockButton as L } from "../KnockButton.mjs";
|
|
11
|
+
import { TOOLBAR_Z_INDEX as H } from "../shared.mjs";
|
|
9
12
|
/* empty css */
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
import { GuideContextDetails as K } from "./GuideContextDetails.mjs";
|
|
14
|
+
import { GuideRow as j } from "./GuideRow.mjs";
|
|
15
|
+
import { getRunConfig as M, clearRunConfigLS as W } from "./helpers.mjs";
|
|
16
|
+
import { useDraggable as N } from "./useDraggable.mjs";
|
|
17
|
+
import { useInspectGuideClientStore as Q } from "./useInspectGuideClientStore.mjs";
|
|
18
|
+
const X = "540px", Z = ({
|
|
19
|
+
guides: o,
|
|
20
|
+
displayOption: l
|
|
21
|
+
}) => {
|
|
22
|
+
const [c, i] = e.useState();
|
|
23
|
+
return e.useEffect(() => {
|
|
24
|
+
i(void 0);
|
|
25
|
+
}, [l]), o.map((r, d) => {
|
|
26
|
+
const {
|
|
27
|
+
isEligible: g,
|
|
28
|
+
isQualified: s
|
|
29
|
+
} = r.annotation;
|
|
30
|
+
return l === "only-displayable" && !(g && s) || l === "only-eligible" && !g ? null : /* @__PURE__ */ e.createElement(j, { key: r.key, guide: r, orderIndex: d, isExpanded: r.key === c, onClick: () => {
|
|
31
|
+
i((n) => n && n === r.key ? void 0 : r.key);
|
|
32
|
+
} });
|
|
33
|
+
});
|
|
34
|
+
}, ue = () => {
|
|
28
35
|
const {
|
|
29
|
-
client:
|
|
30
|
-
} =
|
|
36
|
+
client: o
|
|
37
|
+
} = v(), [l, c] = e.useState("only-eligible"), [i, r] = e.useState(() => M()), [d, g] = e.useState(!1), [s, x] = e.useState(!1), {
|
|
38
|
+
debugSettings: n
|
|
39
|
+
} = I(o.store, (t) => ({
|
|
40
|
+
debugSettings: t.debug || {}
|
|
41
|
+
}));
|
|
31
42
|
e.useEffect(() => {
|
|
32
|
-
var
|
|
43
|
+
var C;
|
|
33
44
|
const {
|
|
34
|
-
isVisible:
|
|
35
|
-
focusedGuideKeys:
|
|
36
|
-
} =
|
|
37
|
-
return
|
|
38
|
-
focusedGuideKeys:
|
|
39
|
-
}), () => {
|
|
40
|
-
|
|
45
|
+
isVisible: t = !1,
|
|
46
|
+
focusedGuideKeys: k = {}
|
|
47
|
+
} = i || {}, w = (C = o.store.state.debug) == null ? void 0 : C.debugging;
|
|
48
|
+
return t && !w && (o.setDebug({
|
|
49
|
+
focusedGuideKeys: k
|
|
50
|
+
}), Object.keys(k).length > 0 && c("all-guides")), () => {
|
|
51
|
+
o.unsetDebug();
|
|
41
52
|
};
|
|
42
|
-
}, [
|
|
43
|
-
const
|
|
44
|
-
position:
|
|
45
|
-
isDragging:
|
|
46
|
-
handlePointerDown:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
}, [i, o, c]);
|
|
54
|
+
const h = e.useRef(null), {
|
|
55
|
+
position: D,
|
|
56
|
+
isDragging: E,
|
|
57
|
+
handlePointerDown: y,
|
|
58
|
+
hasDraggedRef: S
|
|
59
|
+
} = N({
|
|
60
|
+
elementRef: h,
|
|
61
|
+
reclampDeps: [d],
|
|
51
62
|
initialPosition: {
|
|
52
63
|
top: 16,
|
|
53
64
|
right: 16
|
|
54
65
|
}
|
|
55
|
-
}),
|
|
56
|
-
return !
|
|
57
|
-
top:
|
|
58
|
-
right:
|
|
59
|
-
zIndex:
|
|
60
|
-
} },
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
}), u = Q(i);
|
|
67
|
+
return !u || !(i != null && i.isVisible) ? null : /* @__PURE__ */ e.createElement(p, { tgphRef: h, position: "fixed", style: {
|
|
68
|
+
top: D.top + "px",
|
|
69
|
+
right: D.right + "px",
|
|
70
|
+
zIndex: H
|
|
71
|
+
} }, d ? /* @__PURE__ */ e.createElement(a, { border: "px", rounded: "4", align: "center", justify: "center", w: "10", h: "10", onPointerDown: y, backgroundColor: "surface-1", style: {
|
|
72
|
+
cursor: E ? "grabbing" : "grab",
|
|
73
|
+
touchAction: "none",
|
|
74
|
+
userSelect: "none"
|
|
64
75
|
} }, /* @__PURE__ */ e.createElement(p, { style: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
transform: "scale(0.7)",
|
|
77
|
+
transformOrigin: "center center"
|
|
78
|
+
} }, /* @__PURE__ */ e.createElement(L, { onClick: () => {
|
|
79
|
+
S.current || g(!1);
|
|
80
|
+
}, positioned: !1 }))) : /* @__PURE__ */ e.createElement(a, { direction: "column", backgroundColor: "surface-1", rounded: "4", border: "px", overflow: "hidden", style: {
|
|
81
|
+
width: X,
|
|
82
|
+
boxShadow: "0 8px 32px var(--tgph-gray-5)"
|
|
83
|
+
} }, /* @__PURE__ */ e.createElement(a, { w: "full", p: "2", justify: "space-between", direction: "row", align: "center", gap: "2", borderBottom: "px", onPointerDown: y, style: {
|
|
84
|
+
boxSizing: "border-box",
|
|
85
|
+
cursor: E ? "grabbing" : "grab",
|
|
86
|
+
touchAction: "none",
|
|
87
|
+
userSelect: "none"
|
|
88
|
+
} }, /* @__PURE__ */ e.createElement(a, { align: "center", gap: "1_5", style: {
|
|
89
|
+
minWidth: 0,
|
|
90
|
+
flex: 1
|
|
91
|
+
} }, /* @__PURE__ */ e.createElement(a, { display: "inline-flex", align: "center", style: {
|
|
92
|
+
cursor: E ? "grabbing" : "grab",
|
|
93
|
+
touchAction: "none",
|
|
94
|
+
userSelect: "none"
|
|
95
|
+
}, onPointerDown: (t) => {
|
|
96
|
+
t.stopPropagation(), y(t);
|
|
97
|
+
} }, /* @__PURE__ */ e.createElement(R, { color: "gray", size: "1", icon: O, "aria-hidden": !0 })), /* @__PURE__ */ e.createElement(a, { align: "center", gap: "1_5", onPointerDown: (t) => t.stopPropagation() }, /* @__PURE__ */ e.createElement(f.Root, { size: "1", type: "single", value: l, onValueChange: (t) => {
|
|
98
|
+
t && c(t);
|
|
99
|
+
} }, /* @__PURE__ */ e.createElement(f.Option, { value: "all-guides" }, "All guides"), /* @__PURE__ */ e.createElement(f.Option, { value: "only-eligible" }, "Eligible"), /* @__PURE__ */ e.createElement(f.Option, { value: "only-displayable" }, "On this page")), /* @__PURE__ */ e.createElement(b, { label: "Sandbox: Contain engagement actions to client side only" }, /* @__PURE__ */ e.createElement(m, { size: "1", variant: n.skipEngagementTracking ? "outline" : "ghost", color: n.skipEngagementTracking ? "blue" : "gray", icon: {
|
|
100
|
+
icon: P,
|
|
101
|
+
alt: "Sandbox mode"
|
|
102
|
+
}, onClick: () => {
|
|
103
|
+
o.setDebug({
|
|
104
|
+
...n,
|
|
105
|
+
skipEngagementTracking: !n.skipEngagementTracking
|
|
106
|
+
});
|
|
107
|
+
} })), /* @__PURE__ */ e.createElement(b, { label: "Ignore throttle: Show next guide immediately" }, /* @__PURE__ */ e.createElement(m, { size: "1", variant: n.ignoreDisplayInterval ? "outline" : "ghost", color: n.ignoreDisplayInterval ? "blue" : "gray", icon: {
|
|
108
|
+
icon: _,
|
|
109
|
+
alt: "Ignore throttle"
|
|
110
|
+
}, onClick: () => {
|
|
111
|
+
o.setDebug({
|
|
112
|
+
...n,
|
|
113
|
+
ignoreDisplayInterval: !n.ignoreDisplayInterval
|
|
114
|
+
});
|
|
115
|
+
} })), /* @__PURE__ */ e.createElement(b, { label: "Inspect target params" }, /* @__PURE__ */ e.createElement(m, { size: "1", variant: s ? "outline" : "ghost", color: s ? "blue" : "gray", leadingIcon: {
|
|
116
|
+
icon: T,
|
|
117
|
+
alt: "Inspect target params"
|
|
118
|
+
}, trailingIcon: s ? {
|
|
119
|
+
icon: G,
|
|
120
|
+
alt: "Hide context data"
|
|
121
|
+
} : {
|
|
122
|
+
icon: B,
|
|
123
|
+
alt: "Show context data"
|
|
124
|
+
}, onClick: () => x((t) => !t) })))), /* @__PURE__ */ e.createElement(a, { align: "center", gap: "1_5", style: {
|
|
125
|
+
flexShrink: 0
|
|
126
|
+
}, onPointerDown: (t) => t.stopPropagation() }, /* @__PURE__ */ e.createElement(a, { align: "center", gap: "1_5" }, /* @__PURE__ */ e.createElement(m, { size: "1", variant: "outline", leadingIcon: {
|
|
127
|
+
icon: A,
|
|
128
|
+
alt: "Exit"
|
|
129
|
+
}, onClick: () => {
|
|
130
|
+
r((t) => ({
|
|
131
|
+
...t,
|
|
69
132
|
isVisible: !1
|
|
70
|
-
})),
|
|
71
|
-
}, size: "1", variant: "
|
|
72
|
-
icon:
|
|
73
|
-
"
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} }))), /* @__PURE__ */ e.createElement(p, { w: "full" }, /* @__PURE__ */ e.createElement(I, null), m.error && /* @__PURE__ */ e.createElement(p, { px: "2", pb: "1" }, /* @__PURE__ */ e.createElement(h, { as: "span", size: "0", weight: "medium", color: "red" }, m.error)), /* @__PURE__ */ e.createElement(B, { guides: m.guides, displayOption: o }))));
|
|
133
|
+
})), W(), o.unsetDebug();
|
|
134
|
+
} }, "Exit"), /* @__PURE__ */ e.createElement(b, { label: "Minimize toolbar" }, /* @__PURE__ */ e.createElement(m, { size: "1", variant: "outline", leadingIcon: {
|
|
135
|
+
icon: V,
|
|
136
|
+
alt: "Minimize"
|
|
137
|
+
}, onClick: () => g(!0) }))))), s && /* @__PURE__ */ e.createElement(p, { borderBottom: "px" }, /* @__PURE__ */ e.createElement(K, null)), /* @__PURE__ */ e.createElement(p, { p: "1", overflow: "auto", style: {
|
|
138
|
+
maxHeight: "calc(80vh - 96px)"
|
|
139
|
+
} }, u.status === "error" ? /* @__PURE__ */ e.createElement(p, { px: "2", pb: "1" }, /* @__PURE__ */ e.createElement(z, { as: "span", size: "1", weight: "medium", color: u.error === "no_guides_fetched" ? "default" : "red" }, u.message)) : /* @__PURE__ */ e.createElement(Z, { guides: u.guides, displayOption: l }))));
|
|
78
140
|
};
|
|
79
141
|
export {
|
|
80
|
-
|
|
142
|
+
ue as V2
|
|
81
143
|
};
|
|
82
144
|
//# sourceMappingURL=V2.mjs.map
|