@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.
- package/dist/actions.cjs +3 -0
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.d.cts +2 -1
- package/dist/actions.d.ts +2 -1
- package/dist/actions.js +6 -6
- package/dist/api/general-api.js +2 -2
- package/dist/api/users-api.js +2 -2
- package/dist/appSlice/constants.cjs +11 -49
- package/dist/appSlice/constants.cjs.map +1 -1
- package/dist/appSlice/constants.d.cts +1 -16
- package/dist/appSlice/constants.d.ts +1 -16
- package/dist/appSlice/constants.js +1 -1
- package/dist/appSlice/index.js +2 -2
- package/dist/appSlice/mocks.js +2 -2
- package/dist/appSlice/thunks.cjs +30 -60
- package/dist/appSlice/thunks.cjs.map +1 -1
- package/dist/appSlice/thunks.js +17 -17
- package/dist/auth.js +2 -2
- package/dist/{chunk-QFYYTAYD.js → chunk-3JBVI4UH.js} +9 -9
- package/dist/{chunk-QL6FN2JC.js → chunk-4ZYLGBJU.js} +2 -2
- package/dist/{chunk-U5TPV5X5.js → chunk-7WIISD2N.js} +17 -14
- package/dist/{chunk-U5TPV5X5.js.map → chunk-7WIISD2N.js.map} +1 -1
- package/dist/{chunk-FUGCLQ5L.js → chunk-AY7E7VA6.js} +102 -28
- package/dist/chunk-AY7E7VA6.js.map +1 -0
- package/dist/{chunk-EL672W25.js → chunk-DBBE6D36.js} +12 -50
- package/dist/chunk-DBBE6D36.js.map +1 -0
- package/dist/{chunk-GBXG2XBY.js → chunk-E657OJL4.js} +6 -6
- package/dist/{chunk-MZ5NRW3K.js → chunk-FXKMYYK5.js} +17 -17
- package/dist/{chunk-KJHHSYGP.js → chunk-P3N2J3QT.js} +10 -10
- package/dist/{chunk-GEQ2QQEE.js → chunk-PL6RIFD5.js} +2 -2
- package/dist/{chunk-VCEFZTWS.js → chunk-TIL2S3JA.js} +4 -1
- package/dist/chunk-TIL2S3JA.js.map +1 -0
- package/dist/{chunk-C3EMLDPU.js → chunk-V6BWOIRC.js} +6 -6
- package/dist/{chunk-O7DR57RN.js → chunk-ZGRY42BZ.js} +9 -12
- package/dist/{chunk-O7DR57RN.js.map → chunk-ZGRY42BZ.js.map} +1 -1
- package/dist/{chunk-3NOV7X4M.js → chunk-ZZQJWNQT.js} +3 -1
- package/dist/chunk-ZZQJWNQT.js.map +1 -0
- package/dist/commonConstants.js +2 -2
- package/dist/commonSelectors.cjs +19 -60
- package/dist/commonSelectors.cjs.map +1 -1
- package/dist/commonSelectors.js +9 -9
- package/dist/constants.cjs +11 -49
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.js +2 -2
- package/dist/deploymentsSlice/constants.js +2 -2
- package/dist/deploymentsSlice/index.js +2 -2
- package/dist/deploymentsSlice/mocks.js +2 -2
- package/dist/deploymentsSlice/selectors.js +2 -2
- package/dist/deploymentsSlice/thunks.cjs +30 -60
- package/dist/deploymentsSlice/thunks.cjs.map +1 -1
- package/dist/deploymentsSlice/thunks.js +17 -17
- package/dist/devicesSlice/constants.js +2 -2
- package/dist/devicesSlice/index.js +2 -2
- package/dist/devicesSlice/mocks.js +2 -2
- package/dist/devicesSlice/selectors.cjs +8 -11
- package/dist/devicesSlice/selectors.cjs.map +1 -1
- package/dist/devicesSlice/selectors.js +3 -3
- package/dist/devicesSlice/thunks.cjs +32 -60
- package/dist/devicesSlice/thunks.cjs.map +1 -1
- package/dist/devicesSlice/thunks.d.cts +41 -3
- package/dist/devicesSlice/thunks.d.ts +41 -3
- package/dist/devicesSlice/thunks.js +19 -17
- package/dist/liststatehook.js +2 -2
- package/dist/locationutils.js +2 -2
- package/dist/monitorSlice/index.js +2 -2
- package/dist/monitorSlice/mocks.js +2 -2
- package/dist/monitorSlice/thunks.cjs +22 -60
- package/dist/monitorSlice/thunks.cjs.map +1 -1
- package/dist/monitorSlice/thunks.js +15 -15
- package/dist/onboardingSlice/thunks.cjs +30 -60
- package/dist/onboardingSlice/thunks.cjs.map +1 -1
- package/dist/onboardingSlice/thunks.js +17 -17
- package/dist/organizationSlice/constants.js +2 -2
- package/dist/organizationSlice/index.cjs +3 -0
- package/dist/organizationSlice/index.cjs.map +1 -1
- package/dist/organizationSlice/index.d.cts +4 -1
- package/dist/organizationSlice/index.d.ts +4 -1
- package/dist/organizationSlice/index.js +3 -3
- package/dist/organizationSlice/mocks.cjs +175 -0
- package/dist/organizationSlice/mocks.cjs.map +1 -1
- package/dist/organizationSlice/mocks.d.cts +121 -2
- package/dist/organizationSlice/mocks.d.ts +121 -2
- package/dist/organizationSlice/mocks.js +88 -3
- package/dist/organizationSlice/mocks.js.map +1 -1
- package/dist/organizationSlice/selectors.cjs +3 -0
- package/dist/organizationSlice/selectors.cjs.map +1 -1
- package/dist/organizationSlice/selectors.d.cts +3 -2
- package/dist/organizationSlice/selectors.d.ts +3 -2
- package/dist/organizationSlice/selectors.js +5 -3
- package/dist/organizationSlice/thunks.cjs +113 -75
- package/dist/organizationSlice/thunks.cjs.map +1 -1
- package/dist/organizationSlice/thunks.d.cts +17 -3
- package/dist/organizationSlice/thunks.d.ts +17 -3
- package/dist/organizationSlice/thunks.js +23 -19
- package/dist/organizationSlice/types.cjs.map +1 -1
- package/dist/organizationSlice/types.d.cts +30 -7
- package/dist/organizationSlice/types.d.ts +30 -7
- package/dist/releasesSlice/index.js +2 -2
- package/dist/releasesSlice/mocks.js +2 -2
- package/dist/releasesSlice/selectors.cjs.map +1 -1
- package/dist/releasesSlice/selectors.js +4 -4
- package/dist/releasesSlice/thunks.cjs +22 -60
- package/dist/releasesSlice/thunks.cjs.map +1 -1
- package/dist/releasesSlice/thunks.js +15 -15
- package/dist/selectors.cjs +22 -60
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +1 -1
- package/dist/selectors.d.ts +1 -1
- package/dist/selectors.js +39 -37
- package/dist/sockethook.js +2 -2
- package/dist/store.cjs +3 -0
- package/dist/store.cjs.map +1 -1
- package/dist/store.js +7 -7
- package/dist/storehooks.cjs +109 -74
- package/dist/storehooks.cjs.map +1 -1
- package/dist/storehooks.js +24 -22
- package/dist/storehooks.js.map +1 -1
- package/dist/thunks.cjs +113 -73
- package/dist/thunks.cjs.map +1 -1
- package/dist/thunks.d.cts +2 -2
- package/dist/thunks.d.ts +2 -2
- package/dist/thunks.js +23 -17
- package/dist/useDeploymentDevice.cjs +30 -60
- package/dist/useDeploymentDevice.cjs.map +1 -1
- package/dist/useDeploymentDevice.js +19 -19
- package/dist/usersSlice/constants.js +2 -2
- package/dist/usersSlice/index.js +2 -2
- package/dist/usersSlice/mocks.js +2 -2
- package/dist/usersSlice/selectors.cjs +11 -49
- package/dist/usersSlice/selectors.cjs.map +1 -1
- package/dist/usersSlice/selectors.js +4 -4
- package/dist/usersSlice/thunks.cjs +30 -60
- package/dist/usersSlice/thunks.cjs.map +1 -1
- package/dist/usersSlice/thunks.js +17 -17
- package/dist/utils.cjs +26 -61
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -3
- package/dist/utils.d.ts +1 -3
- package/dist/utils.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-3NOV7X4M.js.map +0 -1
- package/dist/chunk-EL672W25.js.map +0 -1
- package/dist/chunk-FUGCLQ5L.js.map +0 -1
- package/dist/chunk-VCEFZTWS.js.map +0 -1
- /package/dist/{chunk-QFYYTAYD.js.map → chunk-3JBVI4UH.js.map} +0 -0
- /package/dist/{chunk-QL6FN2JC.js.map → chunk-4ZYLGBJU.js.map} +0 -0
- /package/dist/{chunk-GBXG2XBY.js.map → chunk-E657OJL4.js.map} +0 -0
- /package/dist/{chunk-MZ5NRW3K.js.map → chunk-FXKMYYK5.js.map} +0 -0
- /package/dist/{chunk-KJHHSYGP.js.map → chunk-P3N2J3QT.js.map} +0 -0
- /package/dist/{chunk-GEQ2QQEE.js.map → chunk-PL6RIFD5.js.map} +0 -0
- /package/dist/{chunk-C3EMLDPU.js.map → chunk-V6BWOIRC.js.map} +0 -0
package/dist/storehooks.cjs
CHANGED
|
@@ -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,82 +66,48 @@ var PLANS = {
|
|
|
70
66
|
os: {
|
|
71
67
|
id: "os",
|
|
72
68
|
name: "Basic",
|
|
73
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 = {
|
|
101
83
|
configure: {
|
|
102
84
|
id: "configure",
|
|
103
85
|
title: "Configure",
|
|
104
|
-
description: "
|
|
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: {
|
|
117
91
|
id: "monitor",
|
|
118
92
|
title: "Monitor",
|
|
119
|
-
description: "
|
|
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: {
|
|
132
98
|
id: "troubleshoot",
|
|
133
99
|
title: "Troubleshoot",
|
|
134
|
-
description: "
|
|
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
|
};
|
|
147
105
|
var BENEFITS = {
|
|
148
|
-
auditlog: {
|
|
106
|
+
auditlog: {
|
|
107
|
+
id: "auditlog",
|
|
108
|
+
benefit: "gain access to logs for important events such as changes to devices, deployments and user management, as well as remote terminal session replays",
|
|
109
|
+
requiredPlan: PLANS.enterprise.id
|
|
110
|
+
},
|
|
149
111
|
dashboard: { id: "dashboard", benefit: "actionable insights into the devices you are updating with Mender", requiredPlan: PLANS.enterprise.id },
|
|
150
112
|
deltaGeneration: {
|
|
151
113
|
id: "deltaGeneration",
|
|
@@ -1390,6 +1352,9 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
|
|
|
1390
1352
|
setSubscription: (state, action) => {
|
|
1391
1353
|
state.organization.subscription = { ...state.organization.subscription, ...action.payload };
|
|
1392
1354
|
},
|
|
1355
|
+
setProducts: (state, action) => {
|
|
1356
|
+
state.products = action.payload;
|
|
1357
|
+
},
|
|
1393
1358
|
setBillingProfile: (state, action) => {
|
|
1394
1359
|
state.organization.billing_profile = action.payload;
|
|
1395
1360
|
},
|
|
@@ -1908,17 +1873,14 @@ var getAttributesList = (0, import_toolkit11.createSelector)(
|
|
|
1908
1873
|
[getFilteringAttributes, getFilteringAttributesFromConfig],
|
|
1909
1874
|
({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers3.duplicateFilter)
|
|
1910
1875
|
);
|
|
1911
|
-
var getDeviceLimitStats = (0, import_toolkit11.createSelector)(
|
|
1912
|
-
|
|
1913
|
-
(limits,
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
}));
|
|
1920
|
-
}
|
|
1921
|
-
);
|
|
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
|
+
});
|
|
1922
1884
|
var getDeviceTypes = (0, import_toolkit11.createSelector)(
|
|
1923
1885
|
[getAcceptedDevices, getDevicesById],
|
|
1924
1886
|
({ deviceIds = [] }, devicesById) => Object.keys(
|
|
@@ -2111,18 +2073,21 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
|
|
|
2111
2073
|
{ inventory: { device_type: [], artifact_name: "" }, identity: {}, monitor: {}, system: {}, tags: {} }
|
|
2112
2074
|
);
|
|
2113
2075
|
var isDarkMode = (mode) => mode === DARK_MODE;
|
|
2114
|
-
var parseSubscriptionPreview = (lines) => lines.reduce(
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
);
|
|
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
|
+
}, {});
|
|
2126
2091
|
|
|
2127
2092
|
// src/releasesSlice/selectors.ts
|
|
2128
2093
|
var getSelectedReleaseId = (state) => state.releases.selectedRelease;
|
|
@@ -3142,11 +3107,18 @@ var addStaticGroup = createAppAsyncThunk(
|
|
|
3142
3107
|
)
|
|
3143
3108
|
).catch((err) => commonErrorHandler(err, `Group could not be updated:`, dispatch))
|
|
3144
3109
|
);
|
|
3110
|
+
var removeReportsByGroupName = createAppAsyncThunk(`${sliceName3}/removeReportsByGroupName`, (groupName, { dispatch, getState }) => {
|
|
3111
|
+
if (!groupName) return Promise.resolve();
|
|
3112
|
+
const reports = getDeviceReportsForUser(getState());
|
|
3113
|
+
const filteredReports = reports.filter((report) => report.group !== groupName);
|
|
3114
|
+
dispatch(saveUserSettings({ reports: filteredReports }));
|
|
3115
|
+
});
|
|
3145
3116
|
var removeStaticGroup = createAppAsyncThunk(
|
|
3146
3117
|
`${sliceName3}/removeStaticGroup`,
|
|
3147
3118
|
(groupName, { dispatch }) => general_api_default.delete(`${import_constants5.inventoryApiUrl}/groups/${groupName}`).then(
|
|
3148
3119
|
() => Promise.all([
|
|
3149
3120
|
dispatch(actions3.removeGroup(groupName)),
|
|
3121
|
+
dispatch(removeReportsByGroupName(groupName)),
|
|
3150
3122
|
dispatch(getGroups2()),
|
|
3151
3123
|
dispatch(setSnackbar3({ message: "Group was removed successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
|
|
3152
3124
|
])
|
|
@@ -3212,6 +3184,7 @@ var removeDynamicGroup = createAppAsyncThunk(`${sliceName3}/removeDynamicGroup`,
|
|
|
3212
3184
|
return general_api_default.delete(`${import_constants5.inventoryApiUrlV2}/filters/${filterId}`).then(
|
|
3213
3185
|
() => Promise.all([
|
|
3214
3186
|
dispatch(actions3.removeGroup(groupName)),
|
|
3187
|
+
dispatch(removeReportsByGroupName(groupName)),
|
|
3215
3188
|
dispatch(setSnackbar3({ message: "Group was removed successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
|
|
3216
3189
|
])
|
|
3217
3190
|
);
|
|
@@ -4102,6 +4075,63 @@ var cancelRequest = createAppAsyncThunk(`${sliceName6}/cancelRequest`, (reason,
|
|
|
4102
4075
|
() => Promise.resolve(dispatch(setSnackbar4({ message: "Deactivation request was sent successfully", autoHideDuration: TIMEOUTS.fiveSeconds })))
|
|
4103
4076
|
);
|
|
4104
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
|
+
};
|
|
4105
4135
|
var getTargetLocation = (key) => {
|
|
4106
4136
|
if (devLocations.includes(window.location.hostname)) {
|
|
4107
4137
|
return "";
|
|
@@ -4316,7 +4346,7 @@ var getUserSubscription = createAppAsyncThunk(`${sliceName6}/getUserSubscription
|
|
|
4316
4346
|
});
|
|
4317
4347
|
var getBillingPreview = createAppAsyncThunk(
|
|
4318
4348
|
`${sliceName6}/getBillingPreview`,
|
|
4319
|
-
(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" ? {
|
|
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)
|
|
4320
4350
|
);
|
|
4321
4351
|
var getCurrentSubscription = createAppAsyncThunk(
|
|
4322
4352
|
`${sliceName6}/getCurrentSubscription`,
|
|
@@ -4327,6 +4357,10 @@ var getCurrentSubscription = createAppAsyncThunk(
|
|
|
4327
4357
|
return commonErrorHandler(err, "There was an error retrieving your current subscription", dispatch, commonErrorFallback);
|
|
4328
4358
|
})
|
|
4329
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
|
+
);
|
|
4330
4364
|
var requestPlanUpgrade = createAppAsyncThunk(
|
|
4331
4365
|
`${sliceName6}/requestPlanUpgrade`,
|
|
4332
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())]))
|
|
@@ -5610,7 +5644,8 @@ var useAppInit = (userId) => {
|
|
|
5610
5644
|
dispatch(getGroups2()),
|
|
5611
5645
|
dispatch(getIntegrations()),
|
|
5612
5646
|
dispatch(getReleases()),
|
|
5613
|
-
dispatch(getAllDeviceCounts()).unwrap()
|
|
5647
|
+
dispatch(getAllDeviceCounts()).unwrap(),
|
|
5648
|
+
dispatch(getProducts())
|
|
5614
5649
|
];
|
|
5615
5650
|
if (hasMultitenancy) {
|
|
5616
5651
|
tasks.push(dispatch(getDeviceLimits2()));
|