@knocklabs/react 0.11.4 → 0.11.6
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 +26 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.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/GuideHoverCard.js +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.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/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 +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.js.map +1 -0
- 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/KnockButton.mjs +14 -8
- package/dist/esm/modules/guide/components/Toolbar/KnockButton.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs +20 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +26 -11
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs +46 -16
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +48 -30
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +67 -39
- 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 +74 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +78 -90
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/KnockButton.d.ts +2 -1
- package/dist/types/modules/guide/components/Toolbar/KnockButton.d.ts.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts +9 -0
- package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.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.map +1 -1
- package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.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 +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 +26 -0
- package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts.map +1 -0
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts +3 -2
- package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -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\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 marker: KnockGuideIneligibilityMarker,\n): Partial<AnnotatedStatuses> | undefined => {\n switch (marker.reason) {\n case \"not_in_target_audience\":\n case \"target_conditions_not_met\":\n return {\n targetable: {\n status: false,\n reason: marker.reason,\n message: marker.message,\n },\n };\n\n case \"marked_as_archived\":\n return {\n archived: {\n status: true,\n },\n };\n\n case \"guide_not_active\":\n return {\n active: {\n status: false,\n },\n };\n\n default:\n return undefined;\n }\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 = marker ? toIneligibilityStatus(marker) : undefined;\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","reason","targetable","message","archived","active","resolveIsEligible","resolveIsQualified","activatable","selectable","annotateGuide","ineligibleGuides","location","ineligiblity","statuses","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":"wJAWMA,EAAoCC,GACjCA,EAAMC,OAAO,CAACC,EAAKC,KAAU,CAAE,GAA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ACZC,YAAa,GACbT,WAAY,CACVd,OAAQC,MAAAA,CACV,CAEJ,GAEWyB,EAA6BA,IAAoC,OACtE,KAAA,CAAEC,OAAAA,GAAWC,kBAAgB,EAG7BlD,EAA+BmD,EAAAA,SAASF,EAAOG,MAAkBC,GAAA,CAC/D3C,MAAAA,EAAY4C,wBAAsBD,CAAK,EAEtC,MAAA,CACLd,SAAUc,EAAMd,SAChBrB,OAAQmC,EAAMnC,OACdqC,YAAaF,EAAME,YACnBjB,iBAAkBe,EAAMf,iBACxBkB,MAAOH,EAAMG,MACbC,QAASJ,EAAMI,QACf/C,UAAAA,CACF,CAAA,CACD,EAGG,GAAA,GAACV,EAAAA,EAASwD,QAATxD,MAAAA,EAAgB0D,WACZnC,OAKHoC,MAAAA,EAAe3D,EAASuD,YAAY,CAAC,EAC3C,GAAI,CAACI,EACI,MAAA,CACLC,MAAO,iBACP1C,OAAQ,CAAA,CACV,EAGI2C,MAAAA,EAAaZ,EAAOa,SAAS,EAa5B,MAAA,CACL5C,OAVoByC,EAAaI,iBAAiBC,IAAkBC,GAAA,CAC9DlE,MAAAA,EAAQC,EAASkB,OAAO+C,CAAQ,EACtC,OAAKlE,EAIEsC,EAActC,EAAOC,EAAU6D,CAAU,EAHvCf,EAAgBmB,CAAQ,CAGe,CACjD,CAID,CACF,EAEaC,EAAkBC,GAC7B,OAAOA,GAAU,UACjBA,IAAU,MACV,eAAgBA,GACfA,EAAuBpB,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 { 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\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\" | \"no_guide_present\";\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 = (\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 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 // Check if the focused guide actually exists and is selectable on the page.\n if (groupStage?.status === \"closed\" && runConfig.focusedGuideKeys) {\n const focusableGuide = orderedGuides.find(\n (g) =>\n runConfig.focusedGuideKeys![g.key] && g.annotation.selectable.status,\n );\n if (!focusableGuide) {\n return {\n error: \"no_guide_present\",\n guides: [],\n };\n }\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","runConfig","client","useGuideContext","useStore","store","state","checkStateIfThrottled","guideGroups","debug","counter","debugging","defaultGroup","error","groupStage","getStage","orderedGuides","display_sequence","map","guideKey","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,EAwHjEE,EAA+BA,CACnCC,EACAC,EACAC,EACAC,IACsC,qBACtC,MAAMC,EACJ,CAAC,GAACD,GAAAA,GAAAA,GAAAA,EAAAA,EAAML,MAANK,YAAAA,EAAWE,MAAXF,YAAAA,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ACV,CAEJ,GAEW6B,EACXC,GACiC,OAC3B,KAAA,CAAEC,OAAAA,GAAWC,kBAAgB,EAG7BvD,EAA+BwD,EAAAA,SAASF,EAAOG,MAAkBC,GAAA,CAC/DhD,MAAAA,EAAYiD,wBAAsBD,CAAK,EAEtC,MAAA,CACLd,SAAUc,EAAMd,SAChB1B,OAAQwC,EAAMxC,OACd0C,YAAaF,EAAME,YACnBjB,iBAAkBe,EAAMf,iBACxBkB,MAAOH,EAAMG,MACbC,QAASJ,EAAMI,QACfpD,UAAAA,CACF,CAAA,CACD,EAGG,GAAA,GAACV,EAAAA,EAAS6D,QAAT7D,MAAAA,EAAgB+D,WACZxC,OAKHyC,MAAAA,EAAehE,EAAS4D,YAAY,CAAC,EAC3C,GAAI,CAACI,EACI,MAAA,CACLC,MAAO,iBACP/C,OAAQ,CAAA,CACV,EAGIgD,MAAAA,EAAaZ,EAAOa,SAAS,EAI7BC,EAAgBJ,EAAaK,iBAAiBC,IAAkBC,GAAA,CAC9DxE,MAAAA,EAAQC,EAASkB,OAAOqD,CAAQ,EACtC,OAAKxE,EAIE2C,EAAc3C,EAAOC,EAAUkE,CAAU,EAHvChB,EAAgBqB,CAAQ,CAGe,CACjD,EAGD,OAAIL,GAAAA,YAAAA,EAAY5C,UAAW,UAAY+B,EAAUmB,kBAK3C,CAJmBJ,EAAcK,KAClCC,GACCrB,EAAUmB,iBAAkBE,EAAE7E,GAAG,GAAK6E,EAAE3B,WAAWN,WAAWnB,MAClE,EAES,CACL2C,MAAO,mBACP/C,OAAQ,CAAA,CACV,EAIG,CACLA,OAAQkD,CACV,CACF,EAEaO,EAAkBC,GAC7B,OAAOA,GAAU,UACjBA,IAAU,MACV,eAAgBA,GACfA,EAAuBzB,aAAe"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,117 +1,118 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { Button as
|
|
4
|
-
import { ButtonGroup as
|
|
5
|
-
import { BellIcon as
|
|
6
|
-
import { CheckmarkCircle as
|
|
7
|
-
import { ChevronDown as
|
|
8
|
-
import { CloseCircle as
|
|
9
|
-
import { Spinner as
|
|
10
|
-
import { default as
|
|
11
|
-
import { EmptyFeed as
|
|
12
|
-
import { NotificationCell as
|
|
13
|
-
import { Avatar as
|
|
14
|
-
import { NotificationFeed as
|
|
15
|
-
import { NotificationFeedHeader as
|
|
16
|
-
import { MarkAsRead as
|
|
17
|
-
import { NotificationFeedContainer as
|
|
18
|
-
import { NotificationFeedPopover as
|
|
19
|
-
import { NotificationIconButton as
|
|
20
|
-
import { UnseenBadge as
|
|
21
|
-
import { Banner as
|
|
22
|
-
import { Card as
|
|
3
|
+
import { Button as x } from "./modules/core/components/Button/Button.mjs";
|
|
4
|
+
import { ButtonGroup as k } from "./modules/core/components/Button/ButtonGroup.mjs";
|
|
5
|
+
import { BellIcon as h } from "./modules/core/components/Icons/Bell.mjs";
|
|
6
|
+
import { CheckmarkCircle as T } from "./modules/core/components/Icons/CheckmarkCircle.mjs";
|
|
7
|
+
import { ChevronDown as v } from "./modules/core/components/Icons/ChevronDown.mjs";
|
|
8
|
+
import { CloseCircle as P } from "./modules/core/components/Icons/CloseCircle.mjs";
|
|
9
|
+
import { Spinner as F } from "./modules/core/components/Spinner/Spinner.mjs";
|
|
10
|
+
import { default as b } from "./modules/core/hooks/useOnBottomScroll.mjs";
|
|
11
|
+
import { EmptyFeed as g } from "./modules/feed/components/EmptyFeed/EmptyFeed.mjs";
|
|
12
|
+
import { NotificationCell as y } from "./modules/feed/components/NotificationCell/NotificationCell.mjs";
|
|
13
|
+
import { Avatar as O } from "./modules/feed/components/NotificationCell/Avatar.mjs";
|
|
14
|
+
import { NotificationFeed as D } from "./modules/feed/components/NotificationFeed/NotificationFeed.mjs";
|
|
15
|
+
import { NotificationFeedHeader as H } from "./modules/feed/components/NotificationFeed/NotificationFeedHeader.mjs";
|
|
16
|
+
import { MarkAsRead as R } from "./modules/feed/components/NotificationFeed/MarkAsRead.mjs";
|
|
17
|
+
import { NotificationFeedContainer as j } from "./modules/feed/components/NotificationFeedContainer/NotificationFeedContainer.mjs";
|
|
18
|
+
import { NotificationFeedPopover as z } from "./modules/feed/components/NotificationFeedPopover/NotificationFeedPopover.mjs";
|
|
19
|
+
import { NotificationIconButton as Q } from "./modules/feed/components/NotificationIconButton/NotificationIconButton.mjs";
|
|
20
|
+
import { UnseenBadge as X } from "./modules/feed/components/UnseenBadge/UnseenBadge.mjs";
|
|
21
|
+
import { Banner as Z, BannerView as _ } from "./modules/guide/components/Banner/Banner.mjs";
|
|
22
|
+
import { Card as ee, CardView as oe } from "./modules/guide/components/Card/Card.mjs";
|
|
23
23
|
import "react";
|
|
24
|
-
import { FilterStatus as
|
|
24
|
+
import { FilterStatus as re, I18nContext as ne, KnockFeedProvider as ie, KnockGuideContext as ae, KnockI18nProvider as se, KnockMsTeamsProvider as me, KnockProvider as ue, KnockSlackProvider as pe, feedProviderKey as ce, formatBadgeCount as fe, formatTimestamp as le, getBadgeAriaLabel as de, locales as xe, msTeamsProviderKey as Ce, renderNodeOrFallback as ke, slackProviderKey as Se, toSentenceCase as he, useAuthenticatedKnockClient as Ke, useConnectedMsTeamsChannels as Te, useConnectedSlackChannels as Me, useCreateNotificationStore as ve, useFeedSettings as Be, useGuide as Pe, useGuideContext as Ae, useGuides as Fe, useKnockClient as Ne, useKnockFeed as be, useKnockMsTeamsClient as Ge, useKnockSlackClient as ge, useMsTeamsAuth as we, useMsTeamsChannels as ye, useMsTeamsConnectionStatus as Ie, useMsTeamsTeams as Oe, useNotificationStore as Ve, useNotifications as De, usePreferences as Ee, useSlackAuth as He, useSlackChannels as Le, useSlackConnectionStatus as Re, useStableOptions as Ue, useTranslations as je } from "@knocklabs/react-core";
|
|
25
25
|
import "@telegraph/button";
|
|
26
26
|
import "@telegraph/layout";
|
|
27
27
|
import "@telegraph/tag";
|
|
28
28
|
import "@telegraph/typography";
|
|
29
29
|
import "lucide-react";
|
|
30
30
|
/* empty css */
|
|
31
|
+
import "@telegraph/icon";
|
|
31
32
|
import "@telegraph/tooltip";
|
|
32
33
|
import "@radix-ui/react-hover-card";
|
|
33
34
|
import "@knocklabs/client";
|
|
34
35
|
import "@telegraph/select";
|
|
35
|
-
import { Modal as
|
|
36
|
-
import { KnockGuideProvider as
|
|
37
|
-
import { MsTeamsAuthButton as
|
|
38
|
-
import { MsTeamsAuthContainer as
|
|
39
|
-
import { default as
|
|
40
|
-
import { SlackAuthButton as
|
|
41
|
-
import { SlackAuthContainer as
|
|
36
|
+
import { Modal as ze, ModalView as Je } from "./modules/guide/components/Modal/Modal.mjs";
|
|
37
|
+
import { KnockGuideProvider as We } from "./modules/guide/providers/KnockGuideProvider.mjs";
|
|
38
|
+
import { MsTeamsAuthButton as Ye } from "./modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.mjs";
|
|
39
|
+
import { MsTeamsAuthContainer as _e } from "./modules/ms-teams/components/MsTeamsAuthContainer/MsTeamsAuthContainer.mjs";
|
|
40
|
+
import { default as eo } from "./modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelCombobox.mjs";
|
|
41
|
+
import { SlackAuthButton as to } from "./modules/slack/components/SlackAuthButton/SlackAuthButton.mjs";
|
|
42
|
+
import { SlackAuthContainer as no } from "./modules/slack/components/SlackAuthContainer/SlackAuthContainer.mjs";
|
|
42
43
|
import { SlackChannelCombobox as ao } from "./modules/slack/components/SlackChannelCombobox/SlackChannelCombobox.mjs";
|
|
43
44
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
O as Avatar,
|
|
46
|
+
Z as Banner,
|
|
47
|
+
_ as BannerView,
|
|
48
|
+
h as BellIcon,
|
|
49
|
+
x as Button,
|
|
50
|
+
k as ButtonGroup,
|
|
51
|
+
ee as Card,
|
|
52
|
+
oe as CardView,
|
|
53
|
+
T as CheckmarkCircle,
|
|
54
|
+
v as ChevronDown,
|
|
55
|
+
P as CloseCircle,
|
|
56
|
+
g as EmptyFeed,
|
|
57
|
+
re as FilterStatus,
|
|
58
|
+
ne as I18nContext,
|
|
59
|
+
ie as KnockFeedProvider,
|
|
59
60
|
ae as KnockGuideContext,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
We as KnockGuideProvider,
|
|
62
|
+
se as KnockI18nProvider,
|
|
63
|
+
me as KnockMsTeamsProvider,
|
|
64
|
+
ue as KnockProvider,
|
|
65
|
+
pe as KnockSlackProvider,
|
|
66
|
+
R as MarkAsRead,
|
|
67
|
+
ze as Modal,
|
|
68
|
+
Je as ModalView,
|
|
69
|
+
Ye as MsTeamsAuthButton,
|
|
70
|
+
_e as MsTeamsAuthContainer,
|
|
71
|
+
eo as MsTeamsChannelCombobox,
|
|
72
|
+
y as NotificationCell,
|
|
73
|
+
D as NotificationFeed,
|
|
74
|
+
j as NotificationFeedContainer,
|
|
75
|
+
H as NotificationFeedHeader,
|
|
76
|
+
z as NotificationFeedPopover,
|
|
77
|
+
Q as NotificationIconButton,
|
|
78
|
+
to as SlackAuthButton,
|
|
79
|
+
no as SlackAuthContainer,
|
|
79
80
|
ao as SlackChannelCombobox,
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
F as Spinner,
|
|
82
|
+
X as UnseenBadge,
|
|
82
83
|
ce as feedProviderKey,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
84
|
+
fe as formatBadgeCount,
|
|
85
|
+
le as formatTimestamp,
|
|
86
|
+
de as getBadgeAriaLabel,
|
|
87
|
+
xe as locales,
|
|
88
|
+
Ce as msTeamsProviderKey,
|
|
89
|
+
ke as renderNodeOrFallback,
|
|
90
|
+
Se as slackProviderKey,
|
|
91
|
+
he as toSentenceCase,
|
|
92
|
+
Ke as useAuthenticatedKnockClient,
|
|
93
|
+
Te as useConnectedMsTeamsChannels,
|
|
94
|
+
Me as useConnectedSlackChannels,
|
|
95
|
+
ve as useCreateNotificationStore,
|
|
96
|
+
Be as useFeedSettings,
|
|
97
|
+
Pe as useGuide,
|
|
98
|
+
Ae as useGuideContext,
|
|
99
|
+
Fe as useGuides,
|
|
100
|
+
Ne as useKnockClient,
|
|
101
|
+
be as useKnockFeed,
|
|
102
|
+
Ge as useKnockMsTeamsClient,
|
|
103
|
+
ge as useKnockSlackClient,
|
|
104
|
+
we as useMsTeamsAuth,
|
|
105
|
+
ye as useMsTeamsChannels,
|
|
106
|
+
Ie as useMsTeamsConnectionStatus,
|
|
107
|
+
Oe as useMsTeamsTeams,
|
|
108
|
+
Ve as useNotificationStore,
|
|
109
|
+
De as useNotifications,
|
|
110
|
+
b as useOnBottomScroll,
|
|
111
|
+
Ee as usePreferences,
|
|
112
|
+
He as useSlackAuth,
|
|
113
|
+
Le as useSlackChannels,
|
|
114
|
+
Re as useSlackConnectionStatus,
|
|
115
|
+
Ue as useStableOptions,
|
|
116
|
+
je as useTranslations
|
|
116
117
|
};
|
|
117
118
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import t from "react";
|
|
2
|
-
import { Button as
|
|
3
|
-
import { TOOLBAR_Z_INDEX as
|
|
2
|
+
import { Button as a } from "@telegraph/button";
|
|
3
|
+
import { TOOLBAR_Z_INDEX as r } from "./shared.mjs";
|
|
4
4
|
/* empty css */
|
|
5
|
-
const
|
|
6
|
-
onClick: e
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const s = ({
|
|
6
|
+
onClick: e,
|
|
7
|
+
positioned: o = !0
|
|
8
|
+
}) => /* @__PURE__ */ t.createElement(a, { onClick: e, ...o && {
|
|
9
|
+
position: "fixed",
|
|
10
|
+
top: "4",
|
|
11
|
+
right: "4",
|
|
12
|
+
style: {
|
|
13
|
+
zIndex: r
|
|
14
|
+
}
|
|
15
|
+
}, bg: "surface-2", shadow: "3", rounded: "3", w: "10", h: "10", variant: "soft", "data-tgph-appearance": "dark", "aria-label": "Expand guide toolbar" }, /* @__PURE__ */ t.createElement("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: {
|
|
10
16
|
position: "absolute",
|
|
11
17
|
top: "50%",
|
|
12
18
|
left: "50%",
|
|
13
19
|
transform: "translate(-50%, -50%)"
|
|
14
20
|
} }, /* @__PURE__ */ t.createElement("path", { d: "M11.6001 32.4V7.59998H16.6365V21.8219H16.7774L22.3067 14.8525H27.9418L21.8138 22.0696L28.4001 32.4H22.7996L18.8555 25.572L16.6365 28.0839V32.4H11.6001Z", fill: "#EDEEEF" }), /* @__PURE__ */ t.createElement("path", { d: "M28.4 10.4C28.4 11.9464 27.1467 13.2 25.6 13.2C24.0534 13.2 22.8 11.9464 22.8 10.4C22.8 8.85358 24.0534 7.59998 25.6 7.59998C27.1467 7.59998 28.4 8.85358 28.4 10.4Z", fill: "#FF573A" })));
|
|
15
21
|
export {
|
|
16
|
-
|
|
22
|
+
s as KnockButton
|
|
17
23
|
};
|
|
18
24
|
//# sourceMappingURL=KnockButton.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnockButton.mjs","sources":["../../../../../../src/modules/guide/components/Toolbar/KnockButton.tsx"],"sourcesContent":["import { Button } from \"@telegraph/button\";\n\nimport { TOOLBAR_Z_INDEX } from \"./shared\";\nimport \"./styles.css\";\n\ntype Props = {\n onClick: () => void;\n};\n\nexport const KnockButton = ({ onClick }: Props) => {\n return (\n <Button\n onClick={onClick}\n position
|
|
1
|
+
{"version":3,"file":"KnockButton.mjs","sources":["../../../../../../src/modules/guide/components/Toolbar/KnockButton.tsx"],"sourcesContent":["import { Button } from \"@telegraph/button\";\n\nimport { TOOLBAR_Z_INDEX } from \"./shared\";\nimport \"./styles.css\";\n\ntype Props = {\n onClick: () => void;\n positioned?: boolean;\n};\n\nexport const KnockButton = ({ onClick, positioned = true }: Props) => {\n return (\n <Button\n onClick={onClick}\n {...(positioned && {\n position: \"fixed\" as const,\n top: \"4\" as const,\n right: \"4\" as const,\n style: { zIndex: TOOLBAR_Z_INDEX },\n })}\n bg=\"surface-2\"\n shadow=\"3\"\n rounded=\"3\"\n w=\"10\"\n h=\"10\"\n variant=\"soft\"\n data-tgph-appearance=\"dark\"\n aria-label=\"Expand guide toolbar\"\n >\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n style={{\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%)\",\n }}\n >\n <path\n d=\"M11.6001 32.4V7.59998H16.6365V21.8219H16.7774L22.3067 14.8525H27.9418L21.8138 22.0696L28.4001 32.4H22.7996L18.8555 25.572L16.6365 28.0839V32.4H11.6001Z\"\n fill=\"#EDEEEF\"\n />\n <path\n d=\"M28.4 10.4C28.4 11.9464 27.1467 13.2 25.6 13.2C24.0534 13.2 22.8 11.9464 22.8 10.4C22.8 8.85358 24.0534 7.59998 25.6 7.59998C27.1467 7.59998 28.4 8.85358 28.4 10.4Z\"\n fill=\"#FF573A\"\n />\n </svg>\n </Button>\n );\n};\n"],"names":["KnockButton","onClick","positioned","React","Button","position","top","right","style","zIndex","TOOLBAR_Z_INDEX","left","transform"],"mappings":";;;;AAUO,MAAMA,IAAcA,CAAC;AAAA,EAAEC,SAAAA;AAAAA,EAASC,YAAAA,IAAa;AAAY,MAE3DC,gBAAAA,EAAA,cAAAC,GAAA,EACC,SAAAH,GACKC,GAAAA,KAAc;AAAA,EACjBG,UAAU;AAAA,EACVC,KAAK;AAAA,EACLC,OAAO;AAAA,EACPC,OAAO;AAAA,IAAEC,QAAQC;AAAAA,EAAAA;AAAgB,GAEnC,IAAG,aACH,QAAO,KACP,SAAQ,KACR,GAAE,MACF,GAAE,MACF,SAAQ,QACR,wBAAqB,QACrB,cAAW,uBAEX,GAAAP,gBAAAA,EAAA,cAAC,OACC,EAAA,OAAM,MACN,QAAO,MACP,SAAQ,aACR,MAAK,QACL,OAAM,8BACN,OAAO;AAAA,EACLE,UAAU;AAAA,EACVC,KAAK;AAAA,EACLK,MAAM;AAAA,EACNC,WAAW;AAAA,KAGbT,gBAAAA,EAAA,cAAC,QACC,EAAA,GAAE,2JACF,MAAK,UAAS,CAAA,GAEhBA,gBAAAA,EAAA,cAAC,UACC,GAAE,wKACF,MAAK,UAAS,CAAA,CAElB,CACF;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,27 +1,42 @@
|
|
|
1
|
-
import { useGuideContext as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { useGuideContext as E, useStore as y } from "@knocklabs/react-core";
|
|
2
|
+
import { Button as s } from "@telegraph/button";
|
|
3
|
+
import { Icon as m } from "@telegraph/icon";
|
|
4
|
+
import { Stack as t, Box as g } from "@telegraph/layout";
|
|
5
|
+
import { Tooltip as p } from "@telegraph/tooltip";
|
|
6
|
+
import { Text as n } from "@telegraph/typography";
|
|
7
|
+
import { ChevronDown as f, ChevronRight as x, Info as d } from "lucide-react";
|
|
5
8
|
import * as e from "react";
|
|
6
|
-
const
|
|
9
|
+
const C = () => {
|
|
7
10
|
const {
|
|
8
11
|
client: a
|
|
9
|
-
} =
|
|
10
|
-
|
|
12
|
+
} = E(), [l, u] = e.useState(!1), {
|
|
13
|
+
defaultGroup: o,
|
|
14
|
+
debugSettings: r
|
|
15
|
+
} = y(a.store, (i) => ({
|
|
16
|
+
defaultGroup: i.guideGroups[0],
|
|
17
|
+
debugSettings: i.debug || {}
|
|
18
|
+
})), c = (o == null ? void 0 : o.display_interval) ?? null;
|
|
19
|
+
return /* @__PURE__ */ e.createElement(t, { direction: "column", borderTop: "px" }, /* @__PURE__ */ e.createElement(t, { h: "5", px: "2", bg: "gray-3", align: "center", gap: "1", style: {
|
|
11
20
|
cursor: "pointer"
|
|
12
|
-
}, onClick: () =>
|
|
21
|
+
}, onClick: () => u((i) => !i) }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "More"), l ? /* @__PURE__ */ e.createElement(f, { size: 12 }) : /* @__PURE__ */ e.createElement(x, { size: 12 })), l && /* @__PURE__ */ e.createElement(t, { direction: "column" }, /* @__PURE__ */ e.createElement(t, { align: "center", justify: "space-between", py: "1", px: "2", borderTop: "px" }, /* @__PURE__ */ e.createElement(t, { align: "center", gap: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "Client-only engagement"), /* @__PURE__ */ e.createElement(p, { label: "Contain engagement actions to the client side only while in preview without sending engagement events to the API" }, /* @__PURE__ */ e.createElement(m, { icon: d, size: "0", color: "gray", "aria-hidden": !0 }))), /* @__PURE__ */ e.createElement(s, { size: "0", variant: "soft", color: r.skipEngagementTracking ? "green" : "gray", onClick: () => a.setDebug({
|
|
22
|
+
...r,
|
|
23
|
+
skipEngagementTracking: !r.skipEngagementTracking
|
|
24
|
+
}) }, r.skipEngagementTracking ? "On" : "Off")), /* @__PURE__ */ e.createElement(t, { direction: "column", py: "1", px: "2" }, /* @__PURE__ */ e.createElement(t, { align: "center", justify: "space-between" }, /* @__PURE__ */ e.createElement(t, { align: "center", gap: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "Suspend throttling"), /* @__PURE__ */ e.createElement(p, { label: "Suspend throttling during preview, and show next guide immediately" }, /* @__PURE__ */ e.createElement(m, { icon: d, size: "0", color: "gray", "aria-hidden": !0 }))), /* @__PURE__ */ e.createElement(s, { size: "0", variant: "soft", color: r.ignoreDisplayInterval ? "green" : "gray", onClick: () => a.setDebug({
|
|
25
|
+
...r,
|
|
26
|
+
ignoreDisplayInterval: !r.ignoreDisplayInterval
|
|
27
|
+
}) }, r.ignoreDisplayInterval ? "On" : "Off")), /* @__PURE__ */ e.createElement(t, { direction: "row", gap: "0_5", py: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", color: "gray" }, "Throttle:", " ", r.ignoreDisplayInterval ? "(ignored)" : c === null ? "(none)" : `Every ${c}s`))), /* @__PURE__ */ e.createElement(t, { direction: "column", py: "1", px: "2", borderTop: "px" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "Target params"), /* @__PURE__ */ e.createElement(t, { direction: "column", gap: "0_5", mt: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", color: "gray" }, "Tenant"), /* @__PURE__ */ e.createElement(n, { as: "code", size: "0" }, a.targetParams.tenant ? /* @__PURE__ */ e.createElement(g, { rounded: "2", overflow: "auto", backgroundColor: "gray-2", border: "px", style: {
|
|
13
28
|
maxHeight: "200px"
|
|
14
29
|
} }, /* @__PURE__ */ e.createElement("pre", { style: {
|
|
15
30
|
fontSize: "11px",
|
|
16
31
|
margin: 0
|
|
17
|
-
} }, /* @__PURE__ */ e.createElement("code", null, a.targetParams.tenant))) : /* @__PURE__ */ e.createElement(
|
|
32
|
+
} }, /* @__PURE__ */ e.createElement("code", null, a.targetParams.tenant))) : /* @__PURE__ */ e.createElement(n, { as: "code", size: "0" }, "-"))), /* @__PURE__ */ e.createElement(t, { direction: "column", gap: "0_5" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", color: "gray" }, "Data"), a.targetParams.data ? /* @__PURE__ */ e.createElement(g, { rounded: "2", overflow: "auto", backgroundColor: "gray-2", border: "px", style: {
|
|
18
33
|
maxHeight: "200px"
|
|
19
34
|
} }, /* @__PURE__ */ e.createElement("pre", { style: {
|
|
20
35
|
fontSize: "11px",
|
|
21
36
|
margin: 0
|
|
22
|
-
} }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(a.targetParams.data, null, 2)))) : /* @__PURE__ */ e.createElement(
|
|
37
|
+
} }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(a.targetParams.data, null, 2)))) : /* @__PURE__ */ e.createElement(n, { as: "code", size: "0" }, "-")))));
|
|
23
38
|
};
|
|
24
39
|
export {
|
|
25
|
-
|
|
40
|
+
C as GuideContextDetails
|
|
26
41
|
};
|
|
27
42
|
//# sourceMappingURL=GuideContextDetails.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideContextDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport { ChevronDown, ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const defaultGroup = useStore(client.store, (state) => state.guideGroups[0]);\n const displayInterval = defaultGroup?.display_interval ?? null;\n\n return (\n <Stack direction=\"column\" borderTop=\"px\">\n <Stack\n h=\"5\"\n px=\"2\"\n bg=\"gray-3\"\n align=\"center\"\n gap=\"1\"\n style={{ cursor: \"pointer\" }}\n onClick={() => setIsExpanded((prev) => !prev)}\n >\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n
|
|
1
|
+
{"version":3,"file":"GuideContextDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.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 { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { ChevronDown, ChevronRight, Info } from \"lucide-react\";\nimport * as React from \"react\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const { defaultGroup, debugSettings } = useStore(client.store, (state) => {\n return {\n defaultGroup: state.guideGroups[0],\n debugSettings: state.debug || {},\n };\n });\n const displayInterval = defaultGroup?.display_interval ?? null;\n\n return (\n <Stack direction=\"column\" borderTop=\"px\">\n <Stack\n h=\"5\"\n px=\"2\"\n bg=\"gray-3\"\n align=\"center\"\n gap=\"1\"\n style={{ cursor: \"pointer\" }}\n onClick={() => setIsExpanded((prev) => !prev)}\n >\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n More\n </Text>\n {isExpanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />}\n </Stack>\n\n {isExpanded && (\n <Stack direction=\"column\">\n <Stack\n align=\"center\"\n justify=\"space-between\"\n py=\"1\"\n px=\"2\"\n borderTop=\"px\"\n >\n <Stack align=\"center\" gap=\"1\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Client-only engagement\n </Text>\n <Tooltip label=\"Contain engagement actions to the client side only while in preview without sending engagement events to the API\">\n <Icon icon={Info} size=\"0\" color=\"gray\" aria-hidden />\n </Tooltip>\n </Stack>\n <Button\n size=\"0\"\n variant=\"soft\"\n color={debugSettings.skipEngagementTracking ? \"green\" : \"gray\"}\n onClick={() =>\n client.setDebug({\n ...debugSettings,\n skipEngagementTracking: !debugSettings.skipEngagementTracking,\n })\n }\n >\n {debugSettings.skipEngagementTracking ? \"On\" : \"Off\"}\n </Button>\n </Stack>\n\n <Stack direction=\"column\" py=\"1\" px=\"2\">\n <Stack align=\"center\" justify=\"space-between\">\n <Stack align=\"center\" gap=\"1\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Suspend throttling\n </Text>\n <Tooltip label=\"Suspend throttling during preview, and show next guide immediately\">\n <Icon icon={Info} size=\"0\" color=\"gray\" aria-hidden />\n </Tooltip>\n </Stack>\n <Button\n size=\"0\"\n variant=\"soft\"\n color={debugSettings.ignoreDisplayInterval ? \"green\" : \"gray\"}\n onClick={() =>\n client.setDebug({\n ...debugSettings,\n ignoreDisplayInterval: !debugSettings.ignoreDisplayInterval,\n })\n }\n >\n {debugSettings.ignoreDisplayInterval ? \"On\" : \"Off\"}\n </Button>\n </Stack>\n <Stack direction=\"row\" gap=\"0_5\" py=\"1\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Throttle:{\" \"}\n {debugSettings.ignoreDisplayInterval\n ? \"(ignored)\"\n : displayInterval === null\n ? \"(none)\"\n : `Every ${displayInterval}s`}\n </Text>\n </Stack>\n </Stack>\n\n <Stack direction=\"column\" py=\"1\" px=\"2\" borderTop=\"px\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Target params\n </Text>\n <Stack direction=\"column\" gap=\"0_5\" mt=\"1\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Tenant\n </Text>\n <Text as=\"code\" size=\"0\">\n {client.targetParams.tenant ? (\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"gray-2\"\n border=\"px\"\n style={{ maxHeight: \"200px\" }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>{client.targetParams.tenant}</code>\n </pre>\n </Box>\n ) : (\n <Text as=\"code\" size=\"0\">\n -\n </Text>\n )}\n </Text>\n </Stack>\n\n <Stack direction=\"column\" gap=\"0_5\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Data\n </Text>\n {client.targetParams.data ? (\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"gray-2\"\n border=\"px\"\n style={{ maxHeight: \"200px\" }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>\n {JSON.stringify(client.targetParams.data, null, 2)}\n </code>\n </pre>\n </Box>\n ) : (\n <Text as=\"code\" size=\"0\">\n -\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n )}\n </Stack>\n );\n};\n"],"names":["GuideContextDetails","client","useGuideContext","isExpanded","setIsExpanded","React","useState","defaultGroup","debugSettings","useStore","store","state","guideGroups","debug","displayInterval","display_interval","Stack","cursor","prev","Text","ChevronDown","ChevronRight","Tooltip","Icon","Info","Button","skipEngagementTracking","setDebug","ignoreDisplayInterval","targetParams","tenant","Box","maxHeight","fontSize","margin","data","JSON","stringify"],"mappings":";;;;;;;;AASO,MAAMA,IAAsBA,MAAM;AACjC,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAC7B,CAACC,GAAYC,CAAa,IAAIC,EAAMC,SAAS,EAAK,GAElD;AAAA,IAAEC,cAAAA;AAAAA,IAAcC,eAAAA;AAAAA,EAAkBC,IAAAA,EAASR,EAAOS,OAAQC,CAAUA,OACjE;AAAA,IACLJ,cAAcI,EAAMC,YAAY,CAAC;AAAA,IACjCJ,eAAeG,EAAME,SAAS,CAAA;AAAA,EAChC,EACD,GACKC,KAAkBP,KAAAA,gBAAAA,EAAcQ,qBAAoB;AAE1D,yCACGC,GAAM,EAAA,WAAU,UAAS,WAAU,KAAA,mCACjCA,GACC,EAAA,GAAE,KACF,IAAG,KACH,IAAG,UACH,OAAM,UACN,KAAI,KACJ,OAAO;AAAA,IAAEC,QAAQ;AAAA,EAAU,GAC3B,SAAS,MAAMb,EAAec,OAAS,CAACA,CAAI,KAE3C,gBAAAb,EAAA,cAAAc,GAAA,EAAK,IAAG,QAAO,MAAK,KAAI,QAAO,YAAQ,MAExC,GACChB,oCAAciB,GAAY,EAAA,MAAM,GAAM,CAAA,IAAG,gBAAAf,EAAA,cAACgB,KAAa,MAAM,GAAM,CAAA,CACtE,GAEClB,qCACEa,GAAM,EAAA,WAAU,YACd,gBAAAX,EAAA,cAAAW,GAAA,EACC,OAAM,UACN,SAAQ,iBACR,IAAG,KACH,IAAG,KACH,WAAU,KAAA,mCAETA,GAAM,EAAA,OAAM,UAAS,KAAI,IAAA,mCACvBG,GAAK,EAAA,IAAG,QAAO,MAAK,KAAI,QAAO,YAAQ,wBAExC,GACC,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vC,gBAAA7B,EAAA,cAAA,QAAA,MACE+B,KAAKC,UAAUpC,EAAO4B,aAAaM,MAAM,MAAM,CAAC,CACnD,CACF,CACF,IAEA,gBAAA9B,EAAA,cAACc,GAAK,EAAA,IAAG,QAAO,MAAK,OAAG,GAExB,CAEJ,CACF,CACF,CAEJ;AAEJ;"}
|
|
@@ -1,27 +1,57 @@
|
|
|
1
1
|
import * as t from "@radix-ui/react-hover-card";
|
|
2
|
-
import {
|
|
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";
|
|
3
5
|
import * as e from "react";
|
|
4
|
-
import { isUnknownGuide as
|
|
5
|
-
const
|
|
6
|
-
children:
|
|
7
|
-
guide:
|
|
6
|
+
import { isUnknownGuide as s } from "./useInspectGuideClientStore.mjs";
|
|
7
|
+
const v = ({
|
|
8
|
+
children: n,
|
|
9
|
+
guide: r
|
|
8
10
|
}) => {
|
|
9
|
-
if (
|
|
10
|
-
return /* @__PURE__ */ e.createElement(
|
|
11
|
+
if (s(r))
|
|
12
|
+
return /* @__PURE__ */ e.createElement(o, { align: "center" }, n);
|
|
11
13
|
const {
|
|
12
|
-
annotation:
|
|
13
|
-
activation_location_rules:
|
|
14
|
-
priority:
|
|
15
|
-
...
|
|
16
|
-
} =
|
|
17
|
-
return /* @__PURE__ */ e.createElement(t.Root, null, /* @__PURE__ */ e.createElement(t.Trigger, null, /* @__PURE__ */ e.createElement(
|
|
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: {
|
|
18
20
|
width: "450px",
|
|
19
21
|
maxHeight: "600px"
|
|
20
|
-
} }, /* @__PURE__ */ e.createElement("
|
|
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: {
|
|
21
51
|
fontSize: "11px"
|
|
22
|
-
} }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(
|
|
52
|
+
} }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(l, null, 2)))), /* @__PURE__ */ e.createElement(t.Arrow, null))));
|
|
23
53
|
};
|
|
24
54
|
export {
|
|
25
|
-
|
|
55
|
+
v as GuideHoverCard
|
|
26
56
|
};
|
|
27
57
|
//# sourceMappingURL=GuideHoverCard.mjs.map
|