subos-frontend 1.0.104 → 1.0.108

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 CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var React10 = require('react');
3
+ var React11 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
 
6
6
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
- var React10__default = /*#__PURE__*/_interopDefault(React10);
9
+ var React11__default = /*#__PURE__*/_interopDefault(React11);
10
10
 
11
11
  // src/config/envConfig.ts
12
12
  function getEnvVar(key, fallback) {
@@ -237,35 +237,7 @@ var transactionApi = {
237
237
  },
238
238
  getInvoice: (transactionId) => apiRequest(`${ENDPOINTS.TRANSACTIONS}/${transactionId}/invoice`)
239
239
  };
240
- var UpgradeContext = React10.createContext(void 0);
241
- var UpgradeProvider = ({ children }) => {
242
- const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] = React10.useState(false);
243
- const setUpgradeSummaryVisible = (visible) => {
244
- setIsUpgradeSummaryVisible(visible);
245
- };
246
- const clearUpgradeSelection = () => {
247
- setIsUpgradeSummaryVisible(false);
248
- };
249
- return /* @__PURE__ */ jsxRuntime.jsx(
250
- UpgradeContext.Provider,
251
- {
252
- value: {
253
- isUpgradeSummaryVisible,
254
- setUpgradeSummaryVisible,
255
- clearUpgradeSelection
256
- },
257
- children
258
- }
259
- );
260
- };
261
- var useUpgrade = () => {
262
- const context = React10.useContext(UpgradeContext);
263
- if (context === void 0) {
264
- throw new Error("useUpgrade must be used within an UpgradeProvider");
265
- }
266
- return context;
267
- };
268
- var CurrencyContext = React10.createContext(void 0);
240
+ var CurrencyContext = React11.createContext(void 0);
269
241
 
270
242
  // src/utils/currency.ts
271
243
  var CURRENCY_SYMBOLS = {
@@ -372,11 +344,11 @@ var useCountryAndCurrency = ({
372
344
  defaultCurrency = "usd",
373
345
  skipAutoDetect = false
374
346
  } = {}) => {
375
- const [country, setCountry] = React10.useState(null);
376
- const [currency, setCurrencyState] = React10.useState(defaultCurrency);
377
- const [isLoading, setIsLoading] = React10.useState(!skipAutoDetect);
378
- const [error, setError] = React10.useState(null);
379
- React10.useEffect(() => {
347
+ const [country, setCountry] = React11.useState(null);
348
+ const [currency, setCurrencyState] = React11.useState(defaultCurrency);
349
+ const [isLoading, setIsLoading] = React11.useState(!skipAutoDetect);
350
+ const [error, setError] = React11.useState(null);
351
+ React11.useEffect(() => {
380
352
  if (skipAutoDetect) {
381
353
  setIsLoading(false);
382
354
  return;
@@ -417,7 +389,7 @@ var useCountryAndCurrency = ({
417
389
  };
418
390
  };
419
391
  var useCurrency = () => {
420
- const context = React10.useContext(CurrencyContext);
392
+ const context = React11.useContext(CurrencyContext);
421
393
  if (context === void 0) {
422
394
  throw new Error("useCurrency must be used within a CurrencyProvider");
423
395
  }
@@ -436,20 +408,20 @@ var CurrencyProvider = ({
436
408
  });
437
409
  return /* @__PURE__ */ jsxRuntime.jsx(CurrencyContext.Provider, { value: { country, currency, isLoading, error, setCurrency }, children });
438
410
  };
439
-
440
- // src/hooks/useSubscription.ts
441
- var useSubscription = () => {
411
+ var SubscriptionContext = React11.createContext(void 0);
412
+ var SubscriptionProvider = ({ children }) => {
442
413
  const { currency } = useCurrency();
443
- const [subscription, setSubscription] = React10.useState(null);
444
- const [loading, setLoading] = React10.useState(false);
445
- const [error, setError] = React10.useState(null);
446
- const fetchSubscription = React10.useCallback(async (externalId) => {
414
+ const [subscription, setSubscription] = React11.useState(null);
415
+ const [loading, setLoading] = React11.useState(false);
416
+ const [error, setError] = React11.useState(null);
417
+ const loadingRef = React11.useRef(false);
418
+ const fetchSubscription = React11.useCallback(async (externalId) => {
447
419
  if (!externalId || externalId === "undefined" || externalId.trim() === "") {
448
420
  setError("Invalid user ID. Please ensure you are properly authenticated.");
449
- setLoading(false);
450
421
  return;
451
422
  }
452
- if (loading) return;
423
+ if (loadingRef.current) return;
424
+ loadingRef.current = true;
453
425
  setLoading(true);
454
426
  setError(null);
455
427
  try {
@@ -465,20 +437,27 @@ var useSubscription = () => {
465
437
  setError("Failed to load subscription information. Please try again later.");
466
438
  }
467
439
  } finally {
440
+ loadingRef.current = false;
468
441
  setLoading(false);
469
442
  }
470
- }, [loading, currency]);
471
- const clearSubscription = React10.useCallback(() => {
443
+ }, [currency]);
444
+ const clearSubscription = React11.useCallback(() => {
472
445
  setSubscription(null);
473
446
  setError(null);
474
447
  }, []);
475
- return {
476
- subscription,
477
- loading,
478
- error,
479
- fetchSubscription,
480
- clearSubscription
481
- };
448
+ return /* @__PURE__ */ jsxRuntime.jsx(SubscriptionContext.Provider, { value: { subscription, loading, error, fetchSubscription, clearSubscription }, children });
449
+ };
450
+ var useSubscriptionContext = () => {
451
+ const context = React11.useContext(SubscriptionContext);
452
+ if (context === void 0) {
453
+ throw new Error("useSubscriptionContext must be used within a SubscriptionProvider");
454
+ }
455
+ return context;
456
+ };
457
+
458
+ // src/hooks/useSubscription.ts
459
+ var useSubscription = () => {
460
+ return useSubscriptionContext();
482
461
  };
483
462
 
484
463
  // src/utils/planUtils.ts
@@ -638,18 +617,46 @@ var getGracePeriodInfo = (subscription) => {
638
617
  message: `Your 7-day grace period started on ${startDate ? formatDate(startDate) : "N/A"}. You have ${remainingDays} days remaining to update your payment method to continue your subscription without interruption.`
639
618
  };
640
619
  };
620
+ var UpgradeContext = React11.createContext(void 0);
621
+ var UpgradeProvider = ({ children }) => {
622
+ const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] = React11.useState(false);
623
+ const setUpgradeSummaryVisible = (visible) => {
624
+ setIsUpgradeSummaryVisible(visible);
625
+ };
626
+ const clearUpgradeSelection = () => {
627
+ setIsUpgradeSummaryVisible(false);
628
+ };
629
+ return /* @__PURE__ */ jsxRuntime.jsx(
630
+ UpgradeContext.Provider,
631
+ {
632
+ value: {
633
+ isUpgradeSummaryVisible,
634
+ setUpgradeSummaryVisible,
635
+ clearUpgradeSelection
636
+ },
637
+ children
638
+ }
639
+ );
640
+ };
641
+ var useUpgrade = () => {
642
+ const context = React11.useContext(UpgradeContext);
643
+ if (context === void 0) {
644
+ throw new Error("useUpgrade must be used within an UpgradeProvider");
645
+ }
646
+ return context;
647
+ };
641
648
 
642
649
  // src/hooks/usePlans.ts
643
650
  var usePlans = () => {
644
651
  const { currency } = useCurrency();
645
- const [plans, setPlans] = React10.useState([]);
646
- const [filteredPlans, setFilteredPlans] = React10.useState([]);
647
- const [selectedPlan, setSelectedPlan] = React10.useState(null);
648
- const [tierFilter, setTierFilter] = React10.useState("all");
649
- const [billingCycle, setBillingCycle] = React10.useState("monthly");
650
- const [loading, setLoading] = React10.useState(false);
651
- const [error, setError] = React10.useState(null);
652
- const fetchPlans = React10.useCallback(async () => {
652
+ const [plans, setPlans] = React11.useState([]);
653
+ const [filteredPlans, setFilteredPlans] = React11.useState([]);
654
+ const [selectedPlan, setSelectedPlan] = React11.useState(null);
655
+ const [tierFilter, setTierFilter] = React11.useState("all");
656
+ const [billingCycle, setBillingCycle] = React11.useState("monthly");
657
+ const [loading, setLoading] = React11.useState(false);
658
+ const [error, setError] = React11.useState(null);
659
+ const fetchPlans = React11.useCallback(async () => {
653
660
  if (loading) return;
654
661
  setLoading(true);
655
662
  setError(null);
@@ -671,7 +678,7 @@ var usePlans = () => {
671
678
  setLoading(false);
672
679
  }
673
680
  }, [loading]);
674
- React10.useEffect(() => {
681
+ React11.useEffect(() => {
675
682
  if (plans.length > 0 && tierFilter === "all") {
676
683
  const uniqueUnits = getUniqueCandidateUnits(plans);
677
684
  if (uniqueUnits.length > 0) {
@@ -679,17 +686,17 @@ var usePlans = () => {
679
686
  }
680
687
  }
681
688
  }, [plans, tierFilter]);
682
- React10.useEffect(() => {
689
+ React11.useEffect(() => {
683
690
  let filtered = [...plans];
684
691
  filtered = filterPlansByBillingCycle(filtered, billingCycle);
685
692
  filtered = filterPlansByTier(filtered, tierFilter);
686
693
  const sorted = sortPlansForDisplay(filtered);
687
694
  setFilteredPlans(sorted);
688
695
  }, [plans, tierFilter, billingCycle]);
689
- const handlePlanSelect = React10.useCallback((plan) => {
696
+ const handlePlanSelect = React11.useCallback((plan) => {
690
697
  setSelectedPlan(plan);
691
698
  }, []);
692
- const handleUpgrade = React10.useCallback(async (externalId, options) => {
699
+ const handleUpgrade = React11.useCallback(async (externalId, options) => {
693
700
  var _a;
694
701
  if (!selectedPlan) return;
695
702
  try {
@@ -711,14 +718,14 @@ var usePlans = () => {
711
718
  alert("An error occurred. Please try again.");
712
719
  }
713
720
  }, [selectedPlan, currency]);
714
- const clearPlans = React10.useCallback(() => {
721
+ const clearPlans = React11.useCallback(() => {
715
722
  setPlans([]);
716
723
  setFilteredPlans([]);
717
724
  setSelectedPlan(null);
718
725
  setError(null);
719
726
  setTierFilter("all");
720
727
  }, []);
721
- const clearSelectedPlan2 = React10.useCallback(() => {
728
+ const clearSelectedPlan2 = React11.useCallback(() => {
722
729
  setSelectedPlan(null);
723
730
  }, []);
724
731
  const dropdownOptions = getDropdownOptions(plans);
@@ -804,18 +811,18 @@ var useTransactions = ({
804
811
  initialFilters = {},
805
812
  autoFetch = false
806
813
  }) => {
807
- const [transactions, setTransactions] = React10.useState([]);
808
- const [allTransactions, setAllTransactions] = React10.useState([]);
809
- const [loading, setLoading] = React10.useState(false);
810
- const [error, setError] = React10.useState(null);
811
- const [filters, setFilters] = React10.useState({
814
+ const [transactions, setTransactions] = React11.useState([]);
815
+ const [allTransactions, setAllTransactions] = React11.useState([]);
816
+ const [loading, setLoading] = React11.useState(false);
817
+ const [error, setError] = React11.useState(null);
818
+ const [filters, setFilters] = React11.useState({
812
819
  ...DEFAULT_FILTERS,
813
820
  ...initialFilters
814
821
  });
815
- const [meta, setMeta] = React10.useState(null);
816
- const [isBackendPaginated, setIsBackendPaginated] = React10.useState(false);
817
- const hasAutoFetchedRef = React10.useRef(false);
818
- const fetchTransactions = React10.useCallback(async () => {
822
+ const [meta, setMeta] = React11.useState(null);
823
+ const [isBackendPaginated, setIsBackendPaginated] = React11.useState(false);
824
+ const hasAutoFetchedRef = React11.useRef(false);
825
+ const fetchTransactions = React11.useCallback(async () => {
819
826
  if (!externalId) return;
820
827
  setLoading(true);
821
828
  setError(null);
@@ -854,7 +861,7 @@ var useTransactions = ({
854
861
  setLoading(false);
855
862
  }
856
863
  }, [externalId, filters]);
857
- const updateFilters = React10.useCallback((newFilters) => {
864
+ const updateFilters = React11.useCallback((newFilters) => {
858
865
  setFilters((prev) => ({
859
866
  ...prev,
860
867
  ...newFilters,
@@ -862,7 +869,7 @@ var useTransactions = ({
862
869
  page: newFilters.page !== void 0 ? newFilters.page : 1
863
870
  }));
864
871
  }, []);
865
- React10.useEffect(() => {
872
+ React11.useEffect(() => {
866
873
  if (!isBackendPaginated && allTransactions.length > 0) {
867
874
  const filteredTransactions = applyFrontendFilters(allTransactions, filters);
868
875
  const paginatedResult = applyFrontendPagination(filteredTransactions, filters);
@@ -870,19 +877,19 @@ var useTransactions = ({
870
877
  setMeta(paginatedResult.meta);
871
878
  }
872
879
  }, [filters, allTransactions, isBackendPaginated]);
873
- const clearFilters = React10.useCallback(() => {
880
+ const clearFilters = React11.useCallback(() => {
874
881
  setFilters(DEFAULT_FILTERS);
875
882
  }, []);
876
- const refetch = React10.useCallback(async () => {
883
+ const refetch = React11.useCallback(async () => {
877
884
  await fetchTransactions();
878
885
  }, [fetchTransactions]);
879
- React10.useEffect(() => {
886
+ React11.useEffect(() => {
880
887
  if (autoFetch && externalId && !hasAutoFetchedRef.current) {
881
888
  hasAutoFetchedRef.current = true;
882
889
  fetchTransactions();
883
890
  }
884
891
  }, [autoFetch, externalId, fetchTransactions]);
885
- React10.useEffect(() => {
892
+ React11.useEffect(() => {
886
893
  if (!autoFetch) return;
887
894
  const hasNonPaginationFilters = filters.startDate !== void 0 || filters.endDate !== void 0 || filters.status !== void 0;
888
895
  const shouldFetch = isBackendPaginated || allTransactions.length === 0 && hasNonPaginationFilters;
@@ -909,10 +916,10 @@ var usePagination = ({
909
916
  initialPage = 1,
910
917
  initialLimit = 10
911
918
  } = {}) => {
912
- const [currentPage, setCurrentPage] = React10.useState(initialPage);
913
- const [limit, setLimitState] = React10.useState(initialLimit);
914
- const [meta, setMeta] = React10.useState(null);
915
- const goToPage = React10.useCallback((page) => {
919
+ const [currentPage, setCurrentPage] = React11.useState(initialPage);
920
+ const [limit, setLimitState] = React11.useState(initialLimit);
921
+ const [meta, setMeta] = React11.useState(null);
922
+ const goToPage = React11.useCallback((page) => {
916
923
  if (meta) {
917
924
  const validPage = Math.max(1, Math.min(page, meta.totalPages));
918
925
  setCurrentPage(validPage);
@@ -920,29 +927,29 @@ var usePagination = ({
920
927
  setCurrentPage(Math.max(1, page));
921
928
  }
922
929
  }, [meta]);
923
- const goToNextPage = React10.useCallback(() => {
930
+ const goToNextPage = React11.useCallback(() => {
924
931
  if (meta && meta.hasNextPage) {
925
932
  setCurrentPage((prev) => prev + 1);
926
933
  }
927
934
  }, [meta]);
928
- const goToPreviousPage = React10.useCallback(() => {
935
+ const goToPreviousPage = React11.useCallback(() => {
929
936
  if (meta && meta.hasPreviousPage) {
930
937
  setCurrentPage((prev) => prev - 1);
931
938
  }
932
939
  }, [meta]);
933
- const goToFirstPage = React10.useCallback(() => {
940
+ const goToFirstPage = React11.useCallback(() => {
934
941
  setCurrentPage(1);
935
942
  }, []);
936
- const goToLastPage = React10.useCallback(() => {
943
+ const goToLastPage = React11.useCallback(() => {
937
944
  if (meta) {
938
945
  setCurrentPage(meta.totalPages);
939
946
  }
940
947
  }, [meta]);
941
- const setLimit = React10.useCallback((newLimit) => {
948
+ const setLimit = React11.useCallback((newLimit) => {
942
949
  setLimitState(newLimit);
943
950
  setCurrentPage(1);
944
951
  }, []);
945
- const reset = React10.useCallback(() => {
952
+ const reset = React11.useCallback(() => {
946
953
  setCurrentPage(initialPage);
947
954
  setLimitState(initialLimit);
948
955
  setMeta(null);
@@ -965,9 +972,9 @@ var useCancelSubscription = ({
965
972
  onSuccess,
966
973
  onError
967
974
  } = {}) => {
968
- const [loading, setLoading] = React10.useState(false);
969
- const [error, setError] = React10.useState(null);
970
- const cancelSubscription = React10.useCallback(async (externalId, options) => {
975
+ const [loading, setLoading] = React11.useState(false);
976
+ const [error, setError] = React11.useState(null);
977
+ const cancelSubscription = React11.useCallback(async (externalId, options) => {
971
978
  if (!externalId) {
972
979
  const errorMsg = "External ID is required";
973
980
  setError(errorMsg);
@@ -996,7 +1003,7 @@ var useCancelSubscription = ({
996
1003
  setLoading(false);
997
1004
  }
998
1005
  }, [onSuccess, onError]);
999
- const reset = React10.useCallback(() => {
1006
+ const reset = React11.useCallback(() => {
1000
1007
  setLoading(false);
1001
1008
  setError(null);
1002
1009
  }, []);
@@ -1012,9 +1019,9 @@ var useCustomerPortal = ({
1012
1019
  onError,
1013
1020
  returnPath = "/dashboard"
1014
1021
  } = {}) => {
1015
- const [loading, setLoading] = React10.useState(false);
1016
- const [error, setError] = React10.useState(null);
1017
- const openCustomerPortal = React10.useCallback(async (externalId) => {
1022
+ const [loading, setLoading] = React11.useState(false);
1023
+ const [error, setError] = React11.useState(null);
1024
+ const openCustomerPortal = React11.useCallback(async (externalId) => {
1018
1025
  var _a;
1019
1026
  if (!externalId) {
1020
1027
  const errorMsg = "External ID is required";
@@ -1051,7 +1058,7 @@ var useCustomerPortal = ({
1051
1058
  setLoading(false);
1052
1059
  }
1053
1060
  }, [onSuccess, onError, returnPath]);
1054
- const reset = React10.useCallback(() => {
1061
+ const reset = React11.useCallback(() => {
1055
1062
  setLoading(false);
1056
1063
  setError(null);
1057
1064
  }, []);
@@ -1062,13 +1069,13 @@ var useCustomerPortal = ({
1062
1069
  reset
1063
1070
  };
1064
1071
  };
1065
- var NavigationContext = React10.createContext(void 0);
1072
+ var NavigationContext = React11.createContext(void 0);
1066
1073
  var NavigationProvider = ({
1067
1074
  children,
1068
1075
  initialPage = "dashboard"
1069
1076
  }) => {
1070
- const [currentPage, setCurrentPage] = React10.useState(initialPage);
1071
- const [history, setHistory] = React10.useState([initialPage]);
1077
+ const [currentPage, setCurrentPage] = React11.useState(initialPage);
1078
+ const [history, setHistory] = React11.useState([initialPage]);
1072
1079
  const navigateTo = (page) => {
1073
1080
  setCurrentPage(page);
1074
1081
  setHistory((prev) => [...prev, page]);
@@ -1085,7 +1092,7 @@ var NavigationProvider = ({
1085
1092
  return /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: { currentPage, navigateTo, goBack }, children });
1086
1093
  };
1087
1094
  var useNavigation = () => {
1088
- const context = React10.useContext(NavigationContext);
1095
+ const context = React11.useContext(NavigationContext);
1089
1096
  if (!context) {
1090
1097
  throw new Error("useNavigation must be used within NavigationProvider");
1091
1098
  }
@@ -1169,8 +1176,8 @@ var TierFilterDropdown = ({
1169
1176
  selectedValue,
1170
1177
  onSelect
1171
1178
  }) => {
1172
- const dropdownRef = React10.useRef(null);
1173
- React10.useEffect(() => {
1179
+ const dropdownRef = React11.useRef(null);
1180
+ React11.useEffect(() => {
1174
1181
  const handleClickOutside = (event) => {
1175
1182
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1176
1183
  if (isOpen) {
@@ -1550,7 +1557,7 @@ var PlanSelector = ({
1550
1557
  activePlanCode,
1551
1558
  nextMembershipPlanId
1552
1559
  }) => {
1553
- const [isDropdownOpen, setIsDropdownOpen] = React10.useState(false);
1560
+ const [isDropdownOpen, setIsDropdownOpen] = React11.useState(false);
1554
1561
  const handleDropdownToggle = () => {
1555
1562
  setIsDropdownOpen(!isDropdownOpen);
1556
1563
  };
@@ -1920,7 +1927,7 @@ var Layout = ({ children, hideHeader = false, hideFooter = false }) => {
1920
1927
  ] });
1921
1928
  };
1922
1929
  var usePaymentParams = () => {
1923
- return React10.useMemo(() => {
1930
+ return React11.useMemo(() => {
1924
1931
  const params = new URLSearchParams(window.location.search);
1925
1932
  return {
1926
1933
  gateway: params.get("gateway") || void 0,
@@ -1951,7 +1958,7 @@ var PaymentSuccessPage = ({
1951
1958
  initialFilters: { page: 1, limit: 100 },
1952
1959
  autoFetch: !!externalId
1953
1960
  });
1954
- const invoiceDownloadUrl = React10.useMemo(() => {
1961
+ const invoiceDownloadUrl = React11.useMemo(() => {
1955
1962
  if (propInvoiceDownloadUrl) return propInvoiceDownloadUrl;
1956
1963
  if (!transactions || transactions.length === 0) return void 0;
1957
1964
  const withOrder = transactions.filter((t) => typeof t.order === "number");
@@ -2465,7 +2472,7 @@ var TransactionPagination = ({
2465
2472
  children: "Previous"
2466
2473
  }
2467
2474
  ),
2468
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-1", children: getVisiblePages().map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React10__default.default.Fragment, { children: page === "..." ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-3 py-2 text-sm text-gray-500", children: "..." }) : /* @__PURE__ */ jsxRuntime.jsx(
2475
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-1", children: getVisiblePages().map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React11__default.default.Fragment, { children: page === "..." ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-3 py-2 text-sm text-gray-500", children: "..." }) : /* @__PURE__ */ jsxRuntime.jsx(
2469
2476
  "button",
2470
2477
  {
2471
2478
  onClick: () => onPageChange(page),
@@ -2511,7 +2518,7 @@ var TransactionModal = ({
2511
2518
  autoFetch: true
2512
2519
  // Enable auto-fetch so it works when modal opens
2513
2520
  });
2514
- React10.useEffect(() => {
2521
+ React11.useEffect(() => {
2515
2522
  if (isOpen && externalId) {
2516
2523
  fetchTransactions();
2517
2524
  }
@@ -3061,9 +3068,11 @@ var GracePeriodNotification = ({
3061
3068
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
3062
3069
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-bold text-orange-900 mb-1", children: "Grace Period Active" }),
3063
3070
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-orange-800", children: [
3064
- "Your 7-day grace period started on",
3071
+ "Your ",
3072
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: "7-day" }),
3073
+ " grace period started on",
3065
3074
  " ",
3066
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: startDate ? formatDate(startDate) : "N/A" }),
3075
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-bold", children: startDate ? formatDate(startDate) : "N/A" }),
3067
3076
  ". You have ",
3068
3077
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-bold text-orange-900 text-base", children: [
3069
3078
  remainingDays,
@@ -3089,10 +3098,10 @@ var SubscriptionDetails = ({
3089
3098
  className = "",
3090
3099
  loading = false
3091
3100
  }) => {
3092
- const [isTransactionModalOpen, setIsTransactionModalOpen] = React10.useState(false);
3093
- const [showCancelConfirmation, setShowCancelConfirmation] = React10.useState(false);
3094
- const [localSubscription, setLocalSubscription] = React10.useState(subscription);
3095
- React10.useEffect(() => {
3101
+ const [isTransactionModalOpen, setIsTransactionModalOpen] = React11.useState(false);
3102
+ const [showCancelConfirmation, setShowCancelConfirmation] = React11.useState(false);
3103
+ const [localSubscription, setLocalSubscription] = React11.useState(subscription);
3104
+ React11.useEffect(() => {
3096
3105
  setLocalSubscription(subscription);
3097
3106
  }, [subscription]);
3098
3107
  const { cancelSubscription, loading: cancelLoading } = useCancelSubscription({
@@ -3222,9 +3231,9 @@ var UpgradeSummary = ({
3222
3231
  billableMetricCode
3223
3232
  }) => {
3224
3233
  const { currency } = useCurrency();
3225
- const [checkoutInfo, setCheckoutInfo] = React10.useState(null);
3226
- const [loading, setLoading] = React10.useState(false);
3227
- React10.useEffect(() => {
3234
+ const [checkoutInfo, setCheckoutInfo] = React11.useState(null);
3235
+ const [loading, setLoading] = React11.useState(false);
3236
+ React11.useEffect(() => {
3228
3237
  const planToDisplay2 = selectedPlan || currentPlan;
3229
3238
  if (!planToDisplay2 || !isVisible || Number(planToDisplay2.fixedCost) === 0) {
3230
3239
  setCheckoutInfo(null);
@@ -3390,9 +3399,9 @@ var UpgradeSummary = ({
3390
3399
  }
3391
3400
  ) }) });
3392
3401
  };
3393
- var SubOSThemeContext = React10.createContext(void 0);
3402
+ var SubOSThemeContext = React11.createContext(void 0);
3394
3403
  var useSubOSTheme = () => {
3395
- const context = React10.useContext(SubOSThemeContext);
3404
+ const context = React11.useContext(SubOSThemeContext);
3396
3405
  if (!context) {
3397
3406
  throw new Error("useSubOSTheme must be used within a SubOSThemeProvider");
3398
3407
  }
@@ -3403,8 +3412,8 @@ var SubOSThemeProvider = ({
3403
3412
  theme = {},
3404
3413
  className = ""
3405
3414
  }) => {
3406
- const [currentTheme, setCurrentTheme] = React10__default.default.useState(theme);
3407
- const cssVariables = React10__default.default.useMemo(() => {
3415
+ const [currentTheme, setCurrentTheme] = React11__default.default.useState(theme);
3416
+ const cssVariables = React11__default.default.useMemo(() => {
3408
3417
  const vars = {};
3409
3418
  if (currentTheme.primaryColors) {
3410
3419
  Object.entries(currentTheme.primaryColors).forEach(([key, value]) => {
@@ -3453,7 +3462,7 @@ var SubOSThemeProvider = ({
3453
3462
  if (currentTheme.shadowCardHover) vars["--subos-shadow-card-hover"] = currentTheme.shadowCardHover;
3454
3463
  return vars;
3455
3464
  }, [currentTheme]);
3456
- const contextValue = React10__default.default.useMemo(() => ({
3465
+ const contextValue = React11__default.default.useMemo(() => ({
3457
3466
  theme: currentTheme,
3458
3467
  setTheme: setCurrentTheme
3459
3468
  }), [currentTheme]);
@@ -3468,7 +3477,7 @@ var SubOSThemeProvider = ({
3468
3477
  };
3469
3478
  var useApplyHostTheme = (hostTheme) => {
3470
3479
  const { setTheme } = useSubOSTheme();
3471
- React10__default.default.useEffect(() => {
3480
+ React11__default.default.useEffect(() => {
3472
3481
  if (hostTheme) {
3473
3482
  setTheme(hostTheme);
3474
3483
  }
@@ -3548,7 +3557,7 @@ var Pagination = ({
3548
3557
  children: "Previous"
3549
3558
  }
3550
3559
  ),
3551
- pageNumbers.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React10__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(
3560
+ pageNumbers.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React11__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(
3552
3561
  "button",
3553
3562
  {
3554
3563
  onClick: () => onPageChange(page),
@@ -3576,8 +3585,8 @@ var DashboardPage = ({
3576
3585
  const subscription = useSubscription();
3577
3586
  const plans = usePlans();
3578
3587
  const { currency, isLoading: isCurrencyLoading } = useCurrency();
3579
- const lastLoadedIdRef = React10.useRef(null);
3580
- React10.useEffect(() => {
3588
+ const lastLoadedIdRef = React11.useRef(null);
3589
+ React11.useEffect(() => {
3581
3590
  if (isCurrencyLoading) return;
3582
3591
  const cacheKey = `${externalId}-${currency}`;
3583
3592
  if (lastLoadedIdRef.current !== cacheKey) {
@@ -3586,7 +3595,7 @@ var DashboardPage = ({
3586
3595
  lastLoadedIdRef.current = cacheKey;
3587
3596
  }
3588
3597
  }, [externalId, currency, isCurrencyLoading]);
3589
- React10.useEffect(() => {
3598
+ React11.useEffect(() => {
3590
3599
  registerClearSelectedPlan(plans.clearSelectedPlan);
3591
3600
  return () => {
3592
3601
  unregisterClearSelectedPlan();
@@ -3653,9 +3662,9 @@ var DashboardPage = ({
3653
3662
  ] }) }) });
3654
3663
  };
3655
3664
  var useProcessPaymentCancel = (params) => {
3656
- const [loading, setLoading] = React10.useState(true);
3657
- const [error, setError] = React10.useState(null);
3658
- React10.useEffect(() => {
3665
+ const [loading, setLoading] = React11.useState(true);
3666
+ const [error, setError] = React11.useState(null);
3667
+ React11.useEffect(() => {
3659
3668
  const run = async () => {
3660
3669
  try {
3661
3670
  const qs = new URLSearchParams({
@@ -3762,6 +3771,7 @@ exports.SubscriptionCancelButton = SubscriptionCancelButton;
3762
3771
  exports.SubscriptionCancelModal = SubscriptionCancelModal;
3763
3772
  exports.SubscriptionDetails = SubscriptionDetails;
3764
3773
  exports.SubscriptionInfoGrid = SubscriptionInfoGrid;
3774
+ exports.SubscriptionProvider = SubscriptionProvider;
3765
3775
  exports.SubscriptionTransactionButton = SubscriptionTransactionButton;
3766
3776
  exports.SubscriptionUsageDisplay = SubscriptionUsageDisplay;
3767
3777
  exports.TierFilterDropdown = TierFilterDropdown;