@knocklabs/react 0.11.11 → 0.11.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +29 -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/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 +1 -1
  19. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
  20. package/dist/cjs/modules/guide/providers/KnockGuideProvider.js +1 -1
  21. package/dist/cjs/modules/guide/providers/KnockGuideProvider.js.map +1 -1
  22. package/dist/esm/index.mjs +99 -98
  23. package/dist/esm/index.mjs.map +1 -1
  24. package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs +80 -0
  25. package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs.map +1 -0
  26. package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs +6 -5
  27. package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs.map +1 -1
  28. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +30 -10
  29. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
  30. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +69 -97
  31. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
  32. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +49 -31
  33. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -1
  34. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +119 -103
  35. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
  36. package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs +8 -46
  37. package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs.map +1 -1
  38. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +106 -83
  39. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
  40. package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs +12 -10
  41. package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs.map +1 -1
  42. package/dist/index.css +1 -1
  43. package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts +9 -0
  44. package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts.map +1 -0
  45. package/dist/types/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.d.ts.map +1 -1
  46. package/dist/types/modules/guide/components/Toolbar/V2/GuideContextDetails.d.ts.map +1 -1
  47. package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts +2 -2
  48. package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts.map +1 -1
  49. package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts +3 -2
  50. package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
  51. package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts +9 -2
  52. package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts.map +1 -1
  53. package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts +5 -1
  54. package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
  55. package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts +8 -6
  56. package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts.map +1 -1
  57. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +11 -7
  58. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
  59. package/dist/types/modules/guide/providers/KnockGuideProvider.d.ts.map +1 -1
  60. package/package.json +5 -4
@@ -1 +1 @@
1
- {"version":3,"file":"GuideRow.js","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":"oyBAsBMA,EAAOA,CAAC,CACZC,MAAAA,EACAC,MAAAA,EAAQ,OACRC,SAAAA,CAKF,IAEKC,EAAA,cAAAC,EAAA,MAAA,CACC,UAAU,MACV,MAAM,SACN,IAAI,MACJ,GAAG,IACH,OAAO,IACP,GAAG,YACH,QAAQ,OACR,OAAO,KACP,YAAY,QAEZ,EAAAD,EAAA,cAACE,QAAK,GAAG,OAAO,KAAK,IAAI,MAAAJ,EAAc,OAAO,UAC3CD,CACH,EACCE,CACH,EAUEI,EACJC,GACkB,CACdC,GAAAA,EAAAA,eAAeD,CAAK,EACf,MAAA,CACLN,MAAO,MACPD,MAAO,WACPS,QAAS,uDACX,EAGI,KAAA,CAAEC,WAAAA,CAAAA,EAAeH,EAEnB,OAACG,EAAWC,OAAOC,OAOnBF,EAAWG,SAASD,OACf,CACLX,MAAO,MACPD,MAAO,WACPS,QAAS,uCACX,EAEGC,EAAWI,WAAWF,OAOvBF,EAAWK,WAAWH,SAAWI,OAC5B,CACLf,MAAO,MACPD,MAAO,YACPS,QAAS,kDACX,EAEGC,EAAWO,YAAYL,OAOxBF,EAAWK,WAAWH,SAAW,UAC5B,CACLX,MAAO,OACPD,MAAO,SACPS,QAAS,mDACX,EAEEC,EAAWK,WAAWH,SAAW,YAC5B,CACLX,MAAO,SACPD,MAAO,YACPS,QACE,qEACJ,EAEEC,EAAWK,WAAWH,SAAW,WAC5B,CACLX,MAAO,OACPD,MAAO,UACP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C,EAAK5B,SAASJ,OAAS,CAAA,EAEjCN,EAAA,cAAAwD,EAAAA,wBAAA,CACC,MAAOlB,EAAK3B,WAAWb,MACvB,QAASwC,EAAK3B,WAAWL,OAAS,CAAA,CAEtC,EACCN,EAAA,cAAAJ,EAAA,CACC,MAAM,OACN,MACES,EAAAA,eAAeD,CAAK,EAChB,WACAA,EAAMG,WAAWkD,aACfrD,EAAMG,WAAWK,WAAWH,SAAW,WACvC,OACA,MAAA,EAGPT,EAAA,cAAAwD,EAAA,wBAAA,CACC,MAAOlB,EAAKxB,YAAYhB,MACxB,QAASwC,EAAKxB,YAAYR,OAAS,CAAA,kBAEpCkD,EAAAA,wBACC,CAAA,MAAOlB,EAAK1B,WAAWd,MACvB,QAASwC,EAAK1B,WAAWN,OAAAA,CAAS,CAEtC,EAEAN,EAAA,cAACgD,EAAAA,QACC,CAAA,MACE3C,EAAAA,eAAeD,CAAK,GACpBA,EAAMG,WAAWK,WAAWH,SAAWI,OACnC,gDACAuB,EACE,qBACA,qBAAA,EAGPpC,EAAA,cAAA0D,EAAAA,OAAA,CACC,KAAK,IACL,QAAStB,EAAY,QAAU,UAC/B,MAAOA,EAAY,OAAS,OAC5B,SACE/B,EAAeD,eAAAA,CAAK,GACpBA,EAAMG,WAAWK,WAAWH,SAAWI,OAEzC,QAAU8C,GAAwB,CAChCA,EAAEC,gBAAgB,EAClBvC,EAAOwC,SAAS,CACd,GAAGtC,EACHQ,iBAAkBK,EAAY,GAAK,CAAE,CAAChC,EAAMiC,GAAG,EAAG,EAAA,CAAK,CACxD,CACH,CAAA,EAAE,OAGJ,CACF,CACF,CACF,EAEClB,GAAcnB,EAAA,cAAC8D,EAAgB,gBAAA,CAAA,MAAA1D,CAAA,CAAgB,CAClD,CAEJ"}
1
+ {"version":3,"file":"GuideRow.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tag } from \"@telegraph/tag\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { Gauge } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport {\n GuideRowDetails,\n StatusSummary,\n getSelectableStatusSummary,\n} from \"./GuideRowDetails\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport {\n AnnotatedGuide,\n AnnotatedStatuses,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nexport const GUIDE_ROW_DATA_SELECTOR = \"data-kgt-guide-row-key\";\n\nconst Pill = ({\n label,\n color = \"gray\",\n children,\n}: {\n label: string;\n color?: StatusColor | \"disabled\";\n children: React.ReactNode;\n}) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n gap=\"0_5\"\n px=\"1\"\n height=\"5\"\n bg=\"surface-2\"\n rounded=\"full\"\n border=\"px\"\n borderColor=\"gray-4\"\n >\n <Text as=\"span\" size=\"0\" color={color} weight=\"medium\">\n {label}\n </Text>\n {children}\n </Stack>\n );\n};\n\nconst getStatusSummary = (\n guide: AnnotatedGuide | UncommittedGuide,\n): StatusSummary => {\n if (isUncommittedGuide(guide)) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide has never been committed and published yet\",\n };\n }\n\n const { annotation } = guide;\n\n if (!annotation.active.status) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide is inactive\",\n };\n }\n if (annotation.archived.status) {\n return {\n color: \"red\",\n label: \"Archived\",\n description: \"User has already dismissed this guide\",\n };\n }\n if (!annotation.targetable.status) {\n return {\n color: \"red\",\n label: \"Not targeted\",\n description: annotation.targetable.message,\n };\n }\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n // Prioritize an undefined selectable status ahead of activatable status.\n if (annotation.selectable.status === undefined) {\n return selectableStatusSummary;\n }\n\n if (!annotation.activatable.status) {\n return {\n color: \"red\",\n label: \"Not activated\",\n description: \"This guide cannot be activated in the current location\",\n };\n }\n\n return {\n ...selectableStatusSummary,\n\n // Shorten the label we display here for space.\n ...(annotation.selectable.status === \"returned\"\n ? { label: \"Display\" }\n : undefined),\n };\n};\n\ntype StatusDot = {\n color: StatusColor;\n tooltip?: string;\n};\n\nconst getStatusDots = (\n guide: AnnotatedGuide | UncommittedGuide,\n): Record<keyof AnnotatedStatuses, StatusDot> => {\n if (isUncommittedGuide(guide)) {\n return {\n active: { color: \"gray\" },\n archived: { color: \"gray\" },\n targetable: { color: \"gray\" },\n activatable: { color: \"gray\" },\n selectable: { color: \"gray\" },\n };\n }\n\n const { annotation } = guide;\n\n const active: StatusDot = {\n color: annotation.active.status ? \"blue\" : \"red\",\n tooltip: `Active: ${annotation.active.status ? \"Yes\" : \"No\"}`,\n };\n\n const archived: StatusDot = {\n color: annotation.archived.status ? \"red\" : \"blue\",\n tooltip: `Archived: ${annotation.archived.status ? \"Yes\" : \"No\"}`,\n };\n\n const targetable: StatusDot = {\n color: annotation.targetable.status ? \"blue\" : \"red\",\n tooltip: `Targeting: ${annotation.targetable.status ? \"Yes\" : \"No\"}`,\n };\n\n const activatable: StatusDot = {\n color: annotation.activatable.status ? \"blue\" : \"red\",\n tooltip: `Activated: ${annotation.activatable.status ? \"Yes\" : \"No\"}`,\n };\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n const selectable = {\n color: selectableStatusSummary.color,\n tooltip: selectableStatusSummary.label,\n };\n\n return { active, archived, targetable, activatable, selectable };\n};\n\ntype Props = {\n guide: UncommittedGuide | AnnotatedGuide;\n orderIndex: number;\n isExpanded: boolean;\n onClick: (guideKey: string) => void;\n};\n\nexport const GuideRow = ({ guide, orderIndex, isExpanded, onClick }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n const [isHovered, setIsHovered] = React.useState(false);\n\n const focusedGuideKeys = debugSettings.focusedGuideKeys || {};\n const hasFocus = Object.keys(focusedGuideKeys).length > 0;\n const isFocused = !!focusedGuideKeys[guide.key];\n\n const dots = getStatusDots(guide);\n const summary = getStatusSummary(guide);\n const dataAttrs = { [GUIDE_ROW_DATA_SELECTOR]: guide.key };\n\n return (\n <Box\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={isExpanded ? \"gray-6\" : \"transparent\"}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ cursor: \"pointer\" }}\n {...dataAttrs}\n >\n <Stack\n h=\"7\"\n px=\"1\"\n gap=\"1\"\n align=\"center\"\n justify=\"space-between\"\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={\n isExpanded\n ? \"transparent\"\n : isFocused\n ? \"gray-6\"\n : isHovered\n ? \"gray-4\"\n : \"transparent\"\n }\n backgroundColor={\n isExpanded\n ? \"surface-2\"\n : isFocused\n ? \"gray-2\"\n : isHovered\n ? \"surface-2\"\n : \"transparent\"\n }\n onClick={() => onClick(guide.key)}\n >\n {/* Left section: order + key */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack w=\"7\" justify=\"space-between\" align=\"center\" gap=\"0_5\">\n <Box w=\"3\">\n {!guide.bypass_global_group_limit && (\n <Icon\n icon={Gauge}\n size=\"0\"\n color=\"gray\"\n alt=\"Subject to throttling\"\n />\n )}\n </Box>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n style={{ flexShrink: 0 }}\n >\n {orderIndex + 1}\n </Text>\n </Stack>\n <Tooltip\n label={`${guide.key}${guide.bypass_global_group_limit ? \" (unthrottled)\" : \"\"}`}\n {...sharedTooltipProps}\n >\n <Text\n as=\"code\"\n size=\"1\"\n weight=\"medium\"\n color=\"default\"\n style={{\n display: \"block\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n maxWidth: \"200px\",\n }}\n >\n {guide.key}\n </Text>\n </Tooltip>\n </Stack>\n\n {/* Right section: verdict + pills + focus */}\n <Stack align=\"center\" gap=\"1_5\" style={{ flexShrink: 0 }}>\n {!hasFocus && (\n <Tooltip label={summary.description} {...sharedTooltipProps}>\n <Tag size=\"0\" variant=\"soft\" color={summary.color}>\n {summary.label}\n </Tag>\n </Tooltip>\n )}\n\n <Pill\n label=\"Elig:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isEligible\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.active.color}\n tooltip={dots.active.tooltip!}\n />\n <StatusDot\n color={dots.archived.color}\n tooltip={dots.archived.tooltip!}\n />\n <StatusDot\n color={dots.targetable.color}\n tooltip={dots.targetable.tooltip!}\n />\n </Pill>\n <Pill\n label=\"Vis:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isQualified &&\n guide.annotation.selectable.status === \"returned\"\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.activatable.color}\n tooltip={dots.activatable.tooltip!}\n />\n <StatusDot\n color={dots.selectable.color}\n tooltip={dots.selectable.tooltip!}\n />\n </Pill>\n\n <Button\n size=\"0\"\n variant={isFocused ? \"solid\" : \"outline\"}\n color={isFocused ? \"blue\" : \"gray\"}\n disabled={\n isUncommittedGuide(guide) ||\n guide.annotation.selectable.status === undefined\n }\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: isFocused ? {} : { [guide.key]: true },\n });\n }}\n >\n Focus\n </Button>\n </Stack>\n </Stack>\n\n {isExpanded && <GuideRowDetails guide={guide} />}\n </Box>\n );\n};\n"],"names":["GUIDE_ROW_DATA_SELECTOR","Pill","label","color","children","React","Stack","Text","getStatusSummary","guide","isUncommittedGuide","description","annotation","active","status","archived","targetable","message","selectableStatusSummary","getSelectableStatusSummary","selectable","undefined","activatable","getStatusDots","tooltip","GuideRow","orderIndex","isExpanded","onClick","client","useGuideContext","debugSettings","useStore","store","state","debug","isHovered","setIsHovered","useState","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","dots","summary","dataAttrs","Box","cursor","minWidth","flex","bypass_global_group_limit","Icon","Gauge","flexShrink","Tooltip","sharedTooltipProps","display","overflow","textOverflow","whiteSpace","maxWidth","Tag","isEligible","StatusDot","isQualified","Button","e","stopPropagation","setDebug","GuideRowDetails"],"mappings":"8zBA2BaA,EAA0B,yBAEjCC,EAAOA,CAAC,CACZC,MAAAA,EACAC,MAAAA,EAAQ,OACRC,SAAAA,CAKF,IAEKC,EAAA,cAAAC,EAAA,MAAA,CACC,UAAU,MACV,MAAM,SACN,IAAI,MACJ,GAAG,IACH,OAAO,IACP,GAAG,YACH,QAAQ,OACR,OAAO,KACP,YAAY,QAEZ,EAAAD,EAAA,cAACE,QAAK,GAAG,OAAO,KAAK,IAAI,MAAAJ,EAAc,OAAO,UAC3CD,CACH,EACCE,CACH,EAIEI,EACJC,GACkB,CACdC,GAAAA,EAAAA,mBAAmBD,CAAK,EACnB,MAAA,CACLN,MAAO,MACPD,MAAO,WACPS,YAAa,uDACf,EAGI,KAAA,CAAEC,WAAAA,CAAAA,EAAeH,EAEnB,GAAA,CAACG,EAAWC,OAAOC,OACd,MAAA,CACLX,MAAO,MACPD,MAAO,WACPS,YAAa,wBACf,EAEEC,GAAAA,EAAWG,SAASD,OACf,MAAA,CACLX,MAAO,MACPD,MAAO,WACPS,YAAa,uCACf,EAEE,GAAA,CAACC,EAAWI,WAAWF,OAClB,MAAA,CACLX,MAAO,MACPD,MAAO,eACPS,YAAaC,EAAWI,WAAWC,OACrC,EAGF,MAAMC,EAA0BC,EAAAA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,OAAS,CAAA,EAEjCnB,EAAA,cAAA6D,0BAAA,CACC,MAAOpB,EAAK9B,WAAWb,MACvB,QAAS2C,EAAK9B,WAAWQ,OAAS,CAAA,CAEtC,EACAnB,EAAA,cAACJ,EACC,CAAA,MAAM,OACN,MACES,EAAmBD,mBAAAA,CAAK,EACpB,WACAA,EAAMG,WAAWuD,aACf1D,EAAMG,WAAWQ,WAAWN,SAAW,WACvC,OACA,QAGRT,EAAA,cAAC6D,2BACC,MAAOpB,EAAKxB,YAAYnB,MACxB,QAAS2C,EAAKxB,YAAYE,QAAS,EAEpCnB,EAAA,cAAA6D,EAAA,wBAAA,CACC,MAAOpB,EAAK1B,WAAWjB,MACvB,QAAS2C,EAAK1B,WAAWI,OAAAA,CAAS,CAEtC,EAECnB,EAAA,cAAA+D,SAAA,CACC,KAAK,IACL,QAASxB,EAAY,QAAU,UAC/B,MAAOA,EAAY,OAAS,OAC5B,SACElC,qBAAmBD,CAAK,GACxBA,EAAMG,WAAWQ,WAAWN,SAAWO,OAEzC,QAAUgD,GAAwB,CAChCA,EAAEC,gBAAgB,EAClBzC,EAAO0C,SAAS,CACd,GAAGxC,EACHQ,iBAAkBK,EAAY,GAAK,CAAE,CAACnC,EAAMoC,GAAG,EAAG,EAAA,CAAK,CACxD,CAAA,GACD,OAGJ,CACF,CACF,EAEClB,GAActB,EAAA,cAACmE,EAAgB,gBAAA,CAAA,MAAA/D,CAAA,CAAgB,CAClD,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("@telegraph/layout"),o=require("@telegraph/typography"),c=require("./GuideAnnotatedStatusDot.js"),i=require("./useInspectGuideClientStore.js"),d=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},e=d(n),s=({title:t,children:a})=>e.default.createElement(u.Stack,{direction:"column",justify:"flex-start",gap:"1",px:"1_5",py:"1",rounded:"2",bg:"surface-1",border:"px",borderColor:"gray-4",style:{flex:1}},e.default.createElement(o.Text,{as:"span",size:"0",color:"gray",weight:"medium"},t),e.default.createElement(u.Stack,{direction:"column",gap:"1",mt:"1"},a)),r=({label:t,value:a,color:l})=>e.default.createElement(u.Stack,{align:"center",gap:"1"},e.default.createElement(c.GuideAnnotatedStatusDot,{color:l,tooltip:`${t}: ${a}`}),e.default.createElement(o.Text,{as:"span",size:"1",weight:"medium"},t,":"),e.default.createElement(o.Text,{as:"span",size:"1",weight:"medium",color:l},a)),f=t=>{switch(t){case"returned":return{value:"Ready to display",color:"blue"};case"throttled":return{value:"Throttled",color:"yellow"};case"queried":return{value:"Queued",color:"gray"};default:return{value:"Not found",color:"red"}}},m=({guide:t})=>{if(i.isUnknownGuide(t))return e.default.createElement(u.Box,{px:"3",py:"2"},e.default.createElement(o.Text,{as:"span",size:"1",color:"gray"},"This guide has never been committed and published."));const{annotation:a}=t,l=f(a.selectable.status);return e.default.createElement(u.Stack,{px:"3",py:"2",gap:"2",direction:"row",align:"flex-start"},e.default.createElement(s,{title:"Eligibility"},e.default.createElement(r,{label:"Active",value:a.active.status?"Yes":"No",color:a.active.status?"blue":"red"}),e.default.createElement(r,{label:"Not archived",value:a.archived.status?"No":"Yes",color:a.archived.status?"red":"blue"}),e.default.createElement(r,{label:"Targeting",value:a.targetable.status?"Yes":"No",color:a.targetable.status?"blue":"red"})),e.default.createElement(s,{title:"Visibility"},e.default.createElement(r,{label:"Activation",value:a.activatable.status?"Yes":"No",color:a.activatable.status?"blue":"red"}),e.default.createElement(r,{label:"Display",value:l.value,color:l.color})))};exports.GuideRowDetails=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),g=require("@knocklabs/react-core"),u=require("@telegraph/button"),r=require("@telegraph/layout"),d=require("@telegraph/tooltip"),s=require("@telegraph/typography"),b=require("./GuideAnnotatedStatusDot.js"),h=require("./helpers.js"),f=require("./useInspectGuideClientStore.js"),y=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},e=y(p),c=({title:t,children:i})=>e.default.createElement(r.Stack,{direction:"column",justify:"flex-start",gap:"1",px:"1_5",py:"1",rounded:"2",bg:"surface-1",border:"px",borderColor:"gray-4",style:{flex:1,alignSelf:"stretch"}},e.default.createElement(s.Text,{as:"span",size:"0",color:"gray",weight:"medium"},t),e.default.createElement(r.Stack,{direction:"column",gap:"1"},i)),n=({label:t,value:i,color:a,tooltip:o,children:l})=>e.default.createElement(r.Stack,{align:"center",gap:"1"},e.default.createElement(d.Tooltip,{enabled:!!o,label:o,...h.sharedTooltipProps},e.default.createElement(r.Stack,{align:"center",gap:"1",display:"inline-flex"},e.default.createElement(b.GuideAnnotatedStatusDot,{color:a,tooltip:`${t}: ${i}`}),e.default.createElement(s.Text,{as:"span",size:"1",weight:"medium"},t,":"),!l&&e.default.createElement(s.Text,{as:"span",size:"1",weight:"medium",color:a},i))),l),m=t=>{switch(t){case"returned":return{label:"Ready to display",color:"blue",description:"The guide is queried and ready to render."};case"throttled":return{label:"Throttled",color:"yellow",description:"The guide is queried but held back by throttle settings."};case"queried":return{label:"Queued",color:"gray",description:"The guide is queried but waiting behind higher-priority guides."};default:return{label:"Not queried",color:"red",description:"No useGuide(s) call on this page matches this guide."}}},E=({guide:t})=>{const{client:i}=g.useGuideContext();if(f.isUncommittedGuide(t))return e.default.createElement(r.Box,{px:"3",py:"2"},e.default.createElement(s.Text,{as:"span",size:"1",color:"gray"},"This guide has never been committed and published."));const{annotation:a,dashboard_url:o}=t,l=m(a.selectable.status);return e.default.createElement(r.Stack,{p:"1",gap:"2",direction:"row",align:"flex-start"},e.default.createElement(c,{title:"Eligibility"},e.default.createElement(n,{label:"Active",value:a.active.status?"Yes":"No",color:a.active.status?"blue":"red",tooltip:"Whether the guide is active in this environment."}),e.default.createElement(n,{label:"Archived",value:a.archived.status?"Yes":"No",color:a.archived.status?"red":"blue",tooltip:"Whether the current user has dismissed this guide."}),e.default.createElement(n,{label:"Targeting",value:a.targetable.status?"Yes":"No",color:a.targetable.status?"blue":"red",tooltip:"Whether the current user matches the guide's targeting conditions."})),e.default.createElement(c,{title:"Visibility"},e.default.createElement(n,{label:"Activation",value:a.activatable.status?"Yes":"No",color:a.activatable.status?"blue":"red",tooltip:"Whether the current page matches the guide's activation rules."}),e.default.createElement(n,{label:"Display",value:l.label,color:l.color,tooltip:"Whether the guide has been queried and is ready to render on the current page."},e.default.createElement(d.Tooltip,{label:l.description,...h.sharedTooltipProps},e.default.createElement(s.Text,{as:"span",size:"1",weight:"medium",color:l.color},l.label)))),e.default.createElement(r.Stack,{direction:"column",justify:"flex-end",gap:"1",style:{alignSelf:"stretch"}},e.default.createElement(u.Button,{size:"0",variant:"outline",onClick:()=>i.resetEngagement(t)},"Reset engagement"),o&&e.default.createElement(u.Button,{size:"0",variant:"outline",onClick:()=>window.open(o,"_blank","noopener")},"Open in dashboard")))};exports.GuideRowDetails=E;exports.getSelectableStatusSummary=m;
2
2
  //# sourceMappingURL=GuideRowDetails.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuideRowDetails.js","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":"iUAaMA,EAAgBA,CAAC,CACrBC,MAAAA,EACAC,SAAAA,CAIF,IACEC,UAAA,cAACC,SACC,UAAU,SACV,QAAQ,aACR,IAAI,IACJ,GAAG,MACH,GAAG,IACH,QAAQ,IACR,GAAG,YACH,OAAO,KACP,YAAY,SACZ,MAAO,CAAEC,KAAM,CAAE,CAEjB,EAAAF,EAAA,QAAA,cAACG,EAAAA,MAAK,GAAG,OAAO,KAAK,IAAI,MAAM,OAAO,OAAO,QAAA,EAC1CL,CACH,EACAE,EAAAA,QAAA,cAACC,SAAM,UAAU,SAAS,IAAI,IAAI,GAAG,GAClCF,EAAAA,CACH,CACF,EAGIK,EAAYA,CAAC,CACjBC,MAAAA,EACAC,MAAAA,EACAC,MAAAA,CAKF,4BACGN,EAAAA,MAAM,CAAA,MAAM,SAAS,IAAI,KACvBD,EAAAA,QAAA,cAAAQ,EAAA,wBAAA,CAAU,MAAAD,EAAc,QAAS,GAAGF,CAAK,KAAKC,CAAK,EAAA,CAAG,EACtDN,EAAAA,QAAA,cAAAG,EAAA,KAAA,CAAK,GAAG,OAAO,KAAK,IAAI,OAAO,UAC7BE,EAAM,GACT,EACAL,EAAA,QAAA,cAACG,EAAAA,KAAK,CAAA,GAAG,OAAO,KAAK,IAAI,OAAO,SAAS,MAAAI,GACtCD,CACH,CACF,EAGIG,EACJC,GAC0C,CAC1C,OAAQA,EAAM,CACZ,IAAK,WACI,MAAA,CAAEJ,MAAO,mBAAoBC,MAAO,MAAO,EACpD,IAAK,YACI,MAAA,CAAED,MAAO,YAAaC,MAAO,QAAS,EAC/C,IAAK,UACI,MAAA,CAAED,MAAO,SAAUC,MAAO,MAAO,EAC1C,QACS,MAAA,CAAED,M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olbar/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":"6bAiBMA,EAAgBA,CAAC,CACrBC,MAAAA,EACAC,SAAAA,CAIF,IACEC,UAAA,cAACC,SACC,UAAU,SACV,QAAQ,aACR,IAAI,IACJ,GAAG,MACH,GAAG,IACH,QAAQ,IACR,GAAG,YACH,OAAO,KACP,YAAY,SACZ,MAAO,CAAEC,KAAM,EAAGC,UAAW,SAAU,CAAA,0BAEtCC,EAAAA,KAAK,CAAA,GAAG,OAAO,KAAK,IAAI,MAAM,OAAO,OAAO,UAC1CN,CACH,0BACCG,EAAAA,MAAM,CAAA,UAAU,SAAS,IAAI,GAAA,EAC3BF,CACH,CACF,EAGIM,EAAYA,CAAC,CACjBC,MAA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EAE9BiB,EAAwBnB,KAC3B,CACF,CACF,CACF,EACAN,EAAA,QAAA,cAACC,QACC,CAAA,UAAU,SACV,QAAQ,WACR,IAAI,IACJ,MAAO,CAAEE,UAAW,SAAA,CAEpB,EAAAH,EAAA,QAAA,cAAC+B,EACC,OAAA,CAAA,KAAK,IACL,QAAQ,UACR,QAAS,IAAMb,EAAOc,gBAAgBf,CAAK,CAAA,EAAE,kBAG/C,EACCO,GACExB,EAAA,QAAA,cAAA+B,EAAA,OAAA,CACC,KAAK,IACL,QAAQ,UACR,QAAS,IAAME,OAAOC,KAAKV,EAAc,SAAU,UAAU,CAAE,EAAA,mBAGjE,CAEJ,CACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("@knocklabs/react-core"),f=require("@telegraph/button"),R=require("@telegraph/icon"),o=require("@telegraph/layout"),m=require("@telegraph/segmented-control"),b=require("@telegraph/tooltip"),q=require("@telegraph/typography"),r=require("lucide-react"),B=require("react"),z=require("../KnockButton.js"),O=require("../shared.js");;/* empty css */const G=require("./GuideContextDetails.js"),P=require("./GuideRow.js"),w=require("./helpers.js"),T=require("./useDraggable.js"),_=require("./useInspectGuideClientStore.js"),V=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},e=V(B),A="540px",j=({guides:n,displayOption:s})=>{const[c,l]=e.default.useState();return e.default.useEffect(()=>{l(void 0)},[s]),n.map((i,p)=>{const{isEligible:d,isQualified:u}=i.annotation;return s==="only-displayable"&&!(d&&u)||s==="only-eligible"&&!d?null:e.default.createElement(P.GuideRow,{key:i.key,guide:i,orderIndex:p,isExpanded:i.key===c,onClick:()=>{l(a=>a&&a===i.key?void 0:i.key)}})})},K=()=>{const{client:n}=D.useGuideContext(),[s,c]=e.default.useState("only-eligible"),[l,i]=e.default.useState(()=>w.getRunConfig()),[p,d]=e.default.useState(!1),[u,x]=e.default.useState(!1),{debugSettings:a}=D.useStore(n.store,t=>({debugSettings:t.debug||{}}));e.default.useEffect(()=>{var C;const{isVisible:t=!1,focusedGuideKeys:k={}}=l||{},I=(C=n.store.state.debug)==null?void 0:C.debugging;return t&&!I&&(n.setDebug({focusedGuideKeys:k}),Object.keys(k).length>0&&c("all-guides")),()=>{n.unsetDebug()}},[l,n,c]);const h=e.default.useRef(null),{position:S,isDragging:y,handlePointerDown:E,hasDraggedRef:v}=T.useDraggable({elementRef:h,reclampDeps:[p],initialPosition:{top:16,right:16}}),g=_.useInspectGuideClientStore(l);return!g||!(l!=null&&l.isVisible)?null:e.default.createElement(o.Box,{tgphRef:h,position:"fixed",style:{top:S.top+"px",right:S.right+"px",zIndex:O.TOOLBAR_Z_INDEX}},p?e.default.createElement(o.Stack,{border:"px",rounded:"4",align:"center",justify:"center",w:"10",h:"10",onPointerDown:E,backgroundColor:"surface-1",style:{cursor:y?"grabbing":"grab",touchAction:"none",userSelect:"none"}},e.default.createElement(o.Box,{style:{transform:"scale(0.7)",transformOrigin:"center center"}},e.default.createElement(z.KnockButton,{onClick:()=>{v.current||d(!1)},positioned:!1}))):e.default.createElement(o.Stack,{direction:"column",backgroundColor:"surface-1",rounded:"4",border:"px",overflow:"hidden",style:{width:A,boxShadow:"0 8px 32px var(--tgph-gray-5)"}},e.default.createElement(o.Stack,{w:"full",p:"2",justify:"space-between",direction:"row",align:"center",gap:"2",borderBottom:"px",onPointerDown:E,style:{boxSizing:"border-box",cursor:y?"grabbing":"grab",touchAction:"none",userSelect:"none"}},e.default.createElement(o.Stack,{align:"center",gap:"1_5",style:{minWidth:0,flex:1}},e.default.createElement(o.Stack,{display:"inline-flex",align:"center",style:{cursor:y?"grabbing":"grab",touchAction:"none",userSelect:"none"},onPointerDown:t=>{t.stopPropagation(),E(t)}},e.default.createElement(R.Icon,{color:"gray",size:"1",icon:r.GripVertical,"aria-hidden":!0})),e.default.createElement(o.Stack,{align:"center",gap:"1_5",onPointerDown:t=>t.stopPropagation()},e.default.createElement(m.SegmentedControl.Root,{size:"1",type:"single",value:s,onValueChange:t=>{t&&c(t)}},e.default.createElement(m.SegmentedControl.Option,{value:"all-guides"},"All guides"),e.default.createElement(m.SegmentedControl.Option,{value:"only-eligible"},"Eligible"),e.default.createElement(m.SegmentedControl.Option,{value:"only-displayable"},"On this page")),e.default.createElement(b.Tooltip,{label:"Sandbox: Contain engagement actions to client side only"},e.default.createElement(f.Button,{size:"1",variant:a.skipEngagementTracking?"outline":"ghost",color:a.skipEngagementTracking?"blue":"gray",icon:{icon:r.Box,alt:"Sandbox mode"},onClick:()=>{n.setDebug({...a,skipEngagementTracking:!a.skipEngagementTracking})}})),e.default.createElement(b.Tooltip,{label:"Ignore throttle: Show next guide immediately"},e.default.createElement(f.Button,{size:"1",variant:a.ignoreDisplayInterval?"outline":"ghost",color:a.ignoreDisplayInterval?"blue":"gray",icon:{icon:r.Gauge,alt:"Ignore throttle"},onClick:()=>{n.setDebug({...a,ignoreDisplayInterval:!a.ignoreDisplayInterval})}})),e.default.createElement(b.Tooltip,{label:"Inspect target params"},e.default.createElement(f.Button,{size:"1",variant:u?"outline":"ghost",color:u?"blue":"gray",leadingIcon:{icon:r.SlidersHorizontal,alt:"Inspect target params"},trailingIcon:u?{icon:r.ChevronDown,alt:"Hide context data"}:{icon:r.ChevronRight,alt:"Show context data"},onClick:()=>x(t=>!t)})))),e.default.createElement(o.Stack,{align:"center",gap:"1_5",style:{flexShrink:0},onPointerDown:t=>t.stopPropagation()},e.default.createElement(o.Stack,{align:"center",gap:"1_5"},e.default.createElement(f.Button,{size:"1",variant:"outline",leadingIcon:{icon:r.LogOut,alt:"Exit"},onClick:()=>{i(t=>({...t,isVisible:!1})),w.clearRunConfigLS(),n.unsetDebug()}},"Exit"),e.default.createElement(b.Tooltip,{label:"Minimize toolbar"},e.default.createElement(f.Button,{size:"1",variant:"outline",leadingIcon:{icon:r.Minimize2,alt:"Minimize"},onClick:()=>d(!0)}))))),u&&e.default.createElement(o.Box,{borderBottom:"px"},e.default.createElement(G.GuideContextDetails,null)),e.default.createElement(o.Box,{p:"1",overflow:"auto",style:{maxHeight:"calc(80vh - 96px)"}},g.status==="error"?e.default.createElement(o.Box,{px:"2",pb:"1"},e.default.createElement(q.Text,{as:"span",size:"1",weight:"medium",color:g.error==="no_guides_fetched"?"default":"red"},g.message)):e.default.createElement(j,{guides:g.guides,displayOption:s}))))};exports.V2=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("@knocklabs/client"),z=require("@knocklabs/react-core"),E=require("@telegraph/button"),K=require("@telegraph/icon"),o=require("@telegraph/layout"),f=require("@telegraph/segmented-control"),h=require("@telegraph/tooltip"),k=require("@telegraph/typography"),c=require("lucide-react"),A=require("react"),L=require("../KnockButton.js"),H=require("../shared.js");;/* empty css */const j=require("./FocusChin.js"),V=require("./GuideContextDetails.js"),F=require("./GuideRow.js"),w=require("./helpers.js"),M=require("./useDraggable.js"),W=require("./useInspectGuideClientStore.js"),Y=a=>a&&typeof a=="object"&&"default"in a?a:{default:a},e=Y(A),X=".",N="540px",U=["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=({children:a})=>e.default.createElement("kbd",{style:{display:"inline-block",padding:"1px 4px",borderRadius:"var(--tgph-rounded-2)",border:"1px solid rgba(255, 255, 255, 0.3)",backgroundColor:"rgba(255, 255, 255, 0.15)"}},a),Z=a=>{switch(a){case"all-guides":return"You have no guides. Get started by creating a guide.";case"only-active":return"There are no active guides.";case"only-eligible":return"Your current user is not eligible for any guides."}},O=(a,l)=>a.filter(i=>!(l==="only-eligible"&&!i.annotation.isEligible||l==="only-active"&&!i.annotation.active.status)),$=({readyToTarget:a})=>{const{client:l}=z.useGuideContext(),[i,g]=e.default.useState("only-active"),[s,q]=e.default.useState(()=>I.KnockGuideClient.getToolbarRunConfigFromUrl()),[S,p]=e.default.useState(!1),[d,B]=e.default.useState(!1),[P,C]=e.default.useState();e.default.useEffect(()=>{C(void 0)},[i]),e.default.useEffect(()=>{var y;const{isVisible:t=!1,focusedGuideKeys:n={}}=s||{},u=(y=l.store.state.debug)==null?void 0:y.debugging;return t&&!u&&a&&(l.setDebug({focusedGuideKeys:n}),Object.keys(n).length>0&&g("all-guides")),()=>{l.unsetDebug()}},[a,s,l,g]),e.default.useEffect(()=>{const t=n=>{n.ctrlKey&&n.key===X&&!n.repeat&&(n.preventDefault(),p(u=>!u))};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[]);const D=e.default.useRef(null),v=e.default.useRef(null),{position:R,isDragging:b,handlePointerDown:m,hasDraggedRef:T}=M.useDraggable({elementRef:D,reclampDeps:[S],initialPosition:{top:16,right:16}}),r=W.useInspectGuideClientStore(s);if(!r||!(s!=null&&s.isVisible))return null;const x=r.status==="ok"?O(r.guides,i):[];return e.default.createElement(o.Box,{tgphRef:D,position:"fixed",style:{top:R.top+"px",right:R.right+"px",zIndex:H.TOOLBAR_Z_INDEX}},S?e.default.createElement(h.Tooltip,{side:"left",label:e.default.createElement(k.Text,{as:"span",size:"1"},"Guide Toolbar",e.default.createElement(o.Stack,{display:"inline-block",ml:"3"},e.default.createElement(G,null,"ctrl")," + ",e.default.createElement(G,null,"."))),...w.sharedTooltipProps},e.default.createElement(o.Stack,{border:"px",rounded:"4",align:"center",justify:"center",w:"10",h:"10",onPointerDown:m,backgroundColor:"surface-1",style:{cursor:b?"grabbing":"grab",touchAction:"none",userSelect:"none",animation:"toolbar-collapse-fade-in 150ms ease-out"}},e.default.createElement(o.Box,{style:{transform:"scale(0.7)",transformOrigin:"center center"}},e.default.createElement(L.KnockButton,{onClick:()=>{T.current||p(!1)},positioned:!1})))):e.default.createElement(o.Stack,{direction:"column",backgroundColor:"surface-1",rounded:"4",overflow:"hidden",style:{width:N,boxShadow:U,animation:"toolbar-expand-fade-in 150ms ease-out"}},e.default.createElement(o.Stack,{w:"full",p:"2",justify:"space-between",direction:"row",align:"center",gap:"2",borderBottom:"px",onPointerDown:m,style:{boxSizing:"border-box",cursor:b?"grabbing":"grab",touchAction:"none",userSelect:"none"}},e.default.createElement(o.Stack,{align:"center",gap:"1_5",style:{minWidth:0,flex:1}},e.default.createElement(o.Stack,{display:"inline-flex",align:"center",style:{cursor:b?"grabbing":"grab",touchAction:"none",userSelect:"none"},onPointerDown:t=>{t.stopPropagation(),m(t)}},e.default.createElement(K.Icon,{color:"gray",size:"1",icon:c.GripVertical,"aria-hidden":!0})),e.default.createElement(o.Stack,{align:"center",gap:"1_5",onPointerDown:t=>t.stopPropagation()},e.default.createElement(f.SegmentedControl.Root,{size:"1",type:"single",value:i,onValueChange:t=>{if(!t)return;const n=l.store.state.debug,u=Object.keys((n==null?void 0:n.focusedGuideKeys)||{});r.status==="ok"&&u.length>0&&(O(r.guides,t).find(_=>_.key===u[0])||l.setDebug({...n,focusedGuideKeys:{}})),g(t)}},e.default.createElement(f.SegmentedControl.Option,{value:"all-guides",style:{width:"54px"}},"All"),e.default.createElement(f.SegmentedControl.Option,{value:"only-active",style:{width:"54px"}},"Active"),e.default.createElement(f.SegmentedControl.Option,{value:"only-eligible",style:{width:"54px"}},"Eligible")),e.default.createElement(h.Tooltip,{label:"Settings",...w.sharedTooltipProps},e.default.createElement(E.Button,{size:"1",variant:d?"outline":"ghost",color:d?"blue":"gray",leadingIcon:{icon:c.SlidersHorizontal,alt:"Inspect target params"},trailingIcon:d?{icon:c.ChevronDown,alt:"Hide context data"}:{icon:c.ChevronRight,alt:"Show context data"},onClick:()=>B(t=>!t)})))),e.default.createElement(o.Stack,{align:"center",gap:"1_5",style:{flexShrink:0},onPointerDown:t=>t.stopPropagation()},e.default.createElement(o.Stack,{align:"center",gap:"1_5"},e.default.createElement(E.Button,{size:"1",variant:"outline",leadingIcon:{icon:c.LogOut,alt:"Exit"},onClick:()=>{q(t=>({...t,isVisible:!1})),l.unsetDebug()}},"Exit"),e.default.createElement(h.Tooltip,{label:"Minimize toolbar",...w.sharedTooltipProps},e.default.createElement(E.Button,{size:"1",variant:"outline",leadingIcon:{icon:c.Minimize2,alt:"Minimize"},onClick:()=>p(!0)}))))),d&&e.default.createElement(o.Box,{borderBottom:"px"},e.default.createElement(V.GuideContextDetails,null)),e.default.createElement(o.Box,{tgphRef:v,p:"1",overflow:"auto",style:{maxHeight:"calc(80vh - 96px)"}},r.status==="error"?e.default.createElement(o.Box,{px:"2",pb:"1",style:{lineHeight:"1.2"}},e.default.createElement(k.Text,{as:"span",size:"1",weight:"medium",color:r.error==="no_guides_fetched"?"default":"red"},r.message)):x.length===0?e.default.createElement(o.Box,{px:"2",pb:"1",style:{lineHeight:"1.2"}},e.default.createElement(k.Text,{as:"span",size:"1",weight:"medium",color:"default"},Z(i))):x.map(t=>e.default.createElement(F.GuideRow,{key:t.key,guide:t,orderIndex:t.orderIndex,isExpanded:t.key===P,onClick:()=>{C(n=>n&&n===t.key?void 0:t.key)}}))),e.default.createElement(j.FocusChin,{guides:x,guideListRef:v})))};exports.V2=$;
2
2
  //# sourceMappingURL=V2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"V2.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.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 { SegmentedControl } from \"@telegraph/segmented-control\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport {\n Box as BoxIcon,\n ChevronDown,\n ChevronRight,\n Gauge,\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 { GuideContextDetails } from \"./GuideContextDetails\";\nimport { GuideRow } from \"./GuideRow\";\nimport { clearRunConfigLS, getRunConfig } from \"./helpers\";\nimport { useDraggable } from \"./useDraggable\";\nimport {\n InspectionResultOk,\n useInspectGuideClientStore,\n} from \"./useInspectGuideClientStore\";\n\nconst TOOLBAR_WIDTH = \"540px\";\n\ntype DisplayOption = \"all-guides\" | \"only-eligible\" | \"only-displayable\";\n\nconst GuidesList = ({\n guides,\n displayOption,\n}: {\n guides: InspectionResultOk[\"guides\"];\n displayOption: DisplayOption;\n}) => {\n const [expandedGuideRowKey, setExpandedGuideRowKey] = React.useState<\n string | undefined\n >();\n\n React.useEffect(() => {\n setExpandedGuideRowKey(undefined);\n }, [displayOption]);\n\n return guides.map((guide, idx) => {\n const { isEligible, isQualified } = guide.annotation;\n const isDisplayable = isEligible && isQualified;\n\n if (displayOption === \"only-displayable\" && !isDisplayable) {\n return null;\n }\n if (displayOption === \"only-eligible\" && !isEligible) {\n return null;\n }\n return (\n <GuideRow\n key={guide.key}\n guide={guide}\n orderIndex={idx}\n isExpanded={guide.key === expandedGuideRowKey}\n onClick={() => {\n setExpandedGuideRowKey((k) =>\n k && k === guide.key ? undefined : guide.key,\n );\n }}\n />\n );\n });\n};\n\nexport const V2 = () => {\n const { client } = useGuideContext();\n\n const [displayOption, setDisplayOption] =\n React.useState<DisplayOption>(\"only-eligible\");\n const [runConfig, setRunConfig] = React.useState(() => getRunConfig());\n const [isCollapsed, setIsCollapsed] = React.useState(false);\n const [isContextPanelOpen, setIsContextPanelOpen] = React.useState(false);\n\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\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 const containerRef = 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 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 <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 }}\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 ) : (\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 }}\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 setDisplayOption(val);\n }}\n >\n <SegmentedControl.Option value=\"all-guides\">\n All guides\n </SegmentedControl.Option>\n <SegmentedControl.Option value=\"only-eligible\">\n Eligible\n </SegmentedControl.Option>\n <SegmentedControl.Option value=\"only-displayable\">\n On this page\n </SegmentedControl.Option>\n </SegmentedControl.Root>\n\n <Tooltip label=\"Sandbox: Contain engagement actions to client side only\">\n <Button\n size=\"1\"\n variant={\n debugSettings.skipEngagementTracking ? \"outline\" : \"ghost\"\n }\n color={\n debugSettings.skipEngagementTracking ? \"blue\" : \"gray\"\n }\n icon={{ icon: BoxIcon, alt: \"Sandbox mode\" }}\n onClick={() => {\n client.setDebug({\n ...debugSettings,\n skipEngagementTracking:\n !debugSettings.skipEngagementTracking,\n });\n }}\n />\n </Tooltip>\n\n <Tooltip label=\"Ignore throttle: Show next guide immediately\">\n <Button\n size=\"1\"\n variant={\n debugSettings.ignoreDisplayInterval ? \"outline\" : \"ghost\"\n }\n color={\n debugSettings.ignoreDisplayInterval ? \"blue\" : \"gray\"\n }\n icon={{ icon: Gauge, alt: \"Ignore throttle\" }}\n onClick={() => {\n client.setDebug({\n ...debugSettings,\n ignoreDisplayInterval:\n !debugSettings.ignoreDisplayInterval,\n });\n }}\n />\n </Tooltip>\n\n <Tooltip label=\"Inspect 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 p=\"1\" overflow=\"auto\" style={{ maxHeight: \"calc(80vh - 96px)\" }}>\n {result.status === \"error\" ? (\n <Box px=\"2\" pb=\"1\">\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 ) : (\n <GuidesList\n guides={result.guides}\n displayOption={displayOption}\n />\n )}\n </Box>\n </Stack>\n )}\n </Box>\n );\n};\n"],"names":["TOOLBAR_WIDTH","GuidesList","guides","displayOption","expandedGuideRowKey","setExpandedGuideRowKey","React","useState","useEffect","undefined","map","guide","idx","isEligible","isQualified","annotation","GuideRow","key","k","V2","client","useGuideContext","setDisplayOption","runConfig","setRunConfig","getRunConfig","isCollapsed","setIsCollapsed","isContextPanelOpen","setIsContextPanelOpen","debugSettings","useStore","store","state","debug","isVisible","focusedGuideKeys","isDebugging","debugging","setDebug","Object","keys","length","unsetDebug","containerRef","useRef","position","isDragging","handlePointerDown","hasDraggedRef","useDraggable","elementRef","reclampDeps","initialPosition","top","right","result","useInspectGuideClientStore","Box","zIndex","TOOLBAR_Z_INDEX","Stack","cursor","touchAction","userSelect","transform","transformOrigin","KnockButton","current","width","boxShadow","boxSizing","minWidth","flex","e","stopPropagation","Icon","GripVertical","SegmentedControl","val","Tooltip","Button","skipEngagementTracking","icon","BoxIcon","alt","ignoreDisplayInterval","Gauge","SlidersHorizontal","ChevronDown","ChevronRight","v","flexShrink","LogOut","curr","clearRunConfigLS","Minimize2","GuideContextDetails","maxHeight","status","Text","error","message"],"mappings":"+qBAgCMA,EAAgB,QAIhBC,EAAaA,CAAC,CAClBC,OAAAA,EACAC,cAAAA,CAIF,IAAM,CACJ,KAAM,CAACC,EAAqBC,CAAsB,EAAIC,EAAAA,QAAMC,SAE1D,EAEFD,OAAAA,EAAAA,QAAME,UAAU,IAAM,CACpBH,EAAuBI,MAAS,CAAA,EAC/B,CAACN,CAAa,CAAC,EAEXD,EAAOQ,IAAI,CAACC,EAAOC,IAAQ,CAC1B,KAAA,CAAEC,WAAAA,EAAYC,YAAAA,GAAgBH,EAAMI,WAMtCZ,OAHAA,IAAkB,oBAAsB,EAFtBU,GAAcC,IAKhCX,IAAkB,iBAAmB,CAACU,EACjC,KAGNP,EAAAA,QAAA,cAAAU,EAAAA,SAAA,CACC,IAAKL,EAAMM,IACX,MAAAN,EACA,WAAYC,EACZ,WAAYD,EAAMM,MAAQb,EAC1B,QAAS,IAAM,CACbC,KACEa,GAAKA,IAAMP,EAAMM,IAAMR,OAAYE,EAAMM,GAC3C,CAAA,EAEF,CAAA,CAEL,CACH,EAE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AAI,GAAG,GAAA,0BACZ0C,EAAAA,KACC,CAAA,GAAG,OACH,KAAK,IACL,OAAO,SACP,MACE5C,EAAO6C,QAAU,oBAAsB,UAAY,KAGpD7C,EAAAA,EAAO8C,OACV,CACF,EAEChG,EAAAA,QAAA,cAAAL,EAAA,CACC,OAAQuD,EAAOtD,OACf,cAAAC,EAEH,CACH,CACF,CAEJ,CAEJ"}
1
+ {"version":3,"file":"V2.js","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":"0uBAgCMA,EAA0B,IAE1BC,EAAgB,QAEhBC,EAAqB,CACzB,gCACA,sCACA,0CACA,kCACA,qCACA,qCAAqC,EACrCC,KAAK,IAAI,EAELC,EAAMA,CAAC,CAAEC,SAAAA,CAAwC,IAEnDC,UAAA,cAAC,OACC,MAAO,CACLC,QAAS,eACTC,QAAS,UACTC,aAAc,wBACdC,OAAQ,qCACRC,gBAAiB,8BAGlBN,CACH,EAIEO,EAAwBC,GAAiC,CAC7D,OAAQA,EAAa,CACnB,IAAK,aACI,MAAA,uDACT,IAAK,cACI,MAAA,8BACT,IAAK,gBACI,MAAA,mDAAA,CAEb,EAEMC,EAAeA,CACnBC,EACAF,IAEOE,EAAOC,OAAkBC,GAC1BJ,EAAAA,IAAkB,iBAAmB,CAACI,EAAMC,WAAWC,YAGvDN,IAAkB,eAAiB,CAACI,EAAMC,WAAWE,OAAOC,OAIjE,EAOUC,EAAKA,CAAC,CAAEC,cAAAA,CAAqB,IAAM,CACxC,KAAA,CAAEC,OAAAA,GAAWC,kBAAgB,EAE7B,CAACZ,EAAea,CAAgB,EACpCpB,EAAAA,QAAMqB,SAAwB,aAAa,EACvC,CAACC,EAAWC,CAAY,EAAIvB,EAAAA,QAAMqB,SAAS,IAC/CG,EAAAA,iBAAiBC,4BACnB,EACM,CAACC,EAAaC,CAAc,EAAI3B,EAAAA,QAAMqB,SAAS,EAAK,EACpD,CAACO,EAAoBC,CAAqB,EAAI7B,EAAAA,QAAMqB,SAAS,EAAK,EAElE,CAACS,EAAqBC,CAAsB,EAAI/B,EAAAA,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CACF,CACF,CACF,EAGCC,GACE5B,EAAA,QAAA,cAAAsE,EAAA,IAAA,CAAI,aAAa,IAAA,EACftE,EAAA,QAAA,cAAA6G,EAAA,oBAAA,IAAmB,CACtB,EAID7G,EAAA,QAAA,cAAAsE,EAAA,IAAA,CACC,QAASb,EACT,EAAE,IACF,SAAS,OACT,MAAO,CAAEqD,UAAW,mBAAoB,CAAA,EAEvC1C,EAAOrD,SAAW,QACjBf,EAAA,QAAA,cAACsE,OAAI,GAAG,IAAI,GAAG,IAAI,MAAO,CAAEyC,WAAY,KAAA,CACtC,EAAA/G,EAAA,QAAA,cAAC0E,EACC,KAAA,CAAA,GAAG,OACH,KAAK,IACL,OAAO,SACP,MACEN,EAAO4C,QAAU,oBAAsB,UAAY,KAGpD5C,EAAAA,EAAO6C,OACV,CACF,EACExG,EAAOmC,SAAW,EACnB5C,EAAAA,QAAA,cAAAsE,EAAAA,IAAA,CAAI,GAAG,IAAI,GAAG,IAAI,MAAO,CAAEyC,WAAY,KAAA,CACtC,EAAA/G,EAAA,QAAA,cAAC0E,EAAAA,KAAK,CAAA,GAAG,OAAO,KAAK,IAAI,OAAO,SAAS,MAAM,SAAA,EAC5CpE,EAAqBC,CAAa,CACrC,CACF,EAEAE,EAAOyG,IACLvG,GAAAX,EAAAA,QAAA,cAACmH,EACC,SAAA,CAAA,IAAKxG,EAAMsC,IACX,MAAAtC,EACA,WAAYA,EAAMyG,WAClB,WAAYzG,EAAMsC,MAAQnB,EAC1B,QAAS,IAAM,CACbC,KACEsF,GAAKA,IAAM1G,EAAMsC,IAAMhB,OAAYtB,EAAMsC,GAC3C,CAAA,GAGL,CAEL,0BAGCqE,EAAU,UAAA,CAAA,OAAA7G,EAAgB,aAAAgD,CAA2B,CAAA,CACxD,CAEJ,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@knocklabs/react-core");require("react");;/* empty css */require("lodash.debounce");const r=require("../../../../core/utils.js"),u="knock_guide_toolbar",s="focused_guide_key",n="knock_guide_debug",l=()=>{const e={isVisible:!1},o=r.checkForWindow();if(!o||!o.location)return e;const c=new URLSearchParams(o.location.search),i=c.get(u),a=c.get(s);if(i!==null){const t={isVisible:i==="true"};return a&&(t.focusedGuideKeys={[a]:!0}),g(t),t}return f()||e},g=e=>{const o=r.checkForWindow();if(!(!o||!o.localStorage))try{o.localStorage.setItem(n,JSON.stringify(e))}catch{}},f=()=>{const e=r.checkForWindow();if(!(!e||!e.localStorage))try{const o=e.localStorage.getItem(n);if(o)return JSON.parse(o)}catch{}},d=()=>{const e=r.checkForWindow();if(!(!e||!e.localStorage))try{e.localStorage.removeItem(n)}catch{}};exports.clearRunConfigLS=d;exports.getRunConfig=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={delayDuration:1e3},o={focusUnknownGuide:"No such guide exists",focusUncommittedGuide:"This guide has not been committed",focusUnselectableGuide:"No component that can display this guide is present"};exports.FOCUS_ERRORS=o;exports.sharedTooltipProps=e;
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/helpers.ts"],"sourcesContent":["import { KnockGuide } from \"@knocklabs/client\";\n\nimport { checkForWindow } from \"../../../../../modules/core\";\n\n// Use this param to start Toolbar and enter into a debugging session when\n// it is present and set to true.\nconst TOOLBAR_QUERY_PARAM = \"knock_guide_toolbar\";\n\n// Optional, when present pin/focus on this guide.\nconst GUIDE_KEY_PARAM = \"focused_guide_key\";\n\n// Use this key to read and write the run config data.\nconst LOCAL_STORAGE_KEY = \"knock_guide_debug\";\n\nexport type ToolbarV2RunConfig = {\n isVisible: boolean;\n focusedGuideKeys?: Record<KnockGuide[\"key\"], true>;\n};\n\nexport const getRunConfig = (): ToolbarV2RunConfig => {\n const fallback = { isVisible: false };\n\n const win = checkForWindow();\n if (!win || !win.location) {\n return fallback;\n }\n\n const urlSearchParams = new URLSearchParams(win.location.search);\n const toolbarParamValue = urlSearchParams.get(TOOLBAR_QUERY_PARAM);\n const guideKeyParamValue = urlSearchParams.get(GUIDE_KEY_PARAM);\n\n // If toolbar param detected in the URL, write to local storage before\n // returning.\n if (toolbarParamValue !== null) {\n const config: ToolbarV2RunConfig = {\n isVisible: toolbarParamValue === \"true\",\n };\n if (guideKeyParamValue) {\n config.focusedGuideKeys = { [guideKeyParamValue]: true };\n }\n\n writeRunConfigLS(config);\n return config;\n }\n\n // If not detected, check local storage for a persisted run config. If not\n // present then fall back to a default config.\n return readRunConfigLS() || fallback;\n};\n\nconst writeRunConfigLS = (config: ToolbarV2RunConfig) => {\n const win = checkForWindow();\n if (!win || !win.localStorage) return;\n\n try {\n win.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(config));\n } catch {\n // localStorage may be unavailable (e.g. private browsing)\n }\n};\n\nconst readRunConfigLS = (): ToolbarV2RunConfig | undefined => {\n const win = checkForWindow();\n if (!win || !win.localStorage) return undefined;\n\n try {\n const stored = win.localStorage.getItem(LOCAL_STORAGE_KEY);\n if (stored) {\n return JSON.parse(stored);\n }\n } catch {\n // localStorage may be unavailable (e.g. private browsing)\n }\n return undefined;\n};\n\nexport const clearRunConfigLS = () => {\n const win = checkForWindow();\n if (!win || !win.localStorage) return;\n\n try {\n win.localStorage.removeItem(LOCAL_STORAGE_KEY);\n } catch {\n // localStorage may be unavailable (e.g. private browsing)\n }\n};\n"],"names":["TOOLBAR_QUERY_PARAM","GUIDE_KEY_PARAM","LOCAL_STORAGE_KEY","getRunConfig","fallback","isVisible","win","checkForWindow","location","urlSearchParams","URLSearchParams","search","toolbarParamValue","get","guideKeyParamValue","config","focusedGuideKeys","writeRunConfigLS","readRunConfigLS","localStorage","setItem","JSON","stringify","stored","getItem","parse","clearRunConfigLS","removeItem"],"mappings":"sQAMMA,EAAsB,sBAGtBC,EAAkB,oBAGlBC,EAAoB,oBAObC,EAAeA,IAA0B,CACpD,MAAMC,EAAW,CAAEC,UAAW,EAAM,EAE9BC,EAAMC,EAAAA,eAAe,EAC3B,GAAI,CAACD,GAAO,CAACA,EAAIE,SACRJ,OAAAA,EAGT,MAAMK,EAAkB,IAAIC,gBAAgBJ,EAAIE,SAASG,MAAM,EACzDC,EAAoBH,EAAgBI,IAAIb,CAAmB,EAC3Dc,EAAqBL,EAAgBI,IAAIZ,CAAe,EAI9D,GAAIW,IAAsB,KAAM,CAC9B,MAAMG,EAA6B,CACjCV,UAAWO,IAAsB,MACnC,EACA,OAAIE,IACFC,EAAOC,iBAAmB,CAAE,CAACF,CAAkB,EAAG,EAAK,GAGzDG,EAAiBF,CAAM,EAChBA,CAAAA,CAKT,OAAOG,EAAqBd,GAAAA,CAC9B,EAEMa,EAAoBF,GAA+B,CACvD,MAAMT,EAAMC,EAAAA,eAAe,EAC3B,GAAI,GAACD,GAAO,CAACA,EAAIa,cAEb,GAAA,CACFb,EAAIa,aAAaC,QAAQlB,EAAmBmB,KAAKC,UAAUP,CAAM,CAAC,CAAA,MAC5D,CAAA,CAGV,EAEMG,EAAkBA,IAAsC,CAC5D,MAAMZ,EAAMC,EAAAA,eAAe,EAC3B,GAAI,GAACD,GAAO,CAACA,EAAIa,cAEb,GAAA,CACF,MAAMI,EAASjB,EAAIa,aAAaK,QAAQtB,CAAiB,EACzD,GAAIqB,EACKF,OAAAA,KAAKI,MAAMF,CAAM,CAC1B,MACM,CAAA,CAIV,EAEaG,EAAmBA,IAAM,CACpC,MAAMpB,EAAMC,EAAAA,eAAe,EAC3B,GAAI,GAACD,GAAO,CAACA,EAAIa,cAEb,GAAA,CACEA,EAAAA,aAAaQ,WAAWzB,CAAiB,CAAA,MACvC,CAAA,CAGV"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/helpers.ts"],"sourcesContent":["export const sharedTooltipProps = {\n delayDuration: 1000,\n};\n\nexport type DisplayOption = \"all-guides\" | \"only-active\" | \"only-eligible\";\n\nexport const FOCUS_ERRORS = {\n focusUnknownGuide: \"No such guide exists\",\n focusUncommittedGuide: \"This guide has not been committed\",\n focusUnselectableGuide: \"No component that can display this guide is present\",\n};\n"],"names":["sharedTooltipProps","delayDuration","FOCUS_ERRORS","focusUnknownGuide","focusUncommittedGuide","focusUnselectableGuide"],"mappings":"gFAAO,MAAMA,EAAqB,CAChCC,cAAe,GACjB,EAIaC,EAAe,CAC1BC,kBAAmB,uBACnBC,sBAAuB,oCACvBC,uBAAwB,qDAC1B"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@knocklabs/client"),y=require("@knocklabs/react-core"),b=e=>e.reduce((t,s)=>({...t,[s.key]:s}),{}),g=(e,t,s,n)=>{var r,u,i,d,o,a,c,f;const l=!!((d=(i=(u=(r=n.key)==null?void 0:r.one)==null?void 0:u.metadata)==null?void 0:i.opts)!=null&&d.includeThrottled)||!!((f=(c=(a=(o=n.key)==null?void 0:o.all)==null?void 0:a.metadata)==null?void 0:c.opts)!=null&&f.includeThrottled);return e.bypass_global_group_limit?"returned":e.key===s.resolved?t.throttled&&!l?"throttled":"returned":"queried"},v=(e,t,s,n)=>{var u,i,d,o;const l=!!((o=(d=(i=(u=n.type)==null?void 0:u.one)==null?void 0:i.metadata)==null?void 0:d.opts)!=null&&o.includeThrottled),r=n.type.one;if(r.size===0)return"queried";if(e.bypass_global_group_limit){const c=[...r.values()][0];return e.key!==c.key?"queried":"returned"}return e.key===s.resolved?t.throttled&&!l?"throttled":"returned":"queried"},h=(e,t,s,n)=>{var o,a,c,f;const l=n.type.all;if(l.size===0)return"queried";const r=[...l.values()],u=r[0],i=b(r);return(f=(c=(a=(o=n.type)==null?void 0:o.all)==null?void 0:a.metadata)==null?void 0:c.opts)!=null&&f.includeThrottled?i[e.key]?"returned":"queried":(u.bypass_global_group_limit||u.key===s.resolved)&&i[e.key]?t.throttled?e.bypass_global_group_limit?"returned":"throttled":"returned":"queried"},G=(e,t,s,n)=>{var l,r;if(n.key)return g(e,t,s,n);if((l=n.type)!=null&&l.all)return h(e,t,s,n);if((r=n.type)!=null&&r.one)return v(e,t,s,n)},S=(e,t,s)=>{if(!s||s.status==="open")return{status:void 0};const n={key:(s.results.key||{})[e.key],type:(s.results.type||{})[e.type]};if(!!!(n.key||n.type))return{status:void 0};const r=G(e,t,s,n);return r?{status:r,query:n}:{status:void 0}},T=(e,t)=>{const s={};return((t==null?void 0:t.reason)==="not_in_target_audience"||(t==null?void 0:t.reason)==="target_conditions_not_met")&&(s.targetable={status:!1,reason:t.reason,message:t.message}),((t==null?void 0:t.reason)==="marked_as_archived"||(e.steps||[]).every(n=>!!n.message.archived_at))&&(s.archived={status:!0}),(t==null?void 0:t.reason)==="guide_not_active"&&(s.active={status:!1}),s},q=({active:e,targetable:t,archived:s})=>!(!e.status||!t.status||s.status),_=({activatable:e,selectable:t})=>!(!e.status||!t.status),k=(e,t,s)=>{const{ineligibleGuides:n,location:l}=t,r=n[e.key],u=T(e,r),i={active:(u==null?void 0:u.active)||{status:!0},targetable:(u==null?void 0:u.targetable)||{status:!0},archived:(u==null?void 0:u.archived)||{status:!1},activatable:{status:p.checkActivatable(e,l)},selectable:S(e,t,s)},d={...i,isEligible:q(i),isQualified:_(i)};return{...e,annotation:d}},w=e=>({__typename:"UnknownGuide",key:e,active:!1,bypass_global_group_limit:!1,annotation:{isEligible:!1,isQualified:!1,selectable:{status:void 0}}}),I=e=>{var d;const{client:t}=y.useGuideContext(),s=y.useStore(t.store,o=>{const a=p.checkStateIfThrottled(o);return{location:o.location,guides:o.guides,guideGroups:o.guideGroups,ineligibleGuides:o.ineligibleGuides,debug:o.debug,counter:o.counter,queries:o.queries,throttled:a}});if(!((d=s.debug)!=null&&d.debugging))return;const n=Object.entries(s.queries)[0];if(!n||n[1].status==="loading")return{status:"error",error:"no_guides_fetched",message:"Loading..."};const l=s.guideGroups[0];if(!l)return{status:"error",error:"no_guide_group",message:"No guide group found"};const r=t.getStage(),u=l.display_sequence.map(o=>{const a=s.guides[o];return a?k(a,s,r):w(o)}),i=Object.keys(e.focusedGuideKeys||{})[0];return(r==null?void 0:r.status)==="closed"&&i&&!u.find(a=>a.key===i&&a.annotation.selectable.status)?{status:"error",error:"no_guide_present",message:`No component that can render \`${i}\` was found`}:{status:"ok",guides:u}},B=e=>typeof e=="object"&&e!==null&&"__typename"in e&&e.__typename==="UnknownGuide";exports.isUnknownGuide=B;exports.resolveIsQualified=_;exports.useInspectGuideClientStore=I;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@knocklabs/client"),y=require("@knocklabs/react-core"),_=require("./helpers.js"),v=e=>e.reduce((t,s)=>({...t,[s.key]:s}),{}),h=(e,t,s,r)=>{var o,l,u,a,n,d,c,f;const i=!!((a=(u=(l=(o=r.key)==null?void 0:o.one)==null?void 0:l.metadata)==null?void 0:u.opts)!=null&&a.includeThrottled)||!!((f=(c=(d=(n=r.key)==null?void 0:n.all)==null?void 0:d.metadata)==null?void 0:c.opts)!=null&&f.includeThrottled);return e.bypass_global_group_limit?"returned":e.key===s.resolved?t.throttled&&!i?"throttled":"returned":"queried"},G=(e,t,s,r)=>{var l,u,a,n;const i=!!((n=(a=(u=(l=r.type)==null?void 0:l.one)==null?void 0:u.metadata)==null?void 0:a.opts)!=null&&n.includeThrottled),o=r.type.one;if(o.size===0)return"queried";if(e.bypass_global_group_limit){const c=[...o.values()][0];return e.key!==c.key?"queried":"returned"}return e.key===s.resolved?t.throttled&&!i?"throttled":"returned":"queried"},S=(e,t,s,r)=>{var n,d,c,f;const i=r.type.all;if(i.size===0)return"queried";const o=[...i.values()],l=o[0],u=v(o);return(f=(c=(d=(n=r.type)==null?void 0:n.all)==null?void 0:d.metadata)==null?void 0:c.opts)!=null&&f.includeThrottled?u[e.key]?"returned":"queried":(l.bypass_global_group_limit||l.key===s.resolved)&&u[e.key]?t.throttled?e.bypass_global_group_limit?"returned":"throttled":"returned":"queried"},m=(e,t,s,r)=>{var i,o;if(r.key)return h(e,t,s,r);if((i=r.type)!=null&&i.all)return S(e,t,s,r);if((o=r.type)!=null&&o.one)return G(e,t,s,r)},U=(e,t,s)=>{if(!s||s.status==="open")return{status:void 0};const r={key:(s.results.key||{})[e.key],type:(s.results.type||{})[e.type]};if(!!!(r.key||r.type))return{status:void 0};const o=m(e,t,s,r);return o?{status:o,query:r}:{status:void 0}},R=(e,t)=>{const s={};return((t==null?void 0:t.reason)==="not_in_target_audience"||(t==null?void 0:t.reason)==="target_conditions_not_met")&&(s.targetable={status:!1,reason:t.reason,message:t.message}),((t==null?void 0:t.reason)==="marked_as_archived"||(e.steps||[]).every(r=>!!r.message.archived_at))&&(s.archived={status:!0}),(t==null?void 0:t.reason)==="guide_not_active"&&(s.active={status:!1}),s},T=({active:e,targetable:t,archived:s})=>!(!e.status||!t.status||s.status),b=({activatable:e,selectable:t})=>!(!e.status||!t.status),q=(e,t,s,r)=>{const{ineligibleGuides:i,location:o}=s,l=i[e.key],u=R(e,l),a={active:(u==null?void 0:u.active)||{status:!0},targetable:(u==null?void 0:u.targetable)||{status:!0},archived:(u==null?void 0:u.archived)||{status:!1},activatable:{status:p.checkActivatable(e,o)},selectable:U(e,s,r)},n={...a,isEligible:T(a),isQualified:b(a)};return{...e,orderIndex:t,annotation:n}},C=(e,t)=>({__typename:"UncommittedGuide",key:e,orderIndex:t,active:!1,bypass_global_group_limit:!1,annotation:{isEligible:!1,isQualified:!1,active:{status:!1},selectable:{status:void 0}}}),O=e=>{var a;const{client:t}=y.useGuideContext(),s=y.useStore(t.store,n=>{const d=p.checkStateIfThrottled(n);return{location:n.location,guides:n.guides,guideGroups:n.guideGroups,ineligibleGuides:n.ineligibleGuides,debug:n.debug,counter:n.counter,queries:n.queries,throttled:d}});if(!((a=s.debug)!=null&&a.debugging))return;const r=Object.entries(s.queries)[0];if(!r||r[1].status==="loading")return{status:"error",error:"no_guides_fetched",message:"Loading..."};const i=s.guideGroups[0];if(!i)return{status:"error",error:"no_guide_group",message:"No guide group found"};const o=t.getStage(),l=i.display_sequence.map((n,d)=>{const c=s.guides[n];return c?q(c,d,s,o):C(n,d)}),u=Object.keys(e.focusedGuideKeys||{})[0];if((o==null?void 0:o.status)==="closed"&&u){const n=l.find(d=>d.key===u);if(!n)return{status:"error",error:"focus_unknown_guide",message:`Unable to display \`${u}\`, ${_.FOCUS_ERRORS.focusUnknownGuide.toLowerCase()}.`};if(g(n))return{status:"error",error:"focus_uncommitted_guide",message:`Unable to display \`${u}\`, ${_.FOCUS_ERRORS.focusUncommittedGuide.toLowerCase()}.`};if(!n.annotation.selectable.status)return{status:"error",error:"focus_unselectable_guide",message:`Unable to display \`${u}\`, ${_.FOCUS_ERRORS.focusUnselectableGuide.toLowerCase()}.`}}return{status:"ok",guides:l}},g=e=>typeof e=="object"&&e!==null&&"__typename"in e&&e.__typename==="UncommittedGuide";exports.isUncommittedGuide=g;exports.resolveIsQualified=b;exports.useInspectGuideClientStore=O;
2
2
  //# sourceMappingURL=useInspectGuideClientStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInspectGuideClientStore.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideClientGroupStage,\n KnockGuideClientStoreState,\n KnockGuideIneligibilityMarker,\n KnockGuideSelectionResult,\n checkActivatable,\n checkStateIfThrottled,\n} from \"@knocklabs/client\";\nimport { useGuideContext, useStore } from \"@knocklabs/react-core\";\n\nimport { ToolbarV2RunConfig } from \"./helpers\";\n\nconst byKey = <T extends { key: string }>(items: T[]) => {\n return items.reduce((acc, item) => ({ ...acc, [item.key]: item }), {});\n};\n\n/**\n * This is the main module that will house core logic for the toolbar. It hooks\n * into the guide client state store, extracts relevant data for debugging, and\n * transforms it into easily consumable data for the toolbar - namely\n * \"annotating\" guides for its various statuses to display.\n */\n\n// Active: `true` status = good\ntype ActiveStatus = {\n status: boolean;\n};\n\n// Targetable: `true` status = good\ntype TargetableStatusTrue = {\n status: true;\n};\ntype TargetableStatusFalse = {\n status: false;\n reason: string;\n message: string;\n};\ntype TargetableStatus = TargetableStatusTrue | TargetableStatusFalse;\n\ntype ActivatableStatus = {\n status: boolean;\n};\n\n// Archived: `false` status = good\ntype ArchivedStatus = {\n status: boolean;\n};\n\n// Selectable:\n// - \"returned\": Queried and resolved to return the guide from useGuide(s).\n// - \"throttled\": Queried and resolved but being throttled, so not yet returned.\n// - \"queried\": Queried but not resolved, because there are other higher\n// priority guides that are ahead of this guide in the query result.\n// - undefined: Not reachable with any of the given queries and filters.\ntype SelectionResultByLimit = {\n one?: KnockGuideSelectionResult;\n all?: KnockGuideSelectionResult;\n};\ntype SelectionResultByQuery = {\n key?: SelectionResultByLimit;\n type?: SelectionResultByLimit;\n};\ntype SelectableStatusPresent = {\n status: \"returned\" | \"throttled\" | \"queried\";\n query: SelectionResultByQuery;\n};\ntype SelectableStatusAbsent = {\n status: undefined;\n};\ntype SelectableStatus = SelectableStatusPresent | SelectableStatusAbsent;\n\nexport type AnnotatedStatuses = {\n // Individual eligibility statuses:\n active: ActiveStatus;\n targetable: TargetableStatus;\n archived: ArchivedStatus;\n // Individual qualified statuses:\n activatable: ActivatableStatus;\n selectable: SelectableStatus;\n};\n\ntype GuideAnnotation = AnnotatedStatuses & {\n // Resolved eligibility based on active, targetable and archived statuses,\n // which are backend driven evaluation results that are exposed for debugging.\n isEligible: boolean;\n\n // Resolved display qualification based on an activatable status, which\n // informs \"when\" and \"where\" an eligible guide can be displayed to user.\n isQualified: boolean;\n};\n\nexport type AnnotatedGuide = KnockGuide & {\n annotation: GuideAnnotation;\n\n // Legacy fields, typed only to make tsc happy when we prune these out.\n activation_location_rules?: KnockGuide[\"activation_url_patterns\"];\n priority?: number;\n};\n\n// Exists and ordered in control but absent in switchboard (therefore not\n// included in the api response), which implies a newly created guide that has\n// never been published to switchboard.\nexport type UnknownGuide = {\n __typename: \"UnknownGuide\";\n key: KnockGuide[\"key\"];\n active: false;\n bypass_global_group_limit: false;\n annotation: {\n isEligible: false;\n isQualified: false;\n selectable: {\n status: undefined;\n };\n };\n};\n\nexport type InspectionResultOk = {\n status: \"ok\";\n guides: (AnnotatedGuide | UnknownGuide)[];\n};\ntype InspectionResultError = {\n status: \"error\";\n error: \"no_guides_fetched\" | \"no_guide_group\" | \"no_guide_present\";\n message: string;\n};\ntype InspectionResult = InspectionResultOk | InspectionResultError;\n\ntype StoreStateSnapshot = Pick<\n KnockGuideClientStoreState,\n | \"location\"\n | \"guides\"\n | \"guideGroups\"\n | \"ineligibleGuides\"\n | \"debug\"\n | \"counter\"\n | \"queries\"\n> & {\n throttled: boolean;\n};\n\nconst inferSelectByKeyReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled =\n !!query.key?.one?.metadata?.opts?.includeThrottled ||\n !!query.key?.all?.metadata?.opts?.includeThrottled;\n\n // If unthrottled, then it should always be returned.\n if (guide.bypass_global_group_limit) {\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectOneByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled = !!query.type?.one?.metadata?.opts?.includeThrottled;\n\n const result = query.type!.one!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n // There may be multiple unthrottled guides of the same type, being queried\n // by type to return a single guide, for example: useGuide({ type: \"card\" }).\n //\n // So it is possible for an unthrottled guide to be shadowed by another\n // unthrottled guide of the same type with higher priority, so we need to\n // look at the query result to determine its return status.\n if (guide.bypass_global_group_limit) {\n const guides = [...result.values()];\n const first = guides[0]!;\n\n if (guide.key !== first.key) {\n // Being shadowed by another guide with higher priority.\n return \"queried\";\n }\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectAllByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const result = query.type!.all!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n const guides = [...result.values()];\n const first = guides[0]!;\n\n // Might want to consider moving this up to do once.\n const guidesByKey: Record<KnockGuide[\"key\"], KnockGuide> = byKey(guides);\n\n // If includeThrottled given, then expect all selected guides to be returned.\n const includeThrottled = !!query.type?.all?.metadata?.opts?.includeThrottled;\n if (includeThrottled) {\n return guidesByKey[guide.key] ? \"returned\" : \"queried\";\n }\n\n // If the first selected guide is unthrottled or resolved, then we should\n // have at minimum one guide to return, and potentially more based on whether\n // we are throttling currently and which other guides are unthrottled.\n if (first.bypass_global_group_limit || first.key === stage.resolved) {\n if (!guidesByKey[guide.key]) {\n return \"queried\";\n }\n if (snapshot.throttled) {\n return guide.bypass_global_group_limit ? \"returned\" : \"throttled\";\n }\n return \"returned\";\n }\n\n return \"queried\";\n};\n\nconst inferSelectReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n) => {\n // Querying by key can only return up to a max of one guide, regardless of\n // useGuide or useGuides, and should take precedence in status designation.\n if (query.key) {\n return inferSelectByKeyReturnStatus(guide, snapshot, stage, query);\n }\n\n if (query.type?.all) {\n return inferSelectAllByTypeReturnStatus(guide, snapshot, stage, query);\n }\n if (query.type?.one) {\n return inferSelectOneByTypeReturnStatus(guide, snapshot, stage, query);\n }\n\n // Should not happen but just for completeness.\n return undefined;\n};\n\nconst toSelectableStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): SelectableStatus => {\n if (!stage || stage.status === \"open\") {\n return { status: undefined };\n }\n\n const query = {\n key: (stage.results.key || {})[guide.key],\n type: (stage.results.type || {})[guide.type],\n };\n\n const queried = Boolean(query.key || query.type);\n if (!queried) {\n // No present query in the current location can select this guide.\n return { status: undefined };\n }\n\n const status = inferSelectReturnStatus(guide, snapshot, stage, query);\n if (!status) {\n return { status: undefined };\n }\n\n return { status, query };\n};\n\nconst toIneligibilityStatus = (\n guide: KnockGuide,\n marker?: KnockGuideIneligibilityMarker,\n): Partial<AnnotatedStatuses> => {\n const statuses: Partial<AnnotatedStatuses> = {};\n\n if (\n marker?.reason === \"not_in_target_audience\" ||\n marker?.reason === \"target_conditions_not_met\"\n ) {\n statuses.targetable = {\n status: false,\n reason: marker.reason,\n message: marker.message,\n };\n }\n\n if (\n marker?.reason === \"marked_as_archived\" ||\n (guide.steps || []).every((s) => !!s.message.archived_at)\n ) {\n statuses.archived = {\n status: true,\n };\n }\n\n if (marker?.reason === \"guide_not_active\") {\n statuses.active = {\n status: false,\n };\n }\n\n return statuses;\n};\n\nconst resolveIsEligible = ({\n active,\n targetable,\n archived,\n}: AnnotatedStatuses) => {\n if (!active.status) return false;\n if (!targetable.status) return false;\n if (archived.status) return false;\n return true;\n};\n\nexport const resolveIsQualified = ({\n activatable,\n selectable,\n}: AnnotatedStatuses) => {\n if (!activatable.status) return false;\n if (!selectable.status) return false;\n return true;\n};\n\nconst annotateGuide = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): AnnotatedGuide => {\n const { ineligibleGuides, location } = snapshot;\n const marker = ineligibleGuides[guide.key];\n const ineligiblity = toIneligibilityStatus(guide, marker);\n\n const statuses: AnnotatedStatuses = {\n // isEligible:\n active: ineligiblity?.active || { status: true },\n targetable: ineligiblity?.targetable || { status: true },\n archived: ineligiblity?.archived || { status: false },\n // isQualified:\n activatable: { status: checkActivatable(guide, location) },\n selectable: toSelectableStatus(guide, snapshot, stage),\n };\n\n const annotation: GuideAnnotation = {\n ...statuses,\n isEligible: resolveIsEligible(statuses),\n isQualified: resolveIsQualified(statuses),\n };\n\n return {\n ...guide,\n annotation,\n };\n};\n\nconst newUnknownGuide = (key: KnockGuide[\"key\"]) =>\n ({\n __typename: \"UnknownGuide\",\n key,\n active: false,\n bypass_global_group_limit: false,\n annotation: {\n isEligible: false,\n isQualified: false,\n selectable: {\n status: undefined,\n },\n },\n }) as UnknownGuide;\n\nexport const useInspectGuideClientStore = (\n runConfig: ToolbarV2RunConfig,\n): InspectionResult | undefined => {\n const { client } = useGuideContext();\n\n // Extract a snapshot of the client store state for debugging.\n const snapshot: StoreStateSnapshot = useStore(client.store, (state) => {\n const throttled = checkStateIfThrottled(state);\n\n return {\n location: state.location,\n guides: state.guides,\n guideGroups: state.guideGroups,\n ineligibleGuides: state.ineligibleGuides,\n debug: state.debug,\n counter: state.counter,\n queries: state.queries,\n throttled,\n };\n });\n\n // Not in debugging session, so noop.\n if (!snapshot.debug?.debugging) {\n return undefined;\n }\n\n // No recorded fetch requests, which implies an inflight request loading.\n const req = Object.entries(snapshot.queries)[0];\n if (!req || req[1].status === \"loading\") {\n return {\n status: \"error\",\n error: \"no_guides_fetched\",\n message: \"Loading...\",\n };\n }\n\n // Should always be a default group so this should never happen.\n const defaultGroup = snapshot.guideGroups[0];\n if (!defaultGroup) {\n return {\n status: \"error\",\n error: \"no_guide_group\",\n message: \"No guide group found\",\n };\n }\n\n const groupStage = client.getStage();\n\n // Annotate guides for various eligibility, activation and query statuses\n // that are useful for debugging purposes.\n const orderedGuides = defaultGroup.display_sequence.map((guideKey) => {\n const guide = snapshot.guides[guideKey];\n if (!guide) {\n return newUnknownGuide(guideKey);\n }\n\n return annotateGuide(guide, snapshot, groupStage);\n });\n\n // Check if the focused guide actually exists and is selectable on the page.\n const focusedGuideKey = Object.keys(runConfig.focusedGuideKeys || {})[0];\n if (groupStage?.status === \"closed\" && focusedGuideKey) {\n const focusableGuide = orderedGuides.find(\n (g) => g.key === focusedGuideKey && g.annotation.selectable.status,\n );\n if (!focusableGuide) {\n return {\n status: \"error\",\n error: \"no_guide_present\",\n message: `No component that can render \\`${focusedGuideKey}\\` was found`,\n };\n }\n }\n\n return {\n status: \"ok\",\n guides: orderedGuides,\n };\n};\n\nexport const isUnknownGuide = (input: unknown): input is UnknownGuide =>\n typeof input === \"object\" &&\n input !== null &&\n \"__typename\" in input &&\n (input as UnknownGuide).__typename === \"UnknownGuide\";\n"],"names":["byKey","items","reduce","acc","item","key","inferSelectByKeyReturnStatus","guide","snapshot","stage","query","includeThrottled","one","metadata","opts","all","bypass_global_group_limit","resolved","throttled","inferSelectOneByTypeReturnStatus","type","result","size","first","values","inferSelectAllByTypeReturnStatus","guides","guidesByKey","inferSelectReturnStatus","toSelectableStatus","status","undefined","results","Boolean","toIneligibilityStatus","marker","statuses","reason","targetable","message","steps","every","s","archived_at","archived","active","resolveIsEligible","resolveIsQualified","activatable","selectable","annotateGuide","ineligibleGuides","location","ineligiblity","checkActivatable","annotation","isEligible","isQualified","newUnknownGuide","__typename","useInspectGuideClientStore","runConfig","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","queries","debugging","req","Object","entries","error","defaultGroup","groupStage","getStage","orderedGuides","display_sequence","map","guideKey","focusedGuideKey","keys","focusedGuideKeys","find","g","isUnknownGuide","input"],"mappings":"wJAaMA,EAAoCC,GACjCA,EAAMC,OAAO,CAACC,EAAKC,KAAU,CAAE,GAAGD,EAAK,CAACC,EAAKC,GAAG,EAAGD,CAAK,GAAI,CAAA,CAAE,EA+HjEE,EAA+BA,CACnCC,EACAC,EACAC,EACAC,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MAAQ+E,GAAmBI,EAAEjC,WAAWN,WAAWnB,MAC9D,EAES,CACLA,OAAQ,QACR8C,MAAO,mBACPrC,QAAS,kCAAkC6C,CAAe,cAC5D,EAIG,CACLtD,OAAQ,KACRJ,OAAQsD,CACV,CACF,EAEaS,EAAkBC,GAC7B,OAAOA,GAAU,UACjBA,IAAU,MACV,eAAgBA,GACfA,EAAuB/B,aAAe"}
1
+ {"version":3,"file":"useInspectGuideClientStore.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideClientGroupStage,\n KnockGuideClientStoreState,\n KnockGuideIneligibilityMarker,\n KnockGuideSelectionResult,\n type ToolbarV2RunConfig,\n checkActivatable,\n checkStateIfThrottled,\n} from \"@knocklabs/client\";\nimport { useGuideContext, useStore } from \"@knocklabs/react-core\";\n\nimport { FOCUS_ERRORS } from \"./helpers\";\n\nconst byKey = <T extends { key: string }>(items: T[]) => {\n return items.reduce((acc, item) => ({ ...acc, [item.key]: item }), {});\n};\n\n/**\n * This is the main module that will house core logic for the toolbar. It hooks\n * into the guide client state store, extracts relevant data for debugging, and\n * transforms it into easily consumable data for the toolbar - namely\n * \"annotating\" guides for its various statuses to display.\n */\n\n// Active: `true` status = good\ntype ActiveStatus = {\n status: boolean;\n};\n\n// Targetable: `true` status = good\ntype TargetableStatusTrue = {\n status: true;\n};\ntype TargetableStatusFalse = {\n status: false;\n reason: string;\n message: string;\n};\ntype TargetableStatus = TargetableStatusTrue | TargetableStatusFalse;\n\ntype ActivatableStatus = {\n status: boolean;\n};\n\n// Archived: `false` status = good\ntype ArchivedStatus = {\n status: boolean;\n};\n\n// Selectable:\n// - \"returned\": Queried and resolved to return the guide from useGuide(s).\n// - \"throttled\": Queried and resolved but being throttled, so not yet returned.\n// - \"queried\": Queried but not resolved, because there are other higher\n// priority guides that are ahead of this guide in the query result.\n// - undefined: Not reachable with any of the given queries and filters.\ntype SelectionResultByLimit = {\n one?: KnockGuideSelectionResult;\n all?: KnockGuideSelectionResult;\n};\ntype SelectionResultByQuery = {\n key?: SelectionResultByLimit;\n type?: SelectionResultByLimit;\n};\ntype SelectableStatusPresent = {\n status: \"returned\" | \"throttled\" | \"queried\";\n query: SelectionResultByQuery;\n};\ntype SelectableStatusAbsent = {\n status: undefined;\n};\ntype SelectableStatus = SelectableStatusPresent | SelectableStatusAbsent;\n\nexport type AnnotatedStatuses = {\n // Individual eligibility statuses:\n active: ActiveStatus;\n targetable: TargetableStatus;\n archived: ArchivedStatus;\n // Individual qualified statuses:\n activatable: ActivatableStatus;\n selectable: SelectableStatus;\n};\n\ntype GuideAnnotation = AnnotatedStatuses & {\n // Resolved eligibility based on active, targetable and archived statuses,\n // which are backend driven evaluation results that are exposed for debugging.\n isEligible: boolean;\n\n // Resolved display qualification based on an activatable status, which\n // informs \"when\" and \"where\" an eligible guide can be displayed to user.\n isQualified: boolean;\n};\n\nexport type AnnotatedGuide = KnockGuide & {\n orderIndex: number;\n annotation: GuideAnnotation;\n\n // Legacy fields, typed only to make tsc happy when we prune these out.\n activation_location_rules?: KnockGuide[\"activation_url_patterns\"];\n priority?: number;\n};\n\n// Exists and ordered in control but absent in switchboard (therefore not\n// included in the api response), which implies a newly created guide that has\n// never been published to switchboard.\nexport type UncommittedGuide = {\n __typename: \"UncommittedGuide\";\n orderIndex: number;\n key: KnockGuide[\"key\"];\n active: false;\n bypass_global_group_limit: false;\n annotation: {\n isEligible: false;\n isQualified: false;\n active: {\n status: false;\n };\n selectable: {\n status: undefined;\n };\n };\n};\n\nexport type InspectionResultOk = {\n status: \"ok\";\n guides: (AnnotatedGuide | UncommittedGuide)[];\n};\ntype InspectionResultError = {\n status: \"error\";\n error:\n | \"no_guides_fetched\"\n | \"no_guide_group\"\n | \"focus_unknown_guide\"\n | \"focus_uncommitted_guide\"\n | \"focus_unselectable_guide\";\n message: string;\n};\ntype InspectionResult = InspectionResultOk | InspectionResultError;\n\ntype StoreStateSnapshot = Pick<\n KnockGuideClientStoreState,\n | \"location\"\n | \"guides\"\n | \"guideGroups\"\n | \"ineligibleGuides\"\n | \"debug\"\n | \"counter\"\n | \"queries\"\n> & {\n throttled: boolean;\n};\n\nconst inferSelectByKeyReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled =\n !!query.key?.one?.metadata?.opts?.includeThrottled ||\n !!query.key?.all?.metadata?.opts?.includeThrottled;\n\n // If unthrottled, then it should always be returned.\n if (guide.bypass_global_group_limit) {\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectOneByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const includeThrottled = !!query.type?.one?.metadata?.opts?.includeThrottled;\n\n const result = query.type!.one!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n // There may be multiple unthrottled guides of the same type, being queried\n // by type to return a single guide, for example: useGuide({ type: \"card\" }).\n //\n // So it is possible for an unthrottled guide to be shadowed by another\n // unthrottled guide of the same type with higher priority, so we need to\n // look at the query result to determine its return status.\n if (guide.bypass_global_group_limit) {\n const guides = [...result.values()];\n const first = guides[0]!;\n\n if (guide.key !== first.key) {\n // Being shadowed by another guide with higher priority.\n return \"queried\";\n }\n return \"returned\";\n }\n\n // If resolved, expect this guide to be returned unless being throttled.\n if (guide.key === stage.resolved) {\n if (snapshot.throttled && !includeThrottled) {\n return \"throttled\";\n }\n return \"returned\";\n }\n\n // If queried but not resolved, it means this guide is being shadowed by\n // another guide with higher priority because throttled guides can be\n // displayed only one at a time.\n return \"queried\";\n};\n\nconst inferSelectAllByTypeReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n): SelectableStatusPresent[\"status\"] => {\n const result = query.type!.all!;\n if (result.size === 0) {\n return \"queried\";\n }\n\n const guides = [...result.values()];\n const first = guides[0]!;\n\n // Might want to consider moving this up to do once.\n const guidesByKey: Record<KnockGuide[\"key\"], KnockGuide> = byKey(guides);\n\n // If includeThrottled given, then expect all selected guides to be returned.\n const includeThrottled = !!query.type?.all?.metadata?.opts?.includeThrottled;\n if (includeThrottled) {\n return guidesByKey[guide.key] ? \"returned\" : \"queried\";\n }\n\n // If the first selected guide is unthrottled or resolved, then we should\n // have at minimum one guide to return, and potentially more based on whether\n // we are throttling currently and which other guides are unthrottled.\n if (first.bypass_global_group_limit || first.key === stage.resolved) {\n if (!guidesByKey[guide.key]) {\n return \"queried\";\n }\n if (snapshot.throttled) {\n return guide.bypass_global_group_limit ? \"returned\" : \"throttled\";\n }\n return \"returned\";\n }\n\n return \"queried\";\n};\n\nconst inferSelectReturnStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage,\n query: SelectionResultByQuery,\n) => {\n // Querying by key can only return up to a max of one guide, regardless of\n // useGuide or useGuides, and should take precedence in status designation.\n if (query.key) {\n return inferSelectByKeyReturnStatus(guide, snapshot, stage, query);\n }\n\n if (query.type?.all) {\n return inferSelectAllByTypeReturnStatus(guide, snapshot, stage, query);\n }\n if (query.type?.one) {\n return inferSelectOneByTypeReturnStatus(guide, snapshot, stage, query);\n }\n\n // Should not happen but just for completeness.\n return undefined;\n};\n\nconst toSelectableStatus = (\n guide: KnockGuide,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): SelectableStatus => {\n if (!stage || stage.status === \"open\") {\n return { status: undefined };\n }\n\n const query = {\n key: (stage.results.key || {})[guide.key],\n type: (stage.results.type || {})[guide.type],\n };\n\n const queried = Boolean(query.key || query.type);\n if (!queried) {\n // No present query in the current location can select this guide.\n return { status: undefined };\n }\n\n const status = inferSelectReturnStatus(guide, snapshot, stage, query);\n if (!status) {\n return { status: undefined };\n }\n\n return { status, query };\n};\n\nconst toIneligibilityStatus = (\n guide: KnockGuide,\n marker?: KnockGuideIneligibilityMarker,\n): Partial<AnnotatedStatuses> => {\n const statuses: Partial<AnnotatedStatuses> = {};\n\n if (\n marker?.reason === \"not_in_target_audience\" ||\n marker?.reason === \"target_conditions_not_met\"\n ) {\n statuses.targetable = {\n status: false,\n reason: marker.reason,\n message: marker.message,\n };\n }\n\n if (\n marker?.reason === \"marked_as_archived\" ||\n (guide.steps || []).every((s) => !!s.message.archived_at)\n ) {\n statuses.archived = {\n status: true,\n };\n }\n\n if (marker?.reason === \"guide_not_active\") {\n statuses.active = {\n status: false,\n };\n }\n\n return statuses;\n};\n\nconst resolveIsEligible = ({\n active,\n targetable,\n archived,\n}: AnnotatedStatuses) => {\n if (!active.status) return false;\n if (!targetable.status) return false;\n if (archived.status) return false;\n return true;\n};\n\nexport const resolveIsQualified = ({\n activatable,\n selectable,\n}: AnnotatedStatuses) => {\n if (!activatable.status) return false;\n if (!selectable.status) return false;\n return true;\n};\n\nconst annotateGuide = (\n guide: KnockGuide,\n orderIndex: number,\n snapshot: StoreStateSnapshot,\n stage: KnockGuideClientGroupStage | undefined,\n): AnnotatedGuide => {\n const { ineligibleGuides, location } = snapshot;\n const marker = ineligibleGuides[guide.key];\n const ineligiblity = toIneligibilityStatus(guide, marker);\n\n const statuses: AnnotatedStatuses = {\n // isEligible:\n active: ineligiblity?.active || { status: true },\n targetable: ineligiblity?.targetable || { status: true },\n archived: ineligiblity?.archived || { status: false },\n // isQualified:\n activatable: { status: checkActivatable(guide, location) },\n selectable: toSelectableStatus(guide, snapshot, stage),\n };\n\n const annotation: GuideAnnotation = {\n ...statuses,\n isEligible: resolveIsEligible(statuses),\n isQualified: resolveIsQualified(statuses),\n };\n\n return {\n ...guide,\n orderIndex,\n annotation,\n };\n};\n\nconst newUncommittedGuide = (key: KnockGuide[\"key\"], orderIndex: number) =>\n ({\n __typename: \"UncommittedGuide\",\n key,\n orderIndex,\n active: false,\n bypass_global_group_limit: false,\n annotation: {\n isEligible: false,\n isQualified: false,\n active: {\n status: false,\n },\n selectable: {\n status: undefined,\n },\n },\n }) as UncommittedGuide;\n\nexport const useInspectGuideClientStore = (\n runConfig: ToolbarV2RunConfig,\n): InspectionResult | undefined => {\n const { client } = useGuideContext();\n\n // Extract a snapshot of the client store state for debugging.\n const snapshot: StoreStateSnapshot = useStore(client.store, (state) => {\n const throttled = checkStateIfThrottled(state);\n\n return {\n location: state.location,\n guides: state.guides,\n guideGroups: state.guideGroups,\n ineligibleGuides: state.ineligibleGuides,\n debug: state.debug,\n counter: state.counter,\n queries: state.queries,\n throttled,\n };\n });\n\n // Not in debugging session, so noop.\n if (!snapshot.debug?.debugging) {\n return undefined;\n }\n\n // No recorded fetch requests, which implies an inflight request loading.\n const req = Object.entries(snapshot.queries)[0];\n if (!req || req[1].status === \"loading\") {\n return {\n status: \"error\",\n error: \"no_guides_fetched\",\n message: \"Loading...\",\n };\n }\n\n // Should always be a default group so this should never happen.\n const defaultGroup = snapshot.guideGroups[0];\n if (!defaultGroup) {\n return {\n status: \"error\",\n error: \"no_guide_group\",\n message: \"No guide group found\",\n };\n }\n\n const groupStage = client.getStage();\n\n // Annotate guides for various eligibility, activation and query statuses\n // that are useful for debugging purposes.\n const orderedGuides = defaultGroup.display_sequence.map((guideKey, index) => {\n const guide = snapshot.guides[guideKey];\n if (!guide) {\n return newUncommittedGuide(guideKey, index);\n }\n\n return annotateGuide(guide, index, snapshot, groupStage);\n });\n\n // Check if the focused guide actually exists and is selectable on the page.\n const focusedGuideKey = Object.keys(runConfig.focusedGuideKeys || {})[0];\n if (groupStage?.status === \"closed\" && focusedGuideKey) {\n const foundGuide = orderedGuides.find((g) => g.key === focusedGuideKey);\n\n // No such guide exists for the given focused guide key.\n if (!foundGuide) {\n return {\n status: \"error\",\n error: \"focus_unknown_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUnknownGuide.toLowerCase()}.`,\n };\n }\n\n // This guide exists but has never been committed and published, so it is\n // not present in the API response.\n if (isUncommittedGuide(foundGuide)) {\n return {\n status: \"error\",\n error: \"focus_uncommitted_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUncommittedGuide.toLowerCase()}.`,\n };\n }\n\n // This guide exists and is present in the response, but it is not queried\n // in the current page so it is impossible to force render this guide.\n if (!foundGuide.annotation.selectable.status) {\n return {\n status: \"error\",\n error: \"focus_unselectable_guide\",\n message: `Unable to display \\`${focusedGuideKey}\\`, ${FOCUS_ERRORS.focusUnselectableGuide.toLowerCase()}.`,\n };\n }\n }\n\n return {\n status: \"ok\",\n guides: orderedGuides,\n };\n};\n\nexport const isUncommittedGuide = (input: unknown): input is UncommittedGuide =>\n typeof input === \"object\" &&\n input !== null &&\n \"__typename\" in input &&\n (input as UncommittedGuide).__typename === \"UncommittedGuide\";\n"],"names":["byKey","items","reduce","acc","item","key","inferSelectByKeyReturnStatus","guide","snapshot","stage","query","includeThrottled","one","metadata","opts","all","bypass_global_group_limit","resolved","throttled","inferSelectOneByTypeReturnStatus","type","result","size","first","values","inferSelectAllByTypeReturnStatus","guides","guidesByKey","inferSelectReturnStatus","toSelectableStatus","status","undefined","results","Boolean","toIneligibilityStatus","marker","statuses","reason","targetable","message","steps","every","s","archived_at","archived","active","resolveIsEligible","resolveIsQualified","activatable","selectable","annotateGuide","orderIndex","ineligibleGuides","location","ineligiblity","checkActivatable","annotation","isEligible","isQualified","newUncommittedGuide","__typename","useInspectGuideClientStore","runConfig","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","queries","debugging","req","Object","entries","error","defaultGroup","groupStage","getStage","orderedGuides","display_sequence","map","guideKey","index","focusedGuideKey","keys","focusedGuideKeys","foundGuide","find","g","FOCUS_ERRORS","focusUnknownGuide","toLowerCase","isUncommittedGuide","focusUncommittedGuide","focusUnselectableGuide","input"],"mappings":"kLAcMA,EAAoCC,GACjCA,EAAMC,OAAO,CAACC,EAAKC,KAAU,CAAE,GAAGD,EAAK,CAACC,EAAKC,GAAG,EAAGD,CAAK,GAAI,CAAA,CAAE,EAyIjEE,EAA+BA,CACnCC,EACAC,EACAC,EACAC,IACsC,qBACtC,MAAMC,EACJ,CAAC,GAACD,GAAAA,GAAAA,GAAAA,EAAAA,EAAML,MAANK,YAAAA,EAAWE,MAAXF,YAAAA,EAAgBG,WAAhBH,YAAAA,EAA0BI,OAA1BJ,MAAAA,EAAgCC,mBAClC,CAAC,GAACD,GAAAA,GAAAA,GAAAA,EAAAA,EAAML,MAANK,YAAAA,EAAWK,MAAXL,YAAAA,EAAgBG,WAAhBH,YAAAA,EAA0BI,OAA1BJ,MAAAA,EAAgCC,kBAGpC,OAAIJ,EAAMS,0BACD,WAILT,EAAMF,MAAQI,EAAMQ,SAClBT,EAASU,WAAa,CAACP,EAClB,YAEF,WAMF,SACT,EAEMQ,EAAmCA,CACvCZ,EACAC,EACAC,EACAC,IACsC,aACtC,MAAMC,EAAmB,CAAC,GAACD,GAAAA,GAAAA,GAAAA,EAAAA,EAAMU,OAANV,YAAAA,EAAYE,MAAZF,YAAAA,EAAiBG,WAAjBH,YAAAA,EAA2BI,OAA3BJ,MAAAA,EAAiCC,kBAEtDU,EAASX,EAAMU,KAAMR,IACvBS,GAAAA,EAAOC,OAAS,EACX,MAAA,UAST,GAAIf,EAAMS,0BAA2B,CAE7BO,MAAAA,EADS,CAAC,GAAGF,EAAOG,QAAQ,EACb,CAAC,EAElBjB,OAAAA,EAAMF,MAAQkB,EAAMlB,IAEf,UAEF,UAAA,CAILE,OAAAA,EAAMF,MAAQI,EAAMQ,SAClBT,EAASU,WAAa,CAACP,EAClB,YAEF,WAMF,SACT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wC,MAAAA,EAAahB,EAAOiB,SAAS,EAI7BC,EAAgBH,EAAaI,iBAAiBC,IAAI,CAACC,EAAUC,IAAU,CACrE9E,MAAAA,EAAQC,EAASkB,OAAO0D,CAAQ,EACtC,OAAK7E,EAIE2C,EAAc3C,EAAO8E,EAAO7E,EAAUuE,CAAU,EAH9CpB,EAAoByB,EAAUC,CAAK,CAGW,CACxD,EAGKC,EAAkBX,OAAOY,KAAKzB,EAAU0B,kBAAoB,CAAA,CAAE,EAAE,CAAC,EACnET,IAAAA,GAAAA,YAAAA,EAAYjD,UAAW,UAAYwD,EAAiB,CACtD,MAAMG,EAAaR,EAAcS,KAAYC,GAAAA,EAAEtF,MAAQiF,CAAe,EAGtE,GAAI,CAACG,EACI,MAAA,CACL3D,OAAQ,QACR+C,MAAO,sBACPtC,QAAS,uBAAuB+C,CAAe,OAAOM,EAAAA,aAAaC,kBAAkBC,aAAa,GACpG,EAKEC,GAAAA,EAAmBN,CAAU,EACxB,MAAA,CACL3D,OAAQ,QACR+C,MAAO,0BACPtC,QAAS,uBAAuB+C,CAAe,OAAOM,EAAAA,aAAaI,sBAAsBF,aAAa,GACxG,EAKF,GAAI,CAACL,EAAWjC,WAAWP,WAAWnB,OAC7B,MAAA,CACLA,OAAQ,QACR+C,MAAO,2BACPtC,QAAS,uBAAuB+C,CAAe,OAAOM,EAAAA,aAAaK,uBAAuBH,aAAa,GACzG,CACF,CAGK,MAAA,CACLhE,OAAQ,KACRJ,OAAQuD,CACV,CACF,EAEac,EAAsBG,GACjC,OAAOA,GAAU,UACjBA,IAAU,MACV,eAAgBA,GACfA,EAA2BtC,aAAe"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@knocklabs/react-core"),n=require("react");require("../components/Banner/Banner.js");require("../components/Card/Card.js");const o=require("../components/Toolbar/V1/V1.js"),a=require("../components/Toolbar/V2/V2.js");require("../components/Modal/Modal.js");const i=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=i(n),l=({children:e,toolbar:r="v2",...u})=>t.default.createElement(c.KnockGuideProvider,{...u,trackDebugParams:r==="v1"},e,r==="v2"?t.default.createElement(a.V2,null):t.default.createElement(o.V1,null));exports.KnockGuideProvider=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@knocklabs/react-core"),o=require("react");require("../components/Banner/Banner.js");require("../components/Card/Card.js");const i=require("../components/Toolbar/V1/V1.js"),a=require("../components/Toolbar/V2/V2.js");require("../components/Modal/Modal.js");const l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=l(o),d=({children:e,toolbar:r="v2",readyToTarget:u,...c})=>t.default.createElement(n.KnockGuideProvider,{...c,readyToTarget:u,trackDebugParams:r==="v1"},e,r==="v2"?t.default.createElement(a.V2,{readyToTarget:u}):t.default.createElement(i.V1,null));exports.KnockGuideProvider=d;
2
2
  //# sourceMappingURL=KnockGuideProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KnockGuideProvider.js","sources":["../../../../../src/modules/guide/providers/KnockGuideProvider.tsx"],"sourcesContent":["import {\n KnockGuideProvider as KnockGuideProviderCore,\n type KnockGuideProviderProps,\n} from \"@knocklabs/react-core\";\nimport React from \"react\";\n\nimport { ToolbarV1, ToolbarV2 } from \"../components\";\n\ntype Props = KnockGuideProviderProps & {\n toolbar?: \"v1\" | \"v2\";\n};\n\n// Re-export the core KnockGuideProvider, so we can add React specific\n// functionality like the Toolbar component which shouldn't be included in other\n// contexts (e.g. React Native).\nexport const KnockGuideProvider: React.FC<React.PropsWithChildren<Props>> = ({\n children,\n toolbar = \"v2\",\n ...props\n}) => {\n return (\n <KnockGuideProviderCore\n {...props}\n // For backward compatibility with toolbar v1. Remove once v2 ships.\n trackDebugParams={toolbar === \"v1\"}\n >\n {children}\n {toolbar === \"v2\" ? <ToolbarV2 /> : <ToolbarV1 />}\n </KnockGuideProviderCore>\n );\n};\n"],"names":["KnockGuideProvider","children","toolbar","props","React","KnockGuideProviderCore","ToolbarV2","ToolbarV1"],"mappings":"uaAeaA,EAA+DA,CAAC,CAC3EC,SAAAA,EACAC,QAAAA,EAAU,KACV,GAAGC,CACL,IAEIC,EAAA,QAAA,cAACC,EAAA,mBAAA,CACC,GAAIF,EAEJ,iBAAkBD,IAAY,IAAA,EAE7BD,EACAC,IAAY,KAAOE,EAAA,QAAA,cAACE,EAAAA,GAAY,IAAA,0BAAIC,EAAAA,GAAY,IAAA,CACnD"}
1
+ {"version":3,"file":"KnockGuideProvider.js","sources":["../../../../../src/modules/guide/providers/KnockGuideProvider.tsx"],"sourcesContent":["import {\n KnockGuideProvider as KnockGuideProviderCore,\n type KnockGuideProviderProps,\n} from \"@knocklabs/react-core\";\nimport React from \"react\";\n\nimport { ToolbarV1, ToolbarV2 } from \"../components\";\n\ntype Props = KnockGuideProviderProps & {\n toolbar?: \"v1\" | \"v2\";\n};\n\n// Re-export the core KnockGuideProvider, so we can add React specific\n// functionality like the Toolbar component which shouldn't be included in other\n// contexts (e.g. React Native).\nexport const KnockGuideProvider: React.FC<React.PropsWithChildren<Props>> = ({\n children,\n toolbar = \"v2\",\n readyToTarget,\n ...props\n}) => {\n return (\n <KnockGuideProviderCore\n {...props}\n readyToTarget={readyToTarget}\n // For backward compatibility with toolbar v1. Remove once v2 ships.\n trackDebugParams={toolbar === \"v1\"}\n >\n {children}\n {toolbar === \"v2\" ? (\n <ToolbarV2 readyToTarget={readyToTarget} />\n ) : (\n <ToolbarV1 />\n )}\n </KnockGuideProviderCore>\n );\n};\n"],"names":["KnockGuideProvider","children","toolbar","readyToTarget","props","React","KnockGuideProviderCore","ToolbarV2","ToolbarV1"],"mappings":"uaAeaA,EAA+DA,CAAC,CAC3EC,SAAAA,EACAC,QAAAA,EAAU,KACVC,cAAAA,EACA,GAAGC,CACL,IAEIC,EAAA,QAAA,cAACC,EAAA,mBAAA,CACKF,GAAAA,EACJ,cAAAD,EAEA,iBAAkBD,IAAY,IAAA,EAE7BD,EACAC,IAAY,KACXG,UAAA,cAACE,MAAU,cAAAJ,4BAEVK,EACF,GAAA,IAAA,CACH"}