@northern.tech/store 0.39.0 → 0.41.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 (134) hide show
  1. package/dist/api/general-api.cjs +1 -1
  2. package/dist/api/general-api.js +1 -1
  3. package/dist/appSlice/index.js +1 -1
  4. package/dist/appSlice/selectors.d.cts +1 -1
  5. package/dist/appSlice/selectors.d.ts +1 -1
  6. package/dist/appSlice/thunks.d.cts +1 -1
  7. package/dist/appSlice/thunks.d.ts +1 -1
  8. package/dist/auth.cjs +1 -1
  9. package/dist/auth.js +1 -1
  10. package/dist/commonConstants.cjs +1 -1
  11. package/dist/commonConstants.js +1 -1
  12. package/dist/commonSelectors.cjs +1 -1
  13. package/dist/commonSelectors.d.cts +1 -1
  14. package/dist/commonSelectors.d.ts +1 -1
  15. package/dist/commonSelectors.js +1 -1
  16. package/dist/constants-CNZ5L0A0.cjs +957 -0
  17. package/dist/constants-CNZ5L0A0.cjs.map +1 -0
  18. package/dist/constants-Cj2kp3Iy.js +676 -0
  19. package/dist/constants-Cj2kp3Iy.js.map +1 -0
  20. package/dist/{constants-BwKiHHaB.d.ts → constants-D9o0Cnk_.d.cts} +2 -1
  21. package/dist/{constants-BwKiHHaB.d.cts → constants-D9o0Cnk_.d.ts} +2 -1
  22. package/dist/constants.cjs +48 -718
  23. package/dist/constants.d.cts +1 -1
  24. package/dist/constants.d.ts +1 -1
  25. package/dist/constants.js +1 -672
  26. package/dist/deploymentsSlice/constants.cjs +1 -1
  27. package/dist/deploymentsSlice/constants.d.cts +1 -1
  28. package/dist/deploymentsSlice/constants.d.ts +1 -1
  29. package/dist/deploymentsSlice/constants.js +1 -1
  30. package/dist/deploymentsSlice/index.cjs +1 -1
  31. package/dist/deploymentsSlice/index.js +1 -1
  32. package/dist/deploymentsSlice/mocks.cjs +1 -1
  33. package/dist/deploymentsSlice/mocks.cjs.map +1 -1
  34. package/dist/deploymentsSlice/mocks.d.cts +1 -1
  35. package/dist/deploymentsSlice/mocks.d.ts +1 -1
  36. package/dist/deploymentsSlice/mocks.js +1 -1
  37. package/dist/deploymentsSlice/mocks.js.map +1 -1
  38. package/dist/deploymentsSlice/selectors.cjs +1 -1
  39. package/dist/deploymentsSlice/selectors.d.cts +1 -1
  40. package/dist/deploymentsSlice/selectors.d.ts +1 -1
  41. package/dist/deploymentsSlice/selectors.js +1 -1
  42. package/dist/deploymentsSlice/thunks.d.cts +1 -1
  43. package/dist/deploymentsSlice/thunks.d.ts +1 -1
  44. package/dist/devicesSlice/constants.cjs +1 -1
  45. package/dist/devicesSlice/constants.js +1 -1
  46. package/dist/devicesSlice/index.js +1 -1
  47. package/dist/devicesSlice/mocks.js +1 -1
  48. package/dist/devicesSlice/selectors.cjs +1 -1
  49. package/dist/devicesSlice/selectors.d.cts +1 -1
  50. package/dist/devicesSlice/selectors.d.ts +1 -1
  51. package/dist/devicesSlice/selectors.js +1 -1
  52. package/dist/devicesSlice/thunks.d.cts +3 -3
  53. package/dist/devicesSlice/thunks.d.ts +3 -3
  54. package/dist/liststatehook.cjs +2 -1
  55. package/dist/liststatehook.cjs.map +1 -1
  56. package/dist/liststatehook.js +2 -1
  57. package/dist/liststatehook.js.map +1 -1
  58. package/dist/locationutils.cjs +1 -1
  59. package/dist/locationutils.js +1 -1
  60. package/dist/monitorSlice/index.js +1 -1
  61. package/dist/monitorSlice/mocks.js +1 -1
  62. package/dist/monitorSlice/selectors.d.cts +1 -1
  63. package/dist/monitorSlice/selectors.d.ts +1 -1
  64. package/dist/monitorSlice/thunks.cjs +1 -1
  65. package/dist/monitorSlice/thunks.cjs.map +1 -1
  66. package/dist/monitorSlice/thunks.d.cts +1 -1
  67. package/dist/monitorSlice/thunks.d.ts +1 -1
  68. package/dist/monitorSlice/thunks.js +1 -1
  69. package/dist/monitorSlice/thunks.js.map +1 -1
  70. package/dist/onboardingSlice/selectors.d.cts +1 -1
  71. package/dist/onboardingSlice/selectors.d.ts +1 -1
  72. package/dist/onboardingSlice/thunks.d.cts +1 -1
  73. package/dist/onboardingSlice/thunks.d.ts +1 -1
  74. package/dist/organizationSlice/constants.cjs +1 -1
  75. package/dist/organizationSlice/constants.js +1 -1
  76. package/dist/organizationSlice/index.cjs +1 -1
  77. package/dist/organizationSlice/index.js +1 -1
  78. package/dist/organizationSlice/mocks.js +1 -1
  79. package/dist/organizationSlice/selectors.cjs +1 -1
  80. package/dist/organizationSlice/selectors.d.cts +1 -1
  81. package/dist/organizationSlice/selectors.d.ts +1 -1
  82. package/dist/organizationSlice/selectors.js +1 -1
  83. package/dist/organizationSlice/thunks.d.cts +1 -1
  84. package/dist/organizationSlice/thunks.d.ts +1 -1
  85. package/dist/releasesSlice/index.js +1 -1
  86. package/dist/releasesSlice/mocks.js +1 -1
  87. package/dist/releasesSlice/selectors.d.cts +1 -1
  88. package/dist/releasesSlice/selectors.d.ts +1 -1
  89. package/dist/releasesSlice/thunks.cjs +6 -4
  90. package/dist/releasesSlice/thunks.cjs.map +1 -1
  91. package/dist/releasesSlice/thunks.d.cts +1 -1
  92. package/dist/releasesSlice/thunks.d.ts +1 -1
  93. package/dist/releasesSlice/thunks.js +6 -4
  94. package/dist/releasesSlice/thunks.js.map +1 -1
  95. package/dist/sockethook.cjs +1 -1
  96. package/dist/sockethook.js +1 -1
  97. package/dist/{store-xV2zaXAc.d.cts → store-B5-0USDz.d.cts} +3 -3
  98. package/dist/{store-BzrMxxAO.d.ts → store-CmiiLjxd.d.ts} +3 -3
  99. package/dist/store.cjs +1 -1
  100. package/dist/store.d.cts +1 -1
  101. package/dist/store.d.ts +1 -1
  102. package/dist/store.js +1 -1
  103. package/dist/storehooks.cjs +1 -1
  104. package/dist/storehooks.d.cts +1 -1
  105. package/dist/storehooks.d.ts +1 -1
  106. package/dist/storehooks.js +1 -1
  107. package/dist/thunks.cjs +57 -40
  108. package/dist/thunks.cjs.map +1 -1
  109. package/dist/thunks.d.cts +2 -2
  110. package/dist/thunks.d.ts +2 -2
  111. package/dist/thunks.js +54 -41
  112. package/dist/thunks.js.map +1 -1
  113. package/dist/usersSlice/constants.cjs +1 -1
  114. package/dist/usersSlice/constants.js +1 -1
  115. package/dist/usersSlice/index.cjs +1 -1
  116. package/dist/usersSlice/index.js +1 -1
  117. package/dist/usersSlice/mocks.js +1 -1
  118. package/dist/usersSlice/selectors.cjs +1 -1
  119. package/dist/usersSlice/selectors.d.cts +1 -1
  120. package/dist/usersSlice/selectors.d.ts +1 -1
  121. package/dist/usersSlice/selectors.js +1 -1
  122. package/dist/usersSlice/thunks.cjs +4 -0
  123. package/dist/usersSlice/thunks.d.cts +43 -3
  124. package/dist/usersSlice/thunks.d.ts +43 -3
  125. package/dist/usersSlice/thunks.js +2 -2
  126. package/dist/utils.cjs +11 -21
  127. package/dist/utils.cjs.map +1 -1
  128. package/dist/utils.d.cts +1 -1
  129. package/dist/utils.d.ts +1 -1
  130. package/dist/utils.js +11 -21
  131. package/dist/utils.js.map +1 -1
  132. package/package.json +3 -3
  133. package/dist/constants.cjs.map +0 -1
  134. package/dist/constants.js.map +0 -1
package/dist/thunks.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
3
3
  const require_appSlice_constants = require("./appSlice/constants.cjs");
4
+ const require_constants = require("./constants-CNZ5L0A0.cjs");
4
5
  const require_onboardingSlice_constants = require("./onboardingSlice/constants.cjs");
5
6
  const require_releasesSlice_constants = require("./releasesSlice/constants.cjs");
6
- const require_constants = require("./constants.cjs");
7
7
  const require_appSlice_index = require("./appSlice/index.cjs");
8
8
  const require_deploymentsSlice_index = require("./deploymentsSlice/index.cjs");
9
9
  const require_devicesSlice_index = require("./devicesSlice/index.cjs");
@@ -456,10 +456,11 @@ const deepClean = (source) => Object.entries(source).reduce((accu, [key, value])
456
456
  return accu;
457
457
  }, void 0);
458
458
  const saveDeltaDeploymentsConfig = require_store.createAppAsyncThunk(`${require_deploymentsSlice_index.sliceName}/saveDeltaDeploymentsConfig`, (config, { dispatch, getState }) => {
459
- const result = deepClean({ xdelta_args: deltaAttributeMappings.reduce((accu, { here, there }) => {
459
+ const configChange = { xdelta_args: deltaAttributeMappings.reduce((accu, { here, there }) => {
460
460
  if (config[here] !== void 0) accu[there] = config[here];
461
461
  return accu;
462
- }, {}) });
462
+ }, {}) };
463
+ const result = deepClean(configChange);
463
464
  if (!result) return Promise.resolve();
464
465
  return require_api_general_api.default.put(`${_northern_tech_utils_constants.deploymentsApiUrl}/config/binary_delta`, result).catch((err) => require_store.commonErrorHandler(err, "There was a problem storing your delta artifact generation configuration.", dispatch)).then(() => {
465
466
  const oldConfig = getState().deployments.config;
@@ -1206,7 +1207,8 @@ const updateDeviceAuth = require_store.createAppAsyncThunk(`${require_devicesSli
1206
1207
  })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !require_devicesSlice_selectors.getDeviceListState(getState()).refreshTrigger }))));
1207
1208
  const updateDevicesAuth = require_store.createAppAsyncThunk(`${require_devicesSlice_index.sliceName}/updateDevicesAuth`, ({ deviceIds, status }, { dispatch, getState }) => {
1208
1209
  let devices = require_devicesSlice_selectors.getDevicesById(getState());
1209
- return dispatch(getDevicesWithAuth(deviceIds.reduce((accu, id) => devices[id].auth_sets ? accu : [...accu, { id }], []))).then(() => {
1210
+ const deviceIdsWithoutAuth = deviceIds.reduce((accu, id) => devices[id].auth_sets ? accu : [...accu, { id }], []);
1211
+ return dispatch(getDevicesWithAuth(deviceIdsWithoutAuth)).then(() => {
1210
1212
  devices = require_devicesSlice_selectors.getDevicesById(getState());
1211
1213
  const deviceAuthUpdates = deviceIds.map((id) => {
1212
1214
  const device = devices[id];
@@ -1228,7 +1230,8 @@ const updateDevicesAuth = require_store.createAppAsyncThunk(`${require_devicesSl
1228
1230
  failed: 0,
1229
1231
  count: 0
1230
1232
  });
1231
- return dispatch(setSnackbar$2(getSnackbarMessage(skipped, count, failed)));
1233
+ const message = getSnackbarMessage(skipped, count, failed);
1234
+ return dispatch(setSnackbar$2(message));
1232
1235
  });
1233
1236
  });
1234
1237
  });
@@ -1364,19 +1367,20 @@ const getSystemDevices = require_store.createAppAsyncThunk(`${require_devicesSli
1364
1367
  if (!hasFullFiltering) return Promise.resolve();
1365
1368
  const { attributes: deviceAttributes = {} } = require_devicesSlice_selectors.getDeviceById(state, id);
1366
1369
  const { mender_gateway_system_id = "" } = deviceAttributes;
1370
+ const filters = [{
1371
+ ...require_constants.emptyFilter,
1372
+ key: "mender_is_gateway",
1373
+ operator: _northern_tech_utils_constants.DEVICE_FILTERING_OPTIONS.$ne.key,
1374
+ value: "true",
1375
+ scope: "inventory"
1376
+ }, {
1377
+ ...require_constants.emptyFilter,
1378
+ key: "mender_gateway_system_id",
1379
+ value: mender_gateway_system_id,
1380
+ scope: "inventory"
1381
+ }];
1367
1382
  const { attributes, filterTerms } = prepareSearchArguments({
1368
- filters: [{
1369
- ...require_constants.emptyFilter,
1370
- key: "mender_is_gateway",
1371
- operator: _northern_tech_utils_constants.DEVICE_FILTERING_OPTIONS.$ne.key,
1372
- value: "true",
1373
- scope: "inventory"
1374
- }, {
1375
- ...require_constants.emptyFilter,
1376
- key: "mender_gateway_system_id",
1377
- value: mender_gateway_system_id,
1378
- scope: "inventory"
1379
- }],
1383
+ filters,
1380
1384
  state
1381
1385
  });
1382
1386
  return require_api_general_api.default.post(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/search`, {
@@ -1403,28 +1407,29 @@ const getGatewayDevices = require_store.createAppAsyncThunk(`${require_devicesSl
1403
1407
  const state = getState();
1404
1408
  const { attributes = {} } = require_devicesSlice_selectors.getDeviceById(state, deviceId);
1405
1409
  const { mender_gateway_system_id = "" } = attributes;
1410
+ const filters = [
1411
+ {
1412
+ ...require_constants.emptyFilter,
1413
+ key: "id",
1414
+ operator: _northern_tech_utils_constants.DEVICE_FILTERING_OPTIONS.$ne.key,
1415
+ value: deviceId,
1416
+ scope: "identity"
1417
+ },
1418
+ {
1419
+ ...require_constants.emptyFilter,
1420
+ key: "mender_is_gateway",
1421
+ value: "true",
1422
+ scope: "inventory"
1423
+ },
1424
+ {
1425
+ ...require_constants.emptyFilter,
1426
+ key: "mender_gateway_system_id",
1427
+ value: mender_gateway_system_id,
1428
+ scope: "inventory"
1429
+ }
1430
+ ];
1406
1431
  const { attributes: attributeSelection, filterTerms } = prepareSearchArguments({
1407
- filters: [
1408
- {
1409
- ...require_constants.emptyFilter,
1410
- key: "id",
1411
- operator: _northern_tech_utils_constants.DEVICE_FILTERING_OPTIONS.$ne.key,
1412
- value: deviceId,
1413
- scope: "identity"
1414
- },
1415
- {
1416
- ...require_constants.emptyFilter,
1417
- key: "mender_is_gateway",
1418
- value: "true",
1419
- scope: "inventory"
1420
- },
1421
- {
1422
- ...require_constants.emptyFilter,
1423
- key: "mender_gateway_system_id",
1424
- value: mender_gateway_system_id,
1425
- scope: "inventory"
1426
- }
1427
- ],
1432
+ filters,
1428
1433
  state
1429
1434
  });
1430
1435
  return require_api_general_api.default.post(`${_northern_tech_utils_constants.inventoryApiUrlV2}/filters/search`, {
@@ -1591,7 +1596,7 @@ const getProductAddons = (products) => products.reduce((accu, product) => {
1591
1596
  const newEligible = addonPrices.map((p) => p.plan);
1592
1597
  accu[addonName] = {
1593
1598
  ...require_appSlice_constants.ADDONS[addonName],
1594
- eligible: [...new Set([
1599
+ eligible: [.../* @__PURE__ */ new Set([
1595
1600
  ...existingEligible,
1596
1601
  ...newEligible,
1597
1602
  require_appSlice_constants.PLANS.enterprise.id
@@ -2036,6 +2041,13 @@ const verifyEmailComplete = require_store.createAppAsyncThunk(`${require_usersSl
2036
2041
  status: err.response?.status,
2037
2042
  data: err.response?.data
2038
2043
  })).finally(() => Promise.resolve(dispatch(getUser("me")))));
2044
+ const getPendingEmailChange = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/getPendingEmailChange`, (_, { rejectWithValue }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.useradmApiUrl}/users/me/email-change/pending`).then(({ data }) => data || null).catch((e) => rejectWithValue(e)));
2045
+ const initiateEmailChange = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/initiateEmailChange`, (emailUpdate, { dispatch }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.useradmApiUrl}/users/me/email-change/start`, emailUpdate).catch((err) => require_store.commonErrorHandler(err, "An error occurred starting the email change process:", dispatch)));
2046
+ const completeEmailChange = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/completeEmailChange`, (secret_hash, { dispatch, rejectWithValue }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.useradmApiUrl}/users/email-change/complete`, { secret_hash }).catch((err) => rejectWithValue({
2047
+ status: err.response?.status,
2048
+ data: err.response?.data
2049
+ })).finally(() => Promise.resolve(dispatch(getUser("me")))));
2050
+ const cancelEmailChange = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/cancelEmailChange`, (_, { dispatch }) => require_api_general_api.default.post(`${_northern_tech_utils_constants.useradmApiUrl}/users/me/email-change/cancel`).catch((err) => require_store.commonErrorHandler(err, "An error occurred cancelling the email change request:", dispatch)));
2039
2051
  const verify2FA = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/verify2FA`, (tfaData, { dispatch }) => require_api_users_api.putVerifyTFA(`${_northern_tech_utils_constants.useradmApiUrl}/2faverify`, tfaData).then(() => Promise.resolve(dispatch(getUser("me")))).catch((err) => require_store.commonErrorHandler(err, "An error occured validating the verification code: failed to verify token, please try again.", dispatch, void 0, true)));
2040
2052
  const getUserList = require_store.createAppAsyncThunk(`${require_usersSlice_index.sliceName}/getUserList`, (_, { dispatch, getState }) => require_api_general_api.default.get(`${_northern_tech_utils_constants.useradmApiUrl}/users`).then((res) => {
2041
2053
  const currentUsersById = require_usersSlice_selectors.getUsersById(getState());
@@ -2282,7 +2294,8 @@ const deriveImpliedAreaPermissions = (area, areaPermissions, skipPermissions = [
2282
2294
  */
2283
2295
  const transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, excessiveAccessSelector) => {
2284
2296
  const permissionSetObject = areaPermissions.reduce((accu, { item, uiPermissions }) => {
2285
- accu = deriveImpliedAreaPermissions(area, uiPermissions, _northern_tech_utils_constants.scopedPermissionAreas.releases.key === area && item !== _northern_tech_utils_constants.ALL_RELEASES ? [_northern_tech_utils_constants.uiPermissionsById.upload.value] : []).reduce((itemPermissionAccu, impliedPermission) => {
2297
+ const skipPermissions = _northern_tech_utils_constants.scopedPermissionAreas.releases.key === area && item !== _northern_tech_utils_constants.ALL_RELEASES ? [_northern_tech_utils_constants.uiPermissionsById.upload.value] : [];
2298
+ accu = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions).reduce((itemPermissionAccu, impliedPermission) => {
2286
2299
  const permissionSetState = itemPermissionAccu[_northern_tech_utils_constants.uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
2287
2300
  type: _northern_tech_utils_constants.uiPermissionsByArea[area].scope,
2288
2301
  value: []
@@ -2518,6 +2531,7 @@ exports.addTenant = addTenant;
2518
2531
  exports.addUserToCurrentTenant = addUserToCurrentTenant;
2519
2532
  exports.advanceOnboarding = advanceOnboarding;
2520
2533
  exports.applyDeviceConfig = applyDeviceConfig;
2534
+ exports.cancelEmailChange = cancelEmailChange;
2521
2535
  exports.cancelFileUpload = require_releasesSlice_thunks.cancelFileUpload;
2522
2536
  exports.cancelRequest = cancelRequest;
2523
2537
  exports.cancelUpgrade = cancelUpgrade;
@@ -2526,6 +2540,7 @@ exports.changeNotificationSetting = require_monitorSlice_thunks.changeNotificati
2526
2540
  exports.changeSsoConfig = changeSsoConfig;
2527
2541
  exports.checkEmailExists = checkEmailExists;
2528
2542
  exports.checkReleasesExistence = require_releasesSlice_thunks.checkReleasesExistence;
2543
+ exports.completeEmailChange = completeEmailChange;
2529
2544
  exports.completeUpgrade = completeUpgrade;
2530
2545
  exports.confirmCardUpdate = confirmCardUpdate;
2531
2546
  exports.confirmOAuthLink = confirmOAuthLink;
@@ -2600,6 +2615,7 @@ exports.getLatestDeviceAlerts = require_monitorSlice_thunks.getLatestDeviceAlert
2600
2615
  exports.getManifest = require_releasesSlice_thunks.getManifest;
2601
2616
  exports.getManifests = require_releasesSlice_thunks.getManifests;
2602
2617
  exports.getOnboardingState = getOnboardingState;
2618
+ exports.getPendingEmailChange = getPendingEmailChange;
2603
2619
  exports.getPermissionSets = getPermissionSets;
2604
2620
  exports.getProducts = getProducts;
2605
2621
  exports.getRelease = require_releasesSlice_thunks.getRelease;
@@ -2626,6 +2642,7 @@ exports.getUserSettings = getUserSettings;
2626
2642
  exports.getUserSubscription = getUserSubscription;
2627
2643
  exports.getWebhookEvents = getWebhookEvents;
2628
2644
  exports.initializeSelf = initializeSelf;
2645
+ exports.initiateEmailChange = initiateEmailChange;
2629
2646
  exports.loginUser = loginUser;
2630
2647
  exports.logoutUser = logoutUser;
2631
2648
  exports.normalizeRbacRoles = normalizeRbacRoles;