@knocklabs/react 0.11.10 → 0.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js.map +1 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
- package/dist/esm/index.mjs +98 -97
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs +79 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +29 -10
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +73 -101
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +35 -27
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +111 -101
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs +18 -13
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +106 -83
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts +9 -0
- package/dist/types/modules/guide/components/Toolbar/V2/FocusChin.d.ts.map +1 -0
- package/dist/types/modules/guide/components/Toolbar/V2/GuideContextDetails.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts +2 -2
- package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts +3 -2
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts +9 -2
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts +6 -0
- package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +10 -5
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
- package/package.json +6 -5
|
@@ -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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AY,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 { FOCUS_ERRORS } from \"./helpers\";\nimport {\n AnnotatedGuide,\n AnnotatedStatuses,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nexport const GUIDE_ROW_DATA_SELECTOR = \"data-kgt-guide-row-key\";\n\nconst Pill = ({\n label,\n color = \"gray\",\n children,\n}: {\n label: string;\n color?: StatusColor | \"disabled\";\n children: React.ReactNode;\n}) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n gap=\"0_5\"\n px=\"1\"\n height=\"5\"\n bg=\"surface-2\"\n rounded=\"full\"\n border=\"px\"\n borderColor=\"gray-4\"\n >\n <Text as=\"span\" size=\"0\" color={color} weight=\"medium\">\n {label}\n </Text>\n {children}\n </Stack>\n );\n};\n\nconst getStatusSummary = (\n guide: AnnotatedGuide | UncommittedGuide,\n): StatusSummary => {\n if (isUncommittedGuide(guide)) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide has never been committed and published yet\",\n };\n }\n\n const { annotation } = guide;\n\n if (!annotation.active.status) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide is inactive\",\n };\n }\n if (annotation.archived.status) {\n return {\n color: \"red\",\n label: \"Archived\",\n description: \"User has already dismissed this guide\",\n };\n }\n if (!annotation.targetable.status) {\n return {\n color: \"red\",\n label: \"Not targeted\",\n description: annotation.targetable.message,\n };\n }\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n // Prioritize an undefined selectable status ahead of activatable status.\n if (annotation.selectable.status === undefined) {\n return selectableStatusSummary;\n }\n\n if (!annotation.activatable.status) {\n return {\n color: \"red\",\n label: \"Not activated\",\n description: \"This guide cannot be activated in the current location\",\n };\n }\n\n return {\n ...selectableStatusSummary,\n\n // Shorten the label we display here for space.\n ...(annotation.selectable.status === \"returned\"\n ? { label: \"Display\" }\n : undefined),\n };\n};\n\ntype StatusDot = {\n color: StatusColor;\n tooltip?: string;\n};\n\nconst getStatusDots = (\n guide: AnnotatedGuide | UncommittedGuide,\n): Record<keyof AnnotatedStatuses, StatusDot> => {\n if (isUncommittedGuide(guide)) {\n return {\n active: { color: \"gray\" },\n archived: { color: \"gray\" },\n targetable: { color: \"gray\" },\n activatable: { color: \"gray\" },\n selectable: { color: \"gray\" },\n };\n }\n\n const { annotation } = guide;\n\n const active: StatusDot = {\n color: annotation.active.status ? \"blue\" : \"red\",\n tooltip: `Active: ${annotation.active.status ? \"Yes\" : \"No\"}`,\n };\n\n const archived: StatusDot = {\n color: annotation.archived.status ? \"red\" : \"blue\",\n tooltip: `Archived: ${annotation.archived.status ? \"Yes\" : \"No\"}`,\n };\n\n const targetable: StatusDot = {\n color: annotation.targetable.status ? \"blue\" : \"red\",\n tooltip: `Targeting: ${annotation.targetable.status ? \"Yes\" : \"No\"}`,\n };\n\n const activatable: StatusDot = {\n color: annotation.activatable.status ? \"blue\" : \"red\",\n tooltip: `Activated: ${annotation.activatable.status ? \"Yes\" : \"No\"}`,\n };\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n const selectable = {\n color: selectableStatusSummary.color,\n tooltip: selectableStatusSummary.label,\n };\n\n return { active, archived, targetable, activatable, selectable };\n};\n\ntype Props = {\n guide: UncommittedGuide | AnnotatedGuide;\n orderIndex: number;\n isExpanded: boolean;\n onClick: (guideKey: string) => void;\n};\n\nexport const GuideRow = ({ guide, orderIndex, isExpanded, onClick }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n const [isHovered, setIsHovered] = React.useState(false);\n\n const focusedGuideKeys = debugSettings.focusedGuideKeys || {};\n const hasFocus = Object.keys(focusedGuideKeys).length > 0;\n const isFocused = !!focusedGuideKeys[guide.key];\n\n const dots = getStatusDots(guide);\n const summary = getStatusSummary(guide);\n const dataAttrs = { [GUIDE_ROW_DATA_SELECTOR]: guide.key };\n\n return (\n <Box\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={isExpanded ? \"gray-6\" : \"transparent\"}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ cursor: \"pointer\" }}\n {...dataAttrs}\n >\n <Stack\n h=\"7\"\n px=\"1\"\n gap=\"1\"\n align=\"center\"\n justify=\"space-between\"\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={\n isExpanded\n ? \"transparent\"\n : isFocused\n ? \"gray-6\"\n : isHovered\n ? \"gray-4\"\n : \"transparent\"\n }\n backgroundColor={\n isExpanded\n ? \"surface-2\"\n : isFocused\n ? \"gray-2\"\n : isHovered\n ? \"surface-2\"\n : \"transparent\"\n }\n onClick={() => onClick(guide.key)}\n >\n {/* Left section: order + key */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack w=\"7\" justify=\"space-between\" align=\"center\" gap=\"0_5\">\n <Box w=\"3\">\n {!guide.bypass_global_group_limit && (\n <Icon\n icon={Gauge}\n size=\"0\"\n color=\"gray\"\n alt=\"Subject to throttling\"\n />\n )}\n </Box>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n style={{ flexShrink: 0 }}\n >\n {orderIndex + 1}\n </Text>\n </Stack>\n <Tooltip\n label={`${guide.key}${guide.bypass_global_group_limit ? \" (unthrottled)\" : \"\"}`}\n >\n <Text\n as=\"code\"\n size=\"1\"\n weight=\"medium\"\n color=\"default\"\n style={{\n display: \"block\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n maxWidth: \"200px\",\n }}\n >\n {guide.key}\n </Text>\n </Tooltip>\n </Stack>\n\n {/* Right section: verdict + pills + focus */}\n <Stack align=\"center\" gap=\"1_5\" style={{ flexShrink: 0 }}>\n {!hasFocus && (\n <Tooltip label={summary.description}>\n <Tag size=\"0\" variant=\"soft\" color={summary.color}>\n {summary.label}\n </Tag>\n </Tooltip>\n )}\n\n <Pill\n label=\"Elig:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isEligible\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.active.color}\n tooltip={dots.active.tooltip!}\n />\n <StatusDot\n color={dots.archived.color}\n tooltip={dots.archived.tooltip!}\n />\n <StatusDot\n color={dots.targetable.color}\n tooltip={dots.targetable.tooltip!}\n />\n </Pill>\n <Pill\n label=\"Vis:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isQualified &&\n guide.annotation.selectable.status === \"returned\"\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.activatable.color}\n tooltip={dots.activatable.tooltip!}\n />\n <StatusDot\n color={dots.selectable.color}\n tooltip={dots.selectable.tooltip!}\n />\n </Pill>\n\n <Tooltip\n label={\n isUncommittedGuide(guide)\n ? FOCUS_ERRORS.focusUncommittedGuide\n : guide.annotation.selectable.status === undefined\n ? FOCUS_ERRORS.focusUnselectableGuide\n : \"\"\n }\n enabled={\n isUncommittedGuide(guide) ||\n guide.annotation.selectable.status === undefined\n }\n >\n <Button\n size=\"0\"\n variant={isFocused ? \"solid\" : \"outline\"}\n color={isFocused ? \"blue\" : \"gray\"}\n disabled={\n isUncommittedGuide(guide) ||\n guide.annotation.selectable.status === undefined\n }\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: isFocused ? {} : { [guide.key]: true },\n });\n }}\n >\n Focus\n </Button>\n </Tooltip>\n </Stack>\n </Stack>\n\n {isExpanded && <GuideRowDetails guide={guide} />}\n </Box>\n );\n};\n"],"names":["GUIDE_ROW_DATA_SELECTOR","Pill","label","color","children","React","Stack","Text","getStatusSummary","guide","isUncommittedGuide","description","annotation","active","status","archived","targetable","message","selectableStatusSummary","getSelectableStatusSummary","selectable","undefined","activatable","getStatusDots","tooltip","GuideRow","orderIndex","isExpanded","onClick","client","useGuideContext","debugSettings","useStore","store","state","debug","isHovered","setIsHovered","useState","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","dots","summary","dataAttrs","Box","cursor","minWidth","flex","bypass_global_group_limit","Icon","Gauge","flexShrink","Tooltip","display","overflow","textOverflow","whiteSpace","maxWidth","Tag","isEligible","StatusDot","isQualified","FOCUS_ERRORS","focusUncommittedGuide","focusUnselectableGuide","Button","e","stopPropagation","setDebug","GuideRowDetails"],"mappings":"8zBA2BaA,EAA0B,yBAEjCC,EAAOA,CAAC,CACZC,MAAAA,EACAC,M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,aAAaE,uBACb,GAER,QACE3D,EAAmBD,mBAAAA,CAAK,GACxBA,EAAMG,WAAWQ,WAAWN,SAAWO,MAGzC,EAAAhB,EAAA,cAACiE,UACC,KAAK,IACL,QAAS1B,EAAY,QAAU,UAC/B,MAAOA,EAAY,OAAS,OAC5B,SACElC,EAAAA,mBAAmBD,CAAK,GACxBA,EAAMG,WAAWQ,WAAWN,SAAWO,OAEzC,QAAUkD,GAAwB,CAChCA,EAAEC,gBAAgB,EAClB3C,EAAO4C,SAAS,CACd,GAAG1C,EACHQ,iBAAkBK,EAAY,GAAK,CAAE,CAACnC,EAAMoC,GAAG,EAAG,EAAA,CAAK,CACxD,CACH,CAAA,EAAE,OAGJ,CACF,CACF,CACF,EAEClB,GAActB,EAAA,cAACqE,EAAgB,gBAAA,CAAA,MAAAjE,CAAA,CAAgB,CAClD,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),i=require("@telegraph/layout"),c=require("@telegraph/tooltip"),s=require("@telegraph/typography"),p=require("./GuideAnnotatedStatusDot.js"),b=require("./helpers.js"),m=require("./useInspectGuideClientStore.js"),g=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},e=g(d),o=({title:t,children:a})=>e.default.createElement(i.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(s.Text,{as:"span",size:"0",color:"gray",weight:"medium"},t),e.default.createElement(i.Stack,{direction:"column",gap:"1",mt:"1"},a)),r=({label:t,value:a,color:l,tooltip:u})=>e.default.createElement(i.Stack,{align:"center",gap:"1"},e.default.createElement(c.Tooltip,{enabled:!!u,label:u,delayDuration:500},e.default.createElement(i.Stack,{as:"span",align:"center",gap:"1",display:"inline-flex"},e.default.createElement(p.GuideAnnotatedStatusDot,{color:l,tooltip:`${t}: ${a}`}),e.default.createElement(s.Text,{as:"span",size:"1",weight:"medium"},t,":"),e.default.createElement(s.Text,{as:"span",size:"1",weight:"medium",color:l},a)))),n=t=>{switch(t){case"returned":return{label:"Ready to display",color:"blue",description:"This guide is queried and ready to display"};case"throttled":return{label:"Throttled",color:"yellow",description:"This guide is queried and ready to display, but throttled currently"};case"queried":return{label:"Queued",color:"gray",description:"This guide is queried but is not ready to display"};default:return{label:"Not queried",color:"red",description:`This guide is not queried (${b.FOCUS_ERRORS.focusUnselectableGuide.toLowerCase()})`}}},f=({guide:t})=>{if(m.isUncommittedGuide(t))return e.default.createElement(i.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}=t,l=n(a.selectable.status);return e.default.createElement(i.Stack,{px:"3",py:"2",gap:"2",direction:"row",align:"flex-start"},e.default.createElement(o,{title:"Eligibility"},e.default.createElement(r,{label:"Active",value:a.active.status?"Yes":"No",color:a.active.status?"blue":"red",tooltip:"Eligible if the guide is currently active"}),e.default.createElement(r,{label:"Archived",value:a.archived.status?"Yes":"No",color:a.archived.status?"red":"blue",tooltip:"Eligible if the guide has not been dismissed/archived by the user already"}),e.default.createElement(r,{label:"Targeting",value:a.targetable.status?"Yes":"No",color:a.targetable.status?"blue":"red",tooltip:"Eligible if the user meets the guide's targeting conditions"})),e.default.createElement(o,{title:"Visibility"},e.default.createElement(r,{label:"Activation",value:a.activatable.status?"Yes":"No",color:a.activatable.status?"blue":"red",tooltip:"Visible when the user's current location matches the guide's activation rules"}),e.default.createElement(r,{label:"Display",value:l.label,color:l.color,tooltip:e.default.createElement(s.Text,{as:"span",size:"1"},"Visible when the guide is queried via `useGuide(s)` in the current page,",e.default.createElement("br",null),"and ready to display per its position in the display pipeline:",e.default.createElement("br",null),l.description)})))};exports.GuideRowDetails=f;exports.getSelectableStatusSummary=n;
|
|
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
|
|
1
|
+
{"version":3,"file":"GuideRowDetails.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRowDetails.tsx"],"sourcesContent":["import { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport { FOCUS_ERRORS } from \"./helpers\";\nimport {\n AnnotatedGuide,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst CardContainer = ({\n title,\n children,\n}: {\n title: string;\n children: React.ReactNode;\n}) => (\n <Stack\n direction=\"column\"\n justify=\"flex-start\"\n gap=\"1\"\n px=\"1_5\"\n py=\"1\"\n rounded=\"2\"\n bg=\"surface-1\"\n border=\"px\"\n borderColor=\"gray-4\"\n style={{ flex: 1 }}\n >\n <Text as=\"span\" size=\"0\" color=\"gray\" weight=\"medium\">\n {title}\n </Text>\n <Stack direction=\"column\" gap=\"1\" mt=\"1\">\n {children}\n </Stack>\n </Stack>\n);\n\nconst StatusRow = ({\n label,\n value,\n color,\n tooltip,\n}: {\n label: string;\n value: string;\n color: StatusColor;\n tooltip?: React.ReactNode;\n}) => {\n return (\n <Stack align=\"center\" gap=\"1\">\n <Tooltip enabled={!!tooltip} label={tooltip} delayDuration={500}>\n <Stack as=\"span\" align=\"center\" gap=\"1\" display=\"inline-flex\">\n <StatusDot color={color} tooltip={`${label}: ${value}`} />\n <Text as=\"span\" size=\"1\" weight=\"medium\">\n {label}:\n </Text>\n <Text as=\"span\" size=\"1\" weight=\"medium\" color={color}>\n {value}\n </Text>\n </Stack>\n </Tooltip>\n </Stack>\n );\n};\n\nexport type StatusSummary = {\n color: StatusColor;\n label: string;\n description: string;\n};\n\nexport const getSelectableStatusSummary = (\n status: \"returned\" | \"throttled\" | \"queried\" | undefined,\n): StatusSummary => {\n switch (status) {\n case \"returned\":\n return {\n label: \"Ready to display\",\n color: \"blue\",\n description: \"This guide is queried and ready to display\",\n };\n case \"throttled\":\n return {\n label: \"Throttled\",\n color: \"yellow\",\n description:\n \"This guide is queried and ready to display, but throttled currently\",\n };\n case \"queried\":\n return {\n label: \"Queued\",\n color: \"gray\",\n description: \"This guide is queried but is not ready to display\",\n };\n default:\n return {\n label: \"Not queried\",\n color: \"red\",\n description: `This guide is not queried (${FOCUS_ERRORS.focusUnselectableGuide.toLowerCase()})`,\n };\n }\n};\n\nexport const GuideRowDetails = ({\n guide,\n}: {\n guide: AnnotatedGuide | UncommittedGuide;\n}) => {\n if (isUncommittedGuide(guide)) {\n return (\n <Box px=\"3\" py=\"2\">\n <Text as=\"span\" size=\"1\" color=\"gray\">\n This guide has never been committed and published.\n </Text>\n </Box>\n );\n }\n\n const { annotation } = guide;\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n return (\n <Stack px=\"3\" py=\"2\" gap=\"2\" direction=\"row\" align=\"flex-start\">\n <CardContainer title=\"Eligibility\">\n <StatusRow\n label=\"Active\"\n value={annotation.active.status ? \"Yes\" : \"No\"}\n color={annotation.active.status ? \"blue\" : \"red\"}\n tooltip=\"Eligible if the guide is currently active\"\n />\n <StatusRow\n label=\"Archived\"\n value={annotation.archived.status ? \"Yes\" : \"No\"}\n color={annotation.archived.status ? \"red\" : \"blue\"}\n tooltip=\"Eligible if the guide has not been dismissed/archived by the user already\"\n />\n <StatusRow\n label=\"Targeting\"\n value={annotation.targetable.status ? \"Yes\" : \"No\"}\n color={annotation.targetable.status ? \"blue\" : \"red\"}\n tooltip=\"Eligible if the user meets the guide's targeting conditions\"\n />\n </CardContainer>\n\n <CardContainer title=\"Visibility\">\n <StatusRow\n label=\"Activation\"\n value={annotation.activatable.status ? \"Yes\" : \"No\"}\n color={annotation.activatable.status ? \"blue\" : \"red\"}\n tooltip=\"Visible when the user's current location matches the guide's activation rules\"\n />\n <StatusRow\n label=\"Display\"\n value={selectableStatusSummary.label}\n color={selectableStatusSummary.color}\n tooltip={\n <Text as=\"span\" size=\"1\">\n Visible when the guide is queried via `useGuide(s)` in the current\n page,\n <br />\n and ready to display per its position in the display pipeline:\n <br />\n {selectableStatusSummary.description}\n </Text>\n }\n />\n </CardContainer>\n </Stack>\n );\n};\n"],"names":["CardContainer","title","children","React","Stack","flex","Text","StatusRow","label","value","color","tooltip","Tooltip","StatusDot","getSelectableStatusSummary","status","description","FOCUS_ERRORS","focusUnselectableGuide","toLowerCase","GuideRowDetails","guide","isUncommittedGuide","Box","annotation","selectableStatusSummary","selectable","active","archived","targetable","activatable"],"mappings":"2XAeMA,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,EACAC,QAAAA,CAMF,IAEIR,EAAAA,QAAA,cAACC,EAAAA,MAAM,CAAA,MAAM,SAAS,IAAI,GACxB,EAAAD,EAAA,QAAA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,GAAG,IAAI,IAAI,IAAI,UAAU,MAAM,MAAM,YAAA,EAChDD,EAAA,QAAA,cAAAH,EAAA,CAAc,MAAM,aAAA,EAClBG,EAAA,QAAA,cAAAI,EAAA,CACC,MAAM,SACN,MAAOiB,EAAWG,OAAOZ,OAAS,MAAQ,KAC1C,MAAOS,EAAWG,OAAOZ,OAAS,OAAS,MAC3C,QAAQ,2CAAA,CAA2C,EAErDZ,EAAA,QAAA,cAACI,EACC,CAAA,MAAM,WACN,MAAOiB,EAAWI,SAASb,OAAS,MAAQ,KAC5C,MAAOS,EAAWI,SAASb,OAAS,MAAQ,OAC5C,QAAQ,2EAA2E,CAAA,EAEpFZ,EAAA,QAAA,cAAAI,EAAA,CACC,MAAM,YACN,MAAOiB,EAAWK,WAAWd,OAAS,MAAQ,KAC9C,MAAOS,EAAWK,WAAWd,OAAS,OAAS,MAC/C,QAAQ,6DAA6D,CAAA,CAEzE,EAEAZ,EAAAA,QAAA,cAACH,EAAc,CAAA,MAAM,YACnB,EAAAG,UAAA,cAACI,EACC,CAAA,MAAM,aACN,MAAOiB,EAAWM,YAAYf,OAAS,MAAQ,KAC/C,MAAOS,EAAWM,YAAYf,OAAS,OAAS,MAChD,QAAQ,+EAA+E,CAAA,EAExFZ,EAAAA,QAAA,cAAAI,EAAA,CACC,MAAM,UACN,MAAOkB,EAAwBjB,MAC/B,MAAOiB,EAAwBf,MAC/B,QACEP,EAAAA,QAAA,cAACG,EAAAA,KAAK,CAAA,GAAG,OAAO,KAAK,GAAG,EAAA,2EAGrBH,EAAAA,QAAA,cAAA,KAAA,IAAE,EAAA,iEAEFA,EAAAA,QAAA,cAAA,KAAA,IAAE,EACFsB,EAAwBT,WAC3B,CACD,CAAA,CAEL,CACF,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("@knocklabs/react-core"),h=require("@telegraph/button"),_=require("@telegraph/icon"),a=require("@telegraph/layout"),f=require("@telegraph/segmented-control"),k=require("@telegraph/tooltip"),w=require("@telegraph/typography"),c=require("lucide-react"),T=require("react"),K=require("../KnockButton.js"),L=require("../shared.js");;/* empty css */const A=require("./FocusChin.js"),H=require("./GuideContextDetails.js"),V=require("./GuideRow.js"),R=require("./helpers.js"),j=require("./useDraggable.js"),F=require("./useInspectGuideClientStore.js"),M=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},e=M(T),N=".",W="540px",G=({children:n})=>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)"}},n),q=(n,r)=>n.filter(s=>{const{isEligible:l,isQualified:g}=s.annotation;return!(r==="only-displayable"&&!(l&&g)||r==="only-eligible"&&!l||r==="only-active"&&!s.annotation.active.status)}),Q=()=>{const{client:n}=P.useGuideContext(),[r,s]=e.default.useState("only-active"),[l,g]=e.default.useState(()=>R.getRunConfig()),[p,m]=e.default.useState(!1),[d,O]=e.default.useState(!1),[B,C]=e.default.useState();e.default.useEffect(()=>{C(void 0)},[r]),e.default.useEffect(()=>{var E;const{isVisible:t=!1,focusedGuideKeys:o={}}=l||{},u=(E=n.store.state.debug)==null?void 0:E.debugging;return t&&!u&&(n.setDebug({focusedGuideKeys:o}),Object.keys(o).length>0&&s("all-guides")),()=>{n.unsetDebug()}},[l,n,s]),e.default.useEffect(()=>{const t=o=>{o.ctrlKey&&o.key===N&&!o.repeat&&(o.preventDefault(),m(u=>!u))};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[]);const S=e.default.useRef(null),D=e.default.useRef(null),{position:v,isDragging:b,handlePointerDown:y,hasDraggedRef:I}=j.useDraggable({elementRef:S,reclampDeps:[p],initialPosition:{top:16,right:16}}),i=F.useInspectGuideClientStore(l);if(!i||!(l!=null&&l.isVisible))return null;const x=i.status==="ok"?q(i.guides,r):[];return e.default.createElement(a.Box,{tgphRef:S,position:"fixed",style:{top:v.top+"px",right:v.right+"px",zIndex:L.TOOLBAR_Z_INDEX}},p?e.default.createElement(k.Tooltip,{side:"left",delayDuration:500,label:e.default.createElement(w.Text,{as:"span",size:"1"},"Guide Toolbar",e.default.createElement(a.Stack,{display:"inline-block",ml:"3"},e.default.createElement(G,null,"ctrl")," + ",e.default.createElement(G,null,".")))},e.default.createElement(a.Stack,{border:"px",rounded:"4",align:"center",justify:"center",w:"10",h:"10",onPointerDown:y,backgroundColor:"surface-1",style:{cursor:b?"grabbing":"grab",touchAction:"none",userSelect:"none",animation:"toolbar-collapse-fade-in 150ms ease-out"}},e.default.createElement(a.Box,{style:{transform:"scale(0.7)",transformOrigin:"center center"}},e.default.createElement(K.KnockButton,{onClick:()=>{I.current||m(!1)},positioned:!1})))):e.default.createElement(a.Stack,{direction:"column",backgroundColor:"surface-1",rounded:"4",border:"px",overflow:"hidden",style:{width:W,boxShadow:"0 8px 32px var(--tgph-gray-5)",animation:"toolbar-expand-fade-in 150ms ease-out"}},e.default.createElement(a.Stack,{w:"full",p:"2",justify:"space-between",direction:"row",align:"center",gap:"2",borderBottom:"px",onPointerDown:y,style:{boxSizing:"border-box",cursor:b?"grabbing":"grab",touchAction:"none",userSelect:"none"}},e.default.createElement(a.Stack,{align:"center",gap:"1_5",style:{minWidth:0,flex:1}},e.default.createElement(a.Stack,{display:"inline-flex",align:"center",style:{cursor:b?"grabbing":"grab",touchAction:"none",userSelect:"none"},onPointerDown:t=>{t.stopPropagation(),y(t)}},e.default.createElement(_.Icon,{color:"gray",size:"1",icon:c.GripVertical,"aria-hidden":!0})),e.default.createElement(a.Stack,{align:"center",gap:"1_5",onPointerDown:t=>t.stopPropagation()},e.default.createElement(f.SegmentedControl.Root,{size:"1",type:"single",value:r,onValueChange:t=>{if(!t)return;const o=n.store.state.debug,u=Object.keys((o==null?void 0:o.focusedGuideKeys)||{});i.status==="ok"&&u.length>0&&(q(i.guides,t).find(z=>z.key===u[0])||n.setDebug({...o,focusedGuideKeys:{}})),s(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(k.Tooltip,{label:"Settings & target params"},e.default.createElement(h.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:()=>O(t=>!t)})))),e.default.createElement(a.Stack,{align:"center",gap:"1_5",style:{flexShrink:0},onPointerDown:t=>t.stopPropagation()},e.default.createElement(a.Stack,{align:"center",gap:"1_5"},e.default.createElement(h.Button,{size:"1",variant:"outline",leadingIcon:{icon:c.LogOut,alt:"Exit"},onClick:()=>{g(t=>({...t,isVisible:!1})),R.clearRunConfigLS(),n.unsetDebug()}},"Exit"),e.default.createElement(k.Tooltip,{label:"Minimize toolbar"},e.default.createElement(h.Button,{size:"1",variant:"outline",leadingIcon:{icon:c.Minimize2,alt:"Minimize"},onClick:()=>m(!0)}))))),d&&e.default.createElement(a.Box,{borderBottom:"px"},e.default.createElement(H.GuideContextDetails,null)),e.default.createElement(a.Box,{tgphRef:D,p:"1",overflow:"auto",style:{maxHeight:"calc(80vh - 96px)"}},i.status==="error"?e.default.createElement(a.Box,{px:"2",pb:"1",style:{lineHeight:"1.2"}},e.default.createElement(w.Text,{as:"span",size:"1",weight:"medium",color:i.error==="no_guides_fetched"?"default":"red"},i.message)):x.length===0?e.default.createElement(a.Box,{px:"2",pb:"1",style:{lineHeight:"1.2"}},e.default.createElement(w.Text,{as:"span",size:"1",weight:"medium",color:"default"},"No guides match the current filter.")):x.map(t=>e.default.createElement(V.GuideRow,{key:t.key,guide:t,orderIndex:t.orderIndex,isExpanded:t.key===B,onClick:()=>{C(o=>o&&o===t.key?void 0:t.key)}}))),e.default.createElement(A.FocusChin,{guides:x,guideListRef:D})))};exports.V2=Q;
|
|
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","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AA,OAAQR,IAAK,MAAO,EACzC,QAAS,IAAM,CACb7D,EAAwBsE,IAAA,CAAE,GAAGA,EAAM3D,UAAW,EAAA,EAAQ,EACrC4D,mBAAA,EACjB3E,EAAOuB,WAAW,CAAA,CAClB,EAAA,MAGJ,EACArC,EAAA,QAAA,cAAC0E,EAAQ,QAAA,CAAA,MAAM,kBACb,EAAA1E,EAAAA,QAAA,cAAC2E,EAAAA,OACC,CAAA,KAAK,IACL,QAAQ,UACR,YAAa,CAAEE,KAAMa,EAAAA,UAAWX,IAAK,UAAW,EAChD,QAAS,IAAM1D,EAAe,EAAI,CAAE,CAAA,CAExC,CACF,CACF,CACF,EAGCC,GACCtB,EAAA,QAAA,cAACoD,OAAI,aAAa,MACfpD,EAAAA,QAAA,cAAA2F,EAAAA,oBAAA,IAAmB,CACtB,EAID3F,EAAAA,QAAA,cAAAoD,EAAA,IAAA,CAAI,EAAE,IAAI,SAAS,OAAO,MAAO,CAAEwC,UAAW,mBAAA,GAC5C1C,EAAO2C,SAAW,QACjB7F,EAAA,QAAA,cAACoD,EAAAA,KAAI,GAAG,IAAI,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 { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { SegmentedControl } from \"@telegraph/segmented-control\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport {\n ChevronDown,\n ChevronRight,\n GripVertical,\n LogOut,\n Minimize2,\n SlidersHorizontal,\n} from \"lucide-react\";\nimport React from \"react\";\n\nimport { KnockButton } from \"../KnockButton\";\nimport { TOOLBAR_Z_INDEX } from \"../shared\";\nimport \"../styles.css\";\n\nimport { FocusChin } from \"./FocusChin\";\nimport { GuideContextDetails } from \"./GuideContextDetails\";\nimport { GuideRow } from \"./GuideRow\";\nimport { DisplayOption, clearRunConfigLS, getRunConfig } from \"./helpers\";\nimport { useDraggable } from \"./useDraggable\";\nimport {\n InspectionResultOk,\n useInspectGuideClientStore,\n} from \"./useInspectGuideClientStore\";\n\nconst TOGGLE_COLLAPSED_HOTKEY = \".\";\n\nconst TOOLBAR_WIDTH = \"540px\";\n\nconst Kbd = ({ children }: { children: React.ReactNode }) => {\n return (\n <kbd\n style={{\n display: \"inline-block\",\n padding: \"1px 4px\",\n borderRadius: \"var(--tgph-rounded-2)\",\n border: \"1px solid rgba(255, 255, 255, 0.3)\",\n backgroundColor: \"rgba(255, 255, 255, 0.15)\",\n }}\n >\n {children}\n </kbd>\n );\n};\n\nconst filterGuides = (\n guides: InspectionResultOk[\"guides\"],\n displayOption: DisplayOption,\n) => {\n return guides.filter((guide) => {\n const { isEligible, isQualified } = guide.annotation;\n const isDisplayable = isEligible && isQualified;\n\n if (displayOption === \"only-displayable\" && !isDisplayable) {\n return false;\n }\n if (displayOption === \"only-eligible\" && !isEligible) {\n return false;\n }\n if (displayOption === \"only-active\" && !guide.annotation.active.status) {\n return false;\n }\n return true;\n });\n};\n\nexport const V2 = () => {\n const { client } = useGuideContext();\n\n const [displayOption, setDisplayOption] =\n React.useState<DisplayOption>(\"only-active\");\n const [runConfig, setRunConfig] = React.useState(() => getRunConfig());\n const [isCollapsed, setIsCollapsed] = React.useState(false);\n const [isContextPanelOpen, setIsContextPanelOpen] = React.useState(false);\n\n const [expandedGuideRowKey, setExpandedGuideRowKey] = React.useState<\n string | undefined\n >();\n\n React.useEffect(() => {\n setExpandedGuideRowKey(undefined);\n }, [displayOption]);\n\n React.useEffect(() => {\n const { isVisible = false, focusedGuideKeys = {} } = runConfig || {};\n const isDebugging = client.store.state.debug?.debugging;\n if (isVisible && !isDebugging) {\n client.setDebug({ focusedGuideKeys });\n\n // If focused, switch to all guides so you can see in the list.\n if (Object.keys(focusedGuideKeys).length > 0) {\n setDisplayOption(\"all-guides\");\n }\n }\n\n return () => {\n client.unsetDebug();\n };\n }, [runConfig, client, setDisplayOption]);\n\n // Toggle collapsed state with Ctrl + .\n React.useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.ctrlKey && e.key === TOGGLE_COLLAPSED_HOTKEY && !e.repeat) {\n e.preventDefault();\n setIsCollapsed((prev) => !prev);\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, []);\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const guideListRef = React.useRef<HTMLDivElement>(null);\n const { position, isDragging, handlePointerDown, hasDraggedRef } =\n useDraggable({\n elementRef: containerRef,\n reclampDeps: [isCollapsed],\n initialPosition: { top: 16, right: 16 },\n });\n\n const result = useInspectGuideClientStore(runConfig);\n if (!result || !runConfig?.isVisible) {\n return null;\n }\n\n const guides =\n result.status === \"ok\" ? filterGuides(result.guides, displayOption) : [];\n\n return (\n <Box\n tgphRef={containerRef}\n position=\"fixed\"\n style={{\n top: position.top + \"px\",\n right: position.right + \"px\",\n zIndex: TOOLBAR_Z_INDEX,\n }}\n >\n {isCollapsed ? (\n <Tooltip\n side=\"left\"\n delayDuration={500}\n label={\n <Text as=\"span\" size=\"1\">\n Guide Toolbar\n <Stack display=\"inline-block\" ml=\"3\">\n <Kbd>ctrl</Kbd> + <Kbd>.</Kbd>\n </Stack>\n </Text>\n }\n >\n <Stack\n border=\"px\"\n rounded=\"4\"\n align=\"center\"\n justify=\"center\"\n w=\"10\"\n h=\"10\"\n onPointerDown={handlePointerDown}\n backgroundColor=\"surface-1\"\n style={{\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n animation: \"toolbar-collapse-fade-in 150ms ease-out\",\n }}\n >\n <Box\n style={{\n transform: \"scale(0.7)\",\n transformOrigin: \"center center\",\n }}\n >\n <KnockButton\n onClick={() => {\n if (!hasDraggedRef.current) {\n setIsCollapsed(false);\n }\n }}\n positioned={false}\n />\n </Box>\n </Stack>\n </Tooltip>\n ) : (\n <Stack\n direction=\"column\"\n backgroundColor=\"surface-1\"\n rounded=\"4\"\n border=\"px\"\n overflow=\"hidden\"\n style={{\n width: TOOLBAR_WIDTH,\n boxShadow: \"0 8px 32px var(--tgph-gray-5)\",\n animation: \"toolbar-expand-fade-in 150ms ease-out\",\n }}\n >\n {/* Header — also acts as drag handle area */}\n <Stack\n w=\"full\"\n p=\"2\"\n justify=\"space-between\"\n direction=\"row\"\n align=\"center\"\n gap=\"2\"\n borderBottom=\"px\"\n onPointerDown={handlePointerDown}\n style={{\n boxSizing: \"border-box\",\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n >\n {/* Left: drag icon + segmented control + settings */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack\n display=\"inline-flex\"\n align=\"center\"\n style={{\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n onPointerDown={(e: React.PointerEvent) => {\n // Already handled by parent, prevent double-fire\n e.stopPropagation();\n handlePointerDown(e);\n }}\n >\n <Icon color=\"gray\" size=\"1\" icon={GripVertical} aria-hidden />\n </Stack>\n <Stack\n align=\"center\"\n gap=\"1_5\"\n onPointerDown={(e: React.PointerEvent) => e.stopPropagation()}\n >\n <SegmentedControl.Root\n size=\"1\"\n type=\"single\"\n value={displayOption}\n onValueChange={(val: DisplayOption) => {\n if (!val) return;\n\n const debugSettings = client.store.state.debug;\n\n const focusedGuideKeys = Object.keys(\n debugSettings?.focusedGuideKeys || {},\n );\n\n // Exit out of focus if the currently focused guide is not\n // part of the selected list filter.\n if (result.status === \"ok\" && focusedGuideKeys.length > 0) {\n const currFocusedGuide = filterGuides(\n result.guides,\n val,\n ).find((g) => g.key === focusedGuideKeys[0]);\n\n if (!currFocusedGuide) {\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: {},\n });\n }\n }\n\n setDisplayOption(val);\n }}\n >\n <SegmentedControl.Option\n value=\"all-guides\"\n style={{ width: \"54px\" }}\n >\n All\n </SegmentedControl.Option>\n <SegmentedControl.Option\n value=\"only-active\"\n style={{ width: \"54px\" }}\n >\n Active\n </SegmentedControl.Option>\n <SegmentedControl.Option\n value=\"only-eligible\"\n style={{ width: \"54px\" }}\n >\n Eligible\n </SegmentedControl.Option>\n {/* Note: `only-displayable` is not available for now */}\n </SegmentedControl.Root>\n\n <Tooltip label=\"Settings & target params\">\n <Button\n size=\"1\"\n variant={isContextPanelOpen ? \"outline\" : \"ghost\"}\n color={isContextPanelOpen ? \"blue\" : \"gray\"}\n leadingIcon={{\n icon: SlidersHorizontal,\n alt: \"Inspect target params\",\n }}\n trailingIcon={\n isContextPanelOpen\n ? { icon: ChevronDown, alt: \"Hide context data\" }\n : { icon: ChevronRight, alt: \"Show context data\" }\n }\n onClick={() => setIsContextPanelOpen((v) => !v)}\n />\n </Tooltip>\n </Stack>\n </Stack>\n\n {/* Right: exit + minimize buttons */}\n <Stack\n align=\"center\"\n gap=\"1_5\"\n style={{ flexShrink: 0 }}\n onPointerDown={(e: React.PointerEvent) => e.stopPropagation()}\n >\n <Stack align=\"center\" gap=\"1_5\">\n <Button\n size=\"1\"\n variant=\"outline\"\n leadingIcon={{ icon: LogOut, alt: \"Exit\" }}\n onClick={() => {\n setRunConfig((curr) => ({ ...curr, isVisible: false }));\n clearRunConfigLS();\n client.unsetDebug();\n }}\n >\n Exit\n </Button>\n <Tooltip label=\"Minimize toolbar\">\n <Button\n size=\"1\"\n variant=\"outline\"\n leadingIcon={{ icon: Minimize2, alt: \"Minimize\" }}\n onClick={() => setIsCollapsed(true)}\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Stack>\n\n {/* Collapsible panel to show context data */}\n {isContextPanelOpen && (\n <Box borderBottom=\"px\">\n <GuideContextDetails />\n </Box>\n )}\n\n {/* Guide list content area */}\n <Box\n tgphRef={guideListRef}\n p=\"1\"\n overflow=\"auto\"\n style={{ maxHeight: \"calc(80vh - 96px)\" }}\n >\n {result.status === \"error\" ? (\n <Box px=\"2\" pb=\"1\" style={{ lineHeight: \"1.2\" }}>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={\n result.error === \"no_guides_fetched\" ? \"default\" : \"red\"\n }\n >\n {result.message}\n </Text>\n </Box>\n ) : guides.length === 0 ? (\n <Box px=\"2\" pb=\"1\" style={{ lineHeight: \"1.2\" }}>\n <Text as=\"span\" size=\"1\" weight=\"medium\" color=\"default\">\n No guides match the current filter.\n </Text>\n </Box>\n ) : (\n guides.map((guide) => (\n <GuideRow\n key={guide.key}\n guide={guide}\n orderIndex={guide.orderIndex}\n isExpanded={guide.key === expandedGuideRowKey}\n onClick={() => {\n setExpandedGuideRowKey((k) =>\n k && k === guide.key ? undefined : guide.key,\n );\n }}\n />\n ))\n )}\n </Box>\n\n {/* Focus chin with dedicated controls */}\n <FocusChin guides={guides} guideListRef={guideListRef} />\n </Stack>\n )}\n </Box>\n );\n};\n"],"names":["TOGGLE_COLLAPSED_HOTKEY","TOOLBAR_WIDTH","Kbd","children","React","display","padding","borderRadius","border","backgroundColor","filterGuides","guides","displayOption","filter","guide","isEligible","isQualified","annotation","active","status","V2","client","useGuideContext","setDisplayOption","useState","runConfig","setRunConfig","getRunConfig","isCollapsed","setIsCollapsed","isContextPanelOpen","setIsContextPanelOpen","expandedGuideRowKey","setExpandedGuideRowKey","useEffect","undefined","isVisible","focusedGuideKeys","isDebugging","store","state","debug","debugging","setDebug","Object","keys","length","unsetDebug","handleKeyDown","e","ctrlKey","key","repeat","preventDefault","prev","addEventListener","removeEventListener","containerRef","useRef","guideListRef","position","isDragging","handlePointerDown","hasDraggedRef","useDraggable","elementRef","reclampDeps","initialPosition","top","right","result","useInspectGuideClientStore","Box","zIndex","TOOLBAR_Z_INDEX","Tooltip","Text","Stack","cursor","touchAction","userSelect","animation","transform","transformOrigin","KnockButton","current","width","boxShadow","boxSizing","minWidth","flex","stopPropagation","Icon","GripVertical","SegmentedControl","val","debugSettings","find","g","Button","icon","SlidersHorizontal","alt","ChevronDown","ChevronRight","v","flexShrink","LogOut","curr","clearRunConfigLS","Minimize2","GuideContextDetails","maxHeight","lineHeight","error","message","map","GuideRow","orderIndex","k","FocusChin"],"mappings":"2sBA+BMA,EAA0B,IAE1BC,EAAgB,QAEhBC,EAAMA,CAAC,CAAEC,SAAAA,CAAwC,IAEnDC,UAAA,cAAC,OACC,MAAO,CACLC,QAAS,eACTC,QAAS,UACTC,aAAc,wBACdC,OAAQ,qCACRC,gBAAiB,8BAGlBN,CACH,EAIEO,EAAeA,CACnBC,EACAC,IAEOD,EAAOE,OAAkBC,GAAA,CACxB,KAAA,CAAEC,WAAAA,EAAYC,YAAAA,GAAgBF,EAAMG,WAS1C,MANIL,EAAAA,IAAkB,oBAAsB,EAFtBG,GAAcC,IAKhCJ,IAAkB,iBAAmB,CAACG,GAGtCH,IAAkB,eAAiB,CAACE,EAAMG,WAAWC,OAAOC,OAGzD,CACR,EAGUC,EAAKA,IAAM,CAChB,KAAA,CAAEC,OAAAA,GAAWC,kBAAgB,EAE7B,CAACV,EAAeW,CAAgB,EACpCnB,EAAAA,QAAMoB,SAAwB,aAAa,EACvC,CAACC,EAAWC,CAAY,EAAItB,UAAMoB,SAAS,IAAMG,EAAAA,cAAc,EAC/D,CAACC,EAAaC,CAAc,EAAIzB,EAAAA,QAAMoB,SAAS,EAAK,EACpD,CAACM,EAAoBC,CAAqB,EAAI3B,EAAAA,QAAMoB,SAAS,EAAK,EAElE,CAACQ,EAAqBC,CAA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AAe,EAAI,CAAA,CAAE,CAExC,CACF,CACF,CACF,EAGCC,GACE1B,EAAA,QAAA,cAAAoE,EAAA,IAAA,CAAI,aAAa,IAAA,EACfpE,EAAA,QAAA,cAAA2G,EAAA,oBAAA,IAAmB,CACtB,EAID3G,EAAA,QAAA,cAAAoE,EAAA,IAAA,CACC,QAASb,EACT,EAAE,IACF,SAAS,OACT,MAAO,CAAEqD,UAAW,mBAAoB,CAAA,EAEvC1C,EAAOnD,SAAW,QACjBf,EAAA,QAAA,cAACoE,OAAI,GAAG,IAAI,GAAG,IAAI,MAAO,CAAEyC,WAAY,KAAA,CACtC,EAAA7G,EAAA,QAAA,cAACwE,EACC,KAAA,CAAA,GAAG,OACH,KAAK,IACL,OAAO,SACP,MACEN,EAAO4C,QAAU,oBAAsB,UAAY,KAGpD5C,EAAAA,EAAO6C,OACV,CACF,EACExG,EAAOmC,SAAW,EACnB1C,EAAAA,QAAA,cAAAoE,EAAAA,IAAA,CAAI,GAAG,IAAI,GAAG,IAAI,MAAO,CAAEyC,WAAY,KAAA,CACtC,EAAA7G,EAAA,QAAA,cAACwE,EAAAA,KAAK,CAAA,GAAG,OAAO,KAAK,IAAI,OAAO,SAAS,MAAM,SAAS,EAAA,qCAExD,CACF,EAEAjE,EAAOyG,IAAKtG,GACTV,EAAAA,QAAA,cAAAiH,EAAA,SAAA,CACC,IAAKvG,EAAMqC,IACX,MAAArC,EACA,WAAYA,EAAMwG,WAClB,WAAYxG,EAAMqC,MAAQnB,EAC1B,QAAS,IAAM,CACbC,KACEsF,GAAKA,IAAMzG,EAAMqC,IAAMhB,OAAYrB,EAAMqC,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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@knocklabs/react-core");require("react");;/* empty css */require("lodash.debounce");const t=require("../../../../core/utils.js"),u="knock_guide_toolbar",a="focused_guide_key",r="knock_guide_debug",l=()=>{const e={isVisible:!1},o=t.checkForWindow();if(!o||!o.location)return e;const c=new URLSearchParams(o.location.search),i=c.get(u),s=c.get(a);if(i!==null){const n={isVisible:i==="true"};return s&&(n.focusedGuideKeys={[s]:!0}),g(n),n}return d()||e},g=e=>{const o=t.checkForWindow();if(!(!o||!o.localStorage))try{o.localStorage.setItem(r,JSON.stringify(e))}catch{}},d=()=>{const e=t.checkForWindow();if(!(!e||!e.localStorage))try{const o=e.localStorage.getItem(r);if(o)return JSON.parse(o)}catch{}},f=()=>{const e=t.checkForWindow();if(!(!e||!e.localStorage))try{e.localStorage.removeItem(r)}catch{}},S={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=S;exports.clearRunConfigLS=f;exports.getRunConfig=l;
|
|
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":"
|
|
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\nexport type DisplayOption =\n | \"all-guides\"\n | \"only-active\"\n | \"only-eligible\"\n | \"only-displayable\";\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\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":["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","FOCUS_ERRORS","focusUnknownGuide","focusUncommittedGuide","focusUnselectableGuide"],"mappings":"sQAYMA,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,EAEa0B,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"),
|
|
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,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,0BAA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C,MAAAA,EAAerE,EAAS4D,YAAY,CAAC,EAC3C,GAAI,CAACS,EACI,MAAA,CACL/C,OAAQ,QACR8C,MAAO,iBACPrC,QAAS,sBACX,EAGIuC,MAAAA,EAAahB,EAAOiB,SAAS,EAI7BC,EAAgBH,EAAaI,iBAAiBC,IAAkBC,GAAA,CAC9D5E,MAAAA,EAAQC,EAASkB,OAAOyD,CAAQ,EACtC,OAAK5E,EAIE2C,EAAc3C,EAAOC,EAAUsE,CAAU,EAHvCpB,EAAgByB,CAAQ,CAGe,CACjD,EAGKC,EAAkBV,OAAOW,KAAKxB,EAAUyB,kBAAoB,CAAA,CAAE,EAAE,CAAC,EACnER,OAAAA,GAAAA,YAAAA,EAAYhD,UAAW,UAAYsD,GAIjC,CAHmBJ,EAAcO,KAC5BC,GAAAA,EAAEnF,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 checkActivatable,\n checkStateIfThrottled,\n} from \"@knocklabs/client\";\nimport { useGuideContext, useStore } from \"@knocklabs/react-core\";\n\nimport { FOCUS_ERRORS, 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 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":"kLAaMA,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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