subos-frontend 1.0.110 → 1.0.112
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 +31 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -5
- package/dist/index.mjs.map +1 -1
- package/dist/types/api/client.d.ts +1 -0
- package/dist/types/api/client.d.ts.map +1 -1
- package/dist/types/components/subscription/ScheduledPlanNotification.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +10 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -176,9 +176,14 @@ var plansApi = {
|
|
|
176
176
|
var subscriptionApi = {
|
|
177
177
|
getActiveSubscription: async (externalId, options) => {
|
|
178
178
|
let endpoint = `${ENDPOINTS.SUBSCRIPTION}/${externalId}`;
|
|
179
|
+
const params = new URLSearchParams();
|
|
179
180
|
if (options == null ? void 0 : options.currency) {
|
|
180
|
-
const params = new URLSearchParams();
|
|
181
181
|
params.append("currency", options.currency);
|
|
182
|
+
}
|
|
183
|
+
if (options == null ? void 0 : options.billableMetric) {
|
|
184
|
+
params.append("billableMetric", typeof options.billableMetric === "string" ? options.billableMetric : "true");
|
|
185
|
+
}
|
|
186
|
+
if (params.toString()) {
|
|
182
187
|
endpoint += `?${params.toString()}`;
|
|
183
188
|
}
|
|
184
189
|
return apiRequest(endpoint, "GET", void 0, void 0, true);
|
|
@@ -425,7 +430,7 @@ var SubscriptionProvider = ({ children }) => {
|
|
|
425
430
|
setLoading(true);
|
|
426
431
|
setError(null);
|
|
427
432
|
try {
|
|
428
|
-
const response = await subscriptionApi.getActiveSubscription(externalId, { currency });
|
|
433
|
+
const response = await subscriptionApi.getActiveSubscription(externalId, { currency, billableMetric: "CANDIDATES" });
|
|
429
434
|
if (response.success && response.data) {
|
|
430
435
|
setSubscription(response.data);
|
|
431
436
|
} else {
|
|
@@ -3032,12 +3037,33 @@ var ScheduledPlanNotification = ({
|
|
|
3032
3037
|
if (!(subscription == null ? void 0 : subscription.nextMembership)) {
|
|
3033
3038
|
return null;
|
|
3034
3039
|
}
|
|
3040
|
+
const formatInterval = (interval) => {
|
|
3041
|
+
if (!interval) return "";
|
|
3042
|
+
return interval.charAt(0).toUpperCase() + interval.slice(1).toLowerCase();
|
|
3043
|
+
};
|
|
3044
|
+
const nextPlan = subscription.nextMembership.plan;
|
|
3045
|
+
if (!nextPlan || !nextPlan.name) {
|
|
3046
|
+
return null;
|
|
3047
|
+
}
|
|
3048
|
+
const metrics = nextPlan.charges && Array.isArray(nextPlan.charges) && nextPlan.charges.length > 0 ? `(${nextPlan.charges.map(
|
|
3049
|
+
(charge) => {
|
|
3050
|
+
var _a, _b, _c;
|
|
3051
|
+
return `${((_a = charge.billableMetric) == null ? void 0 : _a.name) || "Metric"}: ${((_c = (_b = charge.properties) == null ? void 0 : _b.units) == null ? void 0 : _c.toLocaleString()) || 0}`;
|
|
3052
|
+
}
|
|
3053
|
+
).join(", ")}) ` : "";
|
|
3035
3054
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md flex items-start gap-3 ${className}`, children: [
|
|
3036
3055
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-yellow-600 mt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(WarningIcon, { className: "w-5 h-5" }) }),
|
|
3037
3056
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-yellow-800", children: [
|
|
3038
|
-
"Your subscription will change to
|
|
3039
|
-
|
|
3040
|
-
"
|
|
3057
|
+
"Your subscription will change to",
|
|
3058
|
+
" ",
|
|
3059
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-semibold", children: [
|
|
3060
|
+
nextPlan.name,
|
|
3061
|
+
" ",
|
|
3062
|
+
formatInterval(nextPlan.interval),
|
|
3063
|
+
" ",
|
|
3064
|
+
metrics
|
|
3065
|
+
] }),
|
|
3066
|
+
"plan on",
|
|
3041
3067
|
" ",
|
|
3042
3068
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: new Date(subscription.nextMembership.membershipDate).toLocaleDateString("en-US", {
|
|
3043
3069
|
year: "numeric",
|