@northern.tech/store 0.19.2 → 0.21.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 (148) hide show
  1. package/dist/actions.cjs +3 -0
  2. package/dist/actions.cjs.map +1 -1
  3. package/dist/actions.d.cts +2 -1
  4. package/dist/actions.d.ts +2 -1
  5. package/dist/actions.js +3 -3
  6. package/dist/api/general-api.js +1 -1
  7. package/dist/api/users-api.js +1 -1
  8. package/dist/appSlice/constants.cjs +3 -45
  9. package/dist/appSlice/constants.cjs.map +1 -1
  10. package/dist/appSlice/constants.d.cts +0 -15
  11. package/dist/appSlice/constants.d.ts +0 -15
  12. package/dist/appSlice/constants.js +1 -1
  13. package/dist/appSlice/index.js +1 -1
  14. package/dist/appSlice/mocks.js +1 -1
  15. package/dist/appSlice/thunks.cjs +14 -56
  16. package/dist/appSlice/thunks.cjs.map +1 -1
  17. package/dist/appSlice/thunks.js +13 -13
  18. package/dist/auth.js +1 -1
  19. package/dist/{chunk-KJ2SUFAU.js → chunk-4UV7ZJXY.js} +77 -12
  20. package/dist/chunk-4UV7ZJXY.js.map +1 -0
  21. package/dist/{chunk-43ZBO3JW.js → chunk-4ZYLGBJU.js} +2 -2
  22. package/dist/{chunk-45BHMNX6.js → chunk-6PYYMAFS.js} +6 -6
  23. package/dist/{chunk-ZAZTNDSY.js → chunk-7KSKENLP.js} +3 -3
  24. package/dist/{chunk-AV7SRATY.js → chunk-7VFPMJCH.js} +6 -6
  25. package/dist/{chunk-B3C6H2PR.js → chunk-7WIISD2N.js} +17 -14
  26. package/dist/{chunk-B3C6H2PR.js.map → chunk-7WIISD2N.js.map} +1 -1
  27. package/dist/{chunk-AJ6DIDO4.js → chunk-DBBE6D36.js} +4 -46
  28. package/dist/chunk-DBBE6D36.js.map +1 -0
  29. package/dist/{chunk-RJRZXDVT.js → chunk-GHATCG2U.js} +2 -2
  30. package/dist/{chunk-42GZ6FGV.js → chunk-PL6RIFD5.js} +2 -2
  31. package/dist/{chunk-VCEFZTWS.js → chunk-TIL2S3JA.js} +4 -1
  32. package/dist/chunk-TIL2S3JA.js.map +1 -0
  33. package/dist/{chunk-O7DR57RN.js → chunk-ZGRY42BZ.js} +9 -12
  34. package/dist/{chunk-O7DR57RN.js.map → chunk-ZGRY42BZ.js.map} +1 -1
  35. package/dist/{chunk-XOASGJZU.js → chunk-ZVE23XXF.js} +7 -7
  36. package/dist/{chunk-3NOV7X4M.js → chunk-ZZQJWNQT.js} +3 -1
  37. package/dist/chunk-ZZQJWNQT.js.map +1 -0
  38. package/dist/commonConstants.js +1 -1
  39. package/dist/commonSelectors.cjs +11 -56
  40. package/dist/commonSelectors.cjs.map +1 -1
  41. package/dist/commonSelectors.js +7 -7
  42. package/dist/constants.cjs +3 -45
  43. package/dist/constants.cjs.map +1 -1
  44. package/dist/constants.js +1 -1
  45. package/dist/deploymentsSlice/constants.js +1 -1
  46. package/dist/deploymentsSlice/index.js +1 -1
  47. package/dist/deploymentsSlice/mocks.js +1 -1
  48. package/dist/deploymentsSlice/selectors.js +1 -1
  49. package/dist/deploymentsSlice/thunks.cjs +14 -56
  50. package/dist/deploymentsSlice/thunks.cjs.map +1 -1
  51. package/dist/deploymentsSlice/thunks.js +13 -13
  52. package/dist/devicesSlice/constants.js +1 -1
  53. package/dist/devicesSlice/index.js +1 -1
  54. package/dist/devicesSlice/mocks.js +1 -1
  55. package/dist/devicesSlice/selectors.cjs +8 -11
  56. package/dist/devicesSlice/selectors.cjs.map +1 -1
  57. package/dist/devicesSlice/selectors.js +2 -2
  58. package/dist/devicesSlice/thunks.cjs +14 -56
  59. package/dist/devicesSlice/thunks.cjs.map +1 -1
  60. package/dist/devicesSlice/thunks.js +13 -13
  61. package/dist/liststatehook.js +1 -1
  62. package/dist/locationutils.js +1 -1
  63. package/dist/monitorSlice/index.js +1 -1
  64. package/dist/monitorSlice/mocks.js +1 -1
  65. package/dist/monitorSlice/thunks.cjs +14 -56
  66. package/dist/monitorSlice/thunks.cjs.map +1 -1
  67. package/dist/monitorSlice/thunks.js +11 -11
  68. package/dist/onboardingSlice/thunks.cjs +14 -56
  69. package/dist/onboardingSlice/thunks.cjs.map +1 -1
  70. package/dist/onboardingSlice/thunks.js +13 -13
  71. package/dist/organizationSlice/constants.js +1 -1
  72. package/dist/organizationSlice/index.cjs +3 -0
  73. package/dist/organizationSlice/index.cjs.map +1 -1
  74. package/dist/organizationSlice/index.d.cts +4 -1
  75. package/dist/organizationSlice/index.d.ts +4 -1
  76. package/dist/organizationSlice/index.js +2 -2
  77. package/dist/organizationSlice/mocks.cjs +175 -0
  78. package/dist/organizationSlice/mocks.cjs.map +1 -1
  79. package/dist/organizationSlice/mocks.d.cts +121 -2
  80. package/dist/organizationSlice/mocks.d.ts +121 -2
  81. package/dist/organizationSlice/mocks.js +87 -2
  82. package/dist/organizationSlice/mocks.js.map +1 -1
  83. package/dist/organizationSlice/selectors.cjs +3 -0
  84. package/dist/organizationSlice/selectors.cjs.map +1 -1
  85. package/dist/organizationSlice/selectors.d.cts +3 -2
  86. package/dist/organizationSlice/selectors.d.ts +3 -2
  87. package/dist/organizationSlice/selectors.js +4 -2
  88. package/dist/organizationSlice/thunks.cjs +97 -71
  89. package/dist/organizationSlice/thunks.cjs.map +1 -1
  90. package/dist/organizationSlice/thunks.d.cts +17 -3
  91. package/dist/organizationSlice/thunks.d.ts +17 -3
  92. package/dist/organizationSlice/thunks.js +19 -15
  93. package/dist/organizationSlice/types.cjs.map +1 -1
  94. package/dist/organizationSlice/types.d.cts +30 -7
  95. package/dist/organizationSlice/types.d.ts +30 -7
  96. package/dist/releasesSlice/index.js +1 -1
  97. package/dist/releasesSlice/mocks.js +1 -1
  98. package/dist/releasesSlice/selectors.cjs.map +1 -1
  99. package/dist/releasesSlice/selectors.js +3 -3
  100. package/dist/releasesSlice/thunks.cjs +14 -56
  101. package/dist/releasesSlice/thunks.cjs.map +1 -1
  102. package/dist/releasesSlice/thunks.js +11 -11
  103. package/dist/selectors.cjs +14 -56
  104. package/dist/selectors.cjs.map +1 -1
  105. package/dist/selectors.d.cts +1 -1
  106. package/dist/selectors.d.ts +1 -1
  107. package/dist/selectors.js +9 -7
  108. package/dist/sockethook.js +1 -1
  109. package/dist/store.cjs +3 -0
  110. package/dist/store.cjs.map +1 -1
  111. package/dist/store.js +4 -4
  112. package/dist/storehooks.cjs +91 -69
  113. package/dist/storehooks.cjs.map +1 -1
  114. package/dist/storehooks.js +13 -13
  115. package/dist/thunks.cjs +95 -69
  116. package/dist/thunks.cjs.map +1 -1
  117. package/dist/thunks.d.cts +1 -1
  118. package/dist/thunks.d.ts +1 -1
  119. package/dist/thunks.js +17 -13
  120. package/dist/useDeploymentDevice.cjs +14 -56
  121. package/dist/useDeploymentDevice.cjs.map +1 -1
  122. package/dist/useDeploymentDevice.js +13 -13
  123. package/dist/usersSlice/constants.js +1 -1
  124. package/dist/usersSlice/index.js +1 -1
  125. package/dist/usersSlice/mocks.js +1 -1
  126. package/dist/usersSlice/selectors.cjs +3 -45
  127. package/dist/usersSlice/selectors.cjs.map +1 -1
  128. package/dist/usersSlice/selectors.js +3 -3
  129. package/dist/usersSlice/thunks.cjs +14 -56
  130. package/dist/usersSlice/thunks.cjs.map +1 -1
  131. package/dist/usersSlice/thunks.js +13 -13
  132. package/dist/utils.cjs +18 -57
  133. package/dist/utils.cjs.map +1 -1
  134. package/dist/utils.d.cts +1 -3
  135. package/dist/utils.d.ts +1 -3
  136. package/dist/utils.js +2 -2
  137. package/package.json +1 -1
  138. package/dist/chunk-3NOV7X4M.js.map +0 -1
  139. package/dist/chunk-AJ6DIDO4.js.map +0 -1
  140. package/dist/chunk-KJ2SUFAU.js.map +0 -1
  141. package/dist/chunk-VCEFZTWS.js.map +0 -1
  142. /package/dist/{chunk-43ZBO3JW.js.map → chunk-4ZYLGBJU.js.map} +0 -0
  143. /package/dist/{chunk-45BHMNX6.js.map → chunk-6PYYMAFS.js.map} +0 -0
  144. /package/dist/{chunk-ZAZTNDSY.js.map → chunk-7KSKENLP.js.map} +0 -0
  145. /package/dist/{chunk-AV7SRATY.js.map → chunk-7VFPMJCH.js.map} +0 -0
  146. /package/dist/{chunk-RJRZXDVT.js.map → chunk-GHATCG2U.js.map} +0 -0
  147. /package/dist/{chunk-42GZ6FGV.js.map → chunk-PL6RIFD5.js.map} +0 -0
  148. /package/dist/{chunk-XOASGJZU.js.map → chunk-ZVE23XXF.js.map} +0 -0
@@ -16,20 +16,20 @@ import {
16
16
  getUserSettings as getUserSettings2,
17
17
  saveGlobalSettings,
18
18
  saveUserSettings
19
- } from "./chunk-KJ2SUFAU.js";
19
+ } from "./chunk-4UV7ZJXY.js";
20
20
  import {
21
21
  getReleases
22
- } from "./chunk-AV7SRATY.js";
23
- import "./chunk-45BHMNX6.js";
24
- import "./chunk-ZAZTNDSY.js";
22
+ } from "./chunk-7VFPMJCH.js";
23
+ import "./chunk-6PYYMAFS.js";
24
+ import "./chunk-7KSKENLP.js";
25
25
  import "./chunk-XJLZK4QY.js";
26
26
  import "./chunk-IRQRV552.js";
27
27
  import {
28
28
  actions_default
29
- } from "./chunk-RJRZXDVT.js";
29
+ } from "./chunk-GHATCG2U.js";
30
30
  import "./chunk-TRKA7XYU.js";
31
31
  import "./chunk-YR65C62H.js";
32
- import "./chunk-VCEFZTWS.js";
32
+ import "./chunk-TIL2S3JA.js";
33
33
  import "./chunk-PVCHKW35.js";
34
34
  import "./chunk-CQXDAXQF.js";
35
35
  import "./chunk-VODRLEDP.js";
@@ -44,30 +44,30 @@ import {
44
44
  getIsEnterprise,
45
45
  getOnboardingState,
46
46
  getUserCapabilities
47
- } from "./chunk-XOASGJZU.js";
48
- import "./chunk-42GZ6FGV.js";
47
+ } from "./chunk-ZVE23XXF.js";
48
+ import "./chunk-PL6RIFD5.js";
49
49
  import {
50
50
  getGlobalSettings,
51
51
  getOfflineThresholdSettings,
52
52
  getUserSettings
53
- } from "./chunk-43ZBO3JW.js";
53
+ } from "./chunk-4ZYLGBJU.js";
54
54
  import {
55
55
  getIsServiceProvider
56
- } from "./chunk-3NOV7X4M.js";
56
+ } from "./chunk-ZZQJWNQT.js";
57
57
  import "./chunk-YO22XLHI.js";
58
58
  import "./chunk-JIS4PA3R.js";
59
59
  import "./chunk-WR6RQKF5.js";
60
60
  import {
61
61
  getDevicesByStatus,
62
62
  getSortedFilteringAttributes
63
- } from "./chunk-O7DR57RN.js";
63
+ } from "./chunk-ZGRY42BZ.js";
64
64
  import {
65
65
  getFeatures
66
66
  } from "./chunk-4BHM6WVX.js";
67
67
  import {
68
68
  getComparisonCompatibleVersion,
69
69
  stringToBoolean
70
- } from "./chunk-B3C6H2PR.js";
70
+ } from "./chunk-7WIISD2N.js";
71
71
  import {
72
72
  DEPLOYMENT_STATES,
73
73
  DEVICE_STATES,
@@ -77,7 +77,7 @@ import {
77
77
  import "./chunk-2DYA3X77.js";
78
78
  import "./chunk-FAJ3I2UQ.js";
79
79
  import "./chunk-ZKAH3APE.js";
80
- import "./chunk-AJ6DIDO4.js";
80
+ import "./chunk-DBBE6D36.js";
81
81
 
82
82
  // src/storehooks.ts
83
83
  import { useCallback, useEffect, useRef, useState } from "react";
package/dist/thunks.cjs CHANGED
@@ -114,6 +114,7 @@ __export(thunks_exports, {
114
114
  getLatestReleaseInfo: () => getLatestReleaseInfo,
115
115
  getOnboardingState: () => getOnboardingState2,
116
116
  getPermissionSets: () => getPermissionSets,
117
+ getProducts: () => getProducts,
117
118
  getRelease: () => getRelease,
118
119
  getReleases: () => getReleases,
119
120
  getReportDataWithoutBackendSupport: () => getReportDataWithoutBackendSupport,
@@ -189,6 +190,7 @@ __export(thunks_exports, {
189
190
  submitUserFeedback: () => submitUserFeedback,
190
191
  switchUserOrganization: () => switchUserOrganization,
191
192
  tenantDataDivergedMessage: () => tenantDataDivergedMessage,
193
+ transformProductResponse: () => transformProductResponse,
192
194
  triggerDeviceUpdate: () => triggerDeviceUpdate,
193
195
  updateDeploymentControlMap: () => updateDeploymentControlMap,
194
196
  updateDeviceAuth: () => updateDeviceAuth,
@@ -217,10 +219,6 @@ var import_constants5 = require("@northern.tech/utils/constants");
217
219
  // src/appSlice/constants.ts
218
220
  var import_icons_material = require("@mui/icons-material");
219
221
  var import_utils = require("@northern.tech/utils");
220
- var startingDeviceCount = {
221
- os: "for first 50 devices",
222
- professional: "for first 250 devices"
223
- };
224
222
  var chartTypes = {
225
223
  bar: { key: "bar", Icon: import_icons_material.BarChart },
226
224
  pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
@@ -237,31 +235,17 @@ var PLANS = {
237
235
  os: {
238
236
  id: "os",
239
237
  name: "Basic",
240
- minimalDeviceCount: { standard: 50, micro: 100 },
241
- offer: true,
242
- price: "$34 / month",
243
- deviceCount: startingDeviceCount.os,
244
- description: "The core features of Mender. To continue using Enterprise Trial features\u2014like Delta updates, scheduled deployments, phased rollouts, device filtering, dynamic groups, RBAC, audit logs, and more\u2014please upgrade to a higher plan.",
245
- features: ["Access to core features of Mender", "Basic support"]
238
+ description: "The core features of Mender. To continue using Enterprise Trial features\u2014like Delta updates, scheduled deployments, phased rollouts, device filtering, dynamic groups, RBAC, audit logs, and more\u2014please upgrade to a higher plan."
246
239
  },
247
240
  professional: {
248
241
  id: "professional",
249
242
  name: "Professional",
250
- minimalDeviceCount: { standard: 250, micro: 500 },
251
- offer: true,
252
- price: "$291 / month",
253
- deviceCount: startingDeviceCount.professional,
254
- description: "Everything in Basic, plus enhanced update management and automation features.",
255
- features: ["Advanced OTA features", "Higher priority support"]
243
+ description: "Everything in Basic, plus enhanced update management and automation features."
256
244
  },
257
245
  enterprise: {
258
246
  id: "enterprise",
259
247
  name: "Enterprise",
260
- minimalDeviceCount: { standard: 1e3, micro: 2e3 },
261
- price: "Custom pricing",
262
- deviceCount: "Unlimited devices",
263
- description: "Every advanced feature of Mender, tailored for complex and large-scale deployments. Not available as a monthly subscription \u2014 ask us for a quote.",
264
- features: ["All Mender features", "Advanced security features", "SLA-backed support"]
248
+ description: "Every advanced feature of Mender, tailored for complex and large-scale deployments. Not available as a monthly subscription \u2014 ask us for a quote."
265
249
  }
266
250
  };
267
251
  var ADDONS = {
@@ -270,14 +254,6 @@ var ADDONS = {
270
254
  title: "Configure",
271
255
  description: "Seamlessly configure applications and devices remotely \u2013 configure each device to its environment.",
272
256
  needs: ["hasDeviceConfig"],
273
- os: {
274
- price: "$11/month",
275
- deviceCount: startingDeviceCount.os
276
- },
277
- professional: {
278
- price: "$65/month",
279
- deviceCount: startingDeviceCount.professional
280
- },
281
257
  eligible: ["os", "professional", "enterprise"]
282
258
  },
283
259
  monitor: {
@@ -285,14 +261,6 @@ var ADDONS = {
285
261
  title: "Monitor",
286
262
  description: "Detect and analyze health issues of devices, services and applications. Set up alerts so you can act quickly.",
287
263
  needs: ["hasMonitor"],
288
- os: {
289
- price: "-",
290
- deviceCount: "-"
291
- },
292
- professional: {
293
- price: "$86/month",
294
- deviceCount: startingDeviceCount.professional
295
- },
296
264
  eligible: ["professional", "enterprise"]
297
265
  },
298
266
  troubleshoot: {
@@ -300,14 +268,6 @@ var ADDONS = {
300
268
  title: "Troubleshoot",
301
269
  description: "Secure, remote access to your devices \u2013 quickly diagnose and fix issues in real time.",
302
270
  needs: ["hasDeviceConnect"],
303
- os: {
304
- price: "$27/month",
305
- deviceCount: startingDeviceCount.os
306
- },
307
- professional: {
308
- price: "$72/month",
309
- deviceCount: startingDeviceCount.professional
310
- },
311
271
  eligible: ["os", "professional", "enterprise"]
312
272
  }
313
273
  };
@@ -1331,17 +1291,14 @@ var getAttributesList = (0, import_toolkit4.createSelector)(
1331
1291
  [getFilteringAttributes, getFilteringAttributesFromConfig],
1332
1292
  ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers2.duplicateFilter)
1333
1293
  );
1334
- var getDeviceLimitStats = (0, import_toolkit4.createSelector)(
1335
- [getDeviceLimits, getAcceptedDevices],
1336
- (limits, accepted) => {
1337
- const { counts } = accepted;
1338
- return Object.entries(limits).filter(([, limit]) => limit !== 0).map(([type, limit]) => ({
1339
- type,
1340
- limit,
1341
- total: counts[type] || 0
1342
- }));
1343
- }
1344
- );
1294
+ var getDeviceLimitStats = (0, import_toolkit4.createSelector)([getDeviceLimits, getAcceptedDevices], (limits, accepted) => {
1295
+ const { counts } = accepted;
1296
+ return Object.entries(limits).filter(([, limit]) => limit !== 0).map(([type, limit]) => ({
1297
+ type,
1298
+ limit,
1299
+ total: counts[type] || 0
1300
+ }));
1301
+ });
1345
1302
  var getDeviceTypes = (0, import_toolkit4.createSelector)(
1346
1303
  [getAcceptedDevices, getDevicesById],
1347
1304
  ({ deviceIds = [] }, devicesById) => Object.keys(
@@ -1515,18 +1472,21 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
1515
1472
  { inventory: { device_type: [], artifact_name: "" }, identity: {}, monitor: {}, system: {}, tags: {} }
1516
1473
  );
1517
1474
  var isDarkMode = (mode) => mode === DARK_MODE;
1518
- var parseSubscriptionPreview = (lines) => lines.reduce(
1519
- (acc, { addon, amount, product }) => {
1520
- const planId = product.slice("mender_".length);
1521
- if (!addon) {
1522
- acc[planId] = (acc[planId] ?? 0) + amount;
1523
- } else {
1524
- acc.addons[addon] = (acc.addons[addon] ?? 0) + amount;
1525
- }
1526
- return acc;
1527
- },
1528
- { addons: {} }
1529
- );
1475
+ var parseSubscriptionPreview = (lines) => lines.reduce((acc, { addon, amount, product }) => {
1476
+ const tier = product.replace("mender_", "");
1477
+ if (!acc[tier]) {
1478
+ acc[tier] = {
1479
+ amount: 0,
1480
+ addons: {}
1481
+ };
1482
+ }
1483
+ if (!addon) {
1484
+ acc[tier].amount += amount;
1485
+ } else {
1486
+ acc[tier].addons[addon] = (acc[tier].addons[addon] ?? 0) + amount;
1487
+ }
1488
+ return acc;
1489
+ }, {});
1530
1490
 
1531
1491
  // src/releasesSlice/selectors.ts
1532
1492
  var getSelectedReleaseId = (state) => state.releases.selectedRelease;
@@ -2306,6 +2266,9 @@ var organizationSlice = (0, import_toolkit13.createSlice)({
2306
2266
  setSubscription: (state, action) => {
2307
2267
  state.organization.subscription = { ...state.organization.subscription, ...action.payload };
2308
2268
  },
2269
+ setProducts: (state, action) => {
2270
+ state.products = action.payload;
2271
+ },
2309
2272
  setBillingProfile: (state, action) => {
2310
2273
  state.organization.billing_profile = action.payload;
2311
2274
  },
@@ -4262,6 +4225,63 @@ var cancelRequest = createAppAsyncThunk(`${sliceName6}/cancelRequest`, (reason,
4262
4225
  () => Promise.resolve(dispatch(setSnackbar4({ message: "Deactivation request was sent successfully", autoHideDuration: TIMEOUTS.fiveSeconds })))
4263
4226
  );
4264
4227
  });
4228
+ var getTierId = (tierName) => tierName.replace("mender_", "");
4229
+ var getProductPlans = (products) => products.reduce(
4230
+ (plansById, product) => {
4231
+ const { name, prices } = product;
4232
+ const tierId = getTierId(name);
4233
+ prices.forEach((price) => {
4234
+ const existing = plansById[price.plan] ?? { ...PLANS[price.plan], tierLimitsConstrains: {} };
4235
+ const tierConstraints = price.constraints ? { [tierId]: { min: price.constraints.min, max: price.constraints.max, div: price.constraints.div } } : {};
4236
+ plansById[price.plan] = {
4237
+ ...existing,
4238
+ tierLimitsConstrains: {
4239
+ ...existing.tierLimitsConstrains,
4240
+ ...tierConstraints
4241
+ }
4242
+ };
4243
+ });
4244
+ return plansById;
4245
+ },
4246
+ { enterprise: { ...PLANS.enterprise } }
4247
+ );
4248
+ var getProductAddons = (products) => products.reduce((accu, product) => {
4249
+ const { addons = [] } = product;
4250
+ addons.forEach((addon) => {
4251
+ const { name: addonName = "", prices: addonPrices = [] } = addon;
4252
+ const existingEligible = accu[addonName]?.eligible ?? [];
4253
+ const newEligible = addonPrices.map((p) => p.plan);
4254
+ accu[addonName] = {
4255
+ ...ADDONS[addonName],
4256
+ eligible: [.../* @__PURE__ */ new Set([...existingEligible, ...newEligible, PLANS.enterprise.id])]
4257
+ };
4258
+ });
4259
+ return accu;
4260
+ }, {});
4261
+ var transformProductResponse = (products) => {
4262
+ const tiers = [];
4263
+ const sortedProducts = products.sort((a, b) => a.name.localeCompare(b.name));
4264
+ sortedProducts.forEach((tier) => {
4265
+ const addonsSupported = Object.fromEntries((tier.addons || []).map((addon) => [addon.name, addon.prices?.map((p) => p.plan)]));
4266
+ const allPlans = tier.prices.map((price) => price.plan);
4267
+ const addonsTransposed = allPlans.reduce((acc, plan) => {
4268
+ acc[plan] = Object.entries(addonsSupported).filter(([, addonSupportedPlans]) => addonSupportedPlans.includes(plan)).map(([addon]) => addon);
4269
+ return acc;
4270
+ }, {});
4271
+ const tierId = getTierId(tier.name);
4272
+ tiers.push({
4273
+ id: tierId,
4274
+ title: tierId,
4275
+ stripeProductName: tier.name,
4276
+ limitConstrains: Object.fromEntries(tier.prices.map((p) => [p.plan, p.constraints])),
4277
+ addons: addonsSupported,
4278
+ addonsByPlan: addonsTransposed
4279
+ });
4280
+ });
4281
+ const plans = getProductPlans(products);
4282
+ const addons = getProductAddons(products);
4283
+ return { plans, tiers, addons };
4284
+ };
4265
4285
  var getTargetLocation = (key) => {
4266
4286
  if (devLocations.includes(window.location.hostname)) {
4267
4287
  return "";
@@ -4476,7 +4496,7 @@ var getUserSubscription = createAppAsyncThunk(`${sliceName6}/getUserSubscription
4476
4496
  });
4477
4497
  var getBillingPreview = createAppAsyncThunk(
4478
4498
  `${sliceName6}/getBillingPreview`,
4479
- (order, { dispatch }) => general_api_default.post(`${import_constants5.tenantadmApiUrlv2}/billing/subscription/invoices/preview`, order).catch((err) => commonErrorHandler(err, "There was an error getting your billing information:", dispatch, commonErrorFallback)).then(({ data }) => order.preview_mode === "recurring" ? { ...parseSubscriptionPreview(data.lines), total: data.total } : data)
4499
+ (order, { dispatch }) => general_api_default.post(`${import_constants5.tenantadmApiUrlv2}/billing/subscription/invoices/preview`, order).catch((err) => commonErrorHandler(err, "There was an error getting your billing information:", dispatch, commonErrorFallback)).then(({ data }) => order.preview_mode === "recurring" ? { items: parseSubscriptionPreview(data.lines), total: data.total } : data)
4480
4500
  );
4481
4501
  var getCurrentSubscription = createAppAsyncThunk(
4482
4502
  `${sliceName6}/getCurrentSubscription`,
@@ -4487,6 +4507,10 @@ var getCurrentSubscription = createAppAsyncThunk(
4487
4507
  return commonErrorHandler(err, "There was an error retrieving your current subscription", dispatch, commonErrorFallback);
4488
4508
  })
4489
4509
  );
4510
+ var getProducts = createAppAsyncThunk(
4511
+ `${sliceName6}/getEnabledTiers`,
4512
+ (_, { dispatch }) => general_api_default.get(`${import_constants5.tenantadmApiUrlv2}/billing/products`).catch((err) => commonErrorHandler(err, "There was an error getting Mender products:", dispatch, commonErrorFallback)).then((res) => dispatch(actions6.setProducts(transformProductResponse(res.data))))
4513
+ );
4490
4514
  var requestPlanUpgrade = createAppAsyncThunk(
4491
4515
  `${sliceName6}/requestPlanUpgrade`,
4492
4516
  (order, { dispatch }) => general_api_default.post(`${import_constants5.tenantadmApiUrlv2}/billing/subscription`, order).catch((err) => commonErrorHandler(err, "There was an error sending your request", dispatch, commonErrorFallback)).then(() => Promise.all([setTimeout(() => dispatch(getDeviceLimits2()), TIMEOUTS.threeSeconds), dispatch(getUserOrganization())]))
@@ -5739,6 +5763,7 @@ var submitUserFeedback = createAppAsyncThunk(
5739
5763
  getLatestReleaseInfo,
5740
5764
  getOnboardingState,
5741
5765
  getPermissionSets,
5766
+ getProducts,
5742
5767
  getRelease,
5743
5768
  getReleases,
5744
5769
  getReportDataWithoutBackendSupport,
@@ -5814,6 +5839,7 @@ var submitUserFeedback = createAppAsyncThunk(
5814
5839
  submitUserFeedback,
5815
5840
  switchUserOrganization,
5816
5841
  tenantDataDivergedMessage,
5842
+ transformProductResponse,
5817
5843
  triggerDeviceUpdate,
5818
5844
  updateDeploymentControlMap,
5819
5845
  updateDeviceAuth,