subos-frontend 1.0.13 → 1.0.15
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 +363 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +286 -76
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +16 -79
- package/dist/types/components/payments/ChangeCardButton.d.ts.map +1 -1
- package/dist/types/components/plans/BillingCycleToggle.d.ts.map +1 -1
- package/dist/types/components/plans/TierFilterDropdown.d.ts.map +1 -1
- package/dist/types/components/subscription/SubscriptionActionButtons.d.ts.map +1 -1
- package/dist/types/components/subscription/SubscriptionCancelButton.d.ts.map +1 -1
- package/dist/types/components/subscription/SubscriptionDetails.d.ts.map +1 -1
- package/dist/types/components/subscription/SubscriptionTransactionButton.d.ts.map +1 -1
- package/dist/types/components/upgrade/UpgradeSummary.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React8 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var reactRouterDom = require('react-router-dom');
|
|
6
6
|
|
|
7
7
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var React8__default = /*#__PURE__*/_interopDefault(React8);
|
|
11
11
|
|
|
12
12
|
// src/config/envConfig.ts
|
|
13
13
|
function getEnvVar(key, fallback) {
|
|
@@ -216,10 +216,10 @@ var transactionApi = {
|
|
|
216
216
|
getInvoice: (transactionId) => apiRequest(`${ENDPOINTS.TRANSACTIONS}/${transactionId}/invoice`)
|
|
217
217
|
};
|
|
218
218
|
var useSubscription = () => {
|
|
219
|
-
const [subscription, setSubscription] =
|
|
220
|
-
const [loading, setLoading] =
|
|
221
|
-
const [error, setError] =
|
|
222
|
-
const fetchSubscription =
|
|
219
|
+
const [subscription, setSubscription] = React8.useState(null);
|
|
220
|
+
const [loading, setLoading] = React8.useState(false);
|
|
221
|
+
const [error, setError] = React8.useState(null);
|
|
222
|
+
const fetchSubscription = React8.useCallback(async (externalId) => {
|
|
223
223
|
if (!externalId || externalId === "undefined" || externalId.trim() === "") {
|
|
224
224
|
setError("Invalid user ID. Please ensure you are properly authenticated.");
|
|
225
225
|
setLoading(false);
|
|
@@ -244,7 +244,7 @@ var useSubscription = () => {
|
|
|
244
244
|
setLoading(false);
|
|
245
245
|
}
|
|
246
246
|
}, [loading]);
|
|
247
|
-
const clearSubscription =
|
|
247
|
+
const clearSubscription = React8.useCallback(() => {
|
|
248
248
|
setSubscription(null);
|
|
249
249
|
setError(null);
|
|
250
250
|
}, []);
|
|
@@ -381,14 +381,14 @@ var formatDate = (dateString, format = "date") => {
|
|
|
381
381
|
|
|
382
382
|
// src/hooks/usePlans.ts
|
|
383
383
|
var usePlans = () => {
|
|
384
|
-
const [plans, setPlans] =
|
|
385
|
-
const [filteredPlans, setFilteredPlans] =
|
|
386
|
-
const [selectedPlan, setSelectedPlan] =
|
|
387
|
-
const [tierFilter, setTierFilter] =
|
|
388
|
-
const [billingCycle, setBillingCycle] =
|
|
389
|
-
const [loading, setLoading] =
|
|
390
|
-
const [error, setError] =
|
|
391
|
-
const fetchPlans =
|
|
384
|
+
const [plans, setPlans] = React8.useState([]);
|
|
385
|
+
const [filteredPlans, setFilteredPlans] = React8.useState([]);
|
|
386
|
+
const [selectedPlan, setSelectedPlan] = React8.useState(null);
|
|
387
|
+
const [tierFilter, setTierFilter] = React8.useState("all");
|
|
388
|
+
const [billingCycle, setBillingCycle] = React8.useState("monthly");
|
|
389
|
+
const [loading, setLoading] = React8.useState(false);
|
|
390
|
+
const [error, setError] = React8.useState(null);
|
|
391
|
+
const fetchPlans = React8.useCallback(async () => {
|
|
392
392
|
if (loading) return;
|
|
393
393
|
setLoading(true);
|
|
394
394
|
setError(null);
|
|
@@ -410,7 +410,7 @@ var usePlans = () => {
|
|
|
410
410
|
setLoading(false);
|
|
411
411
|
}
|
|
412
412
|
}, [loading]);
|
|
413
|
-
|
|
413
|
+
React8.useEffect(() => {
|
|
414
414
|
if (plans.length > 0 && tierFilter === "all") {
|
|
415
415
|
const uniqueUnits = getUniqueCandidateUnits(plans);
|
|
416
416
|
if (uniqueUnits.length > 0) {
|
|
@@ -418,16 +418,16 @@ var usePlans = () => {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
}, [plans, tierFilter]);
|
|
421
|
-
|
|
421
|
+
React8.useEffect(() => {
|
|
422
422
|
let filtered = [...plans];
|
|
423
423
|
filtered = filterPlansByBillingCycle(filtered, billingCycle);
|
|
424
424
|
filtered = filterPlansByTier(filtered, tierFilter);
|
|
425
425
|
setFilteredPlans(filtered);
|
|
426
426
|
}, [plans, tierFilter, billingCycle]);
|
|
427
|
-
const handlePlanSelect =
|
|
427
|
+
const handlePlanSelect = React8.useCallback((plan) => {
|
|
428
428
|
setSelectedPlan(plan);
|
|
429
429
|
}, []);
|
|
430
|
-
const handleUpgrade =
|
|
430
|
+
const handleUpgrade = React8.useCallback(async (externalId) => {
|
|
431
431
|
var _a;
|
|
432
432
|
if (!selectedPlan) return;
|
|
433
433
|
try {
|
|
@@ -445,14 +445,14 @@ var usePlans = () => {
|
|
|
445
445
|
alert("An error occurred. Please try again.");
|
|
446
446
|
}
|
|
447
447
|
}, [selectedPlan]);
|
|
448
|
-
const clearPlans =
|
|
448
|
+
const clearPlans = React8.useCallback(() => {
|
|
449
449
|
setPlans([]);
|
|
450
450
|
setFilteredPlans([]);
|
|
451
451
|
setSelectedPlan(null);
|
|
452
452
|
setError(null);
|
|
453
453
|
setTierFilter("all");
|
|
454
454
|
}, []);
|
|
455
|
-
const clearSelectedPlan2 =
|
|
455
|
+
const clearSelectedPlan2 = React8.useCallback(() => {
|
|
456
456
|
setSelectedPlan(null);
|
|
457
457
|
}, []);
|
|
458
458
|
const dropdownOptions = getDropdownOptions(plans);
|
|
@@ -536,18 +536,18 @@ var useTransactions = ({
|
|
|
536
536
|
initialFilters = {},
|
|
537
537
|
autoFetch = false
|
|
538
538
|
}) => {
|
|
539
|
-
const [transactions, setTransactions] =
|
|
540
|
-
const [allTransactions, setAllTransactions] =
|
|
541
|
-
const [loading, setLoading] =
|
|
542
|
-
const [error, setError] =
|
|
543
|
-
const [filters, setFilters] =
|
|
539
|
+
const [transactions, setTransactions] = React8.useState([]);
|
|
540
|
+
const [allTransactions, setAllTransactions] = React8.useState([]);
|
|
541
|
+
const [loading, setLoading] = React8.useState(false);
|
|
542
|
+
const [error, setError] = React8.useState(null);
|
|
543
|
+
const [filters, setFilters] = React8.useState({
|
|
544
544
|
...DEFAULT_FILTERS,
|
|
545
545
|
...initialFilters
|
|
546
546
|
});
|
|
547
|
-
const [meta, setMeta] =
|
|
548
|
-
const [isBackendPaginated, setIsBackendPaginated] =
|
|
549
|
-
const hasAutoFetchedRef =
|
|
550
|
-
const fetchTransactions =
|
|
547
|
+
const [meta, setMeta] = React8.useState(null);
|
|
548
|
+
const [isBackendPaginated, setIsBackendPaginated] = React8.useState(false);
|
|
549
|
+
const hasAutoFetchedRef = React8.useRef(false);
|
|
550
|
+
const fetchTransactions = React8.useCallback(async () => {
|
|
551
551
|
if (!externalId) return;
|
|
552
552
|
setLoading(true);
|
|
553
553
|
setError(null);
|
|
@@ -591,7 +591,7 @@ var useTransactions = ({
|
|
|
591
591
|
setLoading(false);
|
|
592
592
|
}
|
|
593
593
|
}, [externalId, filters]);
|
|
594
|
-
const updateFilters =
|
|
594
|
+
const updateFilters = React8.useCallback((newFilters) => {
|
|
595
595
|
setFilters((prev) => ({
|
|
596
596
|
...prev,
|
|
597
597
|
...newFilters,
|
|
@@ -599,7 +599,7 @@ var useTransactions = ({
|
|
|
599
599
|
page: newFilters.page !== void 0 ? newFilters.page : 1
|
|
600
600
|
}));
|
|
601
601
|
}, []);
|
|
602
|
-
|
|
602
|
+
React8.useEffect(() => {
|
|
603
603
|
if (!isBackendPaginated && allTransactions.length > 0) {
|
|
604
604
|
const filteredTransactions = applyFrontendFilters(allTransactions, filters);
|
|
605
605
|
const paginatedResult = applyFrontendPagination(filteredTransactions, filters);
|
|
@@ -607,19 +607,19 @@ var useTransactions = ({
|
|
|
607
607
|
setMeta(paginatedResult.meta);
|
|
608
608
|
}
|
|
609
609
|
}, [filters, allTransactions, isBackendPaginated]);
|
|
610
|
-
const clearFilters =
|
|
610
|
+
const clearFilters = React8.useCallback(() => {
|
|
611
611
|
setFilters(DEFAULT_FILTERS);
|
|
612
612
|
}, []);
|
|
613
|
-
const refetch =
|
|
613
|
+
const refetch = React8.useCallback(async () => {
|
|
614
614
|
await fetchTransactions();
|
|
615
615
|
}, [fetchTransactions]);
|
|
616
|
-
|
|
616
|
+
React8.useEffect(() => {
|
|
617
617
|
if (autoFetch && externalId && !hasAutoFetchedRef.current) {
|
|
618
618
|
hasAutoFetchedRef.current = true;
|
|
619
619
|
fetchTransactions();
|
|
620
620
|
}
|
|
621
621
|
}, [autoFetch, externalId, fetchTransactions]);
|
|
622
|
-
|
|
622
|
+
React8.useEffect(() => {
|
|
623
623
|
if (!autoFetch) return;
|
|
624
624
|
const hasNonPaginationFilters = filters.startDate !== void 0 || filters.endDate !== void 0 || filters.status !== void 0;
|
|
625
625
|
const shouldFetch = isBackendPaginated || allTransactions.length === 0 && hasNonPaginationFilters;
|
|
@@ -646,10 +646,10 @@ var usePagination = ({
|
|
|
646
646
|
initialPage = 1,
|
|
647
647
|
initialLimit = 10
|
|
648
648
|
} = {}) => {
|
|
649
|
-
const [currentPage, setCurrentPage] =
|
|
650
|
-
const [limit, setLimitState] =
|
|
651
|
-
const [meta, setMeta] =
|
|
652
|
-
const goToPage =
|
|
649
|
+
const [currentPage, setCurrentPage] = React8.useState(initialPage);
|
|
650
|
+
const [limit, setLimitState] = React8.useState(initialLimit);
|
|
651
|
+
const [meta, setMeta] = React8.useState(null);
|
|
652
|
+
const goToPage = React8.useCallback((page) => {
|
|
653
653
|
if (meta) {
|
|
654
654
|
const validPage = Math.max(1, Math.min(page, meta.totalPages));
|
|
655
655
|
setCurrentPage(validPage);
|
|
@@ -657,29 +657,29 @@ var usePagination = ({
|
|
|
657
657
|
setCurrentPage(Math.max(1, page));
|
|
658
658
|
}
|
|
659
659
|
}, [meta]);
|
|
660
|
-
const goToNextPage =
|
|
660
|
+
const goToNextPage = React8.useCallback(() => {
|
|
661
661
|
if (meta && meta.hasNextPage) {
|
|
662
662
|
setCurrentPage((prev) => prev + 1);
|
|
663
663
|
}
|
|
664
664
|
}, [meta]);
|
|
665
|
-
const goToPreviousPage =
|
|
665
|
+
const goToPreviousPage = React8.useCallback(() => {
|
|
666
666
|
if (meta && meta.hasPreviousPage) {
|
|
667
667
|
setCurrentPage((prev) => prev - 1);
|
|
668
668
|
}
|
|
669
669
|
}, [meta]);
|
|
670
|
-
const goToFirstPage =
|
|
670
|
+
const goToFirstPage = React8.useCallback(() => {
|
|
671
671
|
setCurrentPage(1);
|
|
672
672
|
}, []);
|
|
673
|
-
const goToLastPage =
|
|
673
|
+
const goToLastPage = React8.useCallback(() => {
|
|
674
674
|
if (meta) {
|
|
675
675
|
setCurrentPage(meta.totalPages);
|
|
676
676
|
}
|
|
677
677
|
}, [meta]);
|
|
678
|
-
const setLimit =
|
|
678
|
+
const setLimit = React8.useCallback((newLimit) => {
|
|
679
679
|
setLimitState(newLimit);
|
|
680
680
|
setCurrentPage(1);
|
|
681
681
|
}, []);
|
|
682
|
-
const reset =
|
|
682
|
+
const reset = React8.useCallback(() => {
|
|
683
683
|
setCurrentPage(initialPage);
|
|
684
684
|
setLimitState(initialLimit);
|
|
685
685
|
setMeta(null);
|
|
@@ -702,9 +702,9 @@ var useCancelSubscription = ({
|
|
|
702
702
|
onSuccess,
|
|
703
703
|
onError
|
|
704
704
|
} = {}) => {
|
|
705
|
-
const [loading, setLoading] =
|
|
706
|
-
const [error, setError] =
|
|
707
|
-
const cancelSubscription =
|
|
705
|
+
const [loading, setLoading] = React8.useState(false);
|
|
706
|
+
const [error, setError] = React8.useState(null);
|
|
707
|
+
const cancelSubscription = React8.useCallback(async (externalId, options) => {
|
|
708
708
|
if (!externalId) {
|
|
709
709
|
const errorMsg = "External ID is required";
|
|
710
710
|
setError(errorMsg);
|
|
@@ -733,7 +733,7 @@ var useCancelSubscription = ({
|
|
|
733
733
|
setLoading(false);
|
|
734
734
|
}
|
|
735
735
|
}, [onSuccess, onError]);
|
|
736
|
-
const reset =
|
|
736
|
+
const reset = React8.useCallback(() => {
|
|
737
737
|
setLoading(false);
|
|
738
738
|
setError(null);
|
|
739
739
|
}, []);
|
|
@@ -773,9 +773,9 @@ var useCustomerPortal = ({
|
|
|
773
773
|
onSuccess,
|
|
774
774
|
onError
|
|
775
775
|
} = {}) => {
|
|
776
|
-
const [loading, setLoading] =
|
|
777
|
-
const [error, setError] =
|
|
778
|
-
const openCustomerPortal =
|
|
776
|
+
const [loading, setLoading] = React8.useState(false);
|
|
777
|
+
const [error, setError] = React8.useState(null);
|
|
778
|
+
const openCustomerPortal = React8.useCallback(async (externalId) => {
|
|
779
779
|
var _a;
|
|
780
780
|
if (!externalId) {
|
|
781
781
|
const errorMsg = "External ID is required";
|
|
@@ -813,7 +813,7 @@ var useCustomerPortal = ({
|
|
|
813
813
|
setLoading(false);
|
|
814
814
|
}
|
|
815
815
|
}, [onSuccess, onError]);
|
|
816
|
-
const reset =
|
|
816
|
+
const reset = React8.useCallback(() => {
|
|
817
817
|
setLoading(false);
|
|
818
818
|
setError(null);
|
|
819
819
|
}, []);
|
|
@@ -824,9 +824,9 @@ var useCustomerPortal = ({
|
|
|
824
824
|
reset
|
|
825
825
|
};
|
|
826
826
|
};
|
|
827
|
-
var UpgradeContext =
|
|
827
|
+
var UpgradeContext = React8.createContext(void 0);
|
|
828
828
|
var UpgradeProvider = ({ children }) => {
|
|
829
|
-
const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] =
|
|
829
|
+
const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] = React8.useState(false);
|
|
830
830
|
const setUpgradeSummaryVisible = (visible) => {
|
|
831
831
|
setIsUpgradeSummaryVisible(visible);
|
|
832
832
|
};
|
|
@@ -846,7 +846,7 @@ var UpgradeProvider = ({ children }) => {
|
|
|
846
846
|
);
|
|
847
847
|
};
|
|
848
848
|
var useUpgrade = () => {
|
|
849
|
-
const context =
|
|
849
|
+
const context = React8.useContext(UpgradeContext);
|
|
850
850
|
if (context === void 0) {
|
|
851
851
|
throw new Error("useUpgrade must be used within an UpgradeProvider");
|
|
852
852
|
}
|
|
@@ -860,22 +860,34 @@ var BillingCycleToggle = ({
|
|
|
860
860
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
861
861
|
"div",
|
|
862
862
|
{
|
|
863
|
-
className: "flex rounded-lg p-1",
|
|
864
|
-
style: {
|
|
863
|
+
className: "inline-flex rounded-lg p-1",
|
|
864
|
+
style: {
|
|
865
|
+
backgroundColor: "var(--subos-muted, #f1f5f9)",
|
|
866
|
+
border: "1px solid var(--subos-border, #e2e8f0)"
|
|
867
|
+
},
|
|
865
868
|
children: [
|
|
866
869
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
867
870
|
"button",
|
|
868
871
|
{
|
|
869
872
|
onClick: () => onBillingCycleChange("monthly"),
|
|
870
|
-
className: `px-
|
|
871
|
-
style: billingCycle
|
|
872
|
-
|
|
873
|
-
|
|
873
|
+
className: `px-6 py-2 rounded-md text-sm font-medium transition-all duration-200 ${className || ""}`,
|
|
874
|
+
style: billingCycle === "monthly" ? {
|
|
875
|
+
backgroundColor: "var(--subos-primary-500, #ef4444)",
|
|
876
|
+
color: "white",
|
|
877
|
+
boxShadow: "0 2px 4px 0 rgba(0, 0, 0, 0.1)",
|
|
878
|
+
fontWeight: "600"
|
|
879
|
+
} : {
|
|
880
|
+
backgroundColor: "transparent",
|
|
881
|
+
color: "var(--subos-muted-foreground, #64748b)",
|
|
882
|
+
fontWeight: "500"
|
|
883
|
+
},
|
|
874
884
|
onMouseEnter: billingCycle !== "monthly" ? (e) => {
|
|
875
|
-
e.currentTarget.style.color = "var(--subos-foreground,
|
|
885
|
+
e.currentTarget.style.color = "var(--subos-foreground, #1e293b)";
|
|
886
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
876
887
|
} : void 0,
|
|
877
888
|
onMouseLeave: billingCycle !== "monthly" ? (e) => {
|
|
878
|
-
e.currentTarget.style.color = "var(--subos-muted-foreground, #
|
|
889
|
+
e.currentTarget.style.color = "var(--subos-muted-foreground, #64748b)";
|
|
890
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
879
891
|
} : void 0,
|
|
880
892
|
children: "Monthly"
|
|
881
893
|
}
|
|
@@ -884,15 +896,24 @@ var BillingCycleToggle = ({
|
|
|
884
896
|
"button",
|
|
885
897
|
{
|
|
886
898
|
onClick: () => onBillingCycleChange("yearly"),
|
|
887
|
-
className: `px-
|
|
888
|
-
style: billingCycle
|
|
889
|
-
|
|
890
|
-
|
|
899
|
+
className: `px-6 py-2 rounded-md text-sm font-medium transition-all duration-200 ${className || ""}`,
|
|
900
|
+
style: billingCycle === "yearly" ? {
|
|
901
|
+
backgroundColor: "var(--subos-primary-500, #ef4444)",
|
|
902
|
+
color: "white",
|
|
903
|
+
boxShadow: "0 2px 4px 0 rgba(0, 0, 0, 0.1)",
|
|
904
|
+
fontWeight: "600"
|
|
905
|
+
} : {
|
|
906
|
+
backgroundColor: "transparent",
|
|
907
|
+
color: "var(--subos-muted-foreground, #64748b)",
|
|
908
|
+
fontWeight: "500"
|
|
909
|
+
},
|
|
891
910
|
onMouseEnter: billingCycle !== "yearly" ? (e) => {
|
|
892
|
-
e.currentTarget.style.color = "var(--subos-foreground,
|
|
911
|
+
e.currentTarget.style.color = "var(--subos-foreground, #1e293b)";
|
|
912
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
893
913
|
} : void 0,
|
|
894
914
|
onMouseLeave: billingCycle !== "yearly" ? (e) => {
|
|
895
|
-
e.currentTarget.style.color = "var(--subos-muted-foreground, #
|
|
915
|
+
e.currentTarget.style.color = "var(--subos-muted-foreground, #64748b)";
|
|
916
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
896
917
|
} : void 0,
|
|
897
918
|
children: "Yearly"
|
|
898
919
|
}
|
|
@@ -909,8 +930,8 @@ var TierFilterDropdown = ({
|
|
|
909
930
|
selectedValue,
|
|
910
931
|
onSelect
|
|
911
932
|
}) => {
|
|
912
|
-
const dropdownRef =
|
|
913
|
-
|
|
933
|
+
const dropdownRef = React8.useRef(null);
|
|
934
|
+
React8.useEffect(() => {
|
|
914
935
|
const handleClickOutside = (event) => {
|
|
915
936
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
916
937
|
if (isOpen) {
|
|
@@ -932,31 +953,74 @@ var TierFilterDropdown = ({
|
|
|
932
953
|
"button",
|
|
933
954
|
{
|
|
934
955
|
onClick: onToggle,
|
|
935
|
-
className: "w-full
|
|
956
|
+
className: "w-full min-w-[200px] px-4 py-3 border rounded-lg text-left focus:outline-none focus:ring-2 flex items-center justify-between transition-all duration-200",
|
|
957
|
+
style: {
|
|
958
|
+
backgroundColor: "var(--subos-background, #ffffff)",
|
|
959
|
+
borderColor: isOpen ? "var(--subos-primary-500, #3f51b5)" : "var(--subos-border, #e2e8f0)",
|
|
960
|
+
color: "var(--subos-foreground, #1e293b)",
|
|
961
|
+
boxShadow: isOpen ? "0 0 0 1px var(--subos-primary-500, #3f51b5)" : "none"
|
|
962
|
+
},
|
|
963
|
+
onMouseEnter: (e) => {
|
|
964
|
+
if (!isOpen) {
|
|
965
|
+
e.currentTarget.style.borderColor = "var(--subos-muted-foreground, #64748b)";
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
onMouseLeave: (e) => {
|
|
969
|
+
if (!isOpen) {
|
|
970
|
+
e.currentTarget.style.borderColor = "var(--subos-border, #e2e8f0)";
|
|
971
|
+
}
|
|
972
|
+
},
|
|
936
973
|
children: [
|
|
937
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "var(--subos-foreground, #1e293b)" }, children: currentSelectionText }),
|
|
938
975
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
939
976
|
"svg",
|
|
940
977
|
{
|
|
941
|
-
className: `w-5 h-5
|
|
978
|
+
className: `w-5 h-5 transition-transform duration-200 ${isOpen ? "rotate-180" : ""}`,
|
|
942
979
|
fill: "none",
|
|
943
980
|
stroke: "currentColor",
|
|
944
981
|
viewBox: "0 0 24 24",
|
|
982
|
+
style: { color: "var(--subos-muted-foreground, #64748b)" },
|
|
945
983
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
946
984
|
}
|
|
947
985
|
)
|
|
948
986
|
]
|
|
949
987
|
}
|
|
950
988
|
),
|
|
951
|
-
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
952
|
-
"
|
|
989
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
990
|
+
"div",
|
|
953
991
|
{
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
992
|
+
className: "absolute top-full left-0 w-full min-w-[200px] mt-1 border rounded-lg z-50",
|
|
993
|
+
style: {
|
|
994
|
+
backgroundColor: "var(--subos-background, #ffffff)",
|
|
995
|
+
borderColor: "var(--subos-border, #e2e8f0)",
|
|
996
|
+
boxShadow: "var(--subos-shadow-card, 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06))"
|
|
997
|
+
},
|
|
998
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
999
|
+
"button",
|
|
1000
|
+
{
|
|
1001
|
+
onClick: () => handleOptionSelect(option.value),
|
|
1002
|
+
className: "w-full px-4 py-3 text-left transition-colors border-b last:border-b-0 first:rounded-t-lg last:rounded-b-lg",
|
|
1003
|
+
style: {
|
|
1004
|
+
backgroundColor: selectedValue === option.value ? "var(--subos-primary-50, #eff6ff)" : "transparent",
|
|
1005
|
+
color: selectedValue === option.value ? "var(--subos-primary-700, #1d4ed8)" : "var(--subos-foreground, #1e293b)",
|
|
1006
|
+
borderColor: "var(--subos-border, #f1f5f9)"
|
|
1007
|
+
},
|
|
1008
|
+
onMouseEnter: (e) => {
|
|
1009
|
+
if (selectedValue !== option.value) {
|
|
1010
|
+
e.currentTarget.style.backgroundColor = "var(--subos-accent, #f8fafc)";
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
onMouseLeave: (e) => {
|
|
1014
|
+
if (selectedValue !== option.value) {
|
|
1015
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: option.label }) })
|
|
1019
|
+
},
|
|
1020
|
+
option.value
|
|
1021
|
+
))
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
960
1024
|
] });
|
|
961
1025
|
};
|
|
962
1026
|
var CheckIcon = ({ className = "w-5 h-5", style }) => {
|
|
@@ -1141,7 +1205,7 @@ var PlanSelector = ({
|
|
|
1141
1205
|
onBillingCycleChange,
|
|
1142
1206
|
activePlanCode
|
|
1143
1207
|
}) => {
|
|
1144
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
1208
|
+
const [isDropdownOpen, setIsDropdownOpen] = React8.useState(false);
|
|
1145
1209
|
const handleDropdownToggle = () => {
|
|
1146
1210
|
setIsDropdownOpen(!isDropdownOpen);
|
|
1147
1211
|
};
|
|
@@ -1206,8 +1270,12 @@ var ChangeCardButton = ({
|
|
|
1206
1270
|
const handleClick = async () => {
|
|
1207
1271
|
await openCustomerPortal(externalId);
|
|
1208
1272
|
};
|
|
1209
|
-
const defaultClassName = "text-sm
|
|
1273
|
+
const defaultClassName = "text-sm font-medium transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed";
|
|
1210
1274
|
const finalClassName = className || defaultClassName;
|
|
1275
|
+
const getStyles = () => ({
|
|
1276
|
+
color: loading ? "var(--subos-muted-foreground, #64748b)" : "var(--subos-primary-600, #2563eb)",
|
|
1277
|
+
textDecoration: "none"
|
|
1278
|
+
});
|
|
1211
1279
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1212
1280
|
"button",
|
|
1213
1281
|
{
|
|
@@ -1215,7 +1283,16 @@ var ChangeCardButton = ({
|
|
|
1215
1283
|
disabled: loading,
|
|
1216
1284
|
className: finalClassName,
|
|
1217
1285
|
type: "button",
|
|
1218
|
-
|
|
1286
|
+
style: getStyles(),
|
|
1287
|
+
onMouseEnter: !loading ? (e) => {
|
|
1288
|
+
e.currentTarget.style.color = "var(--subos-primary-700, #1d4ed8)";
|
|
1289
|
+
e.currentTarget.style.textDecoration = "underline";
|
|
1290
|
+
} : void 0,
|
|
1291
|
+
onMouseLeave: !loading ? (e) => {
|
|
1292
|
+
e.currentTarget.style.color = "var(--subos-primary-600, #2563eb)";
|
|
1293
|
+
e.currentTarget.style.textDecoration = "none";
|
|
1294
|
+
} : void 0,
|
|
1295
|
+
children: loading ? "Opening..." : children || "Manage Billing"
|
|
1219
1296
|
}
|
|
1220
1297
|
);
|
|
1221
1298
|
};
|
|
@@ -1820,7 +1897,7 @@ var TransactionPagination = ({
|
|
|
1820
1897
|
children: "Previous"
|
|
1821
1898
|
}
|
|
1822
1899
|
),
|
|
1823
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-1", children: getVisiblePages().map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1900
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-1", children: getVisiblePages().map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React8__default.default.Fragment, { children: page === "..." ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-3 py-2 text-sm text-gray-500", children: "..." }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1824
1901
|
"button",
|
|
1825
1902
|
{
|
|
1826
1903
|
onClick: () => onPageChange(page),
|
|
@@ -1866,7 +1943,7 @@ var TransactionModal = ({
|
|
|
1866
1943
|
autoFetch: true
|
|
1867
1944
|
// Enable auto-fetch so it works when modal opens
|
|
1868
1945
|
});
|
|
1869
|
-
|
|
1946
|
+
React8.useEffect(() => {
|
|
1870
1947
|
if (isOpen && externalId) {
|
|
1871
1948
|
fetchTransactions();
|
|
1872
1949
|
}
|
|
@@ -2005,7 +2082,7 @@ var SubscriptionInfoGrid = ({
|
|
|
2005
2082
|
return "grid-cols-1 md:grid-cols-3";
|
|
2006
2083
|
}
|
|
2007
2084
|
};
|
|
2008
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `grid ${getGridClass()} gap-4 ${className}`, children: displayFields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: field.className
|
|
2085
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `grid ${getGridClass()} gap-4 ${className}`, children: displayFields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `p-4 border border-gray-200 rounded-lg bg-white ${field.className || ""}`, children: [
|
|
2009
2086
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500", children: field.label }),
|
|
2010
2087
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-medium", children: field.getValue(subscription) })
|
|
2011
2088
|
] }, field.key)) });
|
|
@@ -2055,7 +2132,7 @@ var SubscriptionUsageDisplay = ({
|
|
|
2055
2132
|
const displayValue = metric.formatValue ? metric.formatValue(used, total) : formatDefaultValue(used, total);
|
|
2056
2133
|
const percentage = getProgressPercentage(used, total);
|
|
2057
2134
|
const shouldShowProgress = showProgressBars || metric.showProgress;
|
|
2058
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
2135
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 border border-gray-200 rounded-lg bg-white space-y-1", children: [
|
|
2059
2136
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500", children: metric.label }),
|
|
2060
2137
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: displayValue }),
|
|
2061
2138
|
shouldShowProgress && total > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full bg-gray-200 rounded-full h-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2075,13 +2152,39 @@ var SubscriptionTransactionButton = ({
|
|
|
2075
2152
|
disabled = false,
|
|
2076
2153
|
variant = "text"
|
|
2077
2154
|
}) => {
|
|
2078
|
-
const baseClasses = variant === "text" ? "text-sm
|
|
2155
|
+
const baseClasses = variant === "text" ? "text-sm font-medium transition-colors duration-200 disabled:cursor-not-allowed" : "px-4 py-2 text-white rounded-md text-sm font-medium transition-colors duration-200 disabled:cursor-not-allowed";
|
|
2156
|
+
const getStyles = () => {
|
|
2157
|
+
if (variant === "text") {
|
|
2158
|
+
return {
|
|
2159
|
+
color: disabled ? "var(--subos-muted-foreground, #64748b)" : "var(--subos-primary-600, #2563eb)",
|
|
2160
|
+
textDecoration: "none"
|
|
2161
|
+
};
|
|
2162
|
+
} else {
|
|
2163
|
+
return {
|
|
2164
|
+
backgroundColor: disabled ? "var(--subos-muted, #f1f5f9)" : "var(--subos-primary-500, #3f51b5)",
|
|
2165
|
+
color: disabled ? "var(--subos-muted-foreground, #64748b)" : "white"
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
};
|
|
2079
2169
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2080
2170
|
"button",
|
|
2081
2171
|
{
|
|
2082
2172
|
onClick,
|
|
2083
2173
|
disabled,
|
|
2084
2174
|
className: `${baseClasses} ${className}`,
|
|
2175
|
+
style: getStyles(),
|
|
2176
|
+
onMouseEnter: !disabled && variant === "text" ? (e) => {
|
|
2177
|
+
e.currentTarget.style.color = "var(--subos-primary-700, #1d4ed8)";
|
|
2178
|
+
e.currentTarget.style.textDecoration = "underline";
|
|
2179
|
+
} : !disabled && variant === "button" ? (e) => {
|
|
2180
|
+
e.currentTarget.style.backgroundColor = "var(--subos-primary-600, #2563eb)";
|
|
2181
|
+
} : void 0,
|
|
2182
|
+
onMouseLeave: !disabled && variant === "text" ? (e) => {
|
|
2183
|
+
e.currentTarget.style.color = "var(--subos-primary-600, #2563eb)";
|
|
2184
|
+
e.currentTarget.style.textDecoration = "none";
|
|
2185
|
+
} : !disabled && variant === "button" ? (e) => {
|
|
2186
|
+
e.currentTarget.style.backgroundColor = "var(--subos-primary-500, #3f51b5)";
|
|
2187
|
+
} : void 0,
|
|
2085
2188
|
children
|
|
2086
2189
|
}
|
|
2087
2190
|
);
|
|
@@ -2093,13 +2196,41 @@ var SubscriptionCancelButton = ({
|
|
|
2093
2196
|
disabled = false,
|
|
2094
2197
|
variant = "text"
|
|
2095
2198
|
}) => {
|
|
2096
|
-
const baseClasses = variant === "text" ? "text-sm
|
|
2199
|
+
const baseClasses = variant === "text" ? "text-sm font-medium transition-colors duration-200 disabled:cursor-not-allowed" : "px-4 py-2 text-white rounded-md text-sm font-medium transition-colors duration-200 disabled:cursor-not-allowed";
|
|
2200
|
+
const getStyles = () => {
|
|
2201
|
+
if (variant === "text") {
|
|
2202
|
+
return {
|
|
2203
|
+
color: disabled ? "var(--subos-muted-foreground, #64748b)" : "#dc2626",
|
|
2204
|
+
// Keep red for cancel action
|
|
2205
|
+
textDecoration: "none"
|
|
2206
|
+
};
|
|
2207
|
+
} else {
|
|
2208
|
+
return {
|
|
2209
|
+
backgroundColor: disabled ? "var(--subos-muted, #f1f5f9)" : "#dc2626",
|
|
2210
|
+
// Keep red for cancel action
|
|
2211
|
+
color: disabled ? "var(--subos-muted-foreground, #64748b)" : "white"
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2214
|
+
};
|
|
2097
2215
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2098
2216
|
"button",
|
|
2099
2217
|
{
|
|
2100
2218
|
onClick,
|
|
2101
2219
|
disabled,
|
|
2102
2220
|
className: `${baseClasses} ${className}`,
|
|
2221
|
+
style: getStyles(),
|
|
2222
|
+
onMouseEnter: !disabled && variant === "text" ? (e) => {
|
|
2223
|
+
e.currentTarget.style.color = "#b91c1c";
|
|
2224
|
+
e.currentTarget.style.textDecoration = "underline";
|
|
2225
|
+
} : !disabled && variant === "button" ? (e) => {
|
|
2226
|
+
e.currentTarget.style.backgroundColor = "#b91c1c";
|
|
2227
|
+
} : void 0,
|
|
2228
|
+
onMouseLeave: !disabled && variant === "text" ? (e) => {
|
|
2229
|
+
e.currentTarget.style.color = "#dc2626";
|
|
2230
|
+
e.currentTarget.style.textDecoration = "none";
|
|
2231
|
+
} : !disabled && variant === "button" ? (e) => {
|
|
2232
|
+
e.currentTarget.style.backgroundColor = "#dc2626";
|
|
2233
|
+
} : void 0,
|
|
2103
2234
|
children
|
|
2104
2235
|
}
|
|
2105
2236
|
);
|
|
@@ -2120,14 +2251,15 @@ var SubscriptionActionButtons = ({
|
|
|
2120
2251
|
case "tight":
|
|
2121
2252
|
return isVertical ? "space-y-1" : "space-x-2";
|
|
2122
2253
|
case "normal":
|
|
2123
|
-
return isVertical ? "space-y-
|
|
2254
|
+
return isVertical ? "space-y-3" : "space-x-6";
|
|
2255
|
+
// Increased spacing
|
|
2124
2256
|
case "loose":
|
|
2125
|
-
return isVertical ? "space-y-4" : "space-x-
|
|
2257
|
+
return isVertical ? "space-y-4" : "space-x-8";
|
|
2126
2258
|
default:
|
|
2127
|
-
return isVertical ? "space-y-
|
|
2259
|
+
return isVertical ? "space-y-3" : "space-x-6";
|
|
2128
2260
|
}
|
|
2129
2261
|
};
|
|
2130
|
-
const containerClass = layout === "vertical" ? `flex flex-col ${getSpacingClass()}` : `flex ${getSpacingClass()}`;
|
|
2262
|
+
const containerClass = layout === "vertical" ? `flex flex-col ${getSpacingClass()}` : `flex items-center ${getSpacingClass()}`;
|
|
2131
2263
|
const defaultActions = [
|
|
2132
2264
|
{
|
|
2133
2265
|
key: "transaction",
|
|
@@ -2145,7 +2277,17 @@ var SubscriptionActionButtons = ({
|
|
|
2145
2277
|
if (visibleActions.length === 0) {
|
|
2146
2278
|
return null;
|
|
2147
2279
|
}
|
|
2148
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${containerClass} ${className}`, children: visibleActions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2280
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${containerClass} ${className}`, children: visibleActions.map((action, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2281
|
+
"div",
|
|
2282
|
+
{
|
|
2283
|
+
style: {
|
|
2284
|
+
marginLeft: index > 0 && layout === "horizontal" ? "24px" : "0",
|
|
2285
|
+
marginTop: index > 0 && layout === "vertical" ? "12px" : "0"
|
|
2286
|
+
},
|
|
2287
|
+
children: action.component
|
|
2288
|
+
},
|
|
2289
|
+
action.key
|
|
2290
|
+
)) });
|
|
2149
2291
|
};
|
|
2150
2292
|
var SubscriptionCancelModal = ({
|
|
2151
2293
|
isOpen,
|
|
@@ -2227,8 +2369,8 @@ var SubscriptionDetails = ({
|
|
|
2227
2369
|
customActions = [],
|
|
2228
2370
|
className = ""
|
|
2229
2371
|
}) => {
|
|
2230
|
-
const [isTransactionModalOpen, setIsTransactionModalOpen] =
|
|
2231
|
-
const [showCancelConfirmation, setShowCancelConfirmation] =
|
|
2372
|
+
const [isTransactionModalOpen, setIsTransactionModalOpen] = React8.useState(false);
|
|
2373
|
+
const [showCancelConfirmation, setShowCancelConfirmation] = React8.useState(false);
|
|
2232
2374
|
const { cancelSubscription, loading: cancelLoading } = useCancelSubscription({
|
|
2233
2375
|
onSuccess: () => {
|
|
2234
2376
|
setShowCancelConfirmation(false);
|
|
@@ -2257,7 +2399,7 @@ var SubscriptionDetails = ({
|
|
|
2257
2399
|
setShowCancelConfirmation(false);
|
|
2258
2400
|
};
|
|
2259
2401
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2260
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `mb-6
|
|
2402
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `mb-6 ${className}`, children: [
|
|
2261
2403
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-4", children: [
|
|
2262
2404
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold", children: "Subscription Details" }),
|
|
2263
2405
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2274,7 +2416,6 @@ var SubscriptionDetails = ({
|
|
|
2274
2416
|
ChangeCardButton,
|
|
2275
2417
|
{
|
|
2276
2418
|
externalId,
|
|
2277
|
-
className: "text-sm text-blue-600 font-medium hover:text-blue-700 hover:underline",
|
|
2278
2419
|
onSuccess: () => {
|
|
2279
2420
|
},
|
|
2280
2421
|
onError: (error) => {
|
|
@@ -2339,9 +2480,9 @@ var UpgradeSummary = ({
|
|
|
2339
2480
|
onUpgrade,
|
|
2340
2481
|
isVisible = true
|
|
2341
2482
|
}) => {
|
|
2342
|
-
const [checkoutInfo, setCheckoutInfo] =
|
|
2343
|
-
const [loading, setLoading] =
|
|
2344
|
-
|
|
2483
|
+
const [checkoutInfo, setCheckoutInfo] = React8.useState(null);
|
|
2484
|
+
const [loading, setLoading] = React8.useState(false);
|
|
2485
|
+
React8.useEffect(() => {
|
|
2345
2486
|
if (!selectedPlan || !isVisible || Number(selectedPlan.fixedCost) === 0) {
|
|
2346
2487
|
setCheckoutInfo(null);
|
|
2347
2488
|
return;
|
|
@@ -2368,39 +2509,108 @@ var UpgradeSummary = ({
|
|
|
2368
2509
|
const displayInfo = checkoutInfo;
|
|
2369
2510
|
const intervalDisplay = displayInfo.planInterval === "MONTHLY" ? "Mo" : "Yr";
|
|
2370
2511
|
const dueToday = displayInfo.proration > 0 ? displayInfo.proration : displayInfo.planPrice;
|
|
2371
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
"
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2512
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2513
|
+
"div",
|
|
2514
|
+
{
|
|
2515
|
+
className: "shadow-xl rounded-md border px-4 py-3",
|
|
2516
|
+
style: {
|
|
2517
|
+
backgroundColor: "var(--subos-background, #ffffff)",
|
|
2518
|
+
borderColor: "var(--subos-border, #e2e8f0)",
|
|
2519
|
+
boxShadow: "var(--subos-shadow-card-hover, 0 8px 24px rgba(0,0,0,0.15))"
|
|
2520
|
+
},
|
|
2521
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2522
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2523
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2524
|
+
"p",
|
|
2525
|
+
{
|
|
2526
|
+
className: "text-sm",
|
|
2527
|
+
style: { color: "var(--subos-muted-foreground, #64748b)" },
|
|
2528
|
+
children: "Summary"
|
|
2529
|
+
}
|
|
2530
|
+
),
|
|
2531
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2532
|
+
"h2",
|
|
2533
|
+
{
|
|
2534
|
+
className: "text-sm font-medium",
|
|
2535
|
+
style: { color: "var(--subos-foreground, #1e293b)" },
|
|
2536
|
+
children: displayInfo.planName
|
|
2537
|
+
}
|
|
2538
|
+
)
|
|
2391
2539
|
] }),
|
|
2392
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2393
|
-
"
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2540
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-6", children: [
|
|
2541
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2542
|
+
"h3",
|
|
2543
|
+
{
|
|
2544
|
+
className: "text-2xl font-semibold",
|
|
2545
|
+
style: { color: "var(--subos-foreground, #1e293b)" },
|
|
2546
|
+
children: [
|
|
2547
|
+
"$",
|
|
2548
|
+
displayInfo.planPrice,
|
|
2549
|
+
"/",
|
|
2550
|
+
intervalDisplay
|
|
2551
|
+
]
|
|
2552
|
+
}
|
|
2553
|
+
) }),
|
|
2554
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
2555
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
|
|
2556
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2557
|
+
"p",
|
|
2558
|
+
{
|
|
2559
|
+
className: "text-sm",
|
|
2560
|
+
style: { color: "var(--subos-muted-foreground, #64748b)" },
|
|
2561
|
+
children: "Due Today"
|
|
2562
|
+
}
|
|
2563
|
+
),
|
|
2564
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2565
|
+
"p",
|
|
2566
|
+
{
|
|
2567
|
+
className: "text-xl font-semibold",
|
|
2568
|
+
style: { color: "var(--subos-foreground, #1e293b)" },
|
|
2569
|
+
children: [
|
|
2570
|
+
"$",
|
|
2571
|
+
dueToday
|
|
2572
|
+
]
|
|
2573
|
+
}
|
|
2574
|
+
),
|
|
2575
|
+
displayInfo.proration > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2576
|
+
"p",
|
|
2577
|
+
{
|
|
2578
|
+
className: "text-xs mt-1",
|
|
2579
|
+
style: { color: "var(--subos-muted-foreground, #64748b)" },
|
|
2580
|
+
children: "(Includes prorated discount for unused days of your current plan)"
|
|
2581
|
+
}
|
|
2582
|
+
)
|
|
2583
|
+
] }),
|
|
2584
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2585
|
+
"button",
|
|
2586
|
+
{
|
|
2587
|
+
onClick: onUpgrade,
|
|
2588
|
+
disabled: loading,
|
|
2589
|
+
className: "text-white px-8 py-3 rounded-lg font-semibold transition-all duration-200 text-sm disabled:opacity-50 shadow-md",
|
|
2590
|
+
style: {
|
|
2591
|
+
backgroundColor: loading ? "var(--subos-muted, #f1f5f9)" : "var(--subos-primary-500, #ef4444)",
|
|
2592
|
+
color: loading ? "var(--subos-muted-foreground, #64748b)" : "white",
|
|
2593
|
+
border: "none",
|
|
2594
|
+
boxShadow: loading ? "none" : "0 4px 12px rgba(239, 68, 68, 0.3)"
|
|
2595
|
+
},
|
|
2596
|
+
onMouseEnter: !loading ? (e) => {
|
|
2597
|
+
e.currentTarget.style.backgroundColor = "#dc2626";
|
|
2598
|
+
e.currentTarget.style.transform = "translateY(-1px)";
|
|
2599
|
+
e.currentTarget.style.boxShadow = "0 6px 16px rgba(239, 68, 68, 0.4)";
|
|
2600
|
+
} : void 0,
|
|
2601
|
+
onMouseLeave: !loading ? (e) => {
|
|
2602
|
+
e.currentTarget.style.backgroundColor = "var(--subos-primary-500, #ef4444)";
|
|
2603
|
+
e.currentTarget.style.transform = "translateY(0)";
|
|
2604
|
+
e.currentTarget.style.boxShadow = "0 4px 12px rgba(239, 68, 68, 0.3)";
|
|
2605
|
+
} : void 0,
|
|
2606
|
+
children: loading ? "Loading..." : "Upgrade Now"
|
|
2607
|
+
}
|
|
2608
|
+
)
|
|
2609
|
+
] })
|
|
2610
|
+
] })
|
|
2401
2611
|
] })
|
|
2402
|
-
|
|
2403
|
-
|
|
2612
|
+
}
|
|
2613
|
+
) }) });
|
|
2404
2614
|
};
|
|
2405
2615
|
var LogoInline = ({ src, alt = "Logo", viewBox = "0 0 1024 1024", ...props }) => {
|
|
2406
2616
|
const resolvedSrc = src ?? "https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg";
|
|
@@ -2428,9 +2638,9 @@ var Layout = ({ children }) => {
|
|
|
2428
2638
|
] }) }) })
|
|
2429
2639
|
] });
|
|
2430
2640
|
};
|
|
2431
|
-
var SubOSThemeContext =
|
|
2641
|
+
var SubOSThemeContext = React8.createContext(void 0);
|
|
2432
2642
|
var useSubOSTheme = () => {
|
|
2433
|
-
const context =
|
|
2643
|
+
const context = React8.useContext(SubOSThemeContext);
|
|
2434
2644
|
if (!context) {
|
|
2435
2645
|
throw new Error("useSubOSTheme must be used within a SubOSThemeProvider");
|
|
2436
2646
|
}
|
|
@@ -2441,8 +2651,8 @@ var SubOSThemeProvider = ({
|
|
|
2441
2651
|
theme = {},
|
|
2442
2652
|
className = ""
|
|
2443
2653
|
}) => {
|
|
2444
|
-
const [currentTheme, setCurrentTheme] =
|
|
2445
|
-
const cssVariables =
|
|
2654
|
+
const [currentTheme, setCurrentTheme] = React8__default.default.useState(theme);
|
|
2655
|
+
const cssVariables = React8__default.default.useMemo(() => {
|
|
2446
2656
|
const vars = {};
|
|
2447
2657
|
if (currentTheme.primaryColors) {
|
|
2448
2658
|
Object.entries(currentTheme.primaryColors).forEach(([key, value]) => {
|
|
@@ -2467,7 +2677,7 @@ var SubOSThemeProvider = ({
|
|
|
2467
2677
|
if (currentTheme.shadowCardHover) vars["--subos-shadow-card-hover"] = currentTheme.shadowCardHover;
|
|
2468
2678
|
return vars;
|
|
2469
2679
|
}, [currentTheme]);
|
|
2470
|
-
const contextValue =
|
|
2680
|
+
const contextValue = React8__default.default.useMemo(() => ({
|
|
2471
2681
|
theme: currentTheme,
|
|
2472
2682
|
setTheme: setCurrentTheme
|
|
2473
2683
|
}), [currentTheme]);
|
|
@@ -2482,7 +2692,7 @@ var SubOSThemeProvider = ({
|
|
|
2482
2692
|
};
|
|
2483
2693
|
var useApplyHostTheme = (hostTheme) => {
|
|
2484
2694
|
const { setTheme } = useSubOSTheme();
|
|
2485
|
-
|
|
2695
|
+
React8__default.default.useEffect(() => {
|
|
2486
2696
|
if (hostTheme) {
|
|
2487
2697
|
setTheme(hostTheme);
|
|
2488
2698
|
}
|
|
@@ -2562,7 +2772,7 @@ var Pagination = ({
|
|
|
2562
2772
|
children: "Previous"
|
|
2563
2773
|
}
|
|
2564
2774
|
),
|
|
2565
|
-
pageNumbers.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2775
|
+
pageNumbers.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React8__default.default.Fragment, { children: page === "..." ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300", children: "..." }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2566
2776
|
"button",
|
|
2567
2777
|
{
|
|
2568
2778
|
onClick: () => onPageChange(page),
|
|
@@ -2589,15 +2799,15 @@ var DashboardPage = ({
|
|
|
2589
2799
|
var _a;
|
|
2590
2800
|
const subscription = useSubscription();
|
|
2591
2801
|
const plans = usePlans();
|
|
2592
|
-
const lastLoadedIdRef =
|
|
2593
|
-
|
|
2802
|
+
const lastLoadedIdRef = React8.useRef(null);
|
|
2803
|
+
React8.useEffect(() => {
|
|
2594
2804
|
if (lastLoadedIdRef.current !== externalId) {
|
|
2595
2805
|
subscription.fetchSubscription(externalId);
|
|
2596
2806
|
plans.fetchPlans();
|
|
2597
2807
|
lastLoadedIdRef.current = externalId;
|
|
2598
2808
|
}
|
|
2599
2809
|
}, [externalId]);
|
|
2600
|
-
|
|
2810
|
+
React8.useEffect(() => {
|
|
2601
2811
|
registerClearSelectedPlan(plans.clearSelectedPlan);
|
|
2602
2812
|
return () => {
|
|
2603
2813
|
unregisterClearSelectedPlan();
|
|
@@ -2647,7 +2857,7 @@ var DashboardPage = ({
|
|
|
2647
2857
|
] }) }) });
|
|
2648
2858
|
};
|
|
2649
2859
|
var usePaymentParams = () => {
|
|
2650
|
-
return
|
|
2860
|
+
return React8.useMemo(() => {
|
|
2651
2861
|
const params = new URLSearchParams(window.location.search);
|
|
2652
2862
|
return {
|
|
2653
2863
|
gateway: params.get("gateway") || void 0,
|
|
@@ -2658,9 +2868,9 @@ var usePaymentParams = () => {
|
|
|
2658
2868
|
}, []);
|
|
2659
2869
|
};
|
|
2660
2870
|
var useProcessPaymentSuccess = (params) => {
|
|
2661
|
-
const [loading, setLoading] =
|
|
2662
|
-
const [error, setError] =
|
|
2663
|
-
|
|
2871
|
+
const [loading, setLoading] = React8.useState(true);
|
|
2872
|
+
const [error, setError] = React8.useState(null);
|
|
2873
|
+
React8.useEffect(() => {
|
|
2664
2874
|
const run = async () => {
|
|
2665
2875
|
try {
|
|
2666
2876
|
const qs = new URLSearchParams({
|
|
@@ -2730,9 +2940,9 @@ var PaymentSuccessPage = () => {
|
|
|
2730
2940
|
};
|
|
2731
2941
|
var PaymentSuccessPage_default = PaymentSuccessPage;
|
|
2732
2942
|
var useProcessPaymentCancel = (params) => {
|
|
2733
|
-
const [loading, setLoading] =
|
|
2734
|
-
const [error, setError] =
|
|
2735
|
-
|
|
2943
|
+
const [loading, setLoading] = React8.useState(true);
|
|
2944
|
+
const [error, setError] = React8.useState(null);
|
|
2945
|
+
React8.useEffect(() => {
|
|
2736
2946
|
const run = async () => {
|
|
2737
2947
|
try {
|
|
2738
2948
|
const qs = new URLSearchParams({
|