@knocklabs/react 0.12.1 → 0.13.1
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 +39 -0
- package/dist/cjs/_virtual/_rolldown/runtime.js +1 -0
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/modules/core/components/Button/Button.js +2 -2
- package/dist/cjs/modules/core/components/Button/Button.js.map +1 -1
- package/dist/cjs/modules/core/components/Button/ButtonGroup.js +2 -2
- package/dist/cjs/modules/core/components/Button/ButtonGroup.js.map +1 -1
- package/dist/cjs/modules/core/components/Button/ButtonSpinner.js +2 -2
- package/dist/cjs/modules/core/components/Button/ButtonSpinner.js.map +1 -1
- package/dist/cjs/modules/core/components/Button/index.js +1 -0
- package/dist/cjs/modules/core/components/Icons/Bell.js +2 -2
- package/dist/cjs/modules/core/components/Icons/Bell.js.map +1 -1
- package/dist/cjs/modules/core/components/Icons/CheckmarkCircle.js +2 -2
- package/dist/cjs/modules/core/components/Icons/CheckmarkCircle.js.map +1 -1
- package/dist/cjs/modules/core/components/Icons/ChevronDown.js +2 -2
- package/dist/cjs/modules/core/components/Icons/ChevronDown.js.map +1 -1
- package/dist/cjs/modules/core/components/Icons/CloseCircle.js +2 -2
- package/dist/cjs/modules/core/components/Icons/CloseCircle.js.map +1 -1
- package/dist/cjs/modules/core/components/Icons/index.js +1 -0
- package/dist/cjs/modules/core/components/Spinner/Spinner.js +3 -3
- package/dist/cjs/modules/core/components/Spinner/Spinner.js.map +1 -1
- package/dist/cjs/modules/core/components/Spinner/index.js +1 -0
- package/dist/cjs/modules/core/cx/index.js +2 -2
- package/dist/cjs/modules/core/cx/index.js.map +1 -1
- package/dist/cjs/modules/core/debounce/index.js +2 -2
- package/dist/cjs/modules/core/debounce/index.js.map +1 -1
- package/dist/cjs/modules/core/hooks/index.js +1 -0
- package/dist/cjs/modules/core/hooks/useComponentVisible.js +2 -2
- package/dist/cjs/modules/core/hooks/useComponentVisible.js.map +1 -1
- package/dist/cjs/modules/core/hooks/useOnBottomScroll.js +2 -2
- package/dist/cjs/modules/core/hooks/useOnBottomScroll.js.map +1 -1
- package/dist/cjs/modules/core/index.js +1 -0
- package/dist/cjs/modules/core/utils.js +2 -2
- package/dist/cjs/modules/core/utils.js.map +1 -1
- package/dist/cjs/modules/feed/components/EmptyFeed/EmptyFeed.js +2 -2
- package/dist/cjs/modules/feed/components/EmptyFeed/EmptyFeed.js.map +1 -1
- package/dist/cjs/modules/feed/components/EmptyFeed/index.js +1 -0
- package/dist/cjs/modules/feed/components/NotificationCell/ArchiveButton.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationCell/ArchiveButton.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationCell/Avatar.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationCell/Avatar.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationCell/NotificationCell.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationCell/NotificationCell.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationCell/index.js +1 -0
- package/dist/cjs/modules/feed/components/NotificationFeed/Dropdown.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationFeed/Dropdown.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationFeed/MarkAsRead.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationFeed/MarkAsRead.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationFeed/NotificationFeed.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationFeed/NotificationFeed.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationFeed/NotificationFeedHeader.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationFeed/NotificationFeedHeader.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationFeed/index.js +1 -0
- package/dist/cjs/modules/feed/components/NotificationFeedContainer/NotificationFeedContainer.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationFeedContainer/NotificationFeedContainer.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationFeedContainer/index.js +1 -0
- package/dist/cjs/modules/feed/components/NotificationFeedPopover/NotificationFeedPopover.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationFeedPopover/NotificationFeedPopover.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationFeedPopover/index.js +1 -0
- package/dist/cjs/modules/feed/components/NotificationIconButton/NotificationIconButton.js +2 -2
- package/dist/cjs/modules/feed/components/NotificationIconButton/NotificationIconButton.js.map +1 -1
- package/dist/cjs/modules/feed/components/NotificationIconButton/index.js +1 -0
- package/dist/cjs/modules/feed/components/UnseenBadge/UnseenBadge.js +2 -2
- package/dist/cjs/modules/feed/components/UnseenBadge/UnseenBadge.js.map +1 -1
- package/dist/cjs/modules/feed/components/UnseenBadge/index.js +1 -0
- package/dist/cjs/modules/feed/index.js +1 -0
- package/dist/cjs/modules/guide/components/Banner/Banner.js +2 -2
- package/dist/cjs/modules/guide/components/Banner/Banner.js.map +1 -1
- package/dist/cjs/modules/guide/components/Banner/index.js +1 -0
- package/dist/cjs/modules/guide/components/Card/Card.js +2 -2
- package/dist/cjs/modules/guide/components/Card/Card.js.map +1 -1
- package/dist/cjs/modules/guide/components/Card/index.js +1 -0
- package/dist/cjs/modules/guide/components/Modal/Modal.js +2 -2
- package/dist/cjs/modules/guide/components/Modal/Modal.js.map +1 -1
- package/dist/cjs/modules/guide/components/Modal/index.js +1 -0
- package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/FocusChin.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRowDetails.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/Kbd.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/Kbd.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/helpers.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/index.js +1 -0
- package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/index.js +1 -0
- package/dist/cjs/modules/guide/components/Toolbar/shared.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/shared.js.map +1 -1
- package/dist/cjs/modules/guide/components/Toolbar/styles.inline.js +2 -0
- package/dist/cjs/modules/guide/components/Toolbar/styles.inline.js.map +1 -0
- package/dist/cjs/modules/guide/components/Toolbar/useToolbarStyles.js +2 -2
- package/dist/cjs/modules/guide/components/Toolbar/useToolbarStyles.js.map +1 -1
- package/dist/cjs/modules/guide/components/helpers.js +2 -2
- package/dist/cjs/modules/guide/components/helpers.js.map +1 -1
- package/dist/cjs/modules/guide/components/index.js +1 -0
- package/dist/cjs/modules/guide/index.js +1 -0
- package/dist/cjs/modules/guide/providers/KnockGuideProvider.js +2 -2
- package/dist/cjs/modules/guide/providers/KnockGuideProvider.js.map +1 -1
- package/dist/cjs/modules/guide/providers/index.js +1 -0
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthButton/index.js +1 -0
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthContainer/MsTeamsAuthContainer.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthContainer/MsTeamsAuthContainer.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsAuthContainer/index.js +1 -0
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelCombobox.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelCombobox.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelInTeamCombobox.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelInTeamCombobox.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsConnectionError.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsConnectionError.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsErrorMessage.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsErrorMessage.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsTeamCombobox.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsTeamCombobox.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsChannelCombobox/index.js +1 -0
- package/dist/cjs/modules/ms-teams/components/MsTeamsIcon/MsTeamsIcon.js +2 -2
- package/dist/cjs/modules/ms-teams/components/MsTeamsIcon/MsTeamsIcon.js.map +1 -1
- package/dist/cjs/modules/ms-teams/components/MsTeamsIcon/index.js +1 -0
- package/dist/cjs/modules/ms-teams/index.js +1 -0
- package/dist/cjs/modules/ms-teams/utils.js +2 -2
- package/dist/cjs/modules/ms-teams/utils.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackAddChannelInput/SlackAddChannelInput.js +2 -2
- package/dist/cjs/modules/slack/components/SlackAddChannelInput/SlackAddChannelInput.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackAuthButton/SlackAuthButton.js +2 -2
- package/dist/cjs/modules/slack/components/SlackAuthButton/SlackAuthButton.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackAuthButton/index.js +1 -0
- package/dist/cjs/modules/slack/components/SlackAuthContainer/SlackAuthContainer.js +2 -2
- package/dist/cjs/modules/slack/components/SlackAuthContainer/SlackAuthContainer.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackAuthContainer/index.js +1 -0
- package/dist/cjs/modules/slack/components/SlackChannelCombobox/SlackChannelCombobox.js +2 -2
- package/dist/cjs/modules/slack/components/SlackChannelCombobox/SlackChannelCombobox.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackChannelCombobox/SlackConnectionError.js +2 -2
- package/dist/cjs/modules/slack/components/SlackChannelCombobox/SlackConnectionError.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackChannelCombobox/SlackErrorMessage.js +2 -2
- package/dist/cjs/modules/slack/components/SlackChannelCombobox/SlackErrorMessage.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackChannelCombobox/index.js +1 -0
- package/dist/cjs/modules/slack/components/SlackIcon/SlackIcon.js +2 -2
- package/dist/cjs/modules/slack/components/SlackIcon/SlackIcon.js.map +1 -1
- package/dist/cjs/modules/slack/components/SlackIcon/index.js +1 -0
- package/dist/cjs/modules/slack/index.js +1 -0
- package/dist/cjs/modules/slack/utils.js +2 -2
- package/dist/cjs/modules/slack/utils.js.map +1 -1
- package/dist/cjs/next/KnockGuideLocationSensor.js +2 -2
- package/dist/cjs/next/KnockGuideLocationSensor.js.map +1 -1
- package/dist/cjs/next.js +1 -2
- package/dist/cjs/tanstack/KnockGuideLocationSensor.js +2 -2
- package/dist/cjs/tanstack/KnockGuideLocationSensor.js.map +1 -1
- package/dist/cjs/tanstack.js +1 -2
- package/dist/esm/index.mjs +36 -118
- package/dist/esm/modules/core/components/Button/Button.mjs +28 -21
- package/dist/esm/modules/core/components/Button/Button.mjs.map +1 -1
- package/dist/esm/modules/core/components/Button/ButtonGroup.mjs +11 -9
- package/dist/esm/modules/core/components/Button/ButtonGroup.mjs.map +1 -1
- package/dist/esm/modules/core/components/Button/ButtonSpinner.mjs +13 -10
- package/dist/esm/modules/core/components/Button/ButtonSpinner.mjs.map +1 -1
- package/dist/esm/modules/core/components/Button/index.mjs +3 -0
- package/dist/esm/modules/core/components/Icons/Bell.mjs +26 -10
- package/dist/esm/modules/core/components/Icons/Bell.mjs.map +1 -1
- package/dist/esm/modules/core/components/Icons/CheckmarkCircle.mjs +26 -10
- package/dist/esm/modules/core/components/Icons/CheckmarkCircle.mjs.map +1 -1
- package/dist/esm/modules/core/components/Icons/ChevronDown.mjs +21 -10
- package/dist/esm/modules/core/components/Icons/ChevronDown.mjs.map +1 -1
- package/dist/esm/modules/core/components/Icons/CloseCircle.mjs +18 -10
- package/dist/esm/modules/core/components/Icons/CloseCircle.mjs.map +1 -1
- package/dist/esm/modules/core/components/Icons/index.mjs +5 -0
- package/dist/esm/modules/core/components/Spinner/Spinner.mjs +40 -30
- package/dist/esm/modules/core/components/Spinner/Spinner.mjs.map +1 -1
- package/dist/esm/modules/core/components/Spinner/index.mjs +2 -0
- package/dist/esm/modules/core/cx/index.mjs +6 -5
- package/dist/esm/modules/core/cx/index.mjs.map +1 -1
- package/dist/esm/modules/core/debounce/index.mjs +14 -14
- package/dist/esm/modules/core/debounce/index.mjs.map +1 -1
- package/dist/esm/modules/core/hooks/index.mjs +2 -0
- package/dist/esm/modules/core/hooks/useComponentVisible.mjs +17 -18
- package/dist/esm/modules/core/hooks/useComponentVisible.mjs.map +1 -1
- package/dist/esm/modules/core/hooks/useOnBottomScroll.mjs +21 -21
- package/dist/esm/modules/core/hooks/useOnBottomScroll.mjs.map +1 -1
- package/dist/esm/modules/core/index.mjs +14 -0
- package/dist/esm/modules/core/utils.mjs +10 -11
- package/dist/esm/modules/core/utils.mjs.map +1 -1
- package/dist/esm/modules/feed/components/EmptyFeed/EmptyFeed.mjs +23 -14
- package/dist/esm/modules/feed/components/EmptyFeed/EmptyFeed.mjs.map +1 -1
- package/dist/esm/modules/feed/components/EmptyFeed/index.mjs +2 -0
- package/dist/esm/modules/feed/components/NotificationCell/ArchiveButton.mjs +42 -40
- package/dist/esm/modules/feed/components/NotificationCell/ArchiveButton.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationCell/Avatar.mjs +24 -15
- package/dist/esm/modules/feed/components/NotificationCell/Avatar.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationCell/NotificationCell.mjs +88 -64
- package/dist/esm/modules/feed/components/NotificationCell/NotificationCell.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationCell/index.mjs +3 -0
- package/dist/esm/modules/feed/components/NotificationFeed/Dropdown.mjs +22 -17
- package/dist/esm/modules/feed/components/NotificationFeed/Dropdown.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationFeed/MarkAsRead.mjs +26 -21
- package/dist/esm/modules/feed/components/NotificationFeed/MarkAsRead.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationFeed/NotificationFeed.mjs +78 -68
- package/dist/esm/modules/feed/components/NotificationFeed/NotificationFeed.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationFeed/NotificationFeedHeader.mjs +33 -17
- package/dist/esm/modules/feed/components/NotificationFeed/NotificationFeedHeader.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationFeed/index.mjs +4 -0
- package/dist/esm/modules/feed/components/NotificationFeedContainer/NotificationFeedContainer.mjs +11 -9
- package/dist/esm/modules/feed/components/NotificationFeedContainer/NotificationFeedContainer.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationFeedContainer/index.mjs +2 -0
- package/dist/esm/modules/feed/components/NotificationFeedPopover/NotificationFeedPopover.mjs +62 -65
- package/dist/esm/modules/feed/components/NotificationFeedPopover/NotificationFeedPopover.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationFeedPopover/index.mjs +2 -0
- package/dist/esm/modules/feed/components/NotificationIconButton/NotificationIconButton.mjs +22 -17
- package/dist/esm/modules/feed/components/NotificationIconButton/NotificationIconButton.mjs.map +1 -1
- package/dist/esm/modules/feed/components/NotificationIconButton/index.mjs +2 -0
- package/dist/esm/modules/feed/components/UnseenBadge/UnseenBadge.mjs +27 -23
- package/dist/esm/modules/feed/components/UnseenBadge/UnseenBadge.mjs.map +1 -1
- package/dist/esm/modules/feed/components/UnseenBadge/index.mjs +2 -0
- package/dist/esm/modules/feed/index.mjs +18 -0
- package/dist/esm/modules/guide/components/Banner/Banner.mjs +138 -129
- package/dist/esm/modules/guide/components/Banner/Banner.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Banner/index.mjs +2 -0
- package/dist/esm/modules/guide/components/Card/Card.mjs +184 -167
- package/dist/esm/modules/guide/components/Card/Card.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Card/index.mjs +2 -0
- package/dist/esm/modules/guide/components/Modal/Modal.mjs +188 -168
- package/dist/esm/modules/guide/components/Modal/Modal.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Modal/index.mjs +2 -0
- package/dist/esm/modules/guide/components/Toolbar/KnockButton.mjs +46 -24
- package/dist/esm/modules/guide/components/Toolbar/KnockButton.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs +174 -111
- package/dist/esm/modules/guide/components/Toolbar/V2/FocusChin.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs +82 -19
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +189 -47
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +229 -143
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs +180 -68
- package/dist/esm/modules/guide/components/Toolbar/V2/GuideRowDetails.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/Kbd.mjs +17 -14
- package/dist/esm/modules/guide/components/Toolbar/V2/Kbd.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +315 -159
- package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs +9 -11
- package/dist/esm/modules/guide/components/Toolbar/V2/helpers.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/index.mjs +2 -0
- package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs +66 -74
- package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +136 -192
- package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/index.mjs +3 -0
- package/dist/esm/modules/guide/components/Toolbar/shared.mjs +6 -5
- package/dist/esm/modules/guide/components/Toolbar/shared.mjs.map +1 -1
- package/dist/esm/modules/guide/components/Toolbar/styles.inline.mjs +6 -0
- package/dist/esm/modules/guide/components/Toolbar/styles.inline.mjs.map +1 -0
- package/dist/esm/modules/guide/components/Toolbar/useToolbarStyles.mjs +13 -12
- package/dist/esm/modules/guide/components/Toolbar/useToolbarStyles.mjs.map +1 -1
- package/dist/esm/modules/guide/components/helpers.mjs +15 -15
- package/dist/esm/modules/guide/components/helpers.mjs.map +1 -1
- package/dist/esm/modules/guide/components/index.mjs +9 -0
- package/dist/esm/modules/guide/index.mjs +8 -0
- package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs +19 -17
- package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs.map +1 -1
- package/dist/esm/modules/guide/providers/index.mjs +2 -0
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.mjs +78 -52
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthButton/index.mjs +2 -0
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthContainer/MsTeamsAuthContainer.mjs +33 -16
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthContainer/MsTeamsAuthContainer.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsAuthContainer/index.mjs +2 -0
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelCombobox.mjs +60 -28
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelCombobox.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelInTeamCombobox.mjs +47 -39
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelInTeamCombobox.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsConnectionError.mjs +11 -14
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsConnectionError.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsErrorMessage.mjs +23 -11
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsErrorMessage.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsTeamCombobox.mjs +41 -33
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsTeamCombobox.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsChannelCombobox/index.mjs +2 -0
- package/dist/esm/modules/ms-teams/components/MsTeamsIcon/MsTeamsIcon.mjs +99 -15
- package/dist/esm/modules/ms-teams/components/MsTeamsIcon/MsTeamsIcon.mjs.map +1 -1
- package/dist/esm/modules/ms-teams/components/MsTeamsIcon/index.mjs +2 -0
- package/dist/esm/modules/ms-teams/index.mjs +7 -0
- package/dist/esm/modules/ms-teams/utils.mjs +6 -5
- package/dist/esm/modules/ms-teams/utils.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackAddChannelInput/SlackAddChannelInput.mjs +48 -32
- package/dist/esm/modules/slack/components/SlackAddChannelInput/SlackAddChannelInput.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackAuthButton/SlackAuthButton.mjs +82 -58
- package/dist/esm/modules/slack/components/SlackAuthButton/SlackAuthButton.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackAuthButton/index.mjs +2 -0
- package/dist/esm/modules/slack/components/SlackAuthContainer/SlackAuthContainer.mjs +33 -16
- package/dist/esm/modules/slack/components/SlackAuthContainer/SlackAuthContainer.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackAuthContainer/index.mjs +2 -0
- package/dist/esm/modules/slack/components/SlackChannelCombobox/SlackChannelCombobox.mjs +100 -66
- package/dist/esm/modules/slack/components/SlackChannelCombobox/SlackChannelCombobox.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackChannelCombobox/SlackConnectionError.mjs +11 -14
- package/dist/esm/modules/slack/components/SlackChannelCombobox/SlackConnectionError.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackChannelCombobox/SlackErrorMessage.mjs +23 -11
- package/dist/esm/modules/slack/components/SlackChannelCombobox/SlackErrorMessage.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackChannelCombobox/index.mjs +2 -0
- package/dist/esm/modules/slack/components/SlackIcon/SlackIcon.mjs +32 -12
- package/dist/esm/modules/slack/components/SlackIcon/SlackIcon.mjs.map +1 -1
- package/dist/esm/modules/slack/components/SlackIcon/index.mjs +2 -0
- package/dist/esm/modules/slack/index.mjs +7 -0
- package/dist/esm/modules/slack/utils.mjs +6 -5
- package/dist/esm/modules/slack/utils.mjs.map +1 -1
- package/dist/esm/next/KnockGuideLocationSensor.mjs +37 -37
- package/dist/esm/next/KnockGuideLocationSensor.mjs.map +1 -1
- package/dist/esm/next.mjs +2 -5
- package/dist/esm/tanstack/KnockGuideLocationSensor.mjs +16 -19
- package/dist/esm/tanstack/KnockGuideLocationSensor.mjs.map +1 -1
- package/dist/esm/tanstack.mjs +2 -5
- package/dist/index.css +1 -1
- package/package.json +20 -22
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/modules/guide/components/Toolbar/styles.css.inline.js +0 -2
- package/dist/cjs/modules/guide/components/Toolbar/styles.css.inline.js.map +0 -1
- package/dist/cjs/next.js.map +0 -1
- package/dist/cjs/tanstack.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/modules/guide/components/Toolbar/styles.css.inline.mjs +0 -5
- package/dist/esm/modules/guide/components/Toolbar/styles.css.inline.mjs.map +0 -1
- package/dist/esm/next.mjs.map +0 -1
- package/dist/esm/tanstack.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusChin.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/FocusChin.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { GUIDE_ROW_DATA_SELECTOR } from \"./GuideRow\";\nimport { Kbd } from \"./Kbd\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport { InspectionResultOk } from \"./useInspectGuideClientStore\";\n\n// Extra scroll overshoot so the focused guide plus ~1-2 neighbors are visible,\n// reducing how often consecutive next/prev clicks trigger a scroll.\nconst SCROLL_OVERSHOOT = 60;\n\nconst FOCUS_PREV_HOTKEY = \",\";\nconst FOCUS_NEXT_HOTKEY = \"/\";\n\nconst maybeScrollGuideIntoView = (container: HTMLElement, guideKey: string) => {\n requestAnimationFrame(() => {\n const el = container.querySelector(\n `[${GUIDE_ROW_DATA_SELECTOR}=\"${CSS.escape(guideKey)}\"]`,\n );\n if (!el || !(el instanceof HTMLElement)) return;\n\n const containerRect = container.getBoundingClientRect();\n const elRect = el.getBoundingClientRect();\n\n if (elRect.top < containerRect.top) {\n container.scrollTo({\n top:\n container.scrollTop -\n (containerRect.top - elRect.top) -\n SCROLL_OVERSHOOT,\n behavior: \"smooth\",\n });\n } else if (elRect.bottom > containerRect.bottom) {\n container.scrollTo({\n top:\n container.scrollTop +\n (elRect.bottom - containerRect.bottom) +\n SCROLL_OVERSHOOT,\n behavior: \"smooth\",\n });\n }\n });\n};\n\ntype FocusNav = {\n guides: InspectionResultOk[\"guides\"];\n currentKey: string | undefined;\n focusGuide: (guideKey: string) => void;\n};\n\nconst focusPrev = ({ guides, currentKey, focusGuide }: FocusNav) => {\n const selectableGuides = guides.filter(\n (g) => !!g.annotation.selectable.status,\n );\n if (selectableGuides.length === 0) return;\n\n if (!currentKey) {\n focusGuide(selectableGuides[selectableGuides.length - 1]!.key);\n return;\n }\n\n const currIndex = selectableGuides.findIndex((g) => g.key === currentKey);\n const prevGuide =\n currIndex <= 0 ? undefined : selectableGuides[currIndex - 1];\n if (!prevGuide) return;\n focusGuide(prevGuide.key);\n};\n\nconst focusNext = ({ guides, currentKey, focusGuide }: FocusNav) => {\n const selectableGuides = guides.filter(\n (g) => !!g.annotation.selectable.status,\n );\n if (selectableGuides.length === 0) return;\n\n if (!currentKey) {\n focusGuide(selectableGuides[0]!.key);\n return;\n }\n\n const currIndex = selectableGuides.findIndex((g) => g.key === currentKey);\n const nextGuide =\n currIndex < 0 || currIndex + 1 > selectableGuides.length - 1\n ? undefined\n : selectableGuides[currIndex + 1];\n if (!nextGuide) return;\n focusGuide(nextGuide.key);\n};\n\ntype Props = {\n guides: InspectionResultOk[\"guides\"];\n guideListRef: React.RefObject<HTMLDivElement | null>;\n};\n\nexport const FocusChin = ({ guides, guideListRef }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug,\n }));\n\n const focusedKeys = Object.keys(debugSettings?.focusedGuideKeys || {});\n const isFocused = focusedKeys.length > 0;\n const currentKey = focusedKeys[0];\n\n const focusGuide = React.useCallback(\n (guideKey: string) => {\n client.setDebug({\n ...client.store.state.debug,\n focusedGuideKeys: { [guideKey]: true },\n });\n if (guideListRef.current) {\n maybeScrollGuideIntoView(guideListRef.current, guideKey);\n }\n },\n [client, guideListRef],\n );\n\n // Latest-ref so the window keydown listener below can attach once and always\n // read the current guides / focused key without needing to re-subscribe.\n const latestRef = React.useRef<FocusNav>({ guides, currentKey, focusGuide });\n React.useEffect(() => {\n latestRef.current = { guides, currentKey, focusGuide };\n });\n\n React.useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!e.ctrlKey || e.repeat) return;\n if (e.key === FOCUS_PREV_HOTKEY) {\n e.preventDefault();\n focusPrev(latestRef.current);\n } else if (e.key === FOCUS_NEXT_HOTKEY) {\n e.preventDefault();\n focusNext(latestRef.current);\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, []);\n\n if (!isFocused) {\n return null;\n }\n\n return (\n <Box\n borderTop=\"px\"\n px=\"3\"\n py=\"1\"\n overflow=\"hidden\"\n backgroundColor=\"blue-2\"\n >\n <Stack align=\"center\" justify=\"space-between\" gap=\"4\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"blue\"\n style={{\n display: \"block\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n minWidth: 0,\n }}\n >\n Focus mode: {currentKey}\n </Text>\n <Stack align=\"center\" gap=\"1\" style={{ flexShrink: 0 }}>\n <Tooltip\n label={\n <Text as=\"span\" size=\"1\">\n Focus previous guide\n <Stack display=\"inline-block\" ml=\"3\">\n <Kbd>ctrl</Kbd> + <Kbd>,</Kbd>\n </Stack>\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Button\n size=\"0\"\n variant=\"ghost\"\n color=\"blue\"\n leadingIcon={{ icon: ChevronLeft, alt: \"Previous guide\" }}\n onClick={() => focusPrev(latestRef.current)}\n />\n </Tooltip>\n <Tooltip\n label={\n <Text as=\"span\" size=\"1\">\n Focus next guide\n <Stack display=\"inline-block\" ml=\"3\">\n <Kbd>ctrl</Kbd> + <Kbd>/</Kbd>\n </Stack>\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Button\n size=\"0\"\n variant=\"ghost\"\n color=\"blue\"\n leadingIcon={{ icon: ChevronRight, alt: \"Next guide\" }}\n onClick={() => focusNext(latestRef.current)}\n />\n </Tooltip>\n <Tooltip label=\"Exit focus mode\" {...sharedTooltipProps}>\n <Button\n size=\"0\"\n variant=\"ghost\"\n color=\"blue\"\n leadingIcon={{ icon: X, alt: \"Clear focus\" }}\n onClick={() => {\n client.setDebug({ ...debugSettings, focusedGuideKeys: {} });\n }}\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Box>\n );\n};\n"],"names":["SCROLL_OVERSHOOT","FOCUS_PREV_HOTKEY","FOCUS_NEXT_HOTKEY","maybeScrollGuideIntoView","container","guideKey","requestAnimationFrame","el","querySelector","GUIDE_ROW_DATA_SELECTOR","CSS","escape","HTMLElement","containerRect","getBoundingClientRect","elRect","top","scrollTo","scrollTop","behavior","bottom","focusPrev","guides","currentKey","focusGuide","selectableGuides","filter","g","annotation","selectable","status","length","key","currIndex","findIndex","prevGuide","undefined","focusNext","nextGuide","FocusChin","guideListRef","client","useGuideContext","debugSettings","useStore","store","state","debug","focusedKeys","Object","keys","focusedGuideKeys","isFocused","React","useCallback","setDebug","current","latestRef","useRef","useEffect","handleKeyDown","e","ctrlKey","repeat","preventDefault","addEventListener","removeEventListener","Box","Stack","Text","display","overflow","textOverflow","whiteSpace","minWidth","flexShrink","Tooltip","Kbd","sharedTooltipProps","Button","icon","ChevronLeft","alt","ChevronRight","X"],"mappings":"6rBAeMA,EAAmB,GAEnBC,EAAoB,IACpBC,EAAoB,IAEpBC,EAA2BA,CAACC,EAAwBC,IAAqB,CAC7EC,sBAAsB,IAAM,CACpBC,MAAAA,EAAKH,EAAUI,cACnB,IAAIC,EAAAA,uBAAuB,KAAKC,IAAIC,OAAON,CAAQ,CAAC,IACtD,EACA,GAAI,CAACE,GAAM,EAAEA,aAAcK,aAAc,OAEnCC,MAAAA,EAAgBT,EAAUU,sBAAsB,EAChDC,EAASR,EAAGO,sBAAsB,EAEpCC,EAAOC,IAAMH,EAAcG,IAC7BZ,EAAUa,SAAS,CACjBD,IACEZ,EAAUc,WACTL,EAAcG,IAAMD,EAAOC,KAC5BhB,EACFmB,SAAU,QAAA,CACX,EACQJ,EAAOK,OAASP,EAAcO,QACvChB,EAAUa,SAAS,CACjBD,IACEZ,EAAUc,WACTH,EAAOK,OAASP,EAAcO,QAC/BpB,EACFmB,SAAU,QAAA,CACX,CACH,CACD,CACH,EAQME,EAAYA,CAAC,CAAEC,OAAAA,EAAQC,WAAAA,EAAYC,WAAAA,CAAqB,IAAM,CAC5DC,MAAAA,EAAmBH,EAAOI,OAC7BC,GAAM,CAAC,CAACA,EAAEC,WAAWC,WAA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,eAAe,GAAG,KAC9Bf,EAAA,cAAAwB,EAAAA,IAAA,KAAI,MAAI,EAAM,MAAIxB,EAAA,cAAAwB,MAAA,KAAI,GAAC,CAC1B,CACF,EAEF,GAAIC,oBAEJ,EAAAzB,EAAA,cAAC0B,UACC,KAAK,IACL,QAAQ,QACR,MAAM,OACN,YAAa,CAAEC,KAAMC,EAAAA,YAAaC,IAAK,gBAAiB,EACxD,QAAS,IAAM7D,EAAUoC,EAAUD,OAAO,CAAA,CAAE,CAEhD,EACAH,EAAA,cAACuB,WACC,MACEvB,EAAA,cAACgB,EAAAA,MAAK,GAAG,OAAO,KAAK,GAAG,EAAA,mBAErBhB,EAAA,cAAAe,EAAAA,MAAA,CAAM,QAAQ,eAAe,GAAG,GAC/B,EAAAf,EAAA,cAACwB,WAAI,MAAI,EAAM,MAAIxB,EAAA,cAAAwB,MAAA,KAAI,GAAC,CAC1B,CACF,EAEF,GAAIC,EAAAA,kBAAAA,kBAEHC,EACC,OAAA,CAAA,KAAK,IACL,QAAQ,QACR,MAAM,OACN,YAAa,CAAEC,KAAMG,EAAAA,aAAcD,IAAK,YAAa,EACrD,QAAS,IAAM7C,EAAUoB,EAAUD,OAAO,CAAA,CAAE,CAEhD,EACCH,EAAA,cAAAuB,EAAA,QAAA,CAAQ,MAAM,kBAAsBE,GAAAA,EAAAA,oBACnCzB,EAAA,cAAC0B,EACC,OAAA,CAAA,KAAK,IACL,QAAQ,QACR,MAAM,OACN,YAAa,CAAEC,KAAMI,EAAAA,EAAGF,IAAK,aAAc,EAC3C,QAAS,IAAM,CACbzC,EAAOc,SAAS,CAAE,GAAGZ,EAAeQ,iBAAkB,CAAA,CAAC,CAAG,CAAA,CAC1D,CAAA,CAEN,CACF,CACF,CACF,EA/EO,IAiFX"}
|
|
1
|
+
{"version":3,"file":"FocusChin.js","names":[],"sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/FocusChin.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { GUIDE_ROW_DATA_SELECTOR } from \"./GuideRow\";\nimport { Kbd } from \"./Kbd\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport { InspectionResultOk } from \"./useInspectGuideClientStore\";\n\n// Extra scroll overshoot so the focused guide plus ~1-2 neighbors are visible,\n// reducing how often consecutive next/prev clicks trigger a scroll.\nconst SCROLL_OVERSHOOT = 60;\n\nconst FOCUS_PREV_HOTKEY = \",\";\nconst FOCUS_NEXT_HOTKEY = \"/\";\n\nconst maybeScrollGuideIntoView = (container: HTMLElement, guideKey: string) => {\n requestAnimationFrame(() => {\n const el = container.querySelector(\n `[${GUIDE_ROW_DATA_SELECTOR}=\"${CSS.escape(guideKey)}\"]`,\n );\n if (!el || !(el instanceof HTMLElement)) return;\n\n const containerRect = container.getBoundingClientRect();\n const elRect = el.getBoundingClientRect();\n\n if (elRect.top < containerRect.top) {\n container.scrollTo({\n top:\n container.scrollTop -\n (containerRect.top - elRect.top) -\n SCROLL_OVERSHOOT,\n behavior: \"smooth\",\n });\n } else if (elRect.bottom > containerRect.bottom) {\n container.scrollTo({\n top:\n container.scrollTop +\n (elRect.bottom - containerRect.bottom) +\n SCROLL_OVERSHOOT,\n behavior: \"smooth\",\n });\n }\n });\n};\n\ntype FocusNav = {\n guides: InspectionResultOk[\"guides\"];\n currentKey: string | undefined;\n focusGuide: (guideKey: string) => void;\n};\n\nconst focusPrev = ({ guides, currentKey, focusGuide }: FocusNav) => {\n const selectableGuides = guides.filter(\n (g) => !!g.annotation.selectable.status,\n );\n if (selectableGuides.length === 0) return;\n\n if (!currentKey) {\n focusGuide(selectableGuides[selectableGuides.length - 1]!.key);\n return;\n }\n\n const currIndex = selectableGuides.findIndex((g) => g.key === currentKey);\n const prevGuide =\n currIndex <= 0 ? undefined : selectableGuides[currIndex - 1];\n if (!prevGuide) return;\n focusGuide(prevGuide.key);\n};\n\nconst focusNext = ({ guides, currentKey, focusGuide }: FocusNav) => {\n const selectableGuides = guides.filter(\n (g) => !!g.annotation.selectable.status,\n );\n if (selectableGuides.length === 0) return;\n\n if (!currentKey) {\n focusGuide(selectableGuides[0]!.key);\n return;\n }\n\n const currIndex = selectableGuides.findIndex((g) => g.key === currentKey);\n const nextGuide =\n currIndex < 0 || currIndex + 1 > selectableGuides.length - 1\n ? undefined\n : selectableGuides[currIndex + 1];\n if (!nextGuide) return;\n focusGuide(nextGuide.key);\n};\n\ntype Props = {\n guides: InspectionResultOk[\"guides\"];\n guideListRef: React.RefObject<HTMLDivElement | null>;\n};\n\nexport const FocusChin = ({ guides, guideListRef }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug,\n }));\n\n const focusedKeys = Object.keys(debugSettings?.focusedGuideKeys || {});\n const isFocused = focusedKeys.length > 0;\n const currentKey = focusedKeys[0];\n\n const focusGuide = React.useCallback(\n (guideKey: string) => {\n client.setDebug({\n ...client.store.state.debug,\n focusedGuideKeys: { [guideKey]: true },\n });\n if (guideListRef.current) {\n maybeScrollGuideIntoView(guideListRef.current, guideKey);\n }\n },\n [client, guideListRef],\n );\n\n // Latest-ref so the window keydown listener below can attach once and always\n // read the current guides / focused key without needing to re-subscribe.\n const latestRef = React.useRef<FocusNav>({ guides, currentKey, focusGuide });\n React.useEffect(() => {\n latestRef.current = { guides, currentKey, focusGuide };\n });\n\n React.useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!e.ctrlKey || e.repeat) return;\n if (e.key === FOCUS_PREV_HOTKEY) {\n e.preventDefault();\n focusPrev(latestRef.current);\n } else if (e.key === FOCUS_NEXT_HOTKEY) {\n e.preventDefault();\n focusNext(latestRef.current);\n }\n };\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, []);\n\n if (!isFocused) {\n return null;\n }\n\n return (\n <Box\n borderTop=\"px\"\n px=\"3\"\n py=\"1\"\n overflow=\"hidden\"\n backgroundColor=\"blue-2\"\n >\n <Stack align=\"center\" justify=\"space-between\" gap=\"4\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"blue\"\n style={{\n display: \"block\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n minWidth: 0,\n }}\n >\n Focus mode: {currentKey}\n </Text>\n <Stack align=\"center\" gap=\"1\" style={{ flexShrink: 0 }}>\n <Tooltip\n label={\n <Text as=\"span\" size=\"1\">\n Focus previous guide\n <Stack display=\"inline-block\" ml=\"3\">\n <Kbd>ctrl</Kbd> + <Kbd>,</Kbd>\n </Stack>\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Button\n size=\"0\"\n variant=\"ghost\"\n color=\"blue\"\n leadingIcon={{ icon: ChevronLeft, alt: \"Previous guide\" }}\n onClick={() => focusPrev(latestRef.current)}\n />\n </Tooltip>\n <Tooltip\n label={\n <Text as=\"span\" size=\"1\">\n Focus next guide\n <Stack display=\"inline-block\" ml=\"3\">\n <Kbd>ctrl</Kbd> + <Kbd>/</Kbd>\n </Stack>\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Button\n size=\"0\"\n variant=\"ghost\"\n color=\"blue\"\n leadingIcon={{ icon: ChevronRight, alt: \"Next guide\" }}\n onClick={() => focusNext(latestRef.current)}\n />\n </Tooltip>\n <Tooltip label=\"Exit focus mode\" {...sharedTooltipProps}>\n <Button\n size=\"0\"\n variant=\"ghost\"\n color=\"blue\"\n leadingIcon={{ icon: X, alt: \"Clear focus\" }}\n onClick={() => {\n client.setDebug({ ...debugSettings, focusedGuideKeys: {} });\n }}\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Box>\n );\n};\n"],"mappings":"+ZAeA,IAAM,EAAmB,GAEnB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K,YAAa,EACrD,YAAe,EAAU,EAAU,OAAO,CAC3C,CAAA,CACM,CAAA,GACT,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAAS,MAAM,kBAAkB,GAAI,EAAA,6BACnC,EAAA,EAAA,IAAA,CAAC,EAAA,OAAD,CACE,KAAK,IACL,QAAQ,QACR,MAAM,OACN,YAAa,CAAE,KAAM,EAAA,EAAG,IAAK,aAAc,EAC3C,YAAe,CACb,EAAO,SAAS,CAAE,GAAG,EAAe,iBAAkB,CAAC,CAAE,CAAC,CAC5D,CACD,CAAA,CACM,CAAA,CACJ,GACF,GACJ,CAAA,EA/EE,IAiFX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=GuideAnnotatedStatusDot.js.map
|
|
1
|
+
"use strict";const e=require("./helpers.js");let t=require("react/jsx-runtime"),n=require("@telegraph/layout"),r=require("@telegraph/tooltip");var i={blue:(0,t.jsx)(`svg`,{width:`8`,height:`8`,viewBox:`0 0 8 8`,"aria-hidden":!0,children:(0,t.jsx)(`circle`,{cx:`4`,cy:`4`,r:`4`,fill:`var(--tgph-blue-9)`})}),yellow:(0,t.jsx)(`svg`,{width:`8`,height:`8`,viewBox:`0 0 8 8`,"aria-hidden":!0,children:(0,t.jsx)(`polygon`,{points:`4,0.5 7.5,7.5 0.5,7.5`,fill:`var(--tgph-yellow-9)`})}),gray:(0,t.jsx)(`svg`,{width:`8`,height:`8`,viewBox:`0 0 8 8`,"aria-hidden":!0,children:(0,t.jsx)(`circle`,{cx:`4`,cy:`4`,r:`2.75`,fill:`none`,stroke:`var(--tgph-gray-9)`,strokeWidth:`2.5`})}),red:(0,t.jsxs)(`svg`,{width:`8`,height:`8`,viewBox:`0 0 8 8`,"aria-hidden":!0,children:[(0,t.jsx)(`line`,{x1:`1.5`,y1:`1.5`,x2:`6.5`,y2:`6.5`,stroke:`var(--tgph-red-9)`,strokeWidth:`2`,strokeLinecap:`round`}),(0,t.jsx)(`line`,{x1:`6.5`,y1:`1.5`,x2:`1.5`,y2:`6.5`,stroke:`var(--tgph-red-9)`,strokeWidth:`2`,strokeLinecap:`round`})]})},a=({color:a,tooltip:o})=>(0,t.jsx)(r.Tooltip,{label:o,...e.sharedTooltipProps,children:(0,t.jsx)(n.Stack,{as:`span`,align:`center`,justify:`center`,display:`inline-flex`,p:`0_5`,style:{flexShrink:0},children:i[a]})});exports.GuideAnnotatedStatusDot=a;
|
|
2
|
+
//# sourceMappingURL=GuideAnnotatedStatusDot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideAnnotatedStatusDot.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.tsx"],"sourcesContent":["import { Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\n\nimport { sharedTooltipProps } from \"./helpers\";\n\nexport type StatusColor = \"blue\" | \"red\" | \"yellow\" | \"gray\";\n\n// Directly copied from the design prototype.\nconst STATUS_SHAPES: Record<StatusColor, React.ReactNode> = {\n blue: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <circle cx=\"4\" cy=\"4\" r=\"4\" fill=\"var(--tgph-blue-9)\" />\n </svg>\n ),\n yellow: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <polygon points=\"4,0.5 7.5,7.5 0.5,7.5\" fill=\"var(--tgph-yellow-9)\" />\n </svg>\n ),\n gray: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <circle\n cx=\"4\"\n cy=\"4\"\n r=\"2.75\"\n fill=\"none\"\n stroke=\"var(--tgph-gray-9)\"\n strokeWidth=\"2.5\"\n />\n </svg>\n ),\n red: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <line\n x1=\"1.5\"\n y1=\"1.5\"\n x2=\"6.5\"\n y2=\"6.5\"\n stroke=\"var(--tgph-red-9)\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n <line\n x1=\"6.5\"\n y1=\"1.5\"\n x2=\"1.5\"\n y2=\"6.5\"\n stroke=\"var(--tgph-red-9)\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n ),\n};\n\nexport const GuideAnnotatedStatusDot = ({\n color,\n tooltip,\n}: {\n color: StatusColor;\n tooltip: string;\n}) => {\n return (\n <Tooltip label={tooltip} {...sharedTooltipProps}>\n <Stack\n as=\"span\"\n align=\"center\"\n justify=\"center\"\n display=\"inline-flex\"\n p=\"0_5\"\n style={{ flexShrink: 0 }}\n >\n {STATUS_SHAPES[color]}\n </Stack>\n </Tooltip>\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"GuideAnnotatedStatusDot.js","names":[],"sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideAnnotatedStatusDot.tsx"],"sourcesContent":["import { Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\n\nimport { sharedTooltipProps } from \"./helpers\";\n\nexport type StatusColor = \"blue\" | \"red\" | \"yellow\" | \"gray\";\n\n// Directly copied from the design prototype.\nconst STATUS_SHAPES: Record<StatusColor, React.ReactNode> = {\n blue: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <circle cx=\"4\" cy=\"4\" r=\"4\" fill=\"var(--tgph-blue-9)\" />\n </svg>\n ),\n yellow: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <polygon points=\"4,0.5 7.5,7.5 0.5,7.5\" fill=\"var(--tgph-yellow-9)\" />\n </svg>\n ),\n gray: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <circle\n cx=\"4\"\n cy=\"4\"\n r=\"2.75\"\n fill=\"none\"\n stroke=\"var(--tgph-gray-9)\"\n strokeWidth=\"2.5\"\n />\n </svg>\n ),\n red: (\n <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden>\n <line\n x1=\"1.5\"\n y1=\"1.5\"\n x2=\"6.5\"\n y2=\"6.5\"\n stroke=\"var(--tgph-red-9)\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n <line\n x1=\"6.5\"\n y1=\"1.5\"\n x2=\"1.5\"\n y2=\"6.5\"\n stroke=\"var(--tgph-red-9)\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n />\n </svg>\n ),\n};\n\nexport const GuideAnnotatedStatusDot = ({\n color,\n tooltip,\n}: {\n color: StatusColor;\n tooltip: string;\n}) => {\n return (\n <Tooltip label={tooltip} {...sharedTooltipProps}>\n <Stack\n as=\"span\"\n align=\"center\"\n justify=\"center\"\n display=\"inline-flex\"\n p=\"0_5\"\n style={{ flexShrink: 0 }}\n >\n {STATUS_SHAPES[color]}\n </Stack>\n </Tooltip>\n );\n};\n"],"mappings":"+IAQA,IAAM,EAAsD,CAC1D,MACE,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,IAAI,OAAO,IAAI,QAAQ,UAAU,cAAA,aAC1C,EAAA,EAAA,IAAA,CAAC,SAAD,CAAQ,GAAG,IAAI,GAAG,IAAI,EAAE,IAAI,KAAK,oBAAsB,CAAA,CACpD,CAAA,EAEP,QACE,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,IAAI,OAAO,IAAI,QAAQ,UAAU,cAAA,aAC1C,EAAA,EAAA,IAAA,CAAC,UAAD,CAAS,OAAO,wBAAwB,KAAK,sBAAwB,CAAA,CAClE,CAAA,EAEP,MACE,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAM,IAAI,OAAO,IAAI,QAAQ,UAAU,cAAA,aAC1C,EAAA,EAAA,IAAA,CAAC,SAAD,CACE,GAAG,IACH,GAAG,IACH,EAAE,OACF,KAAK,OACL,OAAO,qBACP,YAAY,KACb,CAAA,CACE,CAAA,EAEP,KACE,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,MAAM,IAAI,OAAO,IAAI,QAAQ,UAAU,cAAA,YAA5C,EACE,EAAA,EAAA,IAAA,CAAC,OAAD,CACE,GAAG,MACH,GAAG,MACH,GAAG,MACH,GAAG,MACH,OAAO,oBACP,YAAY,IACZ,cAAc,OACf,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,OAAD,CACE,GAAG,MACH,GAAG,MACH,GAAG,MACH,GAAG,MACH,OAAO,oBACP,YAAY,IACZ,cAAc,OACf,CAAA,CACE,GAET,EAEa,GAA2B,CACtC,QACA,cAME,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAAS,MAAO,EAAS,GAAI,EAAA,6BAC3B,EAAA,EAAA,IAAA,CAAC,EAAA,MAAD,CACE,GAAG,OACH,MAAM,SACN,QAAQ,SACR,QAAQ,cACR,EAAE,MACF,MAAO,CAAE,WAAY,CAAE,WAEtB,EAAc,EACV,CAAA,CACA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=GuideContextDetails.js.map
|
|
1
|
+
"use strict";const e=require("./helpers.js");let t=require("@knocklabs/react-core"),n=require("react/jsx-runtime"),r=require("@telegraph/layout"),i=require("@telegraph/tooltip"),a=require("@telegraph/typography"),o=require("@telegraph/toggle");var s=()=>{let{client:s}=(0,t.useGuideContext)(),{debugSettings:c}=(0,t.useStore)(s.store,e=>({debugSettings:e.debug||{}}));return(0,n.jsxs)(r.Box,{py:`3`,px:`3`,children:[(0,n.jsxs)(r.Stack,{direction:`column`,gap:`1`,width:`full`,children:[(0,n.jsx)(a.Text,{as:`span`,size:`1`,weight:`medium`,display:`block`,children:`Toolbar settings`}),(0,n.jsxs)(r.Stack,{direction:`column`,gap:`1`,children:[(0,n.jsxs)(r.Stack,{direction:`row`,gap:`2`,align:`center`,h:`7`,children:[(0,n.jsx)(i.Tooltip,{label:`When enabled, engagement actions are not sent to Knock.`,...e.sharedTooltipProps,children:(0,n.jsx)(r.Box,{width:`36`,mt:`1`,children:(0,n.jsx)(a.Text,{as:`span`,size:`1`,weight:`medium`,color:`gray`,borderBottom:`px`,borderStyle:`dashed`,children:`Sandbox engagement`})})}),(0,n.jsx)(o.Toggle.Default,{size:`1`,pt:`1_5`,value:!!c.skipEngagementTracking,onValueChange:e=>{s.setDebug({...c,skipEngagementTracking:e})}})]}),(0,n.jsxs)(r.Stack,{direction:`row`,gap:`2`,align:`center`,h:`7`,children:[(0,n.jsx)(i.Tooltip,{label:`Ignore throttle and show next guide immediately`,...e.sharedTooltipProps,children:(0,n.jsx)(r.Box,{width:`36`,mt:`1`,children:(0,n.jsx)(a.Text,{as:`span`,size:`1`,weight:`medium`,color:`gray`,borderBottom:`px`,borderStyle:`dashed`,children:`Ignore throttle`})})}),(0,n.jsx)(o.Toggle.Default,{size:`1`,pt:`1_5`,value:!!c.ignoreDisplayInterval,onValueChange:e=>{s.setDebug({...c,ignoreDisplayInterval:e})}})]})]})]}),(0,n.jsxs)(r.Stack,{direction:`column`,gap:`1`,width:`full`,children:[(0,n.jsx)(i.Tooltip,{label:(0,n.jsx)(a.Text,{as:`span`,size:`1`,children:`The tenant and data payload passed to KnockGuideProvider. Available for use in runtime conditions.`}),...e.sharedTooltipProps,children:(0,n.jsx)(a.Text,{as:`span`,size:`1`,weight:`medium`,borderBottom:`px`,borderStyle:`dashed`,mt:`4`,style:{whiteSpace:`nowrap`,width:`fit-content`},children:`Target params`})}),(0,n.jsxs)(r.Stack,{direction:`column`,gap:`2`,children:[(0,n.jsxs)(r.Stack,{direction:`row`,gap:`2`,align:`center`,children:[(0,n.jsx)(a.Text,{as:`span`,size:`1`,weight:`medium`,color:`gray`,width:`36`,mt:`1`,children:`Tenant`}),(0,n.jsx)(r.Box,{rounded:`2`,overflow:`auto`,backgroundColor:`surface-2`,border:`px`,p:`1`,style:{flex:1,minWidth:0},children:(0,n.jsx)(`pre`,{style:{fontSize:`11px`,margin:0},children:(0,n.jsx)(`code`,{children:s.targetParams.tenant||`-`})})})]}),(0,n.jsxs)(r.Stack,{direction:`row`,gap:`2`,align:`flex-start`,children:[(0,n.jsx)(a.Text,{as:`span`,size:`1`,weight:`medium`,color:`gray`,width:`36`,mt:`1`,children:`Data`}),(0,n.jsx)(r.Box,{rounded:`2`,overflow:`auto`,backgroundColor:`surface-2`,border:`px`,p:`1`,style:{flex:1,minWidth:0,minHeight:`50px`,maxHeight:`200px`},children:(0,n.jsx)(`pre`,{style:{fontSize:`11px`,margin:0},children:(0,n.jsx)(`code`,{children:s.targetParams.data?JSON.stringify(s.targetParams.data,null,2):`-`})})})]})]})]})]})};exports.GuideContextDetails=s;
|
|
2
|
+
//# sourceMappingURL=GuideContextDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideContextDetails.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Toggle } from \"@telegraph/toggle\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport { sharedTooltipProps } from \"./helpers\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n\n return (\n <Box py=\"3\" px=\"3\">\n <Stack direction=\"column\" gap=\"1\" width=\"full\">\n <Text as=\"span\" size=\"1\" weight=\"medium\" display=\"block\">\n Toolbar settings\n </Text>\n <Stack direction=\"column\" gap=\"1\">\n <Stack direction=\"row\" gap=\"2\" align=\"center\" h=\"7\">\n <Tooltip\n label=\"When enabled, engagement actions are not sent to Knock.\"\n {...sharedTooltipProps}\n >\n <Box width=\"36\" mt=\"1\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n >\n Sandbox engagement\n </Text>\n </Box>\n </Tooltip>\n <Toggle.Default\n size=\"1\"\n pt=\"1_5\"\n value={!!debugSettings.skipEngagementTracking}\n onValueChange={(value: boolean) => {\n client.setDebug({\n ...debugSettings,\n skipEngagementTracking: value,\n });\n }}\n />\n </Stack>\n <Stack direction=\"row\" gap=\"2\" align=\"center\" h=\"7\">\n <Tooltip\n label=\"Ignore throttle and show next guide immediately\"\n {...sharedTooltipProps}\n >\n <Box width=\"36\" mt=\"1\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n >\n Ignore throttle\n </Text>\n </Box>\n </Tooltip>\n <Toggle.Default\n size=\"1\"\n pt=\"1_5\"\n value={!!debugSettings.ignoreDisplayInterval}\n onValueChange={(value: boolean) => {\n client.setDebug({\n ...debugSettings,\n ignoreDisplayInterval: value,\n });\n }}\n />\n </Stack>\n </Stack>\n </Stack>\n <Stack direction=\"column\" gap=\"1\" width=\"full\">\n <Tooltip\n label={\n <Text as=\"span\" size=\"1\">\n The tenant and data payload passed to KnockGuideProvider.\n Available for use in runtime conditions.\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n mt=\"4\"\n style={{\n whiteSpace: \"nowrap\",\n width: \"fit-content\",\n }}\n >\n Target params\n </Text>\n </Tooltip>\n <Stack direction=\"column\" gap=\"2\">\n <Stack direction=\"row\" gap=\"2\" align=\"center\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n width=\"36\"\n mt=\"1\"\n >\n Tenant\n </Text>\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n border=\"px\"\n p=\"1\"\n style={{ flex: 1, minWidth: 0 }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>{client.targetParams.tenant || \"-\"}</code>\n </pre>\n </Box>\n </Stack>\n <Stack direction=\"row\" gap=\"2\" align=\"flex-start\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n width=\"36\"\n mt=\"1\"\n >\n Data\n </Text>\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n border=\"px\"\n p=\"1\"\n style={{\n flex: 1,\n minWidth: 0,\n minHeight: \"50px\",\n maxHeight: \"200px\",\n }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>\n {client.targetParams.data\n ? JSON.stringify(client.targetParams.data, null, 2)\n : \"-\"}\n </code>\n </pre>\n </Box>\n </Stack>\n </Stack>\n </Stack>\n </Box>\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"GuideContextDetails.js","names":[],"sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Toggle } from \"@telegraph/toggle\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport { sharedTooltipProps } from \"./helpers\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n\n return (\n <Box py=\"3\" px=\"3\">\n <Stack direction=\"column\" gap=\"1\" width=\"full\">\n <Text as=\"span\" size=\"1\" weight=\"medium\" display=\"block\">\n Toolbar settings\n </Text>\n <Stack direction=\"column\" gap=\"1\">\n <Stack direction=\"row\" gap=\"2\" align=\"center\" h=\"7\">\n <Tooltip\n label=\"When enabled, engagement actions are not sent to Knock.\"\n {...sharedTooltipProps}\n >\n <Box width=\"36\" mt=\"1\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n >\n Sandbox engagement\n </Text>\n </Box>\n </Tooltip>\n <Toggle.Default\n size=\"1\"\n pt=\"1_5\"\n value={!!debugSettings.skipEngagementTracking}\n onValueChange={(value: boolean) => {\n client.setDebug({\n ...debugSettings,\n skipEngagementTracking: value,\n });\n }}\n />\n </Stack>\n <Stack direction=\"row\" gap=\"2\" align=\"center\" h=\"7\">\n <Tooltip\n label=\"Ignore throttle and show next guide immediately\"\n {...sharedTooltipProps}\n >\n <Box width=\"36\" mt=\"1\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n >\n Ignore throttle\n </Text>\n </Box>\n </Tooltip>\n <Toggle.Default\n size=\"1\"\n pt=\"1_5\"\n value={!!debugSettings.ignoreDisplayInterval}\n onValueChange={(value: boolean) => {\n client.setDebug({\n ...debugSettings,\n ignoreDisplayInterval: value,\n });\n }}\n />\n </Stack>\n </Stack>\n </Stack>\n <Stack direction=\"column\" gap=\"1\" width=\"full\">\n <Tooltip\n label={\n <Text as=\"span\" size=\"1\">\n The tenant and data payload passed to KnockGuideProvider.\n Available for use in runtime conditions.\n </Text>\n }\n {...sharedTooltipProps}\n >\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n borderBottom=\"px\"\n borderStyle=\"dashed\"\n mt=\"4\"\n style={{\n whiteSpace: \"nowrap\",\n width: \"fit-content\",\n }}\n >\n Target params\n </Text>\n </Tooltip>\n <Stack direction=\"column\" gap=\"2\">\n <Stack direction=\"row\" gap=\"2\" align=\"center\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n width=\"36\"\n mt=\"1\"\n >\n Tenant\n </Text>\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n border=\"px\"\n p=\"1\"\n style={{ flex: 1, minWidth: 0 }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>{client.targetParams.tenant || \"-\"}</code>\n </pre>\n </Box>\n </Stack>\n <Stack direction=\"row\" gap=\"2\" align=\"flex-start\">\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color=\"gray\"\n width=\"36\"\n mt=\"1\"\n >\n Data\n </Text>\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n border=\"px\"\n p=\"1\"\n style={{\n flex: 1,\n minWidth: 0,\n minHeight: \"50px\",\n maxHeight: \"200px\",\n }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>\n {client.targetParams.data\n ? JSON.stringify(client.targetParams.data, null, 2)\n : \"-\"}\n </code>\n </pre>\n </Box>\n </Stack>\n </Stack>\n </Stack>\n </Box>\n );\n};\n"],"mappings":"oPAQA,IAAa,MAA4B,CACvC,GAAM,CAAE,WAAA,EAAA,EAAA,gBAAA,CAA2B,EAC7B,CAAE,kBAAA,EAAA,EAAA,SAAA,CAA2B,EAAO,MAAQ,IAAW,CAC3D,cAAe,EAAM,OAAS,CAAC,CACjC,EAAE,EAEF,OACE,EAAA,EAAA,KAAA,CAAC,EAAA,IAAD,CAAK,GAAG,IAAI,GAAG,aAAf,EACE,EAAA,EAAA,KAAA,CAAC,EAAA,MAAD,CAAO,UAAU,SAAS,IAAI,IAAI,MAAM,gBAAxC,EACE,EAAA,EAAA,IAAA,CAAC,EAAA,KAAD,CAAM,GAAG,OAAO,KAAK,IAAI,OAAO,SAAS,QAAQ,iBAAQ,kBAEnD,CAAA,GACN,EAAA,EAAA,KAAA,CAAC,EAAA,MAAD,CAAO,UAAU,SAAS,IAAI,aAA9B,EACE,EAAA,EAAA,KAAA,CAAC,EAAA,MAAD,CAAO,UAAU,MAAM,IAAI,IAAI,MAAM,SAAS,EAAE,aAAhD,EACE,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACE,MAAM,0DACN,GAAI,EAAA,6BAEJ,EAAA,EAAA,IAAA,CAAC,EAAA,IAAD,CAAK,MAAM,KAAK,GAAG,cACjB,EAAA,EAAA,IAAA,CAAC,EAAA,KAAD,CACE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GACA,CAAA,CACH,CAAA,CACF,CAAA,CACA,GACF,GACF,GACJ,GAET"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=GuideRow.js.map
|
|
1
|
+
"use strict";const e=require("../../../../../_virtual/_rolldown/runtime.js"),t=require("./helpers.js"),n=require("./GuideAnnotatedStatusDot.js"),r=require("./useInspectGuideClientStore.js"),i=require("./GuideRowDetails.js");let a=require("@knocklabs/react-core"),o=require("react");o=e.__toESM(o);let s=require("react/jsx-runtime"),c=require("@telegraph/button"),l=require("@telegraph/icon"),u=require("@telegraph/layout"),d=require("@telegraph/tooltip"),f=require("@telegraph/typography"),p=require("lucide-react"),m=require("@telegraph/tag");var h=`data-kgt-guide-row-key`,g=({label:e,color:t=`gray`,children:n})=>(0,s.jsxs)(u.Stack,{direction:`row`,align:`center`,gap:`0_5`,px:`1`,height:`5`,bg:`surface-2`,rounded:`full`,border:`px`,borderColor:`gray-4`,children:[(0,s.jsx)(f.Text,{as:`span`,size:`0`,color:t,weight:`medium`,children:e}),n]}),_=e=>{if(r.isUncommittedGuide(e))return{color:`red`,label:`Inactive`,description:`This guide has never been committed and published yet`};let{annotation:t}=e;if(!t.active.status)return{color:`red`,label:`Inactive`,description:`This guide is inactive`};if(t.archived.status)return{color:`red`,label:`Archived`,description:`User has already dismissed this guide`};if(!t.targetable.status)return{color:`red`,label:`Not targeted`,description:t.targetable.message};let n=i.getSelectableStatusSummary(t.selectable.status);return t.selectable.status===void 0?n:t.activatable.status?{...n,...t.selectable.status===`returned`?{label:`Display`}:void 0}:{color:`red`,label:`Not activated`,description:`This guide cannot be activated in the current location`}},v=e=>{if(r.isUncommittedGuide(e))return{active:{color:`gray`},archived:{color:`gray`},targetable:{color:`gray`},activatable:{color:`gray`},selectable:{color:`gray`}};let{annotation:t}=e,n={color:t.active.status?`blue`:`red`,tooltip:`Active: ${t.active.status?`Yes`:`No`}`},a={color:t.archived.status?`red`:`blue`,tooltip:`Archived: ${t.archived.status?`Yes`:`No`}`},o={color:t.targetable.status?`blue`:`red`,tooltip:`Targeting: ${t.targetable.status?`Yes`:`No`}`},s={color:t.activatable.status?`blue`:`red`,tooltip:`Activated: ${t.activatable.status?`Yes`:`No`}`},c=i.getSelectableStatusSummary(t.selectable.status);return{active:n,archived:a,targetable:o,activatable:s,selectable:{color:c.color,tooltip:c.label}}},y=({guide:e,orderIndex:y,isExpanded:b,onClick:x})=>{let{client:S}=(0,a.useGuideContext)(),{debugSettings:C}=(0,a.useStore)(S.store,e=>({debugSettings:e.debug||{}})),[w,T]=o.useState(!1),E=C.focusedGuideKeys||{},D=Object.keys(E).length>0,O=!!E[e.key],k=v(e),A=_(e),j={[h]:e.key};return(0,s.jsxs)(u.Box,{rounded:`3`,overflow:`hidden`,border:`px`,borderStyle:`solid`,borderColor:b?`gray-6`:`transparent`,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),style:{cursor:`pointer`},...j,children:[(0,s.jsxs)(u.Stack,{h:`7`,px:`1`,gap:`1`,align:`center`,justify:`space-between`,rounded:`3`,overflow:`hidden`,border:`px`,borderStyle:`solid`,borderColor:b?`transparent`:O?`gray-6`:w?`gray-4`:`transparent`,backgroundColor:b?`surface-2`:O?`gray-2`:w?`surface-2`:`transparent`,onClick:()=>x(e.key),children:[(0,s.jsxs)(u.Stack,{align:`center`,gap:`1_5`,style:{minWidth:0,flex:1},children:[(0,s.jsxs)(u.Stack,{w:`7`,justify:`space-between`,align:`center`,gap:`0_5`,children:[(0,s.jsx)(u.Box,{w:`3`,children:!e.bypass_global_group_limit&&(0,s.jsx)(l.Icon,{icon:p.Gauge,size:`0`,color:`gray`,alt:`Subject to throttling`})}),(0,s.jsx)(f.Text,{as:`span`,size:`1`,weight:`medium`,color:e.bypass_global_group_limit?`blue`:`default`,style:{flexShrink:0},children:y+1})]}),(0,s.jsx)(d.Tooltip,{label:`${e.key}${e.bypass_global_group_limit?` (unthrottled)`:``}`,...t.sharedTooltipProps,children:(0,s.jsx)(f.Text,{as:`code`,size:`1`,weight:`medium`,color:`default`,style:{display:`block`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`200px`},children:e.key})})]}),(0,s.jsxs)(u.Stack,{align:`center`,gap:`1_5`,style:{flexShrink:0},children:[!D&&(0,s.jsx)(d.Tooltip,{label:A.description,...t.sharedTooltipProps,children:(0,s.jsx)(m.Tag,{size:`0`,variant:`soft`,color:A.color,children:A.label})}),(0,s.jsxs)(g,{label:`Elig:`,color:r.isUncommittedGuide(e)?`disabled`:e.annotation.isEligible?`blue`:`gray`,children:[(0,s.jsx)(n.GuideAnnotatedStatusDot,{color:k.active.color,tooltip:k.active.tooltip}),(0,s.jsx)(n.GuideAnnotatedStatusDot,{color:k.archived.color,tooltip:k.archived.tooltip}),(0,s.jsx)(n.GuideAnnotatedStatusDot,{color:k.targetable.color,tooltip:k.targetable.tooltip})]}),(0,s.jsxs)(g,{label:`Vis:`,color:r.isUncommittedGuide(e)?`disabled`:e.annotation.isQualified&&e.annotation.selectable.status===`returned`?`blue`:`gray`,children:[(0,s.jsx)(n.GuideAnnotatedStatusDot,{color:k.activatable.color,tooltip:k.activatable.tooltip}),(0,s.jsx)(n.GuideAnnotatedStatusDot,{color:k.selectable.color,tooltip:k.selectable.tooltip})]}),(0,s.jsx)(c.Button,{size:`0`,variant:O?`solid`:`outline`,color:O?`blue`:`gray`,disabled:r.isUncommittedGuide(e)||e.annotation.selectable.status===void 0,onClick:t=>{t.stopPropagation(),S.setDebug({...C,focusedGuideKeys:O?{}:{[e.key]:!0}})},children:`Focus`})]})]}),b&&(0,s.jsx)(i.GuideRowDetails,{guide:e})]})};exports.GUIDE_ROW_DATA_SELECTOR=h,exports.GuideRow=y;
|
|
2
|
+
//# sourceMappingURL=GuideRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideRow.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tag } from \"@telegraph/tag\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { Gauge } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport {\n GuideRowDetails,\n StatusSummary,\n getSelectableStatusSummary,\n} from \"./GuideRowDetails\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport {\n AnnotatedGuide,\n AnnotatedStatuses,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nexport const GUIDE_ROW_DATA_SELECTOR = \"data-kgt-guide-row-key\";\n\nconst Pill = ({\n label,\n color = \"gray\",\n children,\n}: {\n label: string;\n color?: StatusColor | \"disabled\";\n children: React.ReactNode;\n}) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n gap=\"0_5\"\n px=\"1\"\n height=\"5\"\n bg=\"surface-2\"\n rounded=\"full\"\n border=\"px\"\n borderColor=\"gray-4\"\n >\n <Text as=\"span\" size=\"0\" color={color} weight=\"medium\">\n {label}\n </Text>\n {children}\n </Stack>\n );\n};\n\nconst getStatusSummary = (\n guide: AnnotatedGuide | UncommittedGuide,\n): StatusSummary => {\n if (isUncommittedGuide(guide)) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide has never been committed and published yet\",\n };\n }\n\n const { annotation } = guide;\n\n if (!annotation.active.status) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide is inactive\",\n };\n }\n if (annotation.archived.status) {\n return {\n color: \"red\",\n label: \"Archived\",\n description: \"User has already dismissed this guide\",\n };\n }\n if (!annotation.targetable.status) {\n return {\n color: \"red\",\n label: \"Not targeted\",\n description: annotation.targetable.message,\n };\n }\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n // Prioritize an undefined selectable status ahead of activatable status.\n if (annotation.selectable.status === undefined) {\n return selectableStatusSummary;\n }\n\n if (!annotation.activatable.status) {\n return {\n color: \"red\",\n label: \"Not activated\",\n description: \"This guide cannot be activated in the current location\",\n };\n }\n\n return {\n ...selectableStatusSummary,\n\n // Shorten the label we display here for space.\n ...(annotation.selectable.status === \"returned\"\n ? { label: \"Display\" }\n : undefined),\n };\n};\n\ntype StatusDot = {\n color: StatusColor;\n tooltip?: string;\n};\n\nconst getStatusDots = (\n guide: AnnotatedGuide | UncommittedGuide,\n): Record<keyof AnnotatedStatuses, StatusDot> => {\n if (isUncommittedGuide(guide)) {\n return {\n active: { color: \"gray\" },\n archived: { color: \"gray\" },\n targetable: { color: \"gray\" },\n activatable: { color: \"gray\" },\n selectable: { color: \"gray\" },\n };\n }\n\n const { annotation } = guide;\n\n const active: StatusDot = {\n color: annotation.active.status ? \"blue\" : \"red\",\n tooltip: `Active: ${annotation.active.status ? \"Yes\" : \"No\"}`,\n };\n\n const archived: StatusDot = {\n color: annotation.archived.status ? \"red\" : \"blue\",\n tooltip: `Archived: ${annotation.archived.status ? \"Yes\" : \"No\"}`,\n };\n\n const targetable: StatusDot = {\n color: annotation.targetable.status ? \"blue\" : \"red\",\n tooltip: `Targeting: ${annotation.targetable.status ? \"Yes\" : \"No\"}`,\n };\n\n const activatable: StatusDot = {\n color: annotation.activatable.status ? \"blue\" : \"red\",\n tooltip: `Activated: ${annotation.activatable.status ? \"Yes\" : \"No\"}`,\n };\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n const selectable = {\n color: selectableStatusSummary.color,\n tooltip: selectableStatusSummary.label,\n };\n\n return { active, archived, targetable, activatable, selectable };\n};\n\ntype Props = {\n guide: UncommittedGuide | AnnotatedGuide;\n orderIndex: number;\n isExpanded: boolean;\n onClick: (guideKey: string) => void;\n};\n\nexport const GuideRow = ({ guide, orderIndex, isExpanded, onClick }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n const [isHovered, setIsHovered] = React.useState(false);\n\n const focusedGuideKeys = debugSettings.focusedGuideKeys || {};\n const hasFocus = Object.keys(focusedGuideKeys).length > 0;\n const isFocused = !!focusedGuideKeys[guide.key];\n\n const dots = getStatusDots(guide);\n const summary = getStatusSummary(guide);\n const dataAttrs = { [GUIDE_ROW_DATA_SELECTOR]: guide.key };\n\n return (\n <Box\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={isExpanded ? \"gray-6\" : \"transparent\"}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ cursor: \"pointer\" }}\n {...dataAttrs}\n >\n <Stack\n h=\"7\"\n px=\"1\"\n gap=\"1\"\n align=\"center\"\n justify=\"space-between\"\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={\n isExpanded\n ? \"transparent\"\n : isFocused\n ? \"gray-6\"\n : isHovered\n ? \"gray-4\"\n : \"transparent\"\n }\n backgroundColor={\n isExpanded\n ? \"surface-2\"\n : isFocused\n ? \"gray-2\"\n : isHovered\n ? \"surface-2\"\n : \"transparent\"\n }\n onClick={() => onClick(guide.key)}\n >\n {/* Left section: order + key */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack w=\"7\" justify=\"space-between\" align=\"center\" gap=\"0_5\">\n <Box w=\"3\">\n {!guide.bypass_global_group_limit && (\n <Icon\n icon={Gauge}\n size=\"0\"\n color=\"gray\"\n alt=\"Subject to throttling\"\n />\n )}\n </Box>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n style={{ flexShrink: 0 }}\n >\n {orderIndex + 1}\n </Text>\n </Stack>\n <Tooltip\n label={`${guide.key}${guide.bypass_global_group_limit ? \" (unthrottled)\" : \"\"}`}\n {...sharedTooltipProps}\n >\n <Text\n as=\"code\"\n size=\"1\"\n weight=\"medium\"\n color=\"default\"\n style={{\n display: \"block\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n maxWidth: \"200px\",\n }}\n >\n {guide.key}\n </Text>\n </Tooltip>\n </Stack>\n\n {/* Right section: verdict + pills + focus */}\n <Stack align=\"center\" gap=\"1_5\" style={{ flexShrink: 0 }}>\n {!hasFocus && (\n <Tooltip label={summary.description} {...sharedTooltipProps}>\n <Tag size=\"0\" variant=\"soft\" color={summary.color}>\n {summary.label}\n </Tag>\n </Tooltip>\n )}\n\n <Pill\n label=\"Elig:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isEligible\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.active.color}\n tooltip={dots.active.tooltip!}\n />\n <StatusDot\n color={dots.archived.color}\n tooltip={dots.archived.tooltip!}\n />\n <StatusDot\n color={dots.targetable.color}\n tooltip={dots.targetable.tooltip!}\n />\n </Pill>\n <Pill\n label=\"Vis:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isQualified &&\n guide.annotation.selectable.status === \"returned\"\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.activatable.color}\n tooltip={dots.activatable.tooltip!}\n />\n <StatusDot\n color={dots.selectable.color}\n tooltip={dots.selectable.tooltip!}\n />\n </Pill>\n\n <Button\n size=\"0\"\n variant={isFocused ? \"solid\" : \"outline\"}\n color={isFocused ? \"blue\" : \"gray\"}\n disabled={\n isUncommittedGuide(guide) ||\n guide.annotation.selectable.status === undefined\n }\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: isFocused ? {} : { [guide.key]: true },\n });\n }}\n >\n Focus\n </Button>\n </Stack>\n </Stack>\n\n {isExpanded && <GuideRowDetails guide={guide} />}\n </Box>\n );\n};\n"],"names":["GUIDE_ROW_DATA_SELECTOR","Pill","label","color","children","React","Stack","Text","getStatusSummary","guide","isUncommittedGuide","description","annotation","active","status","archived","targetable","message","selectableStatusSummary","getSelectableStatusSummary","selectable","undefined","activatable","getStatusDots","tooltip","GuideRow","orderIndex","isExpanded","onClick","client","useGuideContext","debugSettings","useStore","store","state","debug","isHovered","setIsHovered","useState","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","dots","summary","dataAttrs","Box","cursor","minWidth","flex","bypass_global_group_limit","Icon","Gauge","flexShrink","Tooltip","sharedTooltipProps","display","overflow","textOverflow","whiteSpace","maxWidth","Tag","isEligible","StatusDot","isQualified","Button","e","stopPropagation","setDebug","GuideRowDetails"],"mappings":"8zBA2BaA,EAA0B,yBAEjCC,EAAOA,CAAC,CACZC,MAAAA,EACAC,MAAAA,EAAQ,OACRC,SAAAA,CAKF,IAEKC,EAAA,cAAAC,EAAA,MAAA,CACC,UAAU,MACV,MAAM,SACN,IAAI,MACJ,GAAG,IACH,OAAO,IACP,GAAG,YACH,QAAQ,OACR,OAAO,KACP,YAAY,QAEZ,EAAAD,EAAA,cAACE,QAAK,GAAG,OAAO,KAAK,IAAI,MAAAJ,EAAc,OAAO,UAC3CD,CACH,EACCE,CACH,EAIEI,EACJC,GACkB,CACdC,GAAAA,EAAAA,mBAAmBD,CAAK,EACnB,MAAA,CACLN,MAAO,MACPD,MAAO,WACPS,YAAa,uDACf,EAGI,KAAA,CAAEC,WAAAA,CAAAA,EAAeH,EAEnB,GAAA,CAACG,EAAWC,OAAOC,OACd,MAAA,CACLX,MAAO,MACPD,MAAO,WACPS,YAAa,wBACf,EAEEC,GAAAA,EAAWG,SAASD,OACf,MAAA,CACLX,MAAO,MACPD,MAAO,WACPS,YAAa,uCACf,EAEE,GAAA,CAACC,EAAWI,WAAWF,OAClB,MAAA,CACLX,MAAO,MACPD,MAAO,eAC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A,CACC,MAAOpB,EAAK/B,SAASZ,MACrB,QAAS2C,EAAK/B,SAASS,OAAS,CAAA,EAEjCnB,EAAA,cAAA6D,0BAAA,CACC,MAAOpB,EAAK9B,WAAWb,MACvB,QAAS2C,EAAK9B,WAAWQ,OAAS,CAAA,CAEtC,EACAnB,EAAA,cAACJ,EACC,CAAA,MAAM,OACN,MACES,EAAmBD,mBAAAA,CAAK,EACpB,WACAA,EAAMG,WAAWuD,aACf1D,EAAMG,WAAWQ,WAAWN,SAAW,WACvC,OACA,QAGRT,EAAA,cAAC6D,2BACC,MAAOpB,EAAKxB,YAAYnB,MACxB,QAAS2C,EAAKxB,YAAYE,QAAS,EAEpCnB,EAAA,cAAA6D,EAAA,wBAAA,CACC,MAAOpB,EAAK1B,WAAWjB,MACvB,QAAS2C,EAAK1B,WAAWI,OAAAA,CAAS,CAEtC,EAECnB,EAAA,cAAA+D,SAAA,CACC,KAAK,IACL,QAASxB,EAAY,QAAU,UAC/B,MAAOA,EAAY,OAAS,OAC5B,SACElC,qBAAmBD,CAAK,GACxBA,EAAMG,WAAWQ,WAAWN,SAAWO,OAEzC,QAAUgD,GAAwB,CAChCA,EAAEC,gBAAgB,EAClBzC,EAAO0C,SAAS,CACd,GAAGxC,EACHQ,iBAAkBK,EAAY,GAAK,CAAE,CAACnC,EAAMoC,GAAG,EAAG,EAAA,CAAK,CACxD,CAAA,GACD,OAGJ,CACF,CACF,EAEClB,GAActB,EAAA,cAACmE,EAAgB,gBAAA,CAAA,MAAA/D,CAAA,CAAgB,CAClD,CAEJ"}
|
|
1
|
+
{"version":3,"file":"GuideRow.js","names":[],"sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tag } from \"@telegraph/tag\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { Gauge } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport {\n GuideRowDetails,\n StatusSummary,\n getSelectableStatusSummary,\n} from \"./GuideRowDetails\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport {\n AnnotatedGuide,\n AnnotatedStatuses,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nexport const GUIDE_ROW_DATA_SELECTOR = \"data-kgt-guide-row-key\";\n\nconst Pill = ({\n label,\n color = \"gray\",\n children,\n}: {\n label: string;\n color?: StatusColor | \"disabled\";\n children: React.ReactNode;\n}) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n gap=\"0_5\"\n px=\"1\"\n height=\"5\"\n bg=\"surface-2\"\n rounded=\"full\"\n border=\"px\"\n borderColor=\"gray-4\"\n >\n <Text as=\"span\" size=\"0\" color={color} weight=\"medium\">\n {label}\n </Text>\n {children}\n </Stack>\n );\n};\n\nconst getStatusSummary = (\n guide: AnnotatedGuide | UncommittedGuide,\n): StatusSummary => {\n if (isUncommittedGuide(guide)) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide has never been committed and published yet\",\n };\n }\n\n const { annotation } = guide;\n\n if (!annotation.active.status) {\n return {\n color: \"red\",\n label: \"Inactive\",\n description: \"This guide is inactive\",\n };\n }\n if (annotation.archived.status) {\n return {\n color: \"red\",\n label: \"Archived\",\n description: \"User has already dismissed this guide\",\n };\n }\n if (!annotation.targetable.status) {\n return {\n color: \"red\",\n label: \"Not targeted\",\n description: annotation.targetable.message,\n };\n }\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n // Prioritize an undefined selectable status ahead of activatable status.\n if (annotation.selectable.status === undefined) {\n return selectableStatusSummary;\n }\n\n if (!annotation.activatable.status) {\n return {\n color: \"red\",\n label: \"Not activated\",\n description: \"This guide cannot be activated in the current location\",\n };\n }\n\n return {\n ...selectableStatusSummary,\n\n // Shorten the label we display here for space.\n ...(annotation.selectable.status === \"returned\"\n ? { label: \"Display\" }\n : undefined),\n };\n};\n\ntype StatusDot = {\n color: StatusColor;\n tooltip?: string;\n};\n\nconst getStatusDots = (\n guide: AnnotatedGuide | UncommittedGuide,\n): Record<keyof AnnotatedStatuses, StatusDot> => {\n if (isUncommittedGuide(guide)) {\n return {\n active: { color: \"gray\" },\n archived: { color: \"gray\" },\n targetable: { color: \"gray\" },\n activatable: { color: \"gray\" },\n selectable: { color: \"gray\" },\n };\n }\n\n const { annotation } = guide;\n\n const active: StatusDot = {\n color: annotation.active.status ? \"blue\" : \"red\",\n tooltip: `Active: ${annotation.active.status ? \"Yes\" : \"No\"}`,\n };\n\n const archived: StatusDot = {\n color: annotation.archived.status ? \"red\" : \"blue\",\n tooltip: `Archived: ${annotation.archived.status ? \"Yes\" : \"No\"}`,\n };\n\n const targetable: StatusDot = {\n color: annotation.targetable.status ? \"blue\" : \"red\",\n tooltip: `Targeting: ${annotation.targetable.status ? \"Yes\" : \"No\"}`,\n };\n\n const activatable: StatusDot = {\n color: annotation.activatable.status ? \"blue\" : \"red\",\n tooltip: `Activated: ${annotation.activatable.status ? \"Yes\" : \"No\"}`,\n };\n\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n const selectable = {\n color: selectableStatusSummary.color,\n tooltip: selectableStatusSummary.label,\n };\n\n return { active, archived, targetable, activatable, selectable };\n};\n\ntype Props = {\n guide: UncommittedGuide | AnnotatedGuide;\n orderIndex: number;\n isExpanded: boolean;\n onClick: (guideKey: string) => void;\n};\n\nexport const GuideRow = ({ guide, orderIndex, isExpanded, onClick }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n const [isHovered, setIsHovered] = React.useState(false);\n\n const focusedGuideKeys = debugSettings.focusedGuideKeys || {};\n const hasFocus = Object.keys(focusedGuideKeys).length > 0;\n const isFocused = !!focusedGuideKeys[guide.key];\n\n const dots = getStatusDots(guide);\n const summary = getStatusSummary(guide);\n const dataAttrs = { [GUIDE_ROW_DATA_SELECTOR]: guide.key };\n\n return (\n <Box\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={isExpanded ? \"gray-6\" : \"transparent\"}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{ cursor: \"pointer\" }}\n {...dataAttrs}\n >\n <Stack\n h=\"7\"\n px=\"1\"\n gap=\"1\"\n align=\"center\"\n justify=\"space-between\"\n rounded=\"3\"\n overflow=\"hidden\"\n border=\"px\"\n borderStyle=\"solid\"\n borderColor={\n isExpanded\n ? \"transparent\"\n : isFocused\n ? \"gray-6\"\n : isHovered\n ? \"gray-4\"\n : \"transparent\"\n }\n backgroundColor={\n isExpanded\n ? \"surface-2\"\n : isFocused\n ? \"gray-2\"\n : isHovered\n ? \"surface-2\"\n : \"transparent\"\n }\n onClick={() => onClick(guide.key)}\n >\n {/* Left section: order + key */}\n <Stack align=\"center\" gap=\"1_5\" style={{ minWidth: 0, flex: 1 }}>\n <Stack w=\"7\" justify=\"space-between\" align=\"center\" gap=\"0_5\">\n <Box w=\"3\">\n {!guide.bypass_global_group_limit && (\n <Icon\n icon={Gauge}\n size=\"0\"\n color=\"gray\"\n alt=\"Subject to throttling\"\n />\n )}\n </Box>\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n style={{ flexShrink: 0 }}\n >\n {orderIndex + 1}\n </Text>\n </Stack>\n <Tooltip\n label={`${guide.key}${guide.bypass_global_group_limit ? \" (unthrottled)\" : \"\"}`}\n {...sharedTooltipProps}\n >\n <Text\n as=\"code\"\n size=\"1\"\n weight=\"medium\"\n color=\"default\"\n style={{\n display: \"block\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n maxWidth: \"200px\",\n }}\n >\n {guide.key}\n </Text>\n </Tooltip>\n </Stack>\n\n {/* Right section: verdict + pills + focus */}\n <Stack align=\"center\" gap=\"1_5\" style={{ flexShrink: 0 }}>\n {!hasFocus && (\n <Tooltip label={summary.description} {...sharedTooltipProps}>\n <Tag size=\"0\" variant=\"soft\" color={summary.color}>\n {summary.label}\n </Tag>\n </Tooltip>\n )}\n\n <Pill\n label=\"Elig:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isEligible\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.active.color}\n tooltip={dots.active.tooltip!}\n />\n <StatusDot\n color={dots.archived.color}\n tooltip={dots.archived.tooltip!}\n />\n <StatusDot\n color={dots.targetable.color}\n tooltip={dots.targetable.tooltip!}\n />\n </Pill>\n <Pill\n label=\"Vis:\"\n color={\n isUncommittedGuide(guide)\n ? \"disabled\"\n : guide.annotation.isQualified &&\n guide.annotation.selectable.status === \"returned\"\n ? \"blue\"\n : \"gray\"\n }\n >\n <StatusDot\n color={dots.activatable.color}\n tooltip={dots.activatable.tooltip!}\n />\n <StatusDot\n color={dots.selectable.color}\n tooltip={dots.selectable.tooltip!}\n />\n </Pill>\n\n <Button\n size=\"0\"\n variant={isFocused ? \"solid\" : \"outline\"}\n color={isFocused ? \"blue\" : \"gray\"}\n disabled={\n isUncommittedGuide(guide) ||\n guide.annotation.selectable.status === undefined\n }\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: isFocused ? {} : { [guide.key]: true },\n });\n }}\n >\n Focus\n </Button>\n </Stack>\n </Stack>\n\n {isExpanded && <GuideRowDetails guide={guide} />}\n </Box>\n );\n};\n"],"mappings":"giBA2BA,IAAa,EAA0B,yBAEjC,GAAQ,CACZ,QACA,QAAQ,OACR,eAOE,EAAA,EAAA,KAAA,CAAC,EAAA,MA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,EAAA,EAAA,IAAA,CAAC,EAAA,gBAAD,CAAwB,OAAQ,CAAA,CAC5C,GAET"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=GuideRowDetails.js.map
|
|
1
|
+
"use strict";const e=require("./helpers.js"),t=require("./GuideAnnotatedStatusDot.js"),n=require("./useInspectGuideClientStore.js");let r=require("@knocklabs/react-core"),i=require("react/jsx-runtime"),a=require("@telegraph/button"),o=require("@telegraph/layout"),s=require("@telegraph/tooltip"),c=require("@telegraph/typography");var l=({title:e,children:t})=>(0,i.jsxs)(o.Stack,{direction:`column`,justify:`flex-start`,gap:`1`,px:`1_5`,py:`1`,rounded:`2`,bg:`surface-1`,border:`px`,borderColor:`gray-4`,style:{flex:1,alignSelf:`stretch`},children:[(0,i.jsx)(c.Text,{as:`span`,size:`0`,color:`gray`,weight:`medium`,children:e}),(0,i.jsx)(o.Stack,{direction:`column`,gap:`1`,children:t})]}),u=({label:n,value:r,color:a,tooltip:l,children:u})=>(0,i.jsxs)(o.Stack,{align:`center`,gap:`1`,children:[(0,i.jsx)(s.Tooltip,{enabled:!!l,label:l,...e.sharedTooltipProps,children:(0,i.jsxs)(o.Stack,{align:`center`,gap:`1`,display:`inline-flex`,children:[(0,i.jsx)(t.GuideAnnotatedStatusDot,{color:a,tooltip:`${n}: ${r}`}),(0,i.jsxs)(c.Text,{as:`span`,size:`1`,weight:`medium`,children:[n,`:`]}),!u&&(0,i.jsx)(c.Text,{as:`span`,size:`1`,weight:`medium`,color:a,children:r})]})}),u]}),d=e=>{switch(e){case`returned`:return{label:`Ready to display`,color:`blue`,description:`The guide is queried and ready to render.`};case`throttled`:return{label:`Throttled`,color:`yellow`,description:`The guide is queried but held back by throttle settings.`};case`queried`:return{label:`Queued`,color:`gray`,description:`The guide is queried but waiting behind higher-priority guides.`};default:return{label:`Not queried`,color:`red`,description:`No useGuide(s) call on this page matches this guide.`}}},f=({guide:t})=>{let{client:f}=(0,r.useGuideContext)();if(n.isUncommittedGuide(t))return(0,i.jsx)(o.Box,{px:`3`,py:`2`,children:(0,i.jsx)(c.Text,{as:`span`,size:`1`,color:`gray`,children:`This guide has never been committed and published.`})});let{annotation:p,dashboard_url:m}=t,h=d(p.selectable.status);return(0,i.jsxs)(o.Stack,{p:`1`,gap:`2`,direction:`row`,align:`flex-start`,children:[(0,i.jsxs)(l,{title:`Eligibility`,children:[(0,i.jsx)(u,{label:`Active`,value:p.active.status?`Yes`:`No`,color:p.active.status?`blue`:`red`,tooltip:`Whether the guide is active in this environment.`}),(0,i.jsx)(u,{label:`Archived`,value:p.archived.status?`Yes`:`No`,color:p.archived.status?`red`:`blue`,tooltip:`Whether the current user has dismissed this guide.`}),(0,i.jsx)(u,{label:`Targeting`,value:p.targetable.status?`Yes`:`No`,color:p.targetable.status?`blue`:`red`,tooltip:`Whether the current user matches the guide's targeting conditions.`})]}),(0,i.jsxs)(l,{title:`Visibility`,children:[(0,i.jsx)(u,{label:`Activation`,value:p.activatable.status?`Yes`:`No`,color:p.activatable.status?`blue`:`red`,tooltip:`Whether the current page matches the guide's activation rules.`}),(0,i.jsx)(u,{label:`Display`,value:h.label,color:h.color,tooltip:`Whether the guide has been queried and is ready to render on the current page.`,children:(0,i.jsx)(s.Tooltip,{label:h.description,...e.sharedTooltipProps,children:(0,i.jsx)(c.Text,{as:`span`,size:`1`,weight:`medium`,color:h.color,children:h.label})})})]}),(0,i.jsxs)(o.Stack,{direction:`column`,justify:`flex-end`,gap:`1`,style:{alignSelf:`stretch`},children:[(0,i.jsx)(a.Button,{size:`0`,variant:`outline`,onClick:()=>f.resetEngagement(t),children:`Reset engagement`}),m&&(0,i.jsx)(a.Button,{size:`0`,variant:`outline`,onClick:()=>window.open(m,`_blank`,`noopener`),children:`Open in dashboard`})]})]})};exports.GuideRowDetails=f,exports.getSelectableStatusSummary=d;
|
|
2
|
+
//# sourceMappingURL=GuideRowDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuideRowDetails.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRowDetails.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport {\n AnnotatedGuide,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst CardContainer = ({\n title,\n children,\n}: {\n title: string;\n children: React.ReactNode;\n}) => (\n <Stack\n direction=\"column\"\n justify=\"flex-start\"\n gap=\"1\"\n px=\"1_5\"\n py=\"1\"\n rounded=\"2\"\n bg=\"surface-1\"\n border=\"px\"\n borderColor=\"gray-4\"\n style={{ flex: 1, alignSelf: \"stretch\" }}\n >\n <Text as=\"span\" size=\"0\" color=\"gray\" weight=\"medium\">\n {title}\n </Text>\n <Stack direction=\"column\" gap=\"1\">\n {children}\n </Stack>\n </Stack>\n);\n\nconst StatusRow = ({\n label,\n value,\n color,\n tooltip,\n children,\n}: {\n label: string;\n value: string;\n color: StatusColor;\n tooltip?: React.ReactNode;\n children?: React.ReactNode;\n}) => {\n return (\n <Stack align=\"center\" gap=\"1\">\n <Tooltip enabled={!!tooltip} label={tooltip} {...sharedTooltipProps}>\n <Stack align=\"center\" gap=\"1\" display=\"inline-flex\">\n <StatusDot color={color} tooltip={`${label}: ${value}`} />\n <Text as=\"span\" size=\"1\" weight=\"medium\">\n {label}:\n </Text>\n {/* User children over value when provided, for cases when we want to\n have its own tooltip over it */}\n {!children && (\n <Text as=\"span\" size=\"1\" weight=\"medium\" color={color}>\n {value}\n </Text>\n )}\n </Stack>\n </Tooltip>\n {children}\n </Stack>\n );\n};\n\nexport type StatusSummary = {\n color: StatusColor;\n label: string;\n description: string;\n};\n\nexport const getSelectableStatusSummary = (\n status: \"returned\" | \"throttled\" | \"queried\" | undefined,\n): StatusSummary => {\n switch (status) {\n case \"returned\":\n return {\n label: \"Ready to display\",\n color: \"blue\",\n description: \"The guide is queried and ready to render.\",\n };\n case \"throttled\":\n return {\n label: \"Throttled\",\n color: \"yellow\",\n description: \"The guide is queried but held back by throttle settings.\",\n };\n case \"queried\":\n return {\n label: \"Queued\",\n color: \"gray\",\n description:\n \"The guide is queried but waiting behind higher-priority guides.\",\n };\n default:\n return {\n label: \"Not queried\",\n color: \"red\",\n description: \"No useGuide(s) call on this page matches this guide.\",\n };\n }\n};\n\nexport const GuideRowDetails = ({\n guide,\n}: {\n guide: AnnotatedGuide | UncommittedGuide;\n}) => {\n const { client } = useGuideContext();\n\n if (isUncommittedGuide(guide)) {\n return (\n <Box px=\"3\" py=\"2\">\n <Text as=\"span\" size=\"1\" color=\"gray\">\n This guide has never been committed and published.\n </Text>\n </Box>\n );\n }\n\n const { annotation, dashboard_url: dashboardUrl } = guide;\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n return (\n <Stack p=\"1\" gap=\"2\" direction=\"row\" align=\"flex-start\">\n <CardContainer title=\"Eligibility\">\n <StatusRow\n label=\"Active\"\n value={annotation.active.status ? \"Yes\" : \"No\"}\n color={annotation.active.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the guide is active in this environment.\"\n />\n <StatusRow\n label=\"Archived\"\n value={annotation.archived.status ? \"Yes\" : \"No\"}\n color={annotation.archived.status ? \"red\" : \"blue\"}\n tooltip=\"Whether the current user has dismissed this guide.\"\n />\n <StatusRow\n label=\"Targeting\"\n value={annotation.targetable.status ? \"Yes\" : \"No\"}\n color={annotation.targetable.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the current user matches the guide's targeting conditions.\"\n />\n </CardContainer>\n <CardContainer title=\"Visibility\">\n <StatusRow\n label=\"Activation\"\n value={annotation.activatable.status ? \"Yes\" : \"No\"}\n color={annotation.activatable.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the current page matches the guide's activation rules.\"\n />\n <StatusRow\n label=\"Display\"\n value={selectableStatusSummary.label}\n color={selectableStatusSummary.color}\n tooltip=\"Whether the guide has been queried and is ready to render on the current page.\"\n >\n <Tooltip\n label={selectableStatusSummary.description}\n {...sharedTooltipProps}\n >\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={selectableStatusSummary.color}\n >\n {selectableStatusSummary.label}\n </Text>\n </Tooltip>\n </StatusRow>\n </CardContainer>\n <Stack\n direction=\"column\"\n justify=\"flex-end\"\n gap=\"1\"\n style={{ alignSelf: \"stretch\" }}\n >\n <Button\n size=\"0\"\n variant=\"outline\"\n onClick={() => client.resetEngagement(guide)}\n >\n Reset engagement\n </Button>\n {dashboardUrl && (\n <Button\n size=\"0\"\n variant=\"outline\"\n onClick={() => window.open(dashboardUrl, \"_blank\", \"noopener\")}\n >\n Open in dashboard\n </Button>\n )}\n </Stack>\n </Stack>\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"GuideRowDetails.js","names":[],"sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRowDetails.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\n\nimport {\n StatusColor,\n GuideAnnotatedStatusDot as StatusDot,\n} from \"./GuideAnnotatedStatusDot\";\nimport { sharedTooltipProps } from \"./helpers\";\nimport {\n AnnotatedGuide,\n UncommittedGuide,\n isUncommittedGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst CardContainer = ({\n title,\n children,\n}: {\n title: string;\n children: React.ReactNode;\n}) => (\n <Stack\n direction=\"column\"\n justify=\"flex-start\"\n gap=\"1\"\n px=\"1_5\"\n py=\"1\"\n rounded=\"2\"\n bg=\"surface-1\"\n border=\"px\"\n borderColor=\"gray-4\"\n style={{ flex: 1, alignSelf: \"stretch\" }}\n >\n <Text as=\"span\" size=\"0\" color=\"gray\" weight=\"medium\">\n {title}\n </Text>\n <Stack direction=\"column\" gap=\"1\">\n {children}\n </Stack>\n </Stack>\n);\n\nconst StatusRow = ({\n label,\n value,\n color,\n tooltip,\n children,\n}: {\n label: string;\n value: string;\n color: StatusColor;\n tooltip?: React.ReactNode;\n children?: React.ReactNode;\n}) => {\n return (\n <Stack align=\"center\" gap=\"1\">\n <Tooltip enabled={!!tooltip} label={tooltip} {...sharedTooltipProps}>\n <Stack align=\"center\" gap=\"1\" display=\"inline-flex\">\n <StatusDot color={color} tooltip={`${label}: ${value}`} />\n <Text as=\"span\" size=\"1\" weight=\"medium\">\n {label}:\n </Text>\n {/* User children over value when provided, for cases when we want to\n have its own tooltip over it */}\n {!children && (\n <Text as=\"span\" size=\"1\" weight=\"medium\" color={color}>\n {value}\n </Text>\n )}\n </Stack>\n </Tooltip>\n {children}\n </Stack>\n );\n};\n\nexport type StatusSummary = {\n color: StatusColor;\n label: string;\n description: string;\n};\n\nexport const getSelectableStatusSummary = (\n status: \"returned\" | \"throttled\" | \"queried\" | undefined,\n): StatusSummary => {\n switch (status) {\n case \"returned\":\n return {\n label: \"Ready to display\",\n color: \"blue\",\n description: \"The guide is queried and ready to render.\",\n };\n case \"throttled\":\n return {\n label: \"Throttled\",\n color: \"yellow\",\n description: \"The guide is queried but held back by throttle settings.\",\n };\n case \"queried\":\n return {\n label: \"Queued\",\n color: \"gray\",\n description:\n \"The guide is queried but waiting behind higher-priority guides.\",\n };\n default:\n return {\n label: \"Not queried\",\n color: \"red\",\n description: \"No useGuide(s) call on this page matches this guide.\",\n };\n }\n};\n\nexport const GuideRowDetails = ({\n guide,\n}: {\n guide: AnnotatedGuide | UncommittedGuide;\n}) => {\n const { client } = useGuideContext();\n\n if (isUncommittedGuide(guide)) {\n return (\n <Box px=\"3\" py=\"2\">\n <Text as=\"span\" size=\"1\" color=\"gray\">\n This guide has never been committed and published.\n </Text>\n </Box>\n );\n }\n\n const { annotation, dashboard_url: dashboardUrl } = guide;\n const selectableStatusSummary = getSelectableStatusSummary(\n annotation.selectable.status,\n );\n\n return (\n <Stack p=\"1\" gap=\"2\" direction=\"row\" align=\"flex-start\">\n <CardContainer title=\"Eligibility\">\n <StatusRow\n label=\"Active\"\n value={annotation.active.status ? \"Yes\" : \"No\"}\n color={annotation.active.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the guide is active in this environment.\"\n />\n <StatusRow\n label=\"Archived\"\n value={annotation.archived.status ? \"Yes\" : \"No\"}\n color={annotation.archived.status ? \"red\" : \"blue\"}\n tooltip=\"Whether the current user has dismissed this guide.\"\n />\n <StatusRow\n label=\"Targeting\"\n value={annotation.targetable.status ? \"Yes\" : \"No\"}\n color={annotation.targetable.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the current user matches the guide's targeting conditions.\"\n />\n </CardContainer>\n <CardContainer title=\"Visibility\">\n <StatusRow\n label=\"Activation\"\n value={annotation.activatable.status ? \"Yes\" : \"No\"}\n color={annotation.activatable.status ? \"blue\" : \"red\"}\n tooltip=\"Whether the current page matches the guide's activation rules.\"\n />\n <StatusRow\n label=\"Display\"\n value={selectableStatusSummary.label}\n color={selectableStatusSummary.color}\n tooltip=\"Whether the guide has been queried and is ready to render on the current page.\"\n >\n <Tooltip\n label={selectableStatusSummary.description}\n {...sharedTooltipProps}\n >\n <Text\n as=\"span\"\n size=\"1\"\n weight=\"medium\"\n color={selectableStatusSummary.color}\n >\n {selectableStatusSummary.label}\n </Text>\n </Tooltip>\n </StatusRow>\n </CardContainer>\n <Stack\n direction=\"column\"\n justify=\"flex-end\"\n gap=\"1\"\n style={{ alignSelf: \"stretch\" }}\n >\n <Button\n size=\"0\"\n variant=\"outline\"\n onClick={() => client.resetEngagement(guide)}\n >\n Reset engagement\n </Button>\n {dashboardUrl && (\n <Button\n size=\"0\"\n variant=\"outline\"\n onClick={() => window.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AAA,IAAA,CAAC,EAAD,CACE,MAAM,aACN,MAAO,EAAW,YAAY,OAAS,MAAQ,KAC/C,MAAO,EAAW,YAAY,OAAS,OAAS,MAChD,QAAQ,gEACT,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,MAAM,UACN,MAAO,EAAwB,MAC/B,MAAO,EAAwB,MAC/B,QAAQ,2FAER,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACE,MAAO,EAAwB,YAC/B,GAAI,EAAA,6BAEJ,EAAA,EAAA,IAAA,CAAC,EAAA,KAAD,CACE,GAAG,OACH,KAAK,IACL,OAAO,SACP,MAAO,EAAwB,eAE9B,EAAwB,KACrB,CAAA,CACC,CAAA,CACA,CAAA,CACE,KACf,EAAA,EAAA,KAAA,CAAC,EAAA,MAAD,CACE,UAAU,SACV,QAAQ,WACR,IAAI,IACJ,MAAO,CAAE,UAAW,SAAU,WAJhC,EAME,EAAA,EAAA,IAAA,CAAC,EAAA,OAAD,CACE,KAAK,IACL,QAAQ,UACR,YAAe,EAAO,gBAAgB,CAAK,WAC5C,kBAEO,CAAA,EACP,IACC,EAAA,EAAA,IAAA,CAAC,EAAA,OAAD,CACE,KAAK,IACL,QAAQ,UACR,YAAe,OAAO,KAAK,EAAc,SAAU,UAAU,WAC9D,mBAEO,CAAA,CAEL,GACF,GAEX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=Kbd.js.map
|
|
1
|
+
"use strict";const e=require("../../../../../_virtual/_rolldown/runtime.js");let t=require("react");t=e.__toESM(t);let n=require("react/jsx-runtime");var r=({children:e})=>(0,n.jsx)(`kbd`,{style:{display:`inline-block`,padding:`1px 4px`,borderRadius:`var(--tgph-rounded-2)`,border:`1px solid rgba(255, 255, 255, 0.3)`,backgroundColor:`rgba(255, 255, 255, 0.15)`},children:e});exports.Kbd=r;
|
|
2
|
+
//# sourceMappingURL=Kbd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Kbd.js","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/Kbd.tsx"],"sourcesContent":["import * as React from \"react\";\n\nexport const Kbd = ({ children }: { children: React.ReactNode }) => {\n return (\n <kbd\n style={{\n display: \"inline-block\",\n padding: \"1px 4px\",\n borderRadius: \"var(--tgph-rounded-2)\",\n border: \"1px solid rgba(255, 255, 255, 0.3)\",\n backgroundColor: \"rgba(255, 255, 255, 0.15)\",\n }}\n >\n {children}\n </kbd>\n );\n};\n"],"
|
|
1
|
+
{"version":3,"file":"Kbd.js","names":[],"sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/Kbd.tsx"],"sourcesContent":["import * as React from \"react\";\n\nexport const Kbd = ({ children }: { children: React.ReactNode }) => {\n return (\n <kbd\n style={{\n display: \"inline-block\",\n padding: \"1px 4px\",\n borderRadius: \"var(--tgph-rounded-2)\",\n border: \"1px solid rgba(255, 255, 255, 0.3)\",\n backgroundColor: \"rgba(255, 255, 255, 0.15)\",\n }}\n >\n {children}\n </kbd>\n );\n};\n"],"mappings":"sJAEA,IAAa,GAAO,CAAE,eAElB,EAAA,EAAA,IAAA,CAAC,MAAD,CACE,MAAO,CACL,QAAS,eACT,QAAS,UACT,aAAc,wBACd,OAAQ,qCACR,gBAAiB,2BACnB,EAEC,UACE,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=V2.js.map
|
|
1
|
+
"use strict";const e=require("../../../../../_virtual/_rolldown/runtime.js"),t=require("../shared.js");;/* empty css */const n=require("../KnockButton.js"),r=require("../useToolbarStyles.js"),i=require("./helpers.js"),a=require("./useInspectGuideClientStore.js"),o=require("./GuideRow.js"),s=require("./Kbd.js"),c=require("./FocusChin.js"),l=require("./GuideContextDetails.js"),u=require("./useDraggable.js");let d=require("@knocklabs/react-core"),f=require("react");f=e.__toESM(f);let p=require("react/jsx-runtime"),m=require("@knocklabs/client"),h=require("@telegraph/button"),g=require("@telegraph/icon"),_=require("@telegraph/layout"),v=require("@telegraph/segmented-control"),y=require("@telegraph/tooltip"),b=require("@telegraph/typography"),x=require("lucide-react");var S=`.`,C=`540px`,w=[`0 0 0 1px rgba(0, 0, 0, 0.06)`,`0 0 0 1px rgba(255, 255, 255, 0.10)`,`inset 0 1px 0 rgba(255, 255, 255, 0.04)`,`0 1px 1px 0 rgba(0, 0, 0, 0.04)`,`0 4px 6px -1px rgba(0, 0, 0, 0.05)`,`0 8px 16px -4px rgba(0, 0, 0, 0.06)`].join(`, `),T=e=>{switch(e){case`all-guides`:return`You have no guides. Get started by creating a guide.`;case`only-active`:return`There are no active guides.`;case`only-eligible`:return`Your current user is not eligible for any guides.`}},E=(e,t)=>e.filter(e=>!(t===`only-eligible`&&!e.annotation.isEligible||t===`only-active`&&!e.annotation.active.status)),D=({readyToTarget:e,listenForUpdates:D})=>{let{client:O}=(0,d.useGuideContext)(),[k,A]=f.default.useState(`only-active`),[j,M]=f.default.useState(()=>m.KnockGuideClient.getToolbarRunConfigFromUrl()),[N,P]=f.default.useState(!1),[F,I]=f.default.useState(!1),[L,R]=f.default.useState();r.useToolbarStyles(!!j?.isVisible),f.default.useEffect(()=>{R(void 0)},[k]),f.default.useEffect(()=>{let{isVisible:t=!1,focusedGuideKeys:n={}}=j||{},r=O.store.state.debug?.debugging;return t&&!r&&e&&(O.setDebug({focusedGuideKeys:n}),Object.keys(n).length>0&&A(`all-guides`)),!t&&r&&O.unsetDebug({listenForUpdates:D}),()=>{O.store.state.debug?.debugging&&O.unsetDebug({listenForUpdates:D})}},[e,D,j,O,A]),f.default.useEffect(()=>{let e=e=>{e.ctrlKey&&e.key===S&&!e.repeat&&(e.preventDefault(),P(e=>!e))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]);let z=f.default.useRef(null),B=f.default.useRef(null),{position:V,isDragging:H,handlePointerDown:U,hasDraggedRef:W}=u.useDraggable({elementRef:z,reclampDeps:[N],initialPosition:{top:16,right:16}}),G=a.useInspectGuideClientStore(j);if(!G||!j?.isVisible)return null;let K=G.status===`ok`?E(G.guides,k):[];return(0,p.jsx)(_.Box,{tgphRef:z,position:`fixed`,style:{top:V.top+`px`,right:V.right+`px`,zIndex:t.TOOLBAR_Z_INDEX},children:N?(0,p.jsx)(y.Tooltip,{side:`left`,label:(0,p.jsxs)(b.Text,{as:`span`,size:`1`,children:[`Guide Toolbar`,(0,p.jsxs)(_.Stack,{display:`inline-block`,ml:`3`,children:[(0,p.jsx)(s.Kbd,{children:`ctrl`}),` + `,(0,p.jsx)(s.Kbd,{children:`.`})]})]}),...i.sharedTooltipProps,children:(0,p.jsx)(_.Stack,{border:`px`,rounded:`4`,align:`center`,justify:`center`,w:`10`,h:`10`,onPointerDown:U,backgroundColor:`surface-1`,style:{cursor:H?`grabbing`:`grab`,touchAction:`none`,userSelect:`none`,animation:`toolbar-collapse-fade-in 150ms ease-out`},children:(0,p.jsx)(_.Box,{style:{transform:`scale(0.7)`,transformOrigin:`center center`},children:(0,p.jsx)(n.KnockButton,{onClick:()=>{W.current||P(!1)},positioned:!1})})})}):(0,p.jsxs)(_.Stack,{direction:`column`,backgroundColor:`surface-1`,rounded:`4`,overflow:`hidden`,style:{width:C,boxShadow:w,animation:`toolbar-expand-fade-in 150ms ease-out`},children:[(0,p.jsxs)(_.Stack,{w:`full`,p:`2`,justify:`space-between`,direction:`row`,align:`center`,gap:`2`,borderBottom:`px`,onPointerDown:U,style:{boxSizing:`border-box`,cursor:H?`grabbing`:`grab`,touchAction:`none`,userSelect:`none`},children:[(0,p.jsxs)(_.Stack,{align:`center`,gap:`1_5`,style:{minWidth:0,flex:1},children:[(0,p.jsx)(_.Stack,{display:`inline-flex`,align:`center`,style:{cursor:H?`grabbing`:`grab`,touchAction:`none`,userSelect:`none`},onPointerDown:e=>{e.stopPropagation(),U(e)},children:(0,p.jsx)(g.Icon,{color:`gray`,size:`1`,icon:x.GripVertical,"aria-hidden":!0})}),(0,p.jsxs)(_.Stack,{align:`center`,gap:`1_5`,onPointerDown:e=>e.stopPropagation(),children:[(0,p.jsxs)(v.SegmentedControl.Root,{size:`1`,type:`single`,value:k,onValueChange:e=>{if(!e)return;let t=O.store.state.debug,n=Object.keys(t?.focusedGuideKeys||{});G.status===`ok`&&n.length>0&&(E(G.guides,e).find(e=>e.key===n[0])||O.setDebug({...t,focusedGuideKeys:{}})),A(e)},children:[(0,p.jsx)(v.SegmentedControl.Option,{value:`all-guides`,style:{width:`54px`},children:`All`}),(0,p.jsx)(v.SegmentedControl.Option,{value:`only-active`,style:{width:`54px`},children:`Active`}),(0,p.jsx)(v.SegmentedControl.Option,{value:`only-eligible`,style:{width:`54px`},children:`Eligible`})]}),(0,p.jsx)(y.Tooltip,{label:`Settings`,...i.sharedTooltipProps,children:(0,p.jsx)(h.Button,{size:`1`,variant:F?`outline`:`ghost`,color:F?`blue`:`gray`,leadingIcon:{icon:x.SlidersHorizontal,alt:`Inspect target params`},trailingIcon:F?{icon:x.ChevronDown,alt:`Hide context data`}:{icon:x.ChevronRight,alt:`Show context data`},onClick:()=>I(e=>!e)})})]})]}),(0,p.jsx)(_.Stack,{align:`center`,gap:`1_5`,style:{flexShrink:0},onPointerDown:e=>e.stopPropagation(),children:(0,p.jsxs)(_.Stack,{align:`center`,gap:`1_5`,children:[(0,p.jsx)(h.Button,{size:`1`,variant:`outline`,leadingIcon:{icon:x.LogOut,alt:`Exit`},onClick:()=>{M(e=>({...e,isVisible:!1}))},children:`Exit`}),(0,p.jsx)(y.Tooltip,{label:`Minimize toolbar`,...i.sharedTooltipProps,children:(0,p.jsx)(h.Button,{size:`1`,variant:`outline`,leadingIcon:{icon:x.Minimize2,alt:`Minimize`},onClick:()=>P(!0)})})]})})]}),F&&(0,p.jsx)(_.Box,{borderBottom:`px`,children:(0,p.jsx)(l.GuideContextDetails,{})}),(0,p.jsx)(_.Box,{tgphRef:B,p:`1`,overflow:`auto`,style:{maxHeight:`calc(80vh - 96px)`},children:G.status===`error`?(0,p.jsx)(_.Box,{px:`2`,pb:`1`,style:{lineHeight:`1.2`},children:(0,p.jsx)(b.Text,{as:`span`,size:`1`,weight:`medium`,color:G.error===`no_guides_fetched`?`default`:`red`,children:G.message})}):K.length===0?(0,p.jsx)(_.Box,{px:`2`,pb:`1`,style:{lineHeight:`1.2`},children:(0,p.jsx)(b.Text,{as:`span`,size:`1`,weight:`medium`,color:`default`,children:T(k)})}):K.map(e=>(0,p.jsx)(o.GuideRow,{guide:e,orderIndex:e.orderIndex,isExpanded:e.key===L,onClick:()=>{R(t=>t&&t===e.key?void 0:e.key)}},e.key))}),(0,p.jsx)(c.FocusChin,{guides:K,guideListRef:B})]})})};exports.V2=D;
|
|
2
|
+
//# sourceMappingURL=V2.js.map
|