@knocklabs/react 0.11.12 → 0.11.14

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 (52) hide show
  1. package/CHANGELOG.md +22 -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 +1 -1
  5. package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js.map +1 -1
  6. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js +1 -1
  7. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js.map +1 -1
  8. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js +1 -1
  9. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js.map +1 -1
  10. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js +1 -1
  11. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js.map +1 -1
  12. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js +1 -1
  13. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js.map +1 -1
  14. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js +1 -1
  15. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js.map +1 -1
  16. package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js +1 -1
  17. package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js.map +1 -1
  18. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
  19. package/dist/cjs/modules/guide/providers/KnockGuideProvider.js +1 -1
  20. package/dist/cjs/modules/guide/providers/KnockGuideProvider.js.map +1 -1
  21. package/dist/esm/index.mjs +1 -1
  22. package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs +32 -31
  23. package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs.map +1 -1
  24. package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs +6 -5
  25. package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs.map +1 -1
  26. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +14 -13
  27. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
  28. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +37 -37
  29. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
  30. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +39 -29
  31. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -1
  32. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +83 -77
  33. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
  34. package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs +5 -48
  35. package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs.map +1 -1
  36. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
  37. package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs +12 -10
  38. package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs.map +1 -1
  39. package/dist/index.css +1 -1
  40. package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts.map +1 -1
  41. package/dist/types/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.d.ts.map +1 -1
  42. package/dist/types/modules/guide/components/Toolbar/V2/GuideContextDetails.d.ts.map +1 -1
  43. package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
  44. package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts.map +1 -1
  45. package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts +5 -1
  46. package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
  47. package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts +3 -7
  48. package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts.map +1 -1
  49. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +1 -2
  50. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
  51. package/dist/types/modules/guide/providers/KnockGuideProvider.d.ts.map +1 -1
  52. package/package.json +15 -14
@@ -1,59 +1,69 @@
1
1
  import e from "react";
2
- import { Box as c, Stack as l } from "@telegraph/layout";
3
- import { Tooltip as u } from "@telegraph/tooltip";
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 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,
10
- children: t
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
- } }, /* @__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,
15
- value: t,
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) {
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: "This guide is queried and ready to display"
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: "This guide is queried and ready to display, but throttled currently"
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: "This guide is queried but is not ready to display"
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: `This guide is not queried (${m.focusUnselectableGuide.toLowerCase()})`
46
+ description: "No useGuide(s) call on this page matches this guide."
43
47
  };
44
48
  }
45
- }, x = ({
46
- guide: i
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
- annotation: t
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) })));
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
- x as GuideRowDetails,
57
- b as getSelectableStatusSummary
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 { 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,cA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AAOZ,SAAS,QAAQ,MAC1C,OAAOS,EAAWG,OAAOZ,SAAS,SAAS,OAC3C,SAAQ,4CAAA,CAA2C,GAErDZ,gBAAAA,EAAA,cAACI,GACC,EAAA,OAAM,YACN,OAAOiB,EAAWI,SAASb,SAAS,QAAQ,MAC5C,OAAOS,EAAWI,SAASb,SAAS,QAAQ,QAC5C,SAAQ,4EAA2E,CAAA,GAEpFZ,gBAAAA,EAAA,cAAAI,GAAA,EACC,OAAM,aACN,OAAOiB,EAAWK,WAAWd,SAAS,QAAQ,MAC9C,OAAOS,EAAWK,WAAWd,SAAS,SAAS,OAC/C,SAAQ,8DAA6D,CAAA,CAEzE,GAEAZ,gBAAAA,EAAA,cAACH,GAAc,EAAA,OAAM,aACnB,GAAAG,gBAAAA,EAAA,cAACI,GACC,EAAA,OAAM,cACN,OAAOiB,EAAWM,YAAYf,SAAS,QAAQ,MAC/C,OAAOS,EAAWM,YAAYf,SAAS,SAAS,OAChD,SAAQ,gFAA+E,CAAA,GAExFZ,gBAAAA,EAAA,cAAAI,GAAA,EACC,OAAM,WACN,OAAOkB,EAAwBjB,OAC/B,OAAOiB,EAAwBf,OAC/B,SACEP,gBAAAA,EAAA,cAACG,GAAK,EAAA,IAAG,QAAO,MAAK,IAAG,GAAA,4EAGrBH,gBAAAA,EAAA,cAAA,MAAA,IAAE,GAAA,kEAEFA,gBAAAA,EAAA,cAAA,MAAA,IAAE,GACFsB,EAAwBT,WAC3B,EACD,CAAA,CAEL,CACF;AAEJ;"}
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,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,CACF,GACAN,gBAAAA,EAAA,cAACC,GACC,EAAA,WAAU,UACV,SAAQ,YACR,KAAI,KACJ,OAAO;AAAA,IAAEE,WAAW;AAAA,EAAA,EAEpB,GAAAH,gBAAAA,EAAA,cAAC+B,GACC,EAAA,MAAK,KACL,SAAQ,WACR,SAAS,MAAMb,EAAOc,gBAAgBf,CAAK,EAAA,GAAE,kBAG/C,GACCO,KACExB,gBAAAA,EAAA,cAAA+B,GAAA,EACC,MAAK,KACL,SAAQ,WACR,SAAS,MAAME,OAAOC,KAAKV,GAAc,UAAU,UAAU,EAAE,GAAA,mBAGjE,CAEJ,CACF;AAEJ;"}
@@ -1,154 +1,160 @@
1
- import { useGuideContext as _ } from "@knocklabs/react-core";
2
- import { Button as h } from "@telegraph/button";
3
- import { Icon as K } from "@telegraph/icon";
1
+ import { KnockGuideClient as A } from "@knocklabs/client";
2
+ import { useGuideContext as L } from "@knocklabs/react-core";
3
+ import { Button as E } from "@telegraph/button";
4
+ import { Icon as T } from "@telegraph/icon";
4
5
  import { Box as u, Stack as r } from "@telegraph/layout";
5
- import { SegmentedControl as m } from "@telegraph/segmented-control";
6
- import { Tooltip as w } from "@telegraph/tooltip";
7
- import { Text as k } from "@telegraph/typography";
8
- import { GripVertical as L, ChevronDown as A, ChevronRight as T, SlidersHorizontal as B, LogOut as H, Minimize2 as V } from "lucide-react";
6
+ import { SegmentedControl as p } from "@telegraph/segmented-control";
7
+ import { Tooltip as h } from "@telegraph/tooltip";
8
+ import { Text as w } from "@telegraph/typography";
9
+ import { GripVertical as B, ChevronDown as H, ChevronRight as V, SlidersHorizontal as j, LogOut as F, Minimize2 as M } from "lucide-react";
9
10
  import e from "react";
10
- import { KnockButton as j } from "../KnockButton.mjs";
11
- import { TOOLBAR_Z_INDEX as F } from "../shared.mjs";
11
+ import { KnockButton as W } from "../KnockButton.mjs";
12
+ import { TOOLBAR_Z_INDEX as Y } from "../shared.mjs";
12
13
  /* empty css */
13
- import { FocusChin as M } from "./FocusChin.mjs";
14
+ import { FocusChin as X } from "./FocusChin.mjs";
14
15
  import { GuideContextDetails as N } from "./GuideContextDetails.mjs";
15
- import { GuideRow as W } from "./GuideRow.mjs";
16
- import { getRunConfig as Q, clearRunConfigLS as X } from "./helpers.mjs";
17
- import { useDraggable as Y } from "./useDraggable.mjs";
18
- import { useInspectGuideClientStore as Z } from "./useInspectGuideClientStore.mjs";
19
- const q = ".", J = "540px", S = ({
20
- children: o
16
+ import { GuideRow as U } from "./GuideRow.mjs";
17
+ import { sharedTooltipProps as k } from "./helpers.mjs";
18
+ import { useDraggable as Z } from "./useDraggable.mjs";
19
+ import { useInspectGuideClientStore as q } from "./useInspectGuideClientStore.mjs";
20
+ const J = ".", Q = "540px", $ = ["0 0 0 1px rgba(0, 0, 0, 0.06)", "0 0 0 1px rgba(255, 255, 255, 0.10)", "inset 0 1px 0 rgba(255, 255, 255, 0.04)", "0 1px 1px 0 rgba(0, 0, 0, 0.04)", "0 4px 6px -1px rgba(0, 0, 0, 0.05)", "0 8px 16px -4px rgba(0, 0, 0, 0.06)"].join(", "), G = ({
21
+ children: i
21
22
  }) => /* @__PURE__ */ e.createElement("kbd", { style: {
22
23
  display: "inline-block",
23
24
  padding: "1px 4px",
24
25
  borderRadius: "var(--tgph-rounded-2)",
25
26
  border: "1px solid rgba(255, 255, 255, 0.3)",
26
27
  backgroundColor: "rgba(255, 255, 255, 0.15)"
27
- } }, o), G = (o, a) => o.filter((s) => {
28
- const {
29
- isEligible: i,
30
- isQualified: p
31
- } = s.annotation;
32
- return !(a === "only-displayable" && !(i && p) || a === "only-eligible" && !i || a === "only-active" && !s.annotation.active.status);
33
- }), be = () => {
28
+ } }, i), ee = (i) => {
29
+ switch (i) {
30
+ case "all-guides":
31
+ return "You have no guides. Get started by creating a guide.";
32
+ case "only-active":
33
+ return "There are no active guides.";
34
+ case "only-eligible":
35
+ return "Your current user is not eligible for any guides.";
36
+ }
37
+ }, S = (i, o) => i.filter((l) => !(o === "only-eligible" && !l.annotation.isEligible || o === "only-active" && !l.annotation.active.status)), he = ({
38
+ readyToTarget: i
39
+ }) => {
34
40
  const {
35
41
  client: o
36
- } = _(), [a, s] = e.useState("only-active"), [i, p] = e.useState(() => Q()), [g, f] = e.useState(!1), [d, O] = e.useState(!1), [z, D] = e.useState();
42
+ } = L(), [l, m] = e.useState("only-active"), [s, _] = e.useState(() => A.getToolbarRunConfigFromUrl()), [v, g] = e.useState(!1), [d, z] = e.useState(!1), [I, D] = e.useState();
37
43
  e.useEffect(() => {
38
44
  D(void 0);
39
- }, [a]), e.useEffect(() => {
40
- var x;
45
+ }, [l]), e.useEffect(() => {
46
+ var y;
41
47
  const {
42
48
  isVisible: t = !1,
43
49
  focusedGuideKeys: n = {}
44
- } = i || {}, c = (x = o.store.state.debug) == null ? void 0 : x.debugging;
45
- return t && !c && (o.setDebug({
50
+ } = s || {}, c = (y = o.store.state.debug) == null ? void 0 : y.debugging;
51
+ return t && !c && i && (o.setDebug({
46
52
  focusedGuideKeys: n
47
- }), Object.keys(n).length > 0 && s("all-guides")), () => {
53
+ }), Object.keys(n).length > 0 && m("all-guides")), () => {
48
54
  o.unsetDebug();
49
55
  };
50
- }, [i, o, s]), e.useEffect(() => {
56
+ }, [i, s, o, m]), e.useEffect(() => {
51
57
  const t = (n) => {
52
- n.ctrlKey && n.key === q && !n.repeat && (n.preventDefault(), f((c) => !c));
58
+ n.ctrlKey && n.key === J && !n.repeat && (n.preventDefault(), g((c) => !c));
53
59
  };
54
60
  return window.addEventListener("keydown", t), () => {
55
61
  window.removeEventListener("keydown", t);
56
62
  };
57
63
  }, []);
58
- const v = e.useRef(null), C = e.useRef(null), {
64
+ const C = e.useRef(null), O = e.useRef(null), {
59
65
  position: R,
60
- isDragging: b,
61
- handlePointerDown: y,
62
- hasDraggedRef: I
63
- } = Y({
64
- elementRef: v,
65
- reclampDeps: [g],
66
+ isDragging: f,
67
+ handlePointerDown: b,
68
+ hasDraggedRef: P
69
+ } = Z({
70
+ elementRef: C,
71
+ reclampDeps: [v],
66
72
  initialPosition: {
67
73
  top: 16,
68
74
  right: 16
69
75
  }
70
- }), l = Z(i);
71
- if (!l || !(i != null && i.isVisible))
76
+ }), a = q(s);
77
+ if (!a || !(s != null && s.isVisible))
72
78
  return null;
73
- const E = l.status === "ok" ? G(l.guides, a) : [];
74
- return /* @__PURE__ */ e.createElement(u, { tgphRef: v, position: "fixed", style: {
79
+ const x = a.status === "ok" ? S(a.guides, l) : [];
80
+ return /* @__PURE__ */ e.createElement(u, { tgphRef: C, position: "fixed", style: {
75
81
  top: R.top + "px",
76
82
  right: R.right + "px",
77
- zIndex: F
78
- } }, g ? /* @__PURE__ */ e.createElement(w, { side: "left", delayDuration: 500, label: /* @__PURE__ */ e.createElement(k, { as: "span", size: "1" }, "Guide Toolbar", /* @__PURE__ */ e.createElement(r, { display: "inline-block", ml: "3" }, /* @__PURE__ */ e.createElement(S, null, "ctrl"), " + ", /* @__PURE__ */ e.createElement(S, null, "."))) }, /* @__PURE__ */ e.createElement(r, { border: "px", rounded: "4", align: "center", justify: "center", w: "10", h: "10", onPointerDown: y, backgroundColor: "surface-1", style: {
79
- cursor: b ? "grabbing" : "grab",
83
+ zIndex: Y
84
+ } }, v ? /* @__PURE__ */ e.createElement(h, { side: "left", label: /* @__PURE__ */ e.createElement(w, { as: "span", size: "1" }, "Guide Toolbar", /* @__PURE__ */ e.createElement(r, { display: "inline-block", ml: "3" }, /* @__PURE__ */ e.createElement(G, null, "ctrl"), " + ", /* @__PURE__ */ e.createElement(G, null, "."))), ...k }, /* @__PURE__ */ e.createElement(r, { border: "px", rounded: "4", align: "center", justify: "center", w: "10", h: "10", onPointerDown: b, backgroundColor: "surface-1", style: {
85
+ cursor: f ? "grabbing" : "grab",
80
86
  touchAction: "none",
81
87
  userSelect: "none",
82
88
  animation: "toolbar-collapse-fade-in 150ms ease-out"
83
89
  } }, /* @__PURE__ */ e.createElement(u, { style: {
84
90
  transform: "scale(0.7)",
85
91
  transformOrigin: "center center"
86
- } }, /* @__PURE__ */ e.createElement(j, { onClick: () => {
87
- I.current || f(!1);
88
- }, positioned: !1 })))) : /* @__PURE__ */ e.createElement(r, { direction: "column", backgroundColor: "surface-1", rounded: "4", border: "px", overflow: "hidden", style: {
89
- width: J,
90
- boxShadow: "0 8px 32px var(--tgph-gray-5)",
92
+ } }, /* @__PURE__ */ e.createElement(W, { onClick: () => {
93
+ P.current || g(!1);
94
+ }, positioned: !1 })))) : /* @__PURE__ */ e.createElement(r, { direction: "column", backgroundColor: "surface-1", rounded: "4", overflow: "hidden", style: {
95
+ width: Q,
96
+ boxShadow: $,
91
97
  animation: "toolbar-expand-fade-in 150ms ease-out"
92
- } }, /* @__PURE__ */ e.createElement(r, { w: "full", p: "2", justify: "space-between", direction: "row", align: "center", gap: "2", borderBottom: "px", onPointerDown: y, style: {
98
+ } }, /* @__PURE__ */ e.createElement(r, { w: "full", p: "2", justify: "space-between", direction: "row", align: "center", gap: "2", borderBottom: "px", onPointerDown: b, style: {
93
99
  boxSizing: "border-box",
94
- cursor: b ? "grabbing" : "grab",
100
+ cursor: f ? "grabbing" : "grab",
95
101
  touchAction: "none",
96
102
  userSelect: "none"
97
103
  } }, /* @__PURE__ */ e.createElement(r, { align: "center", gap: "1_5", style: {
98
104
  minWidth: 0,
99
105
  flex: 1
100
106
  } }, /* @__PURE__ */ e.createElement(r, { display: "inline-flex", align: "center", style: {
101
- cursor: b ? "grabbing" : "grab",
107
+ cursor: f ? "grabbing" : "grab",
102
108
  touchAction: "none",
103
109
  userSelect: "none"
104
110
  }, onPointerDown: (t) => {
105
- t.stopPropagation(), y(t);
106
- } }, /* @__PURE__ */ e.createElement(K, { color: "gray", size: "1", icon: L, "aria-hidden": !0 })), /* @__PURE__ */ e.createElement(r, { align: "center", gap: "1_5", onPointerDown: (t) => t.stopPropagation() }, /* @__PURE__ */ e.createElement(m.Root, { size: "1", type: "single", value: a, onValueChange: (t) => {
111
+ t.stopPropagation(), b(t);
112
+ } }, /* @__PURE__ */ e.createElement(T, { color: "gray", size: "1", icon: B, "aria-hidden": !0 })), /* @__PURE__ */ e.createElement(r, { align: "center", gap: "1_5", onPointerDown: (t) => t.stopPropagation() }, /* @__PURE__ */ e.createElement(p.Root, { size: "1", type: "single", value: l, onValueChange: (t) => {
107
113
  if (!t) return;
108
114
  const n = o.store.state.debug, c = Object.keys((n == null ? void 0 : n.focusedGuideKeys) || {});
109
- l.status === "ok" && c.length > 0 && (G(l.guides, t).find((P) => P.key === c[0]) || o.setDebug({
115
+ a.status === "ok" && c.length > 0 && (S(a.guides, t).find((K) => K.key === c[0]) || o.setDebug({
110
116
  ...n,
111
117
  focusedGuideKeys: {}
112
- })), s(t);
113
- } }, /* @__PURE__ */ e.createElement(m.Option, { value: "all-guides", style: {
118
+ })), m(t);
119
+ } }, /* @__PURE__ */ e.createElement(p.Option, { value: "all-guides", style: {
114
120
  width: "54px"
115
- } }, "All"), /* @__PURE__ */ e.createElement(m.Option, { value: "only-active", style: {
121
+ } }, "All"), /* @__PURE__ */ e.createElement(p.Option, { value: "only-active", style: {
116
122
  width: "54px"
117
- } }, "Active"), /* @__PURE__ */ e.createElement(m.Option, { value: "only-eligible", style: {
123
+ } }, "Active"), /* @__PURE__ */ e.createElement(p.Option, { value: "only-eligible", style: {
118
124
  width: "54px"
119
- } }, "Eligible")), /* @__PURE__ */ e.createElement(w, { label: "Settings & target params" }, /* @__PURE__ */ e.createElement(h, { size: "1", variant: d ? "outline" : "ghost", color: d ? "blue" : "gray", leadingIcon: {
120
- icon: B,
125
+ } }, "Eligible")), /* @__PURE__ */ e.createElement(h, { label: "Settings", ...k }, /* @__PURE__ */ e.createElement(E, { size: "1", variant: d ? "outline" : "ghost", color: d ? "blue" : "gray", leadingIcon: {
126
+ icon: j,
121
127
  alt: "Inspect target params"
122
128
  }, trailingIcon: d ? {
123
- icon: A,
129
+ icon: H,
124
130
  alt: "Hide context data"
125
131
  } : {
126
- icon: T,
132
+ icon: V,
127
133
  alt: "Show context data"
128
- }, onClick: () => O((t) => !t) })))), /* @__PURE__ */ e.createElement(r, { align: "center", gap: "1_5", style: {
134
+ }, onClick: () => z((t) => !t) })))), /* @__PURE__ */ e.createElement(r, { align: "center", gap: "1_5", style: {
129
135
  flexShrink: 0
130
- }, onPointerDown: (t) => t.stopPropagation() }, /* @__PURE__ */ e.createElement(r, { align: "center", gap: "1_5" }, /* @__PURE__ */ e.createElement(h, { size: "1", variant: "outline", leadingIcon: {
131
- icon: H,
136
+ }, onPointerDown: (t) => t.stopPropagation() }, /* @__PURE__ */ e.createElement(r, { align: "center", gap: "1_5" }, /* @__PURE__ */ e.createElement(E, { size: "1", variant: "outline", leadingIcon: {
137
+ icon: F,
132
138
  alt: "Exit"
133
139
  }, onClick: () => {
134
- p((t) => ({
140
+ _((t) => ({
135
141
  ...t,
136
142
  isVisible: !1
137
- })), X(), o.unsetDebug();
138
- } }, "Exit"), /* @__PURE__ */ e.createElement(w, { label: "Minimize toolbar" }, /* @__PURE__ */ e.createElement(h, { size: "1", variant: "outline", leadingIcon: {
139
- icon: V,
143
+ })), o.unsetDebug();
144
+ } }, "Exit"), /* @__PURE__ */ e.createElement(h, { label: "Minimize toolbar", ...k }, /* @__PURE__ */ e.createElement(E, { size: "1", variant: "outline", leadingIcon: {
145
+ icon: M,
140
146
  alt: "Minimize"
141
- }, onClick: () => f(!0) }))))), d && /* @__PURE__ */ e.createElement(u, { borderBottom: "px" }, /* @__PURE__ */ e.createElement(N, null)), /* @__PURE__ */ e.createElement(u, { tgphRef: C, p: "1", overflow: "auto", style: {
147
+ }, onClick: () => g(!0) }))))), d && /* @__PURE__ */ e.createElement(u, { borderBottom: "px" }, /* @__PURE__ */ e.createElement(N, null)), /* @__PURE__ */ e.createElement(u, { tgphRef: O, p: "1", overflow: "auto", style: {
142
148
  maxHeight: "calc(80vh - 96px)"
143
- } }, l.status === "error" ? /* @__PURE__ */ e.createElement(u, { px: "2", pb: "1", style: {
149
+ } }, a.status === "error" ? /* @__PURE__ */ e.createElement(u, { px: "2", pb: "1", style: {
144
150
  lineHeight: "1.2"
145
- } }, /* @__PURE__ */ e.createElement(k, { as: "span", size: "1", weight: "medium", color: l.error === "no_guides_fetched" ? "default" : "red" }, l.message)) : E.length === 0 ? /* @__PURE__ */ e.createElement(u, { px: "2", pb: "1", style: {
151
+ } }, /* @__PURE__ */ e.createElement(w, { as: "span", size: "1", weight: "medium", color: a.error === "no_guides_fetched" ? "default" : "red" }, a.message)) : x.length === 0 ? /* @__PURE__ */ e.createElement(u, { px: "2", pb: "1", style: {
146
152
  lineHeight: "1.2"
147
- } }, /* @__PURE__ */ e.createElement(k, { as: "span", size: "1", weight: "medium", color: "default" }, "No guides match the current filter.")) : E.map((t) => /* @__PURE__ */ e.createElement(W, { key: t.key, guide: t, orderIndex: t.orderIndex, isExpanded: t.key === z, onClick: () => {
153
+ } }, /* @__PURE__ */ e.createElement(w, { as: "span", size: "1", weight: "medium", color: "default" }, ee(l))) : x.map((t) => /* @__PURE__ */ e.createElement(U, { key: t.key, guide: t, orderIndex: t.orderIndex, isExpanded: t.key === I, onClick: () => {
148
154
  D((n) => n && n === t.key ? void 0 : t.key);
149
- } }))), /* @__PURE__ */ e.createElement(M, { guides: E, guideListRef: C })));
155
+ } }))), /* @__PURE__ */ e.createElement(X, { guides: x, guideListRef: O })));
150
156
  };
151
157
  export {
152
- be as V2
158
+ he as V2
153
159
  };
154
160
  //# sourceMappingURL=V2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"V2.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { SegmentedControl } from \"@telegraph/segmented-control\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport {\n ChevronDown,\n ChevronRight,\n GripVertical,\n LogOut,\n Minimize2,\n SlidersHorizontal,\n} from \"lucide-react\";\nimport React from \"react\";\n\nimport { KnockButton } from \"../KnockButton\";\nimport { TOOLBAR_Z_INDEX } from \"../shared\";\nimport \"../styles.css\";\n\nimport { FocusChin } from \"./FocusChin\";\nimport { GuideContextDetails } from \"./GuideContextDetails\";\nimport { GuideRow } from \"./GuideRow\";\nimport { DisplayOption, clearRunConfigLS, getRunConfig } from \"./helpers\";\nimport { useDraggable } from \"./useDraggable\";\nimport {\n InspectionResultOk,\n useInspectGuideClientStore,\n} from \"./useInspectGuideClientStore\";\n\nconst TOGGLE_COLLAPSED_HOTKEY = \".\";\n\nconst TOOLBAR_WIDTH = \"540px\";\n\nconst Kbd = ({ children }: { children: React.ReactNode }) => {\n return (\n <kbd\n style={{\n display: \"inline-block\",\n padding: \"1px 4px\",\n borderRadius: \"var(--tgph-rounded-2)\",\n border: \"1px solid rgba(255, 255, 255, 0.3)\",\n backgroundColor: \"rgba(255, 255, 255, 0.15)\",\n }}\n >\n {children}\n </kbd>\n );\n};\n\nconst filterGuides = (\n guides: InspectionResultOk[\"guides\"],\n displayOption: DisplayOption,\n) => {\n return guides.filter((guide) => {\n const { isEligible, isQualified } = guide.annotation;\n const isDisplayable = isEligible && isQualified;\n\n if (displayOption === \"only-displayable\" && !isDisplayable) {\n return false;\n }\n if (displayOption === \"only-eligible\" && !isEligible) {\n return false;\n }\n if (displayOption === \"only-active\" && !guide.annotation.active.status) {\n return false;\n }\n return true;\n });\n};\n\nexport const V2 = () => {\n const { client } = useGuideContext();\n\n const [displayOption, setDisplayOption] =\n React.useState<DisplayOption>(\"only-active\");\n const [runConfig, setRunConfig] = React.useState(() => getRunConfig());\n const [isCollapsed, setIsCollapsed] = React.useState(false);\n const [isContextPanelOpen, setIsContextPanelOpen] = React.useState(false);\n\n const [expandedGuideRowKey, setExpandedGuideRowKey] = React.useState<\n string | undefined\n >();\n\n React.useEffect(() => {\n setExpandedGuideRowKey(undefined);\n }, [displayOption]);\n\n React.useEffect(() => {\n const { isVisible = false, focusedGuideKeys = {} } = runConfig || {};\n const isDebugging = client.store.state.debug?.debugging;\n if (isVisible && !isDebugging) {\n client.setDebug({ focusedGuideKeys });\n\n // If focused, switch to all guides so you can see in the list.\n if (Object.keys(focusedGuideKeys).length > 0) {\n setDisplayOption(\"all-guides\");\n }\n }\n\n return () => {\n client.unsetDebug();\n };\n }, [runConfig, client, setDisplayOption]);\n\n // Toggle collapsed state with Ctrl + .\n React.useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.ctrlKey && e.key === TOGGLE_COLLAPSED_HOTKEY && !e.repeat) {\n e.preventDefault();\n setIsCollapsed((prev) => !prev);\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, []);\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const guideListRef = React.useRef<HTMLDivElement>(null);\n const { position, isDragging, handlePointerDown, hasDraggedRef } =\n useDraggable({\n elementRef: containerRef,\n reclampDeps: [isCollapsed],\n initialPosition: { top: 16, right: 16 },\n });\n\n const result = useInspectGuideClientStore(runConfig);\n if (!result || !runConfig?.isVisible) {\n return null;\n }\n\n const guides =\n result.status === \"ok\" ? filterGuides(result.guides, displayOption) : [];\n\n return (\n <Box\n tgphRef={containerRef}\n position=\"fixed\"\n style={{\n top: position.top + \"px\",\n right: position.right + \"px\",\n zIndex: TOOLBAR_Z_INDEX,\n }}\n >\n {isCollapsed ? (\n <Tooltip\n side=\"left\"\n delayDuration={500}\n label={\n <Text as=\"span\" size=\"1\">\n Guide Toolbar\n <Stack display=\"inline-block\" ml=\"3\">\n <Kbd>ctrl</Kbd> + <Kbd>.</Kbd>\n </Stack>\n </Text>\n }\n >\n <Stack\n border=\"px\"\n rounded=\"4\"\n align=\"center\"\n justify=\"center\"\n w=\"10\"\n h=\"10\"\n onPointerDown={handlePointerDown}\n backgroundColor=\"surface-1\"\n style={{\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n animation: \"toolbar-collapse-fade-in 150ms ease-out\",\n }}\n >\n <Box\n style={{\n transform: \"scale(0.7)\",\n transformOrigin: \"center center\",\n }}\n >\n <KnockButton\n onClick={() => {\n if (!hasDraggedRef.current) {\n setIsCollapsed(false);\n }\n }}\n positioned={false}\n />\n </Box>\n </Stack>\n </Tooltip>\n ) : (\n <Stack\n direction=\"column\"\n backgroundColor=\"surface-1\"\n rounded=\"4\"\n border=\"px\"\n overflow=\"hidden\"\n style={{\n width: TOOLBAR_WIDTH,\n boxShadow: \"0 8px 32px var(--tgph-gray-5)\",\n animation: \"toolbar-expand-fade-in 150ms ease-out\",\n }}\n >\n {/* Header — also acts as drag handle area */}\n <Stack\n w=\"full\"\n p=\"2\"\n justify=\"space-between\"\n direction=\"row\"\n align=\"center\"\n gap=\"2\"\n borderBottom=\"px\"\n onPointerDown={handlePointerDown}\n style={{\n boxSizing: \"border-box\",\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n >\n {/* Left: drag icon + segmented control + settings */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack\n display=\"inline-flex\"\n align=\"center\"\n style={{\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n onPointerDown={(e: React.PointerEvent) => {\n // Already handled by parent, prevent double-fire\n e.stopPropagation();\n handlePointerDown(e);\n }}\n >\n <Icon color=\"gray\" size=\"1\" icon={GripVertical} aria-hidden />\n </Stack>\n <Stack\n align=\"center\"\n gap=\"1_5\"\n onPointerDown={(e: React.PointerEvent) => e.stopPropagation()}\n >\n <SegmentedControl.Root\n size=\"1\"\n type=\"single\"\n value={displayOption}\n onValueChange={(val: DisplayOption) => {\n if (!val) return;\n\n const debugSettings = client.store.state.debug;\n\n const focusedGuideKeys = Object.keys(\n debugSettings?.focusedGuideKeys || {},\n );\n\n // Exit out of focus if the currently focused guide is not\n // part of the selected list filter.\n if (result.status === \"ok\" && focusedGuideKeys.length > 0) {\n const currFocusedGuide = filterGuides(\n result.guides,\n val,\n ).find((g) => g.key === focusedGuideKeys[0]);\n\n if (!currFocusedGuide) {\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: {},\n });\n }\n }\n\n setDisplayOption(val);\n }}\n >\n <SegmentedControl.Option\n value=\"all-guides\"\n style={{ width: \"54px\" }}\n >\n All\n </SegmentedControl.Option>\n <SegmentedControl.Option\n value=\"only-active\"\n style={{ width: \"54px\" }}\n >\n Active\n </SegmentedControl.Option>\n <SegmentedControl.Option\n value=\"only-eligible\"\n style={{ width: \"54px\" }}\n >\n Eligible\n </SegmentedControl.Option>\n {/* Note: `only-displayable` is not available for now */}\n </SegmentedControl.Root>\n\n <Tooltip label=\"Settings & target params\">\n <Button\n size=\"1\"\n variant={isContextPanelOpen ? \"outline\" : \"ghost\"}\n color={isContextPanelOpen ? \"blue\" : \"gray\"}\n leadingIcon={{\n icon: SlidersHorizontal,\n alt: \"Inspect target params\",\n }}\n trailingIcon={\n isContextPanelOpen\n ? { icon: ChevronDown, alt: \"Hide context data\" }\n : { icon: ChevronRight, alt: \"Show context data\" }\n }\n onClick={() => setIsContextPanelOpen((v) => !v)}\n />\n </Tooltip>\n </Stack>\n </Stack>\n\n {/* Right: exit + minimize buttons */}\n <Stack\n align=\"center\"\n gap=\"1_5\"\n style={{ flexShrink: 0 }}\n onPointerDown={(e: React.PointerEvent) => e.stopPropagation()}\n >\n <Stack align=\"center\" gap=\"1_5\">\n <Button\n size=\"1\"\n variant=\"outline\"\n leadingIcon={{ icon: LogOut, alt: \"Exit\" }}\n onClick={() => {\n setRunConfig((curr) => ({ ...curr, isVisible: false }));\n clearRunConfigLS();\n client.unsetDebug();\n }}\n >\n Exit\n </Button>\n <Tooltip label=\"Minimize toolbar\">\n <Button\n size=\"1\"\n variant=\"outline\"\n leadingIcon={{ icon: Minimize2, alt: \"Minimize\" }}\n onClick={() => setIsCollapsed(true)}\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Stack>\n\n {/* Collapsible panel to show context data */}\n {isContextPanelOpen && (\n <Box borderBottom=\"px\">\n <GuideContextDetails />\n </Box>\n )}\n\n {/* Guide list content area */}\n <Box\n tgphRef={guideListRef}\n p=\"1\"\n overflow=\"auto\"\n style={{ maxHeight: \"calc(80vh - 96px)\" }}\n >\n {result.status === \"error\" ? (\n <Box px=\"2\" pb=\"1\" style={{ lineHeight: \"1.2\" }}>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={\n result.error === \"no_guides_fetched\" ? \"default\" : \"red\"\n }\n >\n {result.message}\n </Text>\n </Box>\n ) : guides.length === 0 ? (\n <Box px=\"2\" pb=\"1\" style={{ lineHeight: \"1.2\" }}>\n <Text as=\"span\" size=\"1\" weight=\"medium\" color=\"default\">\n No guides match the current filter.\n </Text>\n </Box>\n ) : (\n guides.map((guide) => (\n <GuideRow\n key={guide.key}\n guide={guide}\n orderIndex={guide.orderIndex}\n isExpanded={guide.key === expandedGuideRowKey}\n onClick={() => {\n setExpandedGuideRowKey((k) =>\n k && k === guide.key ? undefined : guide.key,\n );\n }}\n />\n ))\n )}\n </Box>\n\n {/* Focus chin with dedicated controls */}\n <FocusChin guides={guides} guideListRef={guideListRef} />\n </Stack>\n )}\n </Box>\n );\n};\n"],"names":["TOGGLE_COLLAPSED_HOTKEY","TOOLBAR_WIDTH","Kbd","children","React","display","padding","borderRadius","border","backgroundColor","filterGuides","guides","displayOption","filter","guide","isEligible","isQualified","annotation","active","status","V2","client","useGuideContext","setDisplayOption","useState","runConfig","setRunConfig","getRunConfig","isCollapsed","setIsCollapsed","isContextPanelOpen","setIsContextPanelOpen","expandedGuideRowKey","setExpandedGuideRowKey","useEffect","undefined","isVisible","focusedGuideKeys","isDebugging","store","state","debug","debugging","setDebug","Object","keys","length","unsetDebug","handleKeyDown","e","ctrlKey","key","repeat","preventDefault","prev","addEventListener","removeEventListener","containerRef","useRef","guideListRef","position","isDragging","handlePointerDown","hasDraggedRef","useDraggable","elementRef","reclampDeps","initialPosition","top","right","result","useInspectGuideClientStore","Box","zIndex","TOOLBAR_Z_INDEX","Tooltip","Text","Stack","cursor","touchAction","userSelect","animation","transform","transformOrigin","KnockButton","current","width","boxShadow","boxSizing","minWidth","flex","stopPropagation","Icon","GripVertical","SegmentedControl","val","debugSettings","find","g","Button","icon","SlidersHorizontal","alt","ChevronDown","ChevronRight","v","flexShrink","LogOut","curr","clearRunConfigLS","Minimize2","GuideContextDetails","maxHeight","lineHeight","error","message","map","GuideRow","orderIndex","k","FocusChin"],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,MAAMA,IAA0B,KAE1BC,IAAgB,SAEhBC,IAAMA,CAAC;AAAA,EAAEC,UAAAA;AAAwC,MAEnDC,gBAAAA,EAAA,cAAC,SACC,OAAO;AAAA,EACLC,SAAS;AAAA,EACTC,SAAS;AAAA,EACTC,cAAc;AAAA,EACdC,QAAQ;AAAA,EACRC,iBAAiB;KAGlBN,CACH,GAIEO,IAAeA,CACnBC,GACAC,MAEOD,EAAOE,OAAQC,CAAUA,MAAA;AACxB,QAAA;AAAA,IAAEC,YAAAA;AAAAA,IAAYC,aAAAA;AAAAA,MAAgBF,EAAMG;AAS1C,SANIL,EAAAA,MAAkB,sBAAsB,EAFtBG,KAAcC,MAKhCJ,MAAkB,mBAAmB,CAACG,KAGtCH,MAAkB,iBAAiB,CAACE,EAAMG,WAAWC,OAAOC;AAGzD,CACR,GAGUC,KAAKA,MAAM;AAChB,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAE7B,CAACV,GAAeW,CAAgB,IACpCnB,EAAMoB,SAAwB,aAAa,GACvC,CAACC,GAAWC,CAAY,IAAItB,EAAMoB,SAAS,MAAMG,GAAc,GAC/D,CAACC,GAAaC,CAAc,IAAIzB,EAAMoB,SAAS,EAAK,GACpD,CAACM,GAAoBC,CAAqB,IAAI3B,EAAMoB,SAA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O,MAAK,KAAI,QAAO,UAAS,OAAM,UAAS,GAAA,qCAExD,CACF,IAEAjE,EAAOyG,IAAKtG,CAAAA,MACTV,gBAAAA,EAAA,cAAAiH,GAAA,EACC,KAAKvG,EAAMqC,KACX,OAAArC,GACA,YAAYA,EAAMwG,YAClB,YAAYxG,EAAMqC,QAAQnB,GAC1B,SAAS,MAAM;AACbC,IAAAA,EAAwBsF,OACtBA,KAAKA,MAAMzG,EAAMqC,MAAMhB,SAAYrB,EAAMqC,GAC3C;AAAA,EAAA,IAGL,CAEL,mCAGCqE,GAAU,EAAA,QAAA7G,GAAgB,cAAAgD,EAA2B,CAAA,CACxD,CAEJ;AAEJ;"}
1
+ {"version":3,"file":"V2.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"sourcesContent":["import { KnockGuideClient } from \"@knocklabs/client\";\nimport { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { SegmentedControl } from \"@telegraph/segmented-control\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport {\n ChevronDown,\n ChevronRight,\n GripVertical,\n LogOut,\n Minimize2,\n SlidersHorizontal,\n} from \"lucide-react\";\nimport React from \"react\";\n\nimport { KnockButton } from \"../KnockButton\";\nimport { TOOLBAR_Z_INDEX } from \"../shared\";\nimport \"../styles.css\";\n\nimport { FocusChin } from \"./FocusChin\";\nimport { GuideContextDetails } from \"./GuideContextDetails\";\nimport { GuideRow } from \"./GuideRow\";\nimport { DisplayOption, sharedTooltipProps } from \"./helpers\";\nimport { useDraggable } from \"./useDraggable\";\nimport {\n InspectionResultOk,\n useInspectGuideClientStore,\n} from \"./useInspectGuideClientStore\";\n\nconst TOGGLE_COLLAPSED_HOTKEY = \".\";\n\nconst TOOLBAR_WIDTH = \"540px\";\n\nconst TOOLBAR_BOX_SHADOW = [\n \"0 0 0 1px rgba(0, 0, 0, 0.06)\",\n \"0 0 0 1px rgba(255, 255, 255, 0.10)\",\n \"inset 0 1px 0 rgba(255, 255, 255, 0.04)\",\n \"0 1px 1px 0 rgba(0, 0, 0, 0.04)\",\n \"0 4px 6px -1px rgba(0, 0, 0, 0.05)\",\n \"0 8px 16px -4px rgba(0, 0, 0, 0.06)\",\n].join(\", \");\n\nconst Kbd = ({ children }: { children: React.ReactNode }) => {\n return (\n <kbd\n style={{\n display: \"inline-block\",\n padding: \"1px 4px\",\n borderRadius: \"var(--tgph-rounded-2)\",\n border: \"1px solid rgba(255, 255, 255, 0.3)\",\n backgroundColor: \"rgba(255, 255, 255, 0.15)\",\n }}\n >\n {children}\n </kbd>\n );\n};\n\nconst getEmptyStateMessage = (displayOption: DisplayOption) => {\n switch (displayOption) {\n case \"all-guides\":\n return \"You have no guides. Get started by creating a guide.\";\n case \"only-active\":\n return \"There are no active guides.\";\n case \"only-eligible\":\n return \"Your current user is not eligible for any guides.\";\n }\n};\n\nconst filterGuides = (\n guides: InspectionResultOk[\"guides\"],\n displayOption: DisplayOption,\n) => {\n return guides.filter((guide) => {\n if (displayOption === \"only-eligible\" && !guide.annotation.isEligible) {\n return false;\n }\n if (displayOption === \"only-active\" && !guide.annotation.active.status) {\n return false;\n }\n return true;\n });\n};\n\ntype Props = {\n readyToTarget: boolean;\n};\n\nexport const V2 = ({ readyToTarget }: Props) => {\n const { client } = useGuideContext();\n\n const [displayOption, setDisplayOption] =\n React.useState<DisplayOption>(\"only-active\");\n const [runConfig, setRunConfig] = React.useState(() =>\n KnockGuideClient.getToolbarRunConfigFromUrl(),\n );\n const [isCollapsed, setIsCollapsed] = React.useState(false);\n const [isContextPanelOpen, setIsContextPanelOpen] = React.useState(false);\n\n const [expandedGuideRowKey, setExpandedGuideRowKey] = React.useState<\n string | undefined\n >();\n\n React.useEffect(() => {\n setExpandedGuideRowKey(undefined);\n }, [displayOption]);\n\n React.useEffect(() => {\n const { isVisible = false, focusedGuideKeys = {} } = runConfig || {};\n const isDebugging = client.store.state.debug?.debugging;\n if (isVisible && !isDebugging && readyToTarget) {\n client.setDebug({ focusedGuideKeys });\n\n // If focused, switch to all guides so you can see in the list.\n if (Object.keys(focusedGuideKeys).length > 0) {\n setDisplayOption(\"all-guides\");\n }\n }\n\n return () => {\n client.unsetDebug();\n };\n }, [readyToTarget, runConfig, client, setDisplayOption]);\n\n // Toggle collapsed state with Ctrl + .\n React.useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.ctrlKey && e.key === TOGGLE_COLLAPSED_HOTKEY && !e.repeat) {\n e.preventDefault();\n setIsCollapsed((prev) => !prev);\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, []);\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const guideListRef = React.useRef<HTMLDivElement>(null);\n const { position, isDragging, handlePointerDown, hasDraggedRef } =\n useDraggable({\n elementRef: containerRef,\n reclampDeps: [isCollapsed],\n initialPosition: { top: 16, right: 16 },\n });\n\n const result = useInspectGuideClientStore(runConfig);\n if (!result || !runConfig?.isVisible) {\n return null;\n }\n\n const guides =\n result.status === \"ok\" ? filterGuides(result.guides, displayOption) : [];\n\n return (\n <Box\n tgphRef={containerRef}\n position=\"fixed\"\n style={{\n top: position.top + \"px\",\n right: position.right + \"px\",\n zIndex: TOOLBAR_Z_INDEX,\n }}\n >\n {isCollapsed ? (\n <Tooltip\n side=\"left\"\n label={\n <Text as=\"span\" size=\"1\">\n Guide Toolbar\n <Stack display=\"inline-block\" ml=\"3\">\n <Kbd>ctrl</Kbd> + <Kbd>.</Kbd>\n </Stack>\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Stack\n border=\"px\"\n rounded=\"4\"\n align=\"center\"\n justify=\"center\"\n w=\"10\"\n h=\"10\"\n onPointerDown={handlePointerDown}\n backgroundColor=\"surface-1\"\n style={{\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n animation: \"toolbar-collapse-fade-in 150ms ease-out\",\n }}\n >\n <Box\n style={{\n transform: \"scale(0.7)\",\n transformOrigin: \"center center\",\n }}\n >\n <KnockButton\n onClick={() => {\n if (!hasDraggedRef.current) {\n setIsCollapsed(false);\n }\n }}\n positioned={false}\n />\n </Box>\n </Stack>\n </Tooltip>\n ) : (\n <Stack\n direction=\"column\"\n backgroundColor=\"surface-1\"\n rounded=\"4\"\n overflow=\"hidden\"\n style={{\n width: TOOLBAR_WIDTH,\n boxShadow: TOOLBAR_BOX_SHADOW,\n animation: \"toolbar-expand-fade-in 150ms ease-out\",\n }}\n >\n {/* Header — also acts as drag handle area */}\n <Stack\n w=\"full\"\n p=\"2\"\n justify=\"space-between\"\n direction=\"row\"\n align=\"center\"\n gap=\"2\"\n borderBottom=\"px\"\n onPointerDown={handlePointerDown}\n style={{\n boxSizing: \"border-box\",\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n >\n {/* Left: drag icon + segmented control + settings */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack\n display=\"inline-flex\"\n align=\"center\"\n style={{\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n onPointerDown={(e: React.PointerEvent) => {\n // Already handled by parent, prevent double-fire\n e.stopPropagation();\n handlePointerDown(e);\n }}\n >\n <Icon color=\"gray\" size=\"1\" icon={GripVertical} aria-hidden />\n </Stack>\n <Stack\n align=\"center\"\n gap=\"1_5\"\n onPointerDown={(e: React.PointerEvent) => e.stopPropagation()}\n >\n <SegmentedControl.Root\n size=\"1\"\n type=\"single\"\n value={displayOption}\n onValueChange={(val: DisplayOption) => {\n if (!val) return;\n\n const debugSettings = client.store.state.debug;\n\n const focusedGuideKeys = Object.keys(\n debugSettings?.focusedGuideKeys || {},\n );\n\n // Exit out of focus if the currently focused guide is not\n // part of the selected list filter.\n if (result.status === \"ok\" && focusedGuideKeys.length > 0) {\n const currFocusedGuide = filterGuides(\n result.guides,\n val,\n ).find((g) => g.key === focusedGuideKeys[0]);\n\n if (!currFocusedGuide) {\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: {},\n });\n }\n }\n\n setDisplayOption(val);\n }}\n >\n <SegmentedControl.Option\n value=\"all-guides\"\n style={{ width: \"54px\" }}\n >\n All\n </SegmentedControl.Option>\n <SegmentedControl.Option\n value=\"only-active\"\n style={{ width: \"54px\" }}\n >\n Active\n </SegmentedControl.Option>\n <SegmentedControl.Option\n value=\"only-eligible\"\n style={{ width: \"54px\" }}\n >\n Eligible\n </SegmentedControl.Option>\n </SegmentedControl.Root>\n\n <Tooltip label=\"Settings\" {...sharedTooltipProps}>\n <Button\n size=\"1\"\n variant={isContextPanelOpen ? \"outline\" : \"ghost\"}\n color={isContextPanelOpen ? \"blue\" : \"gray\"}\n leadingIcon={{\n icon: SlidersHorizontal,\n alt: \"Inspect target params\",\n }}\n trailingIcon={\n isContextPanelOpen\n ? { icon: ChevronDown, alt: \"Hide context data\" }\n : { icon: ChevronRight, alt: \"Show context data\" }\n }\n onClick={() => setIsContextPanelOpen((v) => !v)}\n />\n </Tooltip>\n </Stack>\n </Stack>\n\n {/* Right: exit + minimize buttons */}\n <Stack\n align=\"center\"\n gap=\"1_5\"\n style={{ flexShrink: 0 }}\n onPointerDown={(e: React.PointerEvent) => e.stopPropagation()}\n >\n <Stack align=\"center\" gap=\"1_5\">\n <Button\n size=\"1\"\n variant=\"outline\"\n leadingIcon={{ icon: LogOut, alt: \"Exit\" }}\n onClick={() => {\n setRunConfig((curr) => ({ ...curr, isVisible: false }));\n client.unsetDebug();\n }}\n >\n Exit\n </Button>\n <Tooltip label=\"Minimize toolbar\" {...sharedTooltipProps}>\n <Button\n size=\"1\"\n variant=\"outline\"\n leadingIcon={{ icon: Minimize2, alt: \"Minimize\" }}\n onClick={() => setIsCollapsed(true)}\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Stack>\n\n {/* Collapsible panel to show context data */}\n {isContextPanelOpen && (\n <Box borderBottom=\"px\">\n <GuideContextDetails />\n </Box>\n )}\n\n {/* Guide list content area */}\n <Box\n tgphRef={guideListRef}\n p=\"1\"\n overflow=\"auto\"\n style={{ maxHeight: \"calc(80vh - 96px)\" }}\n >\n {result.status === \"error\" ? (\n <Box px=\"2\" pb=\"1\" style={{ lineHeight: \"1.2\" }}>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={\n result.error === \"no_guides_fetched\" ? \"default\" : \"red\"\n }\n >\n {result.message}\n </Text>\n </Box>\n ) : guides.length === 0 ? (\n <Box px=\"2\" pb=\"1\" style={{ lineHeight: \"1.2\" }}>\n <Text as=\"span\" size=\"1\" weight=\"medium\" color=\"default\">\n {getEmptyStateMessage(displayOption)}\n </Text>\n </Box>\n ) : (\n guides.map((guide) => (\n <GuideRow\n key={guide.key}\n guide={guide}\n orderIndex={guide.orderIndex}\n isExpanded={guide.key === expandedGuideRowKey}\n onClick={() => {\n setExpandedGuideRowKey((k) =>\n k && k === guide.key ? undefined : guide.key,\n );\n }}\n />\n ))\n )}\n </Box>\n\n {/* Focus chin with dedicated controls */}\n <FocusChin guides={guides} guideListRef={guideListRef} />\n </Stack>\n )}\n </Box>\n );\n};\n"],"names":["TOGGLE_COLLAPSED_HOTKEY","TOOLBAR_WIDTH","TOOLBAR_BOX_SHADOW","join","Kbd","children","React","display","padding","borderRadius","border","backgroundColor","getEmptyStateMessage","displayOption","filterGuides","guides","filter","guide","annotation","isEligible","active","status","V2","readyToTarget","client","useGuideContext","setDisplayOption","useState","runConfig","setRunConfig","KnockGuideClient","getToolbarRunConfigFromUrl","isCollapsed","setIsCollapsed","isContextPanelOpen","setIsContextPanelOpen","expandedGuideRowKey","setExpandedGuideRowKey","useEffect","undefined","isVisible","focusedGuideKeys","isDebugging","store","state","debug","debugging","setDebug","Object","keys","length","unsetDebug","handleKeyDown","e","ctrlKey","key","repeat","preventDefault","prev","addEventListener","removeEventListener","containerRef","useRef","guideListRef","position","isDragging","handlePointerDown","hasDraggedRef","useDraggable","elementRef","reclampDeps","initialPosition","top","right","result","useInspectGuideClientStore","Box","zIndex","TOOLBAR_Z_INDEX","Tooltip","Text","Stack","sharedTooltipProps","cursor","touchAction","userSelect","animation","transform","transformOrigin","KnockButton","current","width","boxShadow","boxSizing","minWidth","flex","stopPropagation","Icon","GripVertical","SegmentedControl","val","debugSettings","find","g","Button","icon","SlidersHorizontal","alt","ChevronDown","ChevronRight","v","flexShrink","LogOut","curr","Minimize2","GuideContextDetails","maxHeight","lineHeight","error","message","map","GuideRow","orderIndex","k","FocusChin"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,IAA0B,KAE1BC,IAAgB,SAEhBC,IAAqB,CACzB,iCACA,uCACA,2CACA,mCACA,sCACA,qCAAqC,EACrCC,KAAK,IAAI,GAELC,IAAMA,CAAC;AAAA,EAAEC,UAAAA;AAAwC,MAEnDC,gBAAAA,EAAA,cAAC,SACC,OAAO;AAAA,EACLC,SAAS;AAAA,EACTC,SAAS;AAAA,EACTC,cAAc;AAAA,EACdC,QAAQ;AAAA,EACRC,iBAAiB;KAGlBN,CACH,GAIEO,KAAuBA,CAACC,MAAiC;AAC7D,UAAQA,GAAa;AAAA,IACnB,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,EAAA;AAEb,GAEMC,IAAeA,CACnBC,GACAF,MAEOE,EAAOC,OAAQC,CAAUA,MAC1BJ,EAAAA,MAAkB,mBAAmB,CAACI,EAAMC,WAAWC,cAGvDN,MAAkB,iBAAiB,CAACI,EAAMC,WAAWE,OAAOC,OAIjE,GAOUC,KAAKA,CAAC;AAAA,EAAEC,eAAAA;AAAqB,MAAM;AACxC,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAE7B,CAACZ,GAAea,CAAgB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C,WAAW,IACnB5C,gBAAAA,EAAA,cAAAsE,GAAA,EAAI,IAAG,KAAI,IAAG,KAAI,OAAO;AAAA,IAAEyC,YAAY;AAAA,EAAA,EACtC,GAAA/G,gBAAAA,EAAA,cAAC0E,GAAK,EAAA,IAAG,QAAO,MAAK,KAAI,QAAO,UAAS,OAAM,UAAA,GAC5CpE,GAAqBC,CAAa,CACrC,CACF,IAEAE,EAAOyG,IAAKvG,CACVA,MAAAX,gBAAAA,EAAA,cAACmH,GACC,EAAA,KAAKxG,EAAMsC,KACX,OAAAtC,GACA,YAAYA,EAAMyG,YAClB,YAAYzG,EAAMsC,QAAQnB,GAC1B,SAAS,MAAM;AACbC,IAAAA,EAAwBsF,OACtBA,KAAKA,MAAM1G,EAAMsC,MAAMhB,SAAYtB,EAAMsC,GAC3C;AAAA,EAAA,IAGL,CAEL,mCAGCqE,GAAU,EAAA,QAAA7G,GAAgB,cAAAgD,EAA2B,CAAA,CACxD,CAEJ;AAEJ;"}
@@ -1,55 +1,12 @@
1
- import "@knocklabs/react-core";
2
- import "react";
3
- /* empty css */
4
- import "lodash.debounce";
5
- import { checkForWindow as e } from "../../../../core/utils.mjs";
6
- const a = "knock_guide_toolbar", u = "focused_guide_key", c = "knock_guide_debug", _ = () => {
7
- const t = {
8
- isVisible: !1
9
- }, o = e();
10
- if (!o || !o.location)
11
- return t;
12
- const i = new URLSearchParams(o.location.search), r = i.get(a), s = i.get(u);
13
- if (r !== null) {
14
- const n = {
15
- isVisible: r === "true"
16
- };
17
- return s && (n.focusedGuideKeys = {
18
- [s]: !0
19
- }), l(n), n;
20
- }
21
- return g() || t;
22
- }, l = (t) => {
23
- const o = e();
24
- if (!(!o || !o.localStorage))
25
- try {
26
- o.localStorage.setItem(c, JSON.stringify(t));
27
- } catch {
28
- }
29
- }, g = () => {
30
- const t = e();
31
- if (!(!t || !t.localStorage))
32
- try {
33
- const o = t.localStorage.getItem(c);
34
- if (o)
35
- return JSON.parse(o);
36
- } catch {
37
- }
38
- }, h = () => {
39
- const t = e();
40
- if (!(!t || !t.localStorage))
41
- try {
42
- t.localStorage.removeItem(c);
43
- } catch {
44
- }
45
- }, p = {
1
+ const e = {
2
+ delayDuration: 1e3
3
+ }, o = {
46
4
  focusUnknownGuide: "No such guide exists",
47
5
  focusUncommittedGuide: "This guide has not been committed",
48
6
  focusUnselectableGuide: "No component that can display this guide is present"
49
7
  };
50
8
  export {
51
- p as FOCUS_ERRORS,
52
- h as clearRunConfigLS,
53
- _ as getRunConfig
9
+ o as FOCUS_ERRORS,
10
+ e as sharedTooltipProps
54
11
  };
55
12
  //# sourceMappingURL=helpers.mjs.map