@knocklabs/react 0.11.12 → 0.11.13
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 +15 -0
- package/dist/cjs/index.js +1 -1
- 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/GuideAnnotatedStatusDot.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js.map +1 -1
- 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 +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js.map +1 -1
- 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/helpers.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
- package/dist/cjs/modules/guide/providers/KnockGuideProvider.js +1 -1
- package/dist/cjs/modules/guide/providers/KnockGuideProvider.js.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs +32 -31
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs +6 -5
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +14 -13
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +37 -37
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +39 -29
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +83 -77
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs +5 -48
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
- package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs +12 -10
- package/dist/esm/modules/guide/providers/KnockGuideProvider.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/GuideAnnotatedStatusDot.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts +5 -1
- package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts +3 -7
- package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +1 -2
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
- package/dist/types/modules/guide/providers/KnockGuideProvider.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideContextDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Toggle } from \"@telegraph/toggle\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n\n return (\n <Box py=\"3\" px=\"3\">\n <Stack direction=\"column\" gap=\"1\" width=\"full\">\n <Text as=\"span\" size=\"1\" weight=\"medium\" display=\"block\">\n Toolbar settings\n </Text>\n <Stack direction=\"column\" gap=\"1\">\n <Stack direction=\"row\" gap=\"2\" align=\"center\" h=\"7\">\n <Tooltip
|
|
1
|
+
{"version":3,"file":"GuideContextDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Toggle } from \"@telegraph/toggle\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport { sharedTooltipProps } from \"./helpers\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n\n return (\n <Box py=\"3\" px=\"3\">\n <Stack direction=\"column\" gap=\"1\" width=\"full\">\n <Text as=\"span\" size=\"1\" weight=\"medium\" display=\"block\">\n Toolbar settings\n </Text>\n <Stack direction=\"column\" gap=\"1\">\n <Stack direction=\"row\" gap=\"2\" align=\"center\" h=\"7\">\n <Tooltip\n label=\"When enabled, engagement actions are not sent to Knock.\"\n {...sharedTooltipProps}\n >\n <Box width=\"36\" mt=\"1\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n >\n Sandbox engagement\n </Text>\n </Box>\n </Tooltip>\n <Toggle.Default\n size=\"1\"\n pt=\"1_5\"\n value={!!debugSettings.skipEngagementTracking}\n onValueChange={(value: boolean) => {\n client.setDebug({\n ...debugSettings,\n skipEngagementTracking: value,\n });\n }}\n />\n </Stack>\n <Stack direction=\"row\" gap=\"2\" align=\"center\" h=\"7\">\n <Tooltip\n label=\"Ignore throttle and show next guide immediately\"\n {...sharedTooltipProps}\n >\n <Box width=\"36\" mt=\"1\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n >\n Ignore throttle\n </Text>\n </Box>\n </Tooltip>\n <Toggle.Default\n size=\"1\"\n pt=\"1_5\"\n value={!!debugSettings.ignoreDisplayInterval}\n onValueChange={(value: boolean) => {\n client.setDebug({\n ...debugSettings,\n ignoreDisplayInterval: value,\n });\n }}\n />\n </Stack>\n </Stack>\n </Stack>\n <Stack direction=\"column\" gap=\"1\" width=\"full\">\n <Tooltip\n label={\n <Text as=\"span\" size=\"1\">\n The tenant and data payload passed to KnockGuideProvider.\n Available for use in runtime conditions.\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n mt=\"4\"\n style={{\n whiteSpace: \"nowrap\",\n width: \"fit-content\",\n }}\n >\n Target params\n </Text>\n </Tooltip>\n <Stack direction=\"column\" gap=\"2\">\n <Stack direction=\"row\" gap=\"2\" align=\"center\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n width=\"36\"\n mt=\"1\"\n >\n Tenant\n </Text>\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n border=\"px\"\n p=\"1\"\n style={{ flex: 1, minWidth: 0 }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>{client.targetParams.tenant || \"-\"}</code>\n </pre>\n </Box>\n </Stack>\n <Stack direction=\"row\" gap=\"2\" align=\"flex-start\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n width=\"36\"\n mt=\"1\"\n >\n Data\n </Text>\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n border=\"px\"\n p=\"1\"\n style={{\n flex: 1,\n minWidth: 0,\n minHeight: \"50px\",\n maxHeight: \"200px\",\n }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>\n {client.targetParams.data\n ? JSON.stringify(client.targetParams.data, null, 2)\n : \"-\"}\n </code>\n </pre>\n </Box>\n </Stack>\n </Stack>\n </Stack>\n </Box>\n );\n};\n"],"names":["GuideContextDetails","client","useGuideContext","debugSettings","useStore","store","state","debug","Box","Stack","Text","React","Tooltip","sharedTooltipProps","Toggle","skipEngagementTracking","value","setDebug","ignoreDisplayInterval","whiteSpace","width","flex","minWidth","fontSize","margin","targetParams","tenant","minHeight","maxHeight","data","JSON","stringify"],"mappings":";;;;;;;AAQO,MAAMA,IAAsBA,MAAM;AACjC,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAC7B;AAAA,IAAEC,eAAAA;AAAAA,EAAkBC,IAAAA,EAASH,EAAOI,OAAQC,CAAWA,OAAA;AAAA,IAC3DH,eAAeG,EAAMC,SAAS,CAAA;AAAA,EAAC,EAC/B;AAEF,yCACGC,GAAI,EAAA,IAAG,KAAI,IAAG,IAAA,mCACZC,GAAM,EAAA,WAAU,UAAS,KAAI,KAAI,OAAM,OAAA,mCACrCC,GAAK,EAAA,IAAG,QAAO,MAAK,KAAI,QAA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AAW;AAAA,IACXC,WAAW;AAAA,EACb,EAAA,GAECjB,gBAAAA,EAAA,cAAA,OAAA,EAAI,OAAO;AAAA,IAAEY,UAAU;AAAA,IAAQC,QAAQ;AAAA,EAAA,qCACrC,QACEvB,MAAAA,EAAOwB,aAAaI,OACjBC,KAAKC,UAAU9B,EAAOwB,aAAaI,MAAM,MAAM,CAAC,IAChD,GACN,CACF,CACF,CACF,CACF,CACF,CACF;AAEJ;"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { useGuideContext as x, useStore as G } from "@knocklabs/react-core";
|
|
2
|
-
import { Button as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { Box as
|
|
5
|
-
import { Tag as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
import { Text as
|
|
8
|
-
import { Gauge as
|
|
2
|
+
import { Button as T } from "@telegraph/button";
|
|
3
|
+
import { Icon as A } from "@telegraph/icon";
|
|
4
|
+
import { Box as f, Stack as i } from "@telegraph/layout";
|
|
5
|
+
import { Tag as C } from "@telegraph/tag";
|
|
6
|
+
import { Tooltip as h } from "@telegraph/tooltip";
|
|
7
|
+
import { Text as y } from "@telegraph/typography";
|
|
8
|
+
import { Gauge as D } from "lucide-react";
|
|
9
9
|
import * as t from "react";
|
|
10
|
-
import { GuideAnnotatedStatusDot as
|
|
11
|
-
import { GuideRowDetails as
|
|
12
|
-
import {
|
|
13
|
-
import { isUncommittedGuide as
|
|
14
|
-
const
|
|
10
|
+
import { GuideAnnotatedStatusDot as c } from "./GuideAnnotatedStatusDot.mjs";
|
|
11
|
+
import { GuideRowDetails as z, getSelectableStatusSummary as w } from "./GuideRowDetails.mjs";
|
|
12
|
+
import { sharedTooltipProps as E } from "./helpers.mjs";
|
|
13
|
+
import { isUncommittedGuide as n } from "./useInspectGuideClientStore.mjs";
|
|
14
|
+
const N = "data-kgt-guide-row-key", S = ({
|
|
15
15
|
label: e,
|
|
16
16
|
color: o = "gray",
|
|
17
17
|
children: a
|
|
18
|
-
}) => /* @__PURE__ */ t.createElement(
|
|
19
|
-
if (
|
|
18
|
+
}) => /* @__PURE__ */ t.createElement(i, { direction: "row", align: "center", gap: "0_5", px: "1", height: "5", bg: "surface-2", rounded: "full", border: "px", borderColor: "gray-4" }, /* @__PURE__ */ t.createElement(y, { as: "span", size: "0", color: o, weight: "medium" }, e), a), $ = (e) => {
|
|
19
|
+
if (n(e))
|
|
20
20
|
return {
|
|
21
21
|
color: "red",
|
|
22
22
|
label: "Inactive",
|
|
@@ -55,8 +55,8 @@ const z = "data-kgt-guide-row-key", S = ({
|
|
|
55
55
|
label: "Not activated",
|
|
56
56
|
description: "This guide cannot be activated in the current location"
|
|
57
57
|
};
|
|
58
|
-
},
|
|
59
|
-
if (
|
|
58
|
+
}, I = (e) => {
|
|
59
|
+
if (n(e))
|
|
60
60
|
return {
|
|
61
61
|
active: {
|
|
62
62
|
color: "gray"
|
|
@@ -85,21 +85,21 @@ const z = "data-kgt-guide-row-key", S = ({
|
|
|
85
85
|
}, u = {
|
|
86
86
|
color: o.targetable.status ? "blue" : "red",
|
|
87
87
|
tooltip: `Targeting: ${o.targetable.status ? "Yes" : "No"}`
|
|
88
|
-
},
|
|
88
|
+
}, d = {
|
|
89
89
|
color: o.activatable.status ? "blue" : "red",
|
|
90
90
|
tooltip: `Activated: ${o.activatable.status ? "Yes" : "No"}`
|
|
91
|
-
},
|
|
92
|
-
color:
|
|
93
|
-
tooltip:
|
|
91
|
+
}, l = w(o.selectable.status), b = {
|
|
92
|
+
color: l.color,
|
|
93
|
+
tooltip: l.label
|
|
94
94
|
};
|
|
95
95
|
return {
|
|
96
96
|
active: a,
|
|
97
97
|
archived: m,
|
|
98
98
|
targetable: u,
|
|
99
|
-
activatable:
|
|
100
|
-
selectable:
|
|
99
|
+
activatable: d,
|
|
100
|
+
selectable: b
|
|
101
101
|
};
|
|
102
|
-
},
|
|
102
|
+
}, M = ({
|
|
103
103
|
guide: e,
|
|
104
104
|
orderIndex: o,
|
|
105
105
|
isExpanded: a,
|
|
@@ -108,38 +108,38 @@ const z = "data-kgt-guide-row-key", S = ({
|
|
|
108
108
|
const {
|
|
109
109
|
client: u
|
|
110
110
|
} = x(), {
|
|
111
|
-
debugSettings:
|
|
111
|
+
debugSettings: d
|
|
112
112
|
} = G(u.store, (g) => ({
|
|
113
113
|
debugSettings: g.debug || {}
|
|
114
|
-
})), [
|
|
115
|
-
[
|
|
114
|
+
})), [l, b] = t.useState(!1), v = d.focusedGuideKeys || {}, k = Object.keys(v).length > 0, s = !!v[e.key], r = I(e), p = $(e), _ = {
|
|
115
|
+
[N]: e.key
|
|
116
116
|
};
|
|
117
|
-
return /* @__PURE__ */ t.createElement(
|
|
117
|
+
return /* @__PURE__ */ t.createElement(f, { rounded: "3", overflow: "hidden", border: "px", borderStyle: "solid", borderColor: a ? "gray-6" : "transparent", onMouseEnter: () => b(!0), onMouseLeave: () => b(!1), style: {
|
|
118
118
|
cursor: "pointer"
|
|
119
|
-
}, ...
|
|
119
|
+
}, ..._ }, /* @__PURE__ */ t.createElement(i, { 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: () => m(e.key) }, /* @__PURE__ */ t.createElement(i, { align: "center", gap: "1_5", style: {
|
|
120
120
|
minWidth: 0,
|
|
121
121
|
flex: 1
|
|
122
|
-
} }, /* @__PURE__ */ t.createElement(
|
|
122
|
+
} }, /* @__PURE__ */ t.createElement(i, { w: "7", justify: "space-between", align: "center", gap: "0_5" }, /* @__PURE__ */ t.createElement(f, { w: "3" }, !e.bypass_global_group_limit && /* @__PURE__ */ t.createElement(A, { icon: D, size: "0", color: "gray", alt: "Subject to throttling" })), /* @__PURE__ */ t.createElement(y, { as: "span", size: "1", weight: "medium", color: e.bypass_global_group_limit ? "blue" : "default", style: {
|
|
123
123
|
flexShrink: 0
|
|
124
|
-
} }, o + 1)), /* @__PURE__ */ t.createElement(
|
|
124
|
+
} }, o + 1)), /* @__PURE__ */ t.createElement(h, { label: `${e.key}${e.bypass_global_group_limit ? " (unthrottled)" : ""}`, ...E }, /* @__PURE__ */ t.createElement(y, { as: "code", size: "1", weight: "medium", color: "default", style: {
|
|
125
125
|
display: "block",
|
|
126
126
|
overflow: "hidden",
|
|
127
127
|
textOverflow: "ellipsis",
|
|
128
128
|
whiteSpace: "nowrap",
|
|
129
129
|
maxWidth: "200px"
|
|
130
|
-
} }, e.key))), /* @__PURE__ */ t.createElement(
|
|
130
|
+
} }, e.key))), /* @__PURE__ */ t.createElement(i, { align: "center", gap: "1_5", style: {
|
|
131
131
|
flexShrink: 0
|
|
132
|
-
} }, !
|
|
132
|
+
} }, !k && /* @__PURE__ */ t.createElement(h, { label: p.description, ...E }, /* @__PURE__ */ t.createElement(C, { size: "0", variant: "soft", color: p.color }, p.label)), /* @__PURE__ */ t.createElement(S, { label: "Elig:", color: n(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(S, { label: "Vis:", color: n(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(T, { size: "0", variant: s ? "solid" : "outline", color: s ? "blue" : "gray", disabled: n(e) || e.annotation.selectable.status === void 0, onClick: (g) => {
|
|
133
133
|
g.stopPropagation(), u.setDebug({
|
|
134
|
-
...
|
|
135
|
-
focusedGuideKeys:
|
|
134
|
+
...d,
|
|
135
|
+
focusedGuideKeys: s ? {} : {
|
|
136
136
|
[e.key]: !0
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
|
-
} }, "Focus")))
|
|
139
|
+
} }, "Focus"))), a && /* @__PURE__ */ t.createElement(z, { guide: e }));
|
|
140
140
|
};
|
|
141
141
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
N as GUIDE_ROW_DATA_SELECTOR,
|
|
143
|
+
M as GuideRow
|
|
144
144
|
};
|
|
145
145
|
//# 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 { 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 {\n GuideRowDetails,\n StatusSummary,\n getSelectableStatusSummary,\n} from \"./GuideRowDetails\";\nimport { FOCUS_ERRORS } from \"./helpers\";\nimport {\n AnnotatedGuide,\n AnnotatedStatuses,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nexport const GUIDE_ROW_DATA_SELECTOR = \"data-kgt-guide-row-key\";\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\nconst getStatusSummary = (\n guide: AnnotatedGuide | UncommittedGuide,\n): StatusSummary => {\n if (isUncommittedGuide(guide)) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"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 description: \"This guide is inactive\",\n };\n }\n if (annotation.archived.status) {\n return {\n color: \"red\",\n label: \"Archived\",\n description: \"User has already dismissed this guide\",\n };\n }\n if (!annotation.targetable.status) {\n return {\n color: \"red\",\n label: \"Not targeted\",\n description: annotation.targetable.message,\n };\n }\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n // Prioritize an undefined selectable status ahead of activatable status.\n if (annotation.selectable.status === undefined) {\n return selectableStatusSummary;\n }\n\n if (!annotation.activatable.status) {\n return {\n color: \"red\",\n label: \"Not activated\",\n description: \"This guide cannot be activated in the current location\",\n };\n }\n\n return {\n ...selectableStatusSummary,\n\n // Shorten the label we display here for space.\n ...(annotation.selectable.status === \"returned\"\n ? { label: \"Display\" }\n : undefined),\n };\n};\n\ntype StatusDot = {\n color: StatusColor;\n tooltip?: string;\n};\n\nconst getStatusDots = (\n guide: AnnotatedGuide | UncommittedGuide,\n): Record<keyof AnnotatedStatuses, StatusDot> => {\n if (isUncommittedGuide(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 ? \"red\" : \"blue\",\n tooltip: `Archived: ${annotation.archived.status ? \"Yes\" : \"No\"}`,\n };\n\n const targetable: StatusDot = {\n color: annotation.targetable.status ? \"blue\" : \"red\",\n tooltip: `Targeting: ${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 const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n const selectable = {\n color: selectableStatusSummary.color,\n tooltip: selectableStatusSummary.label,\n };\n\n return { active, archived, targetable, activatable, selectable };\n};\n\ntype Props = {\n guide: UncommittedGuide | 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 const dataAttrs = { [GUIDE_ROW_DATA_SELECTOR]: guide.key };\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 {...dataAttrs}\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.description}>\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 isUncommittedGuide(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 isUncommittedGuide(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 isUncommittedGuide(guide)\n ? FOCUS_ERRORS.focusUncommittedGuide\n : guide.annotation.selectable.status === undefined\n ? FOCUS_ERRORS.focusUnselectableGuide\n : \"\"\n }\n enabled={\n isUncommittedGuide(guide) ||\n guide.annotation.selectable.status === undefined\n }\n >\n <Button\n size=\"0\"\n variant={isFocused ? \"solid\" : \"outline\"}\n color={isFocused ? \"blue\" : \"gray\"}\n disabled={\n isUncommittedGuide(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":["GUIDE_ROW_DATA_SELECTOR","Pill","label","color","children","React","Stack","Text","getStatusSummary","guide","isUncommittedGuide","description","annotation","active","status","archived","targetable","message","selectableStatusSummary","getSelectableStatusSummary","selectable","undefined","activatable","getStatusDots","tooltip","GuideRow","orderIndex","isExpanded","onClick","client","useGuideContext","debugSettings","useStore","store","state","debug","isHovered","setIsHovered","useState","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","dots","summary","dataAttrs","Box","cursor","minWidth","flex","bypass_global_group_limit","Icon","Gauge","flexShrink","Tooltip","display","overflow","textOverflow","whiteSpace","maxWidth","Tag","isEligible","StatusDot","isQualified","FOCUS_ERRORS","focusUncommittedGuide","focusUnselectableGuide","Button","e","stopPropagation","setDebug","GuideRowDetails"],"mappings":";;;;;;;;;;;;;AA2BO,MAAMA,IAA0B,0BAEjCC,IAAOA,CAA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
+
{"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 {\n GuideRowDetails,\n StatusSummary,\n getSelectableStatusSummary,\n} from \"./GuideRowDetails\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport {\n AnnotatedGuide,\n AnnotatedStatuses,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nexport const GUIDE_ROW_DATA_SELECTOR = \"data-kgt-guide-row-key\";\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\nconst getStatusSummary = (\n guide: AnnotatedGuide | UncommittedGuide,\n): StatusSummary => {\n if (isUncommittedGuide(guide)) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"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 description: \"This guide is inactive\",\n };\n }\n if (annotation.archived.status) {\n return {\n color: \"red\",\n label: \"Archived\",\n description: \"User has already dismissed this guide\",\n };\n }\n if (!annotation.targetable.status) {\n return {\n color: \"red\",\n label: \"Not targeted\",\n description: annotation.targetable.message,\n };\n }\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n // Prioritize an undefined selectable status ahead of activatable status.\n if (annotation.selectable.status === undefined) {\n return selectableStatusSummary;\n }\n\n if (!annotation.activatable.status) {\n return {\n color: \"red\",\n label: \"Not activated\",\n description: \"This guide cannot be activated in the current location\",\n };\n }\n\n return {\n ...selectableStatusSummary,\n\n // Shorten the label we display here for space.\n ...(annotation.selectable.status === \"returned\"\n ? { label: \"Display\" }\n : undefined),\n };\n};\n\ntype StatusDot = {\n color: StatusColor;\n tooltip?: string;\n};\n\nconst getStatusDots = (\n guide: AnnotatedGuide | UncommittedGuide,\n): Record<keyof AnnotatedStatuses, StatusDot> => {\n if (isUncommittedGuide(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 ? \"red\" : \"blue\",\n tooltip: `Archived: ${annotation.archived.status ? \"Yes\" : \"No\"}`,\n };\n\n const targetable: StatusDot = {\n color: annotation.targetable.status ? \"blue\" : \"red\",\n tooltip: `Targeting: ${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 const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n const selectable = {\n color: selectableStatusSummary.color,\n tooltip: selectableStatusSummary.label,\n };\n\n return { active, archived, targetable, activatable, selectable };\n};\n\ntype Props = {\n guide: UncommittedGuide | 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 const dataAttrs = { [GUIDE_ROW_DATA_SELECTOR]: guide.key };\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 {...dataAttrs}\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 {...sharedTooltipProps}\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.description} {...sharedTooltipProps}>\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 isUncommittedGuide(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 isUncommittedGuide(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 <Button\n size=\"0\"\n variant={isFocused ? \"solid\" : \"outline\"}\n color={isFocused ? \"blue\" : \"gray\"}\n disabled={\n isUncommittedGuide(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 </Stack>\n </Stack>\n\n {isExpanded && <GuideRowDetails guide={guide} />}\n </Box>\n );\n};\n"],"names":["GUIDE_ROW_DATA_SELECTOR","Pill","label","color","children","React","Stack","Text","getStatusSummary","guide","isUncommittedGuide","description","annotation","active","status","archived","targetable","message","selectableStatusSummary","getSelectableStatusSummary","selectable","undefined","activatable","getStatusDots","tooltip","GuideRow","orderIndex","isExpanded","onClick","client","useGuideContext","debugSettings","useStore","store","state","debug","isHovered","setIsHovered","useState","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","dots","summary","dataAttrs","Box","cursor","minWidth","flex","bypass_global_group_limit","Icon","Gauge","flexShrink","Tooltip","sharedTooltipProps","display","overflow","textOverflow","whiteSpace","maxWidth","Tag","isEligible","StatusDot","isQualified","Button","e","stopPropagation","setDebug","GuideRowDetails"],"mappings":";;;;;;;;;;;;;AA2BO,MAAMA,IAA0B,0BAEjCC,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,GAIEI,IAAmBA,CACvBC,MACkB;AACdC,MAAAA,EAAmBD,CAAK;AACnB,WAAA;AAAA,MACLN,OAAO;AAAA,MACPD,OAAO;AAAA,MACPS,aAAa;AAAA,IACf;AAGI,QAAA;AAAA,IAAEC,YAAAA;AAAAA,EAAAA,IAAeH;AAEnB,MAAA,CAACG,EAAWC,OAAOC;AACd,WAAA;AAAA,MACLX,OAAO;AAAA,MACPD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S,CAEtC,GAEC,gBAAAnB,EAAA,cAAA+D,GAAA,EACC,MAAK,KACL,SAASxB,IAAY,UAAU,WAC/B,OAAOA,IAAY,SAAS,QAC5B,UACElC,EAAmBD,CAAK,KACxBA,EAAMG,WAAWQ,WAAWN,WAAWO,QAEzC,SAAS,CAACgD,MAAwB;AAChCA,IAAAA,EAAEC,gBAAgB,GAClBzC,EAAO0C,SAAS;AAAA,MACd,GAAGxC;AAAAA,MACHQ,kBAAkBK,IAAY,KAAK;AAAA,QAAE,CAACnC,EAAMoC,GAAG,GAAG;AAAA,MAAA;AAAA,IAAK,CACxD;AAAA,EAAA,KACD,OAGJ,CACF,CACF,GAEClB,KAAc,gBAAAtB,EAAA,cAACmE,GAAgB,EAAA,OAAA/D,EAAA,CAAgB,CAClD;AAEJ;"}
|
|
@@ -1,59 +1,69 @@
|
|
|
1
1
|
import e from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useGuideContext as h } from "@knocklabs/react-core";
|
|
3
|
+
import { Button as c } from "@telegraph/button";
|
|
4
|
+
import { Box as p, Stack as l } from "@telegraph/layout";
|
|
5
|
+
import { Tooltip as d } from "@telegraph/tooltip";
|
|
4
6
|
import { Text as s } from "@telegraph/typography";
|
|
5
|
-
import { GuideAnnotatedStatusDot as
|
|
6
|
-
import {
|
|
7
|
-
import { isUncommittedGuide as
|
|
8
|
-
const
|
|
9
|
-
title:
|
|
10
|
-
children:
|
|
7
|
+
import { GuideAnnotatedStatusDot as g } from "./GuideAnnotatedStatusDot.mjs";
|
|
8
|
+
import { sharedTooltipProps as m } from "./helpers.mjs";
|
|
9
|
+
import { isUncommittedGuide as b } from "./useInspectGuideClientStore.mjs";
|
|
10
|
+
const u = ({
|
|
11
|
+
title: r,
|
|
12
|
+
children: i
|
|
11
13
|
}) => /* @__PURE__ */ e.createElement(l, { direction: "column", justify: "flex-start", gap: "1", px: "1_5", py: "1", rounded: "2", bg: "surface-1", border: "px", borderColor: "gray-4", style: {
|
|
12
|
-
flex: 1
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
flex: 1,
|
|
15
|
+
alignSelf: "stretch"
|
|
16
|
+
} }, /* @__PURE__ */ e.createElement(s, { as: "span", size: "0", color: "gray", weight: "medium" }, r), /* @__PURE__ */ e.createElement(l, { direction: "column", gap: "1" }, i)), n = ({
|
|
17
|
+
label: r,
|
|
18
|
+
value: i,
|
|
19
|
+
color: t,
|
|
20
|
+
tooltip: o,
|
|
21
|
+
children: a
|
|
22
|
+
}) => /* @__PURE__ */ e.createElement(l, { align: "center", gap: "1" }, /* @__PURE__ */ e.createElement(d, { enabled: !!o, label: o, ...m }, /* @__PURE__ */ e.createElement(l, { align: "center", gap: "1", display: "inline-flex" }, /* @__PURE__ */ e.createElement(g, { color: t, tooltip: `${r}: ${i}` }), /* @__PURE__ */ e.createElement(s, { as: "span", size: "1", weight: "medium" }, r, ":"), !a && /* @__PURE__ */ e.createElement(s, { as: "span", size: "1", weight: "medium", color: t }, i))), a), E = (r) => {
|
|
23
|
+
switch (r) {
|
|
20
24
|
case "returned":
|
|
21
25
|
return {
|
|
22
26
|
label: "Ready to display",
|
|
23
27
|
color: "blue",
|
|
24
|
-
description: "
|
|
28
|
+
description: "The guide is queried and ready to render."
|
|
25
29
|
};
|
|
26
30
|
case "throttled":
|
|
27
31
|
return {
|
|
28
32
|
label: "Throttled",
|
|
29
33
|
color: "yellow",
|
|
30
|
-
description: "
|
|
34
|
+
description: "The guide is queried but held back by throttle settings."
|
|
31
35
|
};
|
|
32
36
|
case "queried":
|
|
33
37
|
return {
|
|
34
38
|
label: "Queued",
|
|
35
39
|
color: "gray",
|
|
36
|
-
description: "
|
|
40
|
+
description: "The guide is queried but waiting behind higher-priority guides."
|
|
37
41
|
};
|
|
38
42
|
default:
|
|
39
43
|
return {
|
|
40
44
|
label: "Not queried",
|
|
41
45
|
color: "red",
|
|
42
|
-
description:
|
|
46
|
+
description: "No useGuide(s) call on this page matches this guide."
|
|
43
47
|
};
|
|
44
48
|
}
|
|
45
|
-
},
|
|
46
|
-
guide:
|
|
49
|
+
}, C = ({
|
|
50
|
+
guide: r
|
|
47
51
|
}) => {
|
|
48
|
-
if (p(i))
|
|
49
|
-
return /* @__PURE__ */ e.createElement(c, { px: "3", py: "2" }, /* @__PURE__ */ e.createElement(s, { as: "span", size: "1", color: "gray" }, "This guide has never been committed and published."));
|
|
50
52
|
const {
|
|
51
|
-
|
|
52
|
-
} =
|
|
53
|
-
|
|
53
|
+
client: i
|
|
54
|
+
} = h();
|
|
55
|
+
if (b(r))
|
|
56
|
+
return /* @__PURE__ */ e.createElement(p, { px: "3", py: "2" }, /* @__PURE__ */ e.createElement(s, { as: "span", size: "1", color: "gray" }, "This guide has never been committed and published."));
|
|
57
|
+
const {
|
|
58
|
+
annotation: t,
|
|
59
|
+
dashboard_url: o
|
|
60
|
+
} = r, a = E(t.selectable.status);
|
|
61
|
+
return /* @__PURE__ */ e.createElement(l, { p: "1", gap: "2", direction: "row", align: "flex-start" }, /* @__PURE__ */ e.createElement(u, { title: "Eligibility" }, /* @__PURE__ */ e.createElement(n, { label: "Active", value: t.active.status ? "Yes" : "No", color: t.active.status ? "blue" : "red", tooltip: "Whether the guide is active in this environment." }), /* @__PURE__ */ e.createElement(n, { label: "Archived", value: t.archived.status ? "Yes" : "No", color: t.archived.status ? "red" : "blue", tooltip: "Whether the current user has dismissed this guide." }), /* @__PURE__ */ e.createElement(n, { label: "Targeting", value: t.targetable.status ? "Yes" : "No", color: t.targetable.status ? "blue" : "red", tooltip: "Whether the current user matches the guide's targeting conditions." })), /* @__PURE__ */ e.createElement(u, { title: "Visibility" }, /* @__PURE__ */ e.createElement(n, { label: "Activation", value: t.activatable.status ? "Yes" : "No", color: t.activatable.status ? "blue" : "red", tooltip: "Whether the current page matches the guide's activation rules." }), /* @__PURE__ */ e.createElement(n, { label: "Display", value: a.label, color: a.color, tooltip: "Whether the guide has been queried and is ready to render on the current page." }, /* @__PURE__ */ e.createElement(d, { label: a.description, ...m }, /* @__PURE__ */ e.createElement(s, { as: "span", size: "1", weight: "medium", color: a.color }, a.label)))), /* @__PURE__ */ e.createElement(l, { direction: "column", justify: "flex-end", gap: "1", style: {
|
|
62
|
+
alignSelf: "stretch"
|
|
63
|
+
} }, /* @__PURE__ */ e.createElement(c, { size: "0", variant: "outline", onClick: () => i.resetEngagement(r) }, "Reset engagement"), o && /* @__PURE__ */ e.createElement(c, { size: "0", variant: "outline", onClick: () => window.open(o, "_blank", "noopener") }, "Open in dashboard")));
|
|
54
64
|
};
|
|
55
65
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
C as GuideRowDetails,
|
|
67
|
+
E as getSelectableStatusSummary
|
|
58
68
|
};
|
|
59
69
|
//# sourceMappingURL=GuideRowDetails.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideRowDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRowDetails.tsx"],"sourcesContent":["import { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport {
|
|
1
|
+
{"version":3,"file":"GuideRowDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRowDetails.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport {\n AnnotatedGuide,\n UncommittedGuide,\n isUncommittedGuide,\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, alignSelf: \"stretch\" }}\n >\n <Text as=\"span\" size=\"0\" color=\"gray\" weight=\"medium\">\n {title}\n </Text>\n <Stack direction=\"column\" gap=\"1\">\n {children}\n </Stack>\n </Stack>\n);\n\nconst StatusRow = ({\n label,\n value,\n color,\n tooltip,\n children,\n}: {\n label: string;\n value: string;\n color: StatusColor;\n tooltip?: React.ReactNode;\n children?: React.ReactNode;\n}) => {\n return (\n <Stack align=\"center\" gap=\"1\">\n <Tooltip enabled={!!tooltip} label={tooltip} {...sharedTooltipProps}>\n <Stack align=\"center\" gap=\"1\" display=\"inline-flex\">\n <StatusDot color={color} tooltip={`${label}: ${value}`} />\n <Text as=\"span\" size=\"1\" weight=\"medium\">\n {label}:\n </Text>\n {/* User children over value when provided, for cases when we want to\n have its own tooltip over it */}\n {!children && (\n <Text as=\"span\" size=\"1\" weight=\"medium\" color={color}>\n {value}\n </Text>\n )}\n </Stack>\n </Tooltip>\n {children}\n </Stack>\n );\n};\n\nexport type StatusSummary = {\n color: StatusColor;\n label: string;\n description: string;\n};\n\nexport const getSelectableStatusSummary = (\n status: \"returned\" | \"throttled\" | \"queried\" | undefined,\n): StatusSummary => {\n switch (status) {\n case \"returned\":\n return {\n label: \"Ready to display\",\n color: \"blue\",\n description: \"The guide is queried and ready to render.\",\n };\n case \"throttled\":\n return {\n label: \"Throttled\",\n color: \"yellow\",\n description: \"The guide is queried but held back by throttle settings.\",\n };\n case \"queried\":\n return {\n label: \"Queued\",\n color: \"gray\",\n description:\n \"The guide is queried but waiting behind higher-priority guides.\",\n };\n default:\n return {\n label: \"Not queried\",\n color: \"red\",\n description: \"No useGuide(s) call on this page matches this guide.\",\n };\n }\n};\n\nexport const GuideRowDetails = ({\n guide,\n}: {\n guide: AnnotatedGuide | UncommittedGuide;\n}) => {\n const { client } = useGuideContext();\n\n if (isUncommittedGuide(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, dashboard_url: dashboardUrl } = guide;\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n return (\n <Stack p=\"1\" 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 tooltip=\"Whether the guide is active in this environment.\"\n />\n <StatusRow\n label=\"Archived\"\n value={annotation.archived.status ? \"Yes\" : \"No\"}\n color={annotation.archived.status ? \"red\" : \"blue\"}\n tooltip=\"Whether the current user has dismissed this guide.\"\n />\n <StatusRow\n label=\"Targeting\"\n value={annotation.targetable.status ? \"Yes\" : \"No\"}\n color={annotation.targetable.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the current user matches the guide's targeting conditions.\"\n />\n </CardContainer>\n <CardContainer title=\"Visibility\">\n <StatusRow\n label=\"Activation\"\n value={annotation.activatable.status ? \"Yes\" : \"No\"}\n color={annotation.activatable.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the current page matches the guide's activation rules.\"\n />\n <StatusRow\n label=\"Display\"\n value={selectableStatusSummary.label}\n color={selectableStatusSummary.color}\n tooltip=\"Whether the guide has been queried and is ready to render on the current page.\"\n >\n <Tooltip\n label={selectableStatusSummary.description}\n {...sharedTooltipProps}\n >\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={selectableStatusSummary.color}\n >\n {selectableStatusSummary.label}\n </Text>\n </Tooltip>\n </StatusRow>\n </CardContainer>\n <Stack\n direction=\"column\"\n justify=\"flex-end\"\n gap=\"1\"\n style={{ alignSelf: \"stretch\" }}\n >\n <Button\n size=\"0\"\n variant=\"outline\"\n onClick={() => client.resetEngagement(guide)}\n >\n Reset engagement\n </Button>\n {dashboardUrl && (\n <Button\n size=\"0\"\n variant=\"outline\"\n onClick={() => window.open(dashboardUrl, \"_blank\", \"noopener\")}\n >\n Open in dashboard\n </Button>\n )}\n </Stack>\n </Stack>\n );\n};\n"],"names":["CardContainer","title","children","React","Stack","flex","alignSelf","Text","StatusRow","label","value","color","tooltip","Tooltip","sharedTooltipProps","StatusDot","getSelectableStatusSummary","status","description","GuideRowDetails","guide","client","useGuideContext","isUncommittedGuide","Box","annotation","dashboard_url","dashboardUrl","selectableStatusSummary","selectable","active","archived","targetable","activatable","Button","resetEngagement","window","open"],"mappings":";;;;;;;;;AAiBA,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;AAAA,EAAGC,WAAW;AAAU,EAAA,mCAEtCC,GAAK,EAAA,IAAG,QAAO,MAAK,KAAI,OAAM,QAAO,QAAO,YAC1CN,CACH,mCACCG,GAAM,EAAA,WAAU,UAAS,KAAI,IAAA,GAC3BF,CACH,CACF,GAGIM,IAAYA,CAAC;AAAA,EACjBC,OAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,SAAAA;AAAAA,EACAV,UAAAA;AAOF,MAEKC,gBAAAA,EAAA,cAAAC,GAAA,EAAM,OAAM,UAAS,KAAI,IAAA,GACvBD,gBAAAA,EAAA,cAAAU,GAAA,EAAQ,SAAS,CAAC,CAACD,GAAS,OAAOA,GAAS,GAAIE,EAAAA,GAC9CX,gBAAAA,EAAA,cAAAC,GAAA,EAAM,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