subos-frontend 1.0.99 → 1.0.102
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 +54 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -12
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +11 -0
- package/dist/types/components/subscription/GracePeriodNotification.d.ts +8 -0
- package/dist/types/components/subscription/GracePeriodNotification.d.ts.map +1 -0
- package/dist/types/components/subscription/SubscriptionDetails.d.ts +1 -0
- package/dist/types/components/subscription/SubscriptionDetails.d.ts.map +1 -1
- package/dist/types/components/subscription/SubscriptionInfoGrid.d.ts +2 -1
- package/dist/types/components/subscription/SubscriptionInfoGrid.d.ts.map +1 -1
- package/dist/types/components/subscription/SubscriptionUsageDisplay.d.ts +1 -0
- package/dist/types/components/subscription/SubscriptionUsageDisplay.d.ts.map +1 -1
- package/dist/types/pages/DashboardPage.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -514,7 +514,7 @@ var getUniqueCandidateUnits = (plans) => {
|
|
|
514
514
|
var _a, _b;
|
|
515
515
|
if (((_a = charge.billableMetric) == null ? void 0 : _a.code) === "CANDIDATES") {
|
|
516
516
|
const units = (_b = charge.properties) == null ? void 0 : _b.units;
|
|
517
|
-
if (typeof units === "number" && Number.isFinite(units)) {
|
|
517
|
+
if (typeof units === "number" && Number.isFinite(units) && units !== 500) {
|
|
518
518
|
unitsSet.add(units);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
@@ -2605,10 +2605,11 @@ var SubscriptionInfoGrid = ({
|
|
|
2605
2605
|
fields,
|
|
2606
2606
|
className = "",
|
|
2607
2607
|
gridCols = 3,
|
|
2608
|
-
showDefaultFields = true
|
|
2608
|
+
showDefaultFields = true,
|
|
2609
|
+
loading = false
|
|
2609
2610
|
}) => {
|
|
2610
2611
|
const displayFields = fields || (showDefaultFields ? defaultFields : []);
|
|
2611
|
-
if (
|
|
2612
|
+
if (displayFields.length === 0) {
|
|
2612
2613
|
return null;
|
|
2613
2614
|
}
|
|
2614
2615
|
const getGridClass = () => {
|
|
@@ -2651,7 +2652,7 @@ var SubscriptionInfoGrid = ({
|
|
|
2651
2652
|
fontWeight: "var(--subos-font-weight-subscription-value, 500)",
|
|
2652
2653
|
color: "var(--subos-color-subscription-value, inherit)"
|
|
2653
2654
|
},
|
|
2654
|
-
children: field.getValue(subscription)
|
|
2655
|
+
children: loading ? "N/A" : field.getValue(subscription) || "N/A"
|
|
2655
2656
|
}
|
|
2656
2657
|
)
|
|
2657
2658
|
] }, field.key);
|
|
@@ -2662,9 +2663,10 @@ var SubscriptionUsageDisplay = ({
|
|
|
2662
2663
|
usageMetrics,
|
|
2663
2664
|
className = "",
|
|
2664
2665
|
gridCols = 3,
|
|
2665
|
-
showProgressBars = false
|
|
2666
|
+
showProgressBars = false,
|
|
2667
|
+
loading = false
|
|
2666
2668
|
}) => {
|
|
2667
|
-
if (
|
|
2669
|
+
if (usageMetrics.length === 0) {
|
|
2668
2670
|
return null;
|
|
2669
2671
|
}
|
|
2670
2672
|
const getGridClass = () => {
|
|
@@ -2697,9 +2699,9 @@ var SubscriptionUsageDisplay = ({
|
|
|
2697
2699
|
};
|
|
2698
2700
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `grid ${getGridClass()} gap-4 ${className}`, children: usageMetrics.map((metric) => {
|
|
2699
2701
|
var _a, _b;
|
|
2700
|
-
const used = ((_a = subscription.usage) == null ? void 0 : _a[metric.key])
|
|
2701
|
-
const total = ((_b = subscription.meta) == null ? void 0 : _b[metric.key])
|
|
2702
|
-
const displayValue = metric.formatValue ? metric.formatValue(used, total) : formatDefaultValue(used, total);
|
|
2702
|
+
const used = ((_a = subscription == null ? void 0 : subscription.usage) == null ? void 0 : _a[metric.key]) ?? 0;
|
|
2703
|
+
const total = ((_b = subscription == null ? void 0 : subscription.meta) == null ? void 0 : _b[metric.key]) ?? 0;
|
|
2704
|
+
const displayValue = loading ? "N/A" : metric.formatValue ? metric.formatValue(used, total) : formatDefaultValue(used, total);
|
|
2703
2705
|
const percentage = getProgressPercentage(used, total);
|
|
2704
2706
|
const shouldShowProgress = showProgressBars || metric.showProgress;
|
|
2705
2707
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 border border-gray-200 rounded-lg bg-white space-y-1", children: [
|
|
@@ -3016,6 +3018,41 @@ var ScheduledPlanNotification = ({
|
|
|
3016
3018
|
] }) })
|
|
3017
3019
|
] });
|
|
3018
3020
|
};
|
|
3021
|
+
var GracePeriodNotification = ({
|
|
3022
|
+
subscription,
|
|
3023
|
+
className = ""
|
|
3024
|
+
}) => {
|
|
3025
|
+
var _a;
|
|
3026
|
+
if (!((_a = subscription == null ? void 0 : subscription.meta) == null ? void 0 : _a.isGracePeriod)) {
|
|
3027
|
+
return null;
|
|
3028
|
+
}
|
|
3029
|
+
const startDate = subscription.meta.gracePeriodStart;
|
|
3030
|
+
const endDate = subscription.meta.gracePeriodEnd;
|
|
3031
|
+
let remainingDays = subscription.remainingGracePeriodDays ?? 0;
|
|
3032
|
+
if (endDate) {
|
|
3033
|
+
const end = new Date(endDate).getTime();
|
|
3034
|
+
const now = (/* @__PURE__ */ new Date()).getTime();
|
|
3035
|
+
const diff = end - now;
|
|
3036
|
+
remainingDays = Math.max(0, Math.ceil(diff / (1e3 * 60 * 60 * 24)));
|
|
3037
|
+
}
|
|
3038
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `mb-4 p-4 bg-orange-50 border border-orange-200 rounded-lg flex items-start gap-3 ${className}`, children: [
|
|
3039
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-orange-500 mt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-5 h-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }) }),
|
|
3040
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
|
|
3041
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-bold text-orange-900 mb-1", children: "Grace Period Active" }),
|
|
3042
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-orange-800", children: [
|
|
3043
|
+
"Your 7-day grace period started on",
|
|
3044
|
+
" ",
|
|
3045
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: startDate ? formatDate(startDate) : "N/A" }),
|
|
3046
|
+
". You have ",
|
|
3047
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-bold text-orange-900 text-base", children: [
|
|
3048
|
+
remainingDays,
|
|
3049
|
+
" days remaining"
|
|
3050
|
+
] }),
|
|
3051
|
+
" to update your payment method to continue your subscription without interruption."
|
|
3052
|
+
] })
|
|
3053
|
+
] })
|
|
3054
|
+
] });
|
|
3055
|
+
};
|
|
3019
3056
|
var SubscriptionDetails = ({
|
|
3020
3057
|
subscription,
|
|
3021
3058
|
externalId,
|
|
@@ -3028,7 +3065,8 @@ var SubscriptionDetails = ({
|
|
|
3028
3065
|
showCancelButton = true,
|
|
3029
3066
|
showChangeCardButton = true,
|
|
3030
3067
|
customActions = [],
|
|
3031
|
-
className = ""
|
|
3068
|
+
className = "",
|
|
3069
|
+
loading = false
|
|
3032
3070
|
}) => {
|
|
3033
3071
|
const [isTransactionModalOpen, setIsTransactionModalOpen] = React10.useState(false);
|
|
3034
3072
|
const [showCancelConfirmation, setShowCancelConfirmation] = React10.useState(false);
|
|
@@ -3112,11 +3150,13 @@ var SubscriptionDetails = ({
|
|
|
3112
3150
|
) })
|
|
3113
3151
|
] }),
|
|
3114
3152
|
/* @__PURE__ */ jsxRuntime.jsx(ScheduledPlanNotification, { subscription: localSubscription }),
|
|
3153
|
+
/* @__PURE__ */ jsxRuntime.jsx(GracePeriodNotification, { subscription: localSubscription }),
|
|
3115
3154
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-5 gap-4", children: [
|
|
3116
3155
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3117
3156
|
SubscriptionInfoGrid,
|
|
3118
3157
|
{
|
|
3119
3158
|
subscription: localSubscription,
|
|
3159
|
+
loading,
|
|
3120
3160
|
className: "!contents",
|
|
3121
3161
|
gridCols: usageMetrics.length > 0 ? 3 : 5
|
|
3122
3162
|
}
|
|
@@ -3125,6 +3165,7 @@ var SubscriptionDetails = ({
|
|
|
3125
3165
|
SubscriptionUsageDisplay,
|
|
3126
3166
|
{
|
|
3127
3167
|
subscription: localSubscription,
|
|
3168
|
+
loading,
|
|
3128
3169
|
usageMetrics,
|
|
3129
3170
|
gridCols: Math.min(usageMetrics.length, 3),
|
|
3130
3171
|
className: "!contents"
|
|
@@ -3249,7 +3290,7 @@ var UpgradeSummary = ({
|
|
|
3249
3290
|
style: { color: "var(--subos-foreground, #1e293b)" },
|
|
3250
3291
|
children: [
|
|
3251
3292
|
currencySymbol,
|
|
3252
|
-
formatCurrencyAmount(displayInfo.planPrice, currencyCode),
|
|
3293
|
+
formatCurrencyAmount((displayInfo == null ? void 0 : displayInfo.planPrice) || 0, currencyCode),
|
|
3253
3294
|
"/",
|
|
3254
3295
|
intervalDisplay
|
|
3255
3296
|
]
|
|
@@ -3281,7 +3322,7 @@ var UpgradeSummary = ({
|
|
|
3281
3322
|
style: { color: "var(--subos-foreground, #1e293b)" },
|
|
3282
3323
|
children: [
|
|
3283
3324
|
currencySymbol,
|
|
3284
|
-
formatCurrencyAmount(dueToday, currencyCode)
|
|
3325
|
+
formatCurrencyAmount(dueToday || 0, currencyCode)
|
|
3285
3326
|
]
|
|
3286
3327
|
}
|
|
3287
3328
|
),
|
|
@@ -3538,6 +3579,7 @@ var DashboardPage = ({
|
|
|
3538
3579
|
SubscriptionDetails,
|
|
3539
3580
|
{
|
|
3540
3581
|
subscription: subscription.subscription,
|
|
3582
|
+
loading: subscription.loading,
|
|
3541
3583
|
externalId,
|
|
3542
3584
|
onSubscriptionCancelled: () => {
|
|
3543
3585
|
subscription.fetchSubscription(externalId);
|