@northern.tech/store 0.36.1 → 0.36.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.d.cts +123 -134
- package/dist/actions.d.ts +123 -134
- package/dist/actions.js.map +1 -1
- package/dist/api/general-api.cjs +3 -3
- package/dist/api/general-api.cjs.map +1 -1
- package/dist/api/general-api.d.cts +9 -10
- package/dist/api/general-api.d.ts +9 -10
- package/dist/api/general-api.js.map +1 -1
- package/dist/api/users-api.cjs +2 -2
- package/dist/api/users-api.cjs.map +1 -1
- package/dist/api/users-api.d.cts +1 -2
- package/dist/api/users-api.d.ts +1 -2
- package/dist/api/users-api.js.map +1 -1
- package/dist/appSlice/constants.cjs +0 -1
- package/dist/appSlice/constants.cjs.map +1 -1
- package/dist/appSlice/constants.d.cts +1 -1
- package/dist/appSlice/constants.d.ts +1 -1
- package/dist/appSlice/constants.js.map +1 -1
- package/dist/appSlice/index.cjs +2 -4
- package/dist/appSlice/index.cjs.map +1 -1
- package/dist/appSlice/index.d.cts +2 -2
- package/dist/appSlice/index.d.ts +2 -2
- package/dist/appSlice/index.js +2 -3
- package/dist/appSlice/index.js.map +1 -1
- package/dist/appSlice/mocks.cjs.map +1 -1
- package/dist/appSlice/mocks.d.cts +1 -1
- package/dist/appSlice/mocks.d.ts +1 -1
- package/dist/appSlice/mocks.js.map +1 -1
- package/dist/appSlice/selectors.cjs +2 -6
- package/dist/appSlice/selectors.cjs.map +1 -1
- package/dist/appSlice/selectors.d.cts +35 -128
- package/dist/appSlice/selectors.d.ts +35 -128
- package/dist/appSlice/selectors.js +2 -5
- package/dist/appSlice/selectors.js.map +1 -1
- package/dist/appSlice/thunks.cjs +0 -1
- package/dist/appSlice/thunks.d.cts +6 -31
- package/dist/appSlice/thunks.d.ts +6 -31
- package/dist/appSlice/thunks.js +2 -2
- package/dist/auth.cjs +2 -2
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/commonConstants.d.cts +1 -1
- package/dist/commonConstants.d.ts +1 -1
- package/dist/commonSelectors.cjs +2 -2
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.d.cts +164 -166
- package/dist/commonSelectors.d.ts +164 -166
- package/dist/commonSelectors.js.map +1 -1
- package/dist/{constants-CIx3fnBv.d.cts → constants-6kYRTdox.d.cts} +1 -1
- package/dist/{constants-BciiayPt.d.ts → constants-6kYRTdox.d.ts} +1 -1
- package/dist/{constants-BIIEMVoG.d.ts → constants-B_7FCJQX.d.cts} +3 -6
- package/dist/{constants-BFTS6mge.d.cts → constants-B_7FCJQX.d.ts} +3 -6
- package/dist/{constants-D41U_jbR.d.cts → constants-BwKiHHaB.d.cts} +1 -1
- package/dist/{constants-5cdwz1iH.d.ts → constants-BwKiHHaB.d.ts} +1 -1
- package/dist/{constants-DK7fI3Rh.d.cts → constants-Db_RBdlV.d.cts} +1 -1
- package/dist/{constants-BWEsNG5c.d.ts → constants-Db_RBdlV.d.ts} +1 -1
- package/dist/{constants-CNhpIMME.d.cts → constants-OZiiFKiA.d.cts} +1 -1
- package/dist/{constants-y2XVLQWf.d.ts → constants-OZiiFKiA.d.ts} +1 -1
- package/dist/{constants-CjO3_FOH.d.ts → constants-OcdoVk6f.d.ts} +3 -4
- package/dist/{constants-G3wymKIl.d.cts → constants-Sn4gnNA3.d.cts} +1 -1
- package/dist/{constants-Cpgyuy_r.d.ts → constants-Sn4gnNA3.d.ts} +1 -1
- package/dist/{constants-BrGIx40B.d.cts → constants-_p6w8uEp.d.cts} +3 -4
- package/dist/constants.cjs +0 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +8 -8
- package/dist/constants.d.ts +8 -8
- package/dist/constants.js.map +1 -1
- package/dist/deploymentsSlice/constants.d.cts +1 -1
- package/dist/deploymentsSlice/constants.d.ts +1 -1
- package/dist/deploymentsSlice/index.cjs +0 -1
- package/dist/deploymentsSlice/index.cjs.map +1 -1
- package/dist/deploymentsSlice/index.d.cts +1 -1
- package/dist/deploymentsSlice/index.d.ts +1 -1
- package/dist/deploymentsSlice/index.js.map +1 -1
- package/dist/deploymentsSlice/mocks.cjs.map +1 -1
- package/dist/deploymentsSlice/mocks.d.cts +1 -1
- package/dist/deploymentsSlice/mocks.d.ts +1 -1
- package/dist/deploymentsSlice/mocks.js.map +1 -1
- package/dist/deploymentsSlice/selectors.cjs +0 -1
- package/dist/deploymentsSlice/selectors.cjs.map +1 -1
- package/dist/deploymentsSlice/selectors.d.cts +15 -16
- package/dist/deploymentsSlice/selectors.d.ts +15 -16
- package/dist/deploymentsSlice/selectors.js.map +1 -1
- package/dist/deploymentsSlice/thunks.d.cts +21 -22
- package/dist/deploymentsSlice/thunks.d.ts +21 -22
- package/dist/devicesSlice/constants.d.cts +1 -1
- package/dist/devicesSlice/constants.d.ts +1 -1
- package/dist/devicesSlice/index.cjs +0 -1
- package/dist/devicesSlice/index.cjs.map +1 -1
- package/dist/devicesSlice/index.d.cts +1 -1
- package/dist/devicesSlice/index.d.ts +1 -1
- package/dist/devicesSlice/index.js.map +1 -1
- package/dist/devicesSlice/mocks.cjs +0 -1
- package/dist/devicesSlice/mocks.cjs.map +1 -1
- package/dist/devicesSlice/mocks.js.map +1 -1
- package/dist/devicesSlice/selectors.cjs +0 -1
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.d.cts +79 -81
- package/dist/devicesSlice/selectors.d.ts +79 -81
- package/dist/devicesSlice/selectors.js.map +1 -1
- package/dist/devicesSlice/thunks.d.cts +67 -69
- package/dist/devicesSlice/thunks.d.ts +67 -69
- package/dist/{index-DUvrw_Ed.d.ts → index-5Q-iI4EB.d.cts} +17 -20
- package/dist/index-BBsUj1a8.d.ts +68 -0
- package/dist/index-BLvjQfGj.d.ts +119 -0
- package/dist/{index-BP0uAq36.d.cts → index-Bb4yvvgG.d.ts} +25 -28
- package/dist/index-Bj3OArhr.d.cts +68 -0
- package/dist/{index-CT5hgXm9.d.cts → index-ByfjrTdH.d.ts} +16 -19
- package/dist/index-C8QadAm7.d.cts +119 -0
- package/dist/{index-BI9O8JWe.d.ts → index-CPdMUfRr.d.ts} +41 -44
- package/dist/index-CSk4ENmk.d.cts +149 -0
- package/dist/index-Cf81vLTi.d.ts +149 -0
- package/dist/index-DBUt8xVc.d.cts +61 -0
- package/dist/index-DBUt8xVc.d.ts +61 -0
- package/dist/index-DLDY7bNT.d.ts +165 -0
- package/dist/{index-B64X5ozM.d.cts → index-DbfM03Gj.d.cts} +42 -45
- package/dist/{index-CkwVnIqd.d.ts → index-EPmsL6Lb.d.cts} +26 -29
- package/dist/index-Zs9RnVoR.d.cts +165 -0
- package/dist/liststatehook.cjs +5 -6
- package/dist/liststatehook.cjs.map +1 -1
- package/dist/liststatehook.d.cts +1 -1
- package/dist/liststatehook.d.ts +1 -1
- package/dist/liststatehook.js +1 -1
- package/dist/liststatehook.js.map +1 -1
- package/dist/locationutils.cjs +0 -1
- package/dist/locationutils.cjs.map +1 -1
- package/dist/locationutils.d.cts +3 -3
- package/dist/locationutils.d.ts +3 -3
- package/dist/locationutils.js.map +1 -1
- package/dist/monitorSlice/constants.d.cts +1 -1
- package/dist/monitorSlice/constants.d.ts +1 -1
- package/dist/monitorSlice/index.cjs +0 -1
- package/dist/monitorSlice/index.cjs.map +1 -1
- package/dist/monitorSlice/index.d.cts +1 -1
- package/dist/monitorSlice/index.d.ts +1 -1
- package/dist/monitorSlice/index.js.map +1 -1
- package/dist/monitorSlice/mocks.cjs +0 -1
- package/dist/monitorSlice/mocks.cjs.map +1 -1
- package/dist/monitorSlice/mocks.d.cts +1 -1
- package/dist/monitorSlice/mocks.d.ts +1 -1
- package/dist/monitorSlice/mocks.js.map +1 -1
- package/dist/monitorSlice/selectors.d.cts +1 -1
- package/dist/monitorSlice/selectors.d.ts +1 -1
- package/dist/monitorSlice/thunks.cjs +1 -3
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.d.cts +11 -13
- package/dist/monitorSlice/thunks.d.ts +11 -13
- package/dist/monitorSlice/thunks.js +1 -2
- package/dist/monitorSlice/thunks.js.map +1 -1
- package/dist/onboardingSlice/constants.cjs.map +1 -1
- package/dist/onboardingSlice/constants.d.cts +1 -1
- package/dist/onboardingSlice/constants.d.ts +1 -1
- package/dist/onboardingSlice/constants.js.map +1 -1
- package/dist/onboardingSlice/index.cjs +0 -1
- package/dist/onboardingSlice/index.cjs.map +1 -1
- package/dist/onboardingSlice/index.d.cts +1 -1
- package/dist/onboardingSlice/index.d.ts +1 -1
- package/dist/onboardingSlice/index.js.map +1 -1
- package/dist/onboardingSlice/mocks.cjs.map +1 -1
- package/dist/onboardingSlice/mocks.d.cts +1 -1
- package/dist/onboardingSlice/mocks.d.ts +1 -1
- package/dist/onboardingSlice/mocks.js.map +1 -1
- package/dist/onboardingSlice/selectors.d.cts +2 -2
- package/dist/onboardingSlice/selectors.d.ts +2 -2
- package/dist/onboardingSlice/thunks.d.cts +22 -23
- package/dist/onboardingSlice/thunks.d.ts +22 -23
- package/dist/organizationSlice/constants.d.cts +1 -1
- package/dist/organizationSlice/constants.d.ts +1 -1
- package/dist/organizationSlice/index.cjs +0 -1
- package/dist/organizationSlice/index.cjs.map +1 -1
- package/dist/organizationSlice/index.d.cts +1 -1
- package/dist/organizationSlice/index.d.ts +1 -1
- package/dist/organizationSlice/index.js.map +1 -1
- package/dist/organizationSlice/mocks.cjs +0 -1
- package/dist/organizationSlice/mocks.cjs.map +1 -1
- package/dist/organizationSlice/mocks.d.cts +3 -4
- package/dist/organizationSlice/mocks.d.ts +3 -4
- package/dist/organizationSlice/mocks.js.map +1 -1
- package/dist/organizationSlice/selectors.cjs +0 -1
- package/dist/organizationSlice/selectors.cjs.map +1 -1
- package/dist/organizationSlice/selectors.d.cts +78 -81
- package/dist/organizationSlice/selectors.d.ts +78 -81
- package/dist/organizationSlice/selectors.js.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +65 -105
- package/dist/organizationSlice/thunks.d.ts +65 -105
- package/dist/organizationSlice/types.d.cts +1 -1
- package/dist/organizationSlice/types.d.ts +1 -1
- package/dist/releasesSlice/constants.cjs.map +1 -1
- package/dist/releasesSlice/constants.d.cts +1 -1
- package/dist/releasesSlice/constants.d.ts +1 -1
- package/dist/releasesSlice/constants.js.map +1 -1
- package/dist/releasesSlice/index.cjs +0 -1
- package/dist/releasesSlice/index.cjs.map +1 -1
- package/dist/releasesSlice/index.d.cts +1 -1
- package/dist/releasesSlice/index.d.ts +1 -1
- package/dist/releasesSlice/index.js.map +1 -1
- package/dist/releasesSlice/mocks.cjs +0 -1
- package/dist/releasesSlice/mocks.cjs.map +1 -1
- package/dist/releasesSlice/mocks.d.cts +3 -6
- package/dist/releasesSlice/mocks.d.ts +3 -6
- package/dist/releasesSlice/mocks.js.map +1 -1
- package/dist/releasesSlice/selectors.cjs +0 -1
- package/dist/releasesSlice/selectors.cjs.map +1 -1
- package/dist/releasesSlice/selectors.d.cts +107 -110
- package/dist/releasesSlice/selectors.d.ts +107 -110
- package/dist/releasesSlice/selectors.js.map +1 -1
- package/dist/releasesSlice/thunks.cjs +39 -16
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.d.cts +52 -61
- package/dist/releasesSlice/thunks.d.ts +52 -61
- package/dist/releasesSlice/thunks.js +38 -15
- package/dist/releasesSlice/thunks.js.map +1 -1
- package/dist/sockethook.cjs +3 -3
- package/dist/sockethook.cjs.map +1 -1
- package/dist/sockethook.js.map +1 -1
- package/dist/{store-BhRxVhtL.d.cts → store-DBUTT4FF.d.cts} +139 -36
- package/dist/{store-BZo47jc-.d.ts → store-gkY5P9Uz.d.ts} +139 -36
- package/dist/store.cjs +0 -1
- package/dist/store.cjs.map +1 -1
- package/dist/store.d.cts +2 -3
- package/dist/store.d.ts +2 -3
- package/dist/store.js.map +1 -1
- package/dist/storehooks.cjs +9 -17
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.d.cts +6 -43
- package/dist/storehooks.d.ts +6 -43
- package/dist/storehooks.js +7 -15
- package/dist/storehooks.js.map +1 -1
- package/dist/thunks.cjs +51 -67
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +2 -2
- package/dist/thunks.d.ts +2 -2
- package/dist/thunks.js +45 -60
- package/dist/thunks.js.map +1 -1
- package/dist/{types-COdPU2QQ.d.cts → types-B33vKVhi.d.cts} +4 -4
- package/dist/{types-BPyM8Inu.d.ts → types-BjtmX60L.d.ts} +4 -4
- package/dist/useDeploymentDevice.cjs +2 -2
- package/dist/useDeploymentDevice.cjs.map +1 -1
- package/dist/useDeploymentDevice.js.map +1 -1
- package/dist/usersSlice/constants.d.cts +1 -1
- package/dist/usersSlice/constants.d.ts +1 -1
- package/dist/usersSlice/index.cjs +0 -1
- package/dist/usersSlice/index.cjs.map +1 -1
- package/dist/usersSlice/index.d.cts +1 -1
- package/dist/usersSlice/index.d.ts +1 -1
- package/dist/usersSlice/index.js.map +1 -1
- package/dist/usersSlice/mocks.cjs +0 -1
- package/dist/usersSlice/mocks.cjs.map +1 -1
- package/dist/usersSlice/mocks.d.cts +4 -6
- package/dist/usersSlice/mocks.d.ts +4 -6
- package/dist/usersSlice/mocks.js.map +1 -1
- package/dist/usersSlice/selectors.cjs +0 -1
- package/dist/usersSlice/selectors.cjs.map +1 -1
- package/dist/usersSlice/selectors.d.cts +44 -47
- package/dist/usersSlice/selectors.d.ts +44 -47
- package/dist/usersSlice/selectors.js.map +1 -1
- package/dist/usersSlice/thunks.d.cts +92 -95
- package/dist/usersSlice/thunks.d.ts +92 -95
- package/dist/utils.cjs +2 -3
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +3 -3
- package/dist/utils.js.map +1 -1
- package/package.json +8 -8
- package/dist/index-B3IF6ur9.d.cts +0 -168
- package/dist/index-BFlHWzjv.d.cts +0 -152
- package/dist/index-BbaS7MzW.d.cts +0 -71
- package/dist/index-Bp1WpATs.d.ts +0 -154
- package/dist/index-C6wNUfiV.d.ts +0 -71
- package/dist/index-CJkrL0oA.d.ts +0 -64
- package/dist/index-DaD3yorF.d.ts +0 -168
- package/dist/index-DwACbyUg.d.cts +0 -154
- package/dist/index-UPc3wvVd.d.cts +0 -64
- package/dist/index-ez3oxfRo.d.ts +0 -152
- package/dist/utils-CHBWS_tH.d.ts +0 -105
- package/dist/utils-Do9z5TL1.d.cts +0 -105
- /package/dist/{chunk-CKQMccvm.cjs → rolldown-runtime-D6vf50IK.cjs} +0 -0
|
@@ -1,29 +1,132 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import
|
|
1
|
+
import { H as emptyUiPermissions, S as Role, m as DeviceIssueOptionKey, xt as FilterOperator } from "./constants-OcdoVk6f.js";
|
|
2
|
+
import { o as UserSliceType } from "./index-Cf81vLTi.js";
|
|
3
|
+
import { i as ReleaseSliceType } from "./index-DLDY7bNT.js";
|
|
4
|
+
import { a as PricePreview } from "./types-BjtmX60L.js";
|
|
5
|
+
import { n as OnboardingSliceType } from "./index-DBUt8xVc.js";
|
|
6
|
+
import { o as DeploymentsSliceType, t as Deployment } from "./index-Bb4yvvgG.js";
|
|
7
|
+
import { c as InventoryAttributes, n as DeviceFilter, r as DeviceGroup, s as DeviceSliceType } from "./index-CPdMUfRr.js";
|
|
8
|
+
import { t as AppSliceType } from "./index-BLvjQfGj.js";
|
|
9
|
+
import { t as MonitorSliceType } from "./index-ByfjrTdH.js";
|
|
10
|
+
import { t as OrganizationSliceType } from "./index-BBsUj1a8.js";
|
|
10
11
|
import { Reducer, UnknownAction } from "@reduxjs/toolkit";
|
|
11
12
|
import { TypedUseSelectorHook } from "react-redux";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
13
|
+
import { AxiosError } from "axios";
|
|
14
|
+
import { Attribute, AttributeFilterPredicate, FilterV2, InvoiceLineItem, Scope } from "@northern.tech/types/MenderTypes";
|
|
14
15
|
|
|
16
|
+
//#region src/utils.d.ts
|
|
17
|
+
type FilterProcessorValue = string | string[] | number | boolean;
|
|
18
|
+
type FilterTerm = {
|
|
19
|
+
attribute: string;
|
|
20
|
+
scope: Scope;
|
|
21
|
+
type: FilterOperator;
|
|
22
|
+
value: FilterProcessorValue;
|
|
23
|
+
};
|
|
24
|
+
declare const mapFiltersToTerms: (filters: DeviceFilter[]) => FilterTerm[];
|
|
25
|
+
declare const mapTermsToFilters: (terms: FilterTerm[]) => DeviceFilter[];
|
|
26
|
+
declare const convertDeviceListStateToFilters: ({
|
|
27
|
+
filters,
|
|
28
|
+
group,
|
|
29
|
+
groups,
|
|
30
|
+
offlineThreshold,
|
|
31
|
+
selectedIssues,
|
|
32
|
+
status
|
|
33
|
+
}: {
|
|
34
|
+
filters?: DeviceFilter[];
|
|
35
|
+
group?: string;
|
|
36
|
+
groups?: {
|
|
37
|
+
byId: Record<string, DeviceGroup>;
|
|
38
|
+
};
|
|
39
|
+
offlineThreshold?: string;
|
|
40
|
+
selectedIssues?: DeviceIssueOptionKey[];
|
|
41
|
+
status?: string;
|
|
42
|
+
}) => {
|
|
43
|
+
applicableFilters: DeviceFilter[];
|
|
44
|
+
filterTerms: FilterTerm[];
|
|
45
|
+
};
|
|
46
|
+
declare const filtersFilter: (item: DeviceFilter, index: number, array: DeviceFilter[]) => boolean;
|
|
47
|
+
declare const stripUndefined: <T extends Record<string, unknown>>(obj: T) => Partial<T>;
|
|
48
|
+
declare const listItemMapper: <T extends object>(byId: Record<string, T>, ids: string[], {
|
|
49
|
+
cutOffSize,
|
|
50
|
+
defaultObject
|
|
51
|
+
}: {
|
|
52
|
+
cutOffSize?: number;
|
|
53
|
+
defaultObject?: Partial<T>;
|
|
54
|
+
}) => T[];
|
|
55
|
+
type UiPermissions = typeof emptyUiPermissions;
|
|
56
|
+
declare const mergePermissions: (existingPermissions: UiPermissions | undefined, addedPermissions: UiPermissions) => UiPermissions;
|
|
57
|
+
declare const mapUserRolesToUiPermissions: (userRoles: string[], roles: Record<string, Role>) => UiPermissions;
|
|
58
|
+
declare const progress: ({
|
|
59
|
+
loaded,
|
|
60
|
+
total
|
|
61
|
+
}: {
|
|
62
|
+
loaded: number;
|
|
63
|
+
total?: number;
|
|
64
|
+
}) => number;
|
|
65
|
+
type ErrorWithResponse = AxiosError<{
|
|
66
|
+
error?: {
|
|
67
|
+
message?: string;
|
|
68
|
+
} | string;
|
|
69
|
+
}> & {
|
|
70
|
+
error?: string;
|
|
71
|
+
};
|
|
72
|
+
declare const extractErrorMessage: (err: ErrorWithResponse, fallback?: string) => string;
|
|
73
|
+
declare const ensureVersionString: (software: string, fallback: string) => string;
|
|
74
|
+
declare const stringToBoolean: (content: string | number | undefined) => boolean;
|
|
75
|
+
type DeploymentStats = {
|
|
76
|
+
failures: number;
|
|
77
|
+
inprogress: number;
|
|
78
|
+
paused: number;
|
|
79
|
+
pending: number;
|
|
80
|
+
skipped?: number;
|
|
81
|
+
successes: number;
|
|
82
|
+
};
|
|
83
|
+
declare const groupDeploymentDevicesStats: (deployment: Pick<Deployment, "devices">) => DeploymentStats;
|
|
84
|
+
declare const statCollector: (items: string[], statistics: Record<string, number>) => number;
|
|
85
|
+
declare const groupDeploymentStats: (deployment: Partial<Deployment>, withSkipped?: boolean) => DeploymentStats;
|
|
86
|
+
declare const getDeploymentState: (deployment: Partial<Deployment>) => string;
|
|
87
|
+
type DeploymentFilter = FilterV2 | {
|
|
88
|
+
terms?: Array<AttributeFilterPredicate | {
|
|
89
|
+
key: string;
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
declare const generateDeploymentGroupDetails: (filter: DeploymentFilter | undefined, groupName: string) => string;
|
|
93
|
+
type DeviceAttributeMap = {
|
|
94
|
+
identity: Record<string, string>;
|
|
95
|
+
inventory: InventoryAttributes;
|
|
96
|
+
monitor: Record<string, string>;
|
|
97
|
+
system: Record<string, string>;
|
|
98
|
+
tags: Record<string, string>;
|
|
99
|
+
};
|
|
100
|
+
declare const mapDeviceAttributes: (attributes?: Attribute[]) => DeviceAttributeMap;
|
|
101
|
+
declare const isDarkMode: (mode: string) => boolean;
|
|
102
|
+
type Line = InvoiceLineItem & {
|
|
103
|
+
product: 'mender_standard' | 'mender_micro';
|
|
104
|
+
};
|
|
105
|
+
declare const parseSubscriptionPreview: (lines: Line[]) => PricePreview["items"];
|
|
106
|
+
declare const convertToBackendSPLimits: (limits: Record<string, number | string>, spLimits: Record<string, object>) => Record<string, {
|
|
107
|
+
Name: string;
|
|
108
|
+
value: number;
|
|
109
|
+
}>;
|
|
110
|
+
declare const dispatchDelayed: ({
|
|
111
|
+
action,
|
|
112
|
+
delay,
|
|
113
|
+
dispatch
|
|
114
|
+
}: {
|
|
115
|
+
action: any;
|
|
116
|
+
delay?: number;
|
|
117
|
+
dispatch: AppDispatch;
|
|
118
|
+
}) => number;
|
|
119
|
+
//#endregion
|
|
15
120
|
//#region src/store.d.ts
|
|
16
121
|
type MenderEnvironment = {
|
|
17
122
|
[key: string]: unknown;
|
|
18
123
|
demoArtifactPort?: string | number;
|
|
19
124
|
disableOnboarding?: string;
|
|
20
125
|
features: Record<string, string>;
|
|
21
|
-
integrationVersion: string;
|
|
22
|
-
menderArtifactVersion: string;
|
|
23
|
-
metaMenderVersion: string;
|
|
24
126
|
sentry?: {
|
|
25
127
|
isReduxEnabled?: string | boolean;
|
|
26
128
|
};
|
|
129
|
+
version: string;
|
|
27
130
|
};
|
|
28
131
|
declare global {
|
|
29
132
|
interface Window {
|
|
@@ -61,7 +164,7 @@ declare const sessionReducer: Reducer<RootReducerState>;
|
|
|
61
164
|
declare const getConfiguredStore: (options?: {
|
|
62
165
|
[key: string]: unknown;
|
|
63
166
|
preloadedState?: Partial<RootReducerState>;
|
|
64
|
-
}) =>
|
|
167
|
+
}) => import("@reduxjs/toolkit").EnhancedStore<{
|
|
65
168
|
app: AppSliceType;
|
|
66
169
|
devices: DeviceSliceType;
|
|
67
170
|
deployments: DeploymentsSliceType;
|
|
@@ -70,8 +173,8 @@ declare const getConfiguredStore: (options?: {
|
|
|
70
173
|
organization: OrganizationSliceType;
|
|
71
174
|
releases: ReleaseSliceType;
|
|
72
175
|
users: UserSliceType;
|
|
73
|
-
}, UnknownAction,
|
|
74
|
-
dispatch:
|
|
176
|
+
}, UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
|
|
177
|
+
dispatch: import("redux-thunk").ThunkDispatch<{
|
|
75
178
|
app: AppSliceType;
|
|
76
179
|
devices: DeviceSliceType;
|
|
77
180
|
deployments: DeploymentsSliceType;
|
|
@@ -81,8 +184,8 @@ declare const getConfiguredStore: (options?: {
|
|
|
81
184
|
releases: ReleaseSliceType;
|
|
82
185
|
users: UserSliceType;
|
|
83
186
|
}, undefined, UnknownAction>;
|
|
84
|
-
}>,
|
|
85
|
-
declare const store:
|
|
187
|
+
}>, import("redux").StoreEnhancer]>>;
|
|
188
|
+
declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
86
189
|
app: AppSliceType;
|
|
87
190
|
devices: DeviceSliceType;
|
|
88
191
|
deployments: DeploymentsSliceType;
|
|
@@ -91,8 +194,8 @@ declare const store: _$_reduxjs_toolkit0.EnhancedStore<{
|
|
|
91
194
|
organization: OrganizationSliceType;
|
|
92
195
|
releases: ReleaseSliceType;
|
|
93
196
|
users: UserSliceType;
|
|
94
|
-
}, UnknownAction,
|
|
95
|
-
dispatch:
|
|
197
|
+
}, UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
|
|
198
|
+
dispatch: import("redux-thunk").ThunkDispatch<{
|
|
96
199
|
app: AppSliceType;
|
|
97
200
|
devices: DeviceSliceType;
|
|
98
201
|
deployments: DeploymentsSliceType;
|
|
@@ -102,12 +205,12 @@ declare const store: _$_reduxjs_toolkit0.EnhancedStore<{
|
|
|
102
205
|
releases: ReleaseSliceType;
|
|
103
206
|
users: UserSliceType;
|
|
104
207
|
}, undefined, UnknownAction>;
|
|
105
|
-
}>,
|
|
208
|
+
}>, import("redux").StoreEnhancer]>>;
|
|
106
209
|
type AppDispatch = typeof store.dispatch;
|
|
107
210
|
type RootState = ReturnType<typeof rootReducer>;
|
|
108
211
|
declare const useAppDispatch: () => AppDispatch;
|
|
109
212
|
declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
|
110
|
-
declare const createAppAsyncThunk:
|
|
213
|
+
declare const createAppAsyncThunk: import("@reduxjs/toolkit").CreateAsyncThunkFunction<{
|
|
111
214
|
dispatch: AppDispatch;
|
|
112
215
|
state: RootState;
|
|
113
216
|
extra?: unknown;
|
|
@@ -117,7 +220,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
117
220
|
fulfilledMeta?: unknown;
|
|
118
221
|
rejectedMeta?: unknown;
|
|
119
222
|
}> & {
|
|
120
|
-
withTypes<ThunkApiConfig extends
|
|
223
|
+
withTypes<ThunkApiConfig extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig & Omit<{
|
|
121
224
|
dispatch: AppDispatch;
|
|
122
225
|
state: RootState;
|
|
123
226
|
extra?: unknown;
|
|
@@ -127,7 +230,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
127
230
|
fulfilledMeta?: unknown;
|
|
128
231
|
rejectedMeta?: unknown;
|
|
129
232
|
}, keyof ThunkApiConfig> extends infer T ? { [K in keyof T]: T[K] } : never> & {
|
|
130
|
-
withTypes<ThunkApiConfig_1 extends
|
|
233
|
+
withTypes<ThunkApiConfig_1 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
131
234
|
dispatch: AppDispatch;
|
|
132
235
|
state: RootState;
|
|
133
236
|
extra?: unknown;
|
|
@@ -137,7 +240,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
137
240
|
fulfilledMeta?: unknown;
|
|
138
241
|
rejectedMeta?: unknown;
|
|
139
242
|
}, keyof ThunkApiConfig> extends infer T_2 ? { [K in keyof T_2]: T_2[K] } : never, keyof ThunkApiConfig_1> extends infer T_1 ? { [K_1 in keyof T_1]: T_1[K_1] } : never> & {
|
|
140
|
-
withTypes<ThunkApiConfig_2 extends
|
|
243
|
+
withTypes<ThunkApiConfig_2 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
141
244
|
dispatch: AppDispatch;
|
|
142
245
|
state: RootState;
|
|
143
246
|
extra?: unknown;
|
|
@@ -147,7 +250,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
147
250
|
fulfilledMeta?: unknown;
|
|
148
251
|
rejectedMeta?: unknown;
|
|
149
252
|
}, keyof ThunkApiConfig> extends infer T_5 ? { [K in keyof T_5]: T_5[K] } : never, keyof ThunkApiConfig_1> extends infer T_4 ? { [K_1 in keyof T_4]: T_4[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_3 ? { [K_2 in keyof T_3]: T_3[K_2] } : never> & {
|
|
150
|
-
withTypes<ThunkApiConfig_3 extends
|
|
253
|
+
withTypes<ThunkApiConfig_3 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
151
254
|
dispatch: AppDispatch;
|
|
152
255
|
state: RootState;
|
|
153
256
|
extra?: unknown;
|
|
@@ -157,7 +260,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
157
260
|
fulfilledMeta?: unknown;
|
|
158
261
|
rejectedMeta?: unknown;
|
|
159
262
|
}, keyof ThunkApiConfig> extends infer T_9 ? { [K in keyof T_9]: T_9[K] } : never, keyof ThunkApiConfig_1> extends infer T_8 ? { [K_1 in keyof T_8]: T_8[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_7 ? { [K_2 in keyof T_7]: T_7[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_6 ? { [K_3 in keyof T_6]: T_6[K_3] } : never> & {
|
|
160
|
-
withTypes<ThunkApiConfig_4 extends
|
|
263
|
+
withTypes<ThunkApiConfig_4 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_4 & Omit<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
161
264
|
dispatch: AppDispatch;
|
|
162
265
|
state: RootState;
|
|
163
266
|
extra?: unknown;
|
|
@@ -167,7 +270,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
167
270
|
fulfilledMeta?: unknown;
|
|
168
271
|
rejectedMeta?: unknown;
|
|
169
272
|
}, keyof ThunkApiConfig> extends infer T_14 ? { [K in keyof T_14]: T_14[K] } : never, keyof ThunkApiConfig_1> extends infer T_13 ? { [K_1 in keyof T_13]: T_13[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_12 ? { [K_2 in keyof T_12]: T_12[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_11 ? { [K_3 in keyof T_11]: T_11[K_3] } : never, keyof ThunkApiConfig_4> extends infer T_10 ? { [K_4 in keyof T_10]: T_10[K_4] } : never> & {
|
|
170
|
-
withTypes<ThunkApiConfig_5 extends
|
|
273
|
+
withTypes<ThunkApiConfig_5 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_5 & Omit<ThunkApiConfig_4 & Omit<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
171
274
|
dispatch: AppDispatch;
|
|
172
275
|
state: RootState;
|
|
173
276
|
extra?: unknown;
|
|
@@ -177,7 +280,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
177
280
|
fulfilledMeta?: unknown;
|
|
178
281
|
rejectedMeta?: unknown;
|
|
179
282
|
}, keyof ThunkApiConfig> extends infer T_20 ? { [K in keyof T_20]: T_20[K] } : never, keyof ThunkApiConfig_1> extends infer T_19 ? { [K_1 in keyof T_19]: T_19[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_18 ? { [K_2 in keyof T_18]: T_18[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_17 ? { [K_3 in keyof T_17]: T_17[K_3] } : never, keyof ThunkApiConfig_4> extends infer T_16 ? { [K_4 in keyof T_16]: T_16[K_4] } : never, keyof ThunkApiConfig_5> extends infer T_15 ? { [K_5 in keyof T_15]: T_15[K_5] } : never> & {
|
|
180
|
-
withTypes<ThunkApiConfig_6 extends
|
|
283
|
+
withTypes<ThunkApiConfig_6 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_6 & Omit<ThunkApiConfig_5 & Omit<ThunkApiConfig_4 & Omit<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
181
284
|
dispatch: AppDispatch;
|
|
182
285
|
state: RootState;
|
|
183
286
|
extra?: unknown;
|
|
@@ -187,7 +290,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
187
290
|
fulfilledMeta?: unknown;
|
|
188
291
|
rejectedMeta?: unknown;
|
|
189
292
|
}, keyof ThunkApiConfig> extends infer T_27 ? { [K in keyof T_27]: T_27[K] } : never, keyof ThunkApiConfig_1> extends infer T_26 ? { [K_1 in keyof T_26]: T_26[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_25 ? { [K_2 in keyof T_25]: T_25[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_24 ? { [K_3 in keyof T_24]: T_24[K_3] } : never, keyof ThunkApiConfig_4> extends infer T_23 ? { [K_4 in keyof T_23]: T_23[K_4] } : never, keyof ThunkApiConfig_5> extends infer T_22 ? { [K_5 in keyof T_22]: T_22[K_5] } : never, keyof ThunkApiConfig_6> extends infer T_21 ? { [K_6 in keyof T_21]: T_21[K_6] } : never> & {
|
|
190
|
-
withTypes<ThunkApiConfig_7 extends
|
|
293
|
+
withTypes<ThunkApiConfig_7 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_7 & Omit<ThunkApiConfig_6 & Omit<ThunkApiConfig_5 & Omit<ThunkApiConfig_4 & Omit<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
191
294
|
dispatch: AppDispatch;
|
|
192
295
|
state: RootState;
|
|
193
296
|
extra?: unknown;
|
|
@@ -197,7 +300,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
197
300
|
fulfilledMeta?: unknown;
|
|
198
301
|
rejectedMeta?: unknown;
|
|
199
302
|
}, keyof ThunkApiConfig> extends infer T_35 ? { [K in keyof T_35]: T_35[K] } : never, keyof ThunkApiConfig_1> extends infer T_34 ? { [K_1 in keyof T_34]: T_34[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_33 ? { [K_2 in keyof T_33]: T_33[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_32 ? { [K_3 in keyof T_32]: T_32[K_3] } : never, keyof ThunkApiConfig_4> extends infer T_31 ? { [K_4 in keyof T_31]: T_31[K_4] } : never, keyof ThunkApiConfig_5> extends infer T_30 ? { [K_5 in keyof T_30]: T_30[K_5] } : never, keyof ThunkApiConfig_6> extends infer T_29 ? { [K_6 in keyof T_29]: T_29[K_6] } : never, keyof ThunkApiConfig_7> extends infer T_28 ? { [K_7 in keyof T_28]: T_28[K_7] } : never> & {
|
|
200
|
-
withTypes<ThunkApiConfig_8 extends
|
|
303
|
+
withTypes<ThunkApiConfig_8 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_8 & Omit<ThunkApiConfig_7 & Omit<ThunkApiConfig_6 & Omit<ThunkApiConfig_5 & Omit<ThunkApiConfig_4 & Omit<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
201
304
|
dispatch: AppDispatch;
|
|
202
305
|
state: RootState;
|
|
203
306
|
extra?: unknown;
|
|
@@ -207,7 +310,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
207
310
|
fulfilledMeta?: unknown;
|
|
208
311
|
rejectedMeta?: unknown;
|
|
209
312
|
}, keyof ThunkApiConfig> extends infer T_44 ? { [K in keyof T_44]: T_44[K] } : never, keyof ThunkApiConfig_1> extends infer T_43 ? { [K_1 in keyof T_43]: T_43[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_42 ? { [K_2 in keyof T_42]: T_42[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_41 ? { [K_3 in keyof T_41]: T_41[K_3] } : never, keyof ThunkApiConfig_4> extends infer T_40 ? { [K_4 in keyof T_40]: T_40[K_4] } : never, keyof ThunkApiConfig_5> extends infer T_39 ? { [K_5 in keyof T_39]: T_39[K_5] } : never, keyof ThunkApiConfig_6> extends infer T_38 ? { [K_6 in keyof T_38]: T_38[K_6] } : never, keyof ThunkApiConfig_7> extends infer T_37 ? { [K_7 in keyof T_37]: T_37[K_7] } : never, keyof ThunkApiConfig_8> extends infer T_36 ? { [K_8 in keyof T_36]: T_36[K_8] } : never> & {
|
|
210
|
-
withTypes<ThunkApiConfig_9 extends
|
|
313
|
+
withTypes<ThunkApiConfig_9 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_9 & Omit<ThunkApiConfig_8 & Omit<ThunkApiConfig_7 & Omit<ThunkApiConfig_6 & Omit<ThunkApiConfig_5 & Omit<ThunkApiConfig_4 & Omit<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit<{
|
|
211
314
|
dispatch: AppDispatch;
|
|
212
315
|
state: RootState;
|
|
213
316
|
extra?: unknown;
|
|
@@ -217,7 +320,7 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
217
320
|
fulfilledMeta?: unknown;
|
|
218
321
|
rejectedMeta?: unknown;
|
|
219
322
|
}, keyof ThunkApiConfig> extends infer T_54 ? { [K in keyof T_54]: T_54[K] } : never, keyof ThunkApiConfig_1> extends infer T_53 ? { [K_1 in keyof T_53]: T_53[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_52 ? { [K_2 in keyof T_52]: T_52[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_51 ? { [K_3 in keyof T_51]: T_51[K_3] } : never, keyof ThunkApiConfig_4> extends infer T_50 ? { [K_4 in keyof T_50]: T_50[K_4] } : never, keyof ThunkApiConfig_5> extends infer T_49 ? { [K_5 in keyof T_49]: T_49[K_5] } : never, keyof ThunkApiConfig_6> extends infer T_48 ? { [K_6 in keyof T_48]: T_48[K_6] } : never, keyof ThunkApiConfig_7> extends infer T_47 ? { [K_7 in keyof T_47]: T_47[K_7] } : never, keyof ThunkApiConfig_8> extends infer T_46 ? { [K_8 in keyof T_46]: T_46[K_8] } : never, keyof ThunkApiConfig_9> extends infer T_45 ? { [K_9 in keyof T_45]: T_45[K_9] } : never> & {
|
|
220
|
-
withTypes<ThunkApiConfig_10 extends
|
|
323
|
+
withTypes<ThunkApiConfig_10 extends import("@reduxjs/toolkit").AsyncThunkConfig>(): import("@reduxjs/toolkit").CreateAsyncThunkFunction<ThunkApiConfig_10 & Omit<ThunkApiConfig_9 & Omit<ThunkApiConfig_8 & Omit<ThunkApiConfig_7 & Omit<ThunkApiConfig_6 & Omit<ThunkApiConfig_5 & Omit<ThunkApiConfig_4 & Omit<ThunkApiConfig_3 & Omit<ThunkApiConfig_2 & Omit<ThunkApiConfig_1 & Omit<ThunkApiConfig & Omit< /*elided*/any, keyof ThunkApiConfig> extends infer T_65 ? { [K in keyof T_65]: T_65[K] } : never, keyof ThunkApiConfig_1> extends infer T_64 ? { [K_1 in keyof T_64]: T_64[K_1] } : never, keyof ThunkApiConfig_2> extends infer T_63 ? { [K_2 in keyof T_63]: T_63[K_2] } : never, keyof ThunkApiConfig_3> extends infer T_62 ? { [K_3 in keyof T_62]: T_62[K_3] } : never, keyof ThunkApiConfig_4> extends infer T_61 ? { [K_4 in keyof T_61]: T_61[K_4] } : never, keyof ThunkApiConfig_5> extends infer T_60 ? { [K_5 in keyof T_60]: T_60[K_5] } : never, keyof ThunkApiConfig_6> extends infer T_59 ? { [K_6 in keyof T_59]: T_59[K_6] } : never, keyof ThunkApiConfig_7> extends infer T_58 ? { [K_7 in keyof T_58]: T_58[K_7] } : never, keyof ThunkApiConfig_8> extends infer T_57 ? { [K_8 in keyof T_57]: T_57[K_8] } : never, keyof ThunkApiConfig_9> extends infer T_56 ? { [K_9 in keyof T_56]: T_56[K_9] } : never, keyof ThunkApiConfig_10> extends infer T_55 ? { [K_10 in keyof T_55]: T_55[K_10] } : never> & /*elided*/any;
|
|
221
324
|
};
|
|
222
325
|
};
|
|
223
326
|
};
|
|
@@ -230,5 +333,5 @@ declare const createAppAsyncThunk: _$_reduxjs_toolkit0.CreateAsyncThunkFunction<
|
|
|
230
333
|
};
|
|
231
334
|
};
|
|
232
335
|
//#endregion
|
|
233
|
-
export { commonErrorHandler as a, sessionReducer as c, useAppSelector as d, commonErrorFallback as i, store as l, MenderEnvironment as n, createAppAsyncThunk as o, RootState as r, getConfiguredStore as s, AppDispatch as t, useAppDispatch as u };
|
|
234
|
-
//# sourceMappingURL=store-
|
|
336
|
+
export { mapUserRolesToUiPermissions as A, groupDeploymentDevicesStats as C, mapDeviceAttributes as D, listItemMapper as E, stringToBoolean as F, stripUndefined as I, parseSubscriptionPreview as M, progress as N, mapFiltersToTerms as O, statCollector as P, getDeploymentState as S, isDarkMode 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, mergePermissions as j, mapTermsToFilters 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, groupDeploymentStats as w, generateDeploymentGroupDetails as x, extractErrorMessage as y };
|
|
337
|
+
//# sourceMappingURL=store-gkY5P9Uz.d.ts.map
|
package/dist/store.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./chunk-CKQMccvm.cjs");
|
|
3
2
|
const require_constants = require("./constants.cjs");
|
|
4
3
|
const require_appSlice_index = require("./appSlice/index.cjs");
|
|
5
4
|
const require_deploymentsSlice_index = require("./deploymentsSlice/index.cjs");
|
package/dist/store.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.cjs","names":["actions","settingsKeys","getToken","appSlice","deviceSlice","deploymentSlice","monitorSlice","onboardingSlice","organizationSlice","releaseSlice","userSlice","userActions","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
|
|
1
|
+
{"version":3,"file":"store.cjs","names":["actions","settingsKeys","getToken","appSlice","deviceSlice","deploymentSlice","monitorSlice","onboardingSlice","organizationSlice","releaseSlice","userSlice","userActions","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,GAAA,6BAAA,oBAAA,CAA6B,KAAK,QAAQ;CAChD,IAAI,sBAAsBC,aAAAA,SAAS,GACjC,SAAS,YAAY;EAAE,UAAA,GAA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;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"}
|
package/dist/store.d.cts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { n as ErrorWithResponse } from "./
|
|
2
|
-
|
|
3
|
-
export { AppDispatch, ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
|
|
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-DBUTT4FF.cjs";
|
|
2
|
+
export { AppDispatch, type ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
|
package/dist/store.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { n as ErrorWithResponse } from "./
|
|
2
|
-
|
|
3
|
-
export { AppDispatch, ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
|
|
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-gkY5P9Uz.js";
|
|
2
|
+
export { AppDispatch, type ErrorWithResponse, MenderEnvironment, RootState, commonErrorFallback, commonErrorHandler, createAppAsyncThunk, getConfiguredStore, sessionReducer, store, useAppDispatch, useAppSelector };
|
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
|
|
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"}
|
package/dist/storehooks.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
|
|
3
3
|
const require_constants = require("./constants.cjs");
|
|
4
4
|
const require_actions = require("./actions.cjs");
|
|
5
5
|
const require_auth = require("./auth.cjs");
|
|
@@ -14,12 +14,12 @@ const require_releasesSlice_thunks = require("./releasesSlice/thunks.cjs");
|
|
|
14
14
|
const require_thunks = require("./thunks.cjs");
|
|
15
15
|
let _northern_tech_utils_helpers = require("@northern.tech/utils/helpers");
|
|
16
16
|
let universal_cookie = require("universal-cookie");
|
|
17
|
-
universal_cookie =
|
|
17
|
+
universal_cookie = require_rolldown_runtime.__toESM(universal_cookie, 1);
|
|
18
18
|
let dayjs = require("dayjs");
|
|
19
|
-
dayjs =
|
|
19
|
+
dayjs = require_rolldown_runtime.__toESM(dayjs, 1);
|
|
20
20
|
let react = require("react");
|
|
21
21
|
let dayjs_plugin_duration_js = require("dayjs/plugin/duration.js");
|
|
22
|
-
dayjs_plugin_duration_js =
|
|
22
|
+
dayjs_plugin_duration_js = require_rolldown_runtime.__toESM(dayjs_plugin_duration_js, 1);
|
|
23
23
|
let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
|
|
24
24
|
//#region src/storehooks.ts
|
|
25
25
|
const cookies = new universal_cookie.default();
|
|
@@ -57,7 +57,7 @@ const parseEnvironmentInfo = require_store.createAppAsyncThunk(`app/parseEnviron
|
|
|
57
57
|
let versionInfo = {};
|
|
58
58
|
const mender_environment = window.mender_environment;
|
|
59
59
|
if (mender_environment) {
|
|
60
|
-
const { features = {}, demoArtifactPort: port, disableOnboarding,
|
|
60
|
+
const { features = {}, demoArtifactPort: port, disableOnboarding, version } = mender_environment;
|
|
61
61
|
demoArtifactPort = Number(port) || demoArtifactPort;
|
|
62
62
|
const appState = state.app;
|
|
63
63
|
environmentData = environmentDatas.reduce((accu, flag) => ({
|
|
@@ -73,12 +73,8 @@ const parseEnvironmentInfo = require_store.createAppAsyncThunk(`app/parseEnviron
|
|
|
73
73
|
};
|
|
74
74
|
onboardingComplete = !environmentFeatures.isHosted || require_utils.stringToBoolean(disableOnboarding) || onboardingComplete;
|
|
75
75
|
versionInfo = {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Integration: require_utils.getComparisonCompatibleVersion(integrationVersion),
|
|
79
|
-
"Mender-Artifact": menderArtifactVersion,
|
|
80
|
-
"Meta-Mender": metaMenderVersion
|
|
81
|
-
}
|
|
76
|
+
docsVersion: isNaN(parseInt(version.charAt(0))) ? "" : version.split(".").slice(0, 2).join("."),
|
|
77
|
+
version
|
|
82
78
|
};
|
|
83
79
|
}
|
|
84
80
|
return Promise.all([
|
|
@@ -86,12 +82,8 @@ const parseEnvironmentInfo = require_store.createAppAsyncThunk(`app/parseEnviron
|
|
|
86
82
|
dispatch(require_actions.setOnboardingComplete(onboardingComplete)),
|
|
87
83
|
dispatch(require_actions.setDemoArtifactPort(demoArtifactPort)),
|
|
88
84
|
dispatch(require_actions.setFeatures(environmentFeatures)),
|
|
89
|
-
dispatch(require_actions.setVersionInformation(
|
|
90
|
-
|
|
91
|
-
docsVersion: versionInfo.docs
|
|
92
|
-
})),
|
|
93
|
-
dispatch(require_actions.setEnvironmentData(environmentData)),
|
|
94
|
-
dispatch(require_thunks.getLatestReleaseInfo())
|
|
85
|
+
dispatch(require_actions.setVersionInformation(versionInfo)),
|
|
86
|
+
dispatch(require_actions.setEnvironmentData(environmentData))
|
|
95
87
|
]);
|
|
96
88
|
});
|
|
97
89
|
const maybeAddOnboardingTasks = ({ devicesByStatus, dispatch, onboardingState, tasks }) => {
|
package/dist/storehooks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storehooks.cjs","names":["Cookies","durationDayJs","storeActions","createAppAsyncThunk","getOnboardingStateSelector","stringToBoolean","getComparisonCompatibleVersion","getSessionInfo","getLatestReleaseInfo","DEVICE_STATES","getDeviceById","useAppDispatch","useAppSelector","getIsEnterprise","getFeatures","getDevicesByStatusSelector","getUserSettingsSelector","getUserCapabilities","getOfflineThresholdSettings","getGlobalSettingsSelector","getSortedFilteringAttributes","getIsServiceProvider","getUserSettings","getGlobalSettings","getUserOrganization","getRoles","getDeviceAttributes","getDeploymentsByStatus","DEPLOYMENT_STATES","getDevicesByStatus","getDynamicGroups","getGroups","getIntegrations","getReleases","getAllDeviceCounts","getDeviceLimits","saveUserSettings","timeUnits","TIMEOUTS","saveGlobalSettings","getOnboardingState"],"sources":["../src/storehooks.ts"],"sourcesContent":["// Copyright 2024 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 { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { extractErrorMessage } from '@northern.tech/utils/helpers';\nimport dayjs from 'dayjs';\nimport durationDayJs from 'dayjs/plugin/duration.js';\nimport Cookies from 'universal-cookie';\n\nimport storeActions from './actions';\nimport { getSessionInfo } from './auth';\nimport { DEPLOYMENT_STATES, DEVICE_STATES, TIMEOUTS, timeUnits } from './constants';\nimport type { DeviceSliceType } from './devicesSlice';\nimport {\n getDevicesByStatus as getDevicesByStatusSelector,\n getFeatures,\n getGlobalSettings as getGlobalSettingsSelector,\n getIsEnterprise,\n getIsServiceProvider,\n getOfflineThresholdSettings,\n getOnboardingState as getOnboardingStateSelector,\n getSortedFilteringAttributes,\n getUserCapabilities,\n getUserSettings as getUserSettingsSelector\n} from './selectors';\nimport { createAppAsyncThunk, useAppDispatch, useAppSelector } from './store';\nimport type { AppDispatch } from './store';\nimport {\n getAllDeviceCounts,\n getDeploymentsByStatus,\n getDeviceAttributes,\n getDeviceById,\n getDeviceLimits,\n getDevicesByStatus,\n getDynamicGroups,\n getGlobalSettings,\n getGroups,\n getIntegrations,\n getLatestReleaseInfo,\n getOnboardingState,\n getReleases,\n getRoles,\n getUserOrganization,\n getUserSettings,\n saveGlobalSettings,\n saveUserSettings\n} from './thunks';\nimport type { UserSettings, UserSliceType } from './usersSlice';\nimport { getComparisonCompatibleVersion, stringToBoolean } from './utils';\n\nconst cookies = new Cookies();\ndayjs.extend(durationDayJs);\n\nconst { setDeviceListState, setFirstLoginAfterSignup, setTooltipsState, setShowStartupNotification } = storeActions;\n\nconst featureFlags = [\n 'hasAiEnabled',\n 'hasAuditlogs',\n 'hasMultitenancy',\n 'hasDeltaProgress',\n 'hasDeviceConfig',\n 'hasDeviceConnect',\n 'hasFeedbackEnabled',\n 'hasManifestsEnabled',\n 'hasMonitor',\n 'hasMCUEnabled',\n 'isEnterprise'\n] as const;\n\nconst environmentDatas = [\n 'commit',\n 'feedbackProbability',\n 'hostAddress',\n 'hostedAnnouncement',\n 'recaptchaSiteKey',\n 'sentry',\n 'stripeAPIKey',\n 'trackerCode'\n] as const;\n\ntype VersionInfo = {\n docs?: string;\n remainder?: Record<string, string>;\n};\n\ntype FeatureFlagsState = Record<string, boolean>;\n\nexport const parseEnvironmentInfo = createAppAsyncThunk(`app/parseEnvironmentInfo`, (_, { dispatch, getState }) => {\n const state = getState();\n let onboardingComplete = getOnboardingStateSelector(state).complete || !!JSON.parse(window.localStorage.getItem('onboardingComplete') ?? 'false');\n let demoArtifactPort = 85;\n let environmentData: Record<string, unknown> = {};\n let environmentFeatures: FeatureFlagsState = {};\n let versionInfo: VersionInfo = {};\n const mender_environment = window.mender_environment;\n if (mender_environment) {\n const { features = {}, demoArtifactPort: port, disableOnboarding, integrationVersion, menderArtifactVersion, metaMenderVersion } = mender_environment;\n demoArtifactPort = Number(port) || demoArtifactPort;\n const appState = state.app;\n environmentData = environmentDatas.reduce((accu, flag) => ({ ...accu, [flag]: mender_environment[flag] || appState[flag as keyof typeof appState] }), {});\n environmentFeatures = {\n ...featureFlags.reduce<FeatureFlagsState>((accu, flag) => ({ ...accu, [flag]: stringToBoolean(features[flag]) }), {}),\n isHosted: stringToBoolean(features.isHosted) || window.location.hostname.includes('hosted.mender.io')\n };\n onboardingComplete = !environmentFeatures.isHosted || stringToBoolean(disableOnboarding) || onboardingComplete;\n versionInfo = {\n docs: isNaN(parseInt(integrationVersion.charAt(0))) ? '' : integrationVersion.split('.').slice(0, 2).join('.'),\n remainder: {\n Integration: getComparisonCompatibleVersion(integrationVersion),\n 'Mender-Artifact': menderArtifactVersion,\n 'Meta-Mender': metaMenderVersion\n }\n };\n }\n return Promise.all([\n dispatch(storeActions.successfullyLoggedIn(getSessionInfo())),\n dispatch(storeActions.setOnboardingComplete(onboardingComplete)),\n dispatch(storeActions.setDemoArtifactPort(demoArtifactPort)),\n dispatch(storeActions.setFeatures(environmentFeatures)),\n dispatch(storeActions.setVersionInformation({ ...(versionInfo.remainder ?? {}), docsVersion: versionInfo.docs })),\n dispatch(storeActions.setEnvironmentData(environmentData)),\n dispatch(getLatestReleaseInfo())\n ]);\n});\n\ntype OnboardingState = {\n complete?: boolean;\n showTips?: boolean | null;\n};\n\ntype MaybeAddOnboardingTasksParams = {\n devicesByStatus: DeviceSliceType['byStatus'];\n dispatch: AppDispatch;\n onboardingState: OnboardingState;\n tasks: Promise<unknown>[];\n};\n\nconst maybeAddOnboardingTasks = ({ devicesByStatus, dispatch, onboardingState, tasks }: MaybeAddOnboardingTasksParams): Promise<unknown>[] => {\n if (!onboardingState.showTips || onboardingState.complete) {\n return tasks;\n }\n // try to retrieve full device details for onboarding devices to ensure ips etc. are available\n // we only load the first few/ 20 devices, as it is possible the onboarding is left dangling\n // and a lot of devices are present and we don't want to flood the backend for this\n return devicesByStatus[DEVICE_STATES.accepted].deviceIds.reduce<Promise<unknown>[]>((accu, id) => {\n accu.push(dispatch(getDeviceById(id)));\n return accu;\n }, tasks);\n};\n\nexport const useAppInit = (userId: string | undefined): { coreInitDone: boolean } => {\n const dispatch = useAppDispatch();\n const [coreInitDone, setCoreInitDone] = useState(false);\n const isEnterprise = useAppSelector(getIsEnterprise);\n const { hasMultitenancy, isHosted } = useAppSelector(getFeatures);\n const devicesByStatus = useAppSelector(getDevicesByStatusSelector);\n const onboardingState = useAppSelector(getOnboardingStateSelector);\n const { columnSelection = [], trackingConsentGiven: hasTrackingEnabled, tooltips = {} } = useAppSelector(getUserSettingsSelector);\n const { canManageUsers } = useAppSelector(getUserCapabilities);\n const { interval, intervalUnit } = useAppSelector(getOfflineThresholdSettings);\n const { id_attribute } = useAppSelector(getGlobalSettingsSelector);\n const { identityAttributes } = useAppSelector(getSortedFilteringAttributes);\n const isServiceProvider = useAppSelector(getIsServiceProvider);\n const coreInitRunning = useRef(false);\n const fullInitRunning = useRef(false);\n\n const retrieveCoreData = useCallback((): Promise<unknown[]> => {\n const tasks: Promise<unknown>[] = [\n dispatch(parseEnvironmentInfo()).unwrap(),\n dispatch(getUserSettings()).unwrap(),\n dispatch(getGlobalSettings()).unwrap(),\n Promise.resolve(dispatch(setFirstLoginAfterSignup(stringToBoolean(cookies.get('firstLoginAfterSignup')))))\n ];\n const multitenancy = hasMultitenancy || isHosted || isEnterprise;\n if (multitenancy) {\n tasks.push(dispatch(getUserOrganization()).unwrap());\n }\n return Promise.all(tasks);\n }, [dispatch, hasMultitenancy, isHosted, isEnterprise]);\n\n const retrieveAppData = useCallback((): Promise<unknown[] | unknown> => {\n if (isServiceProvider) {\n return Promise.resolve(dispatch(getRoles()));\n }\n const tasks: Promise<unknown>[] = [\n dispatch(getDeviceAttributes()),\n dispatch(getDeploymentsByStatus({ status: DEPLOYMENT_STATES.finished, shouldSelect: false })),\n dispatch(getDeploymentsByStatus({ status: DEPLOYMENT_STATES.inprogress })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.accepted })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.pending })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.preauth })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.rejected })),\n dispatch(getDynamicGroups()),\n dispatch(getGroups()),\n dispatch(getIntegrations()),\n dispatch(getReleases()),\n dispatch(getAllDeviceCounts()).unwrap()\n ];\n if (hasMultitenancy) {\n tasks.push(dispatch(getDeviceLimits()));\n tasks.push(dispatch(getRoles()));\n }\n return Promise.all(tasks);\n }, [dispatch, hasMultitenancy, isServiceProvider]);\n\n const interpretAppData = useCallback((): Promise<unknown[]> => {\n const settings: Partial<UserSettings> = {};\n if (cookies.get('_ga') && typeof hasTrackingEnabled === 'undefined') {\n settings.trackingConsentGiven = true;\n }\n let tasks: Promise<unknown>[] = [\n Promise.resolve(dispatch(setDeviceListState({ selectedAttributes: columnSelection.map(column => ({ attribute: column.key, scope: column.scope })) }))),\n Promise.resolve(dispatch(setTooltipsState(tooltips as UserSliceType['tooltips']['byId']))), // tooltips read state is primarily trusted from the redux store, except on app init - here user settings are the reference\n dispatch(saveUserSettings(settings)).unwrap()\n ];\n // checks if user id is set and if cookie for helptips exists for that user\n tasks = maybeAddOnboardingTasks({ devicesByStatus, dispatch, tasks, onboardingState });\n\n if (canManageUsers && intervalUnit && intervalUnit !== timeUnits.days) {\n const duration = dayjs.duration(interval, intervalUnit as keyof typeof timeUnits);\n const days = duration.asDays();\n if (days < 1) {\n tasks.push(Promise.resolve(setTimeout(() => dispatch(setShowStartupNotification(true)), TIMEOUTS.fiveSeconds)));\n } else {\n const roundedDays = Math.max(1, Math.round(days));\n tasks.push(dispatch(saveGlobalSettings({ offlineThreshold: { interval: roundedDays, intervalUnit: timeUnits.days } })));\n }\n }\n\n // the following is used as a migration and initialization of the stored identity attribute\n // changing the default device attribute to the first non-deviceId attribute, unless a stored\n // id attribute setting exists\n const identityOptions = identityAttributes.filter(attribute => !['id', 'Device ID', 'status'].includes(attribute));\n if (!id_attribute && identityOptions.length) {\n tasks.push(dispatch(saveGlobalSettings({ id_attribute: { attribute: identityOptions[0], scope: 'identity' } })));\n } else if (typeof id_attribute === 'string') {\n // Legacy migration path: id_attribute used to be a plain string\n let attribute: string = id_attribute;\n if (attribute === 'Device ID') {\n attribute = 'id';\n }\n tasks.push(dispatch(saveGlobalSettings({ id_attribute: { attribute, scope: 'identity' } })));\n }\n tasks.push(Promise.resolve(dispatch(storeActions.setAppInitDone())));\n return Promise.all(tasks);\n }, [\n columnSelection,\n dispatch,\n identityAttributes,\n hasTrackingEnabled,\n canManageUsers,\n devicesByStatus,\n id_attribute,\n interval,\n intervalUnit,\n onboardingState,\n tooltips\n ]);\n\n const initializeAppData = useCallback(\n (): Promise<unknown> =>\n retrieveAppData()\n .then(interpretAppData)\n // this is allowed to fail if no user information are available\n .catch(err => console.log(extractErrorMessage(err)))\n .then(() => dispatch(getOnboardingState())),\n [dispatch, retrieveAppData, interpretAppData]\n );\n\n useEffect(() => {\n if (!userId || coreInitRunning.current) {\n return;\n }\n coreInitRunning.current = true;\n retrieveCoreData().then(() => setCoreInitDone(true));\n }, [userId, retrieveCoreData]);\n\n useEffect(() => {\n if (fullInitRunning.current || !coreInitDone) {\n return;\n }\n fullInitRunning.current = true;\n initializeAppData();\n }, [initializeAppData, coreInitDone]);\n\n return { coreInitDone };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,UAAU,IAAIA,iBAAAA,SAAS;AAC7B,MAAA,QAAM,OAAOC,yBAAAA,QAAc;AAE3B,MAAM,EAAE,oBAAoB,0BAA0B,kBAAkB,+BAA+BC;AAEvG,MAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AASD,MAAa,uBAAuBC,cAAAA,oBAAoB,6BAA6B,GAAG,EAAE,UAAU,eAAe;CACjH,MAAM,QAAQ,UAAU;CACxB,IAAI,qBAAqBC,wBAAAA,mBAA2B,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,MAAM,OAAO,aAAa,QAAQ,qBAAqB,IAAI,QAAQ;CACjJ,IAAI,mBAAmB;CACvB,IAAI,kBAA2C,EAAE;CACjD,IAAI,sBAAyC,EAAE;CAC/C,IAAI,cAA2B,EAAE;CACjC,MAAM,qBAAqB,OAAO;CAClC,IAAI,oBAAoB;EACtB,MAAM,EAAE,WAAW,EAAE,EAAE,kBAAkB,MAAM,mBAAmB,oBAAoB,uBAAuB,sBAAsB;EACnI,mB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B,EAAE,cAAc;IAAE;IAAW,OAAO;IAAY,EAAE,CAAC,CAAC,CAAC;;EAE9F,MAAM,KAAK,QAAQ,QAAQ,SAASrC,gBAAa,gBAAgB,CAAC,CAAC,CAAC;EACpE,OAAO,QAAQ,IAAI,MAAM;IACxB;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,qBAAA,GAAA,MAAA,mBAEF,iBAAiB,CACd,KAAK,iBAAiB,CAEtB,OAAM,QAAO,QAAQ,KAAA,GAAA,6BAAA,qBAAwB,IAAI,CAAC,CAAC,CACnD,WAAW,SAASsC,eAAAA,oBAAoB,CAAC,CAAC,EAC/C;EAAC;EAAU;EAAiB;EAAiB,CAC9C;CAED,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,CAAC,UAAU,gBAAgB,SAC7B;EAEF,gBAAgB,UAAU;EAC1B,kBAAkB,CAAC,WAAW,gBAAgB,KAAK,CAAC;IACnD,CAAC,QAAQ,iBAAiB,CAAC;CAE9B,CAAA,GAAA,MAAA,iBAAgB;EACd,IAAI,gBAAgB,WAAW,CAAC,cAC9B;EAEF,gBAAgB,UAAU;EAC1B,mBAAmB;IAClB,CAAC,mBAAmB,aAAa,CAAC;CAErC,OAAO,EAAE,cAAc"}
|
|
1
|
+
{"version":3,"file":"storehooks.cjs","names":["Cookies","durationDayJs","storeActions","createAppAsyncThunk","getOnboardingStateSelector","stringToBoolean","getSessionInfo","DEVICE_STATES","getDeviceById","useAppDispatch","useAppSelector","getIsEnterprise","getFeatures","getDevicesByStatusSelector","getUserSettingsSelector","getUserCapabilities","getOfflineThresholdSettings","getGlobalSettingsSelector","getSortedFilteringAttributes","getIsServiceProvider","getUserSettings","getGlobalSettings","getUserOrganization","getRoles","getDeviceAttributes","getDeploymentsByStatus","DEPLOYMENT_STATES","getDevicesByStatus","getDynamicGroups","getGroups","getIntegrations","getReleases","getAllDeviceCounts","getDeviceLimits","saveUserSettings","timeUnits","TIMEOUTS","saveGlobalSettings","getOnboardingState"],"sources":["../src/storehooks.ts"],"sourcesContent":["// Copyright 2024 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 { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { extractErrorMessage } from '@northern.tech/utils/helpers';\nimport dayjs from 'dayjs';\nimport durationDayJs from 'dayjs/plugin/duration.js';\nimport Cookies from 'universal-cookie';\n\nimport storeActions from './actions';\nimport { getSessionInfo } from './auth';\nimport { DEPLOYMENT_STATES, DEVICE_STATES, TIMEOUTS, timeUnits } from './constants';\nimport type { DeviceSliceType } from './devicesSlice';\nimport {\n getDevicesByStatus as getDevicesByStatusSelector,\n getFeatures,\n getGlobalSettings as getGlobalSettingsSelector,\n getIsEnterprise,\n getIsServiceProvider,\n getOfflineThresholdSettings,\n getOnboardingState as getOnboardingStateSelector,\n getSortedFilteringAttributes,\n getUserCapabilities,\n getUserSettings as getUserSettingsSelector\n} from './selectors';\nimport { createAppAsyncThunk, useAppDispatch, useAppSelector } from './store';\nimport type { AppDispatch } from './store';\nimport {\n getAllDeviceCounts,\n getDeploymentsByStatus,\n getDeviceAttributes,\n getDeviceById,\n getDeviceLimits,\n getDevicesByStatus,\n getDynamicGroups,\n getGlobalSettings,\n getGroups,\n getIntegrations,\n getOnboardingState,\n getReleases,\n getRoles,\n getUserOrganization,\n getUserSettings,\n saveGlobalSettings,\n saveUserSettings\n} from './thunks';\nimport type { UserSettings, UserSliceType } from './usersSlice';\nimport { stringToBoolean } from './utils';\n\nconst cookies = new Cookies();\ndayjs.extend(durationDayJs);\n\nconst { setDeviceListState, setFirstLoginAfterSignup, setTooltipsState, setShowStartupNotification } = storeActions;\n\nconst featureFlags = [\n 'hasAiEnabled',\n 'hasAuditlogs',\n 'hasMultitenancy',\n 'hasDeltaProgress',\n 'hasDeviceConfig',\n 'hasDeviceConnect',\n 'hasFeedbackEnabled',\n 'hasManifestsEnabled',\n 'hasMonitor',\n 'hasMCUEnabled',\n 'isEnterprise'\n] as const;\n\nconst environmentDatas = [\n 'commit',\n 'feedbackProbability',\n 'hostAddress',\n 'hostedAnnouncement',\n 'recaptchaSiteKey',\n 'sentry',\n 'stripeAPIKey',\n 'trackerCode'\n] as const;\n\ntype VersionInfo = {\n docsVersion?: string;\n version?: string;\n};\n\ntype FeatureFlagsState = Record<string, boolean>;\n\nexport const parseEnvironmentInfo = createAppAsyncThunk(`app/parseEnvironmentInfo`, (_, { dispatch, getState }) => {\n const state = getState();\n let onboardingComplete = getOnboardingStateSelector(state).complete || !!JSON.parse(window.localStorage.getItem('onboardingComplete') ?? 'false');\n let demoArtifactPort = 85;\n let environmentData: Record<string, unknown> = {};\n let environmentFeatures: FeatureFlagsState = {};\n let versionInfo: VersionInfo = {};\n const mender_environment = window.mender_environment;\n if (mender_environment) {\n const { features = {}, demoArtifactPort: port, disableOnboarding, version } = mender_environment;\n demoArtifactPort = Number(port) || demoArtifactPort;\n const appState = state.app;\n environmentData = environmentDatas.reduce((accu, flag) => ({ ...accu, [flag]: mender_environment[flag] || appState[flag as keyof typeof appState] }), {});\n environmentFeatures = {\n ...featureFlags.reduce<FeatureFlagsState>((accu, flag) => ({ ...accu, [flag]: stringToBoolean(features[flag]) }), {}),\n isHosted: stringToBoolean(features.isHosted) || window.location.hostname.includes('hosted.mender.io')\n };\n onboardingComplete = !environmentFeatures.isHosted || stringToBoolean(disableOnboarding) || onboardingComplete;\n versionInfo = {\n docsVersion: isNaN(parseInt(version.charAt(0))) ? '' : version.split('.').slice(0, 2).join('.'),\n version\n };\n }\n return Promise.all([\n dispatch(storeActions.successfullyLoggedIn(getSessionInfo())),\n dispatch(storeActions.setOnboardingComplete(onboardingComplete)),\n dispatch(storeActions.setDemoArtifactPort(demoArtifactPort)),\n dispatch(storeActions.setFeatures(environmentFeatures)),\n dispatch(storeActions.setVersionInformation(versionInfo)),\n dispatch(storeActions.setEnvironmentData(environmentData))\n ]);\n});\n\ntype OnboardingState = {\n complete?: boolean;\n showTips?: boolean | null;\n};\n\ntype MaybeAddOnboardingTasksParams = {\n devicesByStatus: DeviceSliceType['byStatus'];\n dispatch: AppDispatch;\n onboardingState: OnboardingState;\n tasks: Promise<unknown>[];\n};\n\nconst maybeAddOnboardingTasks = ({ devicesByStatus, dispatch, onboardingState, tasks }: MaybeAddOnboardingTasksParams): Promise<unknown>[] => {\n if (!onboardingState.showTips || onboardingState.complete) {\n return tasks;\n }\n // try to retrieve full device details for onboarding devices to ensure ips etc. are available\n // we only load the first few/ 20 devices, as it is possible the onboarding is left dangling\n // and a lot of devices are present and we don't want to flood the backend for this\n return devicesByStatus[DEVICE_STATES.accepted].deviceIds.reduce<Promise<unknown>[]>((accu, id) => {\n accu.push(dispatch(getDeviceById(id)));\n return accu;\n }, tasks);\n};\n\nexport const useAppInit = (userId: string | undefined): { coreInitDone: boolean } => {\n const dispatch = useAppDispatch();\n const [coreInitDone, setCoreInitDone] = useState(false);\n const isEnterprise = useAppSelector(getIsEnterprise);\n const { hasMultitenancy, isHosted } = useAppSelector(getFeatures);\n const devicesByStatus = useAppSelector(getDevicesByStatusSelector);\n const onboardingState = useAppSelector(getOnboardingStateSelector);\n const { columnSelection = [], trackingConsentGiven: hasTrackingEnabled, tooltips = {} } = useAppSelector(getUserSettingsSelector);\n const { canManageUsers } = useAppSelector(getUserCapabilities);\n const { interval, intervalUnit } = useAppSelector(getOfflineThresholdSettings);\n const { id_attribute } = useAppSelector(getGlobalSettingsSelector);\n const { identityAttributes } = useAppSelector(getSortedFilteringAttributes);\n const isServiceProvider = useAppSelector(getIsServiceProvider);\n const coreInitRunning = useRef(false);\n const fullInitRunning = useRef(false);\n\n const retrieveCoreData = useCallback((): Promise<unknown[]> => {\n const tasks: Promise<unknown>[] = [\n dispatch(parseEnvironmentInfo()).unwrap(),\n dispatch(getUserSettings()).unwrap(),\n dispatch(getGlobalSettings()).unwrap(),\n Promise.resolve(dispatch(setFirstLoginAfterSignup(stringToBoolean(cookies.get('firstLoginAfterSignup')))))\n ];\n const multitenancy = hasMultitenancy || isHosted || isEnterprise;\n if (multitenancy) {\n tasks.push(dispatch(getUserOrganization()).unwrap());\n }\n return Promise.all(tasks);\n }, [dispatch, hasMultitenancy, isHosted, isEnterprise]);\n\n const retrieveAppData = useCallback((): Promise<unknown[] | unknown> => {\n if (isServiceProvider) {\n return Promise.resolve(dispatch(getRoles()));\n }\n const tasks: Promise<unknown>[] = [\n dispatch(getDeviceAttributes()),\n dispatch(getDeploymentsByStatus({ status: DEPLOYMENT_STATES.finished, shouldSelect: false })),\n dispatch(getDeploymentsByStatus({ status: DEPLOYMENT_STATES.inprogress })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.accepted })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.pending })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.preauth })),\n dispatch(getDevicesByStatus({ status: DEVICE_STATES.rejected })),\n dispatch(getDynamicGroups()),\n dispatch(getGroups()),\n dispatch(getIntegrations()),\n dispatch(getReleases()),\n dispatch(getAllDeviceCounts()).unwrap()\n ];\n if (hasMultitenancy) {\n tasks.push(dispatch(getDeviceLimits()));\n tasks.push(dispatch(getRoles()));\n }\n return Promise.all(tasks);\n }, [dispatch, hasMultitenancy, isServiceProvider]);\n\n const interpretAppData = useCallback((): Promise<unknown[]> => {\n const settings: Partial<UserSettings> = {};\n if (cookies.get('_ga') && typeof hasTrackingEnabled === 'undefined') {\n settings.trackingConsentGiven = true;\n }\n let tasks: Promise<unknown>[] = [\n Promise.resolve(dispatch(setDeviceListState({ selectedAttributes: columnSelection.map(column => ({ attribute: column.key, scope: column.scope })) }))),\n Promise.resolve(dispatch(setTooltipsState(tooltips as UserSliceType['tooltips']['byId']))), // tooltips read state is primarily trusted from the redux store, except on app init - here user settings are the reference\n dispatch(saveUserSettings(settings)).unwrap()\n ];\n // checks if user id is set and if cookie for helptips exists for that user\n tasks = maybeAddOnboardingTasks({ devicesByStatus, dispatch, tasks, onboardingState });\n\n if (canManageUsers && intervalUnit && intervalUnit !== timeUnits.days) {\n const duration = dayjs.duration(interval, intervalUnit as keyof typeof timeUnits);\n const days = duration.asDays();\n if (days < 1) {\n tasks.push(Promise.resolve(setTimeout(() => dispatch(setShowStartupNotification(true)), TIMEOUTS.fiveSeconds)));\n } else {\n const roundedDays = Math.max(1, Math.round(days));\n tasks.push(dispatch(saveGlobalSettings({ offlineThreshold: { interval: roundedDays, intervalUnit: timeUnits.days } })));\n }\n }\n\n // the following is used as a migration and initialization of the stored identity attribute\n // changing the default device attribute to the first non-deviceId attribute, unless a stored\n // id attribute setting exists\n const identityOptions = identityAttributes.filter(attribute => !['id', 'Device ID', 'status'].includes(attribute));\n if (!id_attribute && identityOptions.length) {\n tasks.push(dispatch(saveGlobalSettings({ id_attribute: { attribute: identityOptions[0], scope: 'identity' } })));\n } else if (typeof id_attribute === 'string') {\n // Legacy migration path: id_attribute used to be a plain string\n let attribute: string = id_attribute;\n if (attribute === 'Device ID') {\n attribute = 'id';\n }\n tasks.push(dispatch(saveGlobalSettings({ id_attribute: { attribute, scope: 'identity' } })));\n }\n tasks.push(Promise.resolve(dispatch(storeActions.setAppInitDone())));\n return Promise.all(tasks);\n }, [\n columnSelection,\n dispatch,\n identityAttributes,\n hasTrackingEnabled,\n canManageUsers,\n devicesByStatus,\n id_attribute,\n interval,\n intervalUnit,\n onboardingState,\n tooltips\n ]);\n\n const initializeAppData = useCallback(\n (): Promise<unknown> =>\n retrieveAppData()\n .then(interpretAppData)\n // this is allowed to fail if no user information are available\n .catch(err => console.log(extractErrorMessage(err)))\n .then(() => dispatch(getOnboardingState())),\n [dispatch, retrieveAppData, interpretAppData]\n );\n\n useEffect(() => {\n if (!userId || coreInitRunning.current) {\n return;\n }\n coreInitRunning.current = true;\n retrieveCoreData().then(() => setCoreInitDone(true));\n }, [userId, retrieveCoreData]);\n\n useEffect(() => {\n if (fullInitRunning.current || !coreInitDone) {\n return;\n }\n fullInitRunning.current = true;\n initializeAppData();\n }, [initializeAppData, coreInitDone]);\n\n return { coreInitDone };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,UAAU,IAAIA,iBAAAA,QAAQ;AAC5B,MAAA,QAAM,OAAOC,yBAAAA,OAAa;AAE1B,MAAM,EAAE,oBAAoB,0BAA0B,kBAAkB,+BAA+BC;AAEvG,MAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AASA,MAAa,uBAAuBC,cAAAA,oBAAoB,6BAA6B,GAAG,EAAE,UAAU,eAAe;CACjH,MAAM,QAAQ,SAAS;CACvB,IAAI,qBAAqBC,wBAAAA,mBAA2B,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK,MAAM,OAAO,aAAa,QAAQ,oBAAoB,KAAK,OAAO;CAChJ,IAAI,mBAAmB;CACvB,IAAI,kBAA2C,CAAC;CAChD,IAAI,sBAAyC,CAAC;CAC9C,IAAI,cAA2B,CAAC;CAChC,MAAM,qBAAqB,OAAO;CAClC,IAAI,oBAAoB;EACtB,MAAM,EAAE,WAAW,CAAC,GAAG,kBAAkB,MAAM,mBAAmB,YAAY;EAC9E,mBAAmB,OAAO,IAAI,KAAK;EACnC,MAAM,WAAW,MAAM;EACvB,kBAAkB,iBAAiB,QAAQ,MAAM,UAAU;GAAE,GAAG;IAAO,OAAO,mBAAmB,SAAS,SAAS;EAA+B,IAAI,CAAC,CAAC;EACxJ,sBAAsB;GACpB,GAAG,aAAa,QAA2B,MAAM,UAAU;IAAE,GAAG;KAAO,OAA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