@northern.tech/store 0.46.4 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/dist/actions.d.cts +6 -6
  2. package/dist/actions.d.ts +6 -6
  3. package/dist/api/general-api.cjs +2 -2
  4. package/dist/api/general-api.cjs.map +1 -1
  5. package/dist/api/general-api.js +1 -1
  6. package/dist/api/general-api.js.map +1 -1
  7. package/dist/appSlice/constants.cjs +3 -4
  8. package/dist/appSlice/constants.cjs.map +1 -1
  9. package/dist/appSlice/constants.d.cts +1 -1
  10. package/dist/appSlice/constants.d.ts +1 -1
  11. package/dist/appSlice/constants.js +1 -2
  12. package/dist/appSlice/constants.js.map +1 -1
  13. package/dist/appSlice/index.d.cts +1 -1
  14. package/dist/appSlice/index.d.ts +1 -1
  15. package/dist/appSlice/index.js +1 -1
  16. package/dist/appSlice/mocks.d.cts +1 -1
  17. package/dist/appSlice/mocks.d.ts +1 -1
  18. package/dist/appSlice/selectors.cjs.map +1 -1
  19. package/dist/appSlice/selectors.d.cts +2 -130
  20. package/dist/appSlice/selectors.d.ts +2 -130
  21. package/dist/appSlice/selectors.js.map +1 -1
  22. package/dist/appSlice/thunks.d.cts +2 -2
  23. package/dist/appSlice/thunks.d.ts +2 -2
  24. package/dist/auth.cjs +3 -3
  25. package/dist/auth.cjs.map +1 -1
  26. package/dist/auth.d.cts +1 -1
  27. package/dist/auth.d.ts +1 -1
  28. package/dist/auth.js +2 -1
  29. package/dist/auth.js.map +1 -1
  30. package/dist/commonConstants.cjs +4 -3
  31. package/dist/commonConstants.d.cts +2 -2
  32. package/dist/commonConstants.d.ts +2 -2
  33. package/dist/commonConstants.js +1 -1
  34. package/dist/commonSelectors.cjs +1 -1
  35. package/dist/commonSelectors.d.cts +76 -369
  36. package/dist/commonSelectors.d.ts +76 -369
  37. package/dist/commonSelectors.js +1 -1
  38. package/dist/constants-CCkKh9KM.d.ts +109 -0
  39. package/dist/constants-CUwYPOYK.d.cts +109 -0
  40. package/dist/{constants-D5hACLhF.js → constants-DjiC_FnZ.js} +3 -269
  41. package/dist/constants-DjiC_FnZ.js.map +1 -0
  42. package/dist/{constants-MVizYy89.cjs → constants-DsOnY5o5.cjs} +1 -279
  43. package/dist/constants-DsOnY5o5.cjs.map +1 -0
  44. package/dist/{constants-nKSWZ8oD.d.ts → constants-tC3RR_Oo.d.cts} +2 -3
  45. package/dist/{constants-nKSWZ8oD.d.cts → constants-tC3RR_Oo.d.ts} +2 -3
  46. package/dist/constants.cjs +5 -5
  47. package/dist/constants.d.cts +3 -3
  48. package/dist/constants.d.ts +3 -3
  49. package/dist/constants.js +1 -1
  50. package/dist/deploymentsSlice/constants.cjs +1 -1
  51. package/dist/deploymentsSlice/constants.js +1 -1
  52. package/dist/deploymentsSlice/index.cjs +1 -1
  53. package/dist/deploymentsSlice/index.js +1 -1
  54. package/dist/deploymentsSlice/selectors.cjs +1 -1
  55. package/dist/deploymentsSlice/selectors.cjs.map +1 -1
  56. package/dist/deploymentsSlice/selectors.d.cts +2 -97
  57. package/dist/deploymentsSlice/selectors.d.ts +2 -97
  58. package/dist/deploymentsSlice/selectors.js +1 -1
  59. package/dist/deploymentsSlice/selectors.js.map +1 -1
  60. package/dist/deploymentsSlice/thunks.d.cts +4 -4
  61. package/dist/deploymentsSlice/thunks.d.ts +4 -4
  62. package/dist/devicesSlice/constants.cjs +1 -1
  63. package/dist/devicesSlice/constants.d.cts +1 -1
  64. package/dist/devicesSlice/constants.d.ts +1 -1
  65. package/dist/devicesSlice/constants.js +1 -1
  66. package/dist/devicesSlice/index.d.cts +1 -1
  67. package/dist/devicesSlice/index.d.ts +1 -1
  68. package/dist/devicesSlice/index.js +1 -1
  69. package/dist/devicesSlice/mocks.js +1 -1
  70. package/dist/devicesSlice/selectors.cjs +2 -2
  71. package/dist/devicesSlice/selectors.cjs.map +1 -1
  72. package/dist/devicesSlice/selectors.d.cts +2 -887
  73. package/dist/devicesSlice/selectors.d.ts +2 -887
  74. package/dist/devicesSlice/selectors.js +2 -2
  75. package/dist/devicesSlice/selectors.js.map +1 -1
  76. package/dist/devicesSlice/thunks.d.cts +4 -4
  77. package/dist/devicesSlice/thunks.d.ts +4 -4
  78. package/dist/{index-KxRmyFLr.d.cts → index-7jVuB4tG.d.cts} +2 -2
  79. package/dist/{index-fGVC5s1C.d.cts → index-BWtIaimn.d.cts} +2 -2
  80. package/dist/{index-BfmRpbiJ.d.cts → index-BcrZxKLw.d.cts} +2 -2
  81. package/dist/{index--SKVGToc.d.ts → index-C1vNDCYR.d.ts} +2 -2
  82. package/dist/{index-CRqnH_go.d.ts → index-C2za83Qs.d.ts} +2 -2
  83. package/dist/{index-xxqlerg5.d.ts → index-CThE5Gfh.d.ts} +2 -2
  84. package/dist/{index-BKU1G9-x.d.cts → index-CaNZaXie.d.cts} +2 -2
  85. package/dist/{index-BVNS-Aut.d.ts → index-CvMpbsOo.d.ts} +2 -2
  86. package/dist/{index-HjOSTTGF.d.cts → index-CzQRHJ6f.d.cts} +2 -2
  87. package/dist/{index-CqhXqGLt.d.cts → index-DNYeo7wc.d.cts} +2 -2
  88. package/dist/{index-D9GJhX1I.d.ts → index-DOPRnlaC.d.ts} +2 -2
  89. package/dist/{index-BMsafOyJ.d.ts → index-o_m7WKiR.d.ts} +2 -2
  90. package/dist/locationutils.cjs +1 -1
  91. package/dist/locationutils.d.cts +2 -2
  92. package/dist/locationutils.d.ts +2 -2
  93. package/dist/locationutils.js +1 -1
  94. package/dist/mockState.cjs +24 -0
  95. package/dist/mockState.cjs.map +1 -0
  96. package/dist/mockState.d.cts +7 -0
  97. package/dist/mockState.d.ts +7 -0
  98. package/dist/mockState.js +23 -0
  99. package/dist/mockState.js.map +1 -0
  100. package/dist/monitorSlice/constants.d.cts +1 -1
  101. package/dist/monitorSlice/constants.d.ts +1 -1
  102. package/dist/monitorSlice/index.d.cts +1 -1
  103. package/dist/monitorSlice/index.d.ts +1 -1
  104. package/dist/monitorSlice/index.js +1 -1
  105. package/dist/monitorSlice/mocks.d.cts +1 -1
  106. package/dist/monitorSlice/mocks.d.ts +1 -1
  107. package/dist/monitorSlice/mocks.js +1 -1
  108. package/dist/monitorSlice/selectors.cjs.map +1 -1
  109. package/dist/monitorSlice/selectors.d.cts +2 -10
  110. package/dist/monitorSlice/selectors.d.ts +2 -10
  111. package/dist/monitorSlice/selectors.js.map +1 -1
  112. package/dist/monitorSlice/thunks.cjs +2 -3
  113. package/dist/monitorSlice/thunks.cjs.map +1 -1
  114. package/dist/monitorSlice/thunks.d.cts +4 -4
  115. package/dist/monitorSlice/thunks.d.ts +4 -4
  116. package/dist/monitorSlice/thunks.js +3 -2
  117. package/dist/monitorSlice/thunks.js.map +1 -1
  118. package/dist/onboardingSlice/selectors.cjs.map +1 -1
  119. package/dist/onboardingSlice/selectors.d.cts +2 -6
  120. package/dist/onboardingSlice/selectors.d.ts +2 -6
  121. package/dist/onboardingSlice/selectors.js.map +1 -1
  122. package/dist/onboardingSlice/thunks.d.cts +3 -3
  123. package/dist/onboardingSlice/thunks.d.ts +3 -3
  124. package/dist/organizationSlice/constants.cjs +1 -1
  125. package/dist/organizationSlice/constants.js +1 -1
  126. package/dist/organizationSlice/index.cjs +1 -1
  127. package/dist/organizationSlice/index.d.cts +1 -1
  128. package/dist/organizationSlice/index.d.ts +1 -1
  129. package/dist/organizationSlice/index.js +1 -1
  130. package/dist/organizationSlice/mocks.d.cts +3 -3
  131. package/dist/organizationSlice/mocks.d.ts +3 -3
  132. package/dist/organizationSlice/mocks.js +1 -1
  133. package/dist/organizationSlice/selectors.cjs +1 -1
  134. package/dist/organizationSlice/selectors.cjs.map +1 -1
  135. package/dist/organizationSlice/selectors.d.cts +2 -472
  136. package/dist/organizationSlice/selectors.d.ts +2 -472
  137. package/dist/organizationSlice/selectors.js +1 -1
  138. package/dist/organizationSlice/selectors.js.map +1 -1
  139. package/dist/organizationSlice/thunks.d.cts +25 -21
  140. package/dist/organizationSlice/thunks.d.ts +25 -21
  141. package/dist/organizationSlice/types.d.cts +1 -1
  142. package/dist/organizationSlice/types.d.ts +1 -1
  143. package/dist/releasesSlice/index.d.cts +1 -1
  144. package/dist/releasesSlice/index.d.ts +1 -1
  145. package/dist/releasesSlice/index.js +1 -1
  146. package/dist/releasesSlice/mocks.js +1 -1
  147. package/dist/releasesSlice/selectors.cjs.map +1 -1
  148. package/dist/releasesSlice/selectors.d.cts +2 -795
  149. package/dist/releasesSlice/selectors.d.ts +2 -795
  150. package/dist/releasesSlice/selectors.js.map +1 -1
  151. package/dist/releasesSlice/thunks.cjs +17 -17
  152. package/dist/releasesSlice/thunks.cjs.map +1 -1
  153. package/dist/releasesSlice/thunks.d.cts +5 -5
  154. package/dist/releasesSlice/thunks.d.ts +5 -5
  155. package/dist/releasesSlice/thunks.js +2 -1
  156. package/dist/releasesSlice/thunks.js.map +1 -1
  157. package/dist/selectors-1394DVvN.d.ts +712 -0
  158. package/dist/selectors-Ba9LUr_0.d.ts +593 -0
  159. package/dist/selectors-CAo0fzIZ.d.ts +99 -0
  160. package/dist/selectors-CH-yXu-7.d.cts +84 -0
  161. package/dist/selectors-CQYkG1VI.d.cts +9 -0
  162. package/dist/selectors-D9t4It2i.d.ts +84 -0
  163. package/dist/selectors-DDsFLtxz.d.cts +712 -0
  164. package/dist/selectors-DFSv4A_m.d.ts +378 -0
  165. package/dist/selectors-DQKg681M.d.ts +363 -0
  166. package/dist/selectors-DeqP_VLU.d.cts +593 -0
  167. package/dist/selectors-LhR8TyWU.d.cts +378 -0
  168. package/dist/selectors-XzNyGFJI.d.cts +99 -0
  169. package/dist/selectors-aLOjKkxN.d.cts +14 -0
  170. package/dist/selectors-elCimAHX.d.ts +9 -0
  171. package/dist/selectors-jusUdUdc.d.cts +363 -0
  172. package/dist/selectors-vk0GUGHf.d.ts +14 -0
  173. package/dist/selectors.d.cts +9 -9
  174. package/dist/selectors.d.ts +9 -9
  175. package/dist/sockethook.cjs +4 -4
  176. package/dist/sockethook.cjs.map +1 -1
  177. package/dist/sockethook.js +2 -1
  178. package/dist/sockethook.js.map +1 -1
  179. package/dist/{store-Dw8Uo_Df.d.cts → store-CCvk8X-k.d.cts} +14 -33
  180. package/dist/{store-DLp6ajT8.d.ts → store-v5V-bbB_.d.ts} +15 -34
  181. package/dist/store.cjs +2 -4
  182. package/dist/store.cjs.map +1 -1
  183. package/dist/store.d.cts +2 -2
  184. package/dist/store.d.ts +2 -2
  185. package/dist/store.js +2 -4
  186. package/dist/store.js.map +1 -1
  187. package/dist/thunks.cjs +30 -38
  188. package/dist/thunks.cjs.map +1 -1
  189. package/dist/thunks.js +10 -17
  190. package/dist/thunks.js.map +1 -1
  191. package/dist/{types-DY0J79yF.d.ts → types-B2gphGj8.d.ts} +3 -3
  192. package/dist/{types-B67YW1jV.d.cts → types-CLASWtVP.d.cts} +3 -3
  193. package/dist/usersSlice/constants.cjs +1 -1
  194. package/dist/usersSlice/constants.js +1 -1
  195. package/dist/usersSlice/index.cjs +1 -1
  196. package/dist/usersSlice/index.d.cts +1 -1
  197. package/dist/usersSlice/index.d.ts +1 -1
  198. package/dist/usersSlice/index.js +1 -1
  199. package/dist/usersSlice/mocks.d.cts +1 -1
  200. package/dist/usersSlice/mocks.d.ts +1 -1
  201. package/dist/usersSlice/mocks.js +1 -1
  202. package/dist/usersSlice/selectors.cjs +3 -3
  203. package/dist/usersSlice/selectors.cjs.map +1 -1
  204. package/dist/usersSlice/selectors.d.cts +2 -466
  205. package/dist/usersSlice/selectors.d.ts +2 -466
  206. package/dist/usersSlice/selectors.js +2 -2
  207. package/dist/usersSlice/selectors.js.map +1 -1
  208. package/dist/usersSlice/thunks.d.cts +88 -88
  209. package/dist/usersSlice/thunks.d.ts +88 -88
  210. package/dist/utils.cjs +5 -10
  211. package/dist/utils.cjs.map +1 -1
  212. package/dist/utils.d.cts +1 -1
  213. package/dist/utils.d.ts +1 -1
  214. package/dist/utils.js +4 -8
  215. package/dist/utils.js.map +1 -1
  216. package/package.json +1 -1
  217. package/dist/constants-BJuY-ODE.d.ts +0 -124
  218. package/dist/constants-C2O55iZu.d.cts +0 -124
  219. package/dist/constants-D5hACLhF.js.map +0 -1
  220. package/dist/constants-MVizYy89.cjs.map +0 -1
  221. package/dist/storehooks.cjs +0 -249
  222. package/dist/storehooks.cjs.map +0 -1
  223. package/dist/storehooks.d.cts +0 -49
  224. package/dist/storehooks.d.ts +0 -49
  225. package/dist/storehooks.js +0 -241
  226. package/dist/storehooks.js.map +0 -1
@@ -1,17 +1,18 @@
1
- import { Ct as FilterOperator, H as emptyUiPermissions, S as Role, m as DeviceIssueOptionKey } from "./constants-C2O55iZu.cjs";
2
- import { o as UserSliceType } from "./index-CqhXqGLt.cjs";
3
- import { a as ReleaseSliceType } from "./index-fGVC5s1C.cjs";
4
- import { a as PricePreview } from "./types-B67YW1jV.cjs";
1
+ import { H as emptyUiPermissions, S as Role, m as DeviceIssueOptionKey, wt as FilterOperator } from "./constants-CUwYPOYK.cjs";
2
+ import { o as UserSliceType } from "./index-DNYeo7wc.cjs";
3
+ import { a as ReleaseSliceType } from "./index-BWtIaimn.cjs";
4
+ import { a as PricePreview } from "./types-CLASWtVP.cjs";
5
5
  import { n as OnboardingSliceType } from "./index-CoObjWL4.cjs";
6
6
  import { o as DeploymentsSliceType, t as Deployment } from "./index-mvxjivTJ.cjs";
7
- import { c as DeviceSliceType, i as DeviceGroup, r as DeviceFilter, u as InventoryAttributes } from "./index-KxRmyFLr.cjs";
8
- import { t as AppSliceType } from "./index-BKU1G9-x.cjs";
9
- import { t as MonitorSliceType } from "./index-BfmRpbiJ.cjs";
10
- import { t as OrganizationSliceType } from "./index-HjOSTTGF.cjs";
7
+ import { c as DeviceSliceType, i as DeviceGroup, r as DeviceFilter, u as InventoryAttributes } from "./index-7jVuB4tG.cjs";
8
+ import { t as AppSliceType } from "./index-CaNZaXie.cjs";
9
+ import { t as MonitorSliceType } from "./index-BcrZxKLw.cjs";
10
+ import { t as OrganizationSliceType } from "./index-CzQRHJ6f.cjs";
11
11
  import { AttributeFilterPredicate, AttributeResponse, FilterV2, InvoiceLineItem, Scope } from "@northern.tech/types/MenderTypes";
12
12
  import { Reducer, UnknownAction } from "@reduxjs/toolkit";
13
13
  import { AxiosError } from "axios";
14
14
  import { TypedUseSelectorHook } from "react-redux";
15
+ import { isDarkMode } from "@northern.tech/utils/helpers";
15
16
  //#region src/utils.d.ts
16
17
  type FilterProcessorValue = string | string[] | number | boolean;
17
18
  type FilterTerm = {
@@ -89,7 +90,6 @@ type DeviceAttributeMap = {
89
90
  tags: Record<string, string>;
90
91
  };
91
92
  declare const mapDeviceAttributes: (attributes?: AttributeResponse[]) => DeviceAttributeMap;
92
- declare const isDarkMode: (mode: string) => boolean;
93
93
  type Line = InvoiceLineItem & {
94
94
  product: 'mender_standard' | 'mender_micro';
95
95
  };
@@ -105,6 +105,7 @@ declare const dispatchDelayed: ({ action, delay, dispatch }: {
105
105
  }) => number;
106
106
  //#endregion
107
107
  //#region src/store.d.ts
108
+ declare const resetEnvironment: () => void;
108
109
  type MenderEnvironment = {
109
110
  [key: string]: unknown;
110
111
  demoArtifactPort?: string | number;
@@ -172,28 +173,8 @@ declare const getConfiguredStore: (options?: {
172
173
  users: UserSliceType;
173
174
  }, undefined, UnknownAction>;
174
175
  }>, import("redux").StoreEnhancer]>>;
175
- declare const store: import("@reduxjs/toolkit").EnhancedStore<{
176
- app: AppSliceType;
177
- devices: DeviceSliceType;
178
- deployments: DeploymentsSliceType;
179
- monitor: MonitorSliceType;
180
- onboarding: OnboardingSliceType;
181
- organization: OrganizationSliceType;
182
- releases: ReleaseSliceType;
183
- users: UserSliceType;
184
- }, UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
185
- dispatch: import("redux-thunk").ThunkDispatch<{
186
- app: AppSliceType;
187
- devices: DeviceSliceType;
188
- deployments: DeploymentsSliceType;
189
- monitor: MonitorSliceType;
190
- onboarding: OnboardingSliceType;
191
- organization: OrganizationSliceType;
192
- releases: ReleaseSliceType;
193
- users: UserSliceType;
194
- }, undefined, UnknownAction>;
195
- }>, import("redux").StoreEnhancer]>>;
196
- type AppDispatch = typeof store.dispatch;
176
+ type AppStore = ReturnType<typeof getConfiguredStore>;
177
+ type AppDispatch = AppStore['dispatch'];
197
178
  type RootState = ReturnType<typeof rootReducer>;
198
179
  declare const useAppDispatch: () => AppDispatch;
199
180
  declare const useAppSelector: TypedUseSelectorHook<RootState>;
@@ -320,5 +301,5 @@ declare const createAppAsyncThunk: import("@reduxjs/toolkit").CreateAsyncThunkFu
320
301
  };
321
302
  };
322
303
  //#endregion
323
- export { mapTermsToFilters as A, getDeploymentState as C, listItemMapper as D, isDarkMode as E, statCollector as F, stringToBoolean as I, stripOrchestratorManifestPrefix as L, mergePermissions as M, parseSubscriptionPreview as N, mapDeviceAttributes as O, progress as P, stripUndefined as R, getAttributeScopeLabel as S, groupDeploymentStats as T, dispatchDelayed as _, commonErrorHandler as a, filtersFilter as b, sessionReducer as c, useAppSelector as d, DeploymentStats as f, convertToBackendSPLimits as g, convertDeviceListStateToFilters as h, commonErrorFallback as i, mapUserRolesToUiPermissions as j, mapFiltersToTerms as k, store as l, FilterTerm as m, MenderEnvironment as n, createAppAsyncThunk as o, ErrorWithResponse as p, RootState as r, getConfiguredStore as s, AppDispatch as t, useAppDispatch as u, ensureVersionString as v, groupDeploymentDevicesStats as w, generateDeploymentGroupDetails as x, extractErrorMessage as y };
324
- //# sourceMappingURL=store-Dw8Uo_Df.d.cts.map
304
+ export { mapFiltersToTerms as A, getAttributeScopeLabel as C, isDarkMode as D, groupDeploymentStats as E, progress as F, statCollector as I, stringToBoolean as L, mapUserRolesToUiPermissions as M, mergePermissions as N, listItemMapper as O, parseSubscriptionPreview as P, stripOrchestratorManifestPrefix as R, generateDeploymentGroupDetails as S, groupDeploymentDevicesStats as T, convertToBackendSPLimits as _, commonErrorFallback as a, extractErrorMessage as b, getConfiguredStore as c, useAppDispatch as d, useAppSelector as f, convertDeviceListStateToFilters as g, FilterTerm as h, RootState as i, mapTermsToFilters as j, mapDeviceAttributes as k, resetEnvironment as l, ErrorWithResponse as m, AppStore as n, commonErrorHandler as o, DeploymentStats as p, MenderEnvironment as r, createAppAsyncThunk as s, AppDispatch as t, sessionReducer as u, dispatchDelayed as v, getDeploymentState as w, filtersFilter as x, ensureVersionString as y, stripUndefined as z };
305
+ //# sourceMappingURL=store-CCvk8X-k.d.cts.map
@@ -1,14 +1,15 @@
1
- import { Ct as FilterOperator, H as emptyUiPermissions, S as Role, m as DeviceIssueOptionKey } from "./constants-BJuY-ODE.js";
2
- import { o as UserSliceType } from "./index--SKVGToc.js";
3
- import { a as ReleaseSliceType } from "./index-BMsafOyJ.js";
4
- import { a as PricePreview } from "./types-DY0J79yF.js";
1
+ import { H as emptyUiPermissions, S as Role, m as DeviceIssueOptionKey, wt as FilterOperator } from "./constants-CCkKh9KM.js";
2
+ import { o as UserSliceType } from "./index-C1vNDCYR.js";
3
+ import { a as ReleaseSliceType } from "./index-o_m7WKiR.js";
4
+ import { a as PricePreview } from "./types-B2gphGj8.js";
5
5
  import { n as OnboardingSliceType } from "./index-CoObjWL4.js";
6
6
  import { o as DeploymentsSliceType, t as Deployment } from "./index-B8td4-rY.js";
7
- import { c as DeviceSliceType, i as DeviceGroup, r as DeviceFilter, u as InventoryAttributes } from "./index-D9GJhX1I.js";
8
- import { t as AppSliceType } from "./index-xxqlerg5.js";
9
- import { t as MonitorSliceType } from "./index-CRqnH_go.js";
10
- import { t as OrganizationSliceType } from "./index-BVNS-Aut.js";
7
+ import { c as DeviceSliceType, i as DeviceGroup, r as DeviceFilter, u as InventoryAttributes } from "./index-DOPRnlaC.js";
8
+ import { t as AppSliceType } from "./index-CThE5Gfh.js";
9
+ import { t as MonitorSliceType } from "./index-C2za83Qs.js";
10
+ import { t as OrganizationSliceType } from "./index-CvMpbsOo.js";
11
11
  import { Reducer, UnknownAction } from "@reduxjs/toolkit";
12
+ import { isDarkMode as isDarkMode$1 } from "@northern.tech/utils/helpers";
12
13
  import { TypedUseSelectorHook } from "react-redux";
13
14
  import { AxiosError } from "axios";
14
15
  import { AttributeFilterPredicate, AttributeResponse, FilterV2, InvoiceLineItem, Scope } from "@northern.tech/types/MenderTypes";
@@ -60,7 +61,7 @@ type ErrorWithResponse = AxiosError<{
60
61
  }> & {
61
62
  error?: string;
62
63
  };
63
- declare const extractErrorMessage: (err: ErrorWithResponse, fallback?: string) => string;
64
+ declare const extractErrorMessage$1: (err: ErrorWithResponse, fallback?: string) => string;
64
65
  declare const ensureVersionString: (software: string, fallback: string) => string;
65
66
  declare const stringToBoolean: (content: string | number | undefined) => boolean;
66
67
  type DeploymentStats = {
@@ -89,7 +90,6 @@ type DeviceAttributeMap = {
89
90
  tags: Record<string, string>;
90
91
  };
91
92
  declare const mapDeviceAttributes: (attributes?: AttributeResponse[]) => DeviceAttributeMap;
92
- declare const isDarkMode: (mode: string) => boolean;
93
93
  type Line = InvoiceLineItem & {
94
94
  product: 'mender_standard' | 'mender_micro';
95
95
  };
@@ -105,6 +105,7 @@ declare const dispatchDelayed: ({ action, delay, dispatch }: {
105
105
  }) => number;
106
106
  //#endregion
107
107
  //#region src/store.d.ts
108
+ declare const resetEnvironment: () => void;
108
109
  type MenderEnvironment = {
109
110
  [key: string]: unknown;
110
111
  demoArtifactPort?: string | number;
@@ -172,28 +173,8 @@ declare const getConfiguredStore: (options?: {
172
173
  users: UserSliceType;
173
174
  }, undefined, UnknownAction>;
174
175
  }>, import("redux").StoreEnhancer]>>;
175
- declare const store: import("@reduxjs/toolkit").EnhancedStore<{
176
- app: AppSliceType;
177
- devices: DeviceSliceType;
178
- deployments: DeploymentsSliceType;
179
- monitor: MonitorSliceType;
180
- onboarding: OnboardingSliceType;
181
- organization: OrganizationSliceType;
182
- releases: ReleaseSliceType;
183
- users: UserSliceType;
184
- }, UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
185
- dispatch: import("redux-thunk").ThunkDispatch<{
186
- app: AppSliceType;
187
- devices: DeviceSliceType;
188
- deployments: DeploymentsSliceType;
189
- monitor: MonitorSliceType;
190
- onboarding: OnboardingSliceType;
191
- organization: OrganizationSliceType;
192
- releases: ReleaseSliceType;
193
- users: UserSliceType;
194
- }, undefined, UnknownAction>;
195
- }>, import("redux").StoreEnhancer]>>;
196
- type AppDispatch = typeof store.dispatch;
176
+ type AppStore = ReturnType<typeof getConfiguredStore>;
177
+ type AppDispatch = AppStore['dispatch'];
197
178
  type RootState = ReturnType<typeof rootReducer>;
198
179
  declare const useAppDispatch: () => AppDispatch;
199
180
  declare const useAppSelector: TypedUseSelectorHook<RootState>;
@@ -320,5 +301,5 @@ declare const createAppAsyncThunk: import("@reduxjs/toolkit").CreateAsyncThunkFu
320
301
  };
321
302
  };
322
303
  //#endregion
323
- export { mapTermsToFilters as A, getDeploymentState as C, listItemMapper as D, isDarkMode as E, statCollector as F, stringToBoolean as I, stripOrchestratorManifestPrefix as L, mergePermissions as M, parseSubscriptionPreview as N, mapDeviceAttributes as O, progress as P, stripUndefined as R, getAttributeScopeLabel as S, groupDeploymentStats as T, dispatchDelayed as _, commonErrorHandler as a, filtersFilter as b, sessionReducer as c, useAppSelector as d, DeploymentStats as f, convertToBackendSPLimits as g, convertDeviceListStateToFilters as h, commonErrorFallback as i, mapUserRolesToUiPermissions as j, mapFiltersToTerms as k, store as l, FilterTerm as m, MenderEnvironment as n, createAppAsyncThunk as o, ErrorWithResponse as p, RootState as r, getConfiguredStore as s, AppDispatch as t, useAppDispatch as u, ensureVersionString as v, groupDeploymentDevicesStats as w, generateDeploymentGroupDetails as x, extractErrorMessage as y };
324
- //# sourceMappingURL=store-DLp6ajT8.d.ts.map
304
+ export { mapFiltersToTerms as A, getAttributeScopeLabel as C, isDarkMode$1 as D, groupDeploymentStats as E, progress as F, statCollector as I, stringToBoolean as L, mapUserRolesToUiPermissions as M, mergePermissions as N, listItemMapper as O, parseSubscriptionPreview as P, stripOrchestratorManifestPrefix as R, generateDeploymentGroupDetails as S, groupDeploymentDevicesStats as T, convertToBackendSPLimits as _, commonErrorFallback as a, extractErrorMessage$1 as b, getConfiguredStore as c, useAppDispatch as d, useAppSelector as f, convertDeviceListStateToFilters as g, FilterTerm as h, RootState as i, mapTermsToFilters as j, mapDeviceAttributes as k, resetEnvironment as l, ErrorWithResponse as m, AppStore as n, commonErrorHandler as o, DeploymentStats as p, MenderEnvironment as r, createAppAsyncThunk as s, AppDispatch as t, sessionReducer as u, dispatchDelayed as v, getDeploymentState as w, filtersFilter as x, ensureVersionString as y, stripUndefined as z };
305
+ //# sourceMappingURL=store-v5V-bbB_.d.ts.map
package/dist/store.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_constants = require("./constants-MVizYy89.cjs");
2
+ const require_constants = require("./constants-DsOnY5o5.cjs");
3
3
  const require_appSlice_index = require("./appSlice/index.cjs");
4
4
  const require_deploymentsSlice_index = require("./deploymentsSlice/index.cjs");
5
5
  const require_devicesSlice_index = require("./devicesSlice/index.cjs");
@@ -18,7 +18,6 @@ let _sentry_react = require("@sentry/react");
18
18
  const { setSnackbar, uploadProgress } = require_actions;
19
19
  const keys = ["sessionDeploymentChecker", require_constants.settingsKeys.initialized];
20
20
  const resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
21
- resetEnvironment();
22
21
  const commonErrorFallback = "Please check your connection.";
23
22
  const commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
24
23
  const errMsg = (0, _northern_tech_utils_helpers.extractErrorMessage)(err, fallback);
@@ -103,7 +102,6 @@ const getConfiguredStore = (options = {}) => {
103
102
  }).concat(rejectionLoggerMiddleware)
104
103
  });
105
104
  };
106
- const store = getConfiguredStore({ preloadedState: {} });
107
105
  const useAppDispatch = react_redux.useDispatch;
108
106
  const useAppSelector = react_redux.useSelector;
109
107
  const createAppAsyncThunk = _reduxjs_toolkit.createAsyncThunk.withTypes();
@@ -112,8 +110,8 @@ exports.commonErrorFallback = commonErrorFallback;
112
110
  exports.commonErrorHandler = commonErrorHandler;
113
111
  exports.createAppAsyncThunk = createAppAsyncThunk;
114
112
  exports.getConfiguredStore = getConfiguredStore;
113
+ exports.resetEnvironment = resetEnvironment;
115
114
  exports.sessionReducer = sessionReducer;
116
- exports.store = store;
117
115
  exports.useAppDispatch = useAppDispatch;
118
116
  exports.useAppSelector = useAppSelector;
119
117
 
@@ -1 +1 @@
1
- {"version":3,"file":"store.cjs","names":["actions","settingsKeys","extractErrorMessage","getToken","preformatWithRequestID","combineReducers","appSlice","deviceSlice","deploymentSlice","monitorSlice","onboardingSlice","organizationSlice","releaseSlice","userSlice","isRejected","userActions","createReduxEnhancer","configureStore","organizationActions","useDispatch","useSelector","createAsyncThunk"],"sources":["../src/store.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { useDispatch, useSelector } from 'react-redux';\nimport type { TypedUseSelectorHook } from 'react-redux';\n\nimport { extractErrorMessage, preformatWithRequestID } from '@northern.tech/utils/helpers';\nimport type { Middleware, Reducer, UnknownAction } from '@reduxjs/toolkit';\nimport { combineReducers, configureStore, createAsyncThunk, isRejected } from '@reduxjs/toolkit';\nimport { createReduxEnhancer } from '@sentry/react';\n\nimport actions from './actions';\nimport appSlice from './appSlice';\nimport { getToken } from './auth';\nimport { USER_LOGOUT, settingsKeys } from './constants';\nimport deploymentSlice from './deploymentsSlice';\nimport deviceSlice from './devicesSlice';\nimport monitorSlice from './monitorSlice';\nimport onboardingSlice from './onboardingSlice';\nimport organizationSlice, { actions as organizationActions } from './organizationSlice';\nimport releaseSlice from './releasesSlice';\nimport userSlice, { actions as userActions } from './usersSlice';\n\nconst { setSnackbar, uploadProgress } = actions;\n\n// exclude 'pendings-redirect' since this is expected to persist refreshes - the rest should be better to be redone\nconst keys = ['sessionDeploymentChecker', settingsKeys.initialized];\nconst resetEnvironment = (): void => keys.forEach(key => window.sessionStorage.removeItem(key));\n\nresetEnvironment();\n\nexport type { ErrorWithResponse } from './utils';\n\nexport type MenderEnvironment = {\n [key: string]: unknown;\n demoArtifactPort?: string | number;\n disableOnboarding?: string;\n features: Record<string, string>;\n sentry?: { isReduxEnabled?: string | boolean };\n version: string;\n};\n\ndeclare global {\n interface Window {\n mender_environment?: MenderEnvironment;\n }\n}\n\nexport const commonErrorFallback = 'Please check your connection.';\nexport const commonErrorHandler = (\n err: { message?: string; response?: { data?: unknown } },\n errorContext: string,\n dispatch: AppDispatch,\n fallback?: string,\n mightBeAuthRelated = false\n): Promise<never> => {\n const errMsg = extractErrorMessage(err, fallback);\n if (mightBeAuthRelated || getToken()) {\n dispatch(setSnackbar({ message: preformatWithRequestID(err.response, `${errorContext} ${errMsg}`), action: 'Copy to clipboard' }));\n }\n return Promise.reject(err);\n};\n\nconst rootReducer = combineReducers({\n app: appSlice,\n devices: deviceSlice,\n deployments: deploymentSlice,\n monitor: monitorSlice,\n onboarding: onboardingSlice,\n organization: organizationSlice,\n releases: releaseSlice,\n users: userSlice\n});\n\ntype RootReducerState = ReturnType<typeof rootReducer>;\n\nconst sessionReducerImpl: Reducer<RootReducerState | undefined, UnknownAction> = (state, action) => {\n if (action.type === USER_LOGOUT) {\n state = undefined;\n }\n return rootReducer(state, action);\n};\n// Export for testing; cast to RootReducerState since undefined always falls through to initial slice states\nexport const sessionReducer = sessionReducerImpl as Reducer<RootReducerState>;\n\nconst rejectionLoggerMiddleware: Middleware = () => next => action => {\n if (isRejected(action)) {\n console.error('Rejection in action:', action);\n if (action.error) {\n console.error(action.error.stack);\n }\n }\n return next(action);\n};\n\nconst tracingActionIgnoreList = [userActions.successfullyLoggedIn.type, 'users/loginUser/pending', 'users/loginUser/fulfilled', 'users/loginUser/rejected'];\n\nconst sentryReduxEnhancer = createReduxEnhancer({\n actionTransformer: (action: UnknownAction) => {\n if (tracingActionIgnoreList.includes(action.type as string)) {\n return null;\n }\n return action;\n },\n // Transform the state to remove sensitive information\n stateTransformer: (state: RootState) => {\n const transformedState = {\n ...state,\n users: { ...state.users, currentSession: null },\n organization: {\n ...state.organization,\n organization: {\n ...state.organization.organization,\n tenant_token: null\n }\n }\n };\n return transformedState;\n }\n});\n\nexport const getConfiguredStore = (options: { [key: string]: unknown; preloadedState?: Partial<RootReducerState> } = {}) => {\n const { preloadedState, ...config } = options;\n return configureStore({\n ...config,\n preloadedState: preloadedState as RootReducerState,\n enhancers: getDefaultEnhancers => {\n // rely on the plain injected env object, as we're initializing the store only here\n if (window.mender_environment?.sentry?.isReduxEnabled) {\n return getDefaultEnhancers().concat(sentryReduxEnhancer);\n }\n return getDefaultEnhancers();\n },\n reducer: sessionReducer,\n // @ts-expect-error - GetDefaultMiddleware type mismatch between @reduxjs/toolkit and @sentry/react\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware({\n immutableCheck: {\n ignoredPaths: ['app.uploadsById']\n },\n serializableCheck: {\n ignoredActions: [organizationActions.receiveExternalDeviceIntegrations.type, uploadProgress.type],\n ignoredActionPaths: ['uploads', /payload\\..*$/, 'meta.arg.file', 'meta.arg.integration.configHint'],\n ignoredPaths: ['app.uploadsById', 'organization.externalDeviceIntegrations']\n }\n }).concat(rejectionLoggerMiddleware)\n });\n};\nexport const store = getConfiguredStore({\n preloadedState: {}\n});\nexport type AppDispatch = typeof store.dispatch;\nexport type RootState = ReturnType<typeof rootReducer>;\nexport const useAppDispatch: () => AppDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\n\nexport const createAppAsyncThunk = createAsyncThunk.withTypes<{\n dispatch: AppDispatch;\n state: RootState;\n}>();\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAM,EAAE,aAAa,mBAAmBA;AAGxC,MAAM,OAAO,CAAC,4BAA4BC,kBAAAA,aAAa,WAAW;AAClE,MAAM,yBAA+B,KAAK,SAAQ,QAAO,OAAO,eAAe,WAAW,GAAG,CAAC;AAE9F,iBAAiB;AAmBjB,MAAa,sBAAsB;AACnC,MAAa,sBACX,KACA,cACA,UACA,UACA,qBAAqB,UACF;CACnB,MAAM,UAAA,GAASC,6BAAAA,oBAAAA,CAAoB,KAAK,QAAQ;CAChD,IAAI,sBAAsBC,aAAAA,SAAS,GACjC,SAAS,YAAY;EAAE,UAAA,GAASC,6BAAAA,uBAAAA,CAAuB,IAAI,UAAU,GAAG,aAAa,GAAG,QAAQ;EAAG,QAAQ;CAAoB,CAAC,CAAC;CAEnI,OAAO,QAAQ,OAAO,GAAG;AAC3B;AAEA,MAAM,eAAA,GAAcC,iBAAAA,gBAAAA,CAAgB;CAClC,KAAKC,uBAAAA;CACL,SAASC,2BAAAA;CACT,aAAaC,+BAAAA;CACb,SAASC,2BAAAA;CACT,YAAYC,8BAAAA;CACZ,cAAcC,gCAAAA;CACd,UAAUC,4BAAAA;CACV,OAAOC,yBAAAA;AACT,CAAC;AAID,MAAM,sBAA4E,OAAO,WAAW;CAClG,IAAI,OAAO,SAAA,eACT,QAAQ,KAAA;CAEV,OAAO,YAAY,OAAO,MAAM;AAClC;AAEA,MAAa,iBAAiB;AAE9B,MAAM,mCAA8C,UAAQ,WAAU;CACpE,KAAA,GAAIC,iBAAAA,WAAAA,CAAW,MAAM,GAAG;EACtB,QAAQ,MAAM,wBAAwB,MAAM;EAC5C,IAAI,OAAO,OACT,QAAQ,MAAM,OAAO,MAAM,KAAK;CAEpC;CACA,OAAO,KAAK,MAAM;AACpB;AAEA,MAAM,0BAA0B;CAACC,yBAAAA,QAAY,qBAAqB;CAAM;CAA2B;CAA6B;AAA0B;AAE1J,MAAM,uBAAA,GAAsBC,cAAAA,oBAAAA,CAAoB;CAC9C,oBAAoB,WAA0B;EAC5C,IAAI,wBAAwB,SAAS,OAAO,IAAc,GACxD,OAAO;EAET,OAAO;CACT;CAEA,mBAAmB,UAAqB;EAYtC,OAAO;GAVL,GAAG;GACH,OAAO;IAAE,GAAG,MAAM;IAAO,gBAAgB;GAAK;GAC9C,cAAc;IACZ,GAAG,MAAM;IACT,cAAc;KACZ,GAAG,MAAM,aAAa;KACtB,cAAc;IAChB;GACF;EAEoB;CACxB;AACF,CAAC;AAED,MAAa,sBAAsB,UAAkF,CAAC,MAAM;CAC1H,MAAM,EAAE,gBAAgB,GAAG,WAAW;CACtC,QAAA,GAAOC,iBAAAA,eAAAA,CAAe;EACpB,GAAG;EACa;EAChB,YAAW,wBAAuB;GAEhC,IAAI,OAAO,oBAAoB,QAAQ,gBACrC,OAAO,oBAAoB,CAAC,CAAC,OAAO,mBAAmB;GAEzD,OAAO,oBAAoB;EAC7B;EACA,SAAS;EAET,aAAY,yBACV,qBAAqB;GACnB,gBAAgB,EACd,cAAc,CAAC,iBAAiB,EAClC;GACA,mBAAmB;IACjB,gBAAgB,CAACC,gCAAAA,QAAoB,kCAAkC,MAAM,eAAe,IAAI;IAChG,oBAAoB;KAAC;KAAW;KAAgB;KAAiB;IAAiC;IAClG,cAAc,CAAC,mBAAmB,yCAAyC;GAC7E;EACF,CAAC,CAAC,CAAC,OAAO,yBAAyB;CACvC,CAAC;AACH;AACA,MAAa,QAAQ,mBAAmB,EACtC,gBAAgB,CAAC,EACnB,CAAC;AAGD,MAAa,iBAAoCC,YAAAA;AACjD,MAAa,iBAAkDC,YAAAA;AAE/D,MAAa,sBAAsBC,iBAAAA,iBAAiB,UAGjD"}
1
+ {"version":3,"file":"store.cjs","names":["actions","settingsKeys","extractErrorMessage","getToken","preformatWithRequestID","combineReducers","appSlice","deviceSlice","deploymentSlice","monitorSlice","onboardingSlice","organizationSlice","releaseSlice","userSlice","isRejected","userActions","createReduxEnhancer","configureStore","organizationActions","useDispatch","useSelector","createAsyncThunk"],"sources":["../src/store.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { useDispatch, useSelector } from 'react-redux';\nimport type { TypedUseSelectorHook } from 'react-redux';\n\nimport { extractErrorMessage, preformatWithRequestID } from '@northern.tech/utils/helpers';\nimport type { Middleware, Reducer, UnknownAction } from '@reduxjs/toolkit';\nimport { combineReducers, configureStore, createAsyncThunk, isRejected } from '@reduxjs/toolkit';\nimport { createReduxEnhancer } from '@sentry/react';\n\nimport actions from './actions';\nimport appSlice from './appSlice';\nimport { getToken } from './auth';\nimport { USER_LOGOUT, settingsKeys } from './constants';\nimport deploymentSlice from './deploymentsSlice';\nimport deviceSlice from './devicesSlice';\nimport monitorSlice from './monitorSlice';\nimport onboardingSlice from './onboardingSlice';\nimport organizationSlice, { actions as organizationActions } from './organizationSlice';\nimport releaseSlice from './releasesSlice';\nimport userSlice, { actions as userActions } from './usersSlice';\n\nconst { setSnackbar, uploadProgress } = actions;\n\n// exclude 'pendings-redirect' since this is expected to persist refreshes - the rest should be better to be redone\nconst keys = ['sessionDeploymentChecker', settingsKeys.initialized];\nexport const resetEnvironment = (): void => keys.forEach(key => window.sessionStorage.removeItem(key));\n\nexport type { ErrorWithResponse } from './utils';\n\nexport type MenderEnvironment = {\n [key: string]: unknown;\n demoArtifactPort?: string | number;\n disableOnboarding?: string;\n features: Record<string, string>;\n sentry?: { isReduxEnabled?: string | boolean };\n version: string;\n};\n\ndeclare global {\n interface Window {\n mender_environment?: MenderEnvironment;\n }\n}\n\nexport const commonErrorFallback = 'Please check your connection.';\nexport const commonErrorHandler = (\n err: { message?: string; response?: { data?: unknown } },\n errorContext: string,\n dispatch: AppDispatch,\n fallback?: string,\n mightBeAuthRelated = false\n): Promise<never> => {\n const errMsg = extractErrorMessage(err, fallback);\n if (mightBeAuthRelated || getToken()) {\n dispatch(setSnackbar({ message: preformatWithRequestID(err.response, `${errorContext} ${errMsg}`), action: 'Copy to clipboard' }));\n }\n return Promise.reject(err);\n};\n\nconst rootReducer = combineReducers({\n app: appSlice,\n devices: deviceSlice,\n deployments: deploymentSlice,\n monitor: monitorSlice,\n onboarding: onboardingSlice,\n organization: organizationSlice,\n releases: releaseSlice,\n users: userSlice\n});\n\ntype RootReducerState = ReturnType<typeof rootReducer>;\n\nconst sessionReducerImpl: Reducer<RootReducerState | undefined, UnknownAction> = (state, action) => {\n if (action.type === USER_LOGOUT) {\n state = undefined;\n }\n return rootReducer(state, action);\n};\n// Export for testing; cast to RootReducerState since undefined always falls through to initial slice states\nexport const sessionReducer = sessionReducerImpl as Reducer<RootReducerState>;\n\nconst rejectionLoggerMiddleware: Middleware = () => next => action => {\n if (isRejected(action)) {\n console.error('Rejection in action:', action);\n if (action.error) {\n console.error(action.error.stack);\n }\n }\n return next(action);\n};\n\nconst tracingActionIgnoreList = [userActions.successfullyLoggedIn.type, 'users/loginUser/pending', 'users/loginUser/fulfilled', 'users/loginUser/rejected'];\n\nconst sentryReduxEnhancer = createReduxEnhancer({\n actionTransformer: (action: UnknownAction) => {\n if (tracingActionIgnoreList.includes(action.type as string)) {\n return null;\n }\n return action;\n },\n // Transform the state to remove sensitive information\n stateTransformer: (state: RootState) => {\n const transformedState = {\n ...state,\n users: { ...state.users, currentSession: null },\n organization: {\n ...state.organization,\n organization: {\n ...state.organization.organization,\n tenant_token: null\n }\n }\n };\n return transformedState;\n }\n});\n\nexport const getConfiguredStore = (options: { [key: string]: unknown; preloadedState?: Partial<RootReducerState> } = {}) => {\n const { preloadedState, ...config } = options;\n return configureStore({\n ...config,\n preloadedState: preloadedState as RootReducerState,\n enhancers: getDefaultEnhancers => {\n // rely on the plain injected env object, as we're initializing the store only here\n if (window.mender_environment?.sentry?.isReduxEnabled) {\n return getDefaultEnhancers().concat(sentryReduxEnhancer);\n }\n return getDefaultEnhancers();\n },\n reducer: sessionReducer,\n // @ts-expect-error - GetDefaultMiddleware type mismatch between @reduxjs/toolkit and @sentry/react\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware({\n immutableCheck: {\n ignoredPaths: ['app.uploadsById']\n },\n serializableCheck: {\n ignoredActions: [organizationActions.receiveExternalDeviceIntegrations.type, uploadProgress.type],\n ignoredActionPaths: ['uploads', /payload\\..*$/, 'meta.arg.file', 'meta.arg.integration.configHint'],\n ignoredPaths: ['app.uploadsById', 'organization.externalDeviceIntegrations']\n }\n }).concat(rejectionLoggerMiddleware)\n });\n};\nexport type AppStore = ReturnType<typeof getConfiguredStore>;\nexport type AppDispatch = AppStore['dispatch'];\nexport type RootState = ReturnType<typeof rootReducer>;\nexport const useAppDispatch: () => AppDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\n\nexport const createAppAsyncThunk = createAsyncThunk.withTypes<{\n dispatch: AppDispatch;\n state: RootState;\n}>();\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAM,EAAE,aAAa,mBAAmBA;AAGxC,MAAM,OAAO,CAAC,4BAA4BC,kBAAAA,aAAa,WAAW;AAClE,MAAa,yBAA+B,KAAK,SAAQ,QAAO,OAAO,eAAe,WAAW,GAAG,CAAC;AAmBrG,MAAa,sBAAsB;AACnC,MAAa,sBACX,KACA,cACA,UACA,UACA,qBAAqB,UACF;CACnB,MAAM,UAAA,GAASC,6BAAAA,oBAAAA,CAAoB,KAAK,QAAQ;CAChD,IAAI,sBAAsBC,aAAAA,SAAS,GACjC,SAAS,YAAY;EAAE,UAAA,GAASC,6BAAAA,uBAAAA,CAAuB,IAAI,UAAU,GAAG,aAAa,GAAG,QAAQ;EAAG,QAAQ;CAAoB,CAAC,CAAC;CAEnI,OAAO,QAAQ,OAAO,GAAG;AAC3B;AAEA,MAAM,eAAA,GAAcC,iBAAAA,gBAAAA,CAAgB;CAClC,KAAKC,uBAAAA;CACL,SAASC,2BAAAA;CACT,aAAaC,+BAAAA;CACb,SAASC,2BAAAA;CACT,YAAYC,8BAAAA;CACZ,cAAcC,gCAAAA;CACd,UAAUC,4BAAAA;CACV,OAAOC,yBAAAA;AACT,CAAC;AAID,MAAM,sBAA4E,OAAO,WAAW;CAClG,IAAI,OAAO,SAAA,eACT,QAAQ,KAAA;CAEV,OAAO,YAAY,OAAO,MAAM;AAClC;AAEA,MAAa,iBAAiB;AAE9B,MAAM,mCAA8C,UAAQ,WAAU;CACpE,KAAA,GAAIC,iBAAAA,WAAAA,CAAW,MAAM,GAAG;EACtB,QAAQ,MAAM,wBAAwB,MAAM;EAC5C,IAAI,OAAO,OACT,QAAQ,MAAM,OAAO,MAAM,KAAK;CAEpC;CACA,OAAO,KAAK,MAAM;AACpB;AAEA,MAAM,0BAA0B;CAACC,yBAAAA,QAAY,qBAAqB;CAAM;CAA2B;CAA6B;AAA0B;AAE1J,MAAM,uBAAA,GAAsBC,cAAAA,oBAAAA,CAAoB;CAC9C,oBAAoB,WAA0B;EAC5C,IAAI,wBAAwB,SAAS,OAAO,IAAc,GACxD,OAAO;EAET,OAAO;CACT;CAEA,mBAAmB,UAAqB;EAYtC,OAAO;GAVL,GAAG;GACH,OAAO;IAAE,GAAG,MAAM;IAAO,gBAAgB;GAAK;GAC9C,cAAc;IACZ,GAAG,MAAM;IACT,cAAc;KACZ,GAAG,MAAM,aAAa;KACtB,cAAc;IAChB;GACF;EAEoB;CACxB;AACF,CAAC;AAED,MAAa,sBAAsB,UAAkF,CAAC,MAAM;CAC1H,MAAM,EAAE,gBAAgB,GAAG,WAAW;CACtC,QAAA,GAAOC,iBAAAA,eAAAA,CAAe;EACpB,GAAG;EACa;EAChB,YAAW,wBAAuB;GAEhC,IAAI,OAAO,oBAAoB,QAAQ,gBACrC,OAAO,oBAAoB,CAAC,CAAC,OAAO,mBAAmB;GAEzD,OAAO,oBAAoB;EAC7B;EACA,SAAS;EAET,aAAY,yBACV,qBAAqB;GACnB,gBAAgB,EACd,cAAc,CAAC,iBAAiB,EAClC;GACA,mBAAmB;IACjB,gBAAgB,CAACC,gCAAAA,QAAoB,kCAAkC,MAAM,eAAe,IAAI;IAChG,oBAAoB;KAAC;KAAW;KAAgB;KAAiB;IAAiC;IAClG,cAAc,CAAC,mBAAmB,yCAAyC;GAC7E;EACF,CAAC,CAAC,CAAC,OAAO,yBAAyB;CACvC,CAAC;AACH;AAIA,MAAa,iBAAoCC,YAAAA;AACjD,MAAa,iBAAkDC,YAAAA;AAE/D,MAAa,sBAAsBC,iBAAAA,iBAAiB,UAGjD"}
package/dist/store.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as commonErrorHandler, c as sessionReducer, d as useAppSelector, i as commonErrorFallback, l as store, n as MenderEnvironment, o as createAppAsyncThunk, p as ErrorWithResponse, r as RootState, s as getConfiguredStore, t as AppDispatch, u as useAppDispatch } from "./store-Dw8Uo_Df.cjs";
2
- export { AppDispatch, type ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
1
+ import { a as commonErrorFallback, c as getConfiguredStore, d as useAppDispatch, f as useAppSelector, i as RootState, l as resetEnvironment, m as ErrorWithResponse, n as AppStore, o as commonErrorHandler, r as MenderEnvironment, s as createAppAsyncThunk, t as AppDispatch, u as sessionReducer } from "./store-CCvk8X-k.cjs";
2
+ export { AppDispatch, AppStore, type ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, resetEnvironment, sessionReducer, useAppDispatch, useAppSelector };
package/dist/store.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as commonErrorHandler, c as sessionReducer, d as useAppSelector, i as commonErrorFallback, l as store, n as MenderEnvironment, o as createAppAsyncThunk, p as ErrorWithResponse, r as RootState, s as getConfiguredStore, t as AppDispatch, u as useAppDispatch } from "./store-DLp6ajT8.js";
2
- export { AppDispatch, type ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
1
+ import { a as commonErrorFallback, c as getConfiguredStore, d as useAppDispatch, f as useAppSelector, i as RootState, l as resetEnvironment, m as ErrorWithResponse, n as AppStore, o as commonErrorHandler, r as MenderEnvironment, s as createAppAsyncThunk, t as AppDispatch, u as sessionReducer } from "./store-v5V-bbB_.js";
2
+ export { AppDispatch, AppStore, type ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, resetEnvironment, sessionReducer, useAppDispatch, useAppSelector };
package/dist/store.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Q as settingsKeys } from "./constants-D5hACLhF.js";
1
+ import { Q as settingsKeys } from "./constants-DjiC_FnZ.js";
2
2
  import appSlice_default from "./appSlice/index.js";
3
3
  import deploymentsSlice_default from "./deploymentsSlice/index.js";
4
4
  import devicesSlice_default from "./devicesSlice/index.js";
@@ -17,7 +17,6 @@ import { createReduxEnhancer } from "@sentry/react";
17
17
  const { setSnackbar, uploadProgress } = actions_default;
18
18
  const keys = ["sessionDeploymentChecker", settingsKeys.initialized];
19
19
  const resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
20
- resetEnvironment();
21
20
  const commonErrorFallback = "Please check your connection.";
22
21
  const commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
23
22
  const errMsg = extractErrorMessage(err, fallback);
@@ -102,11 +101,10 @@ const getConfiguredStore = (options = {}) => {
102
101
  }).concat(rejectionLoggerMiddleware)
103
102
  });
104
103
  };
105
- const store = getConfiguredStore({ preloadedState: {} });
106
104
  const useAppDispatch = useDispatch;
107
105
  const useAppSelector = useSelector;
108
106
  const createAppAsyncThunk = createAsyncThunk.withTypes();
109
107
  //#endregion
110
- export { commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
108
+ export { commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, resetEnvironment, sessionReducer, useAppDispatch, useAppSelector };
111
109
 
112
110
  //# sourceMappingURL=store.js.map
package/dist/store.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","names":["actions","appSlice","deviceSlice","deploymentSlice","monitorSlice","onboardingSlice","organizationSlice","releaseSlice","userSlice","userActions","organizationActions"],"sources":["../src/store.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { useDispatch, useSelector } from 'react-redux';\nimport type { TypedUseSelectorHook } from 'react-redux';\n\nimport { extractErrorMessage, preformatWithRequestID } from '@northern.tech/utils/helpers';\nimport type { Middleware, Reducer, UnknownAction } from '@reduxjs/toolkit';\nimport { combineReducers, configureStore, createAsyncThunk, isRejected } from '@reduxjs/toolkit';\nimport { createReduxEnhancer } from '@sentry/react';\n\nimport actions from './actions';\nimport appSlice from './appSlice';\nimport { getToken } from './auth';\nimport { USER_LOGOUT, settingsKeys } from './constants';\nimport deploymentSlice from './deploymentsSlice';\nimport deviceSlice from './devicesSlice';\nimport monitorSlice from './monitorSlice';\nimport onboardingSlice from './onboardingSlice';\nimport organizationSlice, { actions as organizationActions } from './organizationSlice';\nimport releaseSlice from './releasesSlice';\nimport userSlice, { actions as userActions } from './usersSlice';\n\nconst { setSnackbar, uploadProgress } = actions;\n\n// exclude 'pendings-redirect' since this is expected to persist refreshes - the rest should be better to be redone\nconst keys = ['sessionDeploymentChecker', settingsKeys.initialized];\nconst resetEnvironment = (): void => keys.forEach(key => window.sessionStorage.removeItem(key));\n\nresetEnvironment();\n\nexport type { ErrorWithResponse } from './utils';\n\nexport type MenderEnvironment = {\n [key: string]: unknown;\n demoArtifactPort?: string | number;\n disableOnboarding?: string;\n features: Record<string, string>;\n sentry?: { isReduxEnabled?: string | boolean };\n version: string;\n};\n\ndeclare global {\n interface Window {\n mender_environment?: MenderEnvironment;\n }\n}\n\nexport const commonErrorFallback = 'Please check your connection.';\nexport const commonErrorHandler = (\n err: { message?: string; response?: { data?: unknown } },\n errorContext: string,\n dispatch: AppDispatch,\n fallback?: string,\n mightBeAuthRelated = false\n): Promise<never> => {\n const errMsg = extractErrorMessage(err, fallback);\n if (mightBeAuthRelated || getToken()) {\n dispatch(setSnackbar({ message: preformatWithRequestID(err.response, `${errorContext} ${errMsg}`), action: 'Copy to clipboard' }));\n }\n return Promise.reject(err);\n};\n\nconst rootReducer = combineReducers({\n app: appSlice,\n devices: deviceSlice,\n deployments: deploymentSlice,\n monitor: monitorSlice,\n onboarding: onboardingSlice,\n organization: organizationSlice,\n releases: releaseSlice,\n users: userSlice\n});\n\ntype RootReducerState = ReturnType<typeof rootReducer>;\n\nconst sessionReducerImpl: Reducer<RootReducerState | undefined, UnknownAction> = (state, action) => {\n if (action.type === USER_LOGOUT) {\n state = undefined;\n }\n return rootReducer(state, action);\n};\n// Export for testing; cast to RootReducerState since undefined always falls through to initial slice states\nexport const sessionReducer = sessionReducerImpl as Reducer<RootReducerState>;\n\nconst rejectionLoggerMiddleware: Middleware = () => next => action => {\n if (isRejected(action)) {\n console.error('Rejection in action:', action);\n if (action.error) {\n console.error(action.error.stack);\n }\n }\n return next(action);\n};\n\nconst tracingActionIgnoreList = [userActions.successfullyLoggedIn.type, 'users/loginUser/pending', 'users/loginUser/fulfilled', 'users/loginUser/rejected'];\n\nconst sentryReduxEnhancer = createReduxEnhancer({\n actionTransformer: (action: UnknownAction) => {\n if (tracingActionIgnoreList.includes(action.type as string)) {\n return null;\n }\n return action;\n },\n // Transform the state to remove sensitive information\n stateTransformer: (state: RootState) => {\n const transformedState = {\n ...state,\n users: { ...state.users, currentSession: null },\n organization: {\n ...state.organization,\n organization: {\n ...state.organization.organization,\n tenant_token: null\n }\n }\n };\n return transformedState;\n }\n});\n\nexport const getConfiguredStore = (options: { [key: string]: unknown; preloadedState?: Partial<RootReducerState> } = {}) => {\n const { preloadedState, ...config } = options;\n return configureStore({\n ...config,\n preloadedState: preloadedState as RootReducerState,\n enhancers: getDefaultEnhancers => {\n // rely on the plain injected env object, as we're initializing the store only here\n if (window.mender_environment?.sentry?.isReduxEnabled) {\n return getDefaultEnhancers().concat(sentryReduxEnhancer);\n }\n return getDefaultEnhancers();\n },\n reducer: sessionReducer,\n // @ts-expect-error - GetDefaultMiddleware type mismatch between @reduxjs/toolkit and @sentry/react\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware({\n immutableCheck: {\n ignoredPaths: ['app.uploadsById']\n },\n serializableCheck: {\n ignoredActions: [organizationActions.receiveExternalDeviceIntegrations.type, uploadProgress.type],\n ignoredActionPaths: ['uploads', /payload\\..*$/, 'meta.arg.file', 'meta.arg.integration.configHint'],\n ignoredPaths: ['app.uploadsById', 'organization.externalDeviceIntegrations']\n }\n }).concat(rejectionLoggerMiddleware)\n });\n};\nexport const store = getConfiguredStore({\n preloadedState: {}\n});\nexport type AppDispatch = typeof store.dispatch;\nexport type RootState = ReturnType<typeof rootReducer>;\nexport const useAppDispatch: () => AppDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\n\nexport const createAppAsyncThunk = createAsyncThunk.withTypes<{\n dispatch: AppDispatch;\n state: RootState;\n}>();\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAM,EAAE,aAAa,mBAAmBA;AAGxC,MAAM,OAAO,CAAC,4BAA4B,aAAa,WAAW;AAClE,MAAM,yBAA+B,KAAK,SAAQ,QAAO,OAAO,eAAe,WAAW,GAAG,CAAC;AAE9F,iBAAiB;AAmBjB,MAAa,sBAAsB;AACnC,MAAa,sBACX,KACA,cACA,UACA,UACA,qBAAqB,UACF;CACnB,MAAM,SAAS,oBAAoB,KAAK,QAAQ;CAChD,IAAI,sBAAsB,SAAS,GACjC,SAAS,YAAY;EAAE,SAAS,uBAAuB,IAAI,UAAU,GAAG,aAAa,GAAG,QAAQ;EAAG,QAAQ;CAAoB,CAAC,CAAC;CAEnI,OAAO,QAAQ,OAAO,GAAG;AAC3B;AAEA,MAAM,cAAc,gBAAgB;CAClC,KAAKC;CACL,SAASC;CACT,aAAaC;CACb,SAASC;CACT,YAAYC;CACZ,cAAcC;CACd,UAAUC;CACV,OAAOC;AACT,CAAC;AAID,MAAM,sBAA4E,OAAO,WAAW;CAClG,IAAI,OAAO,SAAA,eACT,QAAQ,KAAA;CAEV,OAAO,YAAY,OAAO,MAAM;AAClC;AAEA,MAAa,iBAAiB;AAE9B,MAAM,mCAA8C,UAAQ,WAAU;CACpE,IAAI,WAAW,MAAM,GAAG;EACtB,QAAQ,MAAM,wBAAwB,MAAM;EAC5C,IAAI,OAAO,OACT,QAAQ,MAAM,OAAO,MAAM,KAAK;CAEpC;CACA,OAAO,KAAK,MAAM;AACpB;AAEA,MAAM,0BAA0B;CAACC,UAAY,qBAAqB;CAAM;CAA2B;CAA6B;AAA0B;AAE1J,MAAM,sBAAsB,oBAAoB;CAC9C,oBAAoB,WAA0B;EAC5C,IAAI,wBAAwB,SAAS,OAAO,IAAc,GACxD,OAAO;EAET,OAAO;CACT;CAEA,mBAAmB,UAAqB;EAYtC,OAAO;GAVL,GAAG;GACH,OAAO;IAAE,GAAG,MAAM;IAAO,gBAAgB;GAAK;GAC9C,cAAc;IACZ,GAAG,MAAM;IACT,cAAc;KACZ,GAAG,MAAM,aAAa;KACtB,cAAc;IAChB;GACF;EAEoB;CACxB;AACF,CAAC;AAED,MAAa,sBAAsB,UAAkF,CAAC,MAAM;CAC1H,MAAM,EAAE,gBAAgB,GAAG,WAAW;CACtC,OAAO,eAAe;EACpB,GAAG;EACa;EAChB,YAAW,wBAAuB;GAEhC,IAAI,OAAO,oBAAoB,QAAQ,gBACrC,OAAO,oBAAoB,CAAC,CAAC,OAAO,mBAAmB;GAEzD,OAAO,oBAAoB;EAC7B;EACA,SAAS;EAET,aAAY,yBACV,qBAAqB;GACnB,gBAAgB,EACd,cAAc,CAAC,iBAAiB,EAClC;GACA,mBAAmB;IACjB,gBAAgB,CAACC,QAAoB,kCAAkC,MAAM,eAAe,IAAI;IAChG,oBAAoB;KAAC;KAAW;KAAgB;KAAiB;IAAiC;IAClG,cAAc,CAAC,mBAAmB,yCAAyC;GAC7E;EACF,CAAC,CAAC,CAAC,OAAO,yBAAyB;CACvC,CAAC;AACH;AACA,MAAa,QAAQ,mBAAmB,EACtC,gBAAgB,CAAC,EACnB,CAAC;AAGD,MAAa,iBAAoC;AACjD,MAAa,iBAAkD;AAE/D,MAAa,sBAAsB,iBAAiB,UAGjD"}
1
+ {"version":3,"file":"store.js","names":["actions","appSlice","deviceSlice","deploymentSlice","monitorSlice","onboardingSlice","organizationSlice","releaseSlice","userSlice","userActions","organizationActions"],"sources":["../src/store.ts"],"sourcesContent":["// Copyright 2019 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { useDispatch, useSelector } from 'react-redux';\nimport type { TypedUseSelectorHook } from 'react-redux';\n\nimport { extractErrorMessage, preformatWithRequestID } from '@northern.tech/utils/helpers';\nimport type { Middleware, Reducer, UnknownAction } from '@reduxjs/toolkit';\nimport { combineReducers, configureStore, createAsyncThunk, isRejected } from '@reduxjs/toolkit';\nimport { createReduxEnhancer } from '@sentry/react';\n\nimport actions from './actions';\nimport appSlice from './appSlice';\nimport { getToken } from './auth';\nimport { USER_LOGOUT, settingsKeys } from './constants';\nimport deploymentSlice from './deploymentsSlice';\nimport deviceSlice from './devicesSlice';\nimport monitorSlice from './monitorSlice';\nimport onboardingSlice from './onboardingSlice';\nimport organizationSlice, { actions as organizationActions } from './organizationSlice';\nimport releaseSlice from './releasesSlice';\nimport userSlice, { actions as userActions } from './usersSlice';\n\nconst { setSnackbar, uploadProgress } = actions;\n\n// exclude 'pendings-redirect' since this is expected to persist refreshes - the rest should be better to be redone\nconst keys = ['sessionDeploymentChecker', settingsKeys.initialized];\nexport const resetEnvironment = (): void => keys.forEach(key => window.sessionStorage.removeItem(key));\n\nexport type { ErrorWithResponse } from './utils';\n\nexport type MenderEnvironment = {\n [key: string]: unknown;\n demoArtifactPort?: string | number;\n disableOnboarding?: string;\n features: Record<string, string>;\n sentry?: { isReduxEnabled?: string | boolean };\n version: string;\n};\n\ndeclare global {\n interface Window {\n mender_environment?: MenderEnvironment;\n }\n}\n\nexport const commonErrorFallback = 'Please check your connection.';\nexport const commonErrorHandler = (\n err: { message?: string; response?: { data?: unknown } },\n errorContext: string,\n dispatch: AppDispatch,\n fallback?: string,\n mightBeAuthRelated = false\n): Promise<never> => {\n const errMsg = extractErrorMessage(err, fallback);\n if (mightBeAuthRelated || getToken()) {\n dispatch(setSnackbar({ message: preformatWithRequestID(err.response, `${errorContext} ${errMsg}`), action: 'Copy to clipboard' }));\n }\n return Promise.reject(err);\n};\n\nconst rootReducer = combineReducers({\n app: appSlice,\n devices: deviceSlice,\n deployments: deploymentSlice,\n monitor: monitorSlice,\n onboarding: onboardingSlice,\n organization: organizationSlice,\n releases: releaseSlice,\n users: userSlice\n});\n\ntype RootReducerState = ReturnType<typeof rootReducer>;\n\nconst sessionReducerImpl: Reducer<RootReducerState | undefined, UnknownAction> = (state, action) => {\n if (action.type === USER_LOGOUT) {\n state = undefined;\n }\n return rootReducer(state, action);\n};\n// Export for testing; cast to RootReducerState since undefined always falls through to initial slice states\nexport const sessionReducer = sessionReducerImpl as Reducer<RootReducerState>;\n\nconst rejectionLoggerMiddleware: Middleware = () => next => action => {\n if (isRejected(action)) {\n console.error('Rejection in action:', action);\n if (action.error) {\n console.error(action.error.stack);\n }\n }\n return next(action);\n};\n\nconst tracingActionIgnoreList = [userActions.successfullyLoggedIn.type, 'users/loginUser/pending', 'users/loginUser/fulfilled', 'users/loginUser/rejected'];\n\nconst sentryReduxEnhancer = createReduxEnhancer({\n actionTransformer: (action: UnknownAction) => {\n if (tracingActionIgnoreList.includes(action.type as string)) {\n return null;\n }\n return action;\n },\n // Transform the state to remove sensitive information\n stateTransformer: (state: RootState) => {\n const transformedState = {\n ...state,\n users: { ...state.users, currentSession: null },\n organization: {\n ...state.organization,\n organization: {\n ...state.organization.organization,\n tenant_token: null\n }\n }\n };\n return transformedState;\n }\n});\n\nexport const getConfiguredStore = (options: { [key: string]: unknown; preloadedState?: Partial<RootReducerState> } = {}) => {\n const { preloadedState, ...config } = options;\n return configureStore({\n ...config,\n preloadedState: preloadedState as RootReducerState,\n enhancers: getDefaultEnhancers => {\n // rely on the plain injected env object, as we're initializing the store only here\n if (window.mender_environment?.sentry?.isReduxEnabled) {\n return getDefaultEnhancers().concat(sentryReduxEnhancer);\n }\n return getDefaultEnhancers();\n },\n reducer: sessionReducer,\n // @ts-expect-error - GetDefaultMiddleware type mismatch between @reduxjs/toolkit and @sentry/react\n middleware: getDefaultMiddleware =>\n getDefaultMiddleware({\n immutableCheck: {\n ignoredPaths: ['app.uploadsById']\n },\n serializableCheck: {\n ignoredActions: [organizationActions.receiveExternalDeviceIntegrations.type, uploadProgress.type],\n ignoredActionPaths: ['uploads', /payload\\..*$/, 'meta.arg.file', 'meta.arg.integration.configHint'],\n ignoredPaths: ['app.uploadsById', 'organization.externalDeviceIntegrations']\n }\n }).concat(rejectionLoggerMiddleware)\n });\n};\nexport type AppStore = ReturnType<typeof getConfiguredStore>;\nexport type AppDispatch = AppStore['dispatch'];\nexport type RootState = ReturnType<typeof rootReducer>;\nexport const useAppDispatch: () => AppDispatch = useDispatch;\nexport const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;\n\nexport const createAppAsyncThunk = createAsyncThunk.withTypes<{\n dispatch: AppDispatch;\n state: RootState;\n}>();\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,MAAM,EAAE,aAAa,mBAAmBA;AAGxC,MAAM,OAAO,CAAC,4BAA4B,aAAa,WAAW;AAClE,MAAa,yBAA+B,KAAK,SAAQ,QAAO,OAAO,eAAe,WAAW,GAAG,CAAC;AAmBrG,MAAa,sBAAsB;AACnC,MAAa,sBACX,KACA,cACA,UACA,UACA,qBAAqB,UACF;CACnB,MAAM,SAAS,oBAAoB,KAAK,QAAQ;CAChD,IAAI,sBAAsB,SAAS,GACjC,SAAS,YAAY;EAAE,SAAS,uBAAuB,IAAI,UAAU,GAAG,aAAa,GAAG,QAAQ;EAAG,QAAQ;CAAoB,CAAC,CAAC;CAEnI,OAAO,QAAQ,OAAO,GAAG;AAC3B;AAEA,MAAM,cAAc,gBAAgB;CAClC,KAAKC;CACL,SAASC;CACT,aAAaC;CACb,SAASC;CACT,YAAYC;CACZ,cAAcC;CACd,UAAUC;CACV,OAAOC;AACT,CAAC;AAID,MAAM,sBAA4E,OAAO,WAAW;CAClG,IAAI,OAAO,SAAA,eACT,QAAQ,KAAA;CAEV,OAAO,YAAY,OAAO,MAAM;AAClC;AAEA,MAAa,iBAAiB;AAE9B,MAAM,mCAA8C,UAAQ,WAAU;CACpE,IAAI,WAAW,MAAM,GAAG;EACtB,QAAQ,MAAM,wBAAwB,MAAM;EAC5C,IAAI,OAAO,OACT,QAAQ,MAAM,OAAO,MAAM,KAAK;CAEpC;CACA,OAAO,KAAK,MAAM;AACpB;AAEA,MAAM,0BAA0B;CAACC,UAAY,qBAAqB;CAAM;CAA2B;CAA6B;AAA0B;AAE1J,MAAM,sBAAsB,oBAAoB;CAC9C,oBAAoB,WAA0B;EAC5C,IAAI,wBAAwB,SAAS,OAAO,IAAc,GACxD,OAAO;EAET,OAAO;CACT;CAEA,mBAAmB,UAAqB;EAYtC,OAAO;GAVL,GAAG;GACH,OAAO;IAAE,GAAG,MAAM;IAAO,gBAAgB;GAAK;GAC9C,cAAc;IACZ,GAAG,MAAM;IACT,cAAc;KACZ,GAAG,MAAM,aAAa;KACtB,cAAc;IAChB;GACF;EAEoB;CACxB;AACF,CAAC;AAED,MAAa,sBAAsB,UAAkF,CAAC,MAAM;CAC1H,MAAM,EAAE,gBAAgB,GAAG,WAAW;CACtC,OAAO,eAAe;EACpB,GAAG;EACa;EAChB,YAAW,wBAAuB;GAEhC,IAAI,OAAO,oBAAoB,QAAQ,gBACrC,OAAO,oBAAoB,CAAC,CAAC,OAAO,mBAAmB;GAEzD,OAAO,oBAAoB;EAC7B;EACA,SAAS;EAET,aAAY,yBACV,qBAAqB;GACnB,gBAAgB,EACd,cAAc,CAAC,iBAAiB,EAClC;GACA,mBAAmB;IACjB,gBAAgB,CAACC,QAAoB,kCAAkC,MAAM,eAAe,IAAI;IAChG,oBAAoB;KAAC;KAAW;KAAgB;KAAiB;IAAiC;IAClG,cAAc,CAAC,mBAAmB,yCAAyC;GAC7E;EACF,CAAC,CAAC,CAAC,OAAO,yBAAyB;CACvC,CAAC;AACH;AAIA,MAAa,iBAAoC;AACjD,MAAa,iBAAkD;AAE/D,MAAa,sBAAsB,iBAAiB,UAGjD"}
package/dist/thunks.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
3
3
  const require_appSlice_constants = require("./appSlice/constants.cjs");
4
- const require_constants = require("./constants-MVizYy89.cjs");
4
+ const require_constants = require("./constants-DsOnY5o5.cjs");
5
5
  const require_onboardingSlice_constants = require("./onboardingSlice/constants.cjs");
6
6
  const require_releasesSlice_constants = require("./releasesSlice/constants.cjs");
7
7
  const require_appSlice_index = require("./appSlice/index.cjs");
@@ -24,6 +24,7 @@ const require_api_general_api = require("./api/general-api.cjs");
24
24
  const require_monitorSlice_thunks = require("./monitorSlice/thunks.cjs");
25
25
  const require_releasesSlice_thunks = require("./releasesSlice/thunks.cjs");
26
26
  const require_api_users_api = require("./api/users-api.cjs");
27
+ let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
27
28
  let _northern_tech_utils_helpers = require("@northern.tech/utils/helpers");
28
29
  let universal_cookie = require("universal-cookie");
29
30
  universal_cookie = require_rolldown_runtime.__toESM(universal_cookie, 1);
@@ -42,7 +43,6 @@ dayjs_plugin_utc_js = require_rolldown_runtime.__toESM(dayjs_plugin_utc_js, 1);
42
43
  let md5 = require("md5");
43
44
  md5 = require_rolldown_runtime.__toESM(md5, 1);
44
45
  let _northern_tech_utils_retrytimer = require("@northern.tech/utils/retrytimer");
45
- let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
46
46
  //#region src/appSlice/thunks.ts
47
47
  const cookies$3 = new universal_cookie.default();
48
48
  const setFirstLoginAfterSignup = require_store.createAppAsyncThunk(`app/setFirstLoginAfterSignup`, (firstLoginAfterSignup, { dispatch }) => {
@@ -257,7 +257,7 @@ const createDeployment = require_store.createAppAsyncThunk(`${require_deployment
257
257
  dispatch(getSingleDeployment(deploymentId)),
258
258
  Promise.resolve(dispatch(setSnackbar$3({
259
259
  message: "Deployment created successfully",
260
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
260
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
261
261
  })))
262
262
  ];
263
263
  trackDeploymentCreation(totalDeploymentCount, hasDeployments, trial_expiration);
@@ -474,7 +474,7 @@ const saveDeltaDeploymentsConfig = require_store.createAppAsyncThunk(`${require_
474
474
  return Promise.all([dispatch(require_deploymentsSlice_index.actions.setDeploymentsConfig(newConfig)), dispatch(setSnackbar$3("Settings saved successfully"))]);
475
475
  });
476
476
  });
477
- const generateDeploymentLogAnalysis = require_store.createAppAsyncThunk(`${require_deploymentsSlice_index.sliceName}/generateDeploymentLogAnalysis`, ({ deploymentId, deviceId }, { dispatch, rejectWithValue }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.apiRoot}/v1alpha1/deployments/deployments/${deploymentId}/devices/${deviceId}/log/explain`, { timeout: 60 * require_constants.TIMEOUTS.oneSecond }).then(({ data: result }) => Promise.resolve(result)).catch((err) => {
477
+ const generateDeploymentLogAnalysis = require_store.createAppAsyncThunk(`${require_deploymentsSlice_index.sliceName}/generateDeploymentLogAnalysis`, ({ deploymentId, deviceId }, { dispatch, rejectWithValue }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.apiRoot}/v1alpha1/deployments/deployments/${deploymentId}/devices/${deviceId}/log/explain`, { timeout: 60 * _northern_tech_utils_constants.TIMEOUTS.oneSecond }).then(({ data: result }) => Promise.resolve(result)).catch((err) => {
478
478
  if (err.response.status === 429) return rejectWithValue(err.response);
479
479
  require_store.commonErrorHandler(err, "There was an error analysing the deployment log:", dispatch);
480
480
  }));
@@ -574,7 +574,7 @@ const removeDevicesFromGroup = require_store.createAppAsyncThunk(`${require_devi
574
574
  deviceIds
575
575
  })), dispatch(setSnackbar$2({
576
576
  message: `The ${(0, pluralize.default)("devices", deviceIds.length)} ${(0, pluralize.default)("were", deviceIds.length)} removed from the group`,
577
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
577
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
578
578
  }))])));
579
579
  const addStaticGroup = require_store.createAppAsyncThunk(`${require_devicesSlice_index.sliceName}/addStaticGroup`, ({ group, devices }, { dispatch, getState }) => dispatch(addDevicesToGroup({
580
580
  group,
@@ -603,7 +603,7 @@ const removeStaticGroup = require_store.createAppAsyncThunk(`${require_devicesSl
603
603
  dispatch(getGroups()),
604
604
  dispatch(setSnackbar$2({
605
605
  message: "Group was removed successfully",
606
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
606
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
607
607
  }))
608
608
  ])));
609
609
  const getDynamicGroup = require_store.createAppAsyncThunk(`${require_devicesSlice_index.sliceName}/getDynamicGroupById`, (id, { dispatch }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/${id}`).catch((err) => {
@@ -656,7 +656,7 @@ const removeDynamicGroup = require_store.createAppAsyncThunk(`${require_devicesS
656
656
  dispatch(removeReportsByGroupName(groupName)),
657
657
  dispatch(setSnackbar$2({
658
658
  message: "Group was removed successfully",
659
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
659
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
660
660
  }))
661
661
  ]));
662
662
  });
@@ -1134,7 +1134,7 @@ const updateTypeMap = {
1134
1134
  const triggerDeviceUpdate = require_store.createAppAsyncThunk(`${require_devicesSlice_index.sliceName}/triggerDeviceUpdate`, async ({ id, type }, { dispatch }) => {
1135
1135
  await require_api_general_api.default.post(`${_northern_tech_utils_constants.deviceConnect}/devices/${id}/${updateTypeMap[type] ?? updateTypeMap.deploymentUpdate}`).catch((err) => require_store.commonErrorHandler(err, `The request couldn't be sent.`, dispatch));
1136
1136
  dispatch(setSnackbar$2("Request has been sent."));
1137
- await new Promise((resolve) => setTimeout(resolve, require_constants.TIMEOUTS.threeSeconds));
1137
+ await new Promise((resolve) => setTimeout(resolve, _northern_tech_utils_constants.TIMEOUTS.threeSeconds));
1138
1138
  return dispatch(getDeviceById(id));
1139
1139
  });
1140
1140
  const getSessionDetails = require_store.createAppAsyncThunk(`${require_devicesSlice_index.sliceName}/getSessionDetails`, ({ sessionId, deviceId, userId, startDate, endDate }) => {
@@ -1181,11 +1181,11 @@ const deviceFileUpload = require_store.createAppAsyncThunk(`${require_devicesSli
1181
1181
  })), cancelSource.signal)
1182
1182
  ]).then(() => Promise.resolve(dispatch(setSnackbar$2({
1183
1183
  message: "Upload successful",
1184
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1184
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1185
1185
  })))).catch((err) => {
1186
1186
  if ((0, axios.isCancel)(err)) return dispatch(setSnackbar$2({
1187
1187
  message: "The upload has been cancelled",
1188
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1188
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1189
1189
  }));
1190
1190
  return require_store.commonErrorHandler(err, `Error uploading file to device.`, dispatch);
1191
1191
  }).finally(() => dispatch(cleanUpUpload(uploadId)));
@@ -1250,7 +1250,7 @@ const deleteAuthset = require_store.createAppAsyncThunk(`${require_devicesSlice_
1250
1250
  })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !getState().devices.deviceList.refreshTrigger }))));
1251
1251
  const preauthDevice = require_store.createAppAsyncThunk(`${require_devicesSlice_index.sliceName}/preauthDevice`, (authset, { dispatch, rejectWithValue }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.deviceAuthV2}/devices`, authset).then(() => Promise.resolve(dispatch(setSnackbar$2({
1252
1252
  message: "Device was successfully added to the preauthorization list",
1253
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1253
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1254
1254
  })))).catch((err) => {
1255
1255
  if (err.response.status === 409) return rejectWithValue("A device with a matching identity data set already exists");
1256
1256
  return require_store.commonErrorHandler(err, "The device could not be added:", dispatch);
@@ -1278,7 +1278,7 @@ const applyDeviceConfig = require_store.createAppAsyncThunk(`${require_devicesSl
1278
1278
  })))];
1279
1279
  require_utils.dispatchDelayed({
1280
1280
  action: getSingleDeployment(data.deployment_id),
1281
- delay: require_constants.TIMEOUTS.oneSecond,
1281
+ delay: _northern_tech_utils_constants.TIMEOUTS.oneSecond,
1282
1282
  dispatch
1283
1283
  });
1284
1284
  if (isDefault && canManageUsers) {
@@ -1482,7 +1482,7 @@ const cancelRequest = require_store.createAppAsyncThunk(`${require_organizationS
1482
1482
  const { id: tenantId } = require_organizationSlice_selectors.getOrganization(getState());
1483
1483
  return require_api_general_api.default.post(`${_northern_tech_utils_constants.tenantadmApiUrlv2}/tenants/${tenantId}/cancel`, { reason }).then(() => Promise.resolve(dispatch(setSnackbar$1({
1484
1484
  message: "Deactivation request was sent successfully",
1485
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1485
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1486
1486
  }))));
1487
1487
  });
1488
1488
  const getTierId = (tierName) => tierName.replace("mender_", "");
@@ -1574,11 +1574,11 @@ const createOrganizationTrial = require_store.createAppAsyncThunk(`${require_org
1574
1574
  const { headers } = await require_api_general_api.default.postUnauthorized(target, trialPayload).catch((err) => {
1575
1575
  if (err.response?.status >= 400 && err.response?.status < 500) dispatch(setSnackbar$1({
1576
1576
  message: err.response.data.error,
1577
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1577
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1578
1578
  }));
1579
1579
  else dispatch(setSnackbar$1({
1580
1580
  message: "There was an error creating your account",
1581
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1581
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1582
1582
  }));
1583
1583
  return Promise.reject(err);
1584
1584
  });
@@ -1589,7 +1589,7 @@ const createOrganizationTrial = require_store.createAppAsyncThunk(`${require_org
1589
1589
  return new Promise((resolve) => setTimeout(() => {
1590
1590
  window.location.assign(`${targetLocation}${headers.location || ""}`);
1591
1591
  return resolve();
1592
- }, require_constants.TIMEOUTS.fiveSeconds));
1592
+ }, _northern_tech_utils_constants.TIMEOUTS.fiveSeconds));
1593
1593
  });
1594
1594
  const startCardUpdate = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/startCardUpdate`, (_, { dispatch }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.tenantadmApiUrlv2}/billing/card`).then(({ data }) => {
1595
1595
  dispatch(require_organizationSlice_index.actions.receiveSetupIntent(data.intent_id));
@@ -1669,7 +1669,7 @@ const addTenant = require_store.createAppAsyncThunk(`${require_organizationSlice
1669
1669
  dispatch(setSnackbar$1("Tenant was created successfully."));
1670
1670
  require_utils.dispatchDelayed({
1671
1671
  action: getTenants(),
1672
- delay: require_constants.TIMEOUTS.oneSecond,
1672
+ delay: _northern_tech_utils_constants.TIMEOUTS.oneSecond,
1673
1673
  dispatch
1674
1674
  });
1675
1675
  }).catch((err) => require_store.commonErrorHandler(err, "There was an error creating tenant", dispatch, require_store.commonErrorFallback));
@@ -1721,7 +1721,7 @@ const editTenant = require_store.createAppAsyncThunk(`${require_organizationSlic
1721
1721
  dispatch(getUserOrganization());
1722
1722
  require_utils.dispatchDelayed({
1723
1723
  action: getTenants(),
1724
- delay: require_constants.TIMEOUTS.oneSecond,
1724
+ delay: _northern_tech_utils_constants.TIMEOUTS.oneSecond,
1725
1725
  dispatch
1726
1726
  });
1727
1727
  });
@@ -1733,7 +1733,7 @@ const removeTenant = require_store.createAppAsyncThunk(`${require_organizationSl
1733
1733
  await dispatch(getUserOrganization()).unwrap();
1734
1734
  require_utils.dispatchDelayed({
1735
1735
  action: getTenants(),
1736
- delay: require_constants.TIMEOUTS.oneSecond,
1736
+ delay: _northern_tech_utils_constants.TIMEOUTS.oneSecond,
1737
1737
  dispatch
1738
1738
  });
1739
1739
  }));
@@ -1776,17 +1776,17 @@ const getCurrentSubscription = require_store.createAppAsyncThunk(`${require_orga
1776
1776
  return require_store.commonErrorHandler(err, "There was an error retrieving your current subscription", dispatch, require_store.commonErrorFallback);
1777
1777
  }));
1778
1778
  const getProducts = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/getEnabledTiers`, (_, { dispatch }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.tenantadmApiUrlv2}/billing/products`).catch((err) => require_store.commonErrorHandler(err, "There was an error getting Mender products:", dispatch, require_store.commonErrorFallback)).then((res) => dispatch(require_organizationSlice_index.actions.setProducts(transformProductResponse(res.data)))));
1779
- const requestPlanUpgrade = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/requestPlanUpgrade`, (order, { dispatch }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.tenantadmApiUrlv2}/billing/subscription`, order).catch((err) => require_store.commonErrorHandler(err, "There was an error sending your request", dispatch, require_store.commonErrorFallback)).then(() => Promise.all([new Promise((resolve) => setTimeout(resolve, require_constants.TIMEOUTS.threeSeconds)).then(() => dispatch(getDeviceLimits())), dispatch(getUserOrganization())])));
1779
+ const requestPlanUpgrade = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/requestPlanUpgrade`, (order, { dispatch }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.tenantadmApiUrlv2}/billing/subscription`, order).catch((err) => require_store.commonErrorHandler(err, "There was an error sending your request", dispatch, require_store.commonErrorFallback)).then(() => Promise.all([new Promise((resolve) => setTimeout(resolve, _northern_tech_utils_constants.TIMEOUTS.threeSeconds)).then(() => dispatch(getDeviceLimits())), dispatch(getUserOrganization())])));
1780
1780
  const sendSupportMessage = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/sendSupportMessage`, (content, { dispatch }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.tenantadmApiUrlv2}/contact/support`, content).catch((err) => require_store.commonErrorHandler(err, "There was an error sending your request", dispatch, require_store.commonErrorFallback)).then(() => Promise.resolve(dispatch(setSnackbar$1({
1781
1781
  message: "Your request was sent successfully",
1782
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1782
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1783
1783
  })))));
1784
1784
  const requestPlanChange = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/requestPlanChange`, ({ content, tenantId }, { dispatch, rejectWithValue }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.tenantadmApiUrlv2}/tenants/${tenantId}/plan`, content).catch(async (err) => {
1785
1785
  await require_store.commonErrorHandler(err, "There was an error sending your request", dispatch, require_store.commonErrorFallback);
1786
1786
  rejectWithValue(err);
1787
1787
  }).then(() => Promise.resolve(dispatch(setSnackbar$1({
1788
1788
  message: "Your request was sent successfully",
1789
- autoHideDuration: require_constants.TIMEOUTS.fiveSeconds
1789
+ autoHideDuration: _northern_tech_utils_constants.TIMEOUTS.fiveSeconds
1790
1790
  })))));
1791
1791
  const downloadLicenseReport = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/downloadLicenseReport`, (_, { dispatch }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.deviceAuthV2}/license`).catch((err) => require_store.commonErrorHandler(err, "There was an error downloading the report", dispatch, require_store.commonErrorFallback)).then((res) => res.data));
1792
1792
  const createIntegration = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/createIntegration`, ({ id, ...integration }, { dispatch }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.iotManagerBaseURL}/integrations`, integration).catch((err) => require_store.commonErrorHandler(err, "There was an error creating the integration", dispatch, require_store.commonErrorFallback)).then(() => Promise.all([dispatch(setSnackbar$1("The integration was set up successfully")), dispatch(getIntegrations())])));
@@ -1810,23 +1810,15 @@ const getIntegrations = require_store.createAppAsyncThunk(`${require_organizatio
1810
1810
  }, []);
1811
1811
  return Promise.resolve(dispatch(require_organizationSlice_index.actions.receiveExternalDeviceIntegrations(integrations)));
1812
1812
  }));
1813
- const getWebhookEvents = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/getWebhookEvents`, (config = {}, { dispatch, getState }) => {
1814
- const { integrationId, isFollowUp, knownTotal = 0, page = defaultPage, perPage = defaultPerPage } = config;
1813
+ const getWebhookEvents = require_store.createAppAsyncThunk(`${require_organizationSlice_index.sliceName}/getWebhookEvents`, async (config = {}, { dispatch }) => {
1814
+ const { integrationId, page = defaultPage, perPage = defaultPerPage } = config;
1815
1815
  const integrationFilter = integrationId ? `&integration_id=${integrationId}` : "";
1816
- return require_api_general_api.default.get(`${_northern_tech_utils_constants.iotManagerBaseURL}/events?page=${page}&per_page=${perPage}${integrationFilter}`).catch((err) => require_store.commonErrorHandler(err, "There was an error retrieving activity for this integration", dispatch, require_store.commonErrorFallback)).then(({ data }) => {
1817
- const tasks = [Promise.resolve(dispatch(require_organizationSlice_index.actions.receiveWebhookEvents({
1818
- value: isFollowUp ? getState().organization.webhooks.events : data,
1819
- total: isFollowUp ? knownTotal + data.length : (page - 1) * perPage + data.length
1820
- })))];
1821
- if (data.length >= perPage && !isFollowUp) tasks.push(dispatch(getWebhookEvents({
1822
- integrationId,
1823
- isFollowUp: true,
1824
- knownTotal: page * perPage,
1825
- page: page + 1,
1826
- perPage: 1
1827
- })));
1828
- return Promise.all(tasks);
1829
- });
1816
+ const { data, headers } = await require_api_general_api.default.get(`${_northern_tech_utils_constants.iotManagerBaseURL}/events?page=${page}&per_page=${perPage}${integrationFilter}`).catch((err) => require_store.commonErrorHandler(err, "There was an error retrieving activity for this integration", dispatch, require_store.commonErrorFallback));
1817
+ const total = Number(headers[_northern_tech_utils_constants.headerNames.total] || data.length);
1818
+ return dispatch(require_organizationSlice_index.actions.receiveWebhookEvents({
1819
+ value: data,
1820
+ total
1821
+ }));
1830
1822
  });
1831
1823
  const ssoConfigActions = {
1832
1824
  create: {