@knocklabs/react-core 0.8.5 → 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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/modules/guide/context/KnockGuideProvider.js.map +1 -1
- package/dist/cjs/modules/guide/hooks/useGuide.js.map +1 -1
- package/dist/cjs/modules/guide/hooks/useGuides.js.map +1 -1
- package/dist/esm/index.mjs +40 -38
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/modules/guide/context/KnockGuideProvider.mjs.map +1 -1
- package/dist/esm/modules/guide/hooks/useGuide.mjs.map +1 -1
- package/dist/esm/modules/guide/hooks/useGuides.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/guide/context/KnockGuideProvider.d.ts +2 -2
- package/dist/types/modules/guide/context/KnockGuideProvider.d.ts.map +1 -1
- package/dist/types/modules/guide/context/index.d.ts +1 -1
- package/dist/types/modules/guide/context/index.d.ts.map +1 -1
- package/dist/types/modules/guide/hooks/index.d.ts +1 -0
- package/dist/types/modules/guide/hooks/index.d.ts.map +1 -1
- package/dist/types/modules/guide/hooks/useGuide.d.ts +5 -4
- package/dist/types/modules/guide/hooks/useGuide.d.ts.map +1 -1
- package/dist/types/modules/guide/hooks/useGuides.d.ts +4 -3
- package/dist/types/modules/guide/hooks/useGuides.d.ts.map +1 -1
- package/dist/types/modules/guide/index.d.ts +2 -2
- package/dist/types/modules/guide/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/modules/guide/context/KnockGuideProvider.tsx +4 -2
- package/src/modules/guide/context/index.ts +5 -1
- package/src/modules/guide/hooks/index.ts +1 -0
- package/src/modules/guide/hooks/useGuide.ts +10 -5
- package/src/modules/guide/hooks/useGuides.ts +8 -5
- package/src/modules/guide/index.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b8b64e4: feat(beta): add support for basic guide debugging
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [c761e7c]
|
|
12
|
+
- Updated dependencies [3558784]
|
|
13
|
+
- Updated dependencies [b8b64e4]
|
|
14
|
+
- @knocklabs/client@0.17.0
|
|
15
|
+
|
|
3
16
|
## 0.8.5
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./modules/core/context/KnockProvider.js"),c=require("./modules/core/hooks/useAuthenticatedKnockClient.js"),a=require("./modules/core/hooks/useStableOptions.js"),d=require("./modules/core/constants.js"),e=require("./modules/core/utils.js"),n=require("./modules/feed/context/KnockFeedProvider.js"),l=require("./modules/feed/hooks/useNotifications.js"),k=require("./modules/feed/hooks/useFeedSettings.js"),o=require("./modules/feed/hooks/useNotificationStore.js"),r=require("./modules/guide/context/KnockGuideProvider.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./modules/core/context/KnockProvider.js"),c=require("./modules/core/hooks/useAuthenticatedKnockClient.js"),a=require("./modules/core/hooks/useStableOptions.js"),d=require("./modules/core/constants.js"),e=require("./modules/core/utils.js"),n=require("./modules/feed/context/KnockFeedProvider.js"),l=require("./modules/feed/hooks/useNotifications.js"),k=require("./modules/feed/hooks/useFeedSettings.js"),o=require("./modules/feed/hooks/useNotificationStore.js"),r=require("./modules/guide/context/KnockGuideProvider.js"),C=require("./modules/guide/hooks/useGuide.js"),K=require("./modules/guide/hooks/useGuides.js"),S=require("./modules/guide/hooks/useGuideContext.js"),t=require("./modules/ms-teams/context/KnockMsTeamsProvider.js"),m=require("./modules/ms-teams/hooks/useMsTeamsConnectionStatus.js"),q=require("./modules/ms-teams/hooks/useMsTeamsAuth.js"),P=require("./modules/ms-teams/hooks/useMsTeamsTeams.js"),v=require("./modules/ms-teams/hooks/useMsTeamsChannels.js"),T=require("./modules/ms-teams/hooks/useConnectedMsTeamsChannels.js"),i=require("./modules/slack/context/KnockSlackProvider.js"),f=require("./modules/slack/hooks/useSlackConnectionStatus.js"),M=require("./modules/slack/hooks/useSlackChannels.js"),h=require("./modules/slack/hooks/useConnectedSlackChannels.js"),G=require("./modules/slack/hooks/useSlackAuth.js"),u=require("./modules/i18n/context/KnockI18nProvider.js"),F=require("./modules/i18n/hooks/useTranslations.js"),x=require("./modules/i18n/languages/index.js"),y=require("./modules/preferences/hooks/usePreferences.js");exports.KnockProvider=s.KnockProvider;exports.useKnockClient=s.useKnockClient;exports.useAuthenticatedKnockClient=c;exports.useStableOptions=a;exports.FilterStatus=d.FilterStatus;exports.feedProviderKey=e.feedProviderKey;exports.formatBadgeCount=e.formatBadgeCount;exports.formatTimestamp=e.formatTimestamp;exports.msTeamsProviderKey=e.msTeamsProviderKey;exports.renderNodeOrFallback=e.renderNodeOrFallback;exports.slackProviderKey=e.slackProviderKey;exports.toSentenceCase=e.toSentenceCase;exports.KnockFeedProvider=n.KnockFeedProvider;exports.useKnockFeed=n.useKnockFeed;exports.useNotifications=l;exports.useFeedSettings=k;exports.useCreateNotificationStore=o.useCreateNotificationStore;exports.useNotificationStore=o.default;exports.KnockGuideContext=r.KnockGuideContext;exports.KnockGuideProvider=r.KnockGuideProvider;exports.useGuide=C.useGuide;exports.useGuides=K.useGuides;exports.useGuideContext=S.useGuideContext;exports.KnockMsTeamsProvider=t.KnockMsTeamsProvider;exports.useKnockMsTeamsClient=t.useKnockMsTeamsClient;exports.useMsTeamsConnectionStatus=m;exports.useMsTeamsAuth=q;exports.useMsTeamsTeams=P;exports.useMsTeamsChannels=v;exports.useConnectedMsTeamsChannels=T;exports.KnockSlackProvider=i.KnockSlackProvider;exports.useKnockSlackClient=i.useKnockSlackClient;exports.useSlackConnectionStatus=f;exports.useSlackChannels=M;exports.useConnectedSlackChannels=h;exports.useSlackAuth=G;exports.I18nContext=u.I18nContext;exports.KnockI18nProvider=u.KnockI18nProvider;exports.useTranslations=F.useTranslations;exports.locales=x.locales;exports.usePreferences=y.usePreferences;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnockGuideProvider.js","sources":["../../../../../src/modules/guide/context/KnockGuideProvider.tsx"],"sourcesContent":["import Knock, {\n KnockGuideClient,\n KnockGuideTargetParams,\n} from \"@knocklabs/client\";\nimport * as React from \"react\";\n\nimport { useKnockClient, useStableOptions } from \"../../core\";\nimport { ColorMode } from \"../../core/constants\";\n\ntype KnockGuideProviderValue = {\n client: KnockGuideClient;\n colorMode: ColorMode;\n};\n\nexport const KnockGuideContext = React.createContext<\n KnockGuideProviderValue | undefined\n>(undefined);\n\
|
|
1
|
+
{"version":3,"file":"KnockGuideProvider.js","sources":["../../../../../src/modules/guide/context/KnockGuideProvider.tsx"],"sourcesContent":["import Knock, {\n KnockGuideClient,\n KnockGuideTargetParams,\n} from \"@knocklabs/client\";\nimport * as React from \"react\";\n\nimport { useKnockClient, useStableOptions } from \"../../core\";\nimport { ColorMode } from \"../../core/constants\";\n\ntype KnockGuideProviderValue = {\n client: KnockGuideClient;\n colorMode: ColorMode;\n};\n\nexport const KnockGuideContext = React.createContext<\n KnockGuideProviderValue | undefined\n>(undefined);\n\nexport type KnockGuideProviderProps = {\n channelId: string;\n readyToTarget: boolean;\n listenForUpdates?: boolean;\n colorMode?: ColorMode;\n targetParams?: KnockGuideTargetParams;\n trackLocationFromWindow?: boolean;\n orderResolutionDuration?: number; // in milliseconds\n throttleCheckInterval?: number; // in milliseconds\n};\n\nexport const KnockGuideProvider: React.FC<\n React.PropsWithChildren<KnockGuideProviderProps>\n> = ({\n channelId,\n readyToTarget,\n listenForUpdates = true,\n colorMode = \"light\",\n targetParams = {},\n trackLocationFromWindow = true,\n // Default to 0 which works well for react apps as this \"yields\" to react for\n // one render cyle first and close the group stage.\n orderResolutionDuration = 0,\n throttleCheckInterval,\n children,\n}) => {\n let knock: Knock;\n\n try {\n knock = useKnockClient();\n } catch (_) {\n throw new Error(\"KnockGuideProvider must be used within a KnockProvider\");\n }\n\n const stableTargetParams = useStableOptions(targetParams);\n\n const knockGuideClient = React.useMemo(() => {\n return new KnockGuideClient(knock, channelId, stableTargetParams, {\n trackLocationFromWindow,\n orderResolutionDuration,\n throttleCheckInterval,\n });\n }, [\n knock,\n channelId,\n stableTargetParams,\n trackLocationFromWindow,\n orderResolutionDuration,\n throttleCheckInterval,\n ]);\n\n React.useEffect(() => {\n if (readyToTarget) {\n knockGuideClient.fetch();\n if (listenForUpdates) knockGuideClient.subscribe();\n }\n\n return () => knockGuideClient.cleanup();\n }, [readyToTarget, listenForUpdates, knockGuideClient]);\n\n return (\n <KnockGuideContext.Provider\n value={{\n client: knockGuideClient,\n colorMode,\n }}\n >\n {children}\n </KnockGuideContext.Provider>\n );\n};\n"],"names":["KnockGuideContext","React","createContext","undefined","KnockGuideProvider","channelId","readyToTarget","listenForUpdates","colorMode","targetParams","trackLocationFromWindow","orderResolutionDuration","throttleCheckInterval","children","knock","useKnockClient","Error","stableTargetParams","useStableOptions","knockGuideClient","useMemo","KnockGuideClient","useEffect","fetch","subscribe","cleanup","client"],"mappings":"0kBAcaA,EAAoBC,EAAMC,cAErCC,MAAS,EAaEC,EAETA,CAAC,CACHC,UAAAA,EACAC,cAAAA,EACAC,iBAAAA,EAAmB,GACnBC,UAAAA,EAAY,QACZC,aAAAA,EAAe,CAAC,EAChBC,wBAAAA,EAA0B,GAG1BC,wBAAAA,EAA0B,EAC1BC,sBAAAA,EACAC,SAAAA,CACF,IAAM,CACAC,IAAAA,EAEA,GAAA,CACFA,EAAQC,EAAAA,eAAe,OACb,CACJ,MAAA,IAAIC,MAAM,wDAAwD,CAAA,CAGpEC,MAAAA,EAAqBC,EAAiBT,CAAY,EAElDU,EAAmBlB,EAAMmB,QAAQ,IAC9B,IAAIC,EAAAA,iBAAiBP,EAAOT,EAAWY,EAAoB,CAChEP,wBAAAA,EACAC,wBAAAA,EACAC,sBAAAA,CAAAA,CACD,EACA,CACDE,EACAT,EACAY,EACAP,EACAC,EACAC,CAAqB,CACtB,EAEDX,OAAAA,EAAMqB,UAAU,KACVhB,IACFa,EAAiBI,MAAM,EACnBhB,KAAmCiB,UAAU,GAG5C,IAAML,EAAiBM,QAAQ,GACrC,CAACnB,EAAeC,EAAkBY,CAAgB,CAAC,EAGnDlB,EAAA,cAAAD,EAAkB,SAAlB,CACC,MAAO,CACL0B,OAAQP,EACRX,UAAAA,IAGDK,CACH,CAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGuide.js","sources":["../../../../../src/modules/guide/hooks/useGuide.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideFilterParams,\n KnockGuideStep,\n} from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\ninterface UseGuideReturn extends UseGuideContextReturn {\n guide: KnockGuide | undefined;\n step: KnockGuideStep | undefined;\n}\n\nexport const useGuide = (filters: KnockGuideFilterParams): UseGuideReturn => {\n const context = useGuideContext();\n\n if (!filters.key && !filters.type) {\n throw new Error(\n \"useGuide must be given at least one filter: { key?: string; type?: string; }\",\n );\n }\n\n const { client, colorMode } = context;\n\n const guide = useStore(client.store, (state) =>\n client.selectGuide(state, filters),\n );\n\n const step = guide && guide.getStep();\n\n return { client, colorMode, guide, step };\n};\n"],"names":["useGuide","filters","context","useGuideContext","key","type","Error","client","colorMode","guide","useStore","store","selectGuide","state","step","getStep"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGuide.js","sources":["../../../../../src/modules/guide/hooks/useGuide.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideFilterParams,\n KnockGuideStep,\n} from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Any = any;\n\ninterface UseGuideReturn<C = Any> extends UseGuideContextReturn {\n guide: KnockGuide<C> | undefined;\n step: KnockGuideStep<C> | undefined;\n}\n\nexport const useGuide = <C = Any>(\n filters: KnockGuideFilterParams,\n): UseGuideReturn<C> => {\n const context = useGuideContext();\n\n if (!filters.key && !filters.type) {\n throw new Error(\n \"useGuide must be given at least one filter: { key?: string; type?: string; }\",\n );\n }\n\n const { client, colorMode } = context;\n\n const guide = useStore(client.store, (state) =>\n client.selectGuide<C>(state, filters),\n );\n\n const step = guide && guide.getStep();\n\n return { client, colorMode, guide, step };\n};\n"],"names":["useGuide","filters","context","useGuideContext","key","type","Error","client","colorMode","guide","useStore","store","selectGuide","state","step","getStep"],"mappings":"2JAiBaA,EACXC,GACsB,CACtB,MAAMC,EAAUC,EAAAA,gBAAgB,EAEhC,GAAI,CAACF,EAAQG,KAAO,CAACH,EAAQI,KACrB,MAAA,IAAIC,MACR,8EACF,EAGI,KAAA,CAAEC,OAAAA,EAAQC,UAAAA,CAAAA,EAAcN,EAExBO,EAAQC,EAAAA,SAASH,EAAOI,SAC5BJ,EAAOK,YAAeC,EAAOZ,CAAO,CACtC,EAEMa,EAAOL,GAASA,EAAMM,QAAQ,EAE7B,MAAA,CAAER,OAAAA,EAAQC,UAAAA,EAAWC,MAAAA,EAAOK,KAAAA,CAAK,CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGuides.js","sources":["../../../../../src/modules/guide/hooks/useGuides.ts"],"sourcesContent":["import { KnockGuide, KnockGuideFilterParams } from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\ninterface UseGuidesReturn extends UseGuideContextReturn {\n guides: KnockGuide[];\n}\n\nexport const useGuides = (\n filters: Pick<KnockGuideFilterParams, \"type\">,\n): UseGuidesReturn => {\n const context = useGuideContext();\n const { client, colorMode } = context;\n\n const guides = useStore(client.store, (state) =>\n client.selectGuides(state, filters),\n );\n\n return { client, colorMode, guides };\n};\n"],"names":["useGuides","filters","context","useGuideContext","client","colorMode","guides","useStore","store","selectGuides","state"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGuides.js","sources":["../../../../../src/modules/guide/hooks/useGuides.ts"],"sourcesContent":["import { KnockGuide, KnockGuideFilterParams } from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Any = any;\n\ninterface UseGuidesReturn<C = Any> extends UseGuideContextReturn {\n guides: KnockGuide<C>[];\n}\n\nexport const useGuides = <C = Any>(\n filters: Pick<KnockGuideFilterParams, \"type\">,\n): UseGuidesReturn<C> => {\n const context = useGuideContext();\n const { client, colorMode } = context;\n\n const guides = useStore(client.store, (state) =>\n client.selectGuides<C>(state, filters),\n );\n\n return { client, colorMode, guides };\n};\n"],"names":["useGuides","filters","context","useGuideContext","client","colorMode","guides","useStore","store","selectGuides","state"],"mappings":"2JAYaA,EACXC,GACuB,CACvB,MAAMC,EAAUC,EAAAA,gBAAgB,EAC1B,CAAEC,OAAAA,EAAQC,UAAAA,CAAAA,EAAcH,EAExBI,EAASC,EAAAA,SAASH,EAAOI,SAC7BJ,EAAOK,aAAgBC,EAAOT,CAAO,CACvC,EAEO,MAAA,CAAEG,OAAAA,EAAQC,UAAAA,EAAWC,OAAAA,CAAO,CACrC"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { KnockProvider as t, useKnockClient as r } from "./modules/core/context/KnockProvider.mjs";
|
|
2
2
|
import { default as a } from "./modules/core/hooks/useAuthenticatedKnockClient.mjs";
|
|
3
|
-
import { default as
|
|
3
|
+
import { default as u } from "./modules/core/hooks/useStableOptions.mjs";
|
|
4
4
|
import { FilterStatus as m } from "./modules/core/constants.mjs";
|
|
5
|
-
import { feedProviderKey as l, formatBadgeCount as i, formatTimestamp as c, msTeamsProviderKey as
|
|
5
|
+
import { feedProviderKey as l, formatBadgeCount as i, formatTimestamp as c, msTeamsProviderKey as x, renderNodeOrFallback as p, slackProviderKey as k, toSentenceCase as C } from "./modules/core/utils.mjs";
|
|
6
6
|
import { KnockFeedProvider as S, useKnockFeed as T } from "./modules/feed/context/KnockFeedProvider.mjs";
|
|
7
7
|
import { default as v } from "./modules/feed/hooks/useNotifications.mjs";
|
|
8
8
|
import { default as M } from "./modules/feed/hooks/useFeedSettings.mjs";
|
|
@@ -10,61 +10,63 @@ import { useCreateNotificationStore as G, default as N } from "./modules/feed/ho
|
|
|
10
10
|
import { KnockGuideContext as A, KnockGuideProvider as b } from "./modules/guide/context/KnockGuideProvider.mjs";
|
|
11
11
|
import { useGuide as I } from "./modules/guide/hooks/useGuide.mjs";
|
|
12
12
|
import { useGuides as B } from "./modules/guide/hooks/useGuides.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { default as H } from "./modules/ms-teams/hooks/
|
|
16
|
-
import { default as L } from "./modules/ms-teams/hooks/
|
|
17
|
-
import { default as R } from "./modules/ms-teams/hooks/
|
|
18
|
-
import { default as V } from "./modules/ms-teams/hooks/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { default as ee } from "./modules/slack/hooks/
|
|
22
|
-
import { default as te } from "./modules/slack/hooks/
|
|
23
|
-
import { default as se } from "./modules/slack/hooks/
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
13
|
+
import { useGuideContext as q } from "./modules/guide/hooks/useGuideContext.mjs";
|
|
14
|
+
import { KnockMsTeamsProvider as z, useKnockMsTeamsClient as D } from "./modules/ms-teams/context/KnockMsTeamsProvider.mjs";
|
|
15
|
+
import { default as H } from "./modules/ms-teams/hooks/useMsTeamsConnectionStatus.mjs";
|
|
16
|
+
import { default as L } from "./modules/ms-teams/hooks/useMsTeamsAuth.mjs";
|
|
17
|
+
import { default as R } from "./modules/ms-teams/hooks/useMsTeamsTeams.mjs";
|
|
18
|
+
import { default as V } from "./modules/ms-teams/hooks/useMsTeamsChannels.mjs";
|
|
19
|
+
import { default as X } from "./modules/ms-teams/hooks/useConnectedMsTeamsChannels.mjs";
|
|
20
|
+
import { KnockSlackProvider as Z, useKnockSlackClient as _ } from "./modules/slack/context/KnockSlackProvider.mjs";
|
|
21
|
+
import { default as ee } from "./modules/slack/hooks/useSlackConnectionStatus.mjs";
|
|
22
|
+
import { default as te } from "./modules/slack/hooks/useSlackChannels.mjs";
|
|
23
|
+
import { default as se } from "./modules/slack/hooks/useConnectedSlackChannels.mjs";
|
|
24
|
+
import { default as ne } from "./modules/slack/hooks/useSlackAuth.mjs";
|
|
25
|
+
import { I18nContext as fe, KnockI18nProvider as me } from "./modules/i18n/context/KnockI18nProvider.mjs";
|
|
26
|
+
import { useTranslations as le } from "./modules/i18n/hooks/useTranslations.mjs";
|
|
27
|
+
import { locales as ce } from "./modules/i18n/languages/index.mjs";
|
|
28
|
+
import { usePreferences as pe } from "./modules/preferences/hooks/usePreferences.mjs";
|
|
28
29
|
export {
|
|
29
30
|
m as FilterStatus,
|
|
30
|
-
|
|
31
|
+
fe as I18nContext,
|
|
31
32
|
S as KnockFeedProvider,
|
|
32
33
|
A as KnockGuideContext,
|
|
33
34
|
b as KnockGuideProvider,
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
me as KnockI18nProvider,
|
|
36
|
+
z as KnockMsTeamsProvider,
|
|
36
37
|
t as KnockProvider,
|
|
37
|
-
|
|
38
|
+
Z as KnockSlackProvider,
|
|
38
39
|
l as feedProviderKey,
|
|
39
40
|
i as formatBadgeCount,
|
|
40
41
|
c as formatTimestamp,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
ce as locales,
|
|
43
|
+
x as msTeamsProviderKey,
|
|
44
|
+
p as renderNodeOrFallback,
|
|
44
45
|
k as slackProviderKey,
|
|
45
46
|
C as toSentenceCase,
|
|
46
47
|
a as useAuthenticatedKnockClient,
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
X as useConnectedMsTeamsChannels,
|
|
49
|
+
se as useConnectedSlackChannels,
|
|
49
50
|
G as useCreateNotificationStore,
|
|
50
51
|
M as useFeedSettings,
|
|
51
52
|
I as useGuide,
|
|
53
|
+
q as useGuideContext,
|
|
52
54
|
B as useGuides,
|
|
53
55
|
r as useKnockClient,
|
|
54
56
|
T as useKnockFeed,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
D as useKnockMsTeamsClient,
|
|
58
|
+
_ as useKnockSlackClient,
|
|
59
|
+
L as useMsTeamsAuth,
|
|
60
|
+
V as useMsTeamsChannels,
|
|
61
|
+
H as useMsTeamsConnectionStatus,
|
|
62
|
+
R as useMsTeamsTeams,
|
|
61
63
|
N as useNotificationStore,
|
|
62
64
|
v as useNotifications,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
pe as usePreferences,
|
|
66
|
+
ne as useSlackAuth,
|
|
67
|
+
te as useSlackChannels,
|
|
68
|
+
ee as useSlackConnectionStatus,
|
|
69
|
+
u as useStableOptions,
|
|
70
|
+
le as useTranslations
|
|
69
71
|
};
|
|
70
72
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnockGuideProvider.mjs","sources":["../../../../../src/modules/guide/context/KnockGuideProvider.tsx"],"sourcesContent":["import Knock, {\n KnockGuideClient,\n KnockGuideTargetParams,\n} from \"@knocklabs/client\";\nimport * as React from \"react\";\n\nimport { useKnockClient, useStableOptions } from \"../../core\";\nimport { ColorMode } from \"../../core/constants\";\n\ntype KnockGuideProviderValue = {\n client: KnockGuideClient;\n colorMode: ColorMode;\n};\n\nexport const KnockGuideContext = React.createContext<\n KnockGuideProviderValue | undefined\n>(undefined);\n\
|
|
1
|
+
{"version":3,"file":"KnockGuideProvider.mjs","sources":["../../../../../src/modules/guide/context/KnockGuideProvider.tsx"],"sourcesContent":["import Knock, {\n KnockGuideClient,\n KnockGuideTargetParams,\n} from \"@knocklabs/client\";\nimport * as React from \"react\";\n\nimport { useKnockClient, useStableOptions } from \"../../core\";\nimport { ColorMode } from \"../../core/constants\";\n\ntype KnockGuideProviderValue = {\n client: KnockGuideClient;\n colorMode: ColorMode;\n};\n\nexport const KnockGuideContext = React.createContext<\n KnockGuideProviderValue | undefined\n>(undefined);\n\nexport type KnockGuideProviderProps = {\n channelId: string;\n readyToTarget: boolean;\n listenForUpdates?: boolean;\n colorMode?: ColorMode;\n targetParams?: KnockGuideTargetParams;\n trackLocationFromWindow?: boolean;\n orderResolutionDuration?: number; // in milliseconds\n throttleCheckInterval?: number; // in milliseconds\n};\n\nexport const KnockGuideProvider: React.FC<\n React.PropsWithChildren<KnockGuideProviderProps>\n> = ({\n channelId,\n readyToTarget,\n listenForUpdates = true,\n colorMode = \"light\",\n targetParams = {},\n trackLocationFromWindow = true,\n // Default to 0 which works well for react apps as this \"yields\" to react for\n // one render cyle first and close the group stage.\n orderResolutionDuration = 0,\n throttleCheckInterval,\n children,\n}) => {\n let knock: Knock;\n\n try {\n knock = useKnockClient();\n } catch (_) {\n throw new Error(\"KnockGuideProvider must be used within a KnockProvider\");\n }\n\n const stableTargetParams = useStableOptions(targetParams);\n\n const knockGuideClient = React.useMemo(() => {\n return new KnockGuideClient(knock, channelId, stableTargetParams, {\n trackLocationFromWindow,\n orderResolutionDuration,\n throttleCheckInterval,\n });\n }, [\n knock,\n channelId,\n stableTargetParams,\n trackLocationFromWindow,\n orderResolutionDuration,\n throttleCheckInterval,\n ]);\n\n React.useEffect(() => {\n if (readyToTarget) {\n knockGuideClient.fetch();\n if (listenForUpdates) knockGuideClient.subscribe();\n }\n\n return () => knockGuideClient.cleanup();\n }, [readyToTarget, listenForUpdates, knockGuideClient]);\n\n return (\n <KnockGuideContext.Provider\n value={{\n client: knockGuideClient,\n colorMode,\n }}\n >\n {children}\n </KnockGuideContext.Provider>\n );\n};\n"],"names":["KnockGuideContext","React","createContext","undefined","KnockGuideProvider","channelId","readyToTarget","listenForUpdates","colorMode","targetParams","trackLocationFromWindow","orderResolutionDuration","throttleCheckInterval","children","knock","useKnockClient","Error","stableTargetParams","useStableOptions","knockGuideClient","useMemo","KnockGuideClient","useEffect","fetch","subscribe","cleanup","client"],"mappings":";;;;;AAcaA,MAAAA,IAAoBC,EAAMC,cAErCC,MAAS,GAaEC,IAETA,CAAC;AAAA,EACHC,WAAAA;AAAAA,EACAC,eAAAA;AAAAA,EACAC,kBAAAA,IAAmB;AAAA,EACnBC,WAAAA,IAAY;AAAA,EACZC,cAAAA,IAAe,CAAC;AAAA,EAChBC,yBAAAA,IAA0B;AAAA;AAAA;AAAA,EAG1BC,yBAAAA,IAA0B;AAAA,EAC1BC,uBAAAA;AAAAA,EACAC,UAAAA;AACF,MAAM;AACAC,MAAAA;AAEA,MAAA;AACFA,IAAAA,IAAQC,EAAe;AAAA,UACb;AACJ,UAAA,IAAIC,MAAM,wDAAwD;AAAA,EAAA;AAGpEC,QAAAA,IAAqBC,EAAiBT,CAAY,GAElDU,IAAmBlB,EAAMmB,QAAQ,MAC9B,IAAIC,EAAiBP,GAAOT,GAAWY,GAAoB;AAAA,IAChEP,yBAAAA;AAAAA,IACAC,yBAAAA;AAAAA,IACAC,uBAAAA;AAAAA,EAAAA,CACD,GACA,CACDE,GACAT,GACAY,GACAP,GACAC,GACAC,CAAqB,CACtB;AAEDX,SAAAA,EAAMqB,UAAU,OACVhB,MACFa,EAAiBI,MAAM,GACnBhB,OAAmCiB,UAAU,IAG5C,MAAML,EAAiBM,QAAQ,IACrC,CAACnB,GAAeC,GAAkBY,CAAgB,CAAC,GAGnD,gBAAAlB,EAAA,cAAAD,EAAkB,UAAlB,EACC,OAAO;AAAA,IACL0B,QAAQP;AAAAA,IACRX,WAAAA;AAAAA,OAGDK,CACH;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGuide.mjs","sources":["../../../../../src/modules/guide/hooks/useGuide.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideFilterParams,\n KnockGuideStep,\n} from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\ninterface UseGuideReturn extends UseGuideContextReturn {\n guide: KnockGuide | undefined;\n step: KnockGuideStep | undefined;\n}\n\nexport const useGuide = (filters: KnockGuideFilterParams): UseGuideReturn => {\n const context = useGuideContext();\n\n if (!filters.key && !filters.type) {\n throw new Error(\n \"useGuide must be given at least one filter: { key?: string; type?: string; }\",\n );\n }\n\n const { client, colorMode } = context;\n\n const guide = useStore(client.store, (state) =>\n client.selectGuide(state, filters),\n );\n\n const step = guide && guide.getStep();\n\n return { client, colorMode, guide, step };\n};\n"],"names":["useGuide","filters","context","useGuideContext","key","type","Error","client","colorMode","guide","useStore","store","state","selectGuide","step","getStep"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useGuide.mjs","sources":["../../../../../src/modules/guide/hooks/useGuide.ts"],"sourcesContent":["import {\n KnockGuide,\n KnockGuideFilterParams,\n KnockGuideStep,\n} from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Any = any;\n\ninterface UseGuideReturn<C = Any> extends UseGuideContextReturn {\n guide: KnockGuide<C> | undefined;\n step: KnockGuideStep<C> | undefined;\n}\n\nexport const useGuide = <C = Any>(\n filters: KnockGuideFilterParams,\n): UseGuideReturn<C> => {\n const context = useGuideContext();\n\n if (!filters.key && !filters.type) {\n throw new Error(\n \"useGuide must be given at least one filter: { key?: string; type?: string; }\",\n );\n }\n\n const { client, colorMode } = context;\n\n const guide = useStore(client.store, (state) =>\n client.selectGuide<C>(state, filters),\n );\n\n const step = guide && guide.getStep();\n\n return { client, colorMode, guide, step };\n};\n"],"names":["useGuide","filters","context","useGuideContext","key","type","Error","client","colorMode","guide","useStore","store","state","selectGuide","step","getStep"],"mappings":";;AAiBaA,MAAAA,IAAW,CACtBC,MACsB;AACtB,QAAMC,IAAUC,EAAgB;AAEhC,MAAI,CAACF,EAAQG,OAAO,CAACH,EAAQI;AACrB,UAAA,IAAIC,MACR,8EACF;AAGI,QAAA;AAAA,IAAEC,QAAAA;AAAAA,IAAQC,WAAAA;AAAAA,EAAAA,IAAcN,GAExBO,IAAQC,EAASH,EAAOI,OAAQC,OACpCL,EAAOM,YAAeD,GAAOX,CAAO,CACtC,GAEMa,IAAOL,KAASA,EAAMM,QAAQ;AAE7B,SAAA;AAAA,IAAER,QAAAA;AAAAA,IAAQC,WAAAA;AAAAA,IAAWC,OAAAA;AAAAA,IAAOK,MAAAA;AAAAA,EAAK;AAC1C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGuides.mjs","sources":["../../../../../src/modules/guide/hooks/useGuides.ts"],"sourcesContent":["import { KnockGuide, KnockGuideFilterParams } from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\ninterface UseGuidesReturn extends UseGuideContextReturn {\n guides: KnockGuide[];\n}\n\nexport const useGuides = (\n filters: Pick<KnockGuideFilterParams, \"type\">,\n): UseGuidesReturn => {\n const context = useGuideContext();\n const { client, colorMode } = context;\n\n const guides = useStore(client.store, (state) =>\n client.selectGuides(state, filters),\n );\n\n return { client, colorMode, guides };\n};\n"],"names":["useGuides","filters","context","useGuideContext","client","colorMode","guides","useStore","store","state","selectGuides"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useGuides.mjs","sources":["../../../../../src/modules/guide/hooks/useGuides.ts"],"sourcesContent":["import { KnockGuide, KnockGuideFilterParams } from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nimport { UseGuideContextReturn, useGuideContext } from \"./useGuideContext\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Any = any;\n\ninterface UseGuidesReturn<C = Any> extends UseGuideContextReturn {\n guides: KnockGuide<C>[];\n}\n\nexport const useGuides = <C = Any>(\n filters: Pick<KnockGuideFilterParams, \"type\">,\n): UseGuidesReturn<C> => {\n const context = useGuideContext();\n const { client, colorMode } = context;\n\n const guides = useStore(client.store, (state) =>\n client.selectGuides<C>(state, filters),\n );\n\n return { client, colorMode, guides };\n};\n"],"names":["useGuides","filters","context","useGuideContext","client","colorMode","guides","useStore","store","state","selectGuides"],"mappings":";;AAYaA,MAAAA,IAAY,CACvBC,MACuB;AACvB,QAAMC,IAAUC,EAAgB,GAC1B;AAAA,IAAEC,QAAAA;AAAAA,IAAQC,WAAAA;AAAAA,EAAAA,IAAcH,GAExBI,IAASC,EAASH,EAAOI,OAAQC,OACrCL,EAAOM,aAAgBD,GAAOR,CAAO,CACvC;AAEO,SAAA;AAAA,IAAEG,QAAAA;AAAAA,IAAQC,WAAAA;AAAAA,IAAWC,QAAAA;AAAAA,EAAO;AACrC;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FilterStatus, KnockProvider, feedProviderKey, formatBadgeCount, formatTimestamp, msTeamsProviderKey, renderNodeOrFallback, slackProviderKey, toSentenceCase, type ColorMode, type KnockProviderProps, type KnockProviderState, useAuthenticatedKnockClient, useKnockClient, useStableOptions, } from './modules/core';
|
|
2
2
|
export { KnockFeedProvider, type KnockFeedProviderProps, type KnockFeedProviderState, type Selector, useCreateNotificationStore, useFeedSettings, useKnockFeed, useNotificationStore, useNotifications, } from './modules/feed';
|
|
3
|
-
export { KnockGuideProvider, KnockGuideContext, useGuide, useGuides, } from './modules/guide';
|
|
3
|
+
export { KnockGuideProvider, KnockGuideContext, type KnockGuideProviderProps, useGuide, useGuides, useGuideContext, } from './modules/guide';
|
|
4
4
|
export { type MsTeamsChannelQueryOptions, type MsTeamsTeamQueryOptions, KnockMsTeamsProvider, type KnockMsTeamsProviderProps, type KnockMsTeamsProviderState, useConnectedMsTeamsChannels, useKnockMsTeamsClient, useMsTeamsAuth, useMsTeamsChannels, useMsTeamsConnectionStatus, useMsTeamsTeams, } from './modules/ms-teams';
|
|
5
5
|
export { KnockSlackProvider, type ContainerObject, type KnockSlackProviderProps, type KnockSlackProviderState, type SlackChannelQueryOptions, useConnectedSlackChannels, useKnockSlackClient, useSlackAuth, useSlackChannels, useSlackConnectionStatus, } from './modules/slack';
|
|
6
6
|
export { I18nContext, KnockI18nProvider, locales, type I18nContent, type KnockI18nProviderProps, type Translations, useTranslations, } from './modules/i18n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,2BAA2B,EAC3B,cAAc,EACd,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,2BAA2B,EAC3B,cAAc,EACd,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,QAAQ,EACR,SAAS,EACT,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,yBAAyB,EACzB,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -6,7 +6,7 @@ type KnockGuideProviderValue = {
|
|
|
6
6
|
colorMode: ColorMode;
|
|
7
7
|
};
|
|
8
8
|
export declare const KnockGuideContext: React.Context<KnockGuideProviderValue | undefined>;
|
|
9
|
-
type
|
|
9
|
+
export type KnockGuideProviderProps = {
|
|
10
10
|
channelId: string;
|
|
11
11
|
readyToTarget: boolean;
|
|
12
12
|
listenForUpdates?: boolean;
|
|
@@ -16,6 +16,6 @@ type Props = {
|
|
|
16
16
|
orderResolutionDuration?: number;
|
|
17
17
|
throttleCheckInterval?: number;
|
|
18
18
|
};
|
|
19
|
-
export declare const KnockGuideProvider: React.FC<React.PropsWithChildren<
|
|
19
|
+
export declare const KnockGuideProvider: React.FC<React.PropsWithChildren<KnockGuideProviderProps>>;
|
|
20
20
|
export {};
|
|
21
21
|
//# sourceMappingURL=KnockGuideProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KnockGuideProvider.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/context/KnockGuideProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EACZ,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,KAAK,uBAAuB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,oDAElB,CAAC;AAEb,
|
|
1
|
+
{"version":3,"file":"KnockGuideProvider.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/context/KnockGuideProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EACZ,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,KAAK,uBAAuB,GAAG;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,oDAElB,CAAC;AAEb,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CACvC,KAAK,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CA0DjD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { KnockGuideProvider, KnockGuideContext } from './KnockGuideProvider';
|
|
1
|
+
export { KnockGuideProvider, KnockGuideContext, type KnockGuideProviderProps, } from './KnockGuideProvider';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,uBAAuB,GAC7B,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { KnockGuide, KnockGuideFilterParams, KnockGuideStep } from '@knocklabs/client';
|
|
2
2
|
import { UseGuideContextReturn } from './useGuideContext';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
type Any = any;
|
|
4
|
+
interface UseGuideReturn<C = Any> extends UseGuideContextReturn {
|
|
5
|
+
guide: KnockGuide<C> | undefined;
|
|
6
|
+
step: KnockGuideStep<C> | undefined;
|
|
6
7
|
}
|
|
7
|
-
export declare const useGuide: (filters: KnockGuideFilterParams) => UseGuideReturn
|
|
8
|
+
export declare const useGuide: <C = Any>(filters: KnockGuideFilterParams) => UseGuideReturn<C>;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=useGuide.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGuide.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/hooks/useGuide.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,qBAAqB,EAAmB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useGuide.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/hooks/useGuide.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,qBAAqB,EAAmB,MAAM,mBAAmB,CAAC;AAG3E,KAAK,GAAG,GAAG,GAAG,CAAC;AAEf,UAAU,cAAc,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,qBAAqB;IAC7D,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CACrC;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,GAAG,GAAG,EAC9B,SAAS,sBAAsB,KAC9B,cAAc,CAAC,CAAC,CAkBlB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { KnockGuide, KnockGuideFilterParams } from '@knocklabs/client';
|
|
2
2
|
import { UseGuideContextReturn } from './useGuideContext';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Any = any;
|
|
4
|
+
interface UseGuidesReturn<C = Any> extends UseGuideContextReturn {
|
|
5
|
+
guides: KnockGuide<C>[];
|
|
5
6
|
}
|
|
6
|
-
export declare const useGuides: (filters: Pick<KnockGuideFilterParams, "type">) => UseGuidesReturn
|
|
7
|
+
export declare const useGuides: <C = Any>(filters: Pick<KnockGuideFilterParams, "type">) => UseGuidesReturn<C>;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=useGuides.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGuides.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/hooks/useGuides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAmB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"useGuides.d.ts","sourceRoot":"","sources":["../../../../../src/modules/guide/hooks/useGuides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAmB,MAAM,mBAAmB,CAAC;AAG3E,KAAK,GAAG,GAAG,GAAG,CAAC;AAEf,UAAU,eAAe,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,qBAAqB;IAC9D,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,GAAI,CAAC,GAAG,GAAG,EAC/B,SAAS,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,KAC5C,eAAe,CAAC,CAAC,CASnB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { KnockGuideProvider, KnockGuideContext } from './context';
|
|
2
|
-
export { useGuide, useGuides } from './hooks';
|
|
1
|
+
export { KnockGuideProvider, KnockGuideContext, type KnockGuideProviderProps, } from './context';
|
|
2
|
+
export { useGuide, useGuides, useGuideContext } from './hooks';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/guide/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/guide/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,uBAAuB,GAC7B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@knocklabs/react-core",
|
|
3
3
|
"description": "A set of React components to build notification experiences powered by Knock",
|
|
4
4
|
"author": "@knocklabs",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.9.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/cjs/index.js",
|
|
8
8
|
"module": "dist/esm/index.mjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"react": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@knocklabs/client": "^0.
|
|
50
|
+
"@knocklabs/client": "^0.17.0",
|
|
51
51
|
"@tanstack/react-store": "^0.7.3",
|
|
52
52
|
"date-fns": "^4.0.0",
|
|
53
53
|
"fast-deep-equal": "^3.1.3",
|
package/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const KnockGuideContext = React.createContext<
|
|
|
16
16
|
KnockGuideProviderValue | undefined
|
|
17
17
|
>(undefined);
|
|
18
18
|
|
|
19
|
-
type
|
|
19
|
+
export type KnockGuideProviderProps = {
|
|
20
20
|
channelId: string;
|
|
21
21
|
readyToTarget: boolean;
|
|
22
22
|
listenForUpdates?: boolean;
|
|
@@ -27,7 +27,9 @@ type Props = {
|
|
|
27
27
|
throttleCheckInterval?: number; // in milliseconds
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const KnockGuideProvider: React.FC<
|
|
30
|
+
export const KnockGuideProvider: React.FC<
|
|
31
|
+
React.PropsWithChildren<KnockGuideProviderProps>
|
|
32
|
+
> = ({
|
|
31
33
|
channelId,
|
|
32
34
|
readyToTarget,
|
|
33
35
|
listenForUpdates = true,
|
|
@@ -7,12 +7,17 @@ import { useStore } from "@tanstack/react-store";
|
|
|
7
7
|
|
|
8
8
|
import { UseGuideContextReturn, useGuideContext } from "./useGuideContext";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
type Any = any;
|
|
12
|
+
|
|
13
|
+
interface UseGuideReturn<C = Any> extends UseGuideContextReturn {
|
|
14
|
+
guide: KnockGuide<C> | undefined;
|
|
15
|
+
step: KnockGuideStep<C> | undefined;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
export const useGuide =
|
|
18
|
+
export const useGuide = <C = Any>(
|
|
19
|
+
filters: KnockGuideFilterParams,
|
|
20
|
+
): UseGuideReturn<C> => {
|
|
16
21
|
const context = useGuideContext();
|
|
17
22
|
|
|
18
23
|
if (!filters.key && !filters.type) {
|
|
@@ -24,7 +29,7 @@ export const useGuide = (filters: KnockGuideFilterParams): UseGuideReturn => {
|
|
|
24
29
|
const { client, colorMode } = context;
|
|
25
30
|
|
|
26
31
|
const guide = useStore(client.store, (state) =>
|
|
27
|
-
client.selectGuide(state, filters),
|
|
32
|
+
client.selectGuide<C>(state, filters),
|
|
28
33
|
);
|
|
29
34
|
|
|
30
35
|
const step = guide && guide.getStep();
|
|
@@ -3,18 +3,21 @@ import { useStore } from "@tanstack/react-store";
|
|
|
3
3
|
|
|
4
4
|
import { UseGuideContextReturn, useGuideContext } from "./useGuideContext";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
type Any = any;
|
|
8
|
+
|
|
9
|
+
interface UseGuidesReturn<C = Any> extends UseGuideContextReturn {
|
|
10
|
+
guides: KnockGuide<C>[];
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
export const useGuides = (
|
|
13
|
+
export const useGuides = <C = Any>(
|
|
11
14
|
filters: Pick<KnockGuideFilterParams, "type">,
|
|
12
|
-
): UseGuidesReturn => {
|
|
15
|
+
): UseGuidesReturn<C> => {
|
|
13
16
|
const context = useGuideContext();
|
|
14
17
|
const { client, colorMode } = context;
|
|
15
18
|
|
|
16
19
|
const guides = useStore(client.store, (state) =>
|
|
17
|
-
client.selectGuides(state, filters),
|
|
20
|
+
client.selectGuides<C>(state, filters),
|
|
18
21
|
);
|
|
19
22
|
|
|
20
23
|
return { client, colorMode, guides };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
1
|
+
export {
|
|
2
|
+
KnockGuideProvider,
|
|
3
|
+
KnockGuideContext,
|
|
4
|
+
type KnockGuideProviderProps,
|
|
5
|
+
} from "./context";
|
|
6
|
+
export { useGuide, useGuides, useGuideContext } from "./hooks";
|