@knocklabs/react 0.8.11 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/index.css +1 -1
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/modules/core/utils.js +1 -1
  5. package/dist/cjs/modules/core/utils.js.map +1 -1
  6. package/dist/cjs/modules/feed/components/NotificationFeed/NotificationFeed.js +1 -1
  7. package/dist/cjs/modules/feed/components/NotificationFeed/NotificationFeed.js.map +1 -1
  8. package/dist/cjs/modules/guide/components/LocationSensor/NextAppRouter.js +2 -0
  9. package/dist/cjs/modules/guide/components/LocationSensor/NextAppRouter.js.map +1 -0
  10. package/dist/cjs/modules/guide/components/LocationSensor/NextPagesRouter.js +2 -0
  11. package/dist/cjs/modules/guide/components/LocationSensor/NextPagesRouter.js.map +1 -0
  12. package/dist/cjs/modules/guide/providers/KnockGuideProvider.js +1 -1
  13. package/dist/cjs/modules/guide/providers/KnockGuideProvider.js.map +1 -1
  14. package/dist/esm/index.mjs +90 -86
  15. package/dist/esm/index.mjs.map +1 -1
  16. package/dist/esm/modules/core/utils.mjs +6 -2
  17. package/dist/esm/modules/core/utils.mjs.map +1 -1
  18. package/dist/esm/modules/feed/components/NotificationFeed/NotificationFeed.mjs +31 -26
  19. package/dist/esm/modules/feed/components/NotificationFeed/NotificationFeed.mjs.map +1 -1
  20. package/dist/esm/modules/guide/components/LocationSensor/NextAppRouter.mjs +20 -0
  21. package/dist/esm/modules/guide/components/LocationSensor/NextAppRouter.mjs.map +1 -0
  22. package/dist/esm/modules/guide/components/LocationSensor/NextPagesRouter.mjs +24 -0
  23. package/dist/esm/modules/guide/components/LocationSensor/NextPagesRouter.mjs.map +1 -0
  24. package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs +7 -5
  25. package/dist/esm/modules/guide/providers/KnockGuideProvider.mjs.map +1 -1
  26. package/dist/index.css +1 -1
  27. package/dist/types/index.d.ts +1 -1
  28. package/dist/types/index.d.ts.map +1 -1
  29. package/dist/types/modules/feed/components/NotificationFeed/NotificationFeed.d.ts +6 -1
  30. package/dist/types/modules/feed/components/NotificationFeed/NotificationFeed.d.ts.map +1 -1
  31. package/dist/types/modules/guide/components/LocationSensor/NextAppRouter.d.ts +2 -0
  32. package/dist/types/modules/guide/components/LocationSensor/NextAppRouter.d.ts.map +1 -0
  33. package/dist/types/modules/guide/components/LocationSensor/NextPagesRouter.d.ts +2 -0
  34. package/dist/types/modules/guide/components/LocationSensor/NextPagesRouter.d.ts.map +1 -0
  35. package/dist/types/modules/guide/components/LocationSensor/index.d.ts +3 -0
  36. package/dist/types/modules/guide/components/LocationSensor/index.d.ts.map +1 -0
  37. package/dist/types/modules/guide/components/index.d.ts +1 -0
  38. package/dist/types/modules/guide/components/index.d.ts.map +1 -1
  39. package/dist/types/modules/guide/index.d.ts +1 -1
  40. package/dist/types/modules/guide/index.d.ts.map +1 -1
  41. package/package.json +16 -9
@@ -3,105 +3,109 @@
3
3
  import { Button as r } from "./modules/core/components/Button/Button.mjs";
4
4
  import { ButtonGroup as a } from "./modules/core/components/Button/ButtonGroup.mjs";
5
5
  import { BellIcon as i } from "./modules/core/components/Icons/Bell.mjs";
6
- import { CheckmarkCircle as u } from "./modules/core/components/Icons/CheckmarkCircle.mjs";
6
+ import { CheckmarkCircle as m } from "./modules/core/components/Icons/CheckmarkCircle.mjs";
7
7
  import { ChevronDown as f } from "./modules/core/components/Icons/ChevronDown.mjs";
8
- import { CloseCircle as d } from "./modules/core/components/Icons/CloseCircle.mjs";
8
+ import { CloseCircle as p } from "./modules/core/components/Icons/CloseCircle.mjs";
9
9
  import { Spinner as x } from "./modules/core/components/Spinner/Spinner.mjs";
10
10
  import { default as k } from "./modules/core/hooks/useOnBottomScroll.mjs";
11
11
  import { EmptyFeed as K } from "./modules/feed/components/EmptyFeed/EmptyFeed.mjs";
12
12
  import { NotificationCell as h } from "./modules/feed/components/NotificationCell/NotificationCell.mjs";
13
- import { Avatar as v } from "./modules/feed/components/NotificationCell/Avatar.mjs";
14
- import { NotificationFeed as P } from "./modules/feed/components/NotificationFeed/NotificationFeed.mjs";
15
- import { NotificationFeedHeader as N } from "./modules/feed/components/NotificationFeed/NotificationFeedHeader.mjs";
16
- import { MarkAsRead as b } from "./modules/feed/components/NotificationFeed/MarkAsRead.mjs";
17
- import { NotificationFeedContainer as w } from "./modules/feed/components/NotificationFeedContainer/NotificationFeedContainer.mjs";
18
- import { NotificationFeedPopover as I } from "./modules/feed/components/NotificationFeedPopover/NotificationFeedPopover.mjs";
19
- import { NotificationIconButton as O } from "./modules/feed/components/NotificationIconButton/NotificationIconButton.mjs";
20
- import { UnseenBadge as D } from "./modules/feed/components/UnseenBadge/UnseenBadge.mjs";
21
- import { Banner as H, BannerView as R } from "./modules/guide/components/Banner/Banner.mjs";
22
- import { Card as j, CardView as q } from "./modules/guide/components/Card/Card.mjs";
23
- import { GuideToolbar as J } from "./modules/guide/components/GuideToolbar/GuideToolbar.mjs";
24
- import { Modal as Q, ModalView as W } from "./modules/guide/components/Modal/Modal.mjs";
25
- import { KnockGuideProvider as Y } from "./modules/guide/providers/KnockGuideProvider.mjs";
26
- import { MsTeamsAuthButton as _ } from "./modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.mjs";
27
- import { MsTeamsAuthContainer as ee } from "./modules/ms-teams/components/MsTeamsAuthContainer/MsTeamsAuthContainer.mjs";
28
- import { default as te } from "./modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelCombobox.mjs";
29
- import { SlackAuthButton as ne } from "./modules/slack/components/SlackAuthButton/SlackAuthButton.mjs";
30
- import { SlackAuthContainer as se } from "./modules/slack/components/SlackAuthContainer/SlackAuthContainer.mjs";
31
- import { SlackChannelCombobox as me } from "./modules/slack/components/SlackChannelCombobox/SlackChannelCombobox.mjs";
32
- import { FilterStatus as ce, I18nContext as fe, KnockFeedProvider as le, KnockGuideContext as de, KnockI18nProvider as pe, KnockMsTeamsProvider as xe, KnockProvider as Ce, KnockSlackProvider as ke, feedProviderKey as Se, formatBadgeCount as Ke, formatTimestamp as Te, locales as he, msTeamsProviderKey as Me, renderNodeOrFallback as ve, slackProviderKey as Be, toSentenceCase as Pe, useAuthenticatedKnockClient as Fe, useConnectedMsTeamsChannels as Ne, useConnectedSlackChannels as Ae, useCreateNotificationStore as be, useFeedSettings as Ge, useGuide as we, useGuideContext as ye, useGuides as Ie, useKnockClient as ge, useKnockFeed as Oe, useKnockMsTeamsClient as Ve, useKnockSlackClient as De, useMsTeamsAuth as Ee, useMsTeamsChannels as He, useMsTeamsConnectionStatus as Re, useMsTeamsTeams as Ue, useNotificationStore as je, useNotifications as qe, usePreferences as ze, useSlackAuth as Je, useSlackChannels as Le, useSlackConnectionStatus as Qe, useStableOptions as We, useTranslations as Xe } from "@knocklabs/react-core";
13
+ import { Avatar as M } from "./modules/feed/components/NotificationCell/Avatar.mjs";
14
+ import { NotificationFeed as v } from "./modules/feed/components/NotificationFeed/NotificationFeed.mjs";
15
+ import { NotificationFeedHeader as B } from "./modules/feed/components/NotificationFeed/NotificationFeedHeader.mjs";
16
+ import { MarkAsRead as G } from "./modules/feed/components/NotificationFeed/MarkAsRead.mjs";
17
+ import { NotificationFeedContainer as g } from "./modules/feed/components/NotificationFeedContainer/NotificationFeedContainer.mjs";
18
+ import { NotificationFeedPopover as w } from "./modules/feed/components/NotificationFeedPopover/NotificationFeedPopover.mjs";
19
+ import { NotificationIconButton as I } from "./modules/feed/components/NotificationIconButton/NotificationIconButton.mjs";
20
+ import { UnseenBadge as O } from "./modules/feed/components/UnseenBadge/UnseenBadge.mjs";
21
+ import { Banner as D, BannerView as E } from "./modules/guide/components/Banner/Banner.mjs";
22
+ import { Card as U, CardView as j } from "./modules/guide/components/Card/Card.mjs";
23
+ import { GuideToolbar as z } from "./modules/guide/components/GuideToolbar/GuideToolbar.mjs";
24
+ import { LocationSensorNextAppRouter as Q } from "./modules/guide/components/LocationSensor/NextAppRouter.mjs";
25
+ import { LocationSensorNextPagesRouter as X } from "./modules/guide/components/LocationSensor/NextPagesRouter.mjs";
26
+ import { Modal as Z, ModalView as _ } from "./modules/guide/components/Modal/Modal.mjs";
27
+ import { KnockGuideProvider as ee } from "./modules/guide/providers/KnockGuideProvider.mjs";
28
+ import { MsTeamsAuthButton as te } from "./modules/ms-teams/components/MsTeamsAuthButton/MsTeamsAuthButton.mjs";
29
+ import { MsTeamsAuthContainer as ne } from "./modules/ms-teams/components/MsTeamsAuthContainer/MsTeamsAuthContainer.mjs";
30
+ import { default as se } from "./modules/ms-teams/components/MsTeamsChannelCombobox/MsTeamsChannelCombobox.mjs";
31
+ import { SlackAuthButton as ue } from "./modules/slack/components/SlackAuthButton/SlackAuthButton.mjs";
32
+ import { SlackAuthContainer as ce } from "./modules/slack/components/SlackAuthContainer/SlackAuthContainer.mjs";
33
+ import { SlackChannelCombobox as le } from "./modules/slack/components/SlackChannelCombobox/SlackChannelCombobox.mjs";
34
+ import { FilterStatus as de, I18nContext as xe, KnockFeedProvider as Ce, KnockGuideContext as ke, KnockI18nProvider as Se, KnockMsTeamsProvider as Ke, KnockProvider as Te, KnockSlackProvider as he, feedProviderKey as Ne, formatBadgeCount as Me, formatTimestamp as Pe, locales as ve, msTeamsProviderKey as Ae, renderNodeOrFallback as Be, slackProviderKey as Fe, toSentenceCase as Ge, useAuthenticatedKnockClient as be, useConnectedMsTeamsChannels as ge, useConnectedSlackChannels as Re, useCreateNotificationStore as we, useFeedSettings as ye, useGuide as Ie, useGuideContext as Le, useGuides as Oe, useKnockClient as Ve, useKnockFeed as De, useKnockMsTeamsClient as Ee, useKnockSlackClient as He, useMsTeamsAuth as Ue, useMsTeamsChannels as je, useMsTeamsConnectionStatus as qe, useMsTeamsTeams as ze, useNotificationStore as Je, useNotifications as Qe, usePreferences as We, useSlackAuth as Xe, useSlackChannels as Ye, useSlackConnectionStatus as Ze, useStableOptions as _e, useTranslations as $e } from "@knocklabs/react-core";
33
35
  export {
34
- v as Avatar,
35
- H as Banner,
36
- R as BannerView,
36
+ M as Avatar,
37
+ D as Banner,
38
+ E as BannerView,
37
39
  i as BellIcon,
38
40
  r as Button,
39
41
  a as ButtonGroup,
40
- j as Card,
41
- q as CardView,
42
- u as CheckmarkCircle,
42
+ U as Card,
43
+ j as CardView,
44
+ m as CheckmarkCircle,
43
45
  f as ChevronDown,
44
- d as CloseCircle,
46
+ p as CloseCircle,
45
47
  K as EmptyFeed,
46
- ce as FilterStatus,
47
- fe as I18nContext,
48
- le as KnockFeedProvider,
49
- de as KnockGuideContext,
50
- Y as KnockGuideProvider,
51
- J as KnockGuideToolbar,
52
- pe as KnockI18nProvider,
53
- xe as KnockMsTeamsProvider,
54
- Ce as KnockProvider,
55
- ke as KnockSlackProvider,
56
- b as MarkAsRead,
57
- Q as Modal,
58
- W as ModalView,
59
- _ as MsTeamsAuthButton,
60
- ee as MsTeamsAuthContainer,
61
- te as MsTeamsChannelCombobox,
48
+ de as FilterStatus,
49
+ xe as I18nContext,
50
+ Ce as KnockFeedProvider,
51
+ ke as KnockGuideContext,
52
+ Q as KnockGuideLocationSensorNextAppRouter,
53
+ X as KnockGuideLocationSensorNextPagesRouter,
54
+ ee as KnockGuideProvider,
55
+ z as KnockGuideToolbar,
56
+ Se as KnockI18nProvider,
57
+ Ke as KnockMsTeamsProvider,
58
+ Te as KnockProvider,
59
+ he as KnockSlackProvider,
60
+ G as MarkAsRead,
61
+ Z as Modal,
62
+ _ as ModalView,
63
+ te as MsTeamsAuthButton,
64
+ ne as MsTeamsAuthContainer,
65
+ se as MsTeamsChannelCombobox,
62
66
  h as NotificationCell,
63
- P as NotificationFeed,
64
- w as NotificationFeedContainer,
65
- N as NotificationFeedHeader,
66
- I as NotificationFeedPopover,
67
- O as NotificationIconButton,
68
- ne as SlackAuthButton,
69
- se as SlackAuthContainer,
70
- me as SlackChannelCombobox,
67
+ v as NotificationFeed,
68
+ g as NotificationFeedContainer,
69
+ B as NotificationFeedHeader,
70
+ w as NotificationFeedPopover,
71
+ I as NotificationIconButton,
72
+ ue as SlackAuthButton,
73
+ ce as SlackAuthContainer,
74
+ le as SlackChannelCombobox,
71
75
  x as Spinner,
72
- D as UnseenBadge,
73
- Se as feedProviderKey,
74
- Ke as formatBadgeCount,
75
- Te as formatTimestamp,
76
- he as locales,
77
- Me as msTeamsProviderKey,
78
- ve as renderNodeOrFallback,
79
- Be as slackProviderKey,
80
- Pe as toSentenceCase,
81
- Fe as useAuthenticatedKnockClient,
82
- Ne as useConnectedMsTeamsChannels,
83
- Ae as useConnectedSlackChannels,
84
- be as useCreateNotificationStore,
85
- Ge as useFeedSettings,
86
- we as useGuide,
87
- ye as useGuideContext,
88
- Ie as useGuides,
89
- ge as useKnockClient,
90
- Oe as useKnockFeed,
91
- Ve as useKnockMsTeamsClient,
92
- De as useKnockSlackClient,
93
- Ee as useMsTeamsAuth,
94
- He as useMsTeamsChannels,
95
- Re as useMsTeamsConnectionStatus,
96
- Ue as useMsTeamsTeams,
97
- je as useNotificationStore,
98
- qe as useNotifications,
76
+ O as UnseenBadge,
77
+ Ne as feedProviderKey,
78
+ Me as formatBadgeCount,
79
+ Pe as formatTimestamp,
80
+ ve as locales,
81
+ Ae as msTeamsProviderKey,
82
+ Be as renderNodeOrFallback,
83
+ Fe as slackProviderKey,
84
+ Ge as toSentenceCase,
85
+ be as useAuthenticatedKnockClient,
86
+ ge as useConnectedMsTeamsChannels,
87
+ Re as useConnectedSlackChannels,
88
+ we as useCreateNotificationStore,
89
+ ye as useFeedSettings,
90
+ Ie as useGuide,
91
+ Le as useGuideContext,
92
+ Oe as useGuides,
93
+ Ve as useKnockClient,
94
+ De as useKnockFeed,
95
+ Ee as useKnockMsTeamsClient,
96
+ He as useKnockSlackClient,
97
+ Ue as useMsTeamsAuth,
98
+ je as useMsTeamsChannels,
99
+ qe as useMsTeamsConnectionStatus,
100
+ ze as useMsTeamsTeams,
101
+ Je as useNotificationStore,
102
+ Qe as useNotifications,
99
103
  k as useOnBottomScroll,
100
- ze as usePreferences,
101
- Je as useSlackAuth,
102
- Le as useSlackChannels,
103
- Qe as useSlackConnectionStatus,
104
- We as useStableOptions,
105
- Xe as useTranslations
104
+ We as usePreferences,
105
+ Xe as useSlackAuth,
106
+ Ye as useSlackChannels,
107
+ Ze as useSlackConnectionStatus,
108
+ _e as useStableOptions,
109
+ $e as useTranslations
106
110
  };
107
111
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,12 @@
1
1
  const r = (e) => {
2
- const n = window.screenLeft ?? window.screenX, t = window.screenTop ?? window.screenY, o = window.innerWidth ?? document.documentElement.clientWidth ?? screen.width, i = window.innerHeight ?? document.documentElement.clientHeight ?? screen.height, c = o / 2 - 600 / 2 + n, h = `width=600,height=800,top=${i / 2 - 800 / 2 + t},left=${c}`;
3
- window.open(e, "_blank", h);
2
+ const n = window.screenLeft ?? window.screenX, t = window.screenTop ?? window.screenY, o = window.innerWidth ?? document.documentElement.clientWidth ?? screen.width, i = window.innerHeight ?? document.documentElement.clientHeight ?? screen.height, c = o / 2 - 600 / 2 + n, d = `width=600,height=800,top=${i / 2 - 800 / 2 + t},left=${c}`;
3
+ window.open(e, "_blank", d);
4
+ }, p = () => {
5
+ if (typeof window < "u")
6
+ return window;
4
7
  };
5
8
  export {
9
+ p as checkForWindow,
6
10
  r as openPopupWindow
7
11
  };
8
12
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../../../../src/modules/core/utils.ts"],"sourcesContent":["export const openPopupWindow = (url: string) => {\n const width = 600;\n const height = 800;\n // Calculate the position to center the window\n const screenLeft = window.screenLeft ?? window.screenX;\n const screenTop = window.screenTop ?? window.screenY;\n\n const innerWidth =\n window.innerWidth ?? document.documentElement.clientWidth ?? screen.width;\n const innerHeight =\n window.innerHeight ??\n document.documentElement.clientHeight ??\n screen.height;\n\n const left = innerWidth / 2 - width / 2 + screenLeft;\n const top = innerHeight / 2 - height / 2 + screenTop;\n\n // Window features\n const features = `width=${width},height=${height},top=${top},left=${left}`;\n\n window.open(url, \"_blank\", features);\n};\n\nexport const checkForWindow = () => {\n if (typeof window !== \"undefined\") {\n return window;\n }\n};\n"],"names":["openPopupWindow","url","screenLeft","window","screenX","screenTop","screenY","innerWidth","document","documentElement","clientWidth","screen","width","innerHeight","clientHeight","height","left","features","open"],"mappings":"AAAaA,MAAAA,IAAkBA,CAACC,MAAgB;AAIxCC,QAAAA,IAAaC,OAAOD,cAAcC,OAAOC,SACzCC,IAAYF,OAAOE,aAAaF,OAAOG,SAEvCC,IACJJ,OAAOI,cAAcC,SAASC,gBAAgBC,eAAeC,OAAOC,OAChEC,IACJV,OAAOU,eACPL,SAASC,gBAAgBK,gBACzBH,OAAOI,QAEHC,IAAOT,IAAa,IAAIK,MAAQ,IAAIV,GAIpCe,IAAW,4BAHLJ,IAAc,IAAIE,MAAS,IAAIV,CAGgB,SAASW,CAAI;AAEjEE,SAAAA,KAAKjB,GAAK,UAAUgB,CAAQ;AACrC;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../../../../src/modules/core/utils.ts"],"sourcesContent":["export const openPopupWindow = (url: string) => {\n const width = 600;\n const height = 800;\n // Calculate the position to center the window\n const screenLeft = window.screenLeft ?? window.screenX;\n const screenTop = window.screenTop ?? window.screenY;\n\n const innerWidth =\n window.innerWidth ?? document.documentElement.clientWidth ?? screen.width;\n const innerHeight =\n window.innerHeight ??\n document.documentElement.clientHeight ??\n screen.height;\n\n const left = innerWidth / 2 - width / 2 + screenLeft;\n const top = innerHeight / 2 - height / 2 + screenTop;\n\n // Window features\n const features = `width=${width},height=${height},top=${top},left=${left}`;\n\n window.open(url, \"_blank\", features);\n};\n\nexport const checkForWindow = () => {\n if (typeof window !== \"undefined\") {\n return window;\n }\n};\n"],"names":["openPopupWindow","url","screenLeft","window","screenX","screenTop","screenY","innerWidth","document","documentElement","clientWidth","screen","width","innerHeight","clientHeight","height","left","features","open","checkForWindow"],"mappings":"AAAaA,MAAAA,IAAkBA,CAACC,MAAgB;AAIxCC,QAAAA,IAAaC,OAAOD,cAAcC,OAAOC,SACzCC,IAAYF,OAAOE,aAAaF,OAAOG,SAEvCC,IACJJ,OAAOI,cAAcC,SAASC,gBAAgBC,eAAeC,OAAOC,OAChEC,IACJV,OAAOU,eACPL,SAASC,gBAAgBK,gBACzBH,OAAOI,QAEHC,IAAOT,IAAa,IAAIK,MAAQ,IAAIV,GAIpCe,IAAW,4BAHLJ,IAAc,IAAIE,MAAS,IAAIV,CAGgB,SAASW,CAAI;AAEjEE,SAAAA,KAAKjB,GAAK,UAAUgB,CAAQ;AACrC,GAEaE,IAAiBA,MAAM;AAC9B,MAAA,OAAOhB,SAAW;AACbA,WAAAA;AAEX;"}
@@ -1,63 +1,68 @@
1
- import { isRequestInFlight as C, NetworkStatus as f } from "@knocklabs/client";
2
- import { FilterStatus as I, useKnockFeed as R, useFeedSettings as B, useTranslations as q } from "@knocklabs/react-core";
1
+ import { isRequestInFlight as y, NetworkStatus as f } from "@knocklabs/client";
2
+ import { FilterStatus as C, useKnockFeed as I, useFeedSettings as B, useTranslations as q } from "@knocklabs/react-core";
3
3
  import e, { useState as x, useRef as K, useEffect as p, useCallback as H } from "react";
4
4
  import { Spinner as M } from "../../../core/components/Spinner/Spinner.mjs";
5
5
  import P from "../../../core/hooks/useOnBottomScroll.mjs";
6
6
  import { EmptyFeed as z } from "../EmptyFeed/EmptyFeed.mjs";
7
7
  import { NotificationCell as A } from "../NotificationCell/NotificationCell.mjs";
8
8
  /* empty css */
9
- import { NotificationFeedHeader as L } from "./NotificationFeedHeader.mjs";
9
+ import { NotificationFeedHeader as O } from "./NotificationFeedHeader.mjs";
10
10
  /* empty css */
11
- const O = (t) => /* @__PURE__ */ e.createElement(A, { key: t.item.id, ...t }), T = (t) => /* @__PURE__ */ e.createElement(L, { ...t }), k = ({
11
+ const T = (t) => /* @__PURE__ */ e.createElement(A, { key: t.item.id, ...t }), U = (t) => /* @__PURE__ */ e.createElement(O, { ...t }), $ = ({
12
12
  colorMode: t
13
- }) => /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__spinner-container" }, /* @__PURE__ */ e.createElement(M, { thickness: 3, size: "16px", color: t === "dark" ? "rgba(255, 255, 255, 0.65)" : void 0 })), U = "https://knock.app?utm_source=powered-by-knock&utm_medium=referral&utm_campaign=knock-branding-feed", Z = ({
13
+ }) => /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__spinner-container" }, /* @__PURE__ */ e.createElement(M, { thickness: 3, size: "16px", color: t === "dark" ? "rgba(255, 255, 255, 0.65)" : void 0 })), j = "https://knock.app?utm_source=powered-by-knock&utm_medium=referral&utm_campaign=knock-branding-feed", ee = ({
14
14
  EmptyComponent: t = /* @__PURE__ */ e.createElement(z, null),
15
- renderItem: _ = O,
15
+ renderItem: _ = T,
16
16
  onNotificationClick: g,
17
17
  onNotificationButtonClick: E,
18
18
  onMarkAllAsReadClick: b,
19
- initialFilterStatus: r = I.All,
19
+ initialFilterStatus: r = C.All,
20
20
  header: N,
21
- renderHeader: S = T
21
+ renderHeader: h = U,
22
+ renderLoading: m = $
22
23
  }) => {
23
- const [a, m] = x(r), {
24
+ const [a, l] = x(r), {
24
25
  feedClient: n,
25
- useFeedStore: h,
26
+ useFeedStore: S,
26
27
  colorMode: c
27
- } = R(), {
28
+ } = I(), {
28
29
  settings: i
29
30
  } = B(n), {
30
31
  t: F
31
32
  } = q(), {
32
- pageInfo: l,
33
- items: d,
33
+ pageInfo: d,
34
+ items: u,
34
35
  networkStatus: o
35
- } = h(), u = K(null);
36
+ } = S(), k = K(null);
36
37
  p(() => {
37
- m(r);
38
+ l(r);
38
39
  }, [r]), p(() => {
39
40
  n.fetch({
40
41
  status: a
41
42
  });
42
43
  }, [n, a]);
43
- const v = d.length === 0, s = C(o), w = H(() => {
44
- !s && l.after && n.fetchNextPage();
45
- }, [s, l, n]);
44
+ const R = u.length === 0, s = y(o), v = H(() => {
45
+ !s && d.after && n.fetchNextPage();
46
+ }, [s, d, n]);
46
47
  return P({
47
- ref: u,
48
- callback: w,
48
+ ref: k,
49
+ callback: v,
49
50
  offset: 70
50
- }), /* @__PURE__ */ e.createElement("div", { className: `rnf-notification-feed rnf-notification-feed--${c}` }, N || S({
51
- setFilterStatus: m,
51
+ }), /* @__PURE__ */ e.createElement("div", { className: `rnf-notification-feed rnf-notification-feed--${c}` }, N || h({
52
+ setFilterStatus: l,
52
53
  filterStatus: a,
53
54
  onMarkAllAsReadClick: b
54
- }), /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__container", ref: u }, o === f.loading && /* @__PURE__ */ e.createElement(k, { colorMode: c }), /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__feed-items-container" }, o !== f.loading && d.map((y) => _({
55
- item: y,
55
+ }), /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__container", ref: k }, o === f.loading && m({
56
+ colorMode: c
57
+ }), /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__feed-items-container" }, o !== f.loading && u.map((w) => _({
58
+ item: w,
56
59
  onItemClick: g,
57
60
  onButtonClick: E
58
- }))), o === f.fetchMore && /* @__PURE__ */ e.createElement(k, { colorMode: c }), !s && v && t), (i == null ? void 0 : i.features.branding_required) && /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__knock-branding" }, /* @__PURE__ */ e.createElement("a", { href: U, target: "_blank" }, F("poweredBy") || "Powered by Knock")));
61
+ }))), o === f.fetchMore && m({
62
+ colorMode: c
63
+ }), !s && R && t), (i == null ? void 0 : i.features.branding_required) && /* @__PURE__ */ e.createElement("div", { className: "rnf-notification-feed__knock-branding" }, /* @__PURE__ */ e.createElement("a", { href: j, target: "_blank" }, F("poweredBy") || "Powered by Knock")));
59
64
  };
60
65
  export {
61
- Z as NotificationFeed
66
+ ee as NotificationFeed
62
67
  };
63
68
  //# sourceMappingURL=NotificationFeed.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationFeed.mjs","sources":["../../../../../../src/modules/feed/components/NotificationFeed/NotificationFeed.tsx"],"sourcesContent":["import { FeedItem, NetworkStatus, isRequestInFlight } from \"@knocklabs/client\";\nimport {\n ColorMode,\n FilterStatus,\n useFeedSettings,\n useKnockFeed,\n useTranslations,\n} from \"@knocklabs/react-core\";\nimport { GenericData } from \"@knocklabs/types\";\nimport React, {\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { Spinner } from \"../../../core/components/Spinner\";\nimport useOnBottomScroll from \"../../../core/hooks/useOnBottomScroll\";\nimport { EmptyFeed } from \"../EmptyFeed\";\nimport { NotificationCell, NotificationCellProps } from \"../NotificationCell\";\n\nimport {\n NotificationFeedHeader,\n NotificationFeedHeaderProps,\n} from \"./NotificationFeedHeader\";\nimport \"./styles.css\";\n\nexport type RenderItemProps<T = GenericData> = {\n item: FeedItem<T>;\n onItemClick?: NotificationCellProps[\"onItemClick\"];\n onButtonClick?: NotificationCellProps[\"onButtonClick\"];\n};\n\nexport type RenderItem = (props: RenderItemProps) => ReactNode;\n\nexport interface NotificationFeedProps {\n EmptyComponent?: ReactNode;\n /**\n * @deprecated Use `renderHeader` instead to accept `NotificationFeedHeaderProps`\n */\n header?: ReactNode;\n renderItem?: RenderItem;\n renderHeader?: (props: NotificationFeedHeaderProps) => ReactNode;\n onNotificationClick?: NotificationCellProps[\"onItemClick\"];\n onNotificationButtonClick?: NotificationCellProps[\"onButtonClick\"];\n onMarkAllAsReadClick?: (e: React.MouseEvent, unreadItems: FeedItem[]) => void;\n initialFilterStatus?: FilterStatus;\n}\n\nconst defaultRenderItem = (props: RenderItemProps) => (\n <NotificationCell key={props.item.id} {...props} />\n);\n\nconst defaultRenderHeader = (props: NotificationFeedHeaderProps) => (\n <NotificationFeedHeader {...props} />\n);\n\nconst LoadingSpinner = ({ colorMode }: { colorMode: ColorMode }) => (\n <div className=\"rnf-notification-feed__spinner-container\">\n <Spinner\n thickness={3}\n size=\"16px\"\n color={colorMode === \"dark\" ? \"rgba(255, 255, 255, 0.65)\" : undefined}\n />\n </div>\n);\n\nconst poweredByKnockUrl =\n \"https://knock.app?utm_source=powered-by-knock&utm_medium=referral&utm_campaign=knock-branding-feed\";\n\nexport const NotificationFeed: React.FC<NotificationFeedProps> = ({\n EmptyComponent = <EmptyFeed />,\n renderItem = defaultRenderItem,\n onNotificationClick,\n onNotificationButtonClick,\n onMarkAllAsReadClick,\n initialFilterStatus = FilterStatus.All,\n header,\n renderHeader = defaultRenderHeader,\n}) => {\n const [status, setStatus] = useState(initialFilterStatus);\n const { feedClient, useFeedStore, colorMode } = useKnockFeed();\n const { settings } = useFeedSettings(feedClient);\n const { t } = useTranslations();\n\n const { pageInfo, items, networkStatus } = useFeedStore();\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setStatus(initialFilterStatus);\n }, [initialFilterStatus]);\n\n useEffect(() => {\n // When the feed client changes, or the status changes issue a re-fetch\n feedClient.fetch({ status });\n }, [feedClient, status]);\n\n const noItems = items.length === 0;\n const requestInFlight = isRequestInFlight(networkStatus);\n\n // Handle fetching more once we reach the bottom of the list\n const onBottomCallback = useCallback(() => {\n if (!requestInFlight && pageInfo.after) {\n feedClient.fetchNextPage();\n }\n }, [requestInFlight, pageInfo, feedClient]);\n\n // Once we scroll to the bottom of the view we want to automatically fetch\n // more items for the feed and bring them into the list\n useOnBottomScroll({\n ref: containerRef,\n callback: onBottomCallback,\n offset: 70,\n });\n\n return (\n <div\n className={`rnf-notification-feed rnf-notification-feed--${colorMode}`}\n >\n {header ||\n renderHeader({\n setFilterStatus: setStatus,\n filterStatus: status,\n onMarkAllAsReadClick,\n })}\n\n <div className=\"rnf-notification-feed__container\" ref={containerRef}>\n {networkStatus === NetworkStatus.loading && (\n <LoadingSpinner colorMode={colorMode} />\n )}\n\n <div className=\"rnf-notification-feed__feed-items-container\">\n {networkStatus !== NetworkStatus.loading &&\n items.map((item: FeedItem) =>\n renderItem({\n item,\n onItemClick: onNotificationClick,\n onButtonClick: onNotificationButtonClick,\n }),\n )}\n </div>\n\n {networkStatus === NetworkStatus.fetchMore && (\n <LoadingSpinner colorMode={colorMode} />\n )}\n\n {!requestInFlight && noItems && EmptyComponent}\n </div>\n\n {settings?.features.branding_required && (\n <div className=\"rnf-notification-feed__knock-branding\">\n <a href={poweredByKnockUrl} target=\"_blank\">\n {t(\"poweredBy\") || \"Powered by Knock\"}\n </a>\n </div>\n )}\n </div>\n );\n};\n"],"names":["defaultRenderItem","props","React","NotificationCell","item","id","defaultRenderHeader","NotificationFeedHeader","LoadingSpinner","colorMode","Spinner","undefined","poweredByKnockUrl","NotificationFeed","EmptyComponent","EmptyFeed","renderItem","onNotificationClick","onNotificationButtonClick","onMarkAllAsReadClick","initialFilterStatus","FilterStatus","All","header","renderHeader","status","setStatus","useState","feedClient","useFeedStore","useKnockFeed","settings","useFeedSettings","t","useTranslations","pageInfo","items","networkStatus","containerRef","useRef","useEffect","fetch","noItems","length","requestInFlight","isRequestInFlight","onBottomCallback","useCallback","after","fetchNextPage","useOnBottomScroll","ref","callback","offset","setFilterStatus","filterStatus","NetworkStatus","loading","map","onItemClick","onButtonClick","fetchMore","features","branding_required"],"mappings":"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"}
1
+ {"version":3,"file":"NotificationFeed.mjs","sources":["../../../../../../src/modules/feed/components/NotificationFeed/NotificationFeed.tsx"],"sourcesContent":["import { FeedItem, NetworkStatus, isRequestInFlight } from \"@knocklabs/client\";\nimport {\n ColorMode,\n FilterStatus,\n useFeedSettings,\n useKnockFeed,\n useTranslations,\n} from \"@knocklabs/react-core\";\nimport { GenericData } from \"@knocklabs/types\";\nimport React, {\n ReactNode,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport { Spinner } from \"../../../core/components/Spinner\";\nimport useOnBottomScroll from \"../../../core/hooks/useOnBottomScroll\";\nimport { EmptyFeed } from \"../EmptyFeed\";\nimport { NotificationCell, NotificationCellProps } from \"../NotificationCell\";\n\nimport {\n NotificationFeedHeader,\n NotificationFeedHeaderProps,\n} from \"./NotificationFeedHeader\";\nimport \"./styles.css\";\n\nexport type RenderItemProps<T = GenericData> = {\n item: FeedItem<T>;\n onItemClick?: NotificationCellProps[\"onItemClick\"];\n onButtonClick?: NotificationCellProps[\"onButtonClick\"];\n};\n\nexport type RenderItem = (props: RenderItemProps) => ReactNode;\n\nexport type RenderLoadingProps = {\n colorMode: ColorMode;\n};\n\nexport type RenderLoading = (props: RenderLoadingProps) => ReactNode;\n\nexport interface NotificationFeedProps {\n EmptyComponent?: ReactNode;\n /**\n * @deprecated Use `renderHeader` instead to accept `NotificationFeedHeaderProps`\n */\n header?: ReactNode;\n renderItem?: RenderItem;\n renderHeader?: (props: NotificationFeedHeaderProps) => ReactNode;\n onNotificationClick?: NotificationCellProps[\"onItemClick\"];\n onNotificationButtonClick?: NotificationCellProps[\"onButtonClick\"];\n onMarkAllAsReadClick?: (e: React.MouseEvent, unreadItems: FeedItem[]) => void;\n initialFilterStatus?: FilterStatus;\n renderLoading?: RenderLoading;\n}\n\nconst defaultRenderItem = (props: RenderItemProps) => (\n <NotificationCell key={props.item.id} {...props} />\n);\n\nconst defaultRenderHeader = (props: NotificationFeedHeaderProps) => (\n <NotificationFeedHeader {...props} />\n);\n\nconst defaultRenderLoading = ({ colorMode }: RenderLoadingProps) => (\n <div className=\"rnf-notification-feed__spinner-container\">\n <Spinner\n thickness={3}\n size=\"16px\"\n color={colorMode === \"dark\" ? \"rgba(255, 255, 255, 0.65)\" : undefined}\n />\n </div>\n);\n\nconst poweredByKnockUrl =\n \"https://knock.app?utm_source=powered-by-knock&utm_medium=referral&utm_campaign=knock-branding-feed\";\n\nexport const NotificationFeed: React.FC<NotificationFeedProps> = ({\n EmptyComponent = <EmptyFeed />,\n renderItem = defaultRenderItem,\n onNotificationClick,\n onNotificationButtonClick,\n onMarkAllAsReadClick,\n initialFilterStatus = FilterStatus.All,\n header,\n renderHeader = defaultRenderHeader,\n renderLoading = defaultRenderLoading,\n}) => {\n const [status, setStatus] = useState(initialFilterStatus);\n const { feedClient, useFeedStore, colorMode } = useKnockFeed();\n const { settings } = useFeedSettings(feedClient);\n const { t } = useTranslations();\n\n const { pageInfo, items, networkStatus } = useFeedStore();\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setStatus(initialFilterStatus);\n }, [initialFilterStatus]);\n\n useEffect(() => {\n // When the feed client changes, or the status changes issue a re-fetch\n feedClient.fetch({ status });\n }, [feedClient, status]);\n\n const noItems = items.length === 0;\n const requestInFlight = isRequestInFlight(networkStatus);\n\n // Handle fetching more once we reach the bottom of the list\n const onBottomCallback = useCallback(() => {\n if (!requestInFlight && pageInfo.after) {\n feedClient.fetchNextPage();\n }\n }, [requestInFlight, pageInfo, feedClient]);\n\n // Once we scroll to the bottom of the view we want to automatically fetch\n // more items for the feed and bring them into the list\n useOnBottomScroll({\n ref: containerRef,\n callback: onBottomCallback,\n offset: 70,\n });\n\n return (\n <div\n className={`rnf-notification-feed rnf-notification-feed--${colorMode}`}\n >\n {header ||\n renderHeader({\n setFilterStatus: setStatus,\n filterStatus: status,\n onMarkAllAsReadClick,\n })}\n\n <div className=\"rnf-notification-feed__container\" ref={containerRef}>\n {networkStatus === NetworkStatus.loading &&\n renderLoading({ colorMode })}\n\n <div className=\"rnf-notification-feed__feed-items-container\">\n {networkStatus !== NetworkStatus.loading &&\n items.map((item: FeedItem) =>\n renderItem({\n item,\n onItemClick: onNotificationClick,\n onButtonClick: onNotificationButtonClick,\n }),\n )}\n </div>\n\n {networkStatus === NetworkStatus.fetchMore &&\n renderLoading({ colorMode })}\n\n {!requestInFlight && noItems && EmptyComponent}\n </div>\n\n {settings?.features.branding_required && (\n <div className=\"rnf-notification-feed__knock-branding\">\n <a href={poweredByKnockUrl} target=\"_blank\">\n {t(\"poweredBy\") || \"Powered by Knock\"}\n </a>\n </div>\n )}\n </div>\n );\n};\n"],"names":["defaultRenderItem","props","React","NotificationCell","item","id","defaultRenderHeader","NotificationFeedHeader","defaultRenderLoading","colorMode","Spinner","undefined","poweredByKnockUrl","NotificationFeed","EmptyComponent","EmptyFeed","renderItem","onNotificationClick","onNotificationButtonClick","onMarkAllAsReadClick","initialFilterStatus","FilterStatus","All","header","renderHeader","renderLoading","status","setStatus","useState","feedClient","useFeedStore","useKnockFeed","settings","useFeedSettings","t","useTranslations","pageInfo","items","networkStatus","containerRef","useRef","useEffect","fetch","noItems","length","requestInFlight","isRequestInFlight","onBottomCallback","useCallback","after","fetchNextPage","useOnBottomScroll","ref","callback","offset","setFilterStatus","filterStatus","NetworkStatus","loading","map","onItemClick","onButtonClick","fetchMore","features","branding_required"],"mappings":"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"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useGuideContext as s } from "@knocklabs/react-core";
3
+ import { usePathname as a, useSearchParams as c } from "next/navigation";
4
+ import { useEffect as o } from "react";
5
+ import { checkForWindow as i } from "../../../core/utils.mjs";
6
+ const l = () => {
7
+ const r = a(), n = c().toString(), {
8
+ client: t
9
+ } = s();
10
+ return o(() => {
11
+ t.removeLocationChangeEventListeners();
12
+ }, [t]), o(() => {
13
+ const e = i();
14
+ e && t.setLocation(e.location.href);
15
+ }, [t, r, n]), null;
16
+ };
17
+ export {
18
+ l as LocationSensorNextAppRouter
19
+ };
20
+ //# sourceMappingURL=NextAppRouter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextAppRouter.mjs","sources":["../../../../../../src/modules/guide/components/LocationSensor/NextAppRouter.tsx"],"sourcesContent":["\"use client\";\n\nimport { useGuideContext } from \"@knocklabs/react-core\";\nimport { usePathname, useSearchParams } from \"next/navigation\";\nimport { useEffect } from \"react\";\n\nimport { checkForWindow } from \"../../../core/utils\";\n\nexport const LocationSensorNextAppRouter = () => {\n const pathname = usePathname();\n const searchParams = useSearchParams();\n const queryStr = searchParams.toString();\n\n const { client } = useGuideContext();\n\n useEffect(() => {\n client.removeLocationChangeEventListeners();\n }, [client]);\n\n useEffect(() => {\n const win = checkForWindow();\n if (!win) return;\n\n client.setLocation(win.location.href);\n }, [client, pathname, queryStr]);\n\n return null;\n};\n"],"names":["LocationSensorNextAppRouter","pathname","usePathname","queryStr","useSearchParams","toString","client","useGuideContext","useEffect","removeLocationChangeEventListeners","win","checkForWindow","setLocation","location","href"],"mappings":";;;;;AAQO,MAAMA,IAA8BA,MAAM;AAC/C,QAAMC,IAAWC,EAAY,GAEvBC,IADeC,EAAgB,EACPC,SAAS,GAEjC;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB;AAEnCC,SAAAA,EAAU,MAAM;AACdF,IAAAA,EAAOG,mCAAmC;AAAA,EAAA,GACzC,CAACH,CAAM,CAAC,GAEXE,EAAU,MAAM;AACd,UAAME,IAAMC,EAAe;AAC3B,IAAKD,KAEEE,EAAAA,YAAYF,EAAIG,SAASC,IAAI;AAAA,EACnC,GAAA,CAACR,GAAQL,GAAUE,CAAQ,CAAC,GAExB;AACT;"}
@@ -0,0 +1,24 @@
1
+ import { useGuideContext as i } from "@knocklabs/react-core";
2
+ import { useRouter as s } from "next/router";
3
+ import { useEffect as c } from "react";
4
+ import { checkForWindow as a } from "../../../core/utils.mjs";
5
+ const p = () => {
6
+ const t = s(), {
7
+ client: e
8
+ } = i();
9
+ return c(() => {
10
+ const o = a();
11
+ if (!o) return;
12
+ e.store.state.location || e.setLocation(o.location.href), e.removeLocationChangeEventListeners();
13
+ const n = (r) => {
14
+ e.setLocation(o.location.origin + r);
15
+ };
16
+ return t.events.on("routeChangeComplete", n), () => {
17
+ t.events.off("routeChangeComplete", n);
18
+ };
19
+ }, [e]), null;
20
+ };
21
+ export {
22
+ p as LocationSensorNextPagesRouter
23
+ };
24
+ //# sourceMappingURL=NextPagesRouter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextPagesRouter.mjs","sources":["../../../../../../src/modules/guide/components/LocationSensor/NextPagesRouter.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { useRouter } from \"next/router\";\nimport { useEffect } from \"react\";\n\nimport { checkForWindow } from \"../../../core/utils\";\n\nexport const LocationSensorNextPagesRouter = () => {\n const router = useRouter();\n const { client } = useGuideContext();\n\n useEffect(() => {\n const win = checkForWindow();\n if (!win) return;\n\n // Set the initial location if not yet set.\n if (!client.store.state.location) {\n client.setLocation(win.location.href);\n }\n\n // Remove any location chagne event listeners on the window object in case\n // they are attached.\n client.removeLocationChangeEventListeners();\n\n // Attach a route change event listener to the nextjs router. Note, here url\n // is the pathname and any query parameters of the new route but does not\n // include the domain or origin.\n const handleRouteChangeComplete = (url: string) => {\n client.setLocation(win.location.origin + url);\n };\n router.events.on(\"routeChangeComplete\", handleRouteChangeComplete);\n\n return () => {\n router.events.off(\"routeChangeComplete\", handleRouteChangeComplete);\n };\n // We want to run this effect once per client instance and `router` is not\n // guaranteed to be referentially stable.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [client]);\n\n return null;\n};\n"],"names":["LocationSensorNextPagesRouter","router","useRouter","client","useGuideContext","useEffect","win","checkForWindow","store","state","location","setLocation","href","removeLocationChangeEventListeners","handleRouteChangeComplete","url","origin","events","on","off"],"mappings":";;;;AAMO,MAAMA,IAAgCA,MAAM;AACjD,QAAMC,IAASC,EAAU,GACnB;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB;AAEnCC,SAAAA,EAAU,MAAM;AACd,UAAMC,IAAMC,EAAe;AAC3B,QAAI,CAACD,EAAK;AAGV,IAAKH,EAAOK,MAAMC,MAAMC,YACfC,EAAAA,YAAYL,EAAII,SAASE,IAAI,GAKtCT,EAAOU,mCAAmC;AAKpCC,UAAAA,IAA4BA,CAACC,MAAgB;AACjDZ,MAAAA,EAAOQ,YAAYL,EAAII,SAASM,SAASD,CAAG;AAAA,IAC9C;AACOE,WAAAA,EAAAA,OAAOC,GAAG,uBAAuBJ,CAAyB,GAE1D,MAAM;AACJG,MAAAA,EAAAA,OAAOE,IAAI,uBAAuBL,CAAyB;AAAA,IACpE;AAAA,EAAA,GAIC,CAACX,CAAM,CAAC,GAEJ;AACT;"}
@@ -3,12 +3,14 @@ import r from "react";
3
3
  import "../components/Banner/Banner.mjs";
4
4
  import "../components/Card/Card.mjs";
5
5
  import { GuideToolbar as i } from "../components/GuideToolbar/GuideToolbar.mjs";
6
+ import "next/navigation";
7
+ import "next/router";
6
8
  import "../components/Modal/Modal.mjs";
7
- const a = ({
8
- children: e,
9
- ...o
10
- }) => /* @__PURE__ */ r.createElement(t, { ...o }, e, /* @__PURE__ */ r.createElement(i, null));
9
+ const f = ({
10
+ children: o,
11
+ ...e
12
+ }) => /* @__PURE__ */ r.createElement(t, { ...e }, o, /* @__PURE__ */ r.createElement(i, null));
11
13
  export {
12
- a as KnockGuideProvider
14
+ f as KnockGuideProvider
13
15
  };
14
16
  //# sourceMappingURL=KnockGuideProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"KnockGuideProvider.mjs","sources":["../../../../../src/modules/guide/providers/KnockGuideProvider.tsx"],"sourcesContent":["import {\n KnockGuideProvider as KnockGuideProviderCore,\n type KnockGuideProviderProps,\n} from \"@knocklabs/react-core\";\nimport React from \"react\";\n\nimport { GuideToolbar } from \"../components\";\n\n// Re-export the core KnockGuideProvider, so we can add React specific functionality\n// like the GuideToolbar component which shouldn't be included in other contexts (e.g. React Native).\nexport const KnockGuideProvider: React.FC<\n React.PropsWithChildren<KnockGuideProviderProps>\n> = ({ children, ...props }) => {\n return (\n <KnockGuideProviderCore {...props}>\n {children}\n <GuideToolbar />\n </KnockGuideProviderCore>\n );\n};\n"],"names":["KnockGuideProvider","children","props","KnockGuideProviderCore","React","GuideToolbar"],"mappings":";;;;;;AAUO,MAAMA,IAETA,CAAC;AAAA,EAAEC,UAAAA;AAAAA,EAAU,GAAGC;AAAM,sCAErBC,GAAuB,EAAA,GAAID,KACzBD,GACDG,gBAAAA,EAAA,cAACC,OAAY,CACf;"}
1
+ {"version":3,"file":"KnockGuideProvider.mjs","sources":["../../../../../src/modules/guide/providers/KnockGuideProvider.tsx"],"sourcesContent":["import {\n KnockGuideProvider as KnockGuideProviderCore,\n type KnockGuideProviderProps,\n} from \"@knocklabs/react-core\";\nimport React from \"react\";\n\nimport { GuideToolbar } from \"../components\";\n\n// Re-export the core KnockGuideProvider, so we can add React specific functionality\n// like the GuideToolbar component which shouldn't be included in other contexts (e.g. React Native).\nexport const KnockGuideProvider: React.FC<\n React.PropsWithChildren<KnockGuideProviderProps>\n> = ({ children, ...props }) => {\n return (\n <KnockGuideProviderCore {...props}>\n {children}\n <GuideToolbar />\n </KnockGuideProviderCore>\n );\n};\n"],"names":["KnockGuideProvider","children","props","KnockGuideProviderCore","React","GuideToolbar"],"mappings":";;;;;;;;AAUO,MAAMA,IAETA,CAAC;AAAA,EAAEC,UAAAA;AAAAA,EAAU,GAAGC;AAAM,sCAErBC,GAAuB,EAAA,GAAID,KACzBD,GACDG,gBAAAA,EAAA,cAACC,OAAY,CACf;"}