subos-frontend 1.0.79 → 1.0.81

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 React9 = require('react');
3
+ var React10 = 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 React9__default = /*#__PURE__*/_interopDefault(React9);
10
+ var React10__default = /*#__PURE__*/_interopDefault(React10);
11
11
 
12
12
  // src/config/envConfig.ts
13
13
  function getEnvVar(key, fallback) {
@@ -191,10 +191,17 @@ var subscriptionApi = {
191
191
  }
192
192
  return apiRequest(endpoint, "DELETE", void 0, { projectId: getDefaultProjectId() });
193
193
  },
194
- checkoutInfo: async (planCode, externalId, billableMetricCode) => {
194
+ checkoutInfo: async (planCode, externalId, options) => {
195
195
  let endpoint = `${ENDPOINTS.CHECKOUT}/info/${planCode}/${externalId}`;
196
- if (billableMetricCode) {
197
- endpoint += `?billableMetricCode=${encodeURIComponent(billableMetricCode)}`;
196
+ const params = new URLSearchParams();
197
+ if (options == null ? void 0 : options.billableMetricCode) {
198
+ params.append("billableMetricCode", options.billableMetricCode);
199
+ }
200
+ if (options == null ? void 0 : options.currency) {
201
+ params.append("currency", options.currency);
202
+ }
203
+ if (params.toString()) {
204
+ endpoint += `?${params.toString()}`;
198
205
  }
199
206
  return apiRequest(endpoint, "GET", void 0, { projectId: getDefaultProjectId() });
200
207
  }
@@ -227,10 +234,10 @@ var transactionApi = {
227
234
  getInvoice: (transactionId) => apiRequest(`${ENDPOINTS.TRANSACTIONS}/${transactionId}/invoice`)
228
235
  };
229
236
  var useSubscription = () => {
230
- const [subscription, setSubscription] = React9.useState(null);
231
- const [loading, setLoading] = React9.useState(false);
232
- const [error, setError] = React9.useState(null);
233
- const fetchSubscription = React9.useCallback(async (externalId) => {
237
+ const [subscription, setSubscription] = React10.useState(null);
238
+ const [loading, setLoading] = React10.useState(false);
239
+ const [error, setError] = React10.useState(null);
240
+ const fetchSubscription = React10.useCallback(async (externalId) => {
234
241
  if (!externalId || externalId === "undefined" || externalId.trim() === "") {
235
242
  setError("Invalid user ID. Please ensure you are properly authenticated.");
236
243
  setLoading(false);
@@ -255,7 +262,7 @@ var useSubscription = () => {
255
262
  setLoading(false);
256
263
  }
257
264
  }, [loading]);
258
- const clearSubscription = React9.useCallback(() => {
265
+ const clearSubscription = React10.useCallback(() => {
259
266
  setSubscription(null);
260
267
  setError(null);
261
268
  }, []);
@@ -389,17 +396,184 @@ var formatDate = (dateString, format = "date") => {
389
396
  day: "numeric"
390
397
  }).format(date);
391
398
  };
399
+ var UpgradeContext = React10.createContext(void 0);
400
+ var UpgradeProvider = ({ children }) => {
401
+ const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] = React10.useState(false);
402
+ const setUpgradeSummaryVisible = (visible) => {
403
+ setIsUpgradeSummaryVisible(visible);
404
+ };
405
+ const clearUpgradeSelection = () => {
406
+ setIsUpgradeSummaryVisible(false);
407
+ };
408
+ return /* @__PURE__ */ jsxRuntime.jsx(
409
+ UpgradeContext.Provider,
410
+ {
411
+ value: {
412
+ isUpgradeSummaryVisible,
413
+ setUpgradeSummaryVisible,
414
+ clearUpgradeSelection
415
+ },
416
+ children
417
+ }
418
+ );
419
+ };
420
+ var useUpgrade = () => {
421
+ const context = React10.useContext(UpgradeContext);
422
+ if (context === void 0) {
423
+ throw new Error("useUpgrade must be used within an UpgradeProvider");
424
+ }
425
+ return context;
426
+ };
427
+
428
+ // src/utils/currency.ts
429
+ var CURRENCY_SYMBOLS = {
430
+ USD: "$",
431
+ INR: "\u20B9",
432
+ EUR: "\u20AC",
433
+ GBP: "\xA3",
434
+ AUD: "A$",
435
+ CAD: "C$",
436
+ JPY: "\xA5"
437
+ };
438
+ function getCurrencySymbol(code) {
439
+ if (!code) return "$";
440
+ const upper = code.toUpperCase();
441
+ return CURRENCY_SYMBOLS[upper] ?? "$";
442
+ }
443
+ function mapCountryToCurrency(countryCode) {
444
+ const countryToCurrency = {
445
+ // North America
446
+ US: "usd",
447
+ CA: "cad",
448
+ MX: "mxn",
449
+ // Europe
450
+ GB: "gbp",
451
+ DE: "eur",
452
+ FR: "eur",
453
+ IT: "eur",
454
+ ES: "eur",
455
+ NL: "eur",
456
+ BE: "eur",
457
+ AT: "eur",
458
+ PT: "eur",
459
+ IE: "eur",
460
+ FI: "eur",
461
+ GR: "eur",
462
+ LU: "eur",
463
+ CH: "chf",
464
+ SE: "sek",
465
+ NO: "nok",
466
+ DK: "dkk",
467
+ PL: "pln",
468
+ CZ: "czk",
469
+ HU: "huf",
470
+ RO: "ron",
471
+ // Asia
472
+ IN: "inr",
473
+ CN: "cny",
474
+ JP: "jpy",
475
+ KR: "krw",
476
+ SG: "sgd",
477
+ HK: "hkd",
478
+ TW: "twd",
479
+ MY: "myr",
480
+ TH: "thb",
481
+ ID: "idr",
482
+ PH: "php",
483
+ VN: "vnd",
484
+ BD: "bdt",
485
+ PK: "pkr",
486
+ LK: "lkr",
487
+ // Oceania
488
+ AU: "aud",
489
+ NZ: "nzd",
490
+ // Middle East
491
+ AE: "aed",
492
+ SA: "sar",
493
+ IL: "ils",
494
+ TR: "try",
495
+ QA: "qar",
496
+ KW: "kwd",
497
+ OM: "omr",
498
+ BH: "bhd",
499
+ // Africa
500
+ ZA: "zar",
501
+ EG: "egp",
502
+ NG: "ngn",
503
+ KE: "kes",
504
+ // South America
505
+ BR: "brl",
506
+ AR: "ars",
507
+ CL: "clp",
508
+ CO: "cop",
509
+ PE: "pen"
510
+ };
511
+ return countryToCurrency[countryCode] || "USD";
512
+ }
513
+ var CurrencyContext = React10.createContext(void 0);
514
+ var useCurrency = () => {
515
+ const context = React10.useContext(CurrencyContext);
516
+ if (context === void 0) {
517
+ throw new Error("useCurrency must be used within a CurrencyProvider");
518
+ }
519
+ return context;
520
+ };
521
+ var CurrencyProvider = ({
522
+ children,
523
+ ipInfoToken,
524
+ defaultCurrency = "USD",
525
+ skipAutoDetect = false
526
+ }) => {
527
+ const [country, setCountry] = React10.useState(null);
528
+ const [currency, setCurrencyState] = React10.useState(defaultCurrency);
529
+ const [isLoading, setIsLoading] = React10.useState(!skipAutoDetect);
530
+ const [error, setError] = React10.useState(null);
531
+ React10.useEffect(() => {
532
+ if (skipAutoDetect) {
533
+ setIsLoading(false);
534
+ return;
535
+ }
536
+ const fetchCountryAndCurrency = async () => {
537
+ try {
538
+ setIsLoading(true);
539
+ setError(null);
540
+ const url = ipInfoToken ? `https://ipinfo.io/json?token=${ipInfoToken}` : "https://ipinfo.io/json";
541
+ const response = await fetch(url);
542
+ if (!response.ok) {
543
+ throw new Error("Failed to fetch location data");
544
+ }
545
+ const data = await response.json();
546
+ const detectedCountry = data.country;
547
+ setCountry(detectedCountry);
548
+ const detectedCurrency = mapCountryToCurrency(detectedCountry);
549
+ setCurrencyState(detectedCurrency);
550
+ console.log("Currency detected:", { country: detectedCountry, currency: detectedCurrency });
551
+ } catch (err) {
552
+ console.error("Error fetching location:", err);
553
+ setError(err instanceof Error ? err.message : "Unknown error");
554
+ } finally {
555
+ setIsLoading(false);
556
+ }
557
+ };
558
+ fetchCountryAndCurrency();
559
+ }, [ipInfoToken, skipAutoDetect]);
560
+ const setCurrency = (newCurrency) => {
561
+ setCurrencyState(newCurrency);
562
+ };
563
+ return /* @__PURE__ */ jsxRuntime.jsx(CurrencyContext.Provider, { value: { country, currency, isLoading, error, setCurrency }, children });
564
+ };
392
565
 
393
566
  // src/hooks/usePlans.ts
394
567
  var usePlans = () => {
395
- const [plans, setPlans] = React9.useState([]);
396
- const [filteredPlans, setFilteredPlans] = React9.useState([]);
397
- const [selectedPlan, setSelectedPlan] = React9.useState(null);
398
- const [tierFilter, setTierFilter] = React9.useState("all");
399
- const [billingCycle, setBillingCycle] = React9.useState("monthly");
400
- const [loading, setLoading] = React9.useState(false);
401
- const [error, setError] = React9.useState(null);
402
- const fetchPlans = React9.useCallback(async () => {
568
+ const { currency } = useCurrency();
569
+ const [plans, setPlans] = React10.useState([]);
570
+ const [filteredPlans, setFilteredPlans] = React10.useState([]);
571
+ const [selectedPlan, setSelectedPlan] = React10.useState(null);
572
+ const [tierFilter, setTierFilter] = React10.useState("all");
573
+ const [billingCycle, setBillingCycle] = React10.useState("monthly");
574
+ const [loading, setLoading] = React10.useState(false);
575
+ const [error, setError] = React10.useState(null);
576
+ const fetchPlans = React10.useCallback(async () => {
403
577
  if (loading) return;
404
578
  setLoading(true);
405
579
  setError(null);
@@ -421,7 +595,7 @@ var usePlans = () => {
421
595
  setLoading(false);
422
596
  }
423
597
  }, [loading]);
424
- React9.useEffect(() => {
598
+ React10.useEffect(() => {
425
599
  if (plans.length > 0 && tierFilter === "all") {
426
600
  const uniqueUnits = getUniqueCandidateUnits(plans);
427
601
  if (uniqueUnits.length > 0) {
@@ -429,21 +603,22 @@ var usePlans = () => {
429
603
  }
430
604
  }
431
605
  }, [plans, tierFilter]);
432
- React9.useEffect(() => {
606
+ React10.useEffect(() => {
433
607
  let filtered = [...plans];
434
608
  filtered = filterPlansByBillingCycle(filtered, billingCycle);
435
609
  filtered = filterPlansByTier(filtered, tierFilter);
436
610
  setFilteredPlans(filtered);
437
611
  }, [plans, tierFilter, billingCycle]);
438
- const handlePlanSelect = React9.useCallback((plan) => {
612
+ const handlePlanSelect = React10.useCallback((plan) => {
439
613
  setSelectedPlan(plan);
440
614
  }, []);
441
- const handleUpgrade = React9.useCallback(async (externalId) => {
615
+ const handleUpgrade = React10.useCallback(async (externalId) => {
442
616
  var _a;
443
617
  if (!selectedPlan) return;
444
618
  try {
445
619
  const response = await plansApi.createPaymentSession(selectedPlan.code, {
446
- externalId
620
+ externalId,
621
+ currency
447
622
  // billableMetricCode: "CANDIDATES"
448
623
  });
449
624
  if (response.success && ((_a = response.data) == null ? void 0 : _a.checkoutUrl)) {
@@ -456,15 +631,15 @@ var usePlans = () => {
456
631
  console.error("Error creating payment session:", error2);
457
632
  alert("An error occurred. Please try again.");
458
633
  }
459
- }, [selectedPlan]);
460
- const clearPlans = React9.useCallback(() => {
634
+ }, [selectedPlan, currency]);
635
+ const clearPlans = React10.useCallback(() => {
461
636
  setPlans([]);
462
637
  setFilteredPlans([]);
463
638
  setSelectedPlan(null);
464
639
  setError(null);
465
640
  setTierFilter("all");
466
641
  }, []);
467
- const clearSelectedPlan2 = React9.useCallback(() => {
642
+ const clearSelectedPlan2 = React10.useCallback(() => {
468
643
  setSelectedPlan(null);
469
644
  }, []);
470
645
  const dropdownOptions = getDropdownOptions(plans);
@@ -550,18 +725,18 @@ var useTransactions = ({
550
725
  initialFilters = {},
551
726
  autoFetch = false
552
727
  }) => {
553
- const [transactions, setTransactions] = React9.useState([]);
554
- const [allTransactions, setAllTransactions] = React9.useState([]);
555
- const [loading, setLoading] = React9.useState(false);
556
- const [error, setError] = React9.useState(null);
557
- const [filters, setFilters] = React9.useState({
728
+ const [transactions, setTransactions] = React10.useState([]);
729
+ const [allTransactions, setAllTransactions] = React10.useState([]);
730
+ const [loading, setLoading] = React10.useState(false);
731
+ const [error, setError] = React10.useState(null);
732
+ const [filters, setFilters] = React10.useState({
558
733
  ...DEFAULT_FILTERS,
559
734
  ...initialFilters
560
735
  });
561
- const [meta, setMeta] = React9.useState(null);
562
- const [isBackendPaginated, setIsBackendPaginated] = React9.useState(false);
563
- const hasAutoFetchedRef = React9.useRef(false);
564
- const fetchTransactions = React9.useCallback(async () => {
736
+ const [meta, setMeta] = React10.useState(null);
737
+ const [isBackendPaginated, setIsBackendPaginated] = React10.useState(false);
738
+ const hasAutoFetchedRef = React10.useRef(false);
739
+ const fetchTransactions = React10.useCallback(async () => {
565
740
  if (!externalId) return;
566
741
  setLoading(true);
567
742
  setError(null);
@@ -600,7 +775,7 @@ var useTransactions = ({
600
775
  setLoading(false);
601
776
  }
602
777
  }, [externalId, filters]);
603
- const updateFilters = React9.useCallback((newFilters) => {
778
+ const updateFilters = React10.useCallback((newFilters) => {
604
779
  setFilters((prev) => ({
605
780
  ...prev,
606
781
  ...newFilters,
@@ -608,7 +783,7 @@ var useTransactions = ({
608
783
  page: newFilters.page !== void 0 ? newFilters.page : 1
609
784
  }));
610
785
  }, []);
611
- React9.useEffect(() => {
786
+ React10.useEffect(() => {
612
787
  if (!isBackendPaginated && allTransactions.length > 0) {
613
788
  const filteredTransactions = applyFrontendFilters(allTransactions, filters);
614
789
  const paginatedResult = applyFrontendPagination(filteredTransactions, filters);
@@ -616,19 +791,19 @@ var useTransactions = ({
616
791
  setMeta(paginatedResult.meta);
617
792
  }
618
793
  }, [filters, allTransactions, isBackendPaginated]);
619
- const clearFilters = React9.useCallback(() => {
794
+ const clearFilters = React10.useCallback(() => {
620
795
  setFilters(DEFAULT_FILTERS);
621
796
  }, []);
622
- const refetch = React9.useCallback(async () => {
797
+ const refetch = React10.useCallback(async () => {
623
798
  await fetchTransactions();
624
799
  }, [fetchTransactions]);
625
- React9.useEffect(() => {
800
+ React10.useEffect(() => {
626
801
  if (autoFetch && externalId && !hasAutoFetchedRef.current) {
627
802
  hasAutoFetchedRef.current = true;
628
803
  fetchTransactions();
629
804
  }
630
805
  }, [autoFetch, externalId, fetchTransactions]);
631
- React9.useEffect(() => {
806
+ React10.useEffect(() => {
632
807
  if (!autoFetch) return;
633
808
  const hasNonPaginationFilters = filters.startDate !== void 0 || filters.endDate !== void 0 || filters.status !== void 0;
634
809
  const shouldFetch = isBackendPaginated || allTransactions.length === 0 && hasNonPaginationFilters;
@@ -655,10 +830,10 @@ var usePagination = ({
655
830
  initialPage = 1,
656
831
  initialLimit = 10
657
832
  } = {}) => {
658
- const [currentPage, setCurrentPage] = React9.useState(initialPage);
659
- const [limit, setLimitState] = React9.useState(initialLimit);
660
- const [meta, setMeta] = React9.useState(null);
661
- const goToPage = React9.useCallback((page) => {
833
+ const [currentPage, setCurrentPage] = React10.useState(initialPage);
834
+ const [limit, setLimitState] = React10.useState(initialLimit);
835
+ const [meta, setMeta] = React10.useState(null);
836
+ const goToPage = React10.useCallback((page) => {
662
837
  if (meta) {
663
838
  const validPage = Math.max(1, Math.min(page, meta.totalPages));
664
839
  setCurrentPage(validPage);
@@ -666,29 +841,29 @@ var usePagination = ({
666
841
  setCurrentPage(Math.max(1, page));
667
842
  }
668
843
  }, [meta]);
669
- const goToNextPage = React9.useCallback(() => {
844
+ const goToNextPage = React10.useCallback(() => {
670
845
  if (meta && meta.hasNextPage) {
671
846
  setCurrentPage((prev) => prev + 1);
672
847
  }
673
848
  }, [meta]);
674
- const goToPreviousPage = React9.useCallback(() => {
849
+ const goToPreviousPage = React10.useCallback(() => {
675
850
  if (meta && meta.hasPreviousPage) {
676
851
  setCurrentPage((prev) => prev - 1);
677
852
  }
678
853
  }, [meta]);
679
- const goToFirstPage = React9.useCallback(() => {
854
+ const goToFirstPage = React10.useCallback(() => {
680
855
  setCurrentPage(1);
681
856
  }, []);
682
- const goToLastPage = React9.useCallback(() => {
857
+ const goToLastPage = React10.useCallback(() => {
683
858
  if (meta) {
684
859
  setCurrentPage(meta.totalPages);
685
860
  }
686
861
  }, [meta]);
687
- const setLimit = React9.useCallback((newLimit) => {
862
+ const setLimit = React10.useCallback((newLimit) => {
688
863
  setLimitState(newLimit);
689
864
  setCurrentPage(1);
690
865
  }, []);
691
- const reset = React9.useCallback(() => {
866
+ const reset = React10.useCallback(() => {
692
867
  setCurrentPage(initialPage);
693
868
  setLimitState(initialLimit);
694
869
  setMeta(null);
@@ -711,9 +886,9 @@ var useCancelSubscription = ({
711
886
  onSuccess,
712
887
  onError
713
888
  } = {}) => {
714
- const [loading, setLoading] = React9.useState(false);
715
- const [error, setError] = React9.useState(null);
716
- const cancelSubscription = React9.useCallback(async (externalId, options) => {
889
+ const [loading, setLoading] = React10.useState(false);
890
+ const [error, setError] = React10.useState(null);
891
+ const cancelSubscription = React10.useCallback(async (externalId, options) => {
717
892
  if (!externalId) {
718
893
  const errorMsg = "External ID is required";
719
894
  setError(errorMsg);
@@ -742,7 +917,7 @@ var useCancelSubscription = ({
742
917
  setLoading(false);
743
918
  }
744
919
  }, [onSuccess, onError]);
745
- const reset = React9.useCallback(() => {
920
+ const reset = React10.useCallback(() => {
746
921
  setLoading(false);
747
922
  setError(null);
748
923
  }, []);
@@ -758,9 +933,9 @@ var useCustomerPortal = ({
758
933
  onError,
759
934
  returnPath = "/dashboard"
760
935
  } = {}) => {
761
- const [loading, setLoading] = React9.useState(false);
762
- const [error, setError] = React9.useState(null);
763
- const openCustomerPortal = React9.useCallback(async (externalId) => {
936
+ const [loading, setLoading] = React10.useState(false);
937
+ const [error, setError] = React10.useState(null);
938
+ const openCustomerPortal = React10.useCallback(async (externalId) => {
764
939
  var _a;
765
940
  if (!externalId) {
766
941
  const errorMsg = "External ID is required";
@@ -797,7 +972,7 @@ var useCustomerPortal = ({
797
972
  setLoading(false);
798
973
  }
799
974
  }, [onSuccess, onError, returnPath]);
800
- const reset = React9.useCallback(() => {
975
+ const reset = React10.useCallback(() => {
801
976
  setLoading(false);
802
977
  setError(null);
803
978
  }, []);
@@ -808,34 +983,6 @@ var useCustomerPortal = ({
808
983
  reset
809
984
  };
810
985
  };
811
- var UpgradeContext = React9.createContext(void 0);
812
- var UpgradeProvider = ({ children }) => {
813
- const [isUpgradeSummaryVisible, setIsUpgradeSummaryVisible] = React9.useState(false);
814
- const setUpgradeSummaryVisible = (visible) => {
815
- setIsUpgradeSummaryVisible(visible);
816
- };
817
- const clearUpgradeSelection = () => {
818
- setIsUpgradeSummaryVisible(false);
819
- };
820
- return /* @__PURE__ */ jsxRuntime.jsx(
821
- UpgradeContext.Provider,
822
- {
823
- value: {
824
- isUpgradeSummaryVisible,
825
- setUpgradeSummaryVisible,
826
- clearUpgradeSelection
827
- },
828
- children
829
- }
830
- );
831
- };
832
- var useUpgrade = () => {
833
- const context = React9.useContext(UpgradeContext);
834
- if (context === void 0) {
835
- throw new Error("useUpgrade must be used within an UpgradeProvider");
836
- }
837
- return context;
838
- };
839
986
  var BillingCycleToggle = ({
840
987
  billingCycle,
841
988
  onBillingCycleChange,
@@ -914,8 +1061,8 @@ var TierFilterDropdown = ({
914
1061
  selectedValue,
915
1062
  onSelect
916
1063
  }) => {
917
- const dropdownRef = React9.useRef(null);
918
- React9.useEffect(() => {
1064
+ const dropdownRef = React10.useRef(null);
1065
+ React10.useEffect(() => {
919
1066
  const handleClickOutside = (event) => {
920
1067
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
921
1068
  if (isOpen) {
@@ -1280,7 +1427,7 @@ var PlanSelector = ({
1280
1427
  onBillingCycleChange,
1281
1428
  activePlanCode
1282
1429
  }) => {
1283
- const [isDropdownOpen, setIsDropdownOpen] = React9.useState(false);
1430
+ const [isDropdownOpen, setIsDropdownOpen] = React10.useState(false);
1284
1431
  const handleDropdownToggle = () => {
1285
1432
  setIsDropdownOpen(!isDropdownOpen);
1286
1433
  };
@@ -1608,7 +1755,7 @@ var Layout = ({ children, hideHeader = false, hideFooter = false }) => {
1608
1755
  ] });
1609
1756
  };
1610
1757
  var usePaymentParams = () => {
1611
- return React9.useMemo(() => {
1758
+ return React10.useMemo(() => {
1612
1759
  const params = new URLSearchParams(window.location.search);
1613
1760
  return {
1614
1761
  gateway: params.get("gateway") || void 0,
@@ -1639,7 +1786,7 @@ var PaymentSuccessPage = ({
1639
1786
  initialFilters: { page: 1, limit: 100 },
1640
1787
  autoFetch: !!externalId
1641
1788
  });
1642
- const invoiceDownloadUrl = React9.useMemo(() => {
1789
+ const invoiceDownloadUrl = React10.useMemo(() => {
1643
1790
  if (propInvoiceDownloadUrl) return propInvoiceDownloadUrl;
1644
1791
  if (!transactions || transactions.length === 0) return void 0;
1645
1792
  const withOrder = transactions.filter((t) => typeof t.order === "number");
@@ -1802,7 +1949,16 @@ var TransactionItem = ({
1802
1949
  " discount"
1803
1950
  ] })
1804
1951
  ] }),
1805
- showFields.status && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getStatusColor(transaction.transactionStatus, customStatusColors)}`, children: transaction.transactionStatus === "payment_failed" ? "Failed" : transaction.transactionStatus === "succeeded" ? "Succeeded" : transaction.transactionStatus }),
1952
+ showFields.status && /* @__PURE__ */ jsxRuntime.jsx(
1953
+ "span",
1954
+ {
1955
+ className: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getStatusColor(
1956
+ transaction.transactionStatus,
1957
+ customStatusColors
1958
+ )}`,
1959
+ children: transaction.transactionStatus === "payment_failed" ? "Failed" : transaction.transactionStatus === "succeeded" ? "Succeeded" : transaction.transactionStatus === "activated" ? "Activated" : transaction.transactionStatus
1960
+ }
1961
+ ),
1806
1962
  showFields.invoice && showInvoiceButton && transaction.invoice_pdf && /* @__PURE__ */ jsxRuntime.jsx(
1807
1963
  "button",
1808
1964
  {
@@ -2144,7 +2300,7 @@ var TransactionPagination = ({
2144
2300
  children: "Previous"
2145
2301
  }
2146
2302
  ),
2147
- /* @__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(
2303
+ /* @__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(
2148
2304
  "button",
2149
2305
  {
2150
2306
  onClick: () => onPageChange(page),
@@ -2190,7 +2346,7 @@ var TransactionModal = ({
2190
2346
  autoFetch: true
2191
2347
  // Enable auto-fetch so it works when modal opens
2192
2348
  });
2193
- React9.useEffect(() => {
2349
+ React10.useEffect(() => {
2194
2350
  if (isOpen && externalId) {
2195
2351
  fetchTransactions();
2196
2352
  }
@@ -2705,10 +2861,10 @@ var SubscriptionDetails = ({
2705
2861
  customActions = [],
2706
2862
  className = ""
2707
2863
  }) => {
2708
- const [isTransactionModalOpen, setIsTransactionModalOpen] = React9.useState(false);
2709
- const [showCancelConfirmation, setShowCancelConfirmation] = React9.useState(false);
2710
- const [localSubscription, setLocalSubscription] = React9.useState(subscription);
2711
- React9.useEffect(() => {
2864
+ const [isTransactionModalOpen, setIsTransactionModalOpen] = React10.useState(false);
2865
+ const [showCancelConfirmation, setShowCancelConfirmation] = React10.useState(false);
2866
+ const [localSubscription, setLocalSubscription] = React10.useState(subscription);
2867
+ React10.useEffect(() => {
2712
2868
  setLocalSubscription(subscription);
2713
2869
  }, [subscription]);
2714
2870
  const { cancelSubscription, loading: cancelLoading } = useCancelSubscription({
@@ -2833,9 +2989,10 @@ var UpgradeSummary = ({
2833
2989
  isVisible = true,
2834
2990
  billableMetricCode
2835
2991
  }) => {
2836
- const [checkoutInfo, setCheckoutInfo] = React9.useState(null);
2837
- const [loading, setLoading] = React9.useState(false);
2838
- React9.useEffect(() => {
2992
+ const { currency } = useCurrency();
2993
+ const [checkoutInfo, setCheckoutInfo] = React10.useState(null);
2994
+ const [loading, setLoading] = React10.useState(false);
2995
+ React10.useEffect(() => {
2839
2996
  const planToDisplay2 = selectedPlan || currentPlan;
2840
2997
  if (!planToDisplay2 || !isVisible || Number(planToDisplay2.fixedCost) === 0) {
2841
2998
  setCheckoutInfo(null);
@@ -2859,7 +3016,10 @@ var UpgradeSummary = ({
2859
3016
  const fetchCheckoutInfo = async () => {
2860
3017
  setLoading(true);
2861
3018
  try {
2862
- const response = await subscriptionApi.checkoutInfo(selectedPlan.code, externalId, billableMetricCode);
3019
+ const response = await subscriptionApi.checkoutInfo(selectedPlan.code, externalId, {
3020
+ billableMetricCode,
3021
+ currency
3022
+ });
2863
3023
  const dataWrapper = response == null ? void 0 : response.data;
2864
3024
  if ((dataWrapper == null ? void 0 : dataWrapper.success) && (dataWrapper == null ? void 0 : dataWrapper.data)) {
2865
3025
  setCheckoutInfo(dataWrapper.data);
@@ -2871,7 +3031,7 @@ var UpgradeSummary = ({
2871
3031
  }
2872
3032
  };
2873
3033
  fetchCheckoutInfo();
2874
- }, [selectedPlan, currentPlan, externalId, isVisible, billableMetricCode]);
3034
+ }, [selectedPlan, currentPlan, externalId, isVisible, billableMetricCode, currency]);
2875
3035
  const planToDisplay = selectedPlan || currentPlan;
2876
3036
  const isShowingCurrentPlan = !selectedPlan && currentPlan;
2877
3037
  if (!planToDisplay || !isVisible || Number(planToDisplay.fixedCost) === 0 || loading || !checkoutInfo) {
@@ -2881,6 +3041,7 @@ var UpgradeSummary = ({
2881
3041
  const intervalDisplay = displayInfo.planInterval === "MONTHLY" ? "Mo" : "Yr";
2882
3042
  const dueToday = displayInfo.proration > 0 ? displayInfo.proration : displayInfo.planPrice;
2883
3043
  const shouldContactSupport = !!displayInfo.contactSupport;
3044
+ const currencySymbol = getCurrencySymbol(displayInfo.planCurrency);
2884
3045
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
2885
3046
  "div",
2886
3047
  {
@@ -2916,7 +3077,7 @@ var UpgradeSummary = ({
2916
3077
  className: "text-2xl font-semibold",
2917
3078
  style: { color: "var(--subos-foreground, #1e293b)" },
2918
3079
  children: [
2919
- "$",
3080
+ currencySymbol,
2920
3081
  displayInfo.planPrice,
2921
3082
  "/",
2922
3083
  intervalDisplay
@@ -2939,7 +3100,7 @@ var UpgradeSummary = ({
2939
3100
  className: "text-xl font-semibold",
2940
3101
  style: { color: "var(--subos-foreground, #1e293b)" },
2941
3102
  children: [
2942
- "$",
3103
+ currencySymbol,
2943
3104
  dueToday
2944
3105
  ]
2945
3106
  }
@@ -2987,9 +3148,9 @@ var UpgradeSummary = ({
2987
3148
  }
2988
3149
  ) }) });
2989
3150
  };
2990
- var SubOSThemeContext = React9.createContext(void 0);
3151
+ var SubOSThemeContext = React10.createContext(void 0);
2991
3152
  var useSubOSTheme = () => {
2992
- const context = React9.useContext(SubOSThemeContext);
3153
+ const context = React10.useContext(SubOSThemeContext);
2993
3154
  if (!context) {
2994
3155
  throw new Error("useSubOSTheme must be used within a SubOSThemeProvider");
2995
3156
  }
@@ -3000,8 +3161,8 @@ var SubOSThemeProvider = ({
3000
3161
  theme = {},
3001
3162
  className = ""
3002
3163
  }) => {
3003
- const [currentTheme, setCurrentTheme] = React9__default.default.useState(theme);
3004
- const cssVariables = React9__default.default.useMemo(() => {
3164
+ const [currentTheme, setCurrentTheme] = React10__default.default.useState(theme);
3165
+ const cssVariables = React10__default.default.useMemo(() => {
3005
3166
  const vars = {};
3006
3167
  if (currentTheme.primaryColors) {
3007
3168
  Object.entries(currentTheme.primaryColors).forEach(([key, value]) => {
@@ -3050,7 +3211,7 @@ var SubOSThemeProvider = ({
3050
3211
  if (currentTheme.shadowCardHover) vars["--subos-shadow-card-hover"] = currentTheme.shadowCardHover;
3051
3212
  return vars;
3052
3213
  }, [currentTheme]);
3053
- const contextValue = React9__default.default.useMemo(() => ({
3214
+ const contextValue = React10__default.default.useMemo(() => ({
3054
3215
  theme: currentTheme,
3055
3216
  setTheme: setCurrentTheme
3056
3217
  }), [currentTheme]);
@@ -3065,7 +3226,7 @@ var SubOSThemeProvider = ({
3065
3226
  };
3066
3227
  var useApplyHostTheme = (hostTheme) => {
3067
3228
  const { setTheme } = useSubOSTheme();
3068
- React9__default.default.useEffect(() => {
3229
+ React10__default.default.useEffect(() => {
3069
3230
  if (hostTheme) {
3070
3231
  setTheme(hostTheme);
3071
3232
  }
@@ -3145,7 +3306,7 @@ var Pagination = ({
3145
3306
  children: "Previous"
3146
3307
  }
3147
3308
  ),
3148
- 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(
3309
+ 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(
3149
3310
  "button",
3150
3311
  {
3151
3312
  onClick: () => onPageChange(page),
@@ -3172,15 +3333,15 @@ var DashboardPage = ({
3172
3333
  var _a, _b, _c;
3173
3334
  const subscription = useSubscription();
3174
3335
  const plans = usePlans();
3175
- const lastLoadedIdRef = React9.useRef(null);
3176
- React9.useEffect(() => {
3336
+ const lastLoadedIdRef = React10.useRef(null);
3337
+ React10.useEffect(() => {
3177
3338
  if (lastLoadedIdRef.current !== externalId) {
3178
3339
  subscription.fetchSubscription(externalId);
3179
3340
  plans.fetchPlans();
3180
3341
  lastLoadedIdRef.current = externalId;
3181
3342
  }
3182
3343
  }, [externalId]);
3183
- React9.useEffect(() => {
3344
+ React10.useEffect(() => {
3184
3345
  registerClearSelectedPlan(plans.clearSelectedPlan);
3185
3346
  return () => {
3186
3347
  unregisterClearSelectedPlan();
@@ -3244,9 +3405,9 @@ var DashboardPage = ({
3244
3405
  ] }) }) });
3245
3406
  };
3246
3407
  var useProcessPaymentCancel = (params) => {
3247
- const [loading, setLoading] = React9.useState(true);
3248
- const [error, setError] = React9.useState(null);
3249
- React9.useEffect(() => {
3408
+ const [loading, setLoading] = React10.useState(true);
3409
+ const [error, setError] = React10.useState(null);
3410
+ React10.useEffect(() => {
3250
3411
  const run = async () => {
3251
3412
  try {
3252
3413
  const qs = new URLSearchParams({
@@ -3283,12 +3444,12 @@ var PaymentCancelPage = () => {
3283
3444
  };
3284
3445
  var PaymentCancelPage_default = PaymentCancelPage;
3285
3446
  var App = function App2({ externalId }) {
3286
- return /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
3447
+ return /* @__PURE__ */ jsxRuntime.jsx(CurrencyProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
3287
3448
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/", element: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "/dashboard", replace: true }) }),
3288
3449
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/dashboard", element: /* @__PURE__ */ jsxRuntime.jsx(DashboardPage, { externalId }) }),
3289
3450
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/payment-success", element: /* @__PURE__ */ jsxRuntime.jsx(PaymentSuccessPage_default, {}) }),
3290
3451
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "/payment-cancel", element: /* @__PURE__ */ jsxRuntime.jsx(PaymentCancelPage_default, {}) })
3291
- ] }) });
3452
+ ] }) }) });
3292
3453
  };
3293
3454
 
3294
3455
  exports.AddCardIcon = AddCardIcon;
@@ -3300,6 +3461,7 @@ exports.ChangeCardButton = ChangeCardButton;
3300
3461
  exports.CheckCircleIcon = CheckCircleIcon;
3301
3462
  exports.CheckIcon = CheckIcon;
3302
3463
  exports.CreditCardIcon = CreditCardIcon;
3464
+ exports.CurrencyProvider = CurrencyProvider;
3303
3465
  exports.DashboardIcon = DashboardIcon;
3304
3466
  exports.DashboardPage = DashboardPage;
3305
3467
  exports.DeleteIcon = DeleteIcon;
@@ -3364,6 +3526,7 @@ exports.transactionApi = transactionApi;
3364
3526
  exports.unregisterClearSelectedPlan = unregisterClearSelectedPlan;
3365
3527
  exports.useApplyHostTheme = useApplyHostTheme;
3366
3528
  exports.useCancelSubscription = useCancelSubscription;
3529
+ exports.useCurrency = useCurrency;
3367
3530
  exports.useCustomerPortal = useCustomerPortal;
3368
3531
  exports.usePagination = usePagination;
3369
3532
  exports.usePlans = usePlans;