@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
@@ -50,10 +50,6 @@ var import_constants5 = require("@northern.tech/utils/constants");
50
50
  // src/appSlice/constants.ts
51
51
  var import_icons_material = require("@mui/icons-material");
52
52
  var import_utils = require("@northern.tech/utils");
53
- var startingDeviceCount = {
54
- os: "for first 50 devices",
55
- professional: "for first 250 devices"
56
- };
57
53
  var chartTypes = {
58
54
  bar: { key: "bar", Icon: import_icons_material.BarChart },
59
55
  pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
@@ -70,31 +66,17 @@ var PLANS = {
70
66
  os: {
71
67
  id: "os",
72
68
  name: "Basic",
73
- minimalDeviceCount: { standard: 50, micro: 100 },
74
- offer: true,
75
- price: "$34 / month",
76
- deviceCount: startingDeviceCount.os,
77
- 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.",
78
- features: ["Access to core features of Mender", "Basic support"]
69
+ 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."
79
70
  },
80
71
  professional: {
81
72
  id: "professional",
82
73
  name: "Professional",
83
- minimalDeviceCount: { standard: 250, micro: 500 },
84
- offer: true,
85
- price: "$291 / month",
86
- deviceCount: startingDeviceCount.professional,
87
- description: "Everything in Basic, plus enhanced update management and automation features.",
88
- features: ["Advanced OTA features", "Higher priority support"]
74
+ description: "Everything in Basic, plus enhanced update management and automation features."
89
75
  },
90
76
  enterprise: {
91
77
  id: "enterprise",
92
78
  name: "Enterprise",
93
- minimalDeviceCount: { standard: 1e3, micro: 2e3 },
94
- price: "Custom pricing",
95
- deviceCount: "Unlimited devices",
96
- 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.",
97
- features: ["All Mender features", "Advanced security features", "SLA-backed support"]
79
+ 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."
98
80
  }
99
81
  };
100
82
  var ADDONS = {
@@ -103,14 +85,6 @@ var ADDONS = {
103
85
  title: "Configure",
104
86
  description: "Seamlessly configure applications and devices remotely \u2013 configure each device to its environment.",
105
87
  needs: ["hasDeviceConfig"],
106
- os: {
107
- price: "$11/month",
108
- deviceCount: startingDeviceCount.os
109
- },
110
- professional: {
111
- price: "$65/month",
112
- deviceCount: startingDeviceCount.professional
113
- },
114
88
  eligible: ["os", "professional", "enterprise"]
115
89
  },
116
90
  monitor: {
@@ -118,14 +92,6 @@ var ADDONS = {
118
92
  title: "Monitor",
119
93
  description: "Detect and analyze health issues of devices, services and applications. Set up alerts so you can act quickly.",
120
94
  needs: ["hasMonitor"],
121
- os: {
122
- price: "-",
123
- deviceCount: "-"
124
- },
125
- professional: {
126
- price: "$86/month",
127
- deviceCount: startingDeviceCount.professional
128
- },
129
95
  eligible: ["professional", "enterprise"]
130
96
  },
131
97
  troubleshoot: {
@@ -133,14 +99,6 @@ var ADDONS = {
133
99
  title: "Troubleshoot",
134
100
  description: "Secure, remote access to your devices \u2013 quickly diagnose and fix issues in real time.",
135
101
  needs: ["hasDeviceConnect"],
136
- os: {
137
- price: "$27/month",
138
- deviceCount: startingDeviceCount.os
139
- },
140
- professional: {
141
- price: "$72/month",
142
- deviceCount: startingDeviceCount.professional
143
- },
144
102
  eligible: ["os", "professional", "enterprise"]
145
103
  }
146
104
  };
@@ -1394,6 +1352,9 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
1394
1352
  setSubscription: (state, action) => {
1395
1353
  state.organization.subscription = { ...state.organization.subscription, ...action.payload };
1396
1354
  },
1355
+ setProducts: (state, action) => {
1356
+ state.products = action.payload;
1357
+ },
1397
1358
  setBillingProfile: (state, action) => {
1398
1359
  state.organization.billing_profile = action.payload;
1399
1360
  },
@@ -1912,17 +1873,14 @@ var getAttributesList = (0, import_toolkit11.createSelector)(
1912
1873
  [getFilteringAttributes, getFilteringAttributesFromConfig],
1913
1874
  ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers3.duplicateFilter)
1914
1875
  );
1915
- var getDeviceLimitStats = (0, import_toolkit11.createSelector)(
1916
- [getDeviceLimits, getAcceptedDevices],
1917
- (limits, accepted) => {
1918
- const { counts } = accepted;
1919
- return Object.entries(limits).filter(([, limit]) => limit !== 0).map(([type, limit]) => ({
1920
- type,
1921
- limit,
1922
- total: counts[type] || 0
1923
- }));
1924
- }
1925
- );
1876
+ var getDeviceLimitStats = (0, import_toolkit11.createSelector)([getDeviceLimits, getAcceptedDevices], (limits, accepted) => {
1877
+ const { counts } = accepted;
1878
+ return Object.entries(limits).filter(([, limit]) => limit !== 0).map(([type, limit]) => ({
1879
+ type,
1880
+ limit,
1881
+ total: counts[type] || 0
1882
+ }));
1883
+ });
1926
1884
  var getDeviceTypes = (0, import_toolkit11.createSelector)(
1927
1885
  [getAcceptedDevices, getDevicesById],
1928
1886
  ({ deviceIds = [] }, devicesById) => Object.keys(
@@ -2115,18 +2073,21 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
2115
2073
  { inventory: { device_type: [], artifact_name: "" }, identity: {}, monitor: {}, system: {}, tags: {} }
2116
2074
  );
2117
2075
  var isDarkMode = (mode) => mode === DARK_MODE;
2118
- var parseSubscriptionPreview = (lines) => lines.reduce(
2119
- (acc, { addon, amount, product }) => {
2120
- const planId = product.slice("mender_".length);
2121
- if (!addon) {
2122
- acc[planId] = (acc[planId] ?? 0) + amount;
2123
- } else {
2124
- acc.addons[addon] = (acc.addons[addon] ?? 0) + amount;
2125
- }
2126
- return acc;
2127
- },
2128
- { addons: {} }
2129
- );
2076
+ var parseSubscriptionPreview = (lines) => lines.reduce((acc, { addon, amount, product }) => {
2077
+ const tier = product.replace("mender_", "");
2078
+ if (!acc[tier]) {
2079
+ acc[tier] = {
2080
+ amount: 0,
2081
+ addons: {}
2082
+ };
2083
+ }
2084
+ if (!addon) {
2085
+ acc[tier].amount += amount;
2086
+ } else {
2087
+ acc[tier].addons[addon] = (acc[tier].addons[addon] ?? 0) + amount;
2088
+ }
2089
+ return acc;
2090
+ }, {});
2130
2091
 
2131
2092
  // src/releasesSlice/selectors.ts
2132
2093
  var getSelectedReleaseId = (state) => state.releases.selectedRelease;
@@ -4114,6 +4075,63 @@ var cancelRequest = createAppAsyncThunk(`${sliceName6}/cancelRequest`, (reason,
4114
4075
  () => Promise.resolve(dispatch(setSnackbar4({ message: "Deactivation request was sent successfully", autoHideDuration: TIMEOUTS.fiveSeconds })))
4115
4076
  );
4116
4077
  });
4078
+ var getTierId = (tierName) => tierName.replace("mender_", "");
4079
+ var getProductPlans = (products) => products.reduce(
4080
+ (plansById, product) => {
4081
+ const { name, prices } = product;
4082
+ const tierId = getTierId(name);
4083
+ prices.forEach((price) => {
4084
+ const existing = plansById[price.plan] ?? { ...PLANS[price.plan], tierLimitsConstrains: {} };
4085
+ const tierConstraints = price.constraints ? { [tierId]: { min: price.constraints.min, max: price.constraints.max, div: price.constraints.div } } : {};
4086
+ plansById[price.plan] = {
4087
+ ...existing,
4088
+ tierLimitsConstrains: {
4089
+ ...existing.tierLimitsConstrains,
4090
+ ...tierConstraints
4091
+ }
4092
+ };
4093
+ });
4094
+ return plansById;
4095
+ },
4096
+ { enterprise: { ...PLANS.enterprise } }
4097
+ );
4098
+ var getProductAddons = (products) => products.reduce((accu, product) => {
4099
+ const { addons = [] } = product;
4100
+ addons.forEach((addon) => {
4101
+ const { name: addonName = "", prices: addonPrices = [] } = addon;
4102
+ const existingEligible = accu[addonName]?.eligible ?? [];
4103
+ const newEligible = addonPrices.map((p) => p.plan);
4104
+ accu[addonName] = {
4105
+ ...ADDONS[addonName],
4106
+ eligible: [.../* @__PURE__ */ new Set([...existingEligible, ...newEligible, PLANS.enterprise.id])]
4107
+ };
4108
+ });
4109
+ return accu;
4110
+ }, {});
4111
+ var transformProductResponse = (products) => {
4112
+ const tiers = [];
4113
+ const sortedProducts = products.sort((a, b) => a.name.localeCompare(b.name));
4114
+ sortedProducts.forEach((tier) => {
4115
+ const addonsSupported = Object.fromEntries((tier.addons || []).map((addon) => [addon.name, addon.prices?.map((p) => p.plan)]));
4116
+ const allPlans = tier.prices.map((price) => price.plan);
4117
+ const addonsTransposed = allPlans.reduce((acc, plan) => {
4118
+ acc[plan] = Object.entries(addonsSupported).filter(([, addonSupportedPlans]) => addonSupportedPlans.includes(plan)).map(([addon]) => addon);
4119
+ return acc;
4120
+ }, {});
4121
+ const tierId = getTierId(tier.name);
4122
+ tiers.push({
4123
+ id: tierId,
4124
+ title: tierId,
4125
+ stripeProductName: tier.name,
4126
+ limitConstrains: Object.fromEntries(tier.prices.map((p) => [p.plan, p.constraints])),
4127
+ addons: addonsSupported,
4128
+ addonsByPlan: addonsTransposed
4129
+ });
4130
+ });
4131
+ const plans = getProductPlans(products);
4132
+ const addons = getProductAddons(products);
4133
+ return { plans, tiers, addons };
4134
+ };
4117
4135
  var getTargetLocation = (key) => {
4118
4136
  if (devLocations.includes(window.location.hostname)) {
4119
4137
  return "";
@@ -4328,7 +4346,7 @@ var getUserSubscription = createAppAsyncThunk(`${sliceName6}/getUserSubscription
4328
4346
  });
4329
4347
  var getBillingPreview = createAppAsyncThunk(
4330
4348
  `${sliceName6}/getBillingPreview`,
4331
- (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)
4349
+ (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)
4332
4350
  );
4333
4351
  var getCurrentSubscription = createAppAsyncThunk(
4334
4352
  `${sliceName6}/getCurrentSubscription`,
@@ -4339,6 +4357,10 @@ var getCurrentSubscription = createAppAsyncThunk(
4339
4357
  return commonErrorHandler(err, "There was an error retrieving your current subscription", dispatch, commonErrorFallback);
4340
4358
  })
4341
4359
  );
4360
+ var getProducts = createAppAsyncThunk(
4361
+ `${sliceName6}/getEnabledTiers`,
4362
+ (_, { 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))))
4363
+ );
4342
4364
  var requestPlanUpgrade = createAppAsyncThunk(
4343
4365
  `${sliceName6}/requestPlanUpgrade`,
4344
4366
  (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())]))