subos-frontend 1.0.14 → 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 +120 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -25
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +3 -0
- package/dist/types/components/plans/BillingCycleToggle.d.ts.map +1 -1
- package/dist/types/components/subscription/SubscriptionActionButtons.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,29 +860,30 @@ var BillingCycleToggle = ({
|
|
|
860
860
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
861
861
|
"div",
|
|
862
862
|
{
|
|
863
|
-
className: "inline-flex rounded-lg p-1
|
|
863
|
+
className: "inline-flex rounded-lg p-1",
|
|
864
864
|
style: {
|
|
865
865
|
backgroundColor: "var(--subos-muted, #f1f5f9)",
|
|
866
|
-
|
|
866
|
+
border: "1px solid var(--subos-border, #e2e8f0)"
|
|
867
867
|
},
|
|
868
868
|
children: [
|
|
869
869
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
870
870
|
"button",
|
|
871
871
|
{
|
|
872
872
|
onClick: () => onBillingCycleChange("monthly"),
|
|
873
|
-
className: `px-
|
|
873
|
+
className: `px-6 py-2 rounded-md text-sm font-medium transition-all duration-200 ${className || ""}`,
|
|
874
874
|
style: billingCycle === "monthly" ? {
|
|
875
|
-
backgroundColor: "var(--subos-primary-500, #
|
|
875
|
+
backgroundColor: "var(--subos-primary-500, #ef4444)",
|
|
876
876
|
color: "white",
|
|
877
|
-
boxShadow: "0
|
|
877
|
+
boxShadow: "0 2px 4px 0 rgba(0, 0, 0, 0.1)",
|
|
878
|
+
fontWeight: "600"
|
|
878
879
|
} : {
|
|
879
880
|
backgroundColor: "transparent",
|
|
880
881
|
color: "var(--subos-muted-foreground, #64748b)",
|
|
881
|
-
|
|
882
|
+
fontWeight: "500"
|
|
882
883
|
},
|
|
883
884
|
onMouseEnter: billingCycle !== "monthly" ? (e) => {
|
|
884
885
|
e.currentTarget.style.color = "var(--subos-foreground, #1e293b)";
|
|
885
|
-
e.currentTarget.style.backgroundColor = "
|
|
886
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
886
887
|
} : void 0,
|
|
887
888
|
onMouseLeave: billingCycle !== "monthly" ? (e) => {
|
|
888
889
|
e.currentTarget.style.color = "var(--subos-muted-foreground, #64748b)";
|
|
@@ -895,19 +896,20 @@ var BillingCycleToggle = ({
|
|
|
895
896
|
"button",
|
|
896
897
|
{
|
|
897
898
|
onClick: () => onBillingCycleChange("yearly"),
|
|
898
|
-
className: `px-
|
|
899
|
+
className: `px-6 py-2 rounded-md text-sm font-medium transition-all duration-200 ${className || ""}`,
|
|
899
900
|
style: billingCycle === "yearly" ? {
|
|
900
|
-
backgroundColor: "var(--subos-primary-500, #
|
|
901
|
+
backgroundColor: "var(--subos-primary-500, #ef4444)",
|
|
901
902
|
color: "white",
|
|
902
|
-
boxShadow: "0
|
|
903
|
+
boxShadow: "0 2px 4px 0 rgba(0, 0, 0, 0.1)",
|
|
904
|
+
fontWeight: "600"
|
|
903
905
|
} : {
|
|
904
906
|
backgroundColor: "transparent",
|
|
905
907
|
color: "var(--subos-muted-foreground, #64748b)",
|
|
906
|
-
|
|
908
|
+
fontWeight: "500"
|
|
907
909
|
},
|
|
908
910
|
onMouseEnter: billingCycle !== "yearly" ? (e) => {
|
|
909
911
|
e.currentTarget.style.color = "var(--subos-foreground, #1e293b)";
|
|
910
|
-
e.currentTarget.style.backgroundColor = "
|
|
912
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
911
913
|
} : void 0,
|
|
912
914
|
onMouseLeave: billingCycle !== "yearly" ? (e) => {
|
|
913
915
|
e.currentTarget.style.color = "var(--subos-muted-foreground, #64748b)";
|
|
@@ -928,8 +930,8 @@ var TierFilterDropdown = ({
|
|
|
928
930
|
selectedValue,
|
|
929
931
|
onSelect
|
|
930
932
|
}) => {
|
|
931
|
-
const dropdownRef =
|
|
932
|
-
|
|
933
|
+
const dropdownRef = React8.useRef(null);
|
|
934
|
+
React8.useEffect(() => {
|
|
933
935
|
const handleClickOutside = (event) => {
|
|
934
936
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
935
937
|
if (isOpen) {
|
|
@@ -1203,7 +1205,7 @@ var PlanSelector = ({
|
|
|
1203
1205
|
onBillingCycleChange,
|
|
1204
1206
|
activePlanCode
|
|
1205
1207
|
}) => {
|
|
1206
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
1208
|
+
const [isDropdownOpen, setIsDropdownOpen] = React8.useState(false);
|
|
1207
1209
|
const handleDropdownToggle = () => {
|
|
1208
1210
|
setIsDropdownOpen(!isDropdownOpen);
|
|
1209
1211
|
};
|
|
@@ -1895,7 +1897,7 @@ var TransactionPagination = ({
|
|
|
1895
1897
|
children: "Previous"
|
|
1896
1898
|
}
|
|
1897
1899
|
),
|
|
1898
|
-
/* @__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(
|
|
1899
1901
|
"button",
|
|
1900
1902
|
{
|
|
1901
1903
|
onClick: () => onPageChange(page),
|
|
@@ -1941,7 +1943,7 @@ var TransactionModal = ({
|
|
|
1941
1943
|
autoFetch: true
|
|
1942
1944
|
// Enable auto-fetch so it works when modal opens
|
|
1943
1945
|
});
|
|
1944
|
-
|
|
1946
|
+
React8.useEffect(() => {
|
|
1945
1947
|
if (isOpen && externalId) {
|
|
1946
1948
|
fetchTransactions();
|
|
1947
1949
|
}
|
|
@@ -2275,7 +2277,17 @@ var SubscriptionActionButtons = ({
|
|
|
2275
2277
|
if (visibleActions.length === 0) {
|
|
2276
2278
|
return null;
|
|
2277
2279
|
}
|
|
2278
|
-
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
|
+
)) });
|
|
2279
2291
|
};
|
|
2280
2292
|
var SubscriptionCancelModal = ({
|
|
2281
2293
|
isOpen,
|
|
@@ -2357,8 +2369,8 @@ var SubscriptionDetails = ({
|
|
|
2357
2369
|
customActions = [],
|
|
2358
2370
|
className = ""
|
|
2359
2371
|
}) => {
|
|
2360
|
-
const [isTransactionModalOpen, setIsTransactionModalOpen] =
|
|
2361
|
-
const [showCancelConfirmation, setShowCancelConfirmation] =
|
|
2372
|
+
const [isTransactionModalOpen, setIsTransactionModalOpen] = React8.useState(false);
|
|
2373
|
+
const [showCancelConfirmation, setShowCancelConfirmation] = React8.useState(false);
|
|
2362
2374
|
const { cancelSubscription, loading: cancelLoading } = useCancelSubscription({
|
|
2363
2375
|
onSuccess: () => {
|
|
2364
2376
|
setShowCancelConfirmation(false);
|
|
@@ -2468,9 +2480,9 @@ var UpgradeSummary = ({
|
|
|
2468
2480
|
onUpgrade,
|
|
2469
2481
|
isVisible = true
|
|
2470
2482
|
}) => {
|
|
2471
|
-
const [checkoutInfo, setCheckoutInfo] =
|
|
2472
|
-
const [loading, setLoading] =
|
|
2473
|
-
|
|
2483
|
+
const [checkoutInfo, setCheckoutInfo] = React8.useState(null);
|
|
2484
|
+
const [loading, setLoading] = React8.useState(false);
|
|
2485
|
+
React8.useEffect(() => {
|
|
2474
2486
|
if (!selectedPlan || !isVisible || Number(selectedPlan.fixedCost) === 0) {
|
|
2475
2487
|
setCheckoutInfo(null);
|
|
2476
2488
|
return;
|
|
@@ -2574,16 +2586,22 @@ var UpgradeSummary = ({
|
|
|
2574
2586
|
{
|
|
2575
2587
|
onClick: onUpgrade,
|
|
2576
2588
|
disabled: loading,
|
|
2577
|
-
className: "text-white px-
|
|
2589
|
+
className: "text-white px-8 py-3 rounded-lg font-semibold transition-all duration-200 text-sm disabled:opacity-50 shadow-md",
|
|
2578
2590
|
style: {
|
|
2579
|
-
backgroundColor: loading ? "var(--subos-muted, #f1f5f9)" : "var(--subos-primary-500, #
|
|
2580
|
-
color: loading ? "var(--subos-muted-foreground, #64748b)" : "white"
|
|
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)"
|
|
2581
2595
|
},
|
|
2582
2596
|
onMouseEnter: !loading ? (e) => {
|
|
2583
|
-
e.currentTarget.style.backgroundColor = "
|
|
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)";
|
|
2584
2600
|
} : void 0,
|
|
2585
2601
|
onMouseLeave: !loading ? (e) => {
|
|
2586
|
-
e.currentTarget.style.backgroundColor = "var(--subos-primary-500, #
|
|
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)";
|
|
2587
2605
|
} : void 0,
|
|
2588
2606
|
children: loading ? "Loading..." : "Upgrade Now"
|
|
2589
2607
|
}
|
|
@@ -2620,9 +2638,9 @@ var Layout = ({ children }) => {
|
|
|
2620
2638
|
] }) }) })
|
|
2621
2639
|
] });
|
|
2622
2640
|
};
|
|
2623
|
-
var SubOSThemeContext =
|
|
2641
|
+
var SubOSThemeContext = React8.createContext(void 0);
|
|
2624
2642
|
var useSubOSTheme = () => {
|
|
2625
|
-
const context =
|
|
2643
|
+
const context = React8.useContext(SubOSThemeContext);
|
|
2626
2644
|
if (!context) {
|
|
2627
2645
|
throw new Error("useSubOSTheme must be used within a SubOSThemeProvider");
|
|
2628
2646
|
}
|
|
@@ -2633,8 +2651,8 @@ var SubOSThemeProvider = ({
|
|
|
2633
2651
|
theme = {},
|
|
2634
2652
|
className = ""
|
|
2635
2653
|
}) => {
|
|
2636
|
-
const [currentTheme, setCurrentTheme] =
|
|
2637
|
-
const cssVariables =
|
|
2654
|
+
const [currentTheme, setCurrentTheme] = React8__default.default.useState(theme);
|
|
2655
|
+
const cssVariables = React8__default.default.useMemo(() => {
|
|
2638
2656
|
const vars = {};
|
|
2639
2657
|
if (currentTheme.primaryColors) {
|
|
2640
2658
|
Object.entries(currentTheme.primaryColors).forEach(([key, value]) => {
|
|
@@ -2659,7 +2677,7 @@ var SubOSThemeProvider = ({
|
|
|
2659
2677
|
if (currentTheme.shadowCardHover) vars["--subos-shadow-card-hover"] = currentTheme.shadowCardHover;
|
|
2660
2678
|
return vars;
|
|
2661
2679
|
}, [currentTheme]);
|
|
2662
|
-
const contextValue =
|
|
2680
|
+
const contextValue = React8__default.default.useMemo(() => ({
|
|
2663
2681
|
theme: currentTheme,
|
|
2664
2682
|
setTheme: setCurrentTheme
|
|
2665
2683
|
}), [currentTheme]);
|
|
@@ -2674,7 +2692,7 @@ var SubOSThemeProvider = ({
|
|
|
2674
2692
|
};
|
|
2675
2693
|
var useApplyHostTheme = (hostTheme) => {
|
|
2676
2694
|
const { setTheme } = useSubOSTheme();
|
|
2677
|
-
|
|
2695
|
+
React8__default.default.useEffect(() => {
|
|
2678
2696
|
if (hostTheme) {
|
|
2679
2697
|
setTheme(hostTheme);
|
|
2680
2698
|
}
|
|
@@ -2754,7 +2772,7 @@ var Pagination = ({
|
|
|
2754
2772
|
children: "Previous"
|
|
2755
2773
|
}
|
|
2756
2774
|
),
|
|
2757
|
-
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(
|
|
2758
2776
|
"button",
|
|
2759
2777
|
{
|
|
2760
2778
|
onClick: () => onPageChange(page),
|
|
@@ -2781,15 +2799,15 @@ var DashboardPage = ({
|
|
|
2781
2799
|
var _a;
|
|
2782
2800
|
const subscription = useSubscription();
|
|
2783
2801
|
const plans = usePlans();
|
|
2784
|
-
const lastLoadedIdRef =
|
|
2785
|
-
|
|
2802
|
+
const lastLoadedIdRef = React8.useRef(null);
|
|
2803
|
+
React8.useEffect(() => {
|
|
2786
2804
|
if (lastLoadedIdRef.current !== externalId) {
|
|
2787
2805
|
subscription.fetchSubscription(externalId);
|
|
2788
2806
|
plans.fetchPlans();
|
|
2789
2807
|
lastLoadedIdRef.current = externalId;
|
|
2790
2808
|
}
|
|
2791
2809
|
}, [externalId]);
|
|
2792
|
-
|
|
2810
|
+
React8.useEffect(() => {
|
|
2793
2811
|
registerClearSelectedPlan(plans.clearSelectedPlan);
|
|
2794
2812
|
return () => {
|
|
2795
2813
|
unregisterClearSelectedPlan();
|
|
@@ -2839,7 +2857,7 @@ var DashboardPage = ({
|
|
|
2839
2857
|
] }) }) });
|
|
2840
2858
|
};
|
|
2841
2859
|
var usePaymentParams = () => {
|
|
2842
|
-
return
|
|
2860
|
+
return React8.useMemo(() => {
|
|
2843
2861
|
const params = new URLSearchParams(window.location.search);
|
|
2844
2862
|
return {
|
|
2845
2863
|
gateway: params.get("gateway") || void 0,
|
|
@@ -2850,9 +2868,9 @@ var usePaymentParams = () => {
|
|
|
2850
2868
|
}, []);
|
|
2851
2869
|
};
|
|
2852
2870
|
var useProcessPaymentSuccess = (params) => {
|
|
2853
|
-
const [loading, setLoading] =
|
|
2854
|
-
const [error, setError] =
|
|
2855
|
-
|
|
2871
|
+
const [loading, setLoading] = React8.useState(true);
|
|
2872
|
+
const [error, setError] = React8.useState(null);
|
|
2873
|
+
React8.useEffect(() => {
|
|
2856
2874
|
const run = async () => {
|
|
2857
2875
|
try {
|
|
2858
2876
|
const qs = new URLSearchParams({
|
|
@@ -2922,9 +2940,9 @@ var PaymentSuccessPage = () => {
|
|
|
2922
2940
|
};
|
|
2923
2941
|
var PaymentSuccessPage_default = PaymentSuccessPage;
|
|
2924
2942
|
var useProcessPaymentCancel = (params) => {
|
|
2925
|
-
const [loading, setLoading] =
|
|
2926
|
-
const [error, setError] =
|
|
2927
|
-
|
|
2943
|
+
const [loading, setLoading] = React8.useState(true);
|
|
2944
|
+
const [error, setError] = React8.useState(null);
|
|
2945
|
+
React8.useEffect(() => {
|
|
2928
2946
|
const run = async () => {
|
|
2929
2947
|
try {
|
|
2930
2948
|
const qs = new URLSearchParams({
|