@northern.tech/store 0.9.0 → 0.11.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 (137) hide show
  1. package/dist/actions.cjs +7 -3
  2. package/dist/actions.cjs.map +1 -1
  3. package/dist/actions.d.cts +1 -1
  4. package/dist/actions.d.ts +1 -1
  5. package/dist/actions.js +6 -6
  6. package/dist/api/general-api.js +1 -1
  7. package/dist/api/users-api.js +1 -1
  8. package/dist/appSlice/index.js +1 -1
  9. package/dist/appSlice/mocks.js +1 -1
  10. package/dist/appSlice/thunks.cjs +17 -8
  11. package/dist/appSlice/thunks.cjs.map +1 -1
  12. package/dist/appSlice/thunks.js +15 -15
  13. package/dist/auth.js +1 -1
  14. package/dist/{chunk-ITGVP27I.js → chunk-4FNSLYK5.js} +11 -11
  15. package/dist/{chunk-MUZHPRLI.js → chunk-6KNRR7A5.js} +4 -4
  16. package/dist/{chunk-ZOF45MII.js → chunk-CUU3N6KW.js} +13 -13
  17. package/dist/{chunk-ZRSVD5QY.js → chunk-I3H5EFZK.js} +15 -15
  18. package/dist/{chunk-UVYRVFZX.js → chunk-MH5WPYQI.js} +11 -5
  19. package/dist/chunk-MH5WPYQI.js.map +1 -0
  20. package/dist/{chunk-VWNMAIL2.js → chunk-NVNO3I3K.js} +37 -28
  21. package/dist/chunk-NVNO3I3K.js.map +1 -0
  22. package/dist/{chunk-KQ6AGXRK.js → chunk-REZWSU22.js} +8 -4
  23. package/dist/chunk-REZWSU22.js.map +1 -0
  24. package/dist/{chunk-CKF76YO4.js → chunk-RFF52JYU.js} +1 -1
  25. package/dist/chunk-RFF52JYU.js.map +1 -0
  26. package/dist/{chunk-N3TU2WH2.js → chunk-X3NF4KNC.js} +5 -5
  27. package/dist/{chunk-VANBSJS5.js → chunk-ZNAJKEP2.js} +1 -1
  28. package/dist/chunk-ZNAJKEP2.js.map +1 -0
  29. package/dist/commonConstants.js +1 -1
  30. package/dist/commonSelectors.cjs +8 -3
  31. package/dist/commonSelectors.cjs.map +1 -1
  32. package/dist/commonSelectors.js +6 -6
  33. package/dist/constants.js +1 -1
  34. package/dist/deploymentsSlice/constants.js +1 -1
  35. package/dist/deploymentsSlice/index.js +1 -1
  36. package/dist/deploymentsSlice/mocks.js +1 -1
  37. package/dist/deploymentsSlice/selectors.js +1 -1
  38. package/dist/deploymentsSlice/thunks.cjs +17 -8
  39. package/dist/deploymentsSlice/thunks.cjs.map +1 -1
  40. package/dist/deploymentsSlice/thunks.js +15 -15
  41. package/dist/devicesSlice/constants.js +1 -1
  42. package/dist/devicesSlice/index.cjs +7 -3
  43. package/dist/devicesSlice/index.cjs.map +1 -1
  44. package/dist/devicesSlice/index.d.cts +4 -4
  45. package/dist/devicesSlice/index.d.ts +4 -4
  46. package/dist/devicesSlice/index.js +2 -2
  47. package/dist/devicesSlice/mocks.cjs +8 -4
  48. package/dist/devicesSlice/mocks.cjs.map +1 -1
  49. package/dist/devicesSlice/mocks.d.cts +5 -1
  50. package/dist/devicesSlice/mocks.d.ts +5 -1
  51. package/dist/devicesSlice/mocks.js +3 -3
  52. package/dist/devicesSlice/mocks.js.map +1 -1
  53. package/dist/devicesSlice/selectors.cjs +12 -5
  54. package/dist/devicesSlice/selectors.cjs.map +1 -1
  55. package/dist/devicesSlice/selectors.d.cts +310 -3
  56. package/dist/devicesSlice/selectors.d.ts +310 -3
  57. package/dist/devicesSlice/selectors.js +6 -4
  58. package/dist/devicesSlice/thunks.cjs +19 -10
  59. package/dist/devicesSlice/thunks.cjs.map +1 -1
  60. package/dist/devicesSlice/thunks.d.cts +5 -5
  61. package/dist/devicesSlice/thunks.d.ts +5 -5
  62. package/dist/devicesSlice/thunks.js +17 -17
  63. package/dist/liststatehook.js +1 -1
  64. package/dist/locationutils.js +1 -1
  65. package/dist/monitorSlice/index.js +1 -1
  66. package/dist/monitorSlice/mocks.js +1 -1
  67. package/dist/monitorSlice/thunks.cjs +15 -6
  68. package/dist/monitorSlice/thunks.cjs.map +1 -1
  69. package/dist/monitorSlice/thunks.js +13 -13
  70. package/dist/onboardingSlice/index.cjs.map +1 -1
  71. package/dist/onboardingSlice/index.d.cts +1 -1
  72. package/dist/onboardingSlice/index.d.ts +1 -1
  73. package/dist/onboardingSlice/index.js +1 -1
  74. package/dist/onboardingSlice/mocks.cjs.map +1 -1
  75. package/dist/onboardingSlice/mocks.js +1 -1
  76. package/dist/onboardingSlice/thunks.cjs +27 -9
  77. package/dist/onboardingSlice/thunks.cjs.map +1 -1
  78. package/dist/onboardingSlice/thunks.js +15 -15
  79. package/dist/organizationSlice/constants.js +1 -1
  80. package/dist/organizationSlice/index.js +1 -1
  81. package/dist/organizationSlice/mocks.js +1 -1
  82. package/dist/organizationSlice/selectors.js +1 -1
  83. package/dist/organizationSlice/thunks.cjs +19 -10
  84. package/dist/organizationSlice/thunks.cjs.map +1 -1
  85. package/dist/organizationSlice/thunks.d.cts +3 -3
  86. package/dist/organizationSlice/thunks.d.ts +3 -3
  87. package/dist/organizationSlice/thunks.js +15 -15
  88. package/dist/releasesSlice/index.js +1 -1
  89. package/dist/releasesSlice/mocks.js +1 -1
  90. package/dist/releasesSlice/selectors.js +1 -1
  91. package/dist/releasesSlice/thunks.cjs +15 -6
  92. package/dist/releasesSlice/thunks.cjs.map +1 -1
  93. package/dist/releasesSlice/thunks.js +13 -13
  94. package/dist/selectors.cjs +12 -5
  95. package/dist/selectors.cjs.map +1 -1
  96. package/dist/selectors.d.cts +1 -1
  97. package/dist/selectors.d.ts +1 -1
  98. package/dist/selectors.js +37 -35
  99. package/dist/sockethook.js +1 -1
  100. package/dist/store.cjs +7 -3
  101. package/dist/store.cjs.map +1 -1
  102. package/dist/store.js +7 -7
  103. package/dist/storehooks.cjs +38 -17
  104. package/dist/storehooks.cjs.map +1 -1
  105. package/dist/storehooks.js +26 -23
  106. package/dist/storehooks.js.map +1 -1
  107. package/dist/thunks.cjs +31 -13
  108. package/dist/thunks.cjs.map +1 -1
  109. package/dist/thunks.d.cts +1 -1
  110. package/dist/thunks.d.ts +1 -1
  111. package/dist/thunks.js +17 -17
  112. package/dist/useDeploymentDevice.cjs +17 -8
  113. package/dist/useDeploymentDevice.cjs.map +1 -1
  114. package/dist/useDeploymentDevice.js +16 -16
  115. package/dist/usersSlice/constants.js +1 -1
  116. package/dist/usersSlice/index.cjs.map +1 -1
  117. package/dist/usersSlice/index.d.cts +1 -1
  118. package/dist/usersSlice/index.d.ts +1 -1
  119. package/dist/usersSlice/index.js +2 -2
  120. package/dist/usersSlice/mocks.cjs.map +1 -1
  121. package/dist/usersSlice/mocks.js +2 -2
  122. package/dist/usersSlice/selectors.js +1 -1
  123. package/dist/usersSlice/thunks.cjs +17 -8
  124. package/dist/usersSlice/thunks.cjs.map +1 -1
  125. package/dist/usersSlice/thunks.js +15 -15
  126. package/dist/utils.js +1 -1
  127. package/package.json +1 -1
  128. package/dist/chunk-CKF76YO4.js.map +0 -1
  129. package/dist/chunk-KQ6AGXRK.js.map +0 -1
  130. package/dist/chunk-UVYRVFZX.js.map +0 -1
  131. package/dist/chunk-VANBSJS5.js.map +0 -1
  132. package/dist/chunk-VWNMAIL2.js.map +0 -1
  133. /package/dist/{chunk-ITGVP27I.js.map → chunk-4FNSLYK5.js.map} +0 -0
  134. /package/dist/{chunk-MUZHPRLI.js.map → chunk-6KNRR7A5.js.map} +0 -0
  135. /package/dist/{chunk-ZOF45MII.js.map → chunk-CUU3N6KW.js.map} +0 -0
  136. /package/dist/{chunk-ZRSVD5QY.js.map → chunk-I3H5EFZK.js.map} +0 -0
  137. /package/dist/{chunk-N3TU2WH2.js.map → chunk-X3NF4KNC.js.map} +0 -0
@@ -57,7 +57,11 @@ var initialState = {
57
57
  // { items: [{ key: "someKey", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }
58
58
  ],
59
59
  total: 0,
60
- limit: 0,
60
+ limits: {
61
+ standard: 0,
62
+ micro: 0,
63
+ system: 0
64
+ },
61
65
  groups: {
62
66
  byId: {
63
67
  // groupName: { deviceIds: [], total: 0, filters: [] },
@@ -163,8 +167,8 @@ var devicesSlice = createSlice({
163
167
  const { count, status } = action.payload;
164
168
  state.byStatus[status].total = count;
165
169
  },
166
- setDeviceLimit: (state, action) => {
167
- state.limit = action.payload;
170
+ setDeviceLimits: (state, action) => {
171
+ state.limits = action.payload;
168
172
  },
169
173
  receivedDevice: (state, action) => {
170
174
  state.byId[action.payload.id] = {
@@ -193,4 +197,4 @@ export {
193
197
  actions,
194
198
  devicesSlice_default
195
199
  };
196
- //# sourceMappingURL=chunk-KQ6AGXRK.js.map
200
+ //# sourceMappingURL=chunk-REZWSU22.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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 Device as BackendDeviceAuth,\n ConnectionState,\n DeviceConfiguration,\n DeviceState,\n DeviceTierLimits,\n MonitorConfiguration,\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 Device = BackendDeviceAuth &\n UiDeviceAttributes & {\n check_in_time_exact?: string;\n check_in_time_rounded?: string;\n config?: DeviceConfiguration;\n connect_status?: ConnectionState['status'];\n connect_updated_ts?: string;\n deploymentsCount?: number;\n deviceDeployments?: DeviceDeployment;\n etag?: string;\n gatewayIds?: 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: string;\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};\nexport type DeviceStatus = DeviceAuthState | 'active' | 'inactive';\n\nexport type DeviceGroups = {\n byId: Record<string, DeviceGroup>;\n selectedGroup?: string;\n};\nexport type DeviceSliceType = {\n byId: Record<string, Device>;\n byStatus: Record<DeviceStatus, { deviceIds: string[]; total: number }>;\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 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: [], total: 0 },\n active: { deviceIds: [], total: 0 },\n inactive: { deviceIds: [], total: 0 },\n [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },\n [DEVICE_STATES.rejected]: { deviceIds: [], 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 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 setInactiveDevices: (state, action: PayloadAction<{ activeDeviceTotal: number; inactiveDeviceTotal: number }>) => {\n const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;\n state.byStatus.active.total = activeDeviceTotal;\n state.byStatus.inactive.total = inactiveDeviceTotal;\n },\n setDeviceReports: (state, action: PayloadAction<DeviceReport[]>) => {\n state.reports = action.payload;\n },\n setDevicesByStatus: (state, action: PayloadAction<{ deviceIds: string[]; forceUpdate?: boolean; status: DeviceStatus; total: number }>) => {\n const { forceUpdate, status, total, deviceIds } = action.payload;\n state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];\n },\n setDevicesCountByStatus: (state, action: PayloadAction<{ count: number; status: DeviceStatus }>) => {\n const { count, status } = action.payload;\n state.byStatus[status].total = count;\n },\n setDeviceLimits: (state, action: PayloadAction<DeviceTierLimits>) => {\n state.limits = 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 state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };\n }\n }\n }\n});\n\nexport const actions = devicesSlice.actions;\nexport default devicesSlice.reducer;\n"],"mappings":";;;;;;;AAwBA,SAAS,aAAa,uBAAuB;AAE7C,SAAS,mBAAmB;AAOrB,IAAM,YAAY;AA+FlB,IAAM,eAAgC;AAAA,EAC3C,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN;AAAA,EACA,UAAU;AAAA,IACR,CAAC,cAAc,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACpD,QAAQ,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IAClC,UAAU,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACpC,CAAC,cAAc,OAAO,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACnD,CAAC,cAAc,OAAO,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,IACnD,CAAC,cAAc,QAAQ,GAAG,EAAE,WAAW,CAAC,GAAG,OAAO,EAAE;AAAA,EACtD;AAAA,EACA,YAAY;AAAA,IACV,WAAW,CAAC;AAAA,IACZ,GAAG;AAAA,IACH,oBAAoB,CAAC;AAAA,IACrB,gBAAgB,CAAC;AAAA,IACjB,WAAW,CAAC;AAAA,IACZ,MAAM;AAAA,MACJ,WAAW,gBAAgB;AAAA;AAAA;AAAA,IAG7B;AAAA,IACA,OAAO,cAAc;AAAA,IACrB,OAAO;AAAA,IACP,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,MAAM;AAAA,EACR;AAAA,EACA,SAAS;AAAA;AAAA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IACxB;AAAA,IACA,gBAAgB,CAAC,OAAO,WAA4D;AAClF,YAAM,KAAK,OAAO,QAAQ,EAAE,IAAI;AAAA,QAC9B,GAAG,MAAM,KAAK,OAAO,QAAQ,EAAE;AAAA,QAC/B,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AAAA,IACA,4BAA4B,CAAC,OAAO,WAAiE;AACnG,YAAM,EAAE,UAAU,OAAO,IAAI,OAAO;AACpC,YAAM,SAAS,MAAM,KAAK,QAAQ;AAClC,YAAM,sBAAsB,UAAU,OAAO,YAAY,OAAO,UAAU,OAAO,aAAW,QAAQ,OAAO,MAAM,EAAE,SAAS,IAAI;AAChI,UAAI,CAAC,uBAAwB,OAAO,OAAO,aAAa,EAAe,SAAS,OAAO,MAAM,GAAG;AAC9F,cAAM,YAAY,MAAM,SAAS,OAAO,MAAM,EAAE,UAAU,OAAO,QAAM,OAAO,QAAQ;AACtF,cAAM,SAAS,OAAO,MAAM,IAAI,EAAE,WAAW,OAAO,KAAK,IAAI,GAAG,MAAM,SAAS,OAAO,MAAM,EAAE,QAAQ,CAAC,EAAE;AAAA,MAC3G;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,aAAa;AACpC,IAAO,uBAAQ,aAAa;","names":[]}
@@ -143,4 +143,4 @@ export {
143
143
  actions,
144
144
  usersSlice_default
145
145
  };
146
- //# sourceMappingURL=chunk-CKF76YO4.js.map
146
+ //# sourceMappingURL=chunk-RFF52JYU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/usersSlice/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 { User as BackendUser, DeploymentPhase, TenantInfo, TenantsIdName } from '@northern.tech/types/MenderTypes';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { FilterOperator, PermissionSet, Role } from '../constants';\nimport { defaultPermissionSets, rolesById } from '../constants';\nimport type { ReadState } from './constants';\nimport { READ_STATES } from './constants';\n\nexport const sliceName = 'users';\nexport type User = BackendUser & TenantInfo & { tenants?: TenantsIdName };\nexport type UserSession = {\n expiresAt?: string;\n token: string;\n};\nexport type CustomColumn = {\n attribute: {\n name: string;\n scope: string;\n };\n size: number;\n};\n\ntype FilterOption = {\n key: string;\n operator: FilterOperator;\n scope: string;\n value: string;\n};\nexport type GlobalSettings = {\n [x: string]: any;\n id_attribute?: {\n attribute: string;\n scope: string;\n };\n previousFilters: FilterOption[];\n previousPhases: DeploymentPhase[][];\n retries: number;\n};\ntype Column = {\n id: string;\n key: string;\n name: string;\n scope: string;\n title: string;\n};\nexport type UserSettings = {\n [x: string]: any;\n columnSelection: Column[];\n feedbackCollectedAt?: string;\n mode?: 'light' | 'dark';\n onboarding: Partial<{\n address: string;\n approach: 'physical' | 'virtual' | 'mcu' | null;\n complete: boolean;\n demoArtifactPort: number;\n deviceType: string[] | string;\n progress: string;\n showTips: null | boolean;\n showTipsDialog: boolean;\n }>;\n tooltips?: object;\n trackingConsentGiven?: boolean;\n};\ntype UserSliceState = {\n activationCode?: string;\n byId: Record<string, User>;\n currentSession?: UserSession | object;\n currentUser: string | null;\n customColumns: CustomColumn[];\n globalSettings: GlobalSettings;\n permissionSetsById: Record<string, PermissionSet>;\n qrCode: string | null;\n rolesById: Record<string, Role>;\n rolesInitialized: boolean;\n settingsInitialized: boolean;\n showConnectDeviceDialog: boolean;\n showFeedbackDialog: boolean;\n showStartupNotification: boolean;\n tooltips: {\n byId: Record<string, { readState: ReadState }>;\n };\n userSettings: UserSettings;\n userSettingsInitialized: boolean;\n};\nexport const initialState: UserSliceState = {\n activationCode: undefined,\n byId: {},\n currentUser: null,\n currentSession: {\n // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting\n },\n customColumns: [],\n qrCode: null,\n globalSettings: {\n id_attribute: undefined,\n previousFilters: [],\n previousPhases: [],\n retries: 0\n },\n permissionSetsById: {\n ...defaultPermissionSets\n },\n rolesById: {\n ...rolesById\n },\n rolesInitialized: false,\n settingsInitialized: false,\n showConnectDeviceDialog: false,\n showFeedbackDialog: false,\n showStartupNotification: false,\n tooltips: {\n byId: {\n // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants\n }\n },\n userSettings: {\n columnSelection: [],\n onboarding: {}\n },\n userSettingsInitialized: false\n};\n\nexport const usersSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n receivedQrCode: (state, action: PayloadAction<string | null>) => {\n state.qrCode = action.payload;\n },\n successfullyLoggedIn: (state, action: PayloadAction<UserSession>) => {\n state.currentSession = action.payload;\n },\n receivedUserList: (state, action: PayloadAction<Record<string, User>>) => {\n state.byId = action.payload;\n },\n receivedActivationCode: (state, action: PayloadAction<string>) => {\n state.activationCode = action.payload;\n },\n receivedUser: (state, action: PayloadAction<User>) => {\n state.byId[action.payload.id] = action.payload;\n state.currentUser = action.payload.id;\n },\n removedUser: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: removedUser, ...byId } = state.byId;\n state.byId = byId;\n state.currentUser = state.currentUser === action.payload ? null : state.currentUser;\n },\n updatedUser: (state, action: PayloadAction<Partial<User> & { id: string }>) => {\n state.byId[action.payload.id] = {\n ...state.byId[action.payload.id],\n ...action.payload\n };\n },\n receivedPermissionSets: (state, action: PayloadAction<Record<string, PermissionSet>>) => {\n state.permissionSetsById = action.payload;\n },\n receivedRoles: (state, action: PayloadAction<Record<string, Role>>) => {\n state.rolesById = action.payload;\n state.rolesInitialized = true;\n },\n finishedRoleInitialization: (state, action) => {\n state.rolesInitialized = action.payload;\n },\n createdRole: (state, action: PayloadAction<Role>) => {\n state.rolesById[action.payload.name] = {\n ...state.rolesById[action.payload.name],\n ...action.payload\n };\n },\n removedRole: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: toBeRemoved, ...rolesById } = state.rolesById;\n state.rolesById = rolesById;\n },\n setCustomColumns: (state, action: PayloadAction<CustomColumn[]>) => {\n state.customColumns = action.payload;\n },\n setGlobalSettings: (state, action: PayloadAction<GlobalSettings>) => {\n state.settingsInitialized = true;\n state.globalSettings = {\n ...state.globalSettings,\n ...action.payload\n };\n },\n setUserSettings: (state, action: PayloadAction<UserSettings>) => {\n state.userSettingsInitialized = true;\n state.userSettings = {\n ...state.userSettings,\n ...action.payload\n };\n },\n setTooltipState: (state, action: PayloadAction<{ id: string; readState: ReadState }>) => {\n const { id, readState = READ_STATES.read } = action.payload;\n state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };\n },\n setTooltipsState: (state, action: PayloadAction<UserSliceState['tooltips']['byId']>) => {\n state.tooltips.byId = {\n ...state.tooltips.byId,\n ...action.payload\n };\n },\n setShowFeedbackDialog: (state, action: PayloadAction<boolean>) => {\n state.showFeedbackDialog = action.payload;\n },\n setShowConnectingDialog: (state, action: PayloadAction<boolean>) => {\n state.showConnectDeviceDialog = action.payload;\n },\n setShowStartupNotification: (state, action: PayloadAction<boolean>) => {\n state.showStartupNotification = action.payload;\n }\n }\n});\n\nexport const actions = usersSlice.actions;\nexport default usersSlice.reducer;\n"],"mappings":";;;;;;;AAeA,SAAS,mBAAmB;AAOrB,IAAM,YAAY;AA4ElB,IAAM,eAA+B;AAAA,EAC1C,gBAAgB;AAAA,EAChB,MAAM,CAAC;AAAA,EACP,aAAa;AAAA,EACb,gBAAgB;AAAA;AAAA,EAEhB;AAAA,EACA,eAAe,CAAC;AAAA,EAChB,QAAQ;AAAA,EACR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;AAAA,IACpE;AAAA,IACA,kBAAkB,CAAC,OAAO,WAA8D;AACtF,YAAM,SAAS,OAAO;AAAA,QACpB,GAAG,MAAM,SAAS;AAAA,QAClB,GAAG,OAAO;AAAA,MACZ;AAAA,IACF;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAmC;AAChE,YAAM,qBAAqB,OAAO;AAAA,IACpC;AAAA,IACA,yBAAyB,CAAC,OAAO,WAAmC;AAClE,YAAM,0BAA0B,OAAO;AAAA,IACzC;AAAA,IACA,4BAA4B,CAAC,OAAO,WAAmC;AACrE,YAAM,0BAA0B,OAAO;AAAA,IACzC;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,WAAW;AAClC,IAAO,qBAAQ,WAAW;","names":["rolesById"]}
@@ -2,23 +2,23 @@ import {
2
2
  commonErrorFallback,
3
3
  commonErrorHandler,
4
4
  createAppAsyncThunk
5
- } from "./chunk-ZOF45MII.js";
5
+ } from "./chunk-CUU3N6KW.js";
6
6
  import {
7
7
  general_api_default
8
8
  } from "./chunk-5M6EUVNO.js";
9
9
  import {
10
10
  actions_default
11
- } from "./chunk-ITGVP27I.js";
11
+ } from "./chunk-4FNSLYK5.js";
12
12
  import {
13
13
  actions,
14
14
  sliceName
15
15
  } from "./chunk-HLX5L3IM.js";
16
16
  import {
17
17
  getSearchEndpoint
18
- } from "./chunk-ZRSVD5QY.js";
18
+ } from "./chunk-I3H5EFZK.js";
19
19
  import {
20
20
  getDeviceFilters
21
- } from "./chunk-UVYRVFZX.js";
21
+ } from "./chunk-MH5WPYQI.js";
22
22
  import {
23
23
  convertDeviceListStateToFilters
24
24
  } from "./chunk-GX2TWNLC.js";
@@ -107,4 +107,4 @@ export {
107
107
  getDeviceMonitorConfig,
108
108
  changeNotificationSetting
109
109
  };
110
- //# sourceMappingURL=chunk-N3TU2WH2.js.map
110
+ //# sourceMappingURL=chunk-X3NF4KNC.js.map
@@ -48,4 +48,4 @@ export {
48
48
  actions,
49
49
  onboardingSlice_default
50
50
  };
51
- //# sourceMappingURL=chunk-VANBSJS5.js.map
51
+ //# sourceMappingURL=chunk-ZNAJKEP2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/onboardingSlice/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 { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nexport const sliceName = 'onboarding';\n\nexport type OnboardingApproach = 'virtual' | 'physical' | 'mcu';\ntype OnboardingSliceType = {\n address?: string;\n approach: OnboardingApproach | null;\n complete: boolean;\n demoArtifactPort: number;\n deviceConnection?: string;\n deviceType: string[] | string | null;\n progress: string | null;\n showTips: boolean | null;\n showTipsDialog: boolean;\n};\n\nexport const initialState: OnboardingSliceType = {\n approach: null,\n complete: false,\n deviceType: null,\n demoArtifactPort: 85,\n progress: null,\n showTips: null,\n showTipsDialog: false\n};\n\nexport const onboardingSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setOnboardingState: (state, action: PayloadAction<Partial<OnboardingSliceType>>) => ({ ...state, ...action.payload }),\n setDemoArtifactPort: (state, action: PayloadAction<number>) => {\n state.demoArtifactPort = action.payload;\n },\n setShowOnboardingHelp: (state, action: PayloadAction<boolean>) => {\n state.showTips = action.payload;\n },\n setShowDismissOnboardingTipsDialog: (state, action: PayloadAction<boolean>) => {\n state.showTipsDialog = action.payload;\n },\n setOnboardingComplete: (state, action: PayloadAction<boolean>) => {\n state.complete = action.payload;\n },\n setOnboardingProgress: (state, action: PayloadAction<string>) => {\n state.progress = action.payload;\n },\n setOnboardingDeviceType: (state, action: PayloadAction<string[] | string>) => {\n state.deviceType = action.payload;\n },\n setOnboardingApproach: (state, action: PayloadAction<OnboardingApproach>) => {\n state.approach = action.payload;\n }\n }\n});\n\nexport const actions = onboardingSlice.actions;\nexport default onboardingSlice.reducer;\n"],"mappings":";AAcA,SAAS,mBAAmB;AAErB,IAAM,YAAY;AAelB,IAAM,eAAoC;AAAA,EAC/C,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,gBAAgB;AAClB;AAEO,IAAM,kBAAkB,YAAY;AAAA,EACzC,MAAM;AAAA,EACN;AAAA,EACA,UAAU;AAAA,IACR,oBAAoB,CAAC,OAAO,YAAyD,EAAE,GAAG,OAAO,GAAG,OAAO,QAAQ;AAAA,IACnH,qBAAqB,CAAC,OAAO,WAAkC;AAC7D,YAAM,mBAAmB,OAAO;AAAA,IAClC;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAmC;AAChE,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,IACA,oCAAoC,CAAC,OAAO,WAAmC;AAC7E,YAAM,iBAAiB,OAAO;AAAA,IAChC;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAmC;AAChE,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,IACA,uBAAuB,CAAC,OAAO,WAAkC;AAC/D,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,IACA,yBAAyB,CAAC,OAAO,WAA6C;AAC5E,YAAM,aAAa,OAAO;AAAA,IAC5B;AAAA,IACA,uBAAuB,CAAC,OAAO,WAA8C;AAC3E,YAAM,WAAW,OAAO;AAAA,IAC1B;AAAA,EACF;AACF,CAAC;AAEM,IAAM,UAAU,gBAAgB;AACvC,IAAO,0BAAQ,gBAAgB;","names":[]}
@@ -12,8 +12,8 @@ import {
12
12
  timeUnits
13
13
  } from "./chunk-WWED74SG.js";
14
14
  import "./chunk-2DYA3X77.js";
15
- import "./chunk-FAJ3I2UQ.js";
16
15
  import "./chunk-ZKAH3APE.js";
16
+ import "./chunk-FAJ3I2UQ.js";
17
17
  import "./chunk-OWWCFJZ5.js";
18
18
  export {
19
19
  DEVICE_LIST_MAXIMUM_LENGTH,
@@ -763,7 +763,7 @@ var getSortedFilteringAttributes = (0, import_toolkit3.createSelector)([getFilte
763
763
  ...filteringAttributes,
764
764
  identityAttributes: [...filteringAttributes.identityAttributes, "id"]
765
765
  }));
766
- var getDeviceLimit = (state) => state.devices.limit;
766
+ var getDeviceLimits = (state) => state.devices.limits;
767
767
  var getFilteringAttributesLimit = (state) => state.devices.filteringAttributesLimit;
768
768
  var getDeviceIdentityAttributes = (0, import_toolkit3.createSelector)(
769
769
  [getFilteringAttributes, getFilteringAttributesLimit],
@@ -801,9 +801,14 @@ var getSelectedGroupInfo = (0, import_toolkit3.createSelector)(
801
801
  return { groupCount, selectedGroup, groupFilters };
802
802
  }
803
803
  );
804
+ var getCombinedLimit = (0, import_toolkit3.createSelector)(
805
+ [getDeviceLimits],
806
+ (deviceLimits) => Object.values(deviceLimits).reduce((accu, limit) => accu + Math.max(limit ?? 0, 0), 0)
807
+ // limit might be -1 for unlimited devices
808
+ );
804
809
  var getLimitMaxed = (0, import_toolkit3.createSelector)(
805
- [getAcceptedDevices, getDeviceLimit],
806
- ({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
810
+ [getAcceptedDevices, getCombinedLimit],
811
+ ({ total: acceptedDevices = 0 }, combinedLimit) => !!combinedLimit && combinedLimit <= acceptedDevices
807
812
  );
808
813
  var getGroupsByIdWithoutUngrouped = (0, import_toolkit3.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
809
814
  var getGroupData = (0, import_toolkit3.createSelector)([getGroupsByIdWithoutUngrouped], (groups) => {