subos-frontend 1.0.11 → 1.0.13

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,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var React4 = require('react');
3
+ var React9 = 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 React4__default = /*#__PURE__*/_interopDefault(React4);
10
+ var React9__default = /*#__PURE__*/_interopDefault(React9);
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] = React4.useState(null);
220
- const [loading, setLoading] = React4.useState(false);
221
- const [error, setError] = React4.useState(null);
222
- const fetchSubscription = React4.useCallback(async (externalId) => {
219
+ const [subscription, setSubscription] = React9.useState(null);
220
+ const [loading, setLoading] = React9.useState(false);
221
+ const [error, setError] = React9.useState(null);
222
+ const fetchSubscription = React9.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 = React4.useCallback(() => {
247
+ const clearSubscription = React9.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] = React4.useState([]);
385
- const [filteredPlans, setFilteredPlans] = React4.useState([]);
386
- const [selectedPlan, setSelectedPlan] = React4.useState(null);
387
- const [tierFilter, setTierFilter] = React4.useState("all");
388
- const [billingCycle, setBillingCycle] = React4.useState("monthly");
389
- const [loading, setLoading] = React4.useState(false);
390
- const [error, setError] = React4.useState(null);
391
- const fetchPlans = React4.useCallback(async () => {
384
+ const [plans, setPlans] = React9.useState([]);
385
+ const [filteredPlans, setFilteredPlans] = React9.useState([]);
386
+ const [selectedPlan, setSelectedPlan] = React9.useState(null);
387
+ const [tierFilter, setTierFilter] = React9.useState("all");
388
+ const [billingCycle, setBillingCycle] = React9.useState("monthly");
389
+ const [loading, setLoading] = React9.useState(false);
390
+ const [error, setError] = React9.useState(null);
391
+ const fetchPlans = React9.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
- React4.useEffect(() => {
413
+ React9.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
- React4.useEffect(() => {
421
+ React9.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 = React4.useCallback((plan) => {
427
+ const handlePlanSelect = React9.useCallback((plan) => {
428
428
  setSelectedPlan(plan);
429
429
  }, []);
430
- const handleUpgrade = React4.useCallback(async (externalId) => {
430
+ const handleUpgrade = React9.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 = React4.useCallback(() => {
448
+ const clearPlans = React9.useCallback(() => {
449
449
  setPlans([]);
450
450
  setFilteredPlans([]);
451
451
  setSelectedPlan(null);
452
452
  setError(null);
453
453
  setTierFilter("all");
454
454
  }, []);
455
- const clearSelectedPlan2 = React4.useCallback(() => {
455
+ const clearSelectedPlan2 = React9.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] = React4.useState([]);
540
- const [allTransactions, setAllTransactions] = React4.useState([]);
541
- const [loading, setLoading] = React4.useState(false);
542
- const [error, setError] = React4.useState(null);
543
- const [filters, setFilters] = React4.useState({
539
+ const [transactions, setTransactions] = React9.useState([]);
540
+ const [allTransactions, setAllTransactions] = React9.useState([]);
541
+ const [loading, setLoading] = React9.useState(false);
542
+ const [error, setError] = React9.useState(null);
543
+ const [filters, setFilters] = React9.useState({
544
544
  ...DEFAULT_FILTERS,
545
545
  ...initialFilters
546
546
  });
547
- const [meta, setMeta] = React4.useState(null);
548
- const [isBackendPaginated, setIsBackendPaginated] = React4.useState(false);
549
- const hasAutoFetchedRef = React4.useRef(false);
550
- const fetchTransactions = React4.useCallback(async () => {
547
+ const [meta, setMeta] = React9.useState(null);
548
+ const [isBackendPaginated, setIsBackendPaginated] = React9.useState(false);
549
+ const hasAutoFetchedRef = React9.useRef(false);
550
+ const fetchTransactions = React9.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 = React4.useCallback((newFilters) => {
594
+ const updateFilters = React9.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
- React4.useEffect(() => {
602
+ React9.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 = React4.useCallback(() => {
610
+ const clearFilters = React9.useCallback(() => {
611
611
  setFilters(DEFAULT_FILTERS);
612
612
  }, []);
613
- const refetch = React4.useCallback(async () => {
613
+ const refetch = React9.useCallback(async () => {
614
614
  await fetchTransactions();
615
615
  }, [fetchTransactions]);
616
- React4.useEffect(() => {
616
+ React9.useEffect(() => {
617
617
  if (autoFetch && externalId && !hasAutoFetchedRef.current) {
618
618
  hasAutoFetchedRef.current = true;
619
619
  fetchTransactions();
620
620
  }
621
621
  }, [autoFetch, externalId, fetchTransactions]);
622
- React4.useEffect(() => {
622
+ React9.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] = React4.useState(initialPage);
650
- const [limit, setLimitState] = React4.useState(initialLimit);
651
- const [meta, setMeta] = React4.useState(null);
652
- const goToPage = React4.useCallback((page) => {
649
+ const [currentPage, setCurrentPage] = React9.useState(initialPage);
650
+ const [limit, setLimitState] = React9.useState(initialLimit);
651
+ const [meta, setMeta] = React9.useState(null);
652
+ const goToPage = React9.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 = React4.useCallback(() => {
660
+ const goToNextPage = React9.useCallback(() => {
661
661
  if (meta && meta.hasNextPage) {
662
662
  setCurrentPage((prev) => prev + 1);
663
663
  }
664
664
  }, [meta]);
665
- const goToPreviousPage = React4.useCallback(() => {
665
+ const goToPreviousPage = React9.useCallback(() => {
666
666
  if (meta && meta.hasPreviousPage) {
667
667
  setCurrentPage((prev) => prev - 1);
668
668
  }
669
669
  }, [meta]);
670
- const goToFirstPage = React4.useCallback(() => {
670
+ const goToFirstPage = React9.useCallback(() => {
671
671
  setCurrentPage(1);
672
672
  }, []);
673
- const goToLastPage = React4.useCallback(() => {
673
+ const goToLastPage = React9.useCallback(() => {
674
674
  if (meta) {
675
675
  setCurrentPage(meta.totalPages);
676
676
  }
677
677
  }, [meta]);
678
- const setLimit = React4.useCallback((newLimit) => {
678
+ const setLimit = React9.useCallback((newLimit) => {
679
679
  setLimitState(newLimit);
680
680
  setCurrentPage(1);
681
681
  }, []);
682
- const reset = React4.useCallback(() => {
682
+ const reset = React9.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] = React4.useState(false);
706
- const [error, setError] = React4.useState(null);
707
- const cancelSubscription = React4.useCallback(async (externalId, options) => {
705
+ const [loading, setLoading] = React9.useState(false);
706
+ const [error, setError] = React9.useState(null);
707
+ const cancelSubscription = React9.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 = React4.useCallback(() => {
736
+ const reset = React9.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] = React4.useState(false);
777
- const [error, setError] = React4.useState(null);
778
- const openCustomerPortal = React4.useCallback(async (externalId) => {
776
+ const [loading, setLoading] = React9.useState(false);
777
+ const [error, setError] = React9.useState(null);
778
+ const openCustomerPortal = React9.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 = React4.useCallback(() => {
816
+ const reset = React9.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 = React4.createContext(void 0);
827
+ var UpgradeContext = React9.createContext(void 0);
828
828
  var UpgradeProvider = ({ children }) => {
829
- const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] = React4.useState(false);
829
+ const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] = React9.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 = React4.useContext(UpgradeContext);
849
+ const context = React9.useContext(UpgradeContext);
850
850
  if (context === void 0) {
851
851
  throw new Error("useUpgrade must be used within an UpgradeProvider");
852
852
  }
@@ -857,24 +857,49 @@ var BillingCycleToggle = ({
857
857
  onBillingCycleChange,
858
858
  className
859
859
  }) => {
860
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex bg-gray-100 rounded-lg p-1", children: [
861
- /* @__PURE__ */ jsxRuntime.jsx(
862
- "button",
863
- {
864
- onClick: () => onBillingCycleChange("monthly"),
865
- className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${billingCycle === "monthly" ? `bg-green-600 text-white shadow-sm ${className}` : "text-gray-600 hover:text-gray-900"}`,
866
- children: "Monthly"
867
- }
868
- ),
869
- /* @__PURE__ */ jsxRuntime.jsx(
870
- "button",
871
- {
872
- onClick: () => onBillingCycleChange("yearly"),
873
- className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${billingCycle === "yearly" ? `bg-green-600 text-white shadow-sm ${className}` : "text-gray-600 hover:text-gray-900"}`,
874
- children: "Yearly"
875
- }
876
- )
877
- ] });
860
+ return /* @__PURE__ */ jsxRuntime.jsxs(
861
+ "div",
862
+ {
863
+ className: "flex rounded-lg p-1",
864
+ style: { backgroundColor: "var(--subos-muted, #f8f9fa)" },
865
+ children: [
866
+ /* @__PURE__ */ jsxRuntime.jsx(
867
+ "button",
868
+ {
869
+ onClick: () => onBillingCycleChange("monthly"),
870
+ className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${billingCycle === "monthly" ? `subos-btn-primary text-white shadow-sm ${className || ""}` : ""}`,
871
+ style: billingCycle !== "monthly" ? {
872
+ color: "var(--subos-muted-foreground, #6c757d)"
873
+ } : {},
874
+ onMouseEnter: billingCycle !== "monthly" ? (e) => {
875
+ e.currentTarget.style.color = "var(--subos-foreground, inherit)";
876
+ } : void 0,
877
+ onMouseLeave: billingCycle !== "monthly" ? (e) => {
878
+ e.currentTarget.style.color = "var(--subos-muted-foreground, #6c757d)";
879
+ } : void 0,
880
+ children: "Monthly"
881
+ }
882
+ ),
883
+ /* @__PURE__ */ jsxRuntime.jsx(
884
+ "button",
885
+ {
886
+ onClick: () => onBillingCycleChange("yearly"),
887
+ className: `px-4 py-2 rounded-md text-sm font-medium transition-colors ${billingCycle === "yearly" ? `subos-btn-primary text-white shadow-sm ${className || ""}` : ""}`,
888
+ style: billingCycle !== "yearly" ? {
889
+ color: "var(--subos-muted-foreground, #6c757d)"
890
+ } : {},
891
+ onMouseEnter: billingCycle !== "yearly" ? (e) => {
892
+ e.currentTarget.style.color = "var(--subos-foreground, inherit)";
893
+ } : void 0,
894
+ onMouseLeave: billingCycle !== "yearly" ? (e) => {
895
+ e.currentTarget.style.color = "var(--subos-muted-foreground, #6c757d)";
896
+ } : void 0,
897
+ children: "Yearly"
898
+ }
899
+ )
900
+ ]
901
+ }
902
+ );
878
903
  };
879
904
  var TierFilterDropdown = ({
880
905
  isOpen,
@@ -884,8 +909,8 @@ var TierFilterDropdown = ({
884
909
  selectedValue,
885
910
  onSelect
886
911
  }) => {
887
- const dropdownRef = React4.useRef(null);
888
- React4.useEffect(() => {
912
+ const dropdownRef = React9.useRef(null);
913
+ React9.useEffect(() => {
889
914
  const handleClickOutside = (event) => {
890
915
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
891
916
  if (isOpen) {
@@ -934,11 +959,12 @@ var TierFilterDropdown = ({
934
959
  )) })
935
960
  ] });
936
961
  };
937
- var CheckIcon = ({ className = "w-5 h-5" }) => {
962
+ var CheckIcon = ({ className = "w-5 h-5", style }) => {
938
963
  return /* @__PURE__ */ jsxRuntime.jsx(
939
964
  "svg",
940
965
  {
941
966
  className,
967
+ style,
942
968
  fill: "currentColor",
943
969
  viewBox: "0 0 20 20",
944
970
  xmlns: "http://www.w3.org/2000/svg",
@@ -968,36 +994,89 @@ var PlanCard = ({
968
994
  "div",
969
995
  {
970
996
  onClick: isFree || isActive ? void 0 : () => onSelect(plan),
971
- className: `relative border rounded-lg p-6 transition-all flex flex-col h-full ${!isFree && !isActive ? "cursor-pointer" : "cursor-default"} ${!isFree && isSelected && !isActive ? "border-green-500 bg-green-50" : "border-gray-200"} ${!isFree && !isActive ? "hover:border-gray-300" : ""} ${isPopular ? "border-green-500" : ""}`,
997
+ className: `relative border rounded-lg p-6 transition-all flex flex-col h-full font-subos ${!isFree && !isActive ? "cursor-pointer" : "cursor-default"} ${!isFree && isSelected && !isActive ? "border-primary-500 bg-primary-50" : "border-subos-border"} ${!isFree && !isActive ? "hover:border-subos-muted-foreground" : ""} ${isPopular ? "border-primary-500" : ""}`,
998
+ style: {
999
+ backgroundColor: !isFree && isSelected && !isActive ? "var(--subos-primary-50, #e8eaf6)" : "var(--subos-background, #ffffff)",
1000
+ borderColor: !isFree && isSelected && !isActive ? "var(--subos-primary-500, #3f51b5)" : isPopular ? "var(--subos-primary-500, #3f51b5)" : "var(--subos-border, #dee2e6)",
1001
+ color: "var(--subos-foreground, inherit)"
1002
+ },
972
1003
  children: [
973
- isPopular && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-3 left-1/2 transform -translate-x-1/2", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "bg-green-500 text-white px-3 py-1 rounded-full text-xs font-medium", children: "Most Popular" }) }),
974
- !isFree && isSelected && !isActive && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-4 right-4", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-green-500 text-white rounded-full p-1", children: /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "w-4 h-4" }) }) }),
1004
+ isPopular && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-3 left-1/2 transform -translate-x-1/2", children: /* @__PURE__ */ jsxRuntime.jsx(
1005
+ "span",
1006
+ {
1007
+ className: "text-white px-3 py-1 rounded-full text-xs font-medium",
1008
+ style: { backgroundColor: "var(--subos-primary-500, #3f51b5)" },
1009
+ children: "Most Popular"
1010
+ }
1011
+ ) }),
1012
+ !isFree && isSelected && !isActive && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute top-4 right-4", children: /* @__PURE__ */ jsxRuntime.jsx(
1013
+ "div",
1014
+ {
1015
+ className: "text-white rounded-full p-1",
1016
+ style: { backgroundColor: "var(--subos-primary-500, #3f51b5)" },
1017
+ children: /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "w-4 h-4" })
1018
+ }
1019
+ ) }),
975
1020
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4", children: [
976
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-xl font-bold text-gray-900 mb-2", children: plan.name }),
977
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-600 text-sm mb-4", children: description }),
978
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4", children: isFree ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-3xl font-bold text-gray-900", children: "Free" }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
979
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-3xl font-bold text-gray-900", children: [
1021
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-xl font-bold mb-2", style: { color: "var(--subos-foreground, inherit)" }, children: plan.name }),
1022
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm mb-4", style: { color: "var(--subos-muted-foreground, #6c757d)" }, children: description }),
1023
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4", children: isFree ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-3xl font-bold", style: { color: "var(--subos-foreground, inherit)" }, children: "Free" }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1024
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-3xl font-bold", style: { color: "var(--subos-foreground, inherit)" }, children: [
980
1025
  "$",
981
1026
  plan.fixedCost
982
1027
  ] }),
983
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-gray-600 ml-1", children: [
1028
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1", style: { color: "var(--subos-muted-foreground, #6c757d)" }, children: [
984
1029
  "per ",
985
1030
  billingCycle === "yearly" ? "year" : "month"
986
1031
  ] })
987
1032
  ] }) })
988
1033
  ] }),
989
1034
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-2 mb-6 flex-grow", children: features.map((feature, index) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-center text-sm", children: [
990
- /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "w-4 h-4 text-green-500 mr-2 flex-shrink-0" }),
991
- feature
1035
+ /* @__PURE__ */ jsxRuntime.jsx(
1036
+ CheckIcon,
1037
+ {
1038
+ className: "w-4 h-4 mr-2 flex-shrink-0",
1039
+ style: { color: "var(--subos-primary-500, #3f51b5)" }
1040
+ }
1041
+ ),
1042
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "var(--subos-foreground, inherit)" }, children: feature })
992
1043
  ] }, index)) }),
993
1044
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto", children: !isFree && (isActive ? /* @__PURE__ */ jsxRuntime.jsx(
994
1045
  "button",
995
1046
  {
996
- className: "w-full bg-gray-100 border border-gray-200 text-gray-500 py-2 px-4 rounded-md font-medium cursor-default",
1047
+ className: "w-full border py-2 px-4 rounded-md font-medium cursor-default",
1048
+ style: {
1049
+ backgroundColor: "var(--subos-muted, #f8f9fa)",
1050
+ borderColor: "var(--subos-border, #dee2e6)",
1051
+ color: "var(--subos-muted-foreground, #6c757d)"
1052
+ },
997
1053
  disabled: true,
998
1054
  children: "Active"
999
1055
  }
1000
- ) : isSelected ? /* @__PURE__ */ jsxRuntime.jsx("button", { className: "w-full bg-primary text-white py-2 px-4 rounded-md font-medium", children: "Selected" }) : /* @__PURE__ */ jsxRuntime.jsx("button", { className: "w-full bg-white border border-gray-300 text-gray-700 py-2 px-4 rounded-md font-medium hover:bg-gray-50", children: "Select" })) })
1056
+ ) : isSelected ? /* @__PURE__ */ jsxRuntime.jsx(
1057
+ "button",
1058
+ {
1059
+ className: "w-full subos-btn-primary text-white py-2 px-4 rounded-md font-medium",
1060
+ children: "Selected"
1061
+ }
1062
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1063
+ "button",
1064
+ {
1065
+ className: "w-full border py-2 px-4 rounded-md font-medium transition-colors",
1066
+ style: {
1067
+ backgroundColor: "var(--subos-background, #ffffff)",
1068
+ borderColor: "var(--subos-border, #dee2e6)",
1069
+ color: "var(--subos-foreground, inherit)"
1070
+ },
1071
+ onMouseEnter: (e) => {
1072
+ e.currentTarget.style.backgroundColor = "var(--subos-muted, #f8f9fa)";
1073
+ },
1074
+ onMouseLeave: (e) => {
1075
+ e.currentTarget.style.backgroundColor = "var(--subos-background, #ffffff)";
1076
+ },
1077
+ children: "Select"
1078
+ }
1079
+ )) })
1001
1080
  ]
1002
1081
  }
1003
1082
  );
@@ -1062,7 +1141,7 @@ var PlanSelector = ({
1062
1141
  onBillingCycleChange,
1063
1142
  activePlanCode
1064
1143
  }) => {
1065
- const [isDropdownOpen, setIsDropdownOpen] = React4.useState(false);
1144
+ const [isDropdownOpen, setIsDropdownOpen] = React9.useState(false);
1066
1145
  const handleDropdownToggle = () => {
1067
1146
  setIsDropdownOpen(!isDropdownOpen);
1068
1147
  };
@@ -1741,7 +1820,7 @@ var TransactionPagination = ({
1741
1820
  children: "Previous"
1742
1821
  }
1743
1822
  ),
1744
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-1", children: getVisiblePages().map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React4__default.default.Fragment, { children: page === "..." ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-3 py-2 text-sm text-gray-500", children: "..." }) : /* @__PURE__ */ jsxRuntime.jsx(
1823
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-1", children: getVisiblePages().map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React9__default.default.Fragment, { children: page === "..." ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-3 py-2 text-sm text-gray-500", children: "..." }) : /* @__PURE__ */ jsxRuntime.jsx(
1745
1824
  "button",
1746
1825
  {
1747
1826
  onClick: () => onPageChange(page),
@@ -1787,7 +1866,7 @@ var TransactionModal = ({
1787
1866
  autoFetch: true
1788
1867
  // Enable auto-fetch so it works when modal opens
1789
1868
  });
1790
- React4.useEffect(() => {
1869
+ React9.useEffect(() => {
1791
1870
  if (isOpen && externalId) {
1792
1871
  fetchTransactions();
1793
1872
  }
@@ -2066,7 +2145,7 @@ var SubscriptionActionButtons = ({
2066
2145
  if (visibleActions.length === 0) {
2067
2146
  return null;
2068
2147
  }
2069
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${containerClass} ${className}`, children: visibleActions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(React4__default.default.Fragment, { children: action.component }, action.key)) });
2148
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${containerClass} ${className}`, children: visibleActions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(React9__default.default.Fragment, { children: action.component }, action.key)) });
2070
2149
  };
2071
2150
  var SubscriptionCancelModal = ({
2072
2151
  isOpen,
@@ -2148,8 +2227,8 @@ var SubscriptionDetails = ({
2148
2227
  customActions = [],
2149
2228
  className = ""
2150
2229
  }) => {
2151
- const [isTransactionModalOpen, setIsTransactionModalOpen] = React4.useState(false);
2152
- const [showCancelConfirmation, setShowCancelConfirmation] = React4.useState(false);
2230
+ const [isTransactionModalOpen, setIsTransactionModalOpen] = React9.useState(false);
2231
+ const [showCancelConfirmation, setShowCancelConfirmation] = React9.useState(false);
2153
2232
  const { cancelSubscription, loading: cancelLoading } = useCancelSubscription({
2154
2233
  onSuccess: () => {
2155
2234
  setShowCancelConfirmation(false);
@@ -2260,9 +2339,9 @@ var UpgradeSummary = ({
2260
2339
  onUpgrade,
2261
2340
  isVisible = true
2262
2341
  }) => {
2263
- const [checkoutInfo, setCheckoutInfo] = React4.useState(null);
2264
- const [loading, setLoading] = React4.useState(false);
2265
- React4.useEffect(() => {
2342
+ const [checkoutInfo, setCheckoutInfo] = React9.useState(null);
2343
+ const [loading, setLoading] = React9.useState(false);
2344
+ React9.useEffect(() => {
2266
2345
  if (!selectedPlan || !isVisible || Number(selectedPlan.fixedCost) === 0) {
2267
2346
  setCheckoutInfo(null);
2268
2347
  return;
@@ -2315,7 +2394,7 @@ var UpgradeSummary = ({
2315
2394
  {
2316
2395
  onClick: onUpgrade,
2317
2396
  disabled: loading,
2318
- className: "bg-primary text-white px-6 py-2 rounded-md font-medium hover:bg-primary-dark transition-colors text-sm disabled:opacity-50",
2397
+ className: "btn-primary text-white px-6 py-2 rounded-md font-medium hover:bg-primary-dark transition-colors text-sm disabled:opacity-50",
2319
2398
  children: loading ? "Loading..." : "Upgrade Now"
2320
2399
  }
2321
2400
  )
@@ -2349,6 +2428,66 @@ var Layout = ({ children }) => {
2349
2428
  ] }) }) })
2350
2429
  ] });
2351
2430
  };
2431
+ var SubOSThemeContext = React9.createContext(void 0);
2432
+ var useSubOSTheme = () => {
2433
+ const context = React9.useContext(SubOSThemeContext);
2434
+ if (!context) {
2435
+ throw new Error("useSubOSTheme must be used within a SubOSThemeProvider");
2436
+ }
2437
+ return context;
2438
+ };
2439
+ var SubOSThemeProvider = ({
2440
+ children,
2441
+ theme = {},
2442
+ className = ""
2443
+ }) => {
2444
+ const [currentTheme, setCurrentTheme] = React9__default.default.useState(theme);
2445
+ const cssVariables = React9__default.default.useMemo(() => {
2446
+ const vars = {};
2447
+ if (currentTheme.primaryColors) {
2448
+ Object.entries(currentTheme.primaryColors).forEach(([key, value]) => {
2449
+ if (value) vars[`--subos-primary-${key}`] = value;
2450
+ });
2451
+ }
2452
+ if (currentTheme.secondaryColors) {
2453
+ Object.entries(currentTheme.secondaryColors).forEach(([key, value]) => {
2454
+ if (value) vars[`--subos-secondary-${key}`] = value;
2455
+ });
2456
+ }
2457
+ if (currentTheme.background) vars["--subos-background"] = currentTheme.background;
2458
+ if (currentTheme.foreground) vars["--subos-foreground"] = currentTheme.foreground;
2459
+ if (currentTheme.muted) vars["--subos-muted"] = currentTheme.muted;
2460
+ if (currentTheme.mutedForeground) vars["--subos-muted-foreground"] = currentTheme.mutedForeground;
2461
+ if (currentTheme.border) vars["--subos-border"] = currentTheme.border;
2462
+ if (currentTheme.accent) vars["--subos-accent"] = currentTheme.accent;
2463
+ if (currentTheme.accentForeground) vars["--subos-accent-foreground"] = currentTheme.accentForeground;
2464
+ if (currentTheme.fontFamily) vars["--subos-font-family"] = currentTheme.fontFamily;
2465
+ if (currentTheme.borderRadius) vars["--subos-border-radius"] = currentTheme.borderRadius;
2466
+ if (currentTheme.shadowCard) vars["--subos-shadow-card"] = currentTheme.shadowCard;
2467
+ if (currentTheme.shadowCardHover) vars["--subos-shadow-card-hover"] = currentTheme.shadowCardHover;
2468
+ return vars;
2469
+ }, [currentTheme]);
2470
+ const contextValue = React9__default.default.useMemo(() => ({
2471
+ theme: currentTheme,
2472
+ setTheme: setCurrentTheme
2473
+ }), [currentTheme]);
2474
+ return /* @__PURE__ */ jsxRuntime.jsx(SubOSThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
2475
+ "div",
2476
+ {
2477
+ className: `subos-container ${className}`,
2478
+ style: cssVariables,
2479
+ children
2480
+ }
2481
+ ) });
2482
+ };
2483
+ var useApplyHostTheme = (hostTheme) => {
2484
+ const { setTheme } = useSubOSTheme();
2485
+ React9__default.default.useEffect(() => {
2486
+ if (hostTheme) {
2487
+ setTheme(hostTheme);
2488
+ }
2489
+ }, [hostTheme, setTheme]);
2490
+ };
2352
2491
  var Pagination = ({
2353
2492
  meta,
2354
2493
  onPageChange,
@@ -2423,7 +2562,7 @@ var Pagination = ({
2423
2562
  children: "Previous"
2424
2563
  }
2425
2564
  ),
2426
- pageNumbers.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React4__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(
2565
+ pageNumbers.map((page, index) => /* @__PURE__ */ jsxRuntime.jsx(React9__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(
2427
2566
  "button",
2428
2567
  {
2429
2568
  onClick: () => onPageChange(page),
@@ -2450,15 +2589,15 @@ var DashboardPage = ({
2450
2589
  var _a;
2451
2590
  const subscription = useSubscription();
2452
2591
  const plans = usePlans();
2453
- const lastLoadedIdRef = React4.useRef(null);
2454
- React4.useEffect(() => {
2592
+ const lastLoadedIdRef = React9.useRef(null);
2593
+ React9.useEffect(() => {
2455
2594
  if (lastLoadedIdRef.current !== externalId) {
2456
2595
  subscription.fetchSubscription(externalId);
2457
2596
  plans.fetchPlans();
2458
2597
  lastLoadedIdRef.current = externalId;
2459
2598
  }
2460
2599
  }, [externalId]);
2461
- React4.useEffect(() => {
2600
+ React9.useEffect(() => {
2462
2601
  registerClearSelectedPlan(plans.clearSelectedPlan);
2463
2602
  return () => {
2464
2603
  unregisterClearSelectedPlan();
@@ -2508,7 +2647,7 @@ var DashboardPage = ({
2508
2647
  ] }) }) });
2509
2648
  };
2510
2649
  var usePaymentParams = () => {
2511
- return React4.useMemo(() => {
2650
+ return React9.useMemo(() => {
2512
2651
  const params = new URLSearchParams(window.location.search);
2513
2652
  return {
2514
2653
  gateway: params.get("gateway") || void 0,
@@ -2519,9 +2658,9 @@ var usePaymentParams = () => {
2519
2658
  }, []);
2520
2659
  };
2521
2660
  var useProcessPaymentSuccess = (params) => {
2522
- const [loading, setLoading] = React4.useState(true);
2523
- const [error, setError] = React4.useState(null);
2524
- React4.useEffect(() => {
2661
+ const [loading, setLoading] = React9.useState(true);
2662
+ const [error, setError] = React9.useState(null);
2663
+ React9.useEffect(() => {
2525
2664
  const run = async () => {
2526
2665
  try {
2527
2666
  const qs = new URLSearchParams({
@@ -2591,9 +2730,9 @@ var PaymentSuccessPage = () => {
2591
2730
  };
2592
2731
  var PaymentSuccessPage_default = PaymentSuccessPage;
2593
2732
  var useProcessPaymentCancel = (params) => {
2594
- const [loading, setLoading] = React4.useState(true);
2595
- const [error, setError] = React4.useState(null);
2596
- React4.useEffect(() => {
2733
+ const [loading, setLoading] = React9.useState(true);
2734
+ const [error, setError] = React9.useState(null);
2735
+ React9.useEffect(() => {
2597
2736
  const run = async () => {
2598
2737
  try {
2599
2738
  const qs = new URLSearchParams({
@@ -2665,6 +2804,7 @@ exports.PlansGrid = PlansGrid;
2665
2804
  exports.ReceiptIcon = ReceiptIcon;
2666
2805
  exports.SearchIcon = SearchIcon;
2667
2806
  exports.StarBorderIcon = StarBorderIcon;
2807
+ exports.SubOSThemeProvider = SubOSThemeProvider;
2668
2808
  exports.SubscriptionActionButtons = SubscriptionActionButtons;
2669
2809
  exports.SubscriptionCancelButton = SubscriptionCancelButton;
2670
2810
  exports.SubscriptionCancelModal = SubscriptionCancelModal;
@@ -2708,10 +2848,12 @@ exports.registerClearSelectedPlan = registerClearSelectedPlan;
2708
2848
  exports.subscriptionApi = subscriptionApi;
2709
2849
  exports.transactionApi = transactionApi;
2710
2850
  exports.unregisterClearSelectedPlan = unregisterClearSelectedPlan;
2851
+ exports.useApplyHostTheme = useApplyHostTheme;
2711
2852
  exports.useCancelSubscription = useCancelSubscription;
2712
2853
  exports.useCustomerPortal = useCustomerPortal;
2713
2854
  exports.usePagination = usePagination;
2714
2855
  exports.usePlans = usePlans;
2856
+ exports.useSubOSTheme = useSubOSTheme;
2715
2857
  exports.useSubscription = useSubscription;
2716
2858
  exports.useTransactions = useTransactions;
2717
2859
  exports.useUpgrade = useUpgrade;