@northern.tech/store 0.19.1 → 0.20.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 (151) 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 +6 -6
  6. package/dist/api/general-api.js +2 -2
  7. package/dist/api/users-api.js +2 -2
  8. package/dist/appSlice/constants.cjs +11 -49
  9. package/dist/appSlice/constants.cjs.map +1 -1
  10. package/dist/appSlice/constants.d.cts +1 -16
  11. package/dist/appSlice/constants.d.ts +1 -16
  12. package/dist/appSlice/constants.js +1 -1
  13. package/dist/appSlice/index.js +2 -2
  14. package/dist/appSlice/mocks.js +2 -2
  15. package/dist/appSlice/thunks.cjs +30 -60
  16. package/dist/appSlice/thunks.cjs.map +1 -1
  17. package/dist/appSlice/thunks.js +17 -17
  18. package/dist/auth.js +2 -2
  19. package/dist/{chunk-QFYYTAYD.js → chunk-3JBVI4UH.js} +9 -9
  20. package/dist/{chunk-QL6FN2JC.js → chunk-4ZYLGBJU.js} +2 -2
  21. package/dist/{chunk-U5TPV5X5.js → chunk-7WIISD2N.js} +17 -14
  22. package/dist/{chunk-U5TPV5X5.js.map → chunk-7WIISD2N.js.map} +1 -1
  23. package/dist/{chunk-FUGCLQ5L.js → chunk-AY7E7VA6.js} +102 -28
  24. package/dist/chunk-AY7E7VA6.js.map +1 -0
  25. package/dist/{chunk-EL672W25.js → chunk-DBBE6D36.js} +12 -50
  26. package/dist/chunk-DBBE6D36.js.map +1 -0
  27. package/dist/{chunk-GBXG2XBY.js → chunk-E657OJL4.js} +6 -6
  28. package/dist/{chunk-MZ5NRW3K.js → chunk-FXKMYYK5.js} +17 -17
  29. package/dist/{chunk-KJHHSYGP.js → chunk-P3N2J3QT.js} +10 -10
  30. package/dist/{chunk-GEQ2QQEE.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-C3EMLDPU.js → chunk-V6BWOIRC.js} +6 -6
  34. package/dist/{chunk-O7DR57RN.js → chunk-ZGRY42BZ.js} +9 -12
  35. package/dist/{chunk-O7DR57RN.js.map → chunk-ZGRY42BZ.js.map} +1 -1
  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 +2 -2
  39. package/dist/commonSelectors.cjs +19 -60
  40. package/dist/commonSelectors.cjs.map +1 -1
  41. package/dist/commonSelectors.js +9 -9
  42. package/dist/constants.cjs +11 -49
  43. package/dist/constants.cjs.map +1 -1
  44. package/dist/constants.js +2 -2
  45. package/dist/deploymentsSlice/constants.js +2 -2
  46. package/dist/deploymentsSlice/index.js +2 -2
  47. package/dist/deploymentsSlice/mocks.js +2 -2
  48. package/dist/deploymentsSlice/selectors.js +2 -2
  49. package/dist/deploymentsSlice/thunks.cjs +30 -60
  50. package/dist/deploymentsSlice/thunks.cjs.map +1 -1
  51. package/dist/deploymentsSlice/thunks.js +17 -17
  52. package/dist/devicesSlice/constants.js +2 -2
  53. package/dist/devicesSlice/index.js +2 -2
  54. package/dist/devicesSlice/mocks.js +2 -2
  55. package/dist/devicesSlice/selectors.cjs +8 -11
  56. package/dist/devicesSlice/selectors.cjs.map +1 -1
  57. package/dist/devicesSlice/selectors.js +3 -3
  58. package/dist/devicesSlice/thunks.cjs +32 -60
  59. package/dist/devicesSlice/thunks.cjs.map +1 -1
  60. package/dist/devicesSlice/thunks.d.cts +41 -3
  61. package/dist/devicesSlice/thunks.d.ts +41 -3
  62. package/dist/devicesSlice/thunks.js +19 -17
  63. package/dist/liststatehook.js +2 -2
  64. package/dist/locationutils.js +2 -2
  65. package/dist/monitorSlice/index.js +2 -2
  66. package/dist/monitorSlice/mocks.js +2 -2
  67. package/dist/monitorSlice/thunks.cjs +22 -60
  68. package/dist/monitorSlice/thunks.cjs.map +1 -1
  69. package/dist/monitorSlice/thunks.js +15 -15
  70. package/dist/onboardingSlice/thunks.cjs +30 -60
  71. package/dist/onboardingSlice/thunks.cjs.map +1 -1
  72. package/dist/onboardingSlice/thunks.js +17 -17
  73. package/dist/organizationSlice/constants.js +2 -2
  74. package/dist/organizationSlice/index.cjs +3 -0
  75. package/dist/organizationSlice/index.cjs.map +1 -1
  76. package/dist/organizationSlice/index.d.cts +4 -1
  77. package/dist/organizationSlice/index.d.ts +4 -1
  78. package/dist/organizationSlice/index.js +3 -3
  79. package/dist/organizationSlice/mocks.cjs +175 -0
  80. package/dist/organizationSlice/mocks.cjs.map +1 -1
  81. package/dist/organizationSlice/mocks.d.cts +121 -2
  82. package/dist/organizationSlice/mocks.d.ts +121 -2
  83. package/dist/organizationSlice/mocks.js +88 -3
  84. package/dist/organizationSlice/mocks.js.map +1 -1
  85. package/dist/organizationSlice/selectors.cjs +3 -0
  86. package/dist/organizationSlice/selectors.cjs.map +1 -1
  87. package/dist/organizationSlice/selectors.d.cts +3 -2
  88. package/dist/organizationSlice/selectors.d.ts +3 -2
  89. package/dist/organizationSlice/selectors.js +5 -3
  90. package/dist/organizationSlice/thunks.cjs +113 -75
  91. package/dist/organizationSlice/thunks.cjs.map +1 -1
  92. package/dist/organizationSlice/thunks.d.cts +17 -3
  93. package/dist/organizationSlice/thunks.d.ts +17 -3
  94. package/dist/organizationSlice/thunks.js +23 -19
  95. package/dist/organizationSlice/types.cjs.map +1 -1
  96. package/dist/organizationSlice/types.d.cts +30 -7
  97. package/dist/organizationSlice/types.d.ts +30 -7
  98. package/dist/releasesSlice/index.js +2 -2
  99. package/dist/releasesSlice/mocks.js +2 -2
  100. package/dist/releasesSlice/selectors.cjs.map +1 -1
  101. package/dist/releasesSlice/selectors.js +4 -4
  102. package/dist/releasesSlice/thunks.cjs +22 -60
  103. package/dist/releasesSlice/thunks.cjs.map +1 -1
  104. package/dist/releasesSlice/thunks.js +15 -15
  105. package/dist/selectors.cjs +22 -60
  106. package/dist/selectors.cjs.map +1 -1
  107. package/dist/selectors.d.cts +1 -1
  108. package/dist/selectors.d.ts +1 -1
  109. package/dist/selectors.js +39 -37
  110. package/dist/sockethook.js +2 -2
  111. package/dist/store.cjs +3 -0
  112. package/dist/store.cjs.map +1 -1
  113. package/dist/store.js +7 -7
  114. package/dist/storehooks.cjs +109 -74
  115. package/dist/storehooks.cjs.map +1 -1
  116. package/dist/storehooks.js +24 -22
  117. package/dist/storehooks.js.map +1 -1
  118. package/dist/thunks.cjs +113 -73
  119. package/dist/thunks.cjs.map +1 -1
  120. package/dist/thunks.d.cts +2 -2
  121. package/dist/thunks.d.ts +2 -2
  122. package/dist/thunks.js +23 -17
  123. package/dist/useDeploymentDevice.cjs +30 -60
  124. package/dist/useDeploymentDevice.cjs.map +1 -1
  125. package/dist/useDeploymentDevice.js +19 -19
  126. package/dist/usersSlice/constants.js +2 -2
  127. package/dist/usersSlice/index.js +2 -2
  128. package/dist/usersSlice/mocks.js +2 -2
  129. package/dist/usersSlice/selectors.cjs +11 -49
  130. package/dist/usersSlice/selectors.cjs.map +1 -1
  131. package/dist/usersSlice/selectors.js +4 -4
  132. package/dist/usersSlice/thunks.cjs +30 -60
  133. package/dist/usersSlice/thunks.cjs.map +1 -1
  134. package/dist/usersSlice/thunks.js +17 -17
  135. package/dist/utils.cjs +26 -61
  136. package/dist/utils.cjs.map +1 -1
  137. package/dist/utils.d.cts +1 -3
  138. package/dist/utils.d.ts +1 -3
  139. package/dist/utils.js +3 -3
  140. package/package.json +3 -3
  141. package/dist/chunk-3NOV7X4M.js.map +0 -1
  142. package/dist/chunk-EL672W25.js.map +0 -1
  143. package/dist/chunk-FUGCLQ5L.js.map +0 -1
  144. package/dist/chunk-VCEFZTWS.js.map +0 -1
  145. /package/dist/{chunk-QFYYTAYD.js.map → chunk-3JBVI4UH.js.map} +0 -0
  146. /package/dist/{chunk-QL6FN2JC.js.map → chunk-4ZYLGBJU.js.map} +0 -0
  147. /package/dist/{chunk-GBXG2XBY.js.map → chunk-E657OJL4.js.map} +0 -0
  148. /package/dist/{chunk-MZ5NRW3K.js.map → chunk-FXKMYYK5.js.map} +0 -0
  149. /package/dist/{chunk-KJHHSYGP.js.map → chunk-P3N2J3QT.js.map} +0 -0
  150. /package/dist/{chunk-GEQ2QQEE.js.map → chunk-PL6RIFD5.js.map} +0 -0
  151. /package/dist/{chunk-C3EMLDPU.js.map → chunk-V6BWOIRC.js.map} +0 -0
@@ -51,6 +51,7 @@ __export(thunks_exports, {
51
51
  getCurrentCard: () => getCurrentCard,
52
52
  getCurrentSubscription: () => getCurrentSubscription,
53
53
  getIntegrations: () => getIntegrations,
54
+ getProducts: () => getProducts,
54
55
  getSsoConfigById: () => getSsoConfigById,
55
56
  getSsoConfigs: () => getSsoConfigs,
56
57
  getTargetLocation: () => getTargetLocation,
@@ -68,7 +69,8 @@ __export(thunks_exports, {
68
69
  startCardUpdate: () => startCardUpdate,
69
70
  startUpgrade: () => startUpgrade,
70
71
  storeSsoConfig: () => storeSsoConfig,
71
- tenantDataDivergedMessage: () => tenantDataDivergedMessage
72
+ tenantDataDivergedMessage: () => tenantDataDivergedMessage,
73
+ transformProductResponse: () => transformProductResponse
72
74
  });
73
75
  module.exports = __toCommonJS(thunks_exports);
74
76
  var import_helpers11 = require("@northern.tech/utils/helpers");
@@ -87,10 +89,6 @@ var import_constants5 = require("@northern.tech/utils/constants");
87
89
  // src/appSlice/constants.ts
88
90
  var import_icons_material = require("@mui/icons-material");
89
91
  var import_utils = require("@northern.tech/utils");
90
- var startingDeviceCount = {
91
- os: "for first 50 devices",
92
- professional: "for first 250 devices"
93
- };
94
92
  var chartTypes = {
95
93
  bar: { key: "bar", Icon: import_icons_material.BarChart },
96
94
  pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
@@ -107,82 +105,48 @@ var PLANS = {
107
105
  os: {
108
106
  id: "os",
109
107
  name: "Basic",
110
- minimalDeviceCount: { standard: 50, micro: 100 },
111
- offer: true,
112
- price: "$34 / month",
113
- deviceCount: startingDeviceCount.os,
114
- 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.",
115
- features: ["Access to core features of Mender", "Basic support"]
108
+ 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."
116
109
  },
117
110
  professional: {
118
111
  id: "professional",
119
112
  name: "Professional",
120
- minimalDeviceCount: { standard: 250, micro: 500 },
121
- offer: true,
122
- price: "$291 / month",
123
- deviceCount: startingDeviceCount.professional,
124
- description: "Everything in Basic, plus enhanced update management and automation features.",
125
- features: ["Advanced OTA features", "Higher priority support"]
113
+ description: "Everything in Basic, plus enhanced update management and automation features."
126
114
  },
127
115
  enterprise: {
128
116
  id: "enterprise",
129
117
  name: "Enterprise",
130
- minimalDeviceCount: { standard: 1e3, micro: 2e3 },
131
- price: "Custom pricing",
132
- deviceCount: "Unlimited devices",
133
- 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.",
134
- features: ["All Mender features", "Advanced security features", "SLA-backed support"]
118
+ 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."
135
119
  }
136
120
  };
137
121
  var ADDONS = {
138
122
  configure: {
139
123
  id: "configure",
140
124
  title: "Configure",
141
- description: "Expand your plan with device configuration features",
125
+ description: "Seamlessly configure applications and devices remotely \u2013 configure each device to its environment.",
142
126
  needs: ["hasDeviceConfig"],
143
- os: {
144
- price: "$11/month",
145
- deviceCount: startingDeviceCount.os
146
- },
147
- professional: {
148
- price: "$65/month",
149
- deviceCount: startingDeviceCount.professional
150
- },
151
127
  eligible: ["os", "professional", "enterprise"]
152
128
  },
153
129
  monitor: {
154
130
  id: "monitor",
155
131
  title: "Monitor",
156
- description: "Expand your plan with device monitoring features",
132
+ description: "Detect and analyze health issues of devices, services and applications. Set up alerts so you can act quickly.",
157
133
  needs: ["hasMonitor"],
158
- os: {
159
- price: "-",
160
- deviceCount: "-"
161
- },
162
- professional: {
163
- price: "$86/month",
164
- deviceCount: startingDeviceCount.professional
165
- },
166
134
  eligible: ["professional", "enterprise"]
167
135
  },
168
136
  troubleshoot: {
169
137
  id: "troubleshoot",
170
138
  title: "Troubleshoot",
171
- description: "Expand your plan with device troubleshooting features",
139
+ description: "Secure, remote access to your devices \u2013 quickly diagnose and fix issues in real time.",
172
140
  needs: ["hasDeviceConnect"],
173
- os: {
174
- price: "$27/month",
175
- deviceCount: startingDeviceCount.os
176
- },
177
- professional: {
178
- price: "$72/month",
179
- deviceCount: startingDeviceCount.professional
180
- },
181
141
  eligible: ["os", "professional", "enterprise"]
182
142
  }
183
143
  };
184
144
  var BENEFITS = {
185
- auditlog: { id: "auditlog", benefit: "trace change across your devices and access troubleshooting session replay", requiredPlan: PLANS.professional.id },
145
+ auditlog: {
146
+ id: "auditlog",
147
+ benefit: "gain access to logs for important events such as changes to devices, deployments and user management, as well as remote terminal session replays",
148
+ requiredPlan: PLANS.enterprise.id
149
+ },
186
150
  dashboard: { id: "dashboard", benefit: "actionable insights into the devices you are updating with Mender", requiredPlan: PLANS.enterprise.id },
187
151
  deltaGeneration: {
188
152
  id: "deltaGeneration",
@@ -874,6 +838,9 @@ var organizationSlice = (0, import_toolkit.createSlice)({
874
838
  setSubscription: (state, action) => {
875
839
  state.organization.subscription = { ...state.organization.subscription, ...action.payload };
876
840
  },
841
+ setProducts: (state, action) => {
842
+ state.products = action.payload;
843
+ },
877
844
  setBillingProfile: (state, action) => {
878
845
  state.organization.billing_profile = action.payload;
879
846
  },
@@ -1990,17 +1957,14 @@ var getAttributesList = (0, import_toolkit11.createSelector)(
1990
1957
  [getFilteringAttributes, getFilteringAttributesFromConfig],
1991
1958
  ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers3.duplicateFilter)
1992
1959
  );
1993
- var getDeviceLimitStats = (0, import_toolkit11.createSelector)(
1994
- [getDeviceLimits, getAcceptedDevices],
1995
- (limits, accepted) => {
1996
- const { counts } = accepted;
1997
- return Object.entries(limits).filter(([, limit]) => limit !== 0).map(([type, limit]) => ({
1998
- type,
1999
- limit,
2000
- total: counts[type] || 0
2001
- }));
2002
- }
2003
- );
1960
+ var getDeviceLimitStats = (0, import_toolkit11.createSelector)([getDeviceLimits, getAcceptedDevices], (limits, accepted) => {
1961
+ const { counts } = accepted;
1962
+ return Object.entries(limits).filter(([, limit]) => limit !== 0).map(([type, limit]) => ({
1963
+ type,
1964
+ limit,
1965
+ total: counts[type] || 0
1966
+ }));
1967
+ });
2004
1968
  var getDeviceTypes = (0, import_toolkit11.createSelector)(
2005
1969
  [getAcceptedDevices, getDevicesById],
2006
1970
  ({ deviceIds = [] }, devicesById) => Object.keys(
@@ -2174,18 +2138,21 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
2174
2138
  { inventory: { device_type: [], artifact_name: "" }, identity: {}, monitor: {}, system: {}, tags: {} }
2175
2139
  );
2176
2140
  var isDarkMode = (mode) => mode === DARK_MODE;
2177
- var parseSubscriptionPreview = (lines) => lines.reduce(
2178
- (acc, { addon, amount, product }) => {
2179
- const planId = product.slice("mender_".length);
2180
- if (!addon) {
2181
- acc[planId] = (acc[planId] ?? 0) + amount;
2182
- } else {
2183
- acc.addons[addon] = (acc.addons[addon] ?? 0) + amount;
2184
- }
2185
- return acc;
2186
- },
2187
- { addons: {} }
2188
- );
2141
+ var parseSubscriptionPreview = (lines) => lines.reduce((acc, { addon, amount, product }) => {
2142
+ const tier = product.replace("mender_", "");
2143
+ if (!acc[tier]) {
2144
+ acc[tier] = {
2145
+ amount: 0,
2146
+ addons: {}
2147
+ };
2148
+ }
2149
+ if (!addon) {
2150
+ acc[tier].amount += amount;
2151
+ } else {
2152
+ acc[tier].addons[addon] = (acc[tier].addons[addon] ?? 0) + amount;
2153
+ }
2154
+ return acc;
2155
+ }, {});
2189
2156
 
2190
2157
  // src/releasesSlice/selectors.ts
2191
2158
  var getSelectedReleaseId = (state) => state.releases.selectedRelease;
@@ -3159,11 +3126,18 @@ var addStaticGroup = createAppAsyncThunk(
3159
3126
  )
3160
3127
  ).catch((err) => commonErrorHandler(err, `Group could not be updated:`, dispatch))
3161
3128
  );
3129
+ var removeReportsByGroupName = createAppAsyncThunk(`${sliceName4}/removeReportsByGroupName`, (groupName, { dispatch, getState }) => {
3130
+ if (!groupName) return Promise.resolve();
3131
+ const reports = getDeviceReportsForUser(getState());
3132
+ const filteredReports = reports.filter((report) => report.group !== groupName);
3133
+ dispatch(saveUserSettings({ reports: filteredReports }));
3134
+ });
3162
3135
  var removeStaticGroup = createAppAsyncThunk(
3163
3136
  `${sliceName4}/removeStaticGroup`,
3164
3137
  (groupName, { dispatch }) => general_api_default.delete(`${import_constants5.inventoryApiUrl}/groups/${groupName}`).then(
3165
3138
  () => Promise.all([
3166
3139
  dispatch(actions4.removeGroup(groupName)),
3140
+ dispatch(removeReportsByGroupName(groupName)),
3167
3141
  dispatch(getGroups2()),
3168
3142
  dispatch(setSnackbar3({ message: "Group was removed successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
3169
3143
  ])
@@ -3229,6 +3203,7 @@ var removeDynamicGroup = createAppAsyncThunk(`${sliceName4}/removeDynamicGroup`,
3229
3203
  return general_api_default.delete(`${import_constants5.inventoryApiUrlV2}/filters/${filterId}`).then(
3230
3204
  () => Promise.all([
3231
3205
  dispatch(actions4.removeGroup(groupName)),
3206
+ dispatch(removeReportsByGroupName(groupName)),
3232
3207
  dispatch(setSnackbar3({ message: "Group was removed successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
3233
3208
  ])
3234
3209
  );
@@ -4671,6 +4646,63 @@ var cancelRequest = createAppAsyncThunk(`${sliceName}/cancelRequest`, (reason, {
4671
4646
  () => Promise.resolve(dispatch(setSnackbar5({ message: "Deactivation request was sent successfully", autoHideDuration: TIMEOUTS.fiveSeconds })))
4672
4647
  );
4673
4648
  });
4649
+ var getTierId = (tierName) => tierName.replace("mender_", "");
4650
+ var getProductPlans = (products) => products.reduce(
4651
+ (plansById, product) => {
4652
+ const { name, prices } = product;
4653
+ const tierId = getTierId(name);
4654
+ prices.forEach((price) => {
4655
+ const existing = plansById[price.plan] ?? { ...PLANS[price.plan], tierLimitsConstrains: {} };
4656
+ const tierConstraints = price.constraints ? { [tierId]: { min: price.constraints.min, max: price.constraints.max, div: price.constraints.div } } : {};
4657
+ plansById[price.plan] = {
4658
+ ...existing,
4659
+ tierLimitsConstrains: {
4660
+ ...existing.tierLimitsConstrains,
4661
+ ...tierConstraints
4662
+ }
4663
+ };
4664
+ });
4665
+ return plansById;
4666
+ },
4667
+ { enterprise: { ...PLANS.enterprise } }
4668
+ );
4669
+ var getProductAddons = (products) => products.reduce((accu, product) => {
4670
+ const { addons = [] } = product;
4671
+ addons.forEach((addon) => {
4672
+ const { name: addonName = "", prices: addonPrices = [] } = addon;
4673
+ const existingEligible = accu[addonName]?.eligible ?? [];
4674
+ const newEligible = addonPrices.map((p) => p.plan);
4675
+ accu[addonName] = {
4676
+ ...ADDONS[addonName],
4677
+ eligible: [.../* @__PURE__ */ new Set([...existingEligible, ...newEligible, PLANS.enterprise.id])]
4678
+ };
4679
+ });
4680
+ return accu;
4681
+ }, {});
4682
+ var transformProductResponse = (products) => {
4683
+ const tiers = [];
4684
+ const sortedProducts = products.sort((a, b) => a.name.localeCompare(b.name));
4685
+ sortedProducts.forEach((tier) => {
4686
+ const addonsSupported = Object.fromEntries((tier.addons || []).map((addon) => [addon.name, addon.prices?.map((p) => p.plan)]));
4687
+ const allPlans = tier.prices.map((price) => price.plan);
4688
+ const addonsTransposed = allPlans.reduce((acc, plan) => {
4689
+ acc[plan] = Object.entries(addonsSupported).filter(([, addonSupportedPlans]) => addonSupportedPlans.includes(plan)).map(([addon]) => addon);
4690
+ return acc;
4691
+ }, {});
4692
+ const tierId = getTierId(tier.name);
4693
+ tiers.push({
4694
+ id: tierId,
4695
+ title: tierId,
4696
+ stripeProductName: tier.name,
4697
+ limitConstrains: Object.fromEntries(tier.prices.map((p) => [p.plan, p.constraints])),
4698
+ addons: addonsSupported,
4699
+ addonsByPlan: addonsTransposed
4700
+ });
4701
+ });
4702
+ const plans = getProductPlans(products);
4703
+ const addons = getProductAddons(products);
4704
+ return { plans, tiers, addons };
4705
+ };
4674
4706
  var getTargetLocation = (key) => {
4675
4707
  if (devLocations.includes(window.location.hostname)) {
4676
4708
  return "";
@@ -4885,7 +4917,7 @@ var getUserSubscription = createAppAsyncThunk(`${sliceName}/getUserSubscription`
4885
4917
  });
4886
4918
  var getBillingPreview = createAppAsyncThunk(
4887
4919
  `${sliceName}/getBillingPreview`,
4888
- (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)
4920
+ (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)
4889
4921
  );
4890
4922
  var getCurrentSubscription = createAppAsyncThunk(
4891
4923
  `${sliceName}/getCurrentSubscription`,
@@ -4896,6 +4928,10 @@ var getCurrentSubscription = createAppAsyncThunk(
4896
4928
  return commonErrorHandler(err, "There was an error retrieving your current subscription", dispatch, commonErrorFallback);
4897
4929
  })
4898
4930
  );
4931
+ var getProducts = createAppAsyncThunk(
4932
+ `${sliceName}/getEnabledTiers`,
4933
+ (_, { 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(actions.setProducts(transformProductResponse(res.data))))
4934
+ );
4899
4935
  var requestPlanUpgrade = createAppAsyncThunk(
4900
4936
  `${sliceName}/requestPlanUpgrade`,
4901
4937
  (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())]))
@@ -5023,6 +5059,7 @@ var getSsoConfigs = createAppAsyncThunk(
5023
5059
  getCurrentCard,
5024
5060
  getCurrentSubscription,
5025
5061
  getIntegrations,
5062
+ getProducts,
5026
5063
  getSsoConfigById,
5027
5064
  getSsoConfigs,
5028
5065
  getTargetLocation,
@@ -5040,6 +5077,7 @@ var getSsoConfigs = createAppAsyncThunk(
5040
5077
  startCardUpdate,
5041
5078
  startUpgrade,
5042
5079
  storeSsoConfig,
5043
- tenantDataDivergedMessage
5080
+ tenantDataDivergedMessage,
5081
+ transformProductResponse
5044
5082
  });
5045
5083
  //# sourceMappingURL=thunks.cjs.map