@knocklabs/react-core 0.6.14-canary.2 → 0.6.15

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 (218) hide show
  1. package/CHANGELOG.md +521 -0
  2. package/dist/cjs/index.js +2 -0
  3. package/dist/cjs/index.js.map +1 -0
  4. package/dist/cjs/modules/core/constants.js +2 -0
  5. package/dist/cjs/modules/core/constants.js.map +1 -0
  6. package/dist/cjs/modules/core/context/KnockProvider.js +2 -0
  7. package/dist/cjs/modules/core/context/KnockProvider.js.map +1 -0
  8. package/dist/cjs/modules/core/hooks/useAuthenticatedKnockClient.js +2 -0
  9. package/dist/cjs/modules/core/hooks/useAuthenticatedKnockClient.js.map +1 -0
  10. package/dist/cjs/modules/core/hooks/useStableOptions.js +2 -0
  11. package/dist/cjs/modules/core/hooks/useStableOptions.js.map +1 -0
  12. package/dist/cjs/modules/core/utils.js +2 -0
  13. package/dist/cjs/modules/core/utils.js.map +1 -0
  14. package/dist/cjs/modules/feed/context/KnockFeedProvider.js +2 -0
  15. package/dist/cjs/modules/feed/context/KnockFeedProvider.js.map +1 -0
  16. package/dist/cjs/modules/feed/hooks/useFeedSettings.js +2 -0
  17. package/dist/cjs/modules/feed/hooks/useFeedSettings.js.map +1 -0
  18. package/dist/cjs/modules/feed/hooks/useNotificationStore.js +2 -0
  19. package/dist/cjs/modules/feed/hooks/useNotificationStore.js.map +1 -0
  20. package/dist/cjs/modules/feed/hooks/useNotifications.js +2 -0
  21. package/dist/cjs/modules/feed/hooks/useNotifications.js.map +1 -0
  22. package/dist/cjs/modules/guide/context/KnockGuideProvider.js +2 -0
  23. package/dist/cjs/modules/guide/context/KnockGuideProvider.js.map +1 -0
  24. package/dist/cjs/modules/guide/hooks/useGuide.js +2 -0
  25. package/dist/cjs/modules/guide/hooks/useGuide.js.map +1 -0
  26. package/dist/cjs/modules/guide/hooks/useGuideContext.js +2 -0
  27. package/dist/cjs/modules/guide/hooks/useGuideContext.js.map +1 -0
  28. package/dist/cjs/modules/i18n/context/KnockI18nProvider.js +2 -0
  29. package/dist/cjs/modules/i18n/context/KnockI18nProvider.js.map +1 -0
  30. package/dist/cjs/modules/i18n/hooks/useTranslations.js +2 -0
  31. package/dist/cjs/modules/i18n/hooks/useTranslations.js.map +1 -0
  32. package/dist/cjs/modules/i18n/languages/de.js +2 -0
  33. package/dist/cjs/modules/i18n/languages/de.js.map +1 -0
  34. package/dist/cjs/modules/i18n/languages/en.js +2 -0
  35. package/dist/cjs/modules/i18n/languages/en.js.map +1 -0
  36. package/dist/cjs/modules/i18n/languages/index.js +2 -0
  37. package/dist/cjs/modules/i18n/languages/index.js.map +1 -0
  38. package/dist/cjs/modules/ms-teams/context/KnockMsTeamsProvider.js +2 -0
  39. package/dist/cjs/modules/ms-teams/context/KnockMsTeamsProvider.js.map +1 -0
  40. package/dist/cjs/modules/ms-teams/hooks/useConnectedMsTeamsChannels.js +2 -0
  41. package/dist/cjs/modules/ms-teams/hooks/useConnectedMsTeamsChannels.js.map +1 -0
  42. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsAuth.js +2 -0
  43. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsAuth.js.map +1 -0
  44. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsChannels.js +2 -0
  45. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsChannels.js.map +1 -0
  46. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsConnectionStatus.js +2 -0
  47. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsConnectionStatus.js.map +1 -0
  48. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsTeams.js +2 -0
  49. package/dist/cjs/modules/ms-teams/hooks/useMsTeamsTeams.js.map +1 -0
  50. package/dist/cjs/modules/slack/context/KnockSlackProvider.js +2 -0
  51. package/dist/cjs/modules/slack/context/KnockSlackProvider.js.map +1 -0
  52. package/dist/cjs/modules/slack/hooks/useConnectedSlackChannels.js +2 -0
  53. package/dist/cjs/modules/slack/hooks/useConnectedSlackChannels.js.map +1 -0
  54. package/dist/cjs/modules/slack/hooks/useSlackAuth.js +2 -0
  55. package/dist/cjs/modules/slack/hooks/useSlackAuth.js.map +1 -0
  56. package/dist/cjs/modules/slack/hooks/useSlackChannels.js +2 -0
  57. package/dist/cjs/modules/slack/hooks/useSlackChannels.js.map +1 -0
  58. package/dist/cjs/modules/slack/hooks/useSlackConnectionStatus.js +2 -0
  59. package/dist/cjs/modules/slack/hooks/useSlackConnectionStatus.js.map +1 -0
  60. package/dist/esm/index.mjs +66 -0
  61. package/dist/esm/index.mjs.map +1 -0
  62. package/dist/esm/modules/core/constants.mjs +5 -0
  63. package/dist/esm/modules/core/constants.mjs.map +1 -0
  64. package/dist/esm/modules/core/context/KnockProvider.mjs +35 -0
  65. package/dist/esm/modules/core/context/KnockProvider.mjs.map +1 -0
  66. package/dist/esm/modules/core/hooks/useAuthenticatedKnockClient.mjs +29 -0
  67. package/dist/esm/modules/core/hooks/useAuthenticatedKnockClient.mjs.map +1 -0
  68. package/dist/esm/modules/core/hooks/useStableOptions.mjs +13 -0
  69. package/dist/esm/modules/core/hooks/useStableOptions.mjs.map +1 -0
  70. package/dist/esm/modules/core/utils.mjs +49 -0
  71. package/dist/esm/modules/core/utils.mjs.map +1 -0
  72. package/dist/esm/modules/feed/context/KnockFeedProvider.mjs +37 -0
  73. package/dist/esm/modules/feed/context/KnockFeedProvider.mjs.map +1 -0
  74. package/dist/esm/modules/feed/hooks/useFeedSettings.mjs +23 -0
  75. package/dist/esm/modules/feed/hooks/useFeedSettings.mjs.map +1 -0
  76. package/dist/esm/modules/feed/hooks/useNotificationStore.mjs +12 -0
  77. package/dist/esm/modules/feed/hooks/useNotificationStore.mjs.map +1 -0
  78. package/dist/esm/modules/feed/hooks/useNotifications.mjs +34 -0
  79. package/dist/esm/modules/feed/hooks/useNotifications.mjs.map +1 -0
  80. package/dist/esm/modules/guide/context/KnockGuideProvider.mjs +33 -0
  81. package/dist/esm/modules/guide/context/KnockGuideProvider.mjs.map +1 -0
  82. package/dist/esm/modules/guide/hooks/useGuide.mjs +21 -0
  83. package/dist/esm/modules/guide/hooks/useGuide.mjs.map +1 -0
  84. package/dist/esm/modules/guide/hooks/useGuideContext.mjs +12 -0
  85. package/dist/esm/modules/guide/hooks/useGuideContext.mjs.map +1 -0
  86. package/dist/esm/modules/i18n/context/KnockI18nProvider.mjs +11 -0
  87. package/dist/esm/modules/i18n/context/KnockI18nProvider.mjs.map +1 -0
  88. package/dist/esm/modules/i18n/hooks/useTranslations.mjs +17 -0
  89. package/dist/esm/modules/i18n/hooks/useTranslations.mjs.map +1 -0
  90. package/dist/esm/modules/i18n/languages/de.mjs +39 -0
  91. package/dist/esm/modules/i18n/languages/de.mjs.map +1 -0
  92. package/dist/esm/modules/i18n/languages/en.mjs +51 -0
  93. package/dist/esm/modules/i18n/languages/en.mjs.map +1 -0
  94. package/dist/esm/modules/i18n/languages/index.mjs +10 -0
  95. package/dist/esm/modules/i18n/languages/index.mjs.map +1 -0
  96. package/dist/esm/modules/ms-teams/context/KnockMsTeamsProvider.mjs +48 -0
  97. package/dist/esm/modules/ms-teams/context/KnockMsTeamsProvider.mjs.map +1 -0
  98. package/dist/esm/modules/ms-teams/hooks/useConnectedMsTeamsChannels.mjs +78 -0
  99. package/dist/esm/modules/ms-teams/hooks/useConnectedMsTeamsChannels.mjs.map +1 -0
  100. package/dist/esm/modules/ms-teams/hooks/useMsTeamsAuth.mjs +53 -0
  101. package/dist/esm/modules/ms-teams/hooks/useMsTeamsAuth.mjs.map +1 -0
  102. package/dist/esm/modules/ms-teams/hooks/useMsTeamsChannels.mjs +41 -0
  103. package/dist/esm/modules/ms-teams/hooks/useMsTeamsChannels.mjs.map +1 -0
  104. package/dist/esm/modules/ms-teams/hooks/useMsTeamsConnectionStatus.mjs +38 -0
  105. package/dist/esm/modules/ms-teams/hooks/useMsTeamsConnectionStatus.mjs.map +1 -0
  106. package/dist/esm/modules/ms-teams/hooks/useMsTeamsTeams.mjs +51 -0
  107. package/dist/esm/modules/ms-teams/hooks/useMsTeamsTeams.mjs.map +1 -0
  108. package/dist/esm/modules/slack/context/KnockSlackProvider.mjs +49 -0
  109. package/dist/esm/modules/slack/context/KnockSlackProvider.mjs.map +1 -0
  110. package/dist/esm/modules/slack/hooks/useConnectedSlackChannels.mjs +78 -0
  111. package/dist/esm/modules/slack/hooks/useConnectedSlackChannels.mjs.map +1 -0
  112. package/dist/esm/modules/slack/hooks/useSlackAuth.mjs +68 -0
  113. package/dist/esm/modules/slack/hooks/useSlackAuth.mjs.map +1 -0
  114. package/dist/esm/modules/slack/hooks/useSlackChannels.mjs +52 -0
  115. package/dist/esm/modules/slack/hooks/useSlackChannels.mjs.map +1 -0
  116. package/dist/esm/modules/slack/hooks/useSlackConnectionStatus.mjs +47 -0
  117. package/dist/esm/modules/slack/hooks/useSlackConnectionStatus.mjs.map +1 -0
  118. package/dist/types/index.d.ts +8 -0
  119. package/dist/types/index.d.ts.map +1 -0
  120. package/dist/types/interfaces.d.ts +5 -0
  121. package/dist/types/interfaces.d.ts.map +1 -0
  122. package/dist/types/modules/core/constants.d.ts +8 -0
  123. package/dist/types/modules/core/constants.d.ts.map +1 -0
  124. package/dist/types/modules/core/context/KnockProvider.d.ts +20 -0
  125. package/dist/types/modules/core/context/KnockProvider.d.ts.map +1 -0
  126. package/dist/types/modules/core/context/index.d.ts +2 -0
  127. package/dist/types/modules/core/context/index.d.ts.map +1 -0
  128. package/dist/types/modules/core/hooks/index.d.ts +3 -0
  129. package/dist/types/modules/core/hooks/index.d.ts.map +1 -0
  130. package/dist/types/modules/core/hooks/useAuthenticatedKnockClient.d.ts +5 -0
  131. package/dist/types/modules/core/hooks/useAuthenticatedKnockClient.d.ts.map +1 -0
  132. package/dist/types/modules/core/hooks/useStableOptions.d.ts +2 -0
  133. package/dist/types/modules/core/hooks/useStableOptions.d.ts.map +1 -0
  134. package/dist/types/modules/core/index.d.ts +5 -0
  135. package/dist/types/modules/core/index.d.ts.map +1 -0
  136. package/dist/types/modules/core/utils.d.ts +24 -0
  137. package/dist/types/modules/core/utils.d.ts.map +1 -0
  138. package/dist/types/modules/feed/context/KnockFeedProvider.d.ts +19 -0
  139. package/dist/types/modules/feed/context/KnockFeedProvider.d.ts.map +1 -0
  140. package/dist/types/modules/feed/context/index.d.ts +2 -0
  141. package/dist/types/modules/feed/context/index.d.ts.map +1 -0
  142. package/dist/types/modules/feed/hooks/index.d.ts +4 -0
  143. package/dist/types/modules/feed/hooks/index.d.ts.map +1 -0
  144. package/dist/types/modules/feed/hooks/useFeedSettings.d.ts +12 -0
  145. package/dist/types/modules/feed/hooks/useFeedSettings.d.ts.map +1 -0
  146. package/dist/types/modules/feed/hooks/useNotificationStore.d.ts +34 -0
  147. package/dist/types/modules/feed/hooks/useNotificationStore.d.ts.map +1 -0
  148. package/dist/types/modules/feed/hooks/useNotifications.d.ts +4 -0
  149. package/dist/types/modules/feed/hooks/useNotifications.d.ts.map +1 -0
  150. package/dist/types/modules/feed/index.d.ts +3 -0
  151. package/dist/types/modules/feed/index.d.ts.map +1 -0
  152. package/dist/types/modules/guide/context/KnockGuideProvider.d.ts +19 -0
  153. package/dist/types/modules/guide/context/KnockGuideProvider.d.ts.map +1 -0
  154. package/dist/types/modules/guide/context/index.d.ts +2 -0
  155. package/dist/types/modules/guide/context/index.d.ts.map +1 -0
  156. package/dist/types/modules/guide/hooks/index.d.ts +2 -0
  157. package/dist/types/modules/guide/hooks/index.d.ts.map +1 -0
  158. package/dist/types/modules/guide/hooks/useGuide.d.ts +9 -0
  159. package/dist/types/modules/guide/hooks/useGuide.d.ts.map +1 -0
  160. package/dist/types/modules/guide/hooks/useGuideContext.d.ts +7 -0
  161. package/dist/types/modules/guide/hooks/useGuideContext.d.ts.map +1 -0
  162. package/dist/types/modules/guide/index.d.ts +3 -0
  163. package/dist/types/modules/guide/index.d.ts.map +1 -0
  164. package/dist/types/modules/i18n/context/KnockI18nProvider.d.ts +8 -0
  165. package/dist/types/modules/i18n/context/KnockI18nProvider.d.ts.map +1 -0
  166. package/dist/types/modules/i18n/context/index.d.ts +2 -0
  167. package/dist/types/modules/i18n/context/index.d.ts.map +1 -0
  168. package/dist/types/modules/i18n/hooks/index.d.ts +2 -0
  169. package/dist/types/modules/i18n/hooks/index.d.ts.map +1 -0
  170. package/dist/types/modules/i18n/hooks/useTranslations.d.ts +5 -0
  171. package/dist/types/modules/i18n/hooks/useTranslations.d.ts.map +1 -0
  172. package/dist/types/modules/i18n/index.d.ts +4 -0
  173. package/dist/types/modules/i18n/index.d.ts.map +1 -0
  174. package/dist/types/modules/i18n/languages/de.d.ts +4 -0
  175. package/dist/types/modules/i18n/languages/de.d.ts.map +1 -0
  176. package/dist/types/modules/i18n/languages/en.d.ts +4 -0
  177. package/dist/types/modules/i18n/languages/en.d.ts.map +1 -0
  178. package/dist/types/modules/i18n/languages/index.d.ts +54 -0
  179. package/dist/types/modules/i18n/languages/index.d.ts.map +1 -0
  180. package/dist/types/modules/ms-teams/context/KnockMsTeamsProvider.d.ts +20 -0
  181. package/dist/types/modules/ms-teams/context/KnockMsTeamsProvider.d.ts.map +1 -0
  182. package/dist/types/modules/ms-teams/context/index.d.ts +2 -0
  183. package/dist/types/modules/ms-teams/context/index.d.ts.map +1 -0
  184. package/dist/types/modules/ms-teams/hooks/index.d.ts +6 -0
  185. package/dist/types/modules/ms-teams/hooks/index.d.ts.map +1 -0
  186. package/dist/types/modules/ms-teams/hooks/useConnectedMsTeamsChannels.d.ts +15 -0
  187. package/dist/types/modules/ms-teams/hooks/useConnectedMsTeamsChannels.d.ts.map +1 -0
  188. package/dist/types/modules/ms-teams/hooks/useMsTeamsAuth.d.ts +7 -0
  189. package/dist/types/modules/ms-teams/hooks/useMsTeamsAuth.d.ts.map +1 -0
  190. package/dist/types/modules/ms-teams/hooks/useMsTeamsChannels.d.ts +14 -0
  191. package/dist/types/modules/ms-teams/hooks/useMsTeamsChannels.d.ts.map +1 -0
  192. package/dist/types/modules/ms-teams/hooks/useMsTeamsConnectionStatus.d.ts +13 -0
  193. package/dist/types/modules/ms-teams/hooks/useMsTeamsConnectionStatus.d.ts.map +1 -0
  194. package/dist/types/modules/ms-teams/hooks/useMsTeamsTeams.d.ts +13 -0
  195. package/dist/types/modules/ms-teams/hooks/useMsTeamsTeams.d.ts.map +1 -0
  196. package/dist/types/modules/ms-teams/index.d.ts +4 -0
  197. package/dist/types/modules/ms-teams/index.d.ts.map +1 -0
  198. package/dist/types/modules/ms-teams/interfaces.d.ts +11 -0
  199. package/dist/types/modules/ms-teams/interfaces.d.ts.map +1 -0
  200. package/dist/types/modules/slack/context/KnockSlackProvider.d.ts +30 -0
  201. package/dist/types/modules/slack/context/KnockSlackProvider.d.ts.map +1 -0
  202. package/dist/types/modules/slack/context/index.d.ts +2 -0
  203. package/dist/types/modules/slack/context/index.d.ts.map +1 -0
  204. package/dist/types/modules/slack/hooks/index.d.ts +5 -0
  205. package/dist/types/modules/slack/hooks/index.d.ts.map +1 -0
  206. package/dist/types/modules/slack/hooks/useConnectedSlackChannels.d.ts +15 -0
  207. package/dist/types/modules/slack/hooks/useConnectedSlackChannels.d.ts.map +1 -0
  208. package/dist/types/modules/slack/hooks/useSlackAuth.d.ts +11 -0
  209. package/dist/types/modules/slack/hooks/useSlackAuth.d.ts.map +1 -0
  210. package/dist/types/modules/slack/hooks/useSlackChannels.d.ts +13 -0
  211. package/dist/types/modules/slack/hooks/useSlackChannels.d.ts.map +1 -0
  212. package/dist/types/modules/slack/hooks/useSlackConnectionStatus.d.ts +13 -0
  213. package/dist/types/modules/slack/hooks/useSlackConnectionStatus.d.ts.map +1 -0
  214. package/dist/types/modules/slack/index.d.ts +4 -0
  215. package/dist/types/modules/slack/index.d.ts.map +1 -0
  216. package/dist/types/modules/slack/interfaces.d.ts +10 -0
  217. package/dist/types/modules/slack/interfaces.d.ts.map +1 -0
  218. package/package.json +3 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,521 @@
1
+ # Changelog
2
+
3
+ ## 0.6.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 6539c97: patch fix package contents being built properly
8
+ - Updated dependencies [6539c97]
9
+ - @knocklabs/client@0.14.11
10
+
11
+ ## 0.6.14
12
+
13
+ ### Patch Changes
14
+
15
+ - e05ad61: feat: Migrates the internal store library from zustand to @tanstack/store. This is a non-breaking change that maintains backwards compatibility with the @knocklabs/client and @knocklabs/react-core packages.
16
+ - e05ad61: feat: Migrates the internal store library from zustand to @tanstack/store. This is a non-breaking change that maintains backwards compatibility with the @knocklabs/client and @knocklabs/react-core packages.
17
+ - e05ad61: feat: Migrates the internal store library from zustand to @tanstack/store. This is a non-breaking change that maintains backwards compatibility with the @knocklabs/client and @knocklabs/react-core packages.
18
+ - Updated dependencies [e05ad61]
19
+ - Updated dependencies [e05ad61]
20
+ - Updated dependencies [e05ad61]
21
+ - @knocklabs/client@0.14.10
22
+
23
+ ## 0.6.14-canary.2
24
+
25
+ ### Patch Changes
26
+
27
+ - e69da7b: feat: Migrates the internal store library from zustand to @tanstack/store. This is a non-breaking change that maintains backwards compatibility with the @knocklabs/client and @knocklabs/react-core packages.
28
+ - Updated dependencies [e69da7b]
29
+ - @knocklabs/client@0.14.10-canary.2
30
+
31
+ ## 0.6.14-canary.1
32
+
33
+ ### Patch Changes
34
+
35
+ - c76b2d9: feat: Migrates the internal store library from zustand to @tanstack/store. This is a non-breaking change that maintains backwards compatibility with the @knocklabs/client and @knocklabs/react-core packages.
36
+ - Updated dependencies [c76b2d9]
37
+ - @knocklabs/client@0.14.10-canary.1
38
+
39
+ ## 0.6.14-canary.0
40
+
41
+ ### Patch Changes
42
+
43
+ - 86a72cc: feat: Migrates the internal store library from zustand to @tanstack/store. This is a non-breaking change that maintains backwards compatibility with the @knocklabs/client and @knocklabs/react-core packages.
44
+ - Updated dependencies [86a72cc]
45
+ - @knocklabs/client@0.14.10-canary.0
46
+
47
+ ## 0.6.13
48
+
49
+ ### Patch Changes
50
+
51
+ - bea5604: update @knocklabs/react & @knocklabs/react-core to use named exports instead of barrel exports
52
+
53
+ ## 0.6.12
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [4e73f12]
58
+ - @knocklabs/client@0.14.9
59
+
60
+ ## 0.6.11
61
+
62
+ ### Patch Changes
63
+
64
+ - dbbbaf7: Dispose of feed on unmount in `useNotifications` hook
65
+
66
+ Previously, the `useNotifications` hook did not clean up old instances of `Feed`
67
+ on unmount. This has been fixed.
68
+
69
+ ## 0.6.10
70
+
71
+ ### Patch Changes
72
+
73
+ - 337bade: feat: introduce ability to override slack scopes
74
+
75
+ ## 0.6.9
76
+
77
+ ### Patch Changes
78
+
79
+ - 329ee05: downgrade tanstack store deps to 0.6.x to work in older TS version
80
+ - Updated dependencies [329ee05]
81
+ - @knocklabs/client@0.14.8
82
+
83
+ ## 0.6.8
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies [efd1005]
88
+ - @knocklabs/client@0.14.7
89
+
90
+ ## 0.6.7
91
+
92
+ ### Patch Changes
93
+
94
+ - Updated dependencies [a5c615e]
95
+ - @knocklabs/client@0.14.6
96
+
97
+ ## 0.6.6
98
+
99
+ ### Patch Changes
100
+
101
+ - 8f00623: activation location rules support for guides
102
+ - Updated dependencies [8f00623]
103
+ - @knocklabs/client@0.14.5
104
+
105
+ ## 0.6.5
106
+
107
+ ### Patch Changes
108
+
109
+ - e800896: feat: typescript fixes + quality of life improvements
110
+ - Updated dependencies [e800896]
111
+ - @knocklabs/client@0.14.4
112
+
113
+ ## 0.6.4
114
+
115
+ ### Patch Changes
116
+
117
+ - 96d70bc: fixes memory leak when unmounting the useNotifications hook
118
+
119
+ ## 0.6.3
120
+
121
+ ### Patch Changes
122
+
123
+ - c97a1d9: Update TanStack Store
124
+ - Updated dependencies [c97a1d9]
125
+ - @knocklabs/client@0.14.3
126
+
127
+ ## 0.6.2
128
+
129
+ ### Patch Changes
130
+
131
+ - Updated dependencies [00439a2]
132
+ - @knocklabs/client@0.14.2
133
+
134
+ ## 0.6.1
135
+
136
+ ### Patch Changes
137
+
138
+ - Updated dependencies [4c41841]
139
+ - @knocklabs/client@0.14.1
140
+
141
+ ## 0.6.0
142
+
143
+ ### Minor Changes
144
+
145
+ - 711948c: feat: add guide client, hooks, provider, and components
146
+
147
+ ### Patch Changes
148
+
149
+ - Updated dependencies [711948c]
150
+ - @knocklabs/client@0.14.0
151
+
152
+ ## 0.5.2
153
+
154
+ ### Patch Changes
155
+
156
+ - Updated dependencies [187abc1]
157
+ - @knocklabs/client@0.13.1
158
+
159
+ ## 0.5.1
160
+
161
+ ### Patch Changes
162
+
163
+ - Updated dependencies [4cd1b1e]
164
+ - @knocklabs/client@0.13.0
165
+
166
+ ## 0.5.0
167
+
168
+ ### Minor Changes
169
+
170
+ - 8ba5dcb: [JS] Support React 19 in React SDKs
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [8ba5dcb]
175
+ - @knocklabs/client@0.12.0
176
+
177
+ ## 0.4.2
178
+
179
+ ### Patch Changes
180
+
181
+ - 226e319: Fix unnecessary refetches of first page by `useSlackChannels` and `useMsTeamsTeams` hooks
182
+
183
+ Previously, both the `useSlackChannels` and `useMsTeamsTeams` hooks would unnecessarily refetch the first page of data whenever multiple pages of data were loaded. This has been fixed.
184
+
185
+ ## 0.4.1
186
+
187
+ ### Patch Changes
188
+
189
+ - 1b86a0c: fix: correct pagination logic in useSlackChannels hook (KNO-7995)
190
+
191
+ ## 0.4.0
192
+
193
+ ### Minor Changes
194
+
195
+ - 7904b65: Remove `slackSearchbarMultipleChannels` from translations strings
196
+
197
+ ## 0.3.4
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [8ea25f4]
202
+ - @knocklabs/client@0.11.4
203
+
204
+ ## 0.3.3
205
+
206
+ ### Patch Changes
207
+
208
+ - 12bc993: Use SWR in `useConnectedSlackChannels` hook
209
+
210
+ `useConnectedSlackChannels` now uses [SWR](https://swr.vercel.app/) under the hood. The returned array of connections (`data`) will now update optimistically when `updateConnectedChannels` is called.
211
+
212
+ - Updated dependencies [4f76cd6]
213
+ - @knocklabs/client@0.11.3
214
+
215
+ ## 0.3.2
216
+
217
+ ### Patch Changes
218
+
219
+ - 85418a0: rename constants.ts to interfaces.ts
220
+ - 8cc9338: Fix types in useConnectedSlackChannels.ts
221
+ - da84a75: deprecate tenant in favor of tenantId in KnockSlackProvider and useKnockSlackClient
222
+ - 2161d3f: Use SWR for data fetching in useConnectedMsTeamsChannels hook
223
+ - 1ba1393: add TeamsKit hooks for teams and channels
224
+ - Updated dependencies [2161d3f]
225
+ - Updated dependencies [2161d3f]
226
+ - Updated dependencies [1ba1393]
227
+ - Updated dependencies [b4b5c02]
228
+ - @knocklabs/client@0.11.2
229
+
230
+ ## 0.3.1
231
+
232
+ ### Patch Changes
233
+
234
+ - b9f6712: fix: types for userId should handle undefined and null
235
+ - Updated dependencies [b9f6712]
236
+ - @knocklabs/client@0.11.1
237
+
238
+ ## 0.3.0
239
+
240
+ ### Minor Changes
241
+
242
+ - 013ad8d: feat: add MsTeamsAuthButton
243
+
244
+ ### Patch Changes
245
+
246
+ - Updated dependencies [013ad8d]
247
+ - @knocklabs/client@0.11.0
248
+
249
+ ## 0.2.29
250
+
251
+ ### Patch Changes
252
+
253
+ - Updated dependencies [26db496]
254
+ - Updated dependencies [988aaf9]
255
+ - @knocklabs/client@0.10.17
256
+
257
+ ## 0.2.28
258
+
259
+ ### Patch Changes
260
+
261
+ - Updated dependencies [bc99374]
262
+ - @knocklabs/client@0.10.16
263
+
264
+ ## 0.2.27
265
+
266
+ ### Patch Changes
267
+
268
+ - Updated dependencies [26166e3]
269
+ - @knocklabs/client@0.10.15
270
+
271
+ ## 0.2.26
272
+
273
+ ### Patch Changes
274
+
275
+ - Updated dependencies [7510909]
276
+ - @knocklabs/client@0.10.14
277
+
278
+ ## 0.2.25
279
+
280
+ ### Patch Changes
281
+
282
+ - 47a88da: feature: allow passing additional OAuth scope to SlackAuthButton
283
+
284
+ ## 0.2.24
285
+
286
+ ### Patch Changes
287
+
288
+ - 1d440f7: feat: add prebuilt In App Feed Components for React Native
289
+ - Updated dependencies [1d440f7]
290
+ - @knocklabs/client@0.10.13
291
+
292
+ ## 0.2.23
293
+
294
+ ### Patch Changes
295
+
296
+ - Updated dependencies [5545f9e]
297
+ - @knocklabs/client@0.10.12
298
+
299
+ ## 0.2.22
300
+
301
+ ### Patch Changes
302
+
303
+ - Updated dependencies [395f0ca]
304
+ - @knocklabs/client@0.10.11
305
+
306
+ ## 0.2.21
307
+
308
+ ### Patch Changes
309
+
310
+ - a4d520c: chore: update generic types
311
+ - Updated dependencies [a4d520c]
312
+ - @knocklabs/client@0.10.10
313
+
314
+ ## 0.2.20
315
+
316
+ ### Patch Changes
317
+
318
+ - Updated dependencies [d0adb14]
319
+ - @knocklabs/client@0.10.9
320
+
321
+ ## 0.2.19
322
+
323
+ ### Patch Changes
324
+
325
+ - 1e60c19: fix: re-introduce subscribe/setstate call for useNotifications
326
+
327
+ ## 0.2.18
328
+
329
+ ### Patch Changes
330
+
331
+ - 29e3942: fix: introduce new useNotificationStore hook to prevent issues that prevent state updates
332
+ - Updated dependencies [29e3942]
333
+ - @knocklabs/client@0.10.8
334
+
335
+ ## 0.2.17
336
+
337
+ ### Patch Changes
338
+
339
+ - f25b112: fix: ensure feed store reference re-renders after changes to user
340
+ - Updated dependencies [f25b112]
341
+ - @knocklabs/client@0.10.7
342
+
343
+ ## 0.2.16
344
+
345
+ ### Patch Changes
346
+
347
+ - 5d2ddab: fix: ensure options are memoized in useAuthenticatedKnockClient
348
+
349
+ ## 0.2.15
350
+
351
+ ### Patch Changes
352
+
353
+ - b29a47a: Add KnockExpoPushNotificationProvider to react-native sdk
354
+ - Updated dependencies [b29a47a]
355
+ - @knocklabs/client@0.10.6
356
+
357
+ ## 0.2.14
358
+
359
+ ### Patch Changes
360
+
361
+ - 5fe3063: Fixes issue where notification data was not updating in react strict mode
362
+
363
+ ## 0.2.13
364
+
365
+ ### Patch Changes
366
+
367
+ - Updated dependencies [044eb0f]
368
+ - @knocklabs/client@0.10.5
369
+
370
+ ## 0.2.12
371
+
372
+ ### Patch Changes
373
+
374
+ - Updated dependencies [5a7c56e]
375
+ - @knocklabs/client@0.10.4
376
+
377
+ ## 0.2.11
378
+
379
+ ### Patch Changes
380
+
381
+ - Updated dependencies [a71ce51]
382
+ - @knocklabs/client@0.10.3
383
+
384
+ ## 0.2.10
385
+
386
+ ### Patch Changes
387
+
388
+ - 42ba22c: fix: improve typing for react < 18
389
+ - Updated dependencies [42ba22c]
390
+ - @knocklabs/client@0.10.2
391
+
392
+ ## 0.2.9
393
+
394
+ ### Patch Changes
395
+
396
+ - 354dd1a: fix: move away from jsx runtime to support react 16 + 17
397
+
398
+ ## 0.2.8
399
+
400
+ ### Patch Changes
401
+
402
+ - 3c277cb: fix: remove react-query and replace with swr for react 16+ support
403
+ - Updated dependencies [3c277cb]
404
+ - Updated dependencies [567e24f]
405
+ - @knocklabs/client@0.10.1
406
+
407
+ ## 0.2.7
408
+
409
+ ### Patch Changes
410
+
411
+ - Updated dependencies [8bdc75b]
412
+ - @knocklabs/client@0.10.0
413
+
414
+ ## 0.2.6
415
+
416
+ ### Patch Changes
417
+
418
+ - Updated dependencies [f58371c]
419
+ - @knocklabs/client@0.9.4
420
+
421
+ ## 0.2.5
422
+
423
+ ### Patch Changes
424
+
425
+ - 10b5646: Include src files for react-core
426
+
427
+ ## 0.2.4
428
+
429
+ ### Patch Changes
430
+
431
+ - bc69618: Add react-native to package.json files to fix a bug in our React Native SDK
432
+ - Updated dependencies [bc69618]
433
+ - @knocklabs/client@0.9.3
434
+
435
+ ## 0.2.3
436
+
437
+ ### Patch Changes
438
+
439
+ - Updated dependencies [fed0f8c]
440
+ - @knocklabs/client@0.9.2
441
+
442
+ ## 0.2.2
443
+
444
+ ### Patch Changes
445
+
446
+ - 282d005: Handle auth disconnected status.
447
+
448
+ ## 0.2.1
449
+
450
+ ### Patch Changes
451
+
452
+ - Updated dependencies [f37d680]
453
+ - @knocklabs/client@0.9.1
454
+
455
+ ## 0.2.0
456
+
457
+ ### Minor Changes
458
+
459
+ - 627e643: Add SlackKit components, hooks, client JS functions, and example apps.
460
+
461
+ ### Patch Changes
462
+
463
+ - e076109: Fix hover state for connect button.
464
+ - Updated dependencies [627e643]
465
+ - @knocklabs/client@0.9.0
466
+
467
+ ## 0.1.6
468
+
469
+ ### Patch Changes
470
+
471
+ - c9faba5: fix esm build issues with mjs files
472
+ - Updated dependencies [c9faba5]
473
+ - @knocklabs/client@0.8.21
474
+
475
+ ## 0.1.5
476
+
477
+ ### Patch Changes
478
+
479
+ - Re-releasing packages
480
+ - Updated dependencies
481
+ - @knocklabs/client@0.8.20
482
+
483
+ ## 0.1.4
484
+
485
+ ### Patch Changes
486
+
487
+ - 7786ec5: chore: upgrade to yarn modern and update local package references
488
+ - 9dd0d15: feat: add onUserTokenExpiring callback option to client
489
+ - Updated dependencies [7786ec5]
490
+ - Updated dependencies [9dd0d15]
491
+ - @knocklabs/client@0.8.19
492
+
493
+ ## 0.1.3
494
+
495
+ ### Patch Changes
496
+
497
+ - 1050660: feat: switch timestamp formatting to date-fns intlFormatDistance
498
+ - Updated dependencies [e53c200]
499
+ - Updated dependencies [d4ba1f2]
500
+ - @knocklabs/client@0.8.18
501
+
502
+ ## 0.1.2
503
+
504
+ ### Patch Changes
505
+
506
+ - 8988230: Fix esm exports and date-fns/locale imports
507
+ - 8315372: Fix cjs build output for React components
508
+
509
+ ## 0.1.1
510
+
511
+ ### Patch Changes
512
+
513
+ - d8a216e: fix: react-core build process
514
+ fix: remove headless prop from KnockFeedProvider
515
+ fix: move KnockFeedContainer from react-core to react and rename to NotificationFeedContainer
516
+
517
+ ## 0.1.0
518
+
519
+ ### Patch Changes
520
+
521
+ - bcdbc86: Initialize monorepo
@@ -0,0 +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"),t=require("./modules/guide/context/KnockGuideProvider.js"),K=require("./modules/guide/hooks/useGuide.js"),r=require("./modules/ms-teams/context/KnockMsTeamsProvider.js"),C=require("./modules/ms-teams/hooks/useMsTeamsConnectionStatus.js"),S=require("./modules/ms-teams/hooks/useMsTeamsAuth.js"),m=require("./modules/ms-teams/hooks/useMsTeamsTeams.js"),q=require("./modules/ms-teams/hooks/useMsTeamsChannels.js"),v=require("./modules/ms-teams/hooks/useConnectedMsTeamsChannels.js"),i=require("./modules/slack/context/KnockSlackProvider.js"),P=require("./modules/slack/hooks/useSlackConnectionStatus.js"),T=require("./modules/slack/hooks/useSlackChannels.js"),M=require("./modules/slack/hooks/useConnectedSlackChannels.js"),f=require("./modules/slack/hooks/useSlackAuth.js"),u=require("./modules/i18n/context/KnockI18nProvider.js"),h=require("./modules/i18n/hooks/useTranslations.js"),F=require("./modules/i18n/languages/index.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=t.KnockGuideContext;exports.KnockGuideProvider=t.KnockGuideProvider;exports.useGuide=K.useGuide;exports.KnockMsTeamsProvider=r.KnockMsTeamsProvider;exports.useKnockMsTeamsClient=r.useKnockMsTeamsClient;exports.useMsTeamsConnectionStatus=C;exports.useMsTeamsAuth=S;exports.useMsTeamsTeams=m;exports.useMsTeamsChannels=q;exports.useConnectedMsTeamsChannels=v;exports.KnockSlackProvider=i.KnockSlackProvider;exports.useKnockSlackClient=i.useKnockSlackClient;exports.useSlackConnectionStatus=P;exports.useSlackChannels=T;exports.useConnectedSlackChannels=M;exports.useSlackAuth=f;exports.I18nContext=u.I18nContext;exports.KnockI18nProvider=u.KnockI18nProvider;exports.useTranslations=h.useTranslations;exports.locales=F.locales;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var n=(e=>(e.All="all",e.Read="read",e.Unseen="unseen",e.Unread="unread",e))(n||{});exports.FilterStatus=n;
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/modules/core/constants.ts"],"sourcesContent":["export enum FilterStatus {\n All = \"all\",\n Read = \"read\",\n Unseen = \"unseen\",\n Unread = \"unread\",\n}\n\nexport type ColorMode = \"light\" | \"dark\";\n"],"names":["FilterStatus","All","Read","Unseen","Unread"],"mappings":"gFAAYA,IAAAA,GAAAA,IACVC,EAAAA,IAAM,MACNC,EAAAA,KAAO,OACPC,EAAAA,OAAS,SACTC,EAAAA,OAAS,SAJCJ,IAAAA,GAAAA,CAAAA,CAAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),b=require("../../i18n/context/KnockI18nProvider.js"),K=require("../hooks/useAuthenticatedKnockClient.js");require("fast-deep-equal");function m(e){if(e&&typeof e=="object"&&"default"in e)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const o=m(f),i=o.createContext(null),P=({apiKey:e,host:n,logLevel:t,userId:r,userToken:s,onUserTokenExpiring:c,timeBeforeExpirationInMs:u,children:a,i18n:l})=>{const d=o.useMemo(()=>({host:n,onUserTokenExpiring:c,timeBeforeExpirationInMs:u,logLevel:t}),[n,c,u,t]),k=K(e??"",r,s,d);return o.createElement(i.Provider,{value:{knock:k}},o.createElement(b.KnockI18nProvider,{i18n:l},a))},p=()=>{const e=o.useContext(i);if(!e)throw new Error("useKnockClient must be used within a KnockProvider");return e.knock};exports.KnockProvider=P;exports.useKnockClient=p;
2
+ //# sourceMappingURL=KnockProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnockProvider.js","sources":["../../../../../src/modules/core/context/KnockProvider.tsx"],"sourcesContent":["import Knock, { AuthenticateOptions, LogLevel } from \"@knocklabs/client\";\nimport * as React from \"react\";\nimport { PropsWithChildren } from \"react\";\n\nimport { I18nContent, KnockI18nProvider } from \"../../i18n\";\nimport { useAuthenticatedKnockClient } from \"../hooks\";\n\nexport interface KnockProviderState {\n knock: Knock;\n}\n\nconst KnockContext = React.createContext<KnockProviderState | null>(null);\n\nexport interface KnockProviderProps {\n // Knock client props\n apiKey: string | undefined;\n host?: string;\n // Authentication props\n userId: Knock[\"userId\"];\n userToken?: Knock[\"userToken\"];\n onUserTokenExpiring?: AuthenticateOptions[\"onUserTokenExpiring\"];\n timeBeforeExpirationInMs?: AuthenticateOptions[\"timeBeforeExpirationInMs\"];\n // i18n translations\n i18n?: I18nContent;\n logLevel?: LogLevel;\n}\n\nexport const KnockProvider: React.FC<PropsWithChildren<KnockProviderProps>> = ({\n apiKey,\n host,\n logLevel,\n userId,\n userToken,\n onUserTokenExpiring,\n timeBeforeExpirationInMs,\n children,\n i18n,\n}) => {\n // We memoize the options here so that we don't create a new object on every re-render\n const authenticateOptions = React.useMemo(\n () => ({\n host,\n onUserTokenExpiring,\n timeBeforeExpirationInMs,\n logLevel,\n }),\n [host, onUserTokenExpiring, timeBeforeExpirationInMs, logLevel],\n );\n\n const knock = useAuthenticatedKnockClient(\n apiKey ?? \"\",\n userId,\n userToken,\n authenticateOptions,\n );\n\n return (\n <KnockContext.Provider value={{ knock }}>\n <KnockI18nProvider i18n={i18n}>{children}</KnockI18nProvider>\n </KnockContext.Provider>\n );\n};\n\nexport const useKnockClient = (): Knock => {\n const context = React.useContext(KnockContext);\n if (!context) {\n throw new Error(\"useKnockClient must be used within a KnockProvider\");\n }\n return context.knock;\n};\n"],"names":["KnockContext","React","createContext","KnockProvider","apiKey","host","logLevel","userId","userToken","onUserTokenExpiring","timeBeforeExpirationInMs","children","i18n","authenticateOptions","useMemo","knock","useAuthenticatedKnockClient","KnockI18nProvider","useKnockClient","context","useContext","Error"],"mappings":"yjBAWMA,EAAeC,EAAMC,cAAyC,IAAI,EAgB3DC,EAAiEA,CAAC,CAC7EC,OAAAA,EACAC,KAAAA,EACAC,SAAAA,EACAC,OAAAA,EACAC,UAAAA,EACAC,oBAAAA,EACAC,yBAAAA,EACAC,SAAAA,EACAC,KAAAA,CACF,IAAM,CAEEC,MAAAA,EAAsBZ,EAAMa,QAChC,KAAO,CACLT,KAAAA,EACAI,oBAAAA,EACAC,yBAAAA,EACAJ,SAAAA,IAEF,CAACD,EAAMI,EAAqBC,EAA0BJ,CAAQ,CAChE,EAEMS,EAAQC,EACZZ,GAAU,GACVG,EACAC,EACAK,CACF,EAEA,OACGZ,EAAA,cAAAD,EAAa,SAAb,CAAsB,MAAO,CAAEe,MAAAA,CAAAA,CAC9B,EAAAd,EAAA,cAACgB,EAAAA,kBAAkB,CAAA,KAAAL,CAAA,EAAaD,CAAS,CAC3C,CAEJ,EAEaO,EAAiBA,IAAa,CACnCC,MAAAA,EAAUlB,EAAMmB,WAAWpB,CAAY,EAC7C,GAAI,CAACmB,EACG,MAAA,IAAIE,MAAM,oDAAoD,EAEtE,OAAOF,EAAQJ,KACjB"}
@@ -0,0 +1,2 @@
1
+ "use strict";const s=require("@knocklabs/client"),d=require("react");require("../context/KnockProvider.js");const k=require("./useStableOptions.js");require("date-fns");const l=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},h=l(s),o=l(d);function f(e,r,c,t={}){e.authenticate(r,c,{onUserTokenExpiring:t==null?void 0:t.onUserTokenExpiring,timeBeforeExpirationInMs:t==null?void 0:t.timeBeforeExpirationInMs})}function q(e,r,c,t={}){const a=o.default.useRef(),u=k(t);return o.default.useMemo(()=>{const n=a.current;if(n&&n.isAuthenticated()&&(n.userId!==r||n.userToken!==c))return f(n,r,c,u),n;n&&n.teardown();const i=new h.default(e,{host:u.host,logLevel:u.logLevel});return f(i,r,c,u),a.current=i,i},[e,r,c,u])}module.exports=q;
2
+ //# sourceMappingURL=useAuthenticatedKnockClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAuthenticatedKnockClient.js","sources":["../../../../../src/modules/core/hooks/useAuthenticatedKnockClient.ts"],"sourcesContent":["import Knock, { AuthenticateOptions, KnockOptions } from \"@knocklabs/client\";\nimport React from \"react\";\n\nimport { useStableOptions } from \"../../core\";\n\nfunction authenticateWithOptions(\n knock: Knock,\n userId: Knock[\"userId\"],\n userToken?: Knock[\"userToken\"],\n options: AuthenticateOptions = {},\n) {\n knock.authenticate(userId, userToken, {\n onUserTokenExpiring: options?.onUserTokenExpiring,\n timeBeforeExpirationInMs: options?.timeBeforeExpirationInMs,\n });\n}\n\nexport type AuthenticatedKnockClientOptions = KnockOptions &\n AuthenticateOptions;\n\nfunction useAuthenticatedKnockClient(\n apiKey: string,\n userId: Knock[\"userId\"],\n userToken?: Knock[\"userToken\"],\n options: AuthenticatedKnockClientOptions = {},\n) {\n const knockRef = React.useRef<Knock | undefined>();\n const stableOptions = useStableOptions(options);\n\n return React.useMemo(() => {\n const currentKnock = knockRef.current;\n\n // If the userId and the userToken changes then just reauth\n if (\n currentKnock &&\n currentKnock.isAuthenticated() &&\n (currentKnock.userId !== userId || currentKnock.userToken !== userToken)\n ) {\n authenticateWithOptions(currentKnock, userId, userToken, stableOptions);\n return currentKnock;\n }\n\n if (currentKnock) {\n currentKnock.teardown();\n }\n\n // Otherwise instantiate a new Knock client\n const knock = new Knock(apiKey, {\n host: stableOptions.host,\n logLevel: stableOptions.logLevel,\n });\n\n authenticateWithOptions(knock, userId, userToken, stableOptions);\n knockRef.current = knock;\n\n return knock;\n }, [apiKey, userId, userToken, stableOptions]);\n}\n\nexport default useAuthenticatedKnockClient;\n"],"names":["authenticateWithOptions","knock","userId","userToken","options","authenticate","onUserTokenExpiring","timeBeforeExpirationInMs","useAuthenticatedKnockClient","apiKey","knockRef","React","useRef","stableOptions","useStableOptions","useMemo","currentKnock","current","isAuthenticated","teardown","Knock","host","logLevel"],"mappings":"qPAKA,SAASA,EACPC,EACAC,EACAC,EACAC,EAA+B,CAAA,EAC/B,CACMC,EAAAA,aAAaH,EAAQC,EAAW,CACpCG,oBAAqBF,GAAAA,YAAAA,EAASE,oBAC9BC,yBAA0BH,GAAAA,YAAAA,EAASG,wBAAAA,CACpC,CACH,CAKA,SAASC,EACPC,EACAP,EACAC,EACAC,EAA2C,CAAA,EAC3C,CACMM,MAAAA,EAAWC,UAAMC,OAA0B,EAC3CC,EAAgBC,EAAiBV,CAAO,EAEvCO,OAAAA,EAAAA,QAAMI,QAAQ,IAAM,CACzB,MAAMC,EAAeN,EAASO,QAI5BD,GAAAA,GACAA,EAAaE,gBAAgB,IAC5BF,EAAad,SAAWA,GAAUc,EAAab,YAAcA,GAEtCa,OAAAA,EAAAA,EAAcd,EAAQC,EAAWU,CAAa,EAC/DG,EAGLA,GACFA,EAAaG,SAAS,EAIlBlB,MAAAA,EAAQ,IAAImB,EAAAA,QAAMX,EAAQ,CAC9BY,KAAMR,EAAcQ,KACpBC,SAAUT,EAAcS,QAAAA,CACzB,EAEuBrB,OAAAA,EAAAA,EAAOC,EAAQC,EAAWU,CAAa,EAC/DH,EAASO,QAAUhB,EAEZA,GACN,CAACQ,EAAQP,EAAQC,EAAWU,CAAa,CAAC,CAC/C"}
@@ -0,0 +1,2 @@
1
+ "use strict";const n=require("fast-deep-equal"),r=require("react"),s=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},c=s(n);function a(t){const u=r.useRef();return r.useMemo(()=>{const e=u.current;return e&&c.default(t,e)?e:(u.current=t,t)},[t])}module.exports=a;
2
+ //# sourceMappingURL=useStableOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStableOptions.js","sources":["../../../../../src/modules/core/hooks/useStableOptions.ts"],"sourcesContent":["import fastDeepEqual from \"fast-deep-equal\";\nimport { useMemo, useRef } from \"react\";\n\nexport default function useStableOptions<T>(options: T): T {\n const optionsRef = useRef<T>();\n\n return useMemo(() => {\n const currentOptions = optionsRef.current;\n\n if (currentOptions && fastDeepEqual(options, currentOptions)) {\n return currentOptions;\n }\n\n optionsRef.current = options;\n return options;\n }, [options]);\n}\n"],"names":["useStableOptions","options","optionsRef","useRef","useMemo","currentOptions","current","fastDeepEqual"],"mappings":"kIAGA,SAAwBA,EAAoBC,EAAe,CACzD,MAAMC,EAAaC,EAAAA,OAAU,EAE7B,OAAOC,UAAQ,IAAM,CACnB,MAAMC,EAAiBH,EAAWI,QAElC,OAAID,GAAkBE,EAAAA,QAAcN,EAASI,CAAc,EAClDA,GAGTH,EAAWI,QAAUL,EACdA,EAAAA,EACN,CAACA,CAAO,CAAC,CACd"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("date-fns");function i(e){return e>9?"9+":e}function c(e,t={}){try{const r=o.parseISO(e);return o.intlFormatDistance(r,new Date,{locale:t.locale})}catch{return e}}function d(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e,t){return e!==void 0?e:t}function u(e,t,r={}){return[e,t,r.source,r.tenant,r.has_tenant,r.archived].filter(n=>n!=null).join("-")}function s({knockSlackChannelId:e,tenantId:t,connectionStatus:r,errorLabel:n}){return[e,t,r,n].filter(a=>a!=null).join("-")}function f({knockMsTeamsChannelId:e,tenantId:t,connectionStatus:r,errorLabel:n}){return[e,t,r,n].filter(a=>a!=null).join("-")}exports.feedProviderKey=u;exports.formatBadgeCount=i;exports.formatTimestamp=c;exports.msTeamsProviderKey=f;exports.renderNodeOrFallback=l;exports.slackProviderKey=s;exports.toSentenceCase=d;
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/modules/core/utils.ts"],"sourcesContent":["import Knock, { FeedClientOptions } from \"@knocklabs/client\";\nimport { intlFormatDistance, parseISO } from \"date-fns\";\nimport { ReactNode } from \"react\";\n\nexport function formatBadgeCount(count: number): string | number {\n return count > 9 ? \"9+\" : count;\n}\n\ntype FormatTimestampOptions = {\n locale?: string | string[];\n};\n\nexport function formatTimestamp(\n ts: string,\n options: FormatTimestampOptions = {},\n) {\n try {\n const parsedTs = parseISO(ts);\n const formatted = intlFormatDistance(parsedTs, new Date(), {\n locale: options.locale,\n });\n\n return formatted;\n } catch (_e) {\n return ts;\n }\n}\n\nexport function toSentenceCase(string: string): string {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nexport function renderNodeOrFallback(node: ReactNode, fallback: ReactNode) {\n return node !== undefined ? node : fallback;\n}\n\n/*\n Used to build a consistent key for the KnockFeedProvider so that React knows when\n to trigger a re-render of the context when a key property changes.\n*/\nexport function feedProviderKey(\n userId: Knock[\"userId\"],\n feedId: string,\n options: FeedClientOptions = {},\n) {\n return [\n userId,\n feedId,\n options.source,\n options.tenant,\n options.has_tenant,\n options.archived,\n ]\n .filter((f) => f !== null && f !== undefined)\n .join(\"-\");\n}\n\n/*\n Used to build a consistent key for the KnockSlackProvider so that React knows when\n to trigger a re-render of the context when a key property changes.\n*/\nexport function slackProviderKey({\n knockSlackChannelId,\n tenantId,\n connectionStatus,\n errorLabel,\n}: {\n knockSlackChannelId: string;\n tenantId: string;\n connectionStatus: string;\n errorLabel: string | null;\n}) {\n return [knockSlackChannelId, tenantId, connectionStatus, errorLabel]\n .filter((f) => f !== null && f !== undefined)\n .join(\"-\");\n}\n\n/*\n Used to build a consistent key for the KnockMsTeamsProvider so that React knows when\n to trigger a re-render of the context when a key property changes.\n*/\nexport function msTeamsProviderKey({\n knockMsTeamsChannelId,\n tenantId,\n connectionStatus,\n errorLabel,\n}: {\n knockMsTeamsChannelId: string;\n tenantId: string;\n connectionStatus: string;\n errorLabel: string | null;\n}) {\n return [knockMsTeamsChannelId, tenantId, connectionStatus, errorLabel]\n .filter((f) => f !== null && f !== undefined)\n .join(\"-\");\n}\n"],"names":["formatBadgeCount","count","formatTimestamp","ts","options","parsedTs","parseISO","formatted","intlFormatDistance","Date","locale","toSentenceCase","string","charAt","toUpperCase","slice","renderNodeOrFallback","node","fallback","undefined","feedProviderKey","userId","feedId","source","tenant","has_tenant","archived","filter","f","join","slackProviderKey","knockSlackChannelId","tenantId","connectionStatus","errorLabel","msTeamsProviderKey","knockMsTeamsChannelId"],"mappings":"4GAIO,SAASA,EAAiBC,EAAgC,CACxDA,OAAAA,EAAQ,EAAI,KAAOA,CAC5B,CAMO,SAASC,EACdC,EACAC,EAAkC,GAClC,CACI,GAAA,CACIC,MAAAA,EAAWC,WAASH,CAAE,EAKrBI,OAJWC,EAAAA,mBAAmBH,EAAU,IAAII,KAAQ,CACzDC,OAAQN,EAAQM,MAAAA,CACjB,OAGU,CACJP,OAAAA,CAAAA,CAEX,CAEO,SAASQ,EAAeC,EAAwB,CAC9CA,OAAAA,EAAOC,OAAO,CAAC,EAAEC,cAAgBF,EAAOG,MAAM,CAAC,CACxD,CAEgBC,SAAAA,EAAqBC,EAAiBC,EAAqB,CAClED,OAAAA,IAASE,OAAYF,EAAOC,CACrC,CAMO,SAASE,EACdC,EACAC,EACAlB,EAA6B,CAAA,EAC7B,CACO,MAAA,CACLiB,EACAC,EACAlB,EAAQmB,OACRnB,EAAQoB,OACRpB,EAAQqB,WACRrB,EAAQsB,QAAQ,EAEfC,UAAcC,GAAM,IAAuB,EAC3CC,KAAK,GAAG,CACb,CAMO,SAASC,EAAiB,CAC/BC,oBAAAA,EACAC,SAAAA,EACAC,iBAAAA,EACAC,WAAAA,CAMF,EAAG,CACD,MAAO,CAACH,EAAqBC,EAAUC,EAAkBC,CAAU,EAChEP,OAAcC,GAAAA,GAAM,IAAuB,EAC3CC,KAAK,GAAG,CACb,CAMO,SAASM,EAAmB,CACjCC,sBAAAA,EACAJ,SAAAA,EACAC,iBAAAA,EACAC,WAAAA,CAMF,EAAG,CACD,MAAO,CAACE,EAAuBJ,EAAUC,EAAkBC,CAAU,EAClEP,OAAcC,GAAAA,GAAM,IAAuB,EAC3CC,KAAK,GAAG,CACb"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),a=require("../../core/context/KnockProvider.js");require("@knocklabs/client");require("fast-deep-equal");const l=require("../../core/utils.js"),f=require("../hooks/useNotifications.js"),k=require("../hooks/useNotificationStore.js");function v(e){if(e&&typeof e=="object"&&"default"in e)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const c=v(d),u=c.createContext(void 0),K=({feedId:e,children:r,defaultFeedOptions:t={},colorMode:o="light"})=>{let n;try{n=a.useKnockClient()}catch{throw new Error("KnockFeedProvider must be used within a KnockProvider.")}const i=f(n,e??"",t),s=k.useCreateNotificationStore(i);return c.createElement(u.Provider,{key:l.feedProviderKey(n.userId,e??"",t),value:{knock:n,feedClient:i,useFeedStore:s,colorMode:o}},r)},b=()=>{const e=c.useContext(u);if(!e)throw new Error("useKnockFeed must be used within a KnockFeedProvider");return e};exports.KnockFeedProvider=K;exports.useKnockFeed=b;
2
+ //# sourceMappingURL=KnockFeedProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KnockFeedProvider.js","sources":["../../../../../src/modules/feed/context/KnockFeedProvider.tsx"],"sourcesContent":["import Knock, { Feed, FeedClientOptions } from \"@knocklabs/client\";\nimport * as React from \"react\";\nimport { PropsWithChildren } from \"react\";\n\nimport { useKnockClient } from \"../../core\";\nimport { ColorMode } from \"../../core/constants\";\nimport { feedProviderKey } from \"../../core/utils\";\nimport { useCreateNotificationStore } from \"../hooks\";\nimport useNotifications from \"../hooks/useNotifications\";\n\nexport interface KnockFeedProviderState {\n knock: Knock;\n feedClient: Feed;\n useFeedStore: ReturnType<typeof useCreateNotificationStore>;\n colorMode: ColorMode;\n}\n\nconst KnockFeedContext = React.createContext<\n KnockFeedProviderState | undefined\n>(undefined);\n\nexport interface KnockFeedProviderProps {\n // Feed props\n feedId: string | undefined;\n\n // Extra options\n colorMode?: ColorMode;\n\n // Feed client options\n defaultFeedOptions?: FeedClientOptions;\n}\n\nexport const KnockFeedProvider: React.FC<\n PropsWithChildren<KnockFeedProviderProps>\n> = ({ feedId, children, defaultFeedOptions = {}, colorMode = \"light\" }) => {\n let knock: Knock;\n try {\n knock = useKnockClient();\n } catch (_) {\n throw new Error(\"KnockFeedProvider must be used within a KnockProvider.\");\n }\n\n const feedClient = useNotifications(knock, feedId ?? \"\", defaultFeedOptions);\n const useFeedStore = useCreateNotificationStore(feedClient);\n\n return (\n <KnockFeedContext.Provider\n key={feedProviderKey(knock.userId, feedId ?? \"\", defaultFeedOptions)}\n value={{\n knock,\n feedClient,\n useFeedStore,\n colorMode,\n }}\n >\n {children}\n </KnockFeedContext.Provider>\n );\n};\n\nexport const useKnockFeed = (): KnockFeedProviderState => {\n const context = React.useContext(KnockFeedContext);\n if (!context) {\n throw new Error(\"useKnockFeed must be used within a KnockFeedProvider\");\n }\n\n return context;\n};\n"],"names":["KnockFeedContext","React","createContext","undefined","KnockFeedProvider","feedId","children","defaultFeedOptions","colorMode","knock","useKnockClient","Error","feedClient","useNotifications","useFeedStore","useCreateNotificationStore","feedProviderKey","userId","useKnockFeed","context","useContext"],"mappings":"4pBAiBMA,EAAmBC,EAAMC,cAE7BC,MAAS,EAaEC,EAETA,CAAC,CAAEC,OAAAA,EAAQC,SAAAA,EAAUC,mBAAAA,EAAqB,CAAC,EAAGC,UAAAA,EAAY,OAAQ,IAAM,CACtEC,IAAAA,EACA,GAAA,CACFA,EAAQC,EAAAA,eAAe,OACb,CACJ,MAAA,IAAIC,MAAM,wDAAwD,CAAA,CAG1E,MAAMC,EAAaC,EAAiBJ,EAAOJ,GAAU,GAAIE,CAAkB,EACrEO,EAAeC,6BAA2BH,CAAU,EAE1D,OACGX,EAAA,cAAAD,EAAiB,SAAjB,CACC,IAAKgB,EAAAA,gBAAgBP,EAAMQ,OAAQZ,GAAU,GAAIE,CAAkB,EACnE,MAAO,CACLE,MAAAA,EACAG,WAAAA,EACAE,aAAAA,EACAN,UAAAA,IAGDF,CACH,CAEJ,EAEaY,EAAeA,IAA8B,CAClDC,MAAAA,EAAUlB,EAAMmB,WAAWpB,CAAgB,EACjD,GAAI,CAACmB,EACG,MAAA,IAAIR,MAAM,sDAAsD,EAGjEQ,OAAAA,CACT"}
@@ -0,0 +1,2 @@
1
+ "use strict";const e=require("react");function g(t){const[i,c]=e.useState(null),[u,s]=e.useState(!1);return e.useEffect(()=>{async function a(){const n=t.knock,r=n.client(),d=`/v1/users/${n.userId}/feeds/${t.feedId}/settings`;s(!0);const o=await r.makeRequest({method:"GET",url:d});o.error||c(o.body),s(!1)}a()},[]),{settings:i,loading:u}}module.exports=g;
2
+ //# sourceMappingURL=useFeedSettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFeedSettings.js","sources":["../../../../../src/modules/feed/hooks/useFeedSettings.ts"],"sourcesContent":["import { Feed } from \"@knocklabs/client\";\nimport { useEffect, useState } from \"react\";\n\nexport type FeedSettings = {\n features: {\n branding_required: boolean;\n };\n};\n\nfunction useFeedSettings(feedClient: Feed): {\n settings: FeedSettings | null;\n loading: boolean;\n} {\n const [settings, setSettings] = useState(null);\n const [isLoading, setIsLoading] = useState(false);\n\n // TODO: consider moving this into the feed client and into the feed store state when\n // we're using this in other areas of the feed\n useEffect(() => {\n async function getSettings() {\n const knock = feedClient.knock;\n const apiClient = knock.client();\n const feedSettingsPath = `/v1/users/${knock.userId}/feeds/${feedClient.feedId}/settings`;\n setIsLoading(true);\n\n const response = await apiClient.makeRequest({\n method: \"GET\",\n url: feedSettingsPath,\n });\n\n if (!response.error) {\n setSettings(response.body);\n }\n\n setIsLoading(false);\n }\n\n getSettings();\n // TODO: Check if we can remove this disable\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return { settings, loading: isLoading };\n}\n\nexport default useFeedSettings;\n"],"names":["useFeedSettings","feedClient","settings","setSettings","useState","isLoading","setIsLoading","useEffect","getSettings","knock","apiClient","client","feedSettingsPath","userId","feedId","response","makeRequest","method","url","error","body","loading"],"mappings":"sCASA,SAASA,EAAgBC,EAGvB,CACA,KAAM,CAACC,EAAUC,CAAW,EAAIC,EAAAA,SAAS,IAAI,EACvC,CAACC,EAAWC,CAAY,EAAIF,EAAAA,SAAS,EAAK,EAIhDG,OAAAA,EAAAA,UAAU,IAAM,CACd,eAAeC,GAAc,CAC3B,MAAMC,EAAQR,EAAWQ,MACnBC,EAAYD,EAAME,OAAO,EACzBC,EAAmB,aAAaH,EAAMI,MAAM,UAAUZ,EAAWa,MAAM,YAC7ER,EAAa,EAAI,EAEXS,MAAAA,EAAW,MAAML,EAAUM,YAAY,CAC3CC,OAAQ,MACRC,IAAKN,CAAAA,CACN,EAEIG,EAASI,OACZhB,EAAYY,EAASK,IAAI,EAG3Bd,EAAa,EAAK,CAAA,CAGRE,EAAA,CAGd,EAAG,EAAE,EAEE,CAAEN,SAAAA,EAAUmB,QAAShB,CAAU,CACxC"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("@tanstack/react-store");function r(e){return t=>i.useStore(e.store.store,t??(o=>o))}function n(e,t){return r(e)(t??(u=>u))}exports.default=n;exports.useCreateNotificationStore=r;
2
+ //# sourceMappingURL=useNotificationStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNotificationStore.js","sources":["../../../../../src/modules/feed/hooks/useNotificationStore.ts"],"sourcesContent":["import { Feed, type FeedStoreState } from \"@knocklabs/client\";\nimport { useStore } from \"@tanstack/react-store\";\n\nexport type Selector<T> = (state: FeedStoreState) => T;\n\n/**\n * Create a hook factory that provides access to the TanStack Store with optional selector support.\n * This pattern allows for flexible store access with or without selectors while maintaining\n * type safety. The selector can be passed either to useCreateNotificationStore or\n * useNotificationStore, with the latter taking precedence.\n */\nfunction useCreateNotificationStore(feedClient: Feed) {\n return <T = FeedStoreState>(selector?: Selector<T>) => {\n // Keep selector optional for external use\n // useStore requires a selector so we'll pass in a default one when not provided\n // eslint-disable-next-line\n return useStore(\n feedClient.store.store,\n selector ?? ((state) => state as T),\n );\n };\n}\n\n/**\n * A hook used to access content within the notification store.\n *\n * @example\n *\n * ```ts\n * const { items, metadata } = useNotificationStore(feedClient);\n * ```\n *\n * A selector can be used to access a subset of the store state.\n *\n * @example\n *\n * ```ts\n * const { items, metadata } = useNotificationStore(feedClient, (state) => ({\n * items: state.items,\n * metadata: state.metadata,\n * }));\n * ```\n */\nfunction useNotificationStore(feedClient: Feed): FeedStoreState;\nfunction useNotificationStore<T>(feedClient: Feed, selector: Selector<T>): T;\nfunction useNotificationStore<T>(\n feedClient: Feed,\n selector?: Selector<T>,\n): T | FeedStoreState {\n const useStoreLocal = useCreateNotificationStore(feedClient);\n return useStoreLocal(selector ?? ((state) => state as T));\n}\n\nexport { useCreateNotificationStore };\nexport default useNotificationStore;\n"],"names":["useCreateNotificationStore","feedClient","selector","useStore","store","state","useNotificationStore","useStoreLocal"],"mappings":"qJAWA,SAASA,EAA2BC,EAAkB,CACpD,OAA4BC,GAInBC,WACLF,EAAWG,MAAMA,MACjBF,OAAwBG,EAC1B,CAEJ,CAwBA,SAASC,EACPL,EACAC,EACoB,CAEbK,OADeP,EAA2BC,CAAU,EACtCC,IAAcG,GAAUA,EAAW,CAC1D"}
@@ -0,0 +1,2 @@
1
+ "use strict";const i=require("react");require("../../core/context/KnockProvider.js");require("@knocklabs/client");const a=require("../../core/hooks/useStableOptions.js");require("date-fns");function p(u,s,l={}){const n=i.useCallback((o,c)=>{const f=u.feeds.initialize(o,c);return f.listenForUpdates(),f},[u]),e=a(l),[t,d]=i.useState(()=>({feedClient:n(s,e),options:e})),r=i.useRef(!1);return i.useEffect(()=>{const o=r.current;if(t.feedClient.feedId!==s||t.options!==e||o){r.current=!1,d({feedClient:n(s,e),options:e});return}return()=>{r.current=!0,t.feedClient.dispose()}},[n,s,e,t]),t.feedClient}module.exports=p;
2
+ //# sourceMappingURL=useNotifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNotifications.js","sources":["../../../../../src/modules/feed/hooks/useNotifications.ts"],"sourcesContent":["import Knock, { Feed, FeedClientOptions } from \"@knocklabs/client\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { useStableOptions } from \"../../core\";\n\ninterface State {\n feedClient: Feed;\n options: FeedClientOptions;\n}\n\nfunction useNotifications(\n knock: Knock,\n feedChannelId: string,\n options: FeedClientOptions = {},\n): Feed {\n const initFeedClient = useCallback(\n (feedChannelId: string, options: FeedClientOptions) => {\n const feedClient = knock.feeds.initialize(feedChannelId, options);\n\n feedClient.listenForUpdates();\n\n return feedClient;\n },\n [knock],\n );\n\n const stableOptions = useStableOptions(options);\n const [state, setState] = useState<State>(() => ({\n // FIXME In strict mode, useState initializer functions are called twice,\n // which results in one extra instance of the feed client being created\n // and not disposed of. This only affects strict mode.\n feedClient: initFeedClient(feedChannelId, stableOptions),\n options: stableOptions,\n }));\n const disposedRef = useRef(false);\n\n useEffect(() => {\n const isDisposed = disposedRef.current;\n\n // Initialize a new feed client if the feed ID has changed,\n // options have changed, or the current feed client has been disposed\n const needsReinit =\n state.feedClient.feedId !== feedChannelId ||\n state.options !== stableOptions ||\n isDisposed;\n\n if (needsReinit) {\n disposedRef.current = false;\n setState({\n feedClient: initFeedClient(feedChannelId, stableOptions),\n options: stableOptions,\n });\n return;\n }\n\n return () => {\n disposedRef.current = true;\n state.feedClient.dispose();\n };\n }, [initFeedClient, feedChannelId, stableOptions, state]);\n\n return state.feedClient;\n}\n\nexport default useNotifications;\n"],"names":["useNotifications","knock","feedChannelId","options","initFeedClient","useCallback","feedClient","feeds","initialize","listenForUpdates","stableOptions","useStableOptions","state","setState","useState","disposedRef","useRef","useEffect","isDisposed","current","feedId","dispose"],"mappings":"8LAUA,SAASA,EACPC,EACAC,EACAC,EAA6B,CAAA,EACvB,CACN,MAAMC,EAAiBC,EAAAA,YACrB,CAACH,EAAuBC,IAA+B,CACrD,MAAMG,EAAaL,EAAMM,MAAMC,WAAWN,EAAeC,CAAO,EAEhEG,OAAAA,EAAWG,iBAAiB,EAErBH,CAAAA,EAET,CAACL,CAAK,CACR,EAEMS,EAAgBC,EAAiBR,CAAO,EACxC,CAACS,EAAOC,CAAQ,EAAIC,WAAgB,KAAO,CAI/CR,WAAYF,EAAeF,EAAeQ,CAAa,EACvDP,QAASO,CAAAA,EACT,EACIK,EAAcC,SAAO,EAAK,EAEhCC,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAaH,EAAYI,QAS/B,GAJEP,EAAMN,WAAWc,SAAWlB,GAC5BU,EAAMT,UAAYO,GAClBQ,EAEe,CACfH,EAAYI,QAAU,GACbN,EAAA,CACPP,WAAYF,EAAeF,EAAeQ,CAAa,EACvDP,QAASO,CAAAA,CACV,EACD,MAAA,CAGF,MAAO,IAAM,CACXK,EAAYI,QAAU,GACtBP,EAAMN,WAAWe,QAAQ,CAC3B,GACC,CAACjB,EAAgBF,EAAeQ,EAAeE,CAAK,CAAC,EAEjDA,EAAMN,UACf"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@knocklabs/client"),b=require("react"),k=require("../../core/context/KnockProvider.js"),p=require("../../core/hooks/useStableOptions.js");require("date-fns");function v(e){if(e&&typeof e=="object"&&"default"in e)return e;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const c=v(b),a=c.createContext(void 0),K=({channelId:e,readyToTarget:r,listenForUpdates:t=!0,colorMode:o="light",targetParams:l={},trackLocationFromWindow:u=!0,children:d})=>{let i;try{i=k.useKnockClient()}catch{throw new Error("KnockGuideProvider must be used within a KnockProvider")}const s=p(l),n=c.useMemo(()=>new f.KnockGuideClient(i,e,s,{trackLocationFromWindow:u}),[i,e,s,u]);return c.useEffect(()=>(r&&(n.fetch(),t&&n.subscribe()),()=>n.cleanup()),[r,t,n]),c.createElement(a.Provider,{value:{client:n,colorMode:o}},d)};exports.KnockGuideContext=a;exports.KnockGuideProvider=K;
2
+ //# sourceMappingURL=KnockGuideProvider.js.map
@@ -0,0 +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\ntype Props = {\n channelId: string;\n readyToTarget: boolean;\n listenForUpdates?: boolean;\n colorMode?: ColorMode;\n targetParams?: KnockGuideTargetParams;\n trackLocationFromWindow?: boolean;\n};\n\nexport const KnockGuideProvider: React.FC<React.PropsWithChildren<Props>> = ({\n channelId,\n readyToTarget,\n listenForUpdates = true,\n colorMode = \"light\",\n targetParams = {},\n trackLocationFromWindow = true,\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 });\n }, [knock, channelId, stableTargetParams, trackLocationFromWindow]);\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","children","knock","useKnockClient","Error","stableTargetParams","useStableOptions","knockGuideClient","useMemo","KnockGuideClient","useEffect","fetch","subscribe","cleanup","client"],"mappings":"0kBAcaA,EAAoBC,EAAMC,cAErCC,MAAS,EAWEC,EAA+DA,CAAC,CAC3EC,UAAAA,EACAC,cAAAA,EACAC,iBAAAA,EAAmB,GACnBC,UAAAA,EAAY,QACZC,aAAAA,EAAe,CAAC,EAChBC,wBAAAA,EAA0B,GAC1BC,SAAAA,CACF,IAAM,CACAC,IAAAA,EAEA,GAAA,CACFA,EAAQC,EAAAA,eAAe,OACb,CACJ,MAAA,IAAIC,MAAM,wDAAwD,CAAA,CAGpEC,MAAAA,EAAqBC,EAAiBP,CAAY,EAElDQ,EAAmBhB,EAAMiB,QAAQ,IAC9B,IAAIC,EAAAA,iBAAiBP,EAAOP,EAAWU,EAAoB,CAChEL,wBAAAA,CAAAA,CACD,EACA,CAACE,EAAOP,EAAWU,EAAoBL,CAAuB,CAAC,EAElET,OAAAA,EAAMmB,UAAU,KACVd,IACFW,EAAiBI,MAAM,EACnBd,KAAmCe,UAAU,GAG5C,IAAML,EAAiBM,QAAQ,GACrC,CAACjB,EAAeC,EAAkBU,CAAgB,CAAC,EAGnDhB,EAAA,cAAAD,EAAkB,SAAlB,CACC,MAAO,CACLwB,OAAQP,EACRT,UAAAA,IAGDG,CACH,CAEJ"}