@knocklabs/react 0.11.11 → 0.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.css +1 -1
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js +2 -0
  5. package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js.map +1 -0
  6. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js +1 -1
  7. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js.map +1 -1
  8. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js +1 -1
  9. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js.map +1 -1
  10. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js +1 -1
  11. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js.map +1 -1
  12. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js +1 -1
  13. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js.map +1 -1
  14. package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js +1 -1
  15. package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js.map +1 -1
  16. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js +1 -1
  17. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
  18. package/dist/esm/index.mjs +98 -97
  19. package/dist/esm/index.mjs.map +1 -1
  20. package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs +79 -0
  21. package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs.map +1 -0
  22. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +29 -10
  23. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
  24. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +73 -101
  25. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
  26. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +35 -27
  27. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -1
  28. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +111 -101
  29. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
  30. package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs +18 -13
  31. package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs.map +1 -1
  32. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +106 -83
  33. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
  34. package/dist/index.css +1 -1
  35. package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts +9 -0
  36. package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts.map +1 -0
  37. package/dist/types/modules/guide/components/Toolbar/V2/GuideContextDetails.d.ts.map +1 -1
  38. package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts +2 -2
  39. package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts.map +1 -1
  40. package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts +3 -2
  41. package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
  42. package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts +9 -2
  43. package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts.map +1 -1
  44. package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
  45. package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts +6 -0
  46. package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts.map +1 -1
  47. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +10 -5
  48. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
  49. package/package.json +5 -4
@@ -1,68 +1,62 @@
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";
1
+ import { useGuideContext as x, useStore as G } from "@knocklabs/react-core";
2
+ import { Button as C } from "@telegraph/button";
3
+ import { Icon as T } from "@telegraph/icon";
4
+ import { Box as h, Stack as n } from "@telegraph/layout";
5
+ import { Tag as A } from "@telegraph/tag";
6
6
  import { Tooltip as y } from "@telegraph/tooltip";
7
- import { Text as g } from "@telegraph/typography";
8
- import { Gauge as N } from "lucide-react";
7
+ import { Text as v } from "@telegraph/typography";
8
+ import { Gauge as R } from "lucide-react";
9
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 = ({
10
+ import { GuideAnnotatedStatusDot as i } from "./GuideAnnotatedStatusDot.mjs";
11
+ import { GuideRowDetails as D, getSelectableStatusSummary as w } from "./GuideRowDetails.mjs";
12
+ import { FOCUS_ERRORS as E } from "./helpers.mjs";
13
+ import { isUncommittedGuide as l } from "./useInspectGuideClientStore.mjs";
14
+ const z = "data-kgt-guide-row-key", S = ({
14
15
  label: e,
15
16
  color: o = "gray",
16
17
  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))
18
+ }) => /* @__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(v, { as: "span", size: "0", color: o, weight: "medium" }, e), a), N = (e) => {
19
+ if (l(e))
19
20
  return {
20
21
  color: "red",
21
22
  label: "Inactive",
22
- tooltip: "This guide has never been committed and published yet"
23
+ description: "This guide has never been committed and published yet"
23
24
  };
24
25
  const {
25
26
  annotation: o
26
27
  } = 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"
28
+ if (!o.active.status)
29
+ return {
30
+ color: "red",
31
+ label: "Inactive",
32
+ description: "This guide is inactive"
33
+ };
34
+ if (o.archived.status)
35
+ return {
36
+ color: "red",
37
+ label: "Archived",
38
+ description: "User has already dismissed this guide"
39
+ };
40
+ if (!o.targetable.status)
41
+ return {
42
+ color: "red",
43
+ label: "Not targeted",
44
+ description: o.targetable.message
45
+ };
46
+ const a = w(o.selectable.status);
47
+ return o.selectable.status === void 0 ? a : o.activatable.status ? {
48
+ ...a,
49
+ // Shorten the label we display here for space.
50
+ ...o.selectable.status === "returned" ? {
51
+ label: "Display"
52
+ } : void 0
51
53
  } : {
52
54
  color: "red",
53
55
  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
59
- } : {
60
- color: "red",
61
- label: "Inactive",
62
- tooltip: "This guide is inactive"
56
+ description: "This guide cannot be activated in the current location"
63
57
  };
64
- }, q = (e) => {
65
- if (i(e))
58
+ }, O = (e) => {
59
+ if (l(e))
66
60
  return {
67
61
  active: {
68
62
  color: "gray"
@@ -85,72 +79,49 @@ const E = ({
85
79
  } = e, a = {
86
80
  color: o.active.status ? "blue" : "red",
87
81
  tooltip: `Active: ${o.active.status ? "Yes" : "No"}`
88
- }, b = {
82
+ }, m = {
89
83
  color: o.archived.status ? "red" : "blue",
90
- tooltip: `Not archived: ${o.archived.status ? "No" : "Yes"}`
84
+ tooltip: `Archived: ${o.archived.status ? "Yes" : "No"}`
91
85
  }, u = {
92
86
  color: o.targetable.status ? "blue" : "red",
93
- tooltip: `Targeted: ${o.targetable.status ? "Yes" : "No"}`
94
- }, d = {
87
+ tooltip: `Targeting: ${o.targetable.status ? "Yes" : "No"}`
88
+ }, b = {
95
89
  color: o.activatable.status ? "blue" : "red",
96
90
  tooltip: `Activated: ${o.activatable.status ? "Yes" : "No"}`
91
+ }, s = w(o.selectable.status), d = {
92
+ color: s.color,
93
+ tooltip: s.label
97
94
  };
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
95
  return {
127
96
  active: a,
128
- archived: b,
97
+ archived: m,
129
98
  targetable: u,
130
- activatable: d,
131
- selectable: l
99
+ activatable: b,
100
+ selectable: d
132
101
  };
133
- }, Q = ({
102
+ }, P = ({
134
103
  guide: e,
135
104
  orderIndex: o,
136
105
  isExpanded: a,
137
- onClick: b
106
+ onClick: m
138
107
  }) => {
139
108
  const {
140
109
  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: {
110
+ } = x(), {
111
+ debugSettings: b
112
+ } = G(u.store, (g) => ({
113
+ debugSettings: g.debug || {}
114
+ })), [s, d] = t.useState(!1), f = b.focusedGuideKeys || {}, _ = Object.keys(f).length > 0, c = !!f[e.key], r = O(e), p = N(e), k = {
115
+ [z]: e.key
116
+ };
117
+ return /* @__PURE__ */ t.createElement(h, { rounded: "3", overflow: "hidden", border: "px", borderStyle: "solid", borderColor: a ? "gray-6" : "transparent", onMouseEnter: () => d(!0), onMouseLeave: () => d(!1), style: {
147
118
  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: {
119
+ }, ...k }, /* @__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" : c ? "gray-6" : s ? "gray-4" : "transparent", backgroundColor: a ? "surface-2" : c ? "gray-2" : s ? "surface-2" : "transparent", onClick: () => m(e.key) }, /* @__PURE__ */ t.createElement(n, { align: "center", gap: "1_5", style: {
149
120
  minWidth: 0,
150
121
  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: {
122
+ } }, /* @__PURE__ */ t.createElement(n, { w: "7", justify: "space-between", align: "center", gap: "0_5" }, /* @__PURE__ */ t.createElement(h, { w: "3" }, !e.bypass_global_group_limit && /* @__PURE__ */ t.createElement(T, { icon: R, size: "0", color: "gray", alt: "Subject to throttling" })), /* @__PURE__ */ t.createElement(v, { as: "span", size: "1", weight: "medium", color: e.bypass_global_group_limit ? "blue" : "default", style: {
152
123
  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: {
124
+ } }, o + 1)), /* @__PURE__ */ t.createElement(y, { label: `${e.key}${e.bypass_global_group_limit ? " (unthrottled)" : ""}` }, /* @__PURE__ */ t.createElement(v, { as: "code", size: "1", weight: "medium", color: "default", style: {
154
125
  display: "block",
155
126
  overflow: "hidden",
156
127
  textOverflow: "ellipsis",
@@ -158,16 +129,17 @@ const E = ({
158
129
  maxWidth: "200px"
159
130
  } }, e.key))), /* @__PURE__ */ t.createElement(n, { align: "center", gap: "1_5", style: {
160
131
  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 ? {} : {
132
+ } }, !_ && /* @__PURE__ */ t.createElement(y, { label: p.description }, /* @__PURE__ */ t.createElement(A, { size: "0", variant: "soft", color: p.color }, p.label)), /* @__PURE__ */ t.createElement(S, { label: "Elig:", color: l(e) ? "disabled" : e.annotation.isEligible ? "blue" : "gray" }, /* @__PURE__ */ t.createElement(i, { color: r.active.color, tooltip: r.active.tooltip }), /* @__PURE__ */ t.createElement(i, { color: r.archived.color, tooltip: r.archived.tooltip }), /* @__PURE__ */ t.createElement(i, { color: r.targetable.color, tooltip: r.targetable.tooltip })), /* @__PURE__ */ t.createElement(S, { label: "Vis:", color: l(e) ? "disabled" : e.annotation.isQualified && e.annotation.selectable.status === "returned" ? "blue" : "gray" }, /* @__PURE__ */ t.createElement(i, { color: r.activatable.color, tooltip: r.activatable.tooltip }), /* @__PURE__ */ t.createElement(i, { color: r.selectable.color, tooltip: r.selectable.tooltip })), /* @__PURE__ */ t.createElement(y, { label: l(e) ? E.focusUncommittedGuide : e.annotation.selectable.status === void 0 ? E.focusUnselectableGuide : "", enabled: l(e) || e.annotation.selectable.status === void 0 }, /* @__PURE__ */ t.createElement(C, { size: "0", variant: c ? "solid" : "outline", color: c ? "blue" : "gray", disabled: l(e) || e.annotation.selectable.status === void 0, onClick: (g) => {
133
+ g.stopPropagation(), u.setDebug({
134
+ ...b,
135
+ focusedGuideKeys: c ? {} : {
165
136
  [e.key]: !0
166
137
  }
167
138
  });
168
- } }, "Focus")))), a && /* @__PURE__ */ t.createElement(G, { guide: e }));
139
+ } }, "Focus")))), a && /* @__PURE__ */ t.createElement(D, { guide: e }));
169
140
  };
170
141
  export {
171
- Q as GuideRow
142
+ z as GUIDE_ROW_DATA_SELECTOR,
143
+ P as GuideRow
172
144
  };
173
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 { 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,WAAWF,SAOvBF,EAAWK,WAAWH,WAAWI,SAC5B;AAAA,IACLf,OAAO;AAAA,IACPD,OAAO;AAAA,IACPS,SAAS;AAAA,EACX,IAEGC,EAAWO,YAAYL,SAOxBF,EAAWK,WAAWH,WAAW,YAC5B;AAAA,IACLX,OAAO;AAAA,IACPD,OAAO;AAAA,IACPS,SAAS;AAAA,EACX,IAEEC,EAAWK,WAAWH,WAAW,cAC5B;AAAA,IACLX,OAAO;AAAA,IACPD,OAAO;AAAA,IACPS,SACE;AAAA,EACJ,IAEEC,EAAWK,WAAWH,WAAW,aAC5B;AAAA,IACLX,OAAO;AAAA,IACPD,OAAO;AAAA,IACPS,SAAS;AAAA,EACX,IAGK;AAAA,IAAER,OAAO;AAAA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D,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;"}
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","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AEClB,KAAc,gBAAAtB,EAAA,cAACqE,GAAgB,EAAA,OAAAjE,EAAA,CAAgB,CAClD;AAEJ;"}
@@ -1,51 +1,59 @@
1
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,
2
+ import { Box as c, Stack as l } from "@telegraph/layout";
3
+ import { Tooltip as u } from "@telegraph/tooltip";
4
+ import { Text as s } from "@telegraph/typography";
5
+ import { GuideAnnotatedStatusDot as d } from "./GuideAnnotatedStatusDot.mjs";
6
+ import { FOCUS_ERRORS as m } from "./helpers.mjs";
7
+ import { isUncommittedGuide as p } from "./useInspectGuideClientStore.mjs";
8
+ const n = ({
9
+ title: i,
8
10
  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: {
11
+ }) => /* @__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: {
10
12
  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
+ } }, /* @__PURE__ */ e.createElement(s, { as: "span", size: "0", color: "gray", weight: "medium" }, i), /* @__PURE__ */ e.createElement(l, { direction: "column", gap: "1", mt: "1" }, t)), r = ({
14
+ label: i,
13
15
  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) {
16
+ color: a,
17
+ tooltip: o
18
+ }) => /* @__PURE__ */ e.createElement(l, { align: "center", gap: "1" }, /* @__PURE__ */ e.createElement(u, { enabled: !!o, label: o, delayDuration: 500 }, /* @__PURE__ */ e.createElement(l, { as: "span", align: "center", gap: "1", display: "inline-flex" }, /* @__PURE__ */ e.createElement(d, { color: a, tooltip: `${i}: ${t}` }), /* @__PURE__ */ e.createElement(s, { as: "span", size: "1", weight: "medium" }, i, ":"), /* @__PURE__ */ e.createElement(s, { as: "span", size: "1", weight: "medium", color: a }, t)))), b = (i) => {
19
+ switch (i) {
17
20
  case "returned":
18
21
  return {
19
- value: "Ready to display",
20
- color: "blue"
22
+ label: "Ready to display",
23
+ color: "blue",
24
+ description: "This guide is queried and ready to display"
21
25
  };
22
26
  case "throttled":
23
27
  return {
24
- value: "Throttled",
25
- color: "yellow"
28
+ label: "Throttled",
29
+ color: "yellow",
30
+ description: "This guide is queried and ready to display, but throttled currently"
26
31
  };
27
32
  case "queried":
28
33
  return {
29
- value: "Queued",
30
- color: "gray"
34
+ label: "Queued",
35
+ color: "gray",
36
+ description: "This guide is queried but is not ready to display"
31
37
  };
32
38
  default:
33
39
  return {
34
- value: "Not found",
35
- color: "red"
40
+ label: "Not queried",
41
+ color: "red",
42
+ description: `This guide is not queried (${m.focusUnselectableGuide.toLowerCase()})`
36
43
  };
37
44
  }
38
- }, E = ({
39
- guide: a
45
+ }, x = ({
46
+ guide: i
40
47
  }) => {
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."));
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."));
43
50
  const {
44
51
  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 })));
52
+ } = i, a = b(t.selectable.status);
53
+ return /* @__PURE__ */ e.createElement(l, { px: "3", py: "2", gap: "2", direction: "row", align: "flex-start" }, /* @__PURE__ */ e.createElement(n, { title: "Eligibility" }, /* @__PURE__ */ e.createElement(r, { label: "Active", value: t.active.status ? "Yes" : "No", color: t.active.status ? "blue" : "red", tooltip: "Eligible if the guide is currently active" }), /* @__PURE__ */ e.createElement(r, { label: "Archived", value: t.archived.status ? "Yes" : "No", color: t.archived.status ? "red" : "blue", tooltip: "Eligible if the guide has not been dismissed/archived by the user already" }), /* @__PURE__ */ e.createElement(r, { label: "Targeting", value: t.targetable.status ? "Yes" : "No", color: t.targetable.status ? "blue" : "red", tooltip: "Eligible if the user meets the guide's targeting conditions" })), /* @__PURE__ */ e.createElement(n, { title: "Visibility" }, /* @__PURE__ */ e.createElement(r, { label: "Activation", value: t.activatable.status ? "Yes" : "No", color: t.activatable.status ? "blue" : "red", tooltip: "Visible when the user's current location matches the guide's activation rules" }), /* @__PURE__ */ e.createElement(r, { label: "Display", value: a.label, color: a.color, tooltip: /* @__PURE__ */ e.createElement(s, { as: "span", size: "1" }, "Visible when the guide is queried via `useGuide(s)` in the current page,", /* @__PURE__ */ e.createElement("br", null), "and ready to display per its position in the display pipeline:", /* @__PURE__ */ e.createElement("br", null), a.description) })));
47
54
  };
48
55
  export {
49
- E as GuideRowDetails
56
+ x as GuideRowDetails,
57
+ b as getSelectableStatusSummary
50
58
  };
51
59
  //# 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 { 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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,gBAAAA,EAAA,cAACG,GAAK,EAAA,IAAG,QAAO,MAAK,KAAI,OAAM,UAAM,oDAErC,CACF;AAIE,QAAA;AAAA,IAAEY,YAAAA;AAAAA,EAAAA,IAAeH,GACjBI,IAAUP,EAAgBM,EAAWE,WAAWP,MAAM;AAG1D,SAAAV,gBAAAA,EAAA,cAACC,KAAM,IAAG,KAAI,IAAG,KAAI,KAAI,KAAI,WAAU,OAAM,OAAM,gBAChDD,gBAAAA,EAAA,cAAAH,GAAA,EAAc,OAAM,cACnB,GAAAG,gBAAAA,EAAA,cAACI,KACC,OAAM,UACN,OAAOW,EAAWG,OAAOR,SAAS,QAAQ,MAC1C,OAAOK,EAAWG,OAAOR,SAAS,SAAS,MAAM,CAAA,GAElDV,gBAAAA,EAAA,cAAAI,GAAA,EACC,OAAM,gBACN,OAAQW,EAAWI,SAAST,SAAiB,OAAR,OACrC,OAAQK,EAAWI,SAAST,SAAkB,QAAT,QAAe,GAErDV,gBAAAA,EAAA,cAAAI,GAAA,EACC,OAAM,aACN,OAAOW,EAAWK,WAAWV,SAAS,QAAQ,MAC9C,OAAOK,EAAWK,WAAWV,SAAS,SAAS,MAAM,CAAA,CAEzD,mCAECb,GAAc,EAAA,OAAM,aACnB,GAAAG,gBAAAA,EAAA,cAACI,GACC,EAAA,OAAM,cACN,OAAOW,EAAWM,YAAYX,SAAS,QAAQ,MAC/C,OAAOK,EAAWM,YAAYX,SAAS,SAAS,OAAM,GAEvDV,gBAAAA,EAAA,cAAAI,GAAA,EACC,OAAM,WACN,OAAOY,EAAQV,OACf,OAAOU,EAAQT,MAAM,CAAA,CAEzB,CACF;AAEJ;"}
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 { FOCUS_ERRORS } 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 }}\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 tooltip,\n}: {\n label: string;\n value: string;\n color: StatusColor;\n tooltip?: React.ReactNode;\n}) => {\n return (\n <Stack align=\"center\" gap=\"1\">\n <Tooltip enabled={!!tooltip} label={tooltip} delayDuration={500}>\n <Stack as=\"span\" 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 <Text as=\"span\" size=\"1\" weight=\"medium\" color={color}>\n {value}\n </Text>\n </Stack>\n </Tooltip>\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: \"This guide is queried and ready to display\",\n };\n case \"throttled\":\n return {\n label: \"Throttled\",\n color: \"yellow\",\n description:\n \"This guide is queried and ready to display, but throttled currently\",\n };\n case \"queried\":\n return {\n label: \"Queued\",\n color: \"gray\",\n description: \"This guide is queried but is not ready to display\",\n };\n default:\n return {\n label: \"Not queried\",\n color: \"red\",\n description: `This guide is not queried (${FOCUS_ERRORS.focusUnselectableGuide.toLowerCase()})`,\n };\n }\n};\n\nexport const GuideRowDetails = ({\n guide,\n}: {\n guide: AnnotatedGuide | UncommittedGuide;\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 } = guide;\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\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 tooltip=\"Eligible if the guide is currently active\"\n />\n <StatusRow\n label=\"Archived\"\n value={annotation.archived.status ? \"Yes\" : \"No\"}\n color={annotation.archived.status ? \"red\" : \"blue\"}\n tooltip=\"Eligible if the guide has not been dismissed/archived by the user already\"\n />\n <StatusRow\n label=\"Targeting\"\n value={annotation.targetable.status ? \"Yes\" : \"No\"}\n color={annotation.targetable.status ? \"blue\" : \"red\"}\n tooltip=\"Eligible if the user meets the guide's targeting conditions\"\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 tooltip=\"Visible when the user's current location matches the guide's activation rules\"\n />\n <StatusRow\n label=\"Display\"\n value={selectableStatusSummary.label}\n color={selectableStatusSummary.color}\n tooltip={\n <Text as=\"span\" size=\"1\">\n Visible when the guide is queried via `useGuide(s)` in the current\n page,\n <br />\n and ready to display per its position in the display pipeline:\n <br />\n {selectableStatusSummary.description}\n </Text>\n }\n />\n </CardContainer>\n </Stack>\n );\n};\n"],"names":["CardContainer","title","children","React","Stack","flex","Text","StatusRow","label","value","color","tooltip","Tooltip","StatusDot","getSelectableStatusSummary","status","description","FOCUS_ERRORS","focusUnselectableGuide","toLowerCase","GuideRowDetails","guide","isUncommittedGuide","Box","annotation","selectableStatusSummary","selectable","active","archived","targetable","activatable"],"mappings":";;;;;;;AAeA,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;AAAAA,EACAC,SAAAA;AAMF,MAEIR,gBAAAA,EAAA,cAACC,GAAM,EAAA,OAAM,UAAS,KAAI,IACxB,GAAAD,gBAAAA,EAAA,cAACS,GAAQ,EAAA,SAAS,CAAC,CAACD,GAAS,OAAOA,GAAS,eAAe,IAC1D,GAAAR,gBAAAA,EAAA,cAACC,GAAM,EAAA,IAAG,QAAO,OAAM,UAAS,KAAI,KAAI,SAAQ,cAC9C,GAAAD,gBAAAA,EAAA,cAACU,GAAU,EAAA,OAAAH,GAAc,SAAS,GAAGF,CAAK,KAAKC,CAAK,GAAG,CAAA,GACvDN,gBAAAA,EAAA,cAACG,GAAK,EAAA,IAAG,QAAO,MAAK,KAAI,QAAO,SAC7BE,GAAAA,GAAM,GACT,GACCL,gBAAAA,EAAA,cAAAG,GAAA,EAAK,IAAG,QAAO,MAAK,KAAI,QAAO,UAAS,OAAAI,EACtC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