subos-frontend 1.0.40 → 1.0.42
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/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types/api/client.d.ts +1 -2
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/components/upgrade/UpgradeSummary.d.ts +1 -0
- package/dist/types/components/upgrade/UpgradeSummary.d.ts.map +1 -1
- package/dist/types/hooks/usePlans.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -158,8 +158,8 @@ var plansApi = {
|
|
|
158
158
|
planCode,
|
|
159
159
|
currency,
|
|
160
160
|
returnUrl: (options == null ? void 0 : options.returnUrl) ?? `${window.location.origin}/payment-success`,
|
|
161
|
-
cancelUrl: (options == null ? void 0 : options.cancelUrl) ?? `${window.location.origin}/payment-cancel
|
|
162
|
-
billableMetricCode: options
|
|
161
|
+
cancelUrl: (options == null ? void 0 : options.cancelUrl) ?? `${window.location.origin}/payment-cancel`
|
|
162
|
+
// billableMetricCode: options?.billableMetricCode,
|
|
163
163
|
};
|
|
164
164
|
if (externalId) payload.externalId = externalId;
|
|
165
165
|
if (options == null ? void 0 : options.couponCode) payload.couponCode = options.couponCode;
|
|
@@ -192,8 +192,12 @@ var subscriptionApi = {
|
|
|
192
192
|
}
|
|
193
193
|
return apiRequest(endpoint, "DELETE", void 0, { projectId: getDefaultProjectId() });
|
|
194
194
|
},
|
|
195
|
-
checkoutInfo: async (planCode, externalId) => {
|
|
196
|
-
|
|
195
|
+
checkoutInfo: async (planCode, externalId, billableMetricCode) => {
|
|
196
|
+
const queryParams = { projectId: getDefaultProjectId() };
|
|
197
|
+
if (billableMetricCode) {
|
|
198
|
+
queryParams.billableMetricCode = billableMetricCode;
|
|
199
|
+
}
|
|
200
|
+
return apiRequest(`${ENDPOINTS.CHECKOUT}/info/${planCode}/${externalId}`, "GET", void 0, queryParams);
|
|
197
201
|
}
|
|
198
202
|
};
|
|
199
203
|
var customerApi = {
|
|
@@ -441,6 +445,7 @@ var usePlans = () => {
|
|
|
441
445
|
try {
|
|
442
446
|
const response = await plansApi.createPaymentSession(selectedPlan.code, {
|
|
443
447
|
externalId
|
|
448
|
+
// billableMetricCode: "CANDIDATES"
|
|
444
449
|
});
|
|
445
450
|
if (response.success && ((_a = response.data) == null ? void 0 : _a.checkoutUrl)) {
|
|
446
451
|
window.location.href = response.data.checkoutUrl;
|
|
@@ -2782,7 +2787,8 @@ var UpgradeSummary = ({
|
|
|
2782
2787
|
currentPlan,
|
|
2783
2788
|
externalId,
|
|
2784
2789
|
onUpgrade,
|
|
2785
|
-
isVisible = true
|
|
2790
|
+
isVisible = true,
|
|
2791
|
+
billableMetricCode
|
|
2786
2792
|
}) => {
|
|
2787
2793
|
const [checkoutInfo, setCheckoutInfo] = React9.useState(null);
|
|
2788
2794
|
const [loading, setLoading] = React9.useState(false);
|
|
@@ -2810,7 +2816,7 @@ var UpgradeSummary = ({
|
|
|
2810
2816
|
const fetchCheckoutInfo = async () => {
|
|
2811
2817
|
setLoading(true);
|
|
2812
2818
|
try {
|
|
2813
|
-
const response = await subscriptionApi.checkoutInfo(selectedPlan.code, externalId);
|
|
2819
|
+
const response = await subscriptionApi.checkoutInfo(selectedPlan.code, externalId, billableMetricCode);
|
|
2814
2820
|
const dataWrapper = response == null ? void 0 : response.data;
|
|
2815
2821
|
if ((dataWrapper == null ? void 0 : dataWrapper.success) && (dataWrapper == null ? void 0 : dataWrapper.data)) {
|
|
2816
2822
|
setCheckoutInfo(dataWrapper.data);
|
|
@@ -2822,7 +2828,7 @@ var UpgradeSummary = ({
|
|
|
2822
2828
|
}
|
|
2823
2829
|
};
|
|
2824
2830
|
fetchCheckoutInfo();
|
|
2825
|
-
}, [selectedPlan, currentPlan, externalId, isVisible]);
|
|
2831
|
+
}, [selectedPlan, currentPlan, externalId, isVisible, billableMetricCode]);
|
|
2826
2832
|
const planToDisplay = selectedPlan || currentPlan;
|
|
2827
2833
|
const isShowingCurrentPlan = !selectedPlan && currentPlan;
|
|
2828
2834
|
if (!planToDisplay || !isVisible || Number(planToDisplay.fixedCost) === 0 || loading || !checkoutInfo) {
|