subos-frontend 1.0.51 → 1.0.53
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 +26 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -28
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +0 -11
- package/dist/types/components/payments/ChangeCardButton.d.ts +1 -0
- package/dist/types/components/payments/ChangeCardButton.d.ts.map +1 -1
- package/dist/types/components/transaction/TransactionStatusFilter.d.ts.map +1 -1
- package/dist/types/hooks/useCustomerPortal.d.ts +2 -1
- package/dist/types/hooks/useCustomerPortal.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -173,7 +173,7 @@ var plansApi = {
|
|
|
173
173
|
};
|
|
174
174
|
var subscriptionApi = {
|
|
175
175
|
getActiveSubscription: async (externalId) => {
|
|
176
|
-
return apiRequest(`${ENDPOINTS.SUBSCRIPTION}/${externalId}`, "GET", void 0, { projectId:
|
|
176
|
+
return apiRequest(`${ENDPOINTS.SUBSCRIPTION}/${externalId}`, "GET", void 0, { projectId: "8bbac5bf-24ea-4f50-aba4-74d84a4cabf7" });
|
|
177
177
|
},
|
|
178
178
|
cancelSubscription: async (externalId, options) => {
|
|
179
179
|
let endpoint = `${ENDPOINTS.SUBSCRIPTION}/${externalId}`;
|
|
@@ -754,7 +754,8 @@ var useCancelSubscription = ({
|
|
|
754
754
|
};
|
|
755
755
|
var useCustomerPortal = ({
|
|
756
756
|
onSuccess,
|
|
757
|
-
onError
|
|
757
|
+
onError,
|
|
758
|
+
returnPath = "/dashboard"
|
|
758
759
|
} = {}) => {
|
|
759
760
|
const [loading, setLoading] = React9.useState(false);
|
|
760
761
|
const [error, setError] = React9.useState(null);
|
|
@@ -769,7 +770,7 @@ var useCustomerPortal = ({
|
|
|
769
770
|
setLoading(true);
|
|
770
771
|
setError(null);
|
|
771
772
|
try {
|
|
772
|
-
const returnUrl = `${window.location.origin}
|
|
773
|
+
const returnUrl = `${window.location.origin}${returnPath}`;
|
|
773
774
|
const response = await customerApi.createPortalSession(
|
|
774
775
|
externalId,
|
|
775
776
|
returnUrl
|
|
@@ -794,7 +795,7 @@ var useCustomerPortal = ({
|
|
|
794
795
|
} finally {
|
|
795
796
|
setLoading(false);
|
|
796
797
|
}
|
|
797
|
-
}, [onSuccess, onError]);
|
|
798
|
+
}, [onSuccess, onError, returnPath]);
|
|
798
799
|
const reset = React9.useCallback(() => {
|
|
799
800
|
setLoading(false);
|
|
800
801
|
setError(null);
|
|
@@ -1336,42 +1337,43 @@ var ChangeCardButton = ({
|
|
|
1336
1337
|
className = "",
|
|
1337
1338
|
children,
|
|
1338
1339
|
onSuccess,
|
|
1339
|
-
onError
|
|
1340
|
+
onError,
|
|
1341
|
+
returnPath
|
|
1340
1342
|
}) => {
|
|
1341
|
-
const {
|
|
1343
|
+
const { openCustomerPortal } = useCustomerPortal({
|
|
1342
1344
|
onSuccess: () => {
|
|
1343
1345
|
onSuccess == null ? void 0 : onSuccess();
|
|
1344
1346
|
},
|
|
1345
1347
|
onError: (error) => {
|
|
1346
1348
|
onError == null ? void 0 : onError(error);
|
|
1347
|
-
}
|
|
1349
|
+
},
|
|
1350
|
+
returnPath
|
|
1348
1351
|
});
|
|
1349
1352
|
const handleClick = async () => {
|
|
1350
1353
|
await openCustomerPortal(externalId);
|
|
1351
1354
|
};
|
|
1352
|
-
const defaultClassName = "text-sm font-medium transition-colors duration-200
|
|
1355
|
+
const defaultClassName = "text-sm font-medium transition-colors duration-200";
|
|
1353
1356
|
const finalClassName = className || defaultClassName;
|
|
1354
1357
|
const getStyles = () => ({
|
|
1355
|
-
color:
|
|
1358
|
+
color: "var(--subos-primary-600, #2563eb)",
|
|
1356
1359
|
textDecoration: "none"
|
|
1357
1360
|
});
|
|
1358
1361
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1359
1362
|
"button",
|
|
1360
1363
|
{
|
|
1361
1364
|
onClick: handleClick,
|
|
1362
|
-
disabled: loading,
|
|
1363
1365
|
className: finalClassName,
|
|
1364
1366
|
type: "button",
|
|
1365
1367
|
style: getStyles(),
|
|
1366
|
-
onMouseEnter:
|
|
1368
|
+
onMouseEnter: (e) => {
|
|
1367
1369
|
e.currentTarget.style.color = "var(--subos-primary-700, #1d4ed8)";
|
|
1368
1370
|
e.currentTarget.style.textDecoration = "underline";
|
|
1369
|
-
}
|
|
1370
|
-
onMouseLeave:
|
|
1371
|
+
},
|
|
1372
|
+
onMouseLeave: (e) => {
|
|
1371
1373
|
e.currentTarget.style.color = "var(--subos-primary-600, #2563eb)";
|
|
1372
1374
|
e.currentTarget.style.textDecoration = "none";
|
|
1373
|
-
}
|
|
1374
|
-
children:
|
|
1375
|
+
},
|
|
1376
|
+
children: children || "Manage Billing"
|
|
1375
1377
|
}
|
|
1376
1378
|
);
|
|
1377
1379
|
};
|
|
@@ -1444,7 +1446,7 @@ var PaymentCancelView = ({ details, dashboardUrl = "/dashboard", planUrl = "/pla
|
|
|
1444
1446
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-500", children: [
|
|
1445
1447
|
"Having trouble?",
|
|
1446
1448
|
" ",
|
|
1447
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: supportUrl, className: "text-blue-600 hover:text-blue-700", children: "Contact Support" })
|
|
1449
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: supportUrl, target: "_blank", rel: "noopener noreferrer", className: "text-blue-600 hover:text-blue-700", children: "Contact Support" })
|
|
1448
1450
|
] }) })
|
|
1449
1451
|
] })
|
|
1450
1452
|
] });
|
|
@@ -1537,7 +1539,7 @@ var PaymentSuccessView = ({
|
|
|
1537
1539
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-500", children: [
|
|
1538
1540
|
"Need help?",
|
|
1539
1541
|
" ",
|
|
1540
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: supportUrl, className: "text-blue-600 hover:text-blue-700", children: "Contact Support" })
|
|
1542
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: supportUrl, target: "_blank", rel: "noopener noreferrer", className: "text-blue-600 hover:text-blue-700", children: "Contact Support" })
|
|
1541
1543
|
] }) })
|
|
1542
1544
|
] })
|
|
1543
1545
|
] });
|
|
@@ -1688,11 +1690,11 @@ var getStatusColor = (status, customColors) => {
|
|
|
1688
1690
|
return "bg-blue-100 text-blue-800";
|
|
1689
1691
|
}
|
|
1690
1692
|
};
|
|
1691
|
-
var formatCurrency = (amount, currency
|
|
1693
|
+
var formatCurrency = (amount, currency) => {
|
|
1692
1694
|
const numericAmount = typeof amount === "string" ? parseFloat(amount) : amount;
|
|
1693
1695
|
return new Intl.NumberFormat("en-US", {
|
|
1694
1696
|
style: "currency",
|
|
1695
|
-
currency
|
|
1697
|
+
currency: currency || "USD"
|
|
1696
1698
|
}).format(numericAmount);
|
|
1697
1699
|
};
|
|
1698
1700
|
var formatMetaLabel = (key) => {
|
|
@@ -1757,10 +1759,10 @@ var TransactionItem = ({
|
|
|
1757
1759
|
] }),
|
|
1758
1760
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1759
1761
|
showFields.amount && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
|
|
1760
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-900", children: formatCurrency(transaction.amount, transaction == null ? void 0 : transaction.currency) }),
|
|
1761
|
-
showFields.discount && transaction.discountAmt && parseFloat(transaction.discountAmt.toString()) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-green-600", children: [
|
|
1762
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-900", children: formatCurrency(transaction == null ? void 0 : transaction.amount, transaction == null ? void 0 : transaction.currency) }),
|
|
1763
|
+
showFields.discount && (transaction == null ? void 0 : transaction.discountAmt) && parseFloat(transaction == null ? void 0 : transaction.discountAmt.toString()) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-green-600", children: [
|
|
1762
1764
|
"-",
|
|
1763
|
-
formatCurrency(transaction.discountAmt, transaction == null ? void 0 : transaction.currency),
|
|
1765
|
+
formatCurrency(transaction == null ? void 0 : transaction.discountAmt, transaction == null ? void 0 : transaction.currency),
|
|
1764
1766
|
" discount"
|
|
1765
1767
|
] })
|
|
1766
1768
|
] }),
|
|
@@ -1922,14 +1924,10 @@ var TransactionList = ({
|
|
|
1922
1924
|
)) }) });
|
|
1923
1925
|
};
|
|
1924
1926
|
var defaultStatuses = [
|
|
1925
|
-
{ value: "", label: "All Statuses", color: "bg-
|
|
1926
|
-
// { value: 'activated', label: 'Activated', color: 'bg-green-100 text-green-800' },
|
|
1927
|
+
{ value: "", label: "All Statuses", color: "bg-blue-600 text-white" },
|
|
1927
1928
|
{ value: "pending", label: "Pending", color: "bg-yellow-100 text-yellow-800" },
|
|
1928
1929
|
{ value: "succeeded", label: "Succeeded", color: "bg-green-100 text-green-800" },
|
|
1929
|
-
// { value: 'renewed', label: 'Renewed', color: 'bg-green-100 text-green-800' },
|
|
1930
|
-
// { value: 'processing', label: 'Processing', color: 'bg-yellow-100 text-yellow-800' },
|
|
1931
1930
|
{ value: "payment_failed", label: "Payment Failed", color: "bg-red-100 text-red-800" }
|
|
1932
|
-
// { value: 'use_stripe_sdk', label: 'Use Stripe SDK', color: 'bg-blue-100 text-blue-800' },
|
|
1933
1931
|
];
|
|
1934
1932
|
var TransactionStatusFilter = ({
|
|
1935
1933
|
selectedStatus = "",
|
|
@@ -1946,7 +1944,7 @@ var TransactionStatusFilter = ({
|
|
|
1946
1944
|
onClick: () => onStatusChange(status.value),
|
|
1947
1945
|
className: `
|
|
1948
1946
|
px-3 py-1 rounded-full text-sm font-medium transition-all duration-200
|
|
1949
|
-
${selectedStatus === status.value ?
|
|
1947
|
+
${selectedStatus === status.value ? status.color : "bg-gray-100 text-gray-600 hover:bg-gray-200"}
|
|
1950
1948
|
`,
|
|
1951
1949
|
children: status.label
|
|
1952
1950
|
},
|