@knocklabs/react 0.11.5 → 0.11.7
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 +16 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.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 +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js.map +1 -0
- 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/useDraggable.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.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 -99
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs +18 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +15 -29
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +167 -49
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +51 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +132 -59
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs +42 -5
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs +35 -32
- package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +89 -75
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.d.ts +6 -0
- package/dist/types/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.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/GuideRow.d.ts +3 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts +5 -0
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRowDetails.d.ts.map +1 -0
- 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 +7 -1
- package/dist/types/modules/guide/components/Toolbar/V2/helpers.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts +2 -0
- package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +11 -4
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js +0 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js.map +0 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js +0 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js.map +0 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.js +0 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.js.map +0 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs +0 -20
- package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs.map +0 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs +0 -57
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs.map +0 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.mjs +0 -17
- package/dist/esm/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.mjs.map +0 -1
- package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts +0 -9
- package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts.map +0 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.d.ts +0 -8
- package/dist/types/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInspectGuideClientStore.mjs","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\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\ntype 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 InspectionResult = {\n guides: (AnnotatedGuide | UnknownGuide)[];\n error?: \"no_guide_group\";\n};\n\ntype StoreStateSnapshot = Pick<\n KnockGuideClientStoreState,\n | \"location\"\n | \"guides\"\n | \"guideGroups\"\n | \"ineligibleGuides\"\n | \"debug\"\n | \"counter\"\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 = (): 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 throttled,\n };\n });\n\n // Not in debugging session, so noop.\n if (!snapshot.debug?.debugging) {\n return undefined;\n }\n\n // Only for completeness, as there should always be a default group so this\n // should never happen.\n const defaultGroup = snapshot.guideGroups[0];\n if (!defaultGroup) {\n return {\n error: \"no_guide_group\",\n guides: [],\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 return {\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","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","debugging","defaultGroup","error","groupStage","getStage","display_sequence","map","guideKey","isUnknownGuide","input"],"mappings":";;AAWA,MAAMA,IAAQ,CAA4BC,MACjCA,EAAMC,OAAO,CAACC,GAAKC,OAAU;AAAA,EAAE,GAAGD;AAAAA,EAAK,CAACC,EAAKC,GAAG,GAAGD;AAAK,IAAI,CAAA,CAAE,GAwHjEE,IAA+BA,CACnCC,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IACJ,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QAANK,gBAAAA,EAAWE,QAAXF,gBAAAA,EAAgBG,aAAhBH,gBAAAA,EAA0BI,SAA1BJ,QAAAA,EAAgCC,qBAClC,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QA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AAOA,KAAU,YACjBA,MAAU,QACV,gBAAgBA,KACfA,EAAuBpB,eAAe;"}
|
|
1
|
+
{"version":3,"file":"useInspectGuideClientStore.mjs","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":";;AAaA,MAAMA,IAAQ,CAA4BC,MACjCA,EAAMC,OAAO,CAACC,GAAKC,OAAU;AAAA,EAAE,GAAGD;AAAAA,EAAK,CAACC,EAAKC,GAAG,GAAGD;AAAK,IAAI,CAAA,CAAE,GA+HjEE,IAA+BA,CACnCC,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IACJ,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QAANK,gBAAAA,EAAWE,QAAXF,gBAAAA,EAAgBG,aAAhBH,gBAAAA,EAA0BI,SAA1BJ,QAAAA,EAAgCC,qBAClC,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAML,QAANK,gBAAAA,EAAWK,QAAXL,gBAAAA,EAAgBG,aAAhBH,gBAAAA,EAA0BI,SAA1BJ,QAAAA,EAAgCC;AAGpC,SAAIJ,EAAMS,4BACD,aAILT,EAAMF,QAAQI,EAAMQ,WAClBT,EAASU,aAAa,CAACP,IAClB,cAEF,aAMF;AACT,GAEMQ,IAAmCA,CACvCZ,GACAC,GACAC,GACAC,MACsC;;AACtC,QAAMC,IAAmB,CAAC,GAACD,KAAAA,KAAAA,KAAAA,IAAAA,EAAM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J,EAAcO,KAClCC,CAAMA,MAAAA,EAAEnF,QAAQ+E,KAAmBI,EAAEjC,WAAWN,WAAWnB,MAC9D,IAES;AAAA,IACLA,QAAQ;AAAA,IACR8C,OAAO;AAAA,IACPrC,SAAS,kCAAkC6C,CAAe;AAAA,EAC5D,IAIG;AAAA,IACLtD,QAAQ;AAAA,IACRJ,QAAQsD;AAAAA,EACV;AACF,GAEaS,IAAiBA,CAACC,MAC7B,OAAOA,KAAU,YACjBA,MAAU,QACV,gBAAgBA,KACfA,EAAuB/B,eAAe;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type StatusColor = "blue" | "red" | "yellow" | "gray";
|
|
2
|
+
export declare const GuideAnnotatedStatusDot: ({ color, tooltip, }: {
|
|
3
|
+
color: StatusColor;
|
|
4
|
+
tooltip: string;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=GuideAnnotatedStatusDot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuideAnnotatedStatusDot.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAkD7D,eAAO,MAAM,uBAAuB,GAAI,qBAGrC;IACD,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,4CAeA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideContextDetails.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GuideContextDetails.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,+CAqE/B,CAAC"}
|
|
@@ -2,7 +2,9 @@ import { AnnotatedGuide, UnknownGuide } from './useInspectGuideClientStore';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
guide: UnknownGuide | AnnotatedGuide;
|
|
4
4
|
orderIndex: number;
|
|
5
|
+
isExpanded: boolean;
|
|
6
|
+
onClick: (guideKey: string) => void;
|
|
5
7
|
};
|
|
6
|
-
export declare const GuideRow: ({ guide, orderIndex }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const GuideRow: ({ guide, orderIndex, isExpanded, onClick }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
8
10
|
//# sourceMappingURL=GuideRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideRow.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GuideRow.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"names":[],"mappings":"AAeA,OAAO,EACL,cAAc,EAEd,YAAY,EAEb,MAAM,8BAA8B,CAAC;AA8KtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,YAAY,GAAG,cAAc,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,4CAA4C,KAAK,4CA4LzE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuideRowDetails.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRowDetails.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,cAAc,EACd,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAiEtC,eAAO,MAAM,eAAe,GAAI,YAE7B;IACD,KAAK,EAAE,cAAc,GAAG,YAAY,CAAC;CACtC,4CAgDA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"V2.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"V2.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"names":[],"mappings":"AAqBA,OAAO,eAAe,CAAC;AAwDvB,eAAO,MAAM,EAAE,sDA0Rd,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { KnockGuide } from '@knocklabs/client';
|
|
2
|
+
export type ToolbarV2RunConfig = {
|
|
3
|
+
isVisible: boolean;
|
|
4
|
+
focusedGuideKeys?: Record<KnockGuide["key"], true>;
|
|
5
|
+
};
|
|
6
|
+
export declare const getRunConfig: () => ToolbarV2RunConfig;
|
|
7
|
+
export declare const clearRunConfigLS: () => void;
|
|
2
8
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc/C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;CACpD,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,kBA6B/B,CAAC;AA4BF,eAAO,MAAM,gBAAgB,YAS5B,CAAC"}
|
|
@@ -14,6 +14,8 @@ type UseDraggableReturn = {
|
|
|
14
14
|
position: Position;
|
|
15
15
|
isDragging: boolean;
|
|
16
16
|
handlePointerDown: (e: React.PointerEvent) => void;
|
|
17
|
+
/** True if the pointer moved beyond a small threshold during the last interaction. */
|
|
18
|
+
hasDraggedRef: React.RefObject<boolean>;
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* @param rightPadding Extra space to reserve on the right edge (e.g. for a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC;IACnC,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/C,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAChD,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC;IACnC,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IACnD,sFAAsF;IACtF,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAKF;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,YAAY,SAAI,GACf,QAAQ,CAcV;AAED,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,eAAkC,EAClC,WAAgB,EAChB,YAAgB,GACjB,EAAE,mBAAmB,GAAG,kBAAkB,CAgH1C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KnockGuide, KnockGuideSelectionResult } from '@knocklabs/client';
|
|
2
|
+
import { ToolbarV2RunConfig } from './helpers';
|
|
2
3
|
/**
|
|
3
4
|
* This is the main module that will house core logic for the toolbar. It hooks
|
|
4
5
|
* into the guide client state store, extracts relevant data for debugging, and
|
|
@@ -39,7 +40,7 @@ type SelectableStatusAbsent = {
|
|
|
39
40
|
status: undefined;
|
|
40
41
|
};
|
|
41
42
|
type SelectableStatus = SelectableStatusPresent | SelectableStatusAbsent;
|
|
42
|
-
type AnnotatedStatuses = {
|
|
43
|
+
export type AnnotatedStatuses = {
|
|
43
44
|
active: ActiveStatus;
|
|
44
45
|
targetable: TargetableStatus;
|
|
45
46
|
archived: ArchivedStatus;
|
|
@@ -68,12 +69,18 @@ export type UnknownGuide = {
|
|
|
68
69
|
};
|
|
69
70
|
};
|
|
70
71
|
};
|
|
71
|
-
export type
|
|
72
|
+
export type InspectionResultOk = {
|
|
73
|
+
status: "ok";
|
|
72
74
|
guides: (AnnotatedGuide | UnknownGuide)[];
|
|
73
|
-
error?: "no_guide_group";
|
|
74
75
|
};
|
|
76
|
+
type InspectionResultError = {
|
|
77
|
+
status: "error";
|
|
78
|
+
error: "no_guides_fetched" | "no_guide_group" | "no_guide_present";
|
|
79
|
+
message: string;
|
|
80
|
+
};
|
|
81
|
+
type InspectionResult = InspectionResultOk | InspectionResultError;
|
|
75
82
|
export declare const resolveIsQualified: ({ activatable, selectable, }: AnnotatedStatuses) => boolean;
|
|
76
|
-
export declare const useInspectGuideClientStore: () => InspectionResult | undefined;
|
|
83
|
+
export declare const useInspectGuideClientStore: (runConfig: ToolbarV2RunConfig) => InspectionResult | undefined;
|
|
77
84
|
export declare const isUnknownGuide: (input: unknown) => input is UnknownGuide;
|
|
78
85
|
export {};
|
|
79
86
|
//# sourceMappingURL=useInspectGuideClientStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInspectGuideClientStore.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,yBAAyB,EAG1B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useInspectGuideClientStore.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,yBAAyB,EAG1B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAM/C;;;;;GAKG;AAGH,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,OAAO,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c,GAAG,UAAU,GAAG;IACxC,UAAU,EAAE,eAAe,CAAC;IAG5B,yBAAyB,CAAC,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAKF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,cAAc,CAAC;IAC3B,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,EAAE,KAAK,CAAC;IACd,yBAAyB,EAAE,KAAK,CAAC;IACjC,UAAU,EAAE;QACV,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;QACnB,UAAU,EAAE;YACV,MAAM,EAAE,SAAS,CAAC;SACnB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,CAAC,cAAc,GAAG,YAAY,CAAC,EAAE,CAAC;CAC3C,CAAC;AACF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;IACnE,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,KAAK,gBAAgB,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAgOnE,eAAO,MAAM,kBAAkB,GAAI,8BAGhC,iBAAiB,YAInB,CAAC;AAgDF,eAAO,MAAM,0BAA0B,GACrC,WAAW,kBAAkB,KAC5B,gBAAgB,GAAG,SA4ErB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,YAIF,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@knocklabs/react",
|
|
3
3
|
"description": "A set of React components to build notification experiences powered by Knock",
|
|
4
4
|
"author": "@knocklabs",
|
|
5
|
-
"version": "0.11.
|
|
5
|
+
"version": "0.11.7",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
8
8
|
"module": "dist/esm/index.mjs",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@knocklabs/client": "^0.21.
|
|
76
|
-
"@knocklabs/react-core": "^0.13.
|
|
75
|
+
"@knocklabs/client": "^0.21.4",
|
|
76
|
+
"@knocklabs/react-core": "^0.13.4",
|
|
77
77
|
"@popperjs/core": "^2.11.8",
|
|
78
78
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
79
79
|
"@radix-ui/react-hover-card": "^1.1.15",
|
|
@@ -81,7 +81,9 @@
|
|
|
81
81
|
"@telegraph/combobox": "^0.2.1",
|
|
82
82
|
"@telegraph/icon": "^0.4.0",
|
|
83
83
|
"@telegraph/layout": "^0.4.0",
|
|
84
|
+
"@telegraph/segmented-control": "^0.2.1",
|
|
84
85
|
"@telegraph/select": "^0.0.84",
|
|
86
|
+
"@telegraph/tag": "^0.1.3",
|
|
85
87
|
"@telegraph/tokens": "^0.1.3",
|
|
86
88
|
"@telegraph/tooltip": "0.1.1",
|
|
87
89
|
"@telegraph/typography": "^0.2.0",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@telegraph/icon"),n=require("@telegraph/layout"),c=require("lucide-react"),i=require("react"),u=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=u(i),r=16,l=({onPointerDown:e,isDragging:a})=>t.default.createElement(n.Box,{"data-tgph-appearance":"dark",onPointerDown:e,borderRadius:"2",position:"absolute",style:{top:"9px",right:`-${r}px`,height:"24px",cursor:a?"grabbing":"grab",touchAction:"none",userSelect:"none"}},t.default.createElement(o.Icon,{color:"gray",size:"1",icon:c.GripVertical,"aria-hidden":!0}));exports.DRAG_HANDLE_OVERHANG=r;exports.DragHandle=l;
|
|
2
|
-
//# sourceMappingURL=DragHandle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragHandle.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/DragHandle.tsx"],"sourcesContent":["import { Icon } from \"@telegraph/icon\";\nimport { Box } from \"@telegraph/layout\";\nimport { GripVertical } from \"lucide-react\";\nimport React from \"react\";\n\n// How far the drag handle protrudes beyond the toolbar's right edge (px)\nexport const DRAG_HANDLE_OVERHANG = 16;\n\ntype DragHandleProps = {\n onPointerDown: (e: React.PointerEvent) => void;\n isDragging: boolean;\n};\n\nexport const DragHandle = ({ onPointerDown, isDragging }: DragHandleProps) => {\n return (\n <Box\n data-tgph-appearance=\"dark\"\n onPointerDown={onPointerDown}\n borderRadius=\"2\"\n position=\"absolute\"\n style={{\n top: \"9px\",\n right: `-${DRAG_HANDLE_OVERHANG}px`,\n height: \"24px\",\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n >\n <Icon color=\"gray\" size=\"1\" icon={GripVertical} aria-hidden />\n </Box>\n );\n};\n"],"names":["DRAG_HANDLE_OVERHANG","DragHandle","onPointerDown","isDragging","React","Box","top","right","height","cursor","touchAction","userSelect","Icon","GripVertical"],"mappings":"8PAMaA,EAAuB,GAOvBC,EAAaA,CAAC,CAAEC,cAAAA,EAAeC,WAAAA,CAA4B,IAEpEC,UAAA,cAACC,OACC,uBAAqB,OACrB,cAAAH,EACA,aAAa,IACb,SAAS,WACT,MAAO,CACLI,IAAK,MACLC,MAAO,IAAIP,CAAoB,KAC/BQ,OAAQ,OACRC,OAAQN,EAAa,WAAa,OAClCO,YAAa,OACbC,WAAY,MACd,CAAA,EAECP,EAAAA,QAAA,cAAAQ,EAAAA,KAAA,CAAK,MAAM,OAAO,KAAK,IAAI,KAAMC,EAAAA,aAAc,cAAW,EAAA,CAAA,CAC7D"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@radix-ui/react-hover-card"),l=require("@telegraph/button"),a=require("@telegraph/layout"),i=require("lucide-react"),f=require("react"),m=require("./useInspectGuideClientStore.js");function u(t){if(t&&typeof t=="object"&&"default"in t)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,c.get?c:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const o=u(d),e=u(f),p=({children:t,guide:n})=>{if(m.isUnknownGuide(n))return e.createElement(a.Stack,{align:"center"},t);const{annotation:r,activation_location_rules:c,priority:g,...s}=n;return e.createElement(o.Root,null,e.createElement(o.Trigger,null,e.createElement(a.Stack,{align:"center"},t)),e.createElement(o.Portal,null,e.createElement(o.Content,{sideOffset:16,side:"left"},e.createElement(a.Box,{px:"2",shadow:"2",rounded:"3",border:"px",overflow:"auto",backgroundColor:"surface-2",style:{width:"450px",maxHeight:"600px"}},e.createElement(a.Stack,{justify:"flex-end",gap:"1",pt:"2"},e.createElement(l.Button,{size:"0",variant:"soft",color:"default",leadingIcon:{icon:i.RotateCcw,alt:"Reset engagement"},onClick:()=>{}},"Reset engagement"),e.createElement(l.Button,{size:"0",variant:"soft",color:"default",leadingIcon:{icon:i.ExternalLink,alt:"Go to dashboard"},onClick:()=>{}},"Go to dashboard")),e.createElement("pre",{style:{fontSize:"11px"}},e.createElement("code",null,JSON.stringify(s,null,2)))),e.createElement(o.Arrow,null))))};exports.GuideHoverCard=p;
|
|
2
|
-
//# sourceMappingURL=GuideHoverCard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuideHoverCard.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideHoverCard.tsx"],"sourcesContent":["import * as HoverCard from \"@radix-ui/react-hover-card\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { ExternalLink, RotateCcw } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\ntype Props = {\n guide: AnnotatedGuide | UnknownGuide;\n};\n\nexport const GuideHoverCard = ({\n children,\n guide,\n}: React.PropsWithChildren<Props>) => {\n if (isUnknownGuide(guide)) {\n return <Stack align=\"center\">{children}</Stack>;\n }\n\n // Prune out internal or legacy fields.\n const {\n annotation: _annotation,\n activation_location_rules: _activation_location_rules,\n priority: _priority,\n ...rest\n } = guide;\n\n return (\n <HoverCard.Root>\n <HoverCard.Trigger>\n <Stack align=\"center\">{children}</Stack>\n </HoverCard.Trigger>\n <HoverCard.Portal>\n <HoverCard.Content sideOffset={16} side=\"left\">\n <Box\n px=\"2\"\n shadow=\"2\"\n rounded=\"3\"\n border=\"px\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n style={{\n width: \"450px\",\n maxHeight: \"600px\",\n }}\n >\n <Stack justify=\"flex-end\" gap=\"1\" pt=\"2\">\n <Button\n size=\"0\"\n variant=\"soft\"\n color=\"default\"\n leadingIcon={{ icon: RotateCcw, alt: \"Reset engagement\" }}\n // TODO(KNO-11468): Placeholder button\n onClick={() => {}}\n >\n Reset engagement\n </Button>\n <Button\n size=\"0\"\n variant=\"soft\"\n color=\"default\"\n leadingIcon={{ icon: ExternalLink, alt: \"Go to dashboard\" }}\n // TODO(KNO-11819): Placeholder button\n onClick={() => {}}\n >\n Go to dashboard\n </Button>\n </Stack>\n <pre\n style={{\n fontSize: \"11px\",\n }}\n >\n <code>{JSON.stringify(rest, null, 2)}</code>\n </pre>\n </Box>\n <HoverCard.Arrow />\n </HoverCard.Content>\n </HoverCard.Portal>\n </HoverCard.Root>\n );\n};\n"],"names":["GuideHoverCard","children","guide","isUnknownGuide","React","Stack","annotation","_annotation","activation_location_rules","_activation_location_rules","priority","_priority","rest","HoverCard","Box","width","maxHeight","Button","icon","RotateC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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),t=require("@telegraph/select"),s=require("../shared.js"),u=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},l=u(n),o=({value:e,onChange:a})=>l.default.createElement(t.Select.Root,{size:"1",value:e,onValueChange:i=>{i&&a(i)},contentProps:{style:{zIndex:s.TOOLBAR_Z_INDEX}}},l.default.createElement(t.Select.Option,{size:"1",value:"only-displaying"},"Displaying on current page"),l.default.createElement(t.Select.Option,{size:"1",value:"only-displayable"},"Displayable on current page"),l.default.createElement(t.Select.Option,{size:"1",value:"all-eligible"},"All eligible guides for user"),l.default.createElement(t.Select.Option,{size:"1",value:"all-guides"},"All existing guides"));exports.GuidesListDisplaySelect=o;
|
|
2
|
-
//# sourceMappingURL=GuidesListDisplaySelect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuidesListDisplaySelect.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.tsx"],"sourcesContent":["import { Select } from \"@telegraph/select\";\n\nimport { TOOLBAR_Z_INDEX } from \"../shared\";\n\nexport type DisplayOption =\n | \"only-displaying\"\n | \"only-displayable\"\n | \"all-eligible\"\n | \"all-guides\";\n\ntype Props = {\n value: DisplayOption;\n onChange: (option: DisplayOption) => void;\n};\n\nexport const GuidesListDisplaySelect = ({ value, onChange }: Props) => {\n return (\n <Select.Root\n size=\"1\"\n value={value}\n onValueChange={(value) => {\n if (!value) return;\n onChange(value as DisplayOption);\n }}\n contentProps={{\n style: { zIndex: TOOLBAR_Z_INDEX },\n }}\n >\n <Select.Option size=\"1\" value=\"only-displaying\">\n Displaying on current page\n </Select.Option>\n <Select.Option size=\"1\" value=\"only-displayable\">\n Displayable on current page\n </Select.Option>\n <Select.Option size=\"1\" value=\"all-eligible\">\n All eligible guides for user\n </Select.Option>\n <Select.Option size=\"1\" value=\"all-guides\">\n All existing guides\n </Select.Option>\n </Select.Root>\n );\n};\n"],"names":["GuidesListDisplaySelect","value","onChange","React","Select","style","zIndex","TOOLBAR_Z_INDEX"],"mappings":"iOAeaA,EAA0BA,CAAC,CAAEC,MAAAA,EAAOC,SAAAA,CAAgB,IAE7DC,UAAA,cAACC,SAAO,KAAP,CACC,KAAK,IACL,MAAAH,EACA,cAAgBA,GAAU,CACnBA,GACLC,EAASD,CAAsB,GAEjC,aAAc,CACZI,MAAO,CAAEC,OAAQC,EAAAA,eAAAA,CAAgB,GAGlCJ,EAAAA,QAAA,cAAAC,SAAO,OAAP,CAAc,KAAK,IAAI,MAAM,iBAAA,EAAiB,4BAE/C,0BACCA,EAAAA,OAAO,OAAP,CAAc,KAAK,IAAI,MAAM,oBAAkB,6BAEhD,EACAD,UAAA,cAACC,SAAO,OAAP,CAAc,KAAK,IAAI,MAAM,gBAAc,8BAE5C,EACCD,EAAAA,QAAA,cAAAC,SAAO,OAAP,CAAc,KAAK,IAAI,MAAM,cAAY,qBAE1C,CACF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Icon as o } from "@telegraph/icon";
|
|
2
|
-
import { Box as a } from "@telegraph/layout";
|
|
3
|
-
import { GripVertical as i } from "lucide-react";
|
|
4
|
-
import r from "react";
|
|
5
|
-
const n = 16, s = ({
|
|
6
|
-
onPointerDown: e,
|
|
7
|
-
isDragging: t
|
|
8
|
-
}) => /* @__PURE__ */ r.createElement(a, { "data-tgph-appearance": "dark", onPointerDown: e, borderRadius: "2", position: "absolute", style: {
|
|
9
|
-
top: "9px",
|
|
10
|
-
right: `-${n}px`,
|
|
11
|
-
height: "24px",
|
|
12
|
-
cursor: t ? "grabbing" : "grab",
|
|
13
|
-
touchAction: "none",
|
|
14
|
-
userSelect: "none"
|
|
15
|
-
} }, /* @__PURE__ */ r.createElement(o, { color: "gray", size: "1", icon: i, "aria-hidden": !0 }));
|
|
16
|
-
export {
|
|
17
|
-
n as DRAG_HANDLE_OVERHANG,
|
|
18
|
-
s as DragHandle
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=DragHandle.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragHandle.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/DragHandle.tsx"],"sourcesContent":["import { Icon } from \"@telegraph/icon\";\nimport { Box } from \"@telegraph/layout\";\nimport { GripVertical } from \"lucide-react\";\nimport React from \"react\";\n\n// How far the drag handle protrudes beyond the toolbar's right edge (px)\nexport const DRAG_HANDLE_OVERHANG = 16;\n\ntype DragHandleProps = {\n onPointerDown: (e: React.PointerEvent) => void;\n isDragging: boolean;\n};\n\nexport const DragHandle = ({ onPointerDown, isDragging }: DragHandleProps) => {\n return (\n <Box\n data-tgph-appearance=\"dark\"\n onPointerDown={onPointerDown}\n borderRadius=\"2\"\n position=\"absolute\"\n style={{\n top: \"9px\",\n right: `-${DRAG_HANDLE_OVERHANG}px`,\n height: \"24px\",\n cursor: isDragging ? \"grabbing\" : \"grab\",\n touchAction: \"none\",\n userSelect: \"none\",\n }}\n >\n <Icon color=\"gray\" size=\"1\" icon={GripVertical} aria-hidden />\n </Box>\n );\n};\n"],"names":["DRAG_HANDLE_OVERHANG","DragHandle","onPointerDown","isDragging","React","Box","top","right","height","cursor","touchAction","userSelect","Icon","GripVertical"],"mappings":";;;;AAMO,MAAMA,IAAuB,IAOvBC,IAAaA,CAAC;AAAA,EAAEC,eAAAA;AAAAA,EAAeC,YAAAA;AAA4B,MAEpEC,gBAAAA,EAAA,cAACC,KACC,wBAAqB,QACrB,eAAAH,GACA,cAAa,KACb,UAAS,YACT,OAAO;AAAA,EACLI,KAAK;AAAA,EACLC,OAAO,IAAIP,CAAoB;AAAA,EAC/BQ,QAAQ;AAAA,EACRC,QAAQN,IAAa,aAAa;AAAA,EAClCO,aAAa;AAAA,EACbC,YAAY;AACd,EAAA,GAECP,gBAAAA,EAAA,cAAAQ,GAAA,EAAK,OAAM,QAAO,MAAK,KAAI,MAAMC,GAAc,eAAW,GAAA,CAAA,CAC7D;"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as t from "@radix-ui/react-hover-card";
|
|
2
|
-
import { Button as a } from "@telegraph/button";
|
|
3
|
-
import { Stack as o, Box as i } from "@telegraph/layout";
|
|
4
|
-
import { RotateCcw as c, ExternalLink as m } from "lucide-react";
|
|
5
|
-
import * as e from "react";
|
|
6
|
-
import { isUnknownGuide as s } from "./useInspectGuideClientStore.mjs";
|
|
7
|
-
const v = ({
|
|
8
|
-
children: n,
|
|
9
|
-
guide: r
|
|
10
|
-
}) => {
|
|
11
|
-
if (s(r))
|
|
12
|
-
return /* @__PURE__ */ e.createElement(o, { align: "center" }, n);
|
|
13
|
-
const {
|
|
14
|
-
annotation: d,
|
|
15
|
-
activation_location_rules: f,
|
|
16
|
-
priority: u,
|
|
17
|
-
...l
|
|
18
|
-
} = r;
|
|
19
|
-
return /* @__PURE__ */ e.createElement(t.Root, null, /* @__PURE__ */ e.createElement(t.Trigger, null, /* @__PURE__ */ e.createElement(o, { align: "center" }, n)), /* @__PURE__ */ e.createElement(t.Portal, null, /* @__PURE__ */ e.createElement(t.Content, { sideOffset: 16, side: "left" }, /* @__PURE__ */ e.createElement(i, { px: "2", shadow: "2", rounded: "3", border: "px", overflow: "auto", backgroundColor: "surface-2", style: {
|
|
20
|
-
width: "450px",
|
|
21
|
-
maxHeight: "600px"
|
|
22
|
-
} }, /* @__PURE__ */ e.createElement(o, { justify: "flex-end", gap: "1", pt: "2" }, /* @__PURE__ */ e.createElement(
|
|
23
|
-
a,
|
|
24
|
-
{
|
|
25
|
-
size: "0",
|
|
26
|
-
variant: "soft",
|
|
27
|
-
color: "default",
|
|
28
|
-
leadingIcon: {
|
|
29
|
-
icon: c,
|
|
30
|
-
alt: "Reset engagement"
|
|
31
|
-
},
|
|
32
|
-
onClick: () => {
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"Reset engagement"
|
|
36
|
-
), /* @__PURE__ */ e.createElement(
|
|
37
|
-
a,
|
|
38
|
-
{
|
|
39
|
-
size: "0",
|
|
40
|
-
variant: "soft",
|
|
41
|
-
color: "default",
|
|
42
|
-
leadingIcon: {
|
|
43
|
-
icon: m,
|
|
44
|
-
alt: "Go to dashboard"
|
|
45
|
-
},
|
|
46
|
-
onClick: () => {
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"Go to dashboard"
|
|
50
|
-
)), /* @__PURE__ */ e.createElement("pre", { style: {
|
|
51
|
-
fontSize: "11px"
|
|
52
|
-
} }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(l, null, 2)))), /* @__PURE__ */ e.createElement(t.Arrow, null))));
|
|
53
|
-
};
|
|
54
|
-
export {
|
|
55
|
-
v as GuideHoverCard
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=GuideHoverCard.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuideHoverCard.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideHoverCard.tsx"],"sourcesContent":["import * as HoverCard from \"@radix-ui/react-hover-card\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { ExternalLink, RotateCcw } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\ntype Props = {\n guide: AnnotatedGuide | UnknownGuide;\n};\n\nexport const GuideHoverCard = ({\n children,\n guide,\n}: React.PropsWithChildren<Props>) => {\n if (isUnknownGuide(guide)) {\n return <Stack align=\"center\">{children}</Stack>;\n }\n\n // Prune out internal or legacy fields.\n const {\n annotation: _annotation,\n activation_location_rules: _activation_location_rules,\n priority: _priority,\n ...rest\n } = guide;\n\n return (\n <HoverCard.Root>\n <HoverCard.Trigger>\n <Stack align=\"center\">{children}</Stack>\n </HoverCard.Trigger>\n <HoverCard.Portal>\n <HoverCard.Content sideOffset={16} side=\"left\">\n <Box\n px=\"2\"\n shadow=\"2\"\n rounded=\"3\"\n border=\"px\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n style={{\n width: \"450px\",\n maxHeight: \"600px\",\n }}\n >\n <Stack justify=\"flex-end\" gap=\"1\" pt=\"2\">\n <Button\n size=\"0\"\n variant=\"soft\"\n color=\"default\"\n leadingIcon={{ icon: RotateCcw, alt: \"Reset engagement\" }}\n // TODO(KNO-11468): Placeholder button\n onClick={() => {}}\n >\n Reset engagement\n </Button>\n <Button\n size=\"0\"\n variant=\"soft\"\n color=\"default\"\n leadingIcon={{ icon: ExternalLink, alt: \"Go to dashboard\" }}\n // TODO(KNO-11819): Placeholder button\n onClick={() => {}}\n >\n Go to dashboard\n </Button>\n </Stack>\n <pre\n style={{\n fontSize: \"11px\",\n }}\n >\n <code>{JSON.stringify(rest, null, 2)}</code>\n </pre>\n </Box>\n <HoverCard.Arrow />\n </HoverCard.Content>\n </HoverCard.Portal>\n </HoverCard.Root>\n );\n};\n"],"names":["GuideHoverCard","children","guide","isUnknownGuide","React","Stack","annotation","_annotation","activation_location_rules","_activation_location_rules","priority","_priority","rest","HoverCard","Box","width","maxHeight","Button","icon","RotateCcw","alt","ExternalLink","fontSize","JSON","stringify"],"mappings":";;;;;;AAgBO,MAAMA,IAAiBA,CAAC;AAAA,EAC7BC,UAAAA;AAAAA,EACAC,OAAAA;AAC8B,MAAM;AAChCC,MAAAA,EAAeD,CAAK;AACtB,WAAQ,gBAAAE,EAAA,cAAAC,GAAA,EAAM,OAAM,SAAA,GAAUJ,CAAS;AAInC,QAAA;AAAA,IACJK,YAAYC;AAAAA,IACZC,2BAA2BC;AAAAA,IAC3BC,UAAUC;AAAAA,IACV,GAAGC;AAAAA,EAAAA,IACDV;AAEJ,yCACGW,EAAU,MAAV,MACE,gBAAAT,EAAA,cAAAS,EAAU,SAAV,MACC,gBAAAT,EAAA,cAACC,GAAM,EAAA,OAAM,YAAUJ,CAAS,CAClC,GACC,gBAAAG,EAAA,cAAAS,EAAU,QAAV,MACC,gBAAAT,EAAA,cAACS,EAAU,SAAV,EAAkB,YAAY,IAAI,MAAK,UACtC,gBAAAT,EAAA,cAACU,KACC,IAAG,KACH,QAAO,KACP,SAAQ,KACR,QAAO,MACP,UAAS,QACT,iBAAgB,aAChB,OAAO;AAAA,IACLC,OAAO;AAAA,IACPC,WAAW;AAAA,EACb,EAAA,mCAECX,GAAM,EAAA,SAAQ,YAAW,KAAI,KAAI,IAAG,IACnC,GAAA,gBAAAD,EAAA;AAAA,IAACa;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,aAAa;AAAA,QAAEC,MAAMC;AAAAA,QAAWC,KAAK;AAAA,MAAmB;AAAA,MAExD,SAAS,MAAM;AAAA,MAAA;AAAA,IAAC;AAAA,IAAE;AAAA,EAIpB,GAAA,gBAAAhB,EAAA;AAAA,IAACa;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,OAAM;AAAA,MACN,aAAa;AAAA,QAAEC,MAAMG;AAAAA,QAAcD,KAAK;AAAA,MAAkB;AAAA,MAE1D,SAAS,MAAM;AAAA,MAAA;AAAA,IAAC;AAAA,IAAE;AAAA,EAItB,CAAA,GACC,gBAAAhB,EAAA,cAAA,OAAA,EACC,OAAO;AAAA,IACLkB,UAAU;AAAA,EAAA,KAGX,gBAAAlB,EAAA,cAAA,QAAA,MAAMmB,KAAKC,UAAUZ,GAAM,MAAM,CAAC,CAAE,CACvC,CACF,GACC,gBAAAR,EAAA,cAAAS,EAAU,OAAV,IAAe,CAClB,CACF,CACF;AAEJ;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import { Select as l } from "@telegraph/select";
|
|
3
|
-
import { TOOLBAR_Z_INDEX as a } from "../shared.mjs";
|
|
4
|
-
const p = ({
|
|
5
|
-
value: i,
|
|
6
|
-
onChange: n
|
|
7
|
-
}) => /* @__PURE__ */ e.createElement(l.Root, { size: "1", value: i, onValueChange: (t) => {
|
|
8
|
-
t && n(t);
|
|
9
|
-
}, contentProps: {
|
|
10
|
-
style: {
|
|
11
|
-
zIndex: a
|
|
12
|
-
}
|
|
13
|
-
} }, /* @__PURE__ */ e.createElement(l.Option, { size: "1", value: "only-displaying" }, "Displaying on current page"), /* @__PURE__ */ e.createElement(l.Option, { size: "1", value: "only-displayable" }, "Displayable on current page"), /* @__PURE__ */ e.createElement(l.Option, { size: "1", value: "all-eligible" }, "All eligible guides for user"), /* @__PURE__ */ e.createElement(l.Option, { size: "1", value: "all-guides" }, "All existing guides"));
|
|
14
|
-
export {
|
|
15
|
-
p as GuidesListDisplaySelect
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=GuidesListDisplaySelect.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuidesListDisplaySelect.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.tsx"],"sourcesContent":["import { Select } from \"@telegraph/select\";\n\nimport { TOOLBAR_Z_INDEX } from \"../shared\";\n\nexport type DisplayOption =\n | \"only-displaying\"\n | \"only-displayable\"\n | \"all-eligible\"\n | \"all-guides\";\n\ntype Props = {\n value: DisplayOption;\n onChange: (option: DisplayOption) => void;\n};\n\nexport const GuidesListDisplaySelect = ({ value, onChange }: Props) => {\n return (\n <Select.Root\n size=\"1\"\n value={value}\n onValueChange={(value) => {\n if (!value) return;\n onChange(value as DisplayOption);\n }}\n contentProps={{\n style: { zIndex: TOOLBAR_Z_INDEX },\n }}\n >\n <Select.Option size=\"1\" value=\"only-displaying\">\n Displaying on current page\n </Select.Option>\n <Select.Option size=\"1\" value=\"only-displayable\">\n Displayable on current page\n </Select.Option>\n <Select.Option size=\"1\" value=\"all-eligible\">\n All eligible guides for user\n </Select.Option>\n <Select.Option size=\"1\" value=\"all-guides\">\n All existing guides\n </Select.Option>\n </Select.Root>\n );\n};\n"],"names":["GuidesListDisplaySelect","value","onChange","React","Select","style","zIndex","TOOLBAR_Z_INDEX"],"mappings":";;;AAeO,MAAMA,IAA0BA,CAAC;AAAA,EAAEC,OAAAA;AAAAA,EAAOC,UAAAA;AAAgB,MAE7DC,gBAAAA,EAAA,cAACC,EAAO,MAAP,EACC,MAAK,KACL,OAAAH,GACA,eAAgBA,CAAAA,MAAU;AACxB,EAAKA,KACLC,EAASD,CAAsB;GAEjC,cAAc;AAAA,EACZI,OAAO;AAAA,IAAEC,QAAQC;AAAAA,EAAAA;AAAgB,KAGlCJ,gBAAAA,EAAA,cAAAC,EAAO,QAAP,EAAc,MAAK,KAAI,OAAM,kBAAA,GAAiB,4BAE/C,mCACCA,EAAO,QAAP,EAAc,MAAK,KAAI,OAAM,sBAAkB,6BAEhD,GACAD,gBAAAA,EAAA,cAACC,EAAO,QAAP,EAAc,MAAK,KAAI,OAAM,kBAAc,8BAE5C,GACCD,gBAAAA,EAAA,cAAAC,EAAO,QAAP,EAAc,MAAK,KAAI,OAAM,gBAAY,qBAE1C,CACF;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export declare const DRAG_HANDLE_OVERHANG = 16;
|
|
3
|
-
type DragHandleProps = {
|
|
4
|
-
onPointerDown: (e: React.PointerEvent) => void;
|
|
5
|
-
isDragging: boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare const DragHandle: ({ onPointerDown, isDragging }: DragHandleProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=DragHandle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/DragHandle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,KAAK,eAAe,GAAG;IACrB,aAAa,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,YAAY,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,+BAA+B,eAAe,4CAmBxE,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type DisplayOption = "only-displaying" | "only-displayable" | "all-eligible" | "all-guides";
|
|
2
|
-
type Props = {
|
|
3
|
-
value: DisplayOption;
|
|
4
|
-
onChange: (option: DisplayOption) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const GuidesListDisplaySelect: ({ value, onChange }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=GuidesListDisplaySelect.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GuidesListDisplaySelect.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuidesListDisplaySelect.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,kBAAkB,GAClB,cAAc,GACd,YAAY,CAAC;AAEjB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,qBAAqB,KAAK,4CA2BjE,CAAC"}
|