@northern.tech/store 0.42.0 → 0.44.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 (97) hide show
  1. package/dist/actions.d.cts +3 -3
  2. package/dist/actions.d.ts +3 -3
  3. package/dist/appSlice/index.cjs +1 -0
  4. package/dist/appSlice/index.cjs.map +1 -1
  5. package/dist/appSlice/index.js +1 -0
  6. package/dist/appSlice/index.js.map +1 -1
  7. package/dist/appSlice/selectors.d.cts +3 -3
  8. package/dist/appSlice/selectors.d.ts +3 -3
  9. package/dist/appSlice/thunks.d.cts +1 -1
  10. package/dist/appSlice/thunks.d.ts +1 -1
  11. package/dist/auth.d.cts +1 -1
  12. package/dist/auth.d.ts +1 -1
  13. package/dist/commonSelectors.d.cts +3 -3
  14. package/dist/commonSelectors.d.ts +3 -3
  15. package/dist/deploymentsSlice/selectors.d.cts +3 -3
  16. package/dist/deploymentsSlice/selectors.d.ts +3 -3
  17. package/dist/deploymentsSlice/thunks.d.cts +2 -2
  18. package/dist/deploymentsSlice/thunks.d.ts +2 -2
  19. package/dist/devicesSlice/index.cjs +4 -1
  20. package/dist/devicesSlice/index.cjs.map +1 -1
  21. package/dist/devicesSlice/index.d.cts +2 -2
  22. package/dist/devicesSlice/index.d.ts +2 -2
  23. package/dist/devicesSlice/index.js +4 -1
  24. package/dist/devicesSlice/index.js.map +1 -1
  25. package/dist/devicesSlice/mocks.d.cts +1 -0
  26. package/dist/devicesSlice/mocks.d.ts +1 -0
  27. package/dist/devicesSlice/selectors.cjs +2 -0
  28. package/dist/devicesSlice/selectors.cjs.map +1 -1
  29. package/dist/devicesSlice/selectors.d.cts +35 -34
  30. package/dist/devicesSlice/selectors.d.ts +35 -34
  31. package/dist/devicesSlice/selectors.js +2 -1
  32. package/dist/devicesSlice/selectors.js.map +1 -1
  33. package/dist/devicesSlice/thunks.cjs +1 -0
  34. package/dist/devicesSlice/thunks.d.cts +18 -5
  35. package/dist/devicesSlice/thunks.d.ts +18 -5
  36. package/dist/devicesSlice/thunks.js +2 -2
  37. package/dist/{index-Bvyf8OO6.d.ts → index-BpamudGf.d.ts} +8 -6
  38. package/dist/{index-CpfhQHfg.d.ts → index-C0yQmQih.d.ts} +4 -2
  39. package/dist/{index-BgF6rhXn.d.cts → index-DjSjrp5b.d.cts} +4 -2
  40. package/dist/{index-CiQ95u1W.d.cts → index-DnKVKM0G.d.cts} +8 -6
  41. package/dist/locationutils.d.cts +1 -1
  42. package/dist/locationutils.d.ts +1 -1
  43. package/dist/monitorSlice/selectors.d.cts +1 -1
  44. package/dist/monitorSlice/selectors.d.ts +1 -1
  45. package/dist/monitorSlice/thunks.d.cts +2 -2
  46. package/dist/monitorSlice/thunks.d.ts +2 -2
  47. package/dist/onboardingSlice/selectors.d.cts +1 -1
  48. package/dist/onboardingSlice/selectors.d.ts +1 -1
  49. package/dist/onboardingSlice/thunks.d.cts +2 -2
  50. package/dist/onboardingSlice/thunks.d.ts +2 -2
  51. package/dist/organizationSlice/selectors.d.cts +3 -3
  52. package/dist/organizationSlice/selectors.d.ts +3 -3
  53. package/dist/organizationSlice/thunks.cjs +1 -0
  54. package/dist/organizationSlice/thunks.d.cts +16 -3
  55. package/dist/organizationSlice/thunks.d.ts +16 -3
  56. package/dist/organizationSlice/thunks.js +2 -2
  57. package/dist/releasesSlice/selectors.d.cts +3 -3
  58. package/dist/releasesSlice/selectors.d.ts +3 -3
  59. package/dist/releasesSlice/thunks.cjs +5 -8
  60. package/dist/releasesSlice/thunks.cjs.map +1 -1
  61. package/dist/releasesSlice/thunks.d.cts +1 -1
  62. package/dist/releasesSlice/thunks.d.ts +1 -1
  63. package/dist/releasesSlice/thunks.js +5 -8
  64. package/dist/releasesSlice/thunks.js.map +1 -1
  65. package/dist/selectors.cjs +1 -0
  66. package/dist/selectors.d.cts +2 -2
  67. package/dist/selectors.d.ts +2 -2
  68. package/dist/selectors.js +2 -2
  69. package/dist/{store-CPptM5Ts.d.ts → store-BKVs6gSc.d.ts} +3 -3
  70. package/dist/{store-CUUm1GTI.d.cts → store-ByJVpIz9.d.cts} +3 -3
  71. package/dist/store.d.cts +1 -1
  72. package/dist/store.d.ts +1 -1
  73. package/dist/storehooks.cjs +3 -1
  74. package/dist/storehooks.cjs.map +1 -1
  75. package/dist/storehooks.d.cts +2 -2
  76. package/dist/storehooks.d.ts +2 -2
  77. package/dist/storehooks.js +3 -1
  78. package/dist/storehooks.js.map +1 -1
  79. package/dist/thunks.cjs +17 -1
  80. package/dist/thunks.cjs.map +1 -1
  81. package/dist/thunks.d.cts +3 -3
  82. package/dist/thunks.d.ts +3 -3
  83. package/dist/thunks.js +17 -3
  84. package/dist/thunks.js.map +1 -1
  85. package/dist/usersSlice/index.cjs.map +1 -1
  86. package/dist/usersSlice/index.d.cts +1 -1
  87. package/dist/usersSlice/index.d.ts +1 -1
  88. package/dist/usersSlice/index.js.map +1 -1
  89. package/dist/usersSlice/mocks.d.cts +1 -1
  90. package/dist/usersSlice/mocks.d.ts +1 -1
  91. package/dist/usersSlice/selectors.d.cts +3 -3
  92. package/dist/usersSlice/selectors.d.ts +3 -3
  93. package/dist/usersSlice/thunks.d.cts +2 -2
  94. package/dist/usersSlice/thunks.d.ts +2 -2
  95. package/dist/utils.d.cts +1 -1
  96. package/dist/utils.d.ts +1 -1
  97. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import { ht as DeviceAuthState, ut as AlertChannelKey } from "./constants-Rl3FJzFf.cjs";
2
2
  import { i as ReadState } from "./constants-B3Jdkn2b.cjs";
3
- import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User, t as CustomColumn } from "./index-BgF6rhXn.cjs";
3
+ import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User, t as CustomColumn } from "./index-DjSjrp5b.cjs";
4
4
  import { n as ManifestsList, r as Release, s as SoftwareList } from "./index-DiAjzARZ.cjs";
5
5
  import { d as TenantList, i as Organization, l as SSOConfig, n as AuditLogSelectionState, o as ProductConfig, r as Card } from "./types-B80ckxiy.cjs";
6
6
  import { n as OnboardingSliceType, t as OnboardingApproach } from "./index-CoObjWL4.cjs";
7
7
  import { i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "./index-mvxjivTJ.cjs";
8
- import { i as DeviceGroup, o as DeviceListState, r as DeviceFilter, t as Device } from "./index-CiQ95u1W.cjs";
8
+ import { i as DeviceGroup, l as DeviceTierLimits, o as DeviceListState, r as DeviceFilter, t as Device } from "./index-DnKVKM0G.cjs";
9
9
  import { a as Upload, i as SnackbarContent } from "./index-DeOpb2oK.cjs";
10
10
  //#region src/actions.d.ts
11
11
  declare const _default: {
@@ -156,7 +156,7 @@ declare const _default: {
156
156
  total: number;
157
157
  }, "devices/setDevicesByStatus">;
158
158
  setDevicesCountByStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
159
- countsPerTier: import("@northern.tech/types/types.gen").DeviceTierLimits;
159
+ countsPerTier: DeviceTierLimits;
160
160
  status: DeviceAuthState;
161
161
  }, "devices/setDevicesCountByStatus">;
162
162
  setDeviceLimits: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("@northern.tech/types/types.gen").DeviceTierLimits, "devices/setDeviceLimits">;
package/dist/actions.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { ht as DeviceAuthState, ut as AlertChannelKey } from "./constants-B_H4squx.js";
2
2
  import { i as ReadState } from "./constants-B3Jdkn2b.js";
3
- import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User, t as CustomColumn } from "./index-CpfhQHfg.js";
3
+ import { a as UserSettings, i as UserSession, n as GlobalSettings, r as User, t as CustomColumn } from "./index-C0yQmQih.js";
4
4
  import { n as ManifestsList, r as Release, s as SoftwareList } from "./index-C8uiyxnb.js";
5
5
  import { d as TenantList, i as Organization, l as SSOConfig, n as AuditLogSelectionState, o as ProductConfig, r as Card } from "./types-B3qGQoMx.js";
6
6
  import { n as OnboardingSliceType, t as OnboardingApproach } from "./index-CoObjWL4.js";
7
7
  import { i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "./index-B8td4-rY.js";
8
- import { i as DeviceGroup, o as DeviceListState, r as DeviceFilter, t as Device } from "./index-Bvyf8OO6.js";
8
+ import { i as DeviceGroup, l as DeviceTierLimits, o as DeviceListState, r as DeviceFilter, t as Device } from "./index-BpamudGf.js";
9
9
  import { a as Upload, i as SnackbarContent } from "./index-Bs0c1-WY.js";
10
10
  //#region src/actions.d.ts
11
11
  declare const _default: {
@@ -156,7 +156,7 @@ declare const _default: {
156
156
  total: number;
157
157
  }, "devices/setDevicesByStatus">;
158
158
  setDevicesCountByStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
159
- countsPerTier: import("@northern.tech/types/types.gen").DeviceTierLimits;
159
+ countsPerTier: DeviceTierLimits;
160
160
  status: DeviceAuthState;
161
161
  }, "devices/setDevicesCountByStatus">;
162
162
  setDeviceLimits: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("@northern.tech/types/types.gen").DeviceTierLimits, "devices/setDeviceLimits">;
@@ -36,6 +36,7 @@ const initialState = {
36
36
  hasManifestsEnabled: false,
37
37
  hasMonitor: false,
38
38
  hasMCUEnabled: false,
39
+ hasNewSearch: false,
39
40
  isHosted: true,
40
41
  isEnterprise: false
41
42
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["SORTING_OPTIONS","createSlice"],"sources":["../../src/appSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type { SnackbarProps } from '@mui/material';\n\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { SortOptions } from '../constants';\nimport { SORTING_OPTIONS } from '../constants';\n\nexport const sliceName = 'app';\n\nconst getYesterday = () => {\n const today = new Date();\n today.setDate(today.getDate() - 1);\n return today.toISOString();\n};\n\nexport interface SnackbarContent extends Pick<SnackbarProps, 'action' | 'autoHideDuration' | 'message' | 'open'> {\n preventClickToCopy?: boolean;\n}\n\nexport interface SearchState {\n deviceIds: string[];\n isSearching: boolean;\n page?: number;\n perPage?: number;\n searchTerm: string;\n searchTotal: number;\n sort: SortOptions;\n}\n\nexport interface Upload {\n cancelSource: any;\n inprogress?: boolean;\n name?: string;\n progress: number;\n size?: number;\n}\n\ntype VersionInformation = {\n docsVersion?: string;\n version?: string;\n};\n\nexport type SentryConfig = {\n isReduxEnabled?: string; // no parsing done here as this has to be accessed outside of the store\n location: string;\n replaysSessionSampleRate?: number;\n tracesSampleRate?: number;\n};\n\nexport type AppSliceType = {\n appInitDone: boolean;\n cancelSource: any;\n commit: string;\n demoArtifactLink: string;\n docsVersion: string;\n features: Record<string, boolean>;\n feedbackProbability: number;\n firstLoginAfterSignup: boolean;\n hostAddress: string | null;\n hostedAnnouncement: string;\n newThreshold: string;\n offlineThreshold: string;\n recaptchaSiteKey: string;\n searchState: SearchState;\n sentry: SentryConfig;\n snackbar: SnackbarContent;\n stripeAPIKey: string;\n trackerCode: string;\n uploadsById: Record<string, Upload>;\n versionInformation: VersionInformation;\n yesterday?: string;\n};\n\nexport const initialState: AppSliceType = {\n appInitDone: false,\n cancelSource: undefined,\n commit: '',\n demoArtifactLink: 'https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender',\n hostAddress: null,\n snackbar: {\n action: undefined,\n autoHideDuration: undefined,\n message: '',\n open: false,\n preventClickToCopy: false\n },\n // return boolean rather than organization details\n features: {\n hasAiEnabled: false,\n hasAuditlogs: false,\n hasDeltaProgress: false,\n hasMultitenancy: false,\n hasDeviceConfig: false,\n hasDeviceConnect: false,\n hasDeviceFlags: false,\n hasFeedbackEnabled: false,\n hasManifestsEnabled: false,\n hasMonitor: false,\n hasMCUEnabled: false,\n isHosted: true,\n isEnterprise: false\n },\n feedbackProbability: 0.3,\n firstLoginAfterSignup: false,\n hostedAnnouncement: '',\n docsVersion: '',\n recaptchaSiteKey: '',\n searchState: {\n deviceIds: [],\n searchTerm: '',\n searchTotal: 0,\n isSearching: false,\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n }\n },\n sentry: {\n location: '',\n replaysSessionSampleRate: 0.1,\n tracesSampleRate: 1.0\n },\n stripeAPIKey: '',\n trackerCode: '',\n uploadsById: {\n // id: { progress: 0, cancelSource: undefined }\n },\n newThreshold: getYesterday(),\n offlineThreshold: getYesterday(),\n versionInformation: { docsVersion: '', version: '' },\n yesterday: undefined\n};\n\nexport const appSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setFeatures: (state, action: PayloadAction<Record<string, boolean>>) => {\n state.features = {\n ...state.features,\n ...action.payload\n };\n },\n setSnackbar: (state, { payload }: PayloadAction<SnackbarContent | string>) => {\n if (typeof payload === 'string' || payload instanceof String) {\n state.snackbar = {\n ...initialState.snackbar,\n message: payload,\n open: !!payload\n };\n return;\n }\n const { message, autoHideDuration, action, preventClickToCopy = false } = payload;\n state.snackbar = {\n message,\n autoHideDuration,\n action,\n preventClickToCopy,\n open: !!message\n };\n },\n setFirstLoginAfterSignup: (state, action: PayloadAction<boolean>) => {\n state.firstLoginAfterSignup = action.payload;\n },\n setAnnouncement: (state, action: PayloadAction<string>) => {\n state.hostedAnnouncement = action.payload;\n },\n setSearchState: (state, action) => {\n state.searchState = {\n ...state.searchState,\n ...action.payload\n };\n },\n setOfflineThreshold: (state, action: PayloadAction<string>) => {\n state.offlineThreshold = action.payload;\n },\n initUpload: (state, action: PayloadAction<{ id: string; upload: Upload }>) => {\n const { id, upload } = action.payload;\n state.uploadsById[id] = upload;\n },\n uploadProgress: (state, action: PayloadAction<{ id: string; progress: number }>) => {\n const { id, progress } = action.payload;\n state.uploadsById[id] = {\n ...state.uploadsById[id],\n progress\n };\n },\n cleanUpUpload: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: current, ...remainder } = state.uploadsById;\n state.uploadsById = remainder;\n },\n setVersionInformation: (state, action: PayloadAction<VersionInformation>) => {\n state.versionInformation = {\n ...state.versionInformation,\n ...action.payload\n };\n },\n setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),\n setAppInitDone: state => {\n state.appInitDone = true;\n }\n }\n});\n\nexport const actions = appSlice.actions;\nexport default appSlice.reducer;\n"],"mappings":";;;;;;;AAqBA,MAAa,YAAY;AAEzB,MAAM,qBAAqB;CACzB,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;CACjC,OAAO,MAAM,YAAY;AAC3B;AA4DA,MAAa,eAA6B;CACxC,aAAa;CACb,cAAc,KAAA;CACd,QAAQ;CACR,kBAAkB;CAClB,aAAa;CACb,UAAU;EACR,QAAQ,KAAA;EACR,kBAAkB,KAAA;EAClB,SAAS;EACT,MAAM;EACN,oBAAoB;CACtB;CAEA,UAAU;EACR,cAAc;EACd,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB,gBAAgB;EAChB,oBAAoB;EACpB,qBAAqB;EACrB,YAAY;EACZ,eAAe;EACf,UAAU;EACV,cAAc;CAChB;CACA,qBAAqB;CACrB,uBAAuB;CACvB,oBAAoB;CACpB,aAAa;CACb,kBAAkB;CAClB,aAAa;EACX,WAAW,CAAC;EACZ,YAAY;EACZ,aAAa;EACb,aAAa;EACb,MAAM,EACJ,WAAWA,+BAAAA,gBAAgB,KAG7B;CACF;CACA,QAAQ;EACN,UAAU;EACV,0BAA0B;EAC1B,kBAAkB;CACpB;CACA,cAAc;CACd,aAAa;CACb,aAAa,CAEb;CACA,cAAc,aAAa;CAC3B,k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AAO,YAAY;GAAE,GAAG;GAAO,GAAG,OAAO;EAAQ;EACtE,iBAAgB,UAAS;GACvB,MAAM,cAAc;EACtB;CACF;AACF,CAAC;AAED,MAAa,UAAU,SAAS;AAChC,IAAA,mBAAe,SAAS"}
1
+ {"version":3,"file":"index.cjs","names":["SORTING_OPTIONS","createSlice"],"sources":["../../src/appSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type { SnackbarProps } from '@mui/material';\n\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { SortOptions } from '../constants';\nimport { SORTING_OPTIONS } from '../constants';\n\nexport const sliceName = 'app';\n\nconst getYesterday = () => {\n const today = new Date();\n today.setDate(today.getDate() - 1);\n return today.toISOString();\n};\n\nexport interface SnackbarContent extends Pick<SnackbarProps, 'action' | 'autoHideDuration' | 'message' | 'open'> {\n preventClickToCopy?: boolean;\n}\n\nexport interface SearchState {\n deviceIds: string[];\n isSearching: boolean;\n page?: number;\n perPage?: number;\n searchTerm: string;\n searchTotal: number;\n sort: SortOptions;\n}\n\nexport interface Upload {\n cancelSource: any;\n inprogress?: boolean;\n name?: string;\n progress: number;\n size?: number;\n}\n\ntype VersionInformation = {\n docsVersion?: string;\n version?: string;\n};\n\nexport type SentryConfig = {\n isReduxEnabled?: string; // no parsing done here as this has to be accessed outside of the store\n location: string;\n replaysSessionSampleRate?: number;\n tracesSampleRate?: number;\n};\n\nexport type AppSliceType = {\n appInitDone: boolean;\n cancelSource: any;\n commit: string;\n demoArtifactLink: string;\n docsVersion: string;\n features: Record<string, boolean>;\n feedbackProbability: number;\n firstLoginAfterSignup: boolean;\n hostAddress: string | null;\n hostedAnnouncement: string;\n newThreshold: string;\n offlineThreshold: string;\n recaptchaSiteKey: string;\n searchState: SearchState;\n sentry: SentryConfig;\n snackbar: SnackbarContent;\n stripeAPIKey: string;\n trackerCode: string;\n uploadsById: Record<string, Upload>;\n versionInformation: VersionInformation;\n yesterday?: string;\n};\n\nexport const initialState: AppSliceType = {\n appInitDone: false,\n cancelSource: undefined,\n commit: '',\n demoArtifactLink: 'https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender',\n hostAddress: null,\n snackbar: {\n action: undefined,\n autoHideDuration: undefined,\n message: '',\n open: false,\n preventClickToCopy: false\n },\n // return boolean rather than organization details\n features: {\n hasAiEnabled: false,\n hasAuditlogs: false,\n hasDeltaProgress: false,\n hasMultitenancy: false,\n hasDeviceConfig: false,\n hasDeviceConnect: false,\n hasDeviceFlags: false,\n hasFeedbackEnabled: false,\n hasManifestsEnabled: false,\n hasMonitor: false,\n hasMCUEnabled: false,\n hasNewSearch: false,\n isHosted: true,\n isEnterprise: false\n },\n feedbackProbability: 0.3,\n firstLoginAfterSignup: false,\n hostedAnnouncement: '',\n docsVersion: '',\n recaptchaSiteKey: '',\n searchState: {\n deviceIds: [],\n searchTerm: '',\n searchTotal: 0,\n isSearching: false,\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n }\n },\n sentry: {\n location: '',\n replaysSessionSampleRate: 0.1,\n tracesSampleRate: 1.0\n },\n stripeAPIKey: '',\n trackerCode: '',\n uploadsById: {\n // id: { progress: 0, cancelSource: undefined }\n },\n newThreshold: getYesterday(),\n offlineThreshold: getYesterday(),\n versionInformation: { docsVersion: '', version: '' },\n yesterday: undefined\n};\n\nexport const appSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setFeatures: (state, action: PayloadAction<Record<string, boolean>>) => {\n state.features = {\n ...state.features,\n ...action.payload\n };\n },\n setSnackbar: (state, { payload }: PayloadAction<SnackbarContent | string>) => {\n if (typeof payload === 'string' || payload instanceof String) {\n state.snackbar = {\n ...initialState.snackbar,\n message: payload,\n open: !!payload\n };\n return;\n }\n const { message, autoHideDuration, action, preventClickToCopy = false } = payload;\n state.snackbar = {\n message,\n autoHideDuration,\n action,\n preventClickToCopy,\n open: !!message\n };\n },\n setFirstLoginAfterSignup: (state, action: PayloadAction<boolean>) => {\n state.firstLoginAfterSignup = action.payload;\n },\n setAnnouncement: (state, action: PayloadAction<string>) => {\n state.hostedAnnouncement = action.payload;\n },\n setSearchState: (state, action) => {\n state.searchState = {\n ...state.searchState,\n ...action.payload\n };\n },\n setOfflineThreshold: (state, action: PayloadAction<string>) => {\n state.offlineThreshold = action.payload;\n },\n initUpload: (state, action: PayloadAction<{ id: string; upload: Upload }>) => {\n const { id, upload } = action.payload;\n state.uploadsById[id] = upload;\n },\n uploadProgress: (state, action: PayloadAction<{ id: string; progress: number }>) => {\n const { id, progress } = action.payload;\n state.uploadsById[id] = {\n ...state.uploadsById[id],\n progress\n };\n },\n cleanUpUpload: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: current, ...remainder } = state.uploadsById;\n state.uploadsById = remainder;\n },\n setVersionInformation: (state, action: PayloadAction<VersionInformation>) => {\n state.versionInformation = {\n ...state.versionInformation,\n ...action.payload\n };\n },\n setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),\n setAppInitDone: state => {\n state.appInitDone = true;\n }\n }\n});\n\nexport const actions = appSlice.actions;\nexport default appSlice.reducer;\n"],"mappings":";;;;;;;AAqBA,MAAa,YAAY;AAEzB,MAAM,qBAAqB;CACzB,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;CACjC,OAAO,MAAM,YAAY;AAC3B;AA4DA,MAAa,eAA6B;CACxC,aAAa;CACb,cAAc,KAAA;CACd,QAAQ;CACR,kBAAkB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qBAAqB,OAAO;EACpC;EACA,iBAAiB,OAAO,WAAW;GACjC,MAAM,cAAc;IAClB,GAAG,MAAM;IACT,GAAG,OAAO;GACZ;EACF;EACA,sBAAsB,OAAO,WAAkC;GAC7D,MAAM,mBAAmB,OAAO;EAClC;EACA,aAAa,OAAO,WAA0D;GAC5E,MAAM,EAAE,IAAI,WAAW,OAAO;GAC9B,MAAM,YAAY,MAAM;EAC1B;EACA,iBAAiB,OAAO,WAA4D;GAClF,MAAM,EAAE,IAAI,aAAa,OAAO;GAChC,MAAM,YAAY,MAAM;IACtB,GAAG,MAAM,YAAY;IACrB;GACF;EACF;EACA,gBAAgB,OAAO,WAAkC;GAEvD,MAAM,GAAG,OAAO,UAAU,SAAS,GAAG,cAAc,MAAM;GAC1D,MAAM,cAAc;EACtB;EACA,wBAAwB,OAAO,WAA8C;GAC3E,MAAM,qBAAqB;IACzB,GAAG,MAAM;IACT,GAAG,OAAO;GACZ;EACF;EACA,qBAAqB,OAAO,YAAY;GAAE,GAAG;GAAO,GAAG,OAAO;EAAQ;EACtE,iBAAgB,UAAS;GACvB,MAAM,cAAc;EACtB;CACF;AACF,CAAC;AAED,MAAa,UAAU,SAAS;AAChC,IAAA,mBAAe,SAAS"}
@@ -32,6 +32,7 @@ const initialState = {
32
32
  hasManifestsEnabled: false,
33
33
  hasMonitor: false,
34
34
  hasMCUEnabled: false,
35
+ hasNewSearch: false,
35
36
  isHosted: true,
36
37
  isEnterprise: false
37
38
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/appSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type { SnackbarProps } from '@mui/material';\n\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { SortOptions } from '../constants';\nimport { SORTING_OPTIONS } from '../constants';\n\nexport const sliceName = 'app';\n\nconst getYesterday = () => {\n const today = new Date();\n today.setDate(today.getDate() - 1);\n return today.toISOString();\n};\n\nexport interface SnackbarContent extends Pick<SnackbarProps, 'action' | 'autoHideDuration' | 'message' | 'open'> {\n preventClickToCopy?: boolean;\n}\n\nexport interface SearchState {\n deviceIds: string[];\n isSearching: boolean;\n page?: number;\n perPage?: number;\n searchTerm: string;\n searchTotal: number;\n sort: SortOptions;\n}\n\nexport interface Upload {\n cancelSource: any;\n inprogress?: boolean;\n name?: string;\n progress: number;\n size?: number;\n}\n\ntype VersionInformation = {\n docsVersion?: string;\n version?: string;\n};\n\nexport type SentryConfig = {\n isReduxEnabled?: string; // no parsing done here as this has to be accessed outside of the store\n location: string;\n replaysSessionSampleRate?: number;\n tracesSampleRate?: number;\n};\n\nexport type AppSliceType = {\n appInitDone: boolean;\n cancelSource: any;\n commit: string;\n demoArtifactLink: string;\n docsVersion: string;\n features: Record<string, boolean>;\n feedbackProbability: number;\n firstLoginAfterSignup: boolean;\n hostAddress: string | null;\n hostedAnnouncement: string;\n newThreshold: string;\n offlineThreshold: string;\n recaptchaSiteKey: string;\n searchState: SearchState;\n sentry: SentryConfig;\n snackbar: SnackbarContent;\n stripeAPIKey: string;\n trackerCode: string;\n uploadsById: Record<string, Upload>;\n versionInformation: VersionInformation;\n yesterday?: string;\n};\n\nexport const initialState: AppSliceType = {\n appInitDone: false,\n cancelSource: undefined,\n commit: '',\n demoArtifactLink: 'https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender',\n hostAddress: null,\n snackbar: {\n action: undefined,\n autoHideDuration: undefined,\n message: '',\n open: false,\n preventClickToCopy: false\n },\n // return boolean rather than organization details\n features: {\n hasAiEnabled: false,\n hasAuditlogs: false,\n hasDeltaProgress: false,\n hasMultitenancy: false,\n hasDeviceConfig: false,\n hasDeviceConnect: false,\n hasDeviceFlags: false,\n hasFeedbackEnabled: false,\n hasManifestsEnabled: false,\n hasMonitor: false,\n hasMCUEnabled: false,\n isHosted: true,\n isEnterprise: false\n },\n feedbackProbability: 0.3,\n firstLoginAfterSignup: false,\n hostedAnnouncement: '',\n docsVersion: '',\n recaptchaSiteKey: '',\n searchState: {\n deviceIds: [],\n searchTerm: '',\n searchTotal: 0,\n isSearching: false,\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n }\n },\n sentry: {\n location: '',\n replaysSessionSampleRate: 0.1,\n tracesSampleRate: 1.0\n },\n stripeAPIKey: '',\n trackerCode: '',\n uploadsById: {\n // id: { progress: 0, cancelSource: undefined }\n },\n newThreshold: getYesterday(),\n offlineThreshold: getYesterday(),\n versionInformation: { docsVersion: '', version: '' },\n yesterday: undefined\n};\n\nexport const appSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setFeatures: (state, action: PayloadAction<Record<string, boolean>>) => {\n state.features = {\n ...state.features,\n ...action.payload\n };\n },\n setSnackbar: (state, { payload }: PayloadAction<SnackbarContent | string>) => {\n if (typeof payload === 'string' || payload instanceof String) {\n state.snackbar = {\n ...initialState.snackbar,\n message: payload,\n open: !!payload\n };\n return;\n }\n const { message, autoHideDuration, action, preventClickToCopy = false } = payload;\n state.snackbar = {\n message,\n autoHideDuration,\n action,\n preventClickToCopy,\n open: !!message\n };\n },\n setFirstLoginAfterSignup: (state, action: PayloadAction<boolean>) => {\n state.firstLoginAfterSignup = action.payload;\n },\n setAnnouncement: (state, action: PayloadAction<string>) => {\n state.hostedAnnouncement = action.payload;\n },\n setSearchState: (state, action) => {\n state.searchState = {\n ...state.searchState,\n ...action.payload\n };\n },\n setOfflineThreshold: (state, action: PayloadAction<string>) => {\n state.offlineThreshold = action.payload;\n },\n initUpload: (state, action: PayloadAction<{ id: string; upload: Upload }>) => {\n const { id, upload } = action.payload;\n state.uploadsById[id] = upload;\n },\n uploadProgress: (state, action: PayloadAction<{ id: string; progress: number }>) => {\n const { id, progress } = action.payload;\n state.uploadsById[id] = {\n ...state.uploadsById[id],\n progress\n };\n },\n cleanUpUpload: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: current, ...remainder } = state.uploadsById;\n state.uploadsById = remainder;\n },\n setVersionInformation: (state, action: PayloadAction<VersionInformation>) => {\n state.versionInformation = {\n ...state.versionInformation,\n ...action.payload\n };\n },\n setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),\n setAppInitDone: state => {\n state.appInitDone = true;\n }\n }\n});\n\nexport const actions = appSlice.actions;\nexport default appSlice.reducer;\n"],"mappings":";;;AAqBA,MAAa,YAAY;AAEzB,MAAM,qBAAqB;CACzB,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;CACjC,OAAO,MAAM,YAAY;AAC3B;AA4DA,MAAa,eAA6B;CACxC,aAAa;CACb,cAAc,KAAA;CACd,QAAQ;CACR,kBAAkB;CAClB,aAAa;CACb,UAAU;EACR,QAAQ,KAAA;EACR,kBAAkB,KAAA;EAClB,SAAS;EACT,MAAM;EACN,oBAAoB;CACtB;CAEA,UAAU;EACR,cAAc;EACd,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB,gBAAgB;EAChB,oBAAoB;EACpB,qBAAqB;EACrB,YAAY;EACZ,eAAe;EACf,UAAU;EACV,cAAc;CAChB;CACA,qBAAqB;CACrB,uBAAuB;CACvB,oBAAoB;CACpB,aAAa;CACb,kBAAkB;CAClB,aAAa;EACX,WAAW,CAAC;EACZ,YAAY;EACZ,aAAa;EACb,aAAa;EACb,MAAM,EACJ,WAAW,gBAAgB,KAG7B;CACF;CACA,QAAQ;EACN,UAAU;EACV,0BAA0B;EAC1B,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,GAAG,MAAM;IACT,GAAG,OAAO;GACZ;EACF;EACA,qBAAqB,OAAO,YAAY;GAAE,GAAG;GAAO,GAAG,OAAO;EAAQ;EACtE,iBAAgB,UAAS;GACvB,MAAM,cAAc;EACtB;CACF;AACF,CAAC;AAED,MAAa,UAAU,SAAS;AAChC,IAAA,mBAAe,SAAS"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/appSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type { SnackbarProps } from '@mui/material';\n\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { SortOptions } from '../constants';\nimport { SORTING_OPTIONS } from '../constants';\n\nexport const sliceName = 'app';\n\nconst getYesterday = () => {\n const today = new Date();\n today.setDate(today.getDate() - 1);\n return today.toISOString();\n};\n\nexport interface SnackbarContent extends Pick<SnackbarProps, 'action' | 'autoHideDuration' | 'message' | 'open'> {\n preventClickToCopy?: boolean;\n}\n\nexport interface SearchState {\n deviceIds: string[];\n isSearching: boolean;\n page?: number;\n perPage?: number;\n searchTerm: string;\n searchTotal: number;\n sort: SortOptions;\n}\n\nexport interface Upload {\n cancelSource: any;\n inprogress?: boolean;\n name?: string;\n progress: number;\n size?: number;\n}\n\ntype VersionInformation = {\n docsVersion?: string;\n version?: string;\n};\n\nexport type SentryConfig = {\n isReduxEnabled?: string; // no parsing done here as this has to be accessed outside of the store\n location: string;\n replaysSessionSampleRate?: number;\n tracesSampleRate?: number;\n};\n\nexport type AppSliceType = {\n appInitDone: boolean;\n cancelSource: any;\n commit: string;\n demoArtifactLink: string;\n docsVersion: string;\n features: Record<string, boolean>;\n feedbackProbability: number;\n firstLoginAfterSignup: boolean;\n hostAddress: string | null;\n hostedAnnouncement: string;\n newThreshold: string;\n offlineThreshold: string;\n recaptchaSiteKey: string;\n searchState: SearchState;\n sentry: SentryConfig;\n snackbar: SnackbarContent;\n stripeAPIKey: string;\n trackerCode: string;\n uploadsById: Record<string, Upload>;\n versionInformation: VersionInformation;\n yesterday?: string;\n};\n\nexport const initialState: AppSliceType = {\n appInitDone: false,\n cancelSource: undefined,\n commit: '',\n demoArtifactLink: 'https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender',\n hostAddress: null,\n snackbar: {\n action: undefined,\n autoHideDuration: undefined,\n message: '',\n open: false,\n preventClickToCopy: false\n },\n // return boolean rather than organization details\n features: {\n hasAiEnabled: false,\n hasAuditlogs: false,\n hasDeltaProgress: false,\n hasMultitenancy: false,\n hasDeviceConfig: false,\n hasDeviceConnect: false,\n hasDeviceFlags: false,\n hasFeedbackEnabled: false,\n hasManifestsEnabled: false,\n hasMonitor: false,\n hasMCUEnabled: false,\n hasNewSearch: false,\n isHosted: true,\n isEnterprise: false\n },\n feedbackProbability: 0.3,\n firstLoginAfterSignup: false,\n hostedAnnouncement: '',\n docsVersion: '',\n recaptchaSiteKey: '',\n searchState: {\n deviceIds: [],\n searchTerm: '',\n searchTotal: 0,\n isSearching: false,\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n }\n },\n sentry: {\n location: '',\n replaysSessionSampleRate: 0.1,\n tracesSampleRate: 1.0\n },\n stripeAPIKey: '',\n trackerCode: '',\n uploadsById: {\n // id: { progress: 0, cancelSource: undefined }\n },\n newThreshold: getYesterday(),\n offlineThreshold: getYesterday(),\n versionInformation: { docsVersion: '', version: '' },\n yesterday: undefined\n};\n\nexport const appSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setFeatures: (state, action: PayloadAction<Record<string, boolean>>) => {\n state.features = {\n ...state.features,\n ...action.payload\n };\n },\n setSnackbar: (state, { payload }: PayloadAction<SnackbarContent | string>) => {\n if (typeof payload === 'string' || payload instanceof String) {\n state.snackbar = {\n ...initialState.snackbar,\n message: payload,\n open: !!payload\n };\n return;\n }\n const { message, autoHideDuration, action, preventClickToCopy = false } = payload;\n state.snackbar = {\n message,\n autoHideDuration,\n action,\n preventClickToCopy,\n open: !!message\n };\n },\n setFirstLoginAfterSignup: (state, action: PayloadAction<boolean>) => {\n state.firstLoginAfterSignup = action.payload;\n },\n setAnnouncement: (state, action: PayloadAction<string>) => {\n state.hostedAnnouncement = action.payload;\n },\n setSearchState: (state, action) => {\n state.searchState = {\n ...state.searchState,\n ...action.payload\n };\n },\n setOfflineThreshold: (state, action: PayloadAction<string>) => {\n state.offlineThreshold = action.payload;\n },\n initUpload: (state, action: PayloadAction<{ id: string; upload: Upload }>) => {\n const { id, upload } = action.payload;\n state.uploadsById[id] = upload;\n },\n uploadProgress: (state, action: PayloadAction<{ id: string; progress: number }>) => {\n const { id, progress } = action.payload;\n state.uploadsById[id] = {\n ...state.uploadsById[id],\n progress\n };\n },\n cleanUpUpload: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: current, ...remainder } = state.uploadsById;\n state.uploadsById = remainder;\n },\n setVersionInformation: (state, action: PayloadAction<VersionInformation>) => {\n state.versionInformation = {\n ...state.versionInformation,\n ...action.payload\n };\n },\n setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),\n setAppInitDone: state => {\n state.appInitDone = true;\n }\n }\n});\n\nexport const actions = appSlice.actions;\nexport default appSlice.reducer;\n"],"mappings":";;;AAqBA,MAAa,YAAY;AAEzB,MAAM,qBAAqB;CACzB,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;CACjC,OAAO,MAAM,YAAY;AAC3B;AA4DA,MAAa,eAA6B;CACxC,aAAa;CACb,cAAc,KA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qB,OAAO;EACpC;EACA,iBAAiB,OAAO,WAAW;GACjC,MAAM,cAAc;IAClB,GAAG,MAAM;IACT,GAAG,OAAO;GACZ;EACF;EACA,sBAAsB,OAAO,WAAkC;GAC7D,MAAM,mBAAmB,OAAO;EAClC;EACA,aAAa,OAAO,WAA0D;GAC5E,MAAM,EAAE,IAAI,WAAW,OAAO;GAC9B,MAAM,YAAY,MAAM;EAC1B;EACA,iBAAiB,OAAO,WAA4D;GAClF,MAAM,EAAE,IAAI,aAAa,OAAO;GAChC,MAAM,YAAY,MAAM;IACtB,GAAG,MAAM,YAAY;IACrB;GACF;EACF;EACA,gBAAgB,OAAO,WAAkC;GAEvD,MAAM,GAAG,OAAO,UAAU,SAAS,GAAG,cAAc,MAAM;GAC1D,MAAM,cAAc;EACtB;EACA,wBAAwB,OAAO,WAA8C;GAC3E,MAAM,qBAAqB;IACzB,GAAG,MAAM;IACT,GAAG,OAAO;GACZ;EACF;EACA,qBAAqB,OAAO,YAAY;GAAE,GAAG;GAAO,GAAG,OAAO;EAAQ;EACtE,iBAAgB,UAAS;GACvB,MAAM,cAAc;EACtB;CACF;AACF,CAAC;AAED,MAAa,UAAU,SAAS;AAChC,IAAA,mBAAe,SAAS"}
@@ -1,12 +1,12 @@
1
- import { o as UserSliceType } from "../index-BgF6rhXn.cjs";
1
+ import { o as UserSliceType } from "../index-DjSjrp5b.cjs";
2
2
  import { i as ReleaseSliceType } from "../index-DiAjzARZ.cjs";
3
3
  import { n as OnboardingSliceType } from "../index-CoObjWL4.cjs";
4
4
  import { o as DeploymentsSliceType } from "../index-mvxjivTJ.cjs";
5
- import { c as DeviceSliceType } from "../index-CiQ95u1W.cjs";
5
+ import { c as DeviceSliceType } from "../index-DnKVKM0G.cjs";
6
6
  import { a as Upload, i as SnackbarContent, n as SearchState, r as SentryConfig, t as AppSliceType } from "../index-DeOpb2oK.cjs";
7
7
  import { t as MonitorSliceType } from "../index-Ctj2r57a.cjs";
8
8
  import { t as OrganizationSliceType } from "../index-C_LGDJN2.cjs";
9
- import { r as RootState } from "../store-CUUm1GTI.cjs";
9
+ import { r as RootState } from "../store-ByJVpIz9.cjs";
10
10
  //#region src/appSlice/selectors.d.ts
11
11
  declare const getDocsVersion: (state: RootState) => string;
12
12
  declare const getFeatures: (state: RootState) => Record<string, boolean>;
@@ -1,12 +1,12 @@
1
- import { o as UserSliceType } from "../index-CpfhQHfg.js";
1
+ import { o as UserSliceType } from "../index-C0yQmQih.js";
2
2
  import { i as ReleaseSliceType } from "../index-C8uiyxnb.js";
3
3
  import { n as OnboardingSliceType } from "../index-CoObjWL4.js";
4
4
  import { o as DeploymentsSliceType } from "../index-B8td4-rY.js";
5
- import { c as DeviceSliceType } from "../index-Bvyf8OO6.js";
5
+ import { c as DeviceSliceType } from "../index-BpamudGf.js";
6
6
  import { a as Upload, i as SnackbarContent, n as SearchState, r as SentryConfig, t as AppSliceType } from "../index-Bs0c1-WY.js";
7
7
  import { t as MonitorSliceType } from "../index-BAGyeC-q.js";
8
8
  import { t as OrganizationSliceType } from "../index-ChKTa1aL.js";
9
- import { r as RootState } from "../store-CPptM5Ts.js";
9
+ import { r as RootState } from "../store-BKVs6gSc.js";
10
10
  //#region src/appSlice/selectors.d.ts
11
11
  declare const getDocsVersion: (state: RootState) => string;
12
12
  declare const getFeatures: (state: RootState) => Record<string, boolean>;
@@ -1,5 +1,5 @@
1
1
  import { n as SearchState } from "../index-DeOpb2oK.cjs";
2
- import { r as RootState, t as AppDispatch } from "../store-CUUm1GTI.cjs";
2
+ import { r as RootState, t as AppDispatch } from "../store-ByJVpIz9.cjs";
3
3
  //#region src/appSlice/thunks.d.ts
4
4
  declare const setFirstLoginAfterSignup: import("@reduxjs/toolkit").AsyncThunk<void, boolean, {
5
5
  dispatch: AppDispatch;
@@ -1,5 +1,5 @@
1
1
  import { n as SearchState } from "../index-Bs0c1-WY.js";
2
- import { r as RootState, t as AppDispatch } from "../store-CPptM5Ts.js";
2
+ import { r as RootState, t as AppDispatch } from "../store-BKVs6gSc.js";
3
3
  //#region src/appSlice/thunks.d.ts
4
4
  declare const setFirstLoginAfterSignup: import("@reduxjs/toolkit").AsyncThunk<void, boolean, {
5
5
  dispatch: AppDispatch;
package/dist/auth.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as UserSession } from "./index-BgF6rhXn.cjs";
1
+ import { i as UserSession } from "./index-DjSjrp5b.cjs";
2
2
  //#region src/auth.d.ts
3
3
  declare const getSessionInfo: () => UserSession;
4
4
  declare const getToken: () => string;
package/dist/auth.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as UserSession } from "./index-CpfhQHfg.js";
1
+ import { i as UserSession } from "./index-C0yQmQih.js";
2
2
  //#region src/auth.d.ts
3
3
  declare const getSessionInfo: () => UserSession;
4
4
  declare const getToken: () => string;
@@ -1,15 +1,15 @@
1
1
  import { a as AvailablePlans } from "./constants-nKSWZ8oD.cjs";
2
2
  import { S as Role } from "./constants-Rl3FJzFf.cjs";
3
- import { a as UserSettings, n as GlobalSettings, o as UserSliceType, r as User } from "./index-BgF6rhXn.cjs";
3
+ import { a as UserSettings, n as GlobalSettings, o as UserSliceType, r as User } from "./index-DjSjrp5b.cjs";
4
4
  import { i as ReleaseSliceType, r as Release } from "./index-DiAjzARZ.cjs";
5
5
  import { i as Organization, n as AuditLogSelectionState } from "./types-B80ckxiy.cjs";
6
6
  import { n as OnboardingSliceType, t as OnboardingApproach } from "./index-CoObjWL4.cjs";
7
7
  import { l as SelectionState, o as DeploymentsSliceType, s as DeviceDeployment, t as Deployment } from "./index-mvxjivTJ.cjs";
8
- import { c as DeviceSliceType, i as DeviceGroup, l as InventoryAttributes, n as DeviceComponents, t as Device } from "./index-CiQ95u1W.cjs";
8
+ import { c as DeviceSliceType, i as DeviceGroup, n as DeviceComponents, t as Device, u as InventoryAttributes } from "./index-DnKVKM0G.cjs";
9
9
  import { t as AppSliceType } from "./index-DeOpb2oK.cjs";
10
10
  import { t as MonitorSliceType } from "./index-Ctj2r57a.cjs";
11
11
  import { t as OrganizationSliceType } from "./index-C_LGDJN2.cjs";
12
- import { r as RootState } from "./store-CUUm1GTI.cjs";
12
+ import { r as RootState } from "./store-ByJVpIz9.cjs";
13
13
  import { AuditLog } from "@northern.tech/types/types.gen";
14
14
  //#region src/commonSelectors.d.ts
15
15
  declare const getIsEnterprise: ((state: {
@@ -1,15 +1,15 @@
1
1
  import { a as AvailablePlans } from "./constants-nKSWZ8oD.js";
2
2
  import { S as Role } from "./constants-B_H4squx.js";
3
- import { a as UserSettings, n as GlobalSettings, o as UserSliceType, r as User } from "./index-CpfhQHfg.js";
3
+ import { a as UserSettings, n as GlobalSettings, o as UserSliceType, r as User } from "./index-C0yQmQih.js";
4
4
  import { i as ReleaseSliceType, r as Release } from "./index-C8uiyxnb.js";
5
5
  import { i as Organization, n as AuditLogSelectionState } from "./types-B3qGQoMx.js";
6
6
  import { n as OnboardingSliceType, t as OnboardingApproach } from "./index-CoObjWL4.js";
7
7
  import { l as SelectionState, o as DeploymentsSliceType, s as DeviceDeployment, t as Deployment } from "./index-B8td4-rY.js";
8
- import { c as DeviceSliceType, i as DeviceGroup, l as InventoryAttributes, n as DeviceComponents, t as Device } from "./index-Bvyf8OO6.js";
8
+ import { c as DeviceSliceType, i as DeviceGroup, n as DeviceComponents, t as Device, u as InventoryAttributes } from "./index-BpamudGf.js";
9
9
  import { t as AppSliceType } from "./index-Bs0c1-WY.js";
10
10
  import { t as MonitorSliceType } from "./index-BAGyeC-q.js";
11
11
  import { t as OrganizationSliceType } from "./index-ChKTa1aL.js";
12
- import { r as RootState } from "./store-CPptM5Ts.js";
12
+ import { r as RootState } from "./store-BKVs6gSc.js";
13
13
  import { AuditLog } from "@northern.tech/types/types.gen";
14
14
  //#region src/commonSelectors.d.ts
15
15
  declare const getIsEnterprise: ((state: {
@@ -1,12 +1,12 @@
1
- import { o as UserSliceType } from "../index-BgF6rhXn.cjs";
1
+ import { o as UserSliceType } from "../index-DjSjrp5b.cjs";
2
2
  import { i as ReleaseSliceType } from "../index-DiAjzARZ.cjs";
3
3
  import { n as OnboardingSliceType } from "../index-CoObjWL4.cjs";
4
4
  import { l as SelectionState, n as DeploymentByStatus, o as DeploymentsSliceType, t as Deployment } from "../index-mvxjivTJ.cjs";
5
- import { c as DeviceSliceType } from "../index-CiQ95u1W.cjs";
5
+ import { c as DeviceSliceType } from "../index-DnKVKM0G.cjs";
6
6
  import { t as AppSliceType } from "../index-DeOpb2oK.cjs";
7
7
  import { t as MonitorSliceType } from "../index-Ctj2r57a.cjs";
8
8
  import { t as OrganizationSliceType } from "../index-C_LGDJN2.cjs";
9
- import { r as RootState } from "../store-CUUm1GTI.cjs";
9
+ import { r as RootState } from "../store-ByJVpIz9.cjs";
10
10
  //#region src/deploymentsSlice/selectors.d.ts
11
11
  declare const getDeploymentsById: (state: RootState) => Record<string, Deployment>;
12
12
  declare const getDeploymentsByStatus: (state: RootState) => DeploymentByStatus;
@@ -1,12 +1,12 @@
1
- import { o as UserSliceType } from "../index-CpfhQHfg.js";
1
+ import { o as UserSliceType } from "../index-C0yQmQih.js";
2
2
  import { i as ReleaseSliceType } from "../index-C8uiyxnb.js";
3
3
  import { n as OnboardingSliceType } from "../index-CoObjWL4.js";
4
4
  import { l as SelectionState, n as DeploymentByStatus, o as DeploymentsSliceType, t as Deployment } from "../index-B8td4-rY.js";
5
- import { c as DeviceSliceType } from "../index-Bvyf8OO6.js";
5
+ import { c as DeviceSliceType } from "../index-BpamudGf.js";
6
6
  import { t as AppSliceType } from "../index-Bs0c1-WY.js";
7
7
  import { t as MonitorSliceType } from "../index-BAGyeC-q.js";
8
8
  import { t as OrganizationSliceType } from "../index-ChKTa1aL.js";
9
- import { r as RootState } from "../store-CPptM5Ts.js";
9
+ import { r as RootState } from "../store-BKVs6gSc.js";
10
10
  //#region src/deploymentsSlice/selectors.d.ts
11
11
  declare const getDeploymentsById: (state: RootState) => Record<string, Deployment>;
12
12
  declare const getDeploymentsByStatus: (state: RootState) => DeploymentByStatus;
@@ -1,8 +1,8 @@
1
1
  import { T as SortOptions } from "../constants-Rl3FJzFf.cjs";
2
2
  import { c as SelectionListState, i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "../index-mvxjivTJ.cjs";
3
- import { t as Device$1 } from "../index-CiQ95u1W.cjs";
3
+ import { t as Device$1 } from "../index-DnKVKM0G.cjs";
4
4
  import { i as SnackbarContent } from "../index-DeOpb2oK.cjs";
5
- import { r as RootState, t as AppDispatch } from "../store-CUUm1GTI.cjs";
5
+ import { r as RootState, t as AppDispatch } from "../store-ByJVpIz9.cjs";
6
6
  import { DeploymentV1, DeploymentV2, NewDeploymentForGroup, NewDeploymentTypeManagement, NewDeploymentV2TypeManagement } from "@northern.tech/types/MenderTypes";
7
7
  //#region src/deploymentsSlice/thunks.d.ts
8
8
  declare const deriveDeploymentGroup: ({ filter, group, groups, name }: Deployment) => string | undefined;
@@ -1,8 +1,8 @@
1
1
  import { T as SortOptions } from "../constants-B_H4squx.js";
2
2
  import { c as SelectionListState, i as DeploymentConfig, l as SelectionState, r as DeploymentByStatusKey, t as Deployment } from "../index-B8td4-rY.js";
3
- import { t as Device$1 } from "../index-Bvyf8OO6.js";
3
+ import { t as Device$1 } from "../index-BpamudGf.js";
4
4
  import { i as SnackbarContent } from "../index-Bs0c1-WY.js";
5
- import { r as RootState, t as AppDispatch } from "../store-CPptM5Ts.js";
5
+ import { r as RootState, t as AppDispatch } from "../store-BKVs6gSc.js";
6
6
  import { DeploymentV1, DeploymentV2, NewDeploymentForGroup, NewDeploymentTypeManagement, NewDeploymentV2TypeManagement } from "@northern.tech/types/MenderTypes";
7
7
  //#region src/deploymentsSlice/thunks.d.ts
8
8
  declare const deriveDeploymentGroup: ({ filter, group, groups, name }: Deployment) => string | undefined;
@@ -76,6 +76,7 @@ const initialState = {
76
76
  },
77
77
  reports: [],
78
78
  testDeviceCount: 0,
79
+ testDeviceLimit: 0,
79
80
  total: 0,
80
81
  limits: {
81
82
  standard: 0,
@@ -182,7 +183,9 @@ const devicesSlice = (0, _reduxjs_toolkit.createSlice)({
182
183
  };
183
184
  },
184
185
  setDeviceLimits: (state, action) => {
185
- state.limits = action.payload;
186
+ const { test, ...tiers } = action.payload;
187
+ state.limits = tiers;
188
+ state.testDeviceLimit = test || 0;
186
189
  },
187
190
  setTestDeviceCount: (state, action) => {
188
191
  state.testDeviceCount = action.payload;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["DEVICE_STATES","DEVICE_LIST_DEFAULTS","SORTING_OPTIONS","createSlice","duplicateFilter","deepCompare"],"sources":["../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type {\n AttributeResponse,\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type DeviceComponents = Record<string, AttributeResponse[]>;\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n components?: DeviceComponents;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;;;;;AAmCA,MAAa,YAAY;AAiGzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACPA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;CACpG;CACA,YAAY;EACV,WAAW,CAAC;EACZ,GAAGC,+BAAAA;EACH,oBAAoB,CAAC;EACrB,gBAAgB,CAAC;EACjB,WAAW,CAAC;EACZ,MAAM,EACJ,WAAWC,+BAAAA,gBAAgB,KAG7B;EACA,OAAOF,+BAAAA,cAAc;EACrB,OAAO;EACP,gBAAgB;EAChB,WA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AAO,OAAO,CAAC;OAChC,aAAa,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,cAAc,CAAC;MAC9E,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,QAAQ,CAAC;KACnE;IACF;GACF;EACF;CACF;AACF,CAAC;AAED,MAAa,UAAU,aAAa;AACpC,IAAA,uBAAe,aAAa"}
1
+ {"version":3,"file":"index.cjs","names":["DEVICE_STATES","DEVICE_LIST_DEFAULTS","SORTING_OPTIONS","createSlice","duplicateFilter","deepCompare"],"sources":["../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type {\n AttributeResponse,\n Device as BackendDeviceAuth,\n DeviceTierLimits as BackendDeviceTierLimits,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceTierLimits = Omit<BackendDeviceTierLimits, 'test'>;\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type DeviceComponents = Record<string, AttributeResponse[]>;\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n components?: DeviceComponents;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n testDeviceLimit: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n testDeviceLimit: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<BackendDeviceTierLimits>) => {\n const { test, ...tiers } = action.payload;\n state.limits = tiers;\n // The test device limit is returned by the tiers endpoint, but we handle it separately.\n state.testDeviceLimit = test || 0;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;;;;;AAmCA,MAAa,YAAY;AAmGzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACPA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GACjGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,UAAU;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;GAChGA,+BAAAA,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAAO;GAAE;EAAE;CACpG;CACA,YAAY;EACV,WAAW,CAAC;E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IAAI,UACnG,OAAO,OAAOL,+BAAAA,aAAa,CAAC,CAAc,SAAS,OAAO,MAAM,GAAG;IAC9F,MAAM,YAAY,MAAM,SAAS,OAAO,OAAO,CAAC,UAAU,QAAO,OAAM,OAAO,QAAQ;IACtF,MAAM,aAAc,OAAO,WAAW,QAAmB;IACzD,MAAM,SAAS,OAAO,UAAU;KAC9B;KACA,QAAQ;MACN,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC;OAChC,aAAa,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,cAAc,CAAC;MAC9E,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,QAAQ,CAAC;KACnE;IACF;GACF;EACF;CACF;AACF,CAAC;AAED,MAAa,UAAU,aAAa;AACpC,IAAA,uBAAe,aAAa"}
@@ -1,2 +1,2 @@
1
- import { a as DeviceGroups, c as DeviceSliceType, d as actions, f as devicesSlice, i as DeviceGroup, l as InventoryAttributes, m as sliceName, n as DeviceComponents, o as DeviceListState, p as initialState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device, u as _default } from "../index-CiQ95u1W.cjs";
2
- export { Device, DeviceComponents, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
1
+ import { a as DeviceGroups, c as DeviceSliceType, d as _default, f as actions, h as sliceName, i as DeviceGroup, l as DeviceTierLimits, m as initialState, n as DeviceComponents, o as DeviceListState, p as devicesSlice, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device, u as InventoryAttributes } from "../index-DnKVKM0G.cjs";
2
+ export { Device, DeviceComponents, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, DeviceTierLimits, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
@@ -1,2 +1,2 @@
1
- import { a as DeviceGroups, c as DeviceSliceType, d as actions, f as devicesSlice, i as DeviceGroup, l as InventoryAttributes, m as sliceName, n as DeviceComponents, o as DeviceListState, p as initialState, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device, u as _default } from "../index-Bvyf8OO6.js";
2
- export { Device, DeviceComponents, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
1
+ import { a as DeviceGroups, c as DeviceSliceType, d as _default, f as actions, h as sliceName, i as DeviceGroup, l as DeviceTierLimits, m as initialState, n as DeviceComponents, o as DeviceListState, p as devicesSlice, r as DeviceFilter, s as DeviceSelectedAttribute, t as Device, u as InventoryAttributes } from "../index-BpamudGf.js";
2
+ export { Device, DeviceComponents, DeviceFilter, DeviceGroup, DeviceGroups, DeviceListState, DeviceSelectedAttribute, DeviceSliceType, DeviceTierLimits, InventoryAttributes, actions, _default as default, devicesSlice, initialState, sliceName };
@@ -72,6 +72,7 @@ const initialState = {
72
72
  },
73
73
  reports: [],
74
74
  testDeviceCount: 0,
75
+ testDeviceLimit: 0,
75
76
  total: 0,
76
77
  limits: {
77
78
  standard: 0,
@@ -178,7 +179,9 @@ const devicesSlice = createSlice({
178
179
  };
179
180
  },
180
181
  setDeviceLimits: (state, action) => {
181
- state.limits = action.payload;
182
+ const { test, ...tiers } = action.payload;
183
+ state.limits = tiers;
184
+ state.testDeviceLimit = test || 0;
182
185
  },
183
186
  setTestDeviceCount: (state, action) => {
184
187
  state.testDeviceCount = action.payload;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type {\n AttributeResponse,\n Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type DeviceComponents = Record<string, AttributeResponse[]>;\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n components?: DeviceComponents;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = action.payload;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;AAmCA,MAAa,YAAY;AAiGzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACP,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO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KAAK,OAAO,QAAQ;IAC7B,GAAG,OAAO;GACZ;EACF;EACA,6BAA6B,OAAO,WAAiE;GACnG,MAAM,EAAE,UAAU,WAAW,OAAO;GACpC,MAAM,SAAS,MAAM,KAAK;GAE1B,IAAI,EADwB,UAAU,OAAO,YAAY,OAAO,UAAU,QAAO,YAAW,QAAQ,OAAO,MAAM,CAAC,CAAC,SAAS,IAAI,UACnG,OAAO,OAAO,aAAa,CAAC,CAAc,SAAS,OAAO,MAAM,GAAG;IAC9F,MAAM,YAAY,MAAM,SAAS,OAAO,OAAO,CAAC,UAAU,QAAO,OAAM,OAAO,QAAQ;IACtF,MAAM,aAAc,OAAO,WAAW,QAAmB;IACzD,MAAM,SAAS,OAAO,UAAU;KAC9B;KACA,QAAQ;MACN,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC;OAChC,aAAa,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,cAAc,CAAC;MAC9E,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,QAAQ,CAAC;KACnE;IACF;GACF;EACF;CACF;AACF,CAAC;AAED,MAAa,UAAU,aAAa;AACpC,IAAA,uBAAe,aAAa"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/devicesSlice/index.ts"],"sourcesContent":["// Copyright 2023 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 type {\n AttributeResponse,\n Device as BackendDeviceAuth,\n DeviceTierLimits as BackendDeviceTierLimits,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n MonitorConfiguration,\n Scope,\n SortCriteria,\n Status\n} from '@northern.tech/types/MenderTypes';\n// @ts-nocheck\nimport { deepCompare, duplicateFilter } from '@northern.tech/utils/helpers';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { ALL_DEVICE_STATES, DeviceIssueOptionKey, FilterOperator, SortOptions } from '../constants';\nimport { DEVICE_LIST_DEFAULTS, DEVICE_STATES, SORTING_OPTIONS } from '../constants';\nimport type { DeviceDeployment } from '../deploymentsSlice';\nimport type { DeviceAuthState } from './constants';\n\nexport const sliceName = 'devices';\nexport type DeviceTierLimits = Omit<BackendDeviceTierLimits, 'test'>;\nexport type DeviceSelectedAttribute = { attribute: string; scope: string };\nexport type DeviceListState = {\n detailsTab: string;\n deviceIds: string[];\n isLoading: boolean;\n open?: boolean;\n page: number;\n perPage: number;\n refreshTrigger: boolean;\n selectedAttributes: DeviceSelectedAttribute[];\n selectedId?: string;\n selectedIssues: DeviceIssueOptionKey[];\n selection: number[];\n setOnly?: boolean;\n sort: SortOptions & Partial<SortCriteria>;\n state?: DeviceAuthState | typeof ALL_DEVICE_STATES;\n total: number;\n};\ntype DeviceReport = {\n items: { count: number; key: string }[];\n otherCount: number;\n total: number;\n};\nexport type DeviceGroup = { deviceIds?: string[]; filters?: DeviceFilter[]; id?: string; total?: number };\nexport type InventoryAttributes = {\n [key: string]: string | string[];\n artifact_name: string;\n device_type: string[];\n};\n\n// based on the api docs the Record values might be even: \"Supported types: number, string, array of numbers, array of strings\" - but I guess \"string\" or \"string | sting[]\" should be good enough\ntype UiDeviceAttributes = {\n attributes: InventoryAttributes;\n identity?: Record<string, string>;\n monitor?: Record<string, string>;\n system: Record<string, string>;\n tags?: Record<string, string>;\n};\n\nexport type DeviceComponents = Record<string, AttributeResponse[]>;\n\nexport type Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n components?: DeviceComponents;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n group?: string;\n id: string;\n isNew?: boolean;\n isOffline?: boolean;\n monitors?: MonitorConfiguration[];\n status: Status;\n twinsByIntegration?: Record<string, DeviceState & { twinError?: string }>;\n };\nexport type DeviceFilter = {\n key: string;\n operator: FilterOperator;\n scope: Scope;\n value: string | string[];\n};\ntype FilteringAttributes = {\n identityAttributes: string[];\n inventoryAttributes: string[];\n systemAttributes: string[];\n tagAttributes: string[];\n};\ntype FilteringAttributesConfig = {\n attributes: Record<string, string[]>;\n count: number;\n limit: number;\n};\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceAuthState, { counts: DeviceTierLimits & { total: number }; deviceIds: string[] }>;\n deviceList: DeviceListState;\n filteringAttributes: FilteringAttributes;\n filteringAttributesConfig: FilteringAttributesConfig;\n filteringAttributesLimit: number;\n filters: DeviceFilter[];\n groups: DeviceGroups;\n limits: DeviceTierLimits;\n reports: DeviceReport[];\n testDeviceCount: number;\n testDeviceLimit: number;\n total: number;\n};\nexport const initialState: DeviceSliceType = {\n byId: {\n // [deviceId]: {\n // ...,\n // twinsByIntegration: { [external.provider.id]: twinData }\n // }\n },\n byStatus: {\n [DEVICE_STATES.accepted]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.pending]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.preauth]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } },\n [DEVICE_STATES.rejected]: { deviceIds: [], counts: { standard: 0, micro: 0, system: 0, total: 0 } }\n },\n deviceList: {\n deviceIds: [],\n ...DEVICE_LIST_DEFAULTS,\n selectedAttributes: [],\n selectedIssues: [],\n selection: [],\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n },\n state: DEVICE_STATES.accepted,\n total: 0,\n refreshTrigger: false,\n isLoading: false,\n detailsTab: '',\n open: false\n },\n filters: [\n // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }\n ],\n filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },\n filteringAttributesLimit: 10,\n filteringAttributesConfig: {\n attributes: {\n // inventory: ['some_attribute']\n },\n count: 0,\n limit: 100\n },\n reports: [\n // { items: [{ key: \"someKey\", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }\n ],\n testDeviceCount: 0,\n testDeviceLimit: 0,\n total: 0,\n limits: {\n standard: 0,\n micro: 0,\n system: 0\n },\n groups: {\n byId: {\n // groupName: { deviceIds: [], total: 0, filters: [] },\n // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }\n },\n selectedGroup: undefined\n }\n};\n\nexport const devicesSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedGroups: (state, action: PayloadAction<Record<string, DeviceGroup>>) => {\n state.groups.byId = action.payload;\n },\n addToGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds } = action.payload;\n const maybeExistingGroup = {\n filters: [],\n deviceIds: [],\n ...state.groups.byId[group]\n };\n state.groups.byId[group] = {\n ...maybeExistingGroup,\n deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(duplicateFilter),\n total: (maybeExistingGroup.total || 0) + 1\n };\n },\n removeFromGroup: (state, action: PayloadAction<{ deviceIds: string[]; group: string }>) => {\n const { group, deviceIds: removedIds } = action.payload;\n const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};\n const changedGroup = {\n ...maybeExistingGroup,\n deviceIds: deviceIds.filter(id => !removedIds.includes(id)),\n total: Math.max(total - removedIds.length, 0)\n };\n if (changedGroup.total || changedGroup.deviceIds.length) {\n state.groups.byId[group] = changedGroup;\n return;\n } else if (state.groups.selectedGroup === group) {\n state.groups.selectedGroup = undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [group]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n },\n addGroup: (state, action: PayloadAction<{ group: DeviceGroup; groupName: string }>) => {\n const { groupName, group } = action.payload;\n state.groups.byId[groupName] = {\n ...state.groups.byId[groupName],\n ...group\n };\n },\n selectGroup: (state, { payload: group }: PayloadAction<string | undefined>) => {\n state.deviceList.deviceIds =\n group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0\n ? state.groups.byId[group].deviceIds\n : [];\n state.groups.selectedGroup = group;\n },\n removeGroup: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removal, ...remainingById } = state.groups.byId;\n state.groups.byId = remainingById;\n state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? undefined : state.groups.selectedGroup;\n },\n setDeviceListState: (state, action: PayloadAction<Partial<DeviceListState>>) => {\n state.deviceList = {\n ...state.deviceList,\n ...action.payload,\n sort: {\n ...state.deviceList.sort,\n ...action.payload.sort\n }\n };\n },\n setFilterAttributes: (state, action: PayloadAction<FilteringAttributes>) => {\n state.filteringAttributes = action.payload;\n },\n setFilterablesConfig: (state, action: PayloadAction<FilteringAttributesConfig>) => {\n state.filteringAttributesConfig = action.payload;\n },\n receivedDevices: (state, action: PayloadAction<Record<string, Device>>) => {\n state.byId = {\n ...state.byId,\n ...action.payload\n };\n },\n setDeviceFilters: (state, action: PayloadAction<DeviceFilter[]>) => {\n if (deepCompare(action.payload, state.filters)) {\n return;\n }\n state.filters = action.payload.filter(filter => filter.key && filter.operator && filter.scope && typeof filter.value !== 'undefined');\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; status: DeviceAuthState; total: number }>) => {\n const { status, total, deviceIds } = action.payload;\n if (total) {\n state.byStatus[status].deviceIds = deviceIds;\n state.byStatus[status].counts.total = total;\n }\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ countsPerTier: DeviceTierLimits; status: DeviceAuthState }>) => {\n const { countsPerTier, status } = action.payload;\n state.byStatus[status].counts = { ...countsPerTier, total: Object.values(countsPerTier).reduce((accu, tieredCount) => accu + tieredCount, 0) };\n },\n setDeviceLimits: (state, action: PayloadAction<BackendDeviceTierLimits>) => {\n const { test, ...tiers } = action.payload;\n state.limits = tiers;\n // The test device limit is returned by the tiers endpoint, but we handle it separately.\n state.testDeviceLimit = test || 0;\n },\n setTestDeviceCount: (state, action: PayloadAction<number>) => {\n state.testDeviceCount = action.payload;\n },\n receivedDevice: (state, action: PayloadAction<{ id: string } & Partial<Device>>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n maybeUpdateDevicesByStatus: (state, action: PayloadAction<{ authId?: string; deviceId: string }>) => {\n const { deviceId, authId } = action.payload;\n const device = state.byId[deviceId];\n const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter(authset => authset.id !== authId).length > 0 : false;\n if (!hasMultipleAuthSets && (Object.values(DEVICE_STATES) as string[]).includes(device.status)) {\n const deviceIds = state.byStatus[device.status].deviceIds.filter(id => id !== deviceId);\n const deviceTier = (device.attributes.tier as string) || 'standard';\n state.byStatus[device.status] = {\n deviceIds,\n counts: {\n ...state.byStatus[device.status].counts,\n [deviceTier]: Math.max(0, state.byStatus[device.status].counts[deviceTier] - 1),\n total: Math.max(0, state.byStatus[device.status].counts.total - 1)\n }\n };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;AAmCA,MAAa,YAAY;AAmGzB,MAAa,eAAgC;CAC3C,MAAM,CAKN;CACA,UAAU;GACP,cAAc,WAAW;GAAE,WAAW,CAAC;GAAG,QAAQ;IAAE,UAAU;IAAG,OAAO;IAAG,QAAQ;IAAG,OAA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AClF,MAAM,KAAK,OAAO,QAAQ,MAAM;IAC9B,GAAG,MAAM,KAAK,OAAO,QAAQ;IAC7B,GAAG,OAAO;GACZ;EACF;EACA,6BAA6B,OAAO,WAAiE;GACnG,MAAM,EAAE,UAAU,WAAW,OAAO;GACpC,MAAM,SAAS,MAAM,KAAK;GAE1B,IAAI,EADwB,UAAU,OAAO,YAAY,OAAO,UAAU,QAAO,YAAW,QAAQ,OAAO,MAAM,CAAC,CAAC,SAAS,IAAI,UACnG,OAAO,OAAO,aAAa,CAAC,CAAc,SAAS,OAAO,MAAM,GAAG;IAC9F,MAAM,YAAY,MAAM,SAAS,OAAO,OAAO,CAAC,UAAU,QAAO,OAAM,OAAO,QAAQ;IACtF,MAAM,aAAc,OAAO,WAAW,QAAmB;IACzD,MAAM,SAAS,OAAO,UAAU;KAC9B;KACA,QAAQ;MACN,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC;OAChC,aAAa,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,cAAc,CAAC;MAC9E,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,QAAQ,CAAC;KACnE;IACF;GACF;EACF;CACF;AACF,CAAC;AAED,MAAa,UAAU,aAAa;AACpC,IAAA,uBAAe,aAAa"}
@@ -162,6 +162,7 @@ declare const mockState: {
162
162
  total: number;
163
163
  }[];
164
164
  testDeviceCount: number;
165
+ testDeviceLimit: number;
165
166
  total: number;
166
167
  };
167
168
  //#endregion
@@ -162,6 +162,7 @@ declare const mockState: {
162
162
  total: number;
163
163
  }[];
164
164
  testDeviceCount: number;
165
+ testDeviceLimit: number;
165
166
  total: number;
166
167
  };
167
168
  //#endregion
@@ -14,6 +14,7 @@ const getDeviceListState = (state) => state.devices.deviceList;
14
14
  const getListedDevices = (state) => state.devices.deviceList.deviceIds;
15
15
  const getFilteringAttributes = (state) => state.devices.filteringAttributes;
16
16
  const getDeviceFilters = (state) => state.devices.filters || [];
17
+ const getTestDeviceLimit = (state) => state.devices.testDeviceLimit;
17
18
  const getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
18
19
  const getSortedFilteringAttributes = (0, _reduxjs_toolkit.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
19
20
  ...filteringAttributes,
@@ -148,5 +149,6 @@ exports.getSelectedGroup = getSelectedGroup;
148
149
  exports.getSelectedGroupInfo = getSelectedGroupInfo;
149
150
  exports.getSortedFilteringAttributes = getSortedFilteringAttributes;
150
151
  exports.getTestDeviceCount = getTestDeviceCount;
152
+ exports.getTestDeviceLimit = getTestDeviceLimit;
151
153
 
152
154
  //# sourceMappingURL=selectors.cjs.map