@burdenoff/microfe-billing 2026.1108.1 → 2026.1108.2
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/billing/BillingAdminRoutes.d.ts +1 -2
- package/dist/billing/BillingAdminRoutes.js +11 -12
- package/dist/billing/BillingAdminRoutes.js.map +1 -1
- package/dist/billing/BillingRoot.d.ts +0 -1
- package/dist/billing/BillingRoot.js +10 -9
- package/dist/billing/BillingRoot.js.map +1 -1
- package/dist/billing/BillingUserRoutes.d.ts +1 -2
- package/dist/billing/BillingUserRoutes.js +13 -14
- package/dist/billing/BillingUserRoutes.js.map +1 -1
- package/dist/billing/hooks/useBillingAccountSelection.d.ts +0 -1
- package/dist/billing/hooks/useBillingAccountSelection.js +7 -5
- package/dist/billing/hooks/useBillingAccountSelection.js.map +1 -1
- package/dist/billing/hooks/useBillingEventEmitter.d.ts +0 -1
- package/dist/billing/hooks/useBillingEventEmitter.js +1 -2
- package/dist/billing/hooks/useBillingEventEmitter.js.map +1 -1
- package/dist/billing/hooks/useBillingNavigate.d.ts +0 -1
- package/dist/billing/hooks/useBillingNavigate.js +1 -2
- package/dist/billing/hooks/useBillingNavigate.js.map +1 -1
- package/dist/billing/hooks/useBillingPermissions.d.ts +0 -1
- package/dist/billing/hooks/useBillingPermissions.js +2 -3
- package/dist/billing/hooks/useBillingPermissions.js.map +1 -1
- package/dist/billing/hooks/useDefaultBillingCurrency.d.ts +0 -1
- package/dist/billing/hooks/useDefaultBillingCurrency.js +1 -2
- package/dist/billing/hooks/useDefaultBillingCurrency.js.map +1 -1
- package/dist/billing/hooks/useProducts.d.ts +0 -1
- package/dist/billing/hooks/useProducts.js +1 -2
- package/dist/billing/hooks/useProducts.js.map +1 -1
- package/dist/billing/index.d.ts +0 -1
- package/dist/billing/lib/native-purchases.d.ts +0 -1
- package/dist/billing/lib/native-purchases.js +1 -2
- package/dist/billing/lib/native-purchases.js.map +1 -1
- package/dist/billing/modules/addons/components/FloatingCartDrawer.d.ts +0 -1
- package/dist/billing/modules/addons/components/FloatingCartDrawer.js +4 -5
- package/dist/billing/modules/addons/components/FloatingCartDrawer.js.map +1 -1
- package/dist/billing/modules/addons/hooks/index.d.ts +0 -1
- package/dist/billing/modules/addons/hooks/index.js +3 -2
- package/dist/billing/modules/addons/hooks/useAddonPurchaseEligibility.d.ts +0 -1
- package/dist/billing/modules/addons/hooks/useAddonPurchaseEligibility.js +1 -2
- package/dist/billing/modules/addons/hooks/useAddonPurchaseEligibility.js.map +1 -1
- package/dist/billing/modules/addons/hooks/useAddons.d.ts +0 -1
- package/dist/billing/modules/addons/hooks/useAddons.js +1 -2
- package/dist/billing/modules/addons/hooks/useAddons.js.map +1 -1
- package/dist/billing/modules/addons/index.d.ts +0 -1
- package/dist/billing/modules/addons/index.js +10 -10
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.d.ts +0 -1
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +15 -16
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.d.ts +0 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +11 -12
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.d.ts +0 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +16 -17
- package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.d.ts +0 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js +16 -17
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.d.ts +0 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +111 -106
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.d.ts +0 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.js +105 -100
- package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/index.d.ts +0 -1
- package/dist/billing/modules/addons/pages/index.js +7 -6
- package/dist/billing/modules/addons/store/addonCartStore.d.ts +0 -1
- package/dist/billing/modules/addons/store/addonCartStore.js +2 -7
- package/dist/billing/modules/addons/store/addonCartStore.js.map +1 -1
- package/dist/billing/modules/affiliate/api.d.ts +0 -1
- package/dist/billing/modules/affiliate/api.js +1 -2
- package/dist/billing/modules/affiliate/api.js.map +1 -1
- package/dist/billing/modules/affiliate/index.d.ts +0 -1
- package/dist/billing/modules/affiliate/index.js +1 -2
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.d.ts +0 -1
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +29 -28
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/index.d.ts +0 -1
- package/dist/billing/modules/analytics/index.js +1 -2
- package/dist/billing/modules/analytics/pages/AnalyticsPage.d.ts +0 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +8 -9
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/index.d.ts +0 -1
- package/dist/billing/modules/analytics/pages/index.js +1 -1
- package/dist/billing/modules/billing/hooks/index.d.ts +0 -1
- package/dist/billing/modules/billing/hooks/index.js +5 -4
- package/dist/billing/modules/billing/hooks/useInvoices.d.ts +0 -1
- package/dist/billing/modules/billing/hooks/useInvoices.js +1 -2
- package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
- package/dist/billing/modules/billing/hooks/useOrderCallbacks.d.ts +0 -1
- package/dist/billing/modules/billing/hooks/useOrderCallbacks.js +1 -2
- package/dist/billing/modules/billing/hooks/useOrderCallbacks.js.map +1 -1
- package/dist/billing/modules/billing/hooks/usePayments.d.ts +0 -1
- package/dist/billing/modules/billing/hooks/useRefunds.d.ts +0 -1
- package/dist/billing/modules/billing/hooks/useRefunds.js +1 -2
- package/dist/billing/modules/billing/hooks/useRefunds.js.map +1 -1
- package/dist/billing/modules/billing/hooks/useTransactions.d.ts +0 -1
- package/dist/billing/modules/billing/hooks/useTransactions.js +30 -31
- package/dist/billing/modules/billing/hooks/useTransactions.js.map +1 -1
- package/dist/billing/modules/billing/index.d.ts +0 -1
- package/dist/billing/modules/billing/index.js +15 -15
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +11 -12
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +53 -59
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +81 -87
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +11 -12
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +51 -54
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js +33 -34
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js +92 -93
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js +38 -39
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.d.ts +0 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +24 -30
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/index.d.ts +0 -1
- package/dist/billing/modules/billing/pages/index.js +10 -9
- package/dist/billing/modules/checkout/components/AutoPayToggle.d.ts +0 -1
- package/dist/billing/modules/checkout/components/BillingAccountSelector.d.ts +0 -1
- package/dist/billing/modules/checkout/components/BillingAccountSelector.js +1 -2
- package/dist/billing/modules/checkout/components/BillingAccountSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/CompactAutoPayToggle.d.ts +0 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.d.ts +0 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js +1 -2
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/CreditsAmountInput.d.ts +0 -1
- package/dist/billing/modules/checkout/components/CreditsAmountInput.js +1 -2
- package/dist/billing/modules/checkout/components/CreditsAmountInput.js.map +1 -1
- package/dist/billing/modules/checkout/components/CreditsPaymentOption.d.ts +0 -1
- package/dist/billing/modules/checkout/components/CurrencySelector.d.ts +0 -1
- package/dist/billing/modules/checkout/components/NativeCheckoutView.d.ts +0 -1
- package/dist/billing/modules/checkout/components/NativeCheckoutView.js +1 -2
- package/dist/billing/modules/checkout/components/NativeCheckoutView.js.map +1 -1
- package/dist/billing/modules/checkout/components/OrderSummary.d.ts +0 -1
- package/dist/billing/modules/checkout/components/OrderSummary.js +35 -32
- package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -1
- package/dist/billing/modules/checkout/components/PaymentProviderSelector.d.ts +0 -1
- package/dist/billing/modules/checkout/components/PromoCodeInput.d.ts +0 -1
- package/dist/billing/modules/checkout/components/PromoCodeInput.js +1 -2
- package/dist/billing/modules/checkout/components/PromoCodeInput.js.map +1 -1
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.d.ts +0 -1
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js +1 -2
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js.map +1 -1
- package/dist/billing/modules/checkout/components/SavedCardSelector.d.ts +0 -1
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.d.ts +0 -1
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.js +1 -2
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.js.map +1 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.d.ts +0 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.js +5 -3
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/components/StripePaymentForm.d.ts +0 -1
- package/dist/billing/modules/checkout/components/StripePaymentForm.js +35 -41
- package/dist/billing/modules/checkout/components/StripePaymentForm.js.map +1 -1
- package/dist/billing/modules/checkout/components/SubscriptionSelector.d.ts +0 -1
- package/dist/billing/modules/checkout/components/SubscriptionSelector.js +1 -2
- package/dist/billing/modules/checkout/components/SubscriptionSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.d.ts +0 -1
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.js +1 -2
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/WebCheckoutRedirectView.d.ts +0 -1
- package/dist/billing/modules/checkout/components/WebCheckoutRedirectView.js +5 -6
- package/dist/billing/modules/checkout/components/WebCheckoutRedirectView.js.map +1 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.d.ts +0 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js +7 -8
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/index.d.ts +0 -1
- package/dist/billing/modules/checkout/components/index.js +12 -11
- package/dist/billing/modules/checkout/hooks/index.d.ts +0 -1
- package/dist/billing/modules/checkout/hooks/index.js +5 -4
- package/dist/billing/modules/checkout/hooks/useCheckout.d.ts +0 -1
- package/dist/billing/modules/checkout/hooks/useCheckout.js +182 -195
- package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.d.ts +0 -1
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.js +33 -32
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.d.ts +0 -1
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.js +1 -2
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.d.ts +0 -1
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.js +1 -2
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useStoreShipping.d.ts +4 -8
- package/dist/billing/modules/checkout/hooks/useStoreShipping.js +1 -2
- package/dist/billing/modules/checkout/hooks/useStoreShipping.js.map +1 -1
- package/dist/billing/modules/checkout/index.d.ts +0 -1
- package/dist/billing/modules/checkout/index.js +19 -19
- package/dist/billing/modules/checkout/pages/CheckoutPage.d.ts +0 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +730 -732
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/checkout/pages/index.d.ts +0 -1
- package/dist/billing/modules/checkout/pages/index.js +1 -1
- package/dist/billing/modules/checkout/types/index.d.ts +0 -1
- package/dist/billing/modules/checkout/utils/storeOrder.d.ts +0 -1
- package/dist/billing/modules/checkout/utils/storeOrder.js +0 -1
- package/dist/billing/modules/checkout/utils/storeOrder.js.map +1 -1
- package/dist/billing/modules/coupons/index.d.ts +0 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.d.ts +0 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +5 -6
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.d.ts +0 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +15 -13
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.d.ts +0 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +12 -10
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.d.ts +0 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +7 -11
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/index.d.ts +0 -1
- package/dist/billing/modules/coupons/pages/index.js +5 -4
- package/dist/billing/modules/credits/hooks/index.d.ts +0 -1
- package/dist/billing/modules/credits/hooks/useCredits.d.ts +0 -1
- package/dist/billing/modules/credits/hooks/useCredits.js +20 -21
- package/dist/billing/modules/credits/hooks/useCredits.js.map +1 -1
- package/dist/billing/modules/credits/index.d.ts +0 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.d.ts +0 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +19 -24
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.d.ts +0 -1
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +26 -27
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.d.ts +0 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +54 -52
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.d.ts +0 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js +37 -38
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/index.d.ts +0 -1
- package/dist/billing/modules/credits/pages/index.js +5 -4
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.d.ts +0 -1
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.js +2 -3
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.js.map +1 -1
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.d.ts +0 -1
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js +35 -43
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js.map +1 -1
- package/dist/billing/modules/dashboard/components/BillingAccountCard.d.ts +0 -1
- package/dist/billing/modules/dashboard/components/BillingAccountCard.js +1 -2
- package/dist/billing/modules/dashboard/components/BillingAccountCard.js.map +1 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.d.ts +0 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +1 -2
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.d.ts +0 -1
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.js +2 -5
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.js.map +1 -1
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.d.ts +0 -1
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js +1 -2
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js.map +1 -1
- package/dist/billing/modules/dashboard/components/index.d.ts +0 -1
- package/dist/billing/modules/dashboard/components/index.js +7 -6
- package/dist/billing/modules/dashboard/hooks/index.d.ts +0 -1
- package/dist/billing/modules/dashboard/hooks/index.js +3 -2
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.d.ts +0 -1
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.js +2 -3
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.js.map +1 -1
- package/dist/billing/modules/dashboard/hooks/useDashboard.d.ts +0 -1
- package/dist/billing/modules/dashboard/hooks/useDashboard.js +2 -3
- package/dist/billing/modules/dashboard/hooks/useDashboard.js.map +1 -1
- package/dist/billing/modules/dashboard/index.d.ts +0 -1
- package/dist/billing/modules/dashboard/index.js +11 -10
- package/dist/billing/modules/dashboard/pages/OverviewPage.d.ts +0 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +266 -264
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/index.d.ts +0 -1
- package/dist/billing/modules/dashboard/pages/index.js +1 -1
- package/dist/billing/modules/discounts/index.d.ts +0 -1
- package/dist/billing/modules/discounts/index.js +1 -2
- package/dist/billing/modules/discounts/pages/DiscountsListPage.d.ts +0 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +169 -176
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/discounts/pages/index.d.ts +0 -1
- package/dist/billing/modules/discounts/pages/index.js +1 -1
- package/dist/billing/modules/earnings/api.d.ts +0 -1
- package/dist/billing/modules/earnings/api.js +66 -67
- package/dist/billing/modules/earnings/api.js.map +1 -1
- package/dist/billing/modules/earnings/index.d.ts +0 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.d.ts +0 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +17 -17
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.d.ts +0 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +188 -189
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.d.ts +0 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +111 -111
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.d.ts +0 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +29 -30
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.d.ts +0 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +103 -104
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/earnings/payoutAccountStatus.d.ts +0 -1
- package/dist/billing/modules/earnings/payoutAccountStatus.js +1 -2
- package/dist/billing/modules/earnings/payoutAccountStatus.js.map +1 -1
- package/dist/billing/modules/plans/constants/enterprise.d.ts +0 -1
- package/dist/billing/modules/plans/constants/enterprise.js +1 -2
- package/dist/billing/modules/plans/constants/enterprise.js.map +1 -1
- package/dist/billing/modules/plans/constants/featuredQuotas.d.ts +0 -1
- package/dist/billing/modules/plans/constants/featuredQuotas.js +1 -2
- package/dist/billing/modules/plans/constants/featuredQuotas.js.map +1 -1
- package/dist/billing/modules/plans/hooks/index.d.ts +0 -1
- package/dist/billing/modules/plans/hooks/index.js +3 -2
- package/dist/billing/modules/plans/hooks/usePlans.d.ts +0 -1
- package/dist/billing/modules/plans/hooks/usePlans.js +1 -2
- package/dist/billing/modules/plans/hooks/usePlans.js.map +1 -1
- package/dist/billing/modules/plans/hooks/useQuotas.d.ts +0 -1
- package/dist/billing/modules/plans/hooks/useQuotas.js +1 -2
- package/dist/billing/modules/plans/hooks/useQuotas.js.map +1 -1
- package/dist/billing/modules/plans/index.d.ts +0 -1
- package/dist/billing/modules/plans/index.js +11 -11
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.d.ts +0 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +12 -15
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.d.ts +0 -1
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +38 -39
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.d.ts +0 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +10 -11
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.d.ts +0 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +40 -41
- package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.d.ts +0 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js +15 -16
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.d.ts +0 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +18 -19
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.d.ts +0 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +100 -101
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/index.d.ts +0 -1
- package/dist/billing/modules/plans/pages/index.js +8 -7
- package/dist/billing/modules/plans/utils/currencyPriceOverrides.d.ts +0 -1
- package/dist/billing/modules/plans/utils/currencyPriceOverrides.js +1 -2
- package/dist/billing/modules/plans/utils/currencyPriceOverrides.js.map +1 -1
- package/dist/billing/modules/plans/utils/planSelector.d.ts +0 -1
- package/dist/billing/modules/plans/utils/planSelector.js +1 -2
- package/dist/billing/modules/plans/utils/planSelector.js.map +1 -1
- package/dist/billing/modules/promotions/index.d.ts +0 -1
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.d.ts +0 -1
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +5 -6
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/PromotionsListPage.d.ts +0 -1
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js +5 -6
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/index.d.ts +0 -1
- package/dist/billing/modules/promotions/pages/index.js +3 -2
- package/dist/billing/modules/quota/hooks/index.d.ts +0 -1
- package/dist/billing/modules/quota/hooks/index.js +1 -1
- package/dist/billing/modules/quota/hooks/useQuota.d.ts +0 -1
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.d.ts +0 -1
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.js +1 -2
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.js.map +1 -1
- package/dist/billing/modules/quota/index.d.ts +0 -1
- package/dist/billing/modules/quota/index.js +8 -8
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.d.ts +0 -1
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js +12 -15
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaPage.d.ts +0 -1
- package/dist/billing/modules/quota/pages/QuotaPage.js +3 -3
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.d.ts +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +13 -14
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.d.ts +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +9 -10
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.d.ts +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +12 -13
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.d.ts +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +16 -17
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/index.d.ts +0 -1
- package/dist/billing/modules/quota/pages/index.js +6 -5
- package/dist/billing/modules/quota/utils/quotaSelector.d.ts +0 -1
- package/dist/billing/modules/quota/utils/quotaSelector.js +1 -2
- package/dist/billing/modules/quota/utils/quotaSelector.js.map +1 -1
- package/dist/billing/modules/settings/index.d.ts +0 -1
- package/dist/billing/modules/settings/pages/SettingsPage.d.ts +0 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js +12 -13
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.d.ts +0 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +32 -32
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/index.d.ts +0 -1
- package/dist/billing/modules/settings/pages/index.js +3 -2
- package/dist/billing/modules/store/graphql/index.d.ts +0 -1
- package/dist/billing/modules/store/index.d.ts +0 -1
- package/dist/billing/modules/store/index.js +1 -2
- package/dist/billing/modules/store/pages/StoreCheckoutPage.d.ts +0 -1
- package/dist/billing/modules/store/pages/StoreCheckoutPage.js +1 -2
- package/dist/billing/modules/store/pages/StoreCheckoutPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.d.ts +0 -1
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js +9 -11
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js.map +1 -1
- package/dist/billing/modules/subscriptions/hooks/index.d.ts +0 -1
- package/dist/billing/modules/subscriptions/hooks/index.js +1 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts +0 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js +1 -2
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js.map +1 -1
- package/dist/billing/modules/subscriptions/index.d.ts +0 -1
- package/dist/billing/modules/subscriptions/index.js +6 -6
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.d.ts +0 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +311 -312
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.d.ts +0 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +61 -62
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.d.ts +0 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +30 -31
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/index.d.ts +0 -1
- package/dist/billing/modules/subscriptions/pages/index.js +4 -3
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.d.ts +0 -1
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js +17 -18
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.js.map +1 -1
- package/dist/billing/modules/usage/hooks/index.d.ts +0 -1
- package/dist/billing/modules/usage/hooks/useUsage.d.ts +0 -1
- package/dist/billing/modules/usage/hooks/useUsage.js +72 -73
- package/dist/billing/modules/usage/hooks/useUsage.js.map +1 -1
- package/dist/billing/modules/usage/hooks/useWorkspaceAiSpend.d.ts +0 -1
- package/dist/billing/modules/usage/hooks/useWorkspaceAiSpend.js +12 -13
- package/dist/billing/modules/usage/hooks/useWorkspaceAiSpend.js.map +1 -1
- package/dist/billing/modules/usage/index.d.ts +0 -1
- package/dist/billing/modules/usage/index.js +1 -2
- package/dist/billing/modules/usage/pages/UsagePage.d.ts +0 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +229 -227
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/modules/usage/pages/index.d.ts +0 -1
- package/dist/billing/modules/usage/pages/index.js +1 -1
- package/dist/billing/modules/usage/utils/aiSpend.d.ts +0 -1
- package/dist/billing/modules/usage/utils/aiSpend.js +2 -3
- package/dist/billing/modules/usage/utils/aiSpend.js.map +1 -1
- package/dist/billing/providers/BillingProvider.d.ts +0 -1
- package/dist/billing/providers/BillingProvider.js +3 -4
- package/dist/billing/providers/BillingProvider.js.map +1 -1
- package/dist/billing/shared/components/AccessDenied.d.ts +0 -1
- package/dist/billing/shared/components/AccessDenied.js +1 -2
- package/dist/billing/shared/components/AccessDenied.js.map +1 -1
- package/dist/billing/shared/components/ActorIdentity.d.ts +0 -1
- package/dist/billing/shared/components/ActorIdentity.js +2 -3
- package/dist/billing/shared/components/ActorIdentity.js.map +1 -1
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.d.ts +0 -1
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.js +1 -2
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.js.map +1 -1
- package/dist/billing/shared/components/EmptyState.d.ts +0 -1
- package/dist/billing/shared/components/EmptyState.js +1 -2
- package/dist/billing/shared/components/EmptyState.js.map +1 -1
- package/dist/billing/shared/components/GeoPricingOverridesEditor.d.ts +0 -1
- package/dist/billing/shared/components/PageHeader.d.ts +0 -1
- package/dist/billing/shared/components/PageHeader.js +1 -2
- package/dist/billing/shared/components/PageHeader.js.map +1 -1
- package/dist/billing/shared/components/PushPermissionNudge.d.ts +0 -1
- package/dist/billing/shared/components/PushPermissionNudge.js +2 -3
- package/dist/billing/shared/components/PushPermissionNudge.js.map +1 -1
- package/dist/billing/shared/components/ServerError.d.ts +0 -1
- package/dist/billing/shared/components/ServerError.js +1 -2
- package/dist/billing/shared/components/ServerError.js.map +1 -1
- package/dist/billing/shared/components/StatCard.d.ts +0 -1
- package/dist/billing/shared/components/StatCard.js +1 -2
- package/dist/billing/shared/components/StatCard.js.map +1 -1
- package/dist/billing/shared/components/index.d.ts +0 -1
- package/dist/billing/shared/components/index.js +8 -7
- package/dist/billing/shared/hooks/index.d.ts +0 -1
- package/dist/billing/shared/hooks/index.js +1 -1
- package/dist/billing/shared/hooks/useActorProfiles.d.ts +0 -1
- package/dist/billing/shared/hooks/useActorProfiles.js +4 -8
- package/dist/billing/shared/hooks/useActorProfiles.js.map +1 -1
- package/dist/billing/shared/hooks/useTr.d.ts +0 -1
- package/dist/billing/shared/hooks/useTr.js +1 -2
- package/dist/billing/shared/hooks/useTr.js.map +1 -1
- package/dist/billing/shared/index.d.ts +0 -1
- package/dist/billing/shared/types/graphql.d.ts +0 -1
- package/dist/billing/shared/types/graphql.js +1 -2
- package/dist/billing/shared/types/graphql.js.map +1 -1
- package/dist/billing/shared/types/index.d.ts +0 -1
- package/dist/billing/shared/ui/Card.d.ts +1 -2
- package/dist/billing/shared/ui/Card.js +1 -2
- package/dist/billing/shared/ui/Card.js.map +1 -1
- package/dist/billing/shared/ui/MetricCard.d.ts +1 -2
- package/dist/billing/shared/ui/MetricCard.js +1 -2
- package/dist/billing/shared/ui/MetricCard.js.map +1 -1
- package/dist/billing/shared/ui/ProgressBar.d.ts +1 -2
- package/dist/billing/shared/ui/ProgressBar.js +1 -2
- package/dist/billing/shared/ui/ProgressBar.js.map +1 -1
- package/dist/billing/shared/ui/SectionHeader.d.ts +1 -2
- package/dist/billing/shared/ui/StatusPill.d.ts +1 -2
- package/dist/billing/shared/ui/StatusPill.js +1 -2
- package/dist/billing/shared/ui/StatusPill.js.map +1 -1
- package/dist/billing/shared/ui/index.d.ts +0 -1
- package/dist/billing/shared/ui/index.js +5 -4
- package/dist/billing/shared/utils/directActivityGraphql.d.ts +0 -1
- package/dist/billing/shared/utils/directBillingGraphql.d.ts +0 -1
- package/dist/billing/shared/utils/directBillingGraphql.js +1 -2
- package/dist/billing/shared/utils/directBillingGraphql.js.map +1 -1
- package/dist/billing/shared/utils/error.d.ts +0 -1
- package/dist/billing/shared/utils/error.js +1 -2
- package/dist/billing/shared/utils/error.js.map +1 -1
- package/dist/billing/shared/utils/format.d.ts +0 -1
- package/dist/billing/shared/utils/format.js +1 -2
- package/dist/billing/shared/utils/format.js.map +1 -1
- package/dist/billing/shared/utils/gatewayGraphql.d.ts +0 -1
- package/dist/billing/shared/utils/gatewayGraphql.js +2 -3
- package/dist/billing/shared/utils/gatewayGraphql.js.map +1 -1
- package/dist/billing/shared/utils/index.d.ts +0 -1
- package/dist/billing/shared/utils/index.js +9 -8
- package/dist/billing/shared/utils/navigation.d.ts +0 -1
- package/dist/billing/shared/utils/navigation.js +1 -2
- package/dist/billing/shared/utils/navigation.js.map +1 -1
- package/dist/billing/shared/utils/paymentTheme.d.ts +0 -1
- package/dist/billing/shared/utils/paymentTheme.js +2 -3
- package/dist/billing/shared/utils/paymentTheme.js.map +1 -1
- package/dist/billing/shared/utils/planFeatureQuantity.d.ts +0 -1
- package/dist/billing/shared/utils/planFeatureQuantity.js +2 -3
- package/dist/billing/shared/utils/planFeatureQuantity.js.map +1 -1
- package/dist/billing/shared/utils/status.d.ts +0 -1
- package/dist/billing/shared/utils/status.js +24 -25
- package/dist/billing/shared/utils/status.js.map +1 -1
- package/dist/billing/shared/utils/tokens.d.ts +0 -1
- package/dist/billing/shared/utils/tokens.js +1 -2
- package/dist/billing/shared/utils/tokens.js.map +1 -1
- package/dist/billing/translations/en.d.ts +0 -1
- package/dist/billing/types/index.d.ts +0 -1
- package/dist/dev/main.d.ts +0 -1
- package/dist/generated/global-operations.d.ts +3252 -3206
- package/dist/generated/global-operations.js +445 -422
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +2 -22
- package/dist/generated/global-types.js +1 -2
- package/dist/generated/global-types.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +76 -47
- package/dist/generated/wspace-operations.js +2 -3
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +4 -24
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/node_modules/@capacitor/core/dist/index.js +12 -14
- package/dist/node_modules/@capacitor/core/dist/index.js.map +1 -1
- package/dist/node_modules/sonner/dist/index.js +75 -69
- package/dist/node_modules/sonner/dist/index.js.map +1 -1
- package/dist/utils/nativeBridge.d.ts +0 -1
- package/dist/utils/nativeBridge.js +1 -2
- package/package.json +65 -54
- package/dist/billing/BillingAdminRoutes.d.ts.map +0 -1
- package/dist/billing/BillingRoot.d.ts.map +0 -1
- package/dist/billing/BillingUserRoutes.d.ts.map +0 -1
- package/dist/billing/hooks/useBillingAccountSelection.d.ts.map +0 -1
- package/dist/billing/hooks/useBillingEventEmitter.d.ts.map +0 -1
- package/dist/billing/hooks/useBillingNavigate.d.ts.map +0 -1
- package/dist/billing/hooks/useBillingPermissions.d.ts.map +0 -1
- package/dist/billing/hooks/useDefaultBillingCurrency.d.ts.map +0 -1
- package/dist/billing/hooks/useProducts.d.ts.map +0 -1
- package/dist/billing/index.d.ts.map +0 -1
- package/dist/billing/lib/native-purchases.d.ts.map +0 -1
- package/dist/billing/modules/addons/components/FloatingCartDrawer.d.ts.map +0 -1
- package/dist/billing/modules/addons/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/addons/hooks/useAddonPurchaseEligibility.d.ts.map +0 -1
- package/dist/billing/modules/addons/hooks/useAddons.d.ts.map +0 -1
- package/dist/billing/modules/addons/index.d.ts.map +0 -1
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.d.ts.map +0 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.d.ts.map +0 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.d.ts.map +0 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.d.ts.map +0 -1
- package/dist/billing/modules/addons/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/addons/store/addonCartStore.d.ts.map +0 -1
- package/dist/billing/modules/affiliate/api.d.ts.map +0 -1
- package/dist/billing/modules/affiliate/index.d.ts.map +0 -1
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.d.ts.map +0 -1
- package/dist/billing/modules/analytics/index.d.ts.map +0 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.d.ts.map +0 -1
- package/dist/billing/modules/analytics/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/billing/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/billing/hooks/useInvoices.d.ts.map +0 -1
- package/dist/billing/modules/billing/hooks/useOrderCallbacks.d.ts.map +0 -1
- package/dist/billing/modules/billing/hooks/usePayments.d.ts.map +0 -1
- package/dist/billing/modules/billing/hooks/useRefunds.d.ts.map +0 -1
- package/dist/billing/modules/billing/hooks/useTransactions.d.ts.map +0 -1
- package/dist/billing/modules/billing/index.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/RefundsPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.d.ts.map +0 -1
- package/dist/billing/modules/billing/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/AutoPayToggle.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/BillingAccountSelector.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/CompactAutoPayToggle.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/CreditsAmountInput.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/CreditsPaymentOption.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/CurrencySelector.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/NativeCheckoutView.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/OrderSummary.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/PaymentProviderSelector.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/PromoCodeInput.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/SavedCardSelector.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/StripePaymentForm.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/SubscriptionSelector.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/WebCheckoutRedirectView.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.d.ts.map +0 -1
- package/dist/billing/modules/checkout/components/index.d.ts.map +0 -1
- package/dist/billing/modules/checkout/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/checkout/hooks/useCheckout.d.ts.map +0 -1
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.d.ts.map +0 -1
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.d.ts.map +0 -1
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.d.ts.map +0 -1
- package/dist/billing/modules/checkout/hooks/useStoreShipping.d.ts.map +0 -1
- package/dist/billing/modules/checkout/index.d.ts.map +0 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.d.ts.map +0 -1
- package/dist/billing/modules/checkout/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/checkout/types/index.d.ts.map +0 -1
- package/dist/billing/modules/checkout/utils/storeOrder.d.ts.map +0 -1
- package/dist/billing/modules/coupons/index.d.ts.map +0 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.d.ts.map +0 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.d.ts.map +0 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.d.ts.map +0 -1
- package/dist/billing/modules/coupons/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/credits/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/credits/hooks/useCredits.d.ts.map +0 -1
- package/dist/billing/modules/credits/index.d.ts.map +0 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.d.ts.map +0 -1
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.d.ts.map +0 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.d.ts.map +0 -1
- package/dist/billing/modules/credits/pages/CreditsPage.d.ts.map +0 -1
- package/dist/billing/modules/credits/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/components/BillingAccountCard.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/components/index.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/hooks/useDashboard.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/index.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.d.ts.map +0 -1
- package/dist/billing/modules/dashboard/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/discounts/index.d.ts.map +0 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.d.ts.map +0 -1
- package/dist/billing/modules/discounts/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/earnings/api.d.ts.map +0 -1
- package/dist/billing/modules/earnings/index.d.ts.map +0 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.d.ts.map +0 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.d.ts.map +0 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.d.ts.map +0 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.d.ts.map +0 -1
- package/dist/billing/modules/earnings/payoutAccountStatus.d.ts.map +0 -1
- package/dist/billing/modules/plans/constants/enterprise.d.ts.map +0 -1
- package/dist/billing/modules/plans/constants/featuredQuotas.d.ts.map +0 -1
- package/dist/billing/modules/plans/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/plans/hooks/usePlans.d.ts.map +0 -1
- package/dist/billing/modules/plans/hooks/useQuotas.d.ts.map +0 -1
- package/dist/billing/modules/plans/index.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/PlansListPage.d.ts.map +0 -1
- package/dist/billing/modules/plans/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/plans/utils/currencyPriceOverrides.d.ts.map +0 -1
- package/dist/billing/modules/plans/utils/planSelector.d.ts.map +0 -1
- package/dist/billing/modules/promotions/index.d.ts.map +0 -1
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.d.ts.map +0 -1
- package/dist/billing/modules/promotions/pages/PromotionsListPage.d.ts.map +0 -1
- package/dist/billing/modules/promotions/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/quota/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/quota/hooks/useQuota.d.ts.map +0 -1
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.d.ts.map +0 -1
- package/dist/billing/modules/quota/index.d.ts.map +0 -1
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.d.ts.map +0 -1
- package/dist/billing/modules/quota/pages/QuotaPage.d.ts.map +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.d.ts.map +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.d.ts.map +0 -1
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.d.ts.map +0 -1
- package/dist/billing/modules/quota/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/quota/utils/quotaSelector.d.ts.map +0 -1
- package/dist/billing/modules/settings/index.d.ts.map +0 -1
- package/dist/billing/modules/settings/pages/SettingsPage.d.ts.map +0 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.d.ts.map +0 -1
- package/dist/billing/modules/settings/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/store/graphql/index.d.ts.map +0 -1
- package/dist/billing/modules/store/index.d.ts.map +0 -1
- package/dist/billing/modules/store/pages/StoreCheckoutPage.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/index.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.d.ts.map +0 -1
- package/dist/billing/modules/subscriptions/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/usage/components/WorkspaceAiSpendPanel.d.ts.map +0 -1
- package/dist/billing/modules/usage/hooks/index.d.ts.map +0 -1
- package/dist/billing/modules/usage/hooks/useUsage.d.ts.map +0 -1
- package/dist/billing/modules/usage/hooks/useWorkspaceAiSpend.d.ts.map +0 -1
- package/dist/billing/modules/usage/index.d.ts.map +0 -1
- package/dist/billing/modules/usage/pages/UsagePage.d.ts.map +0 -1
- package/dist/billing/modules/usage/pages/index.d.ts.map +0 -1
- package/dist/billing/modules/usage/utils/aiSpend.d.ts.map +0 -1
- package/dist/billing/providers/BillingProvider.d.ts.map +0 -1
- package/dist/billing/shared/components/AccessDenied.d.ts.map +0 -1
- package/dist/billing/shared/components/ActorIdentity.d.ts.map +0 -1
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.d.ts.map +0 -1
- package/dist/billing/shared/components/EmptyState.d.ts.map +0 -1
- package/dist/billing/shared/components/GeoPricingOverridesEditor.d.ts.map +0 -1
- package/dist/billing/shared/components/PageHeader.d.ts.map +0 -1
- package/dist/billing/shared/components/PushPermissionNudge.d.ts.map +0 -1
- package/dist/billing/shared/components/ServerError.d.ts.map +0 -1
- package/dist/billing/shared/components/StatCard.d.ts.map +0 -1
- package/dist/billing/shared/components/index.d.ts.map +0 -1
- package/dist/billing/shared/hooks/index.d.ts.map +0 -1
- package/dist/billing/shared/hooks/useActorProfiles.d.ts.map +0 -1
- package/dist/billing/shared/hooks/useTr.d.ts.map +0 -1
- package/dist/billing/shared/index.d.ts.map +0 -1
- package/dist/billing/shared/types/graphql.d.ts.map +0 -1
- package/dist/billing/shared/types/index.d.ts.map +0 -1
- package/dist/billing/shared/ui/Card.d.ts.map +0 -1
- package/dist/billing/shared/ui/MetricCard.d.ts.map +0 -1
- package/dist/billing/shared/ui/ProgressBar.d.ts.map +0 -1
- package/dist/billing/shared/ui/SectionHeader.d.ts.map +0 -1
- package/dist/billing/shared/ui/StatusPill.d.ts.map +0 -1
- package/dist/billing/shared/ui/index.d.ts.map +0 -1
- package/dist/billing/shared/utils/directActivityGraphql.d.ts.map +0 -1
- package/dist/billing/shared/utils/directBillingGraphql.d.ts.map +0 -1
- package/dist/billing/shared/utils/error.d.ts.map +0 -1
- package/dist/billing/shared/utils/format.d.ts.map +0 -1
- package/dist/billing/shared/utils/gatewayGraphql.d.ts.map +0 -1
- package/dist/billing/shared/utils/index.d.ts.map +0 -1
- package/dist/billing/shared/utils/navigation.d.ts.map +0 -1
- package/dist/billing/shared/utils/paymentTheme.d.ts.map +0 -1
- package/dist/billing/shared/utils/planFeatureQuantity.d.ts.map +0 -1
- package/dist/billing/shared/utils/status.d.ts.map +0 -1
- package/dist/billing/shared/utils/tokens.d.ts.map +0 -1
- package/dist/billing/translations/en.d.ts.map +0 -1
- package/dist/billing/types/index.d.ts.map +0 -1
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/utils/nativeBridge.d.ts.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { PageHeader as e } from "../../../shared/components/PageHeader.js";
|
|
2
|
-
import "../../../
|
|
3
|
-
import { formatCurrency as
|
|
2
|
+
import { useBillingNavigate as t } from "../../../hooks/useBillingNavigate.js";
|
|
3
|
+
import { formatCurrency as n, formatDateTime as r } from "../../../shared/utils/format.js";
|
|
4
4
|
import "../../../shared/utils/index.js";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
5
|
+
import "../../../shared/components/index.js";
|
|
6
|
+
import { useCreateRefundRecordMutation as ee, useGetBillingAccountsCheckoutQuery as te, useGetRefundRecordsQuery as i, useGetTransactionLazyQuery as a } from "../../../../generated/global-operations.js";
|
|
7
7
|
import { RefundRecordStatus as o } from "../../../../generated/global-types.js";
|
|
8
8
|
import { useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
9
9
|
import { CheckCircle as d, Clock as f, CreditCard as ne, Loader2 as p, PlusCircle as m, Search as h, X as g, XCircle as _ } from "lucide-react";
|
|
10
10
|
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
11
11
|
import { useI18n as b } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
12
12
|
import { IllustratedEmptyState as re, PagePurpose as ie } from "@burdenoff/fe-libs/ui";
|
|
13
|
-
|
|
13
|
+
// src/billing/modules/billing/pages/UserRefundsPage.tsx
|
|
14
14
|
var x = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, S = {
|
|
15
15
|
[o.Pending]: {
|
|
16
16
|
label: "In Review",
|
|
@@ -53,11 +53,11 @@ var C = () => {
|
|
|
53
53
|
let { t: f } = b(), _ = (e, t) => {
|
|
54
54
|
let n = f(e);
|
|
55
55
|
return n === e ? t : n;
|
|
56
|
-
}, S =
|
|
56
|
+
}, S = t(), [C, w] = u(!1), [T, E] = u(""), [D, O] = u(null), [k, A] = u(!1), [j, M] = u(""), [N, P] = u(""), [F, I] = u(null), [oe, L] = u(!1), { data: R, loading: z } = te({ fetchPolicy: "cache-and-network" }), B = c(() => R?.getBillingAccountsByOrg ?? [], [R]), [V, H] = u(void 0);
|
|
57
57
|
s(() => {
|
|
58
58
|
!V && B.length > 0 && H(B[0].id);
|
|
59
59
|
}, [B, V]);
|
|
60
|
-
let U = B.find((e) => e.id === V), [W, { data: G, loading: K, error: q }] =
|
|
60
|
+
let U = B.find((e) => e.id === V), [W, { data: G, loading: K, error: q }] = a({ fetchPolicy: "network-only" }), se = l("");
|
|
61
61
|
s(() => {
|
|
62
62
|
if (K) return;
|
|
63
63
|
let e = G?.getTransaction;
|
|
@@ -68,7 +68,8 @@ var C = () => {
|
|
|
68
68
|
q
|
|
69
69
|
]);
|
|
70
70
|
let J = (e, t) => {
|
|
71
|
-
|
|
71
|
+
let n = `${e}::${t}`;
|
|
72
|
+
se.current = n, O(null), A(!1), P(""), W({ variables: {
|
|
72
73
|
id: e,
|
|
73
74
|
billingAccountId: t
|
|
74
75
|
} });
|
|
@@ -76,7 +77,7 @@ var C = () => {
|
|
|
76
77
|
E(e), O(null), A(!1), P(""), x.test(e.trim()) && V && J(e.trim(), V);
|
|
77
78
|
}, le = (e) => {
|
|
78
79
|
H(e), O(null), A(!1), P(""), x.test(T.trim()) && J(T.trim(), e);
|
|
79
|
-
}, { data: ue, loading: de, refetch: fe } =
|
|
80
|
+
}, { data: ue, loading: de, refetch: fe } = i({
|
|
80
81
|
variables: {
|
|
81
82
|
billingAccountId: V,
|
|
82
83
|
pageSize: 20,
|
|
@@ -84,7 +85,7 @@ var C = () => {
|
|
|
84
85
|
},
|
|
85
86
|
skip: !V,
|
|
86
87
|
fetchPolicy: "cache-and-network"
|
|
87
|
-
}), Y = ue?.getRefundRecords.records ?? [], [X, { loading: Z }] =
|
|
88
|
+
}), Y = ue?.getRefundRecords.records ?? [], [X, { loading: Z }] = ee({ refetchQueries: ["GetRefundRecords"] }), pe = (e) => e ? e.stripePaymentId ? {
|
|
88
89
|
provider: "STRIPE",
|
|
89
90
|
gatewayPaymentId: e.stripePaymentId
|
|
90
91
|
} : e.razorpayPaymentId ? {
|
|
@@ -95,25 +96,19 @@ var C = () => {
|
|
|
95
96
|
I("Enter a valid transaction ID, an amount, and a reason.");
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
|
-
let
|
|
99
|
-
if (!
|
|
99
|
+
let t = pe(D);
|
|
100
|
+
if (!t) {
|
|
100
101
|
I("No payment gateway info found for this transaction. Please contact support.");
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
104
|
let r = parseFloat(N);
|
|
104
|
-
if (isNaN(r) || r <= 0)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
if (r > D.amount) {
|
|
109
|
-
I(`Cannot exceed the original payment amount (${t(D.amount, D.currency)}).`);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
try {
|
|
105
|
+
if (isNaN(r) || r <= 0) I("Please enter a valid amount greater than 0.");
|
|
106
|
+
else if (r > D.amount) I(`Cannot exceed the original payment amount (${n(D.amount, D.currency)}).`);
|
|
107
|
+
else try {
|
|
113
108
|
await X({ variables: {
|
|
114
109
|
billingAccountId: V,
|
|
115
|
-
provider:
|
|
116
|
-
gatewayPaymentId:
|
|
110
|
+
provider: t.provider,
|
|
111
|
+
gatewayPaymentId: t.gatewayPaymentId,
|
|
117
112
|
amount: r,
|
|
118
113
|
currency: D.currency ?? U?.currency ?? "USD",
|
|
119
114
|
transactionId: D.id,
|
|
@@ -238,7 +233,7 @@ var C = () => {
|
|
|
238
233
|
/* @__PURE__ */ v(d, { className: "size-3.5 text-status-success-text shrink-0" }),
|
|
239
234
|
/* @__PURE__ */ v("span", {
|
|
240
235
|
className: "font-medium text-text-primary",
|
|
241
|
-
children:
|
|
236
|
+
children: n(D.amount, D.currency)
|
|
242
237
|
}),
|
|
243
238
|
/* @__PURE__ */ v("span", {
|
|
244
239
|
className: "text-text-secondary",
|
|
@@ -246,7 +241,7 @@ var C = () => {
|
|
|
246
241
|
}),
|
|
247
242
|
/* @__PURE__ */ v("span", {
|
|
248
243
|
className: "text-text-secondary",
|
|
249
|
-
children:
|
|
244
|
+
children: r(D.createdAt)
|
|
250
245
|
}),
|
|
251
246
|
D.stripePaymentId && /* @__PURE__ */ v("span", {
|
|
252
247
|
className: "text-xs text-text-secondary",
|
|
@@ -296,7 +291,7 @@ var C = () => {
|
|
|
296
291
|
}),
|
|
297
292
|
/* @__PURE__ */ y("span", {
|
|
298
293
|
className: "text-xs text-text-secondary",
|
|
299
|
-
children: ["max ",
|
|
294
|
+
children: ["max ", n(D.amount, D.currency)]
|
|
300
295
|
})
|
|
301
296
|
]
|
|
302
297
|
})] }),
|
|
@@ -357,7 +352,7 @@ var C = () => {
|
|
|
357
352
|
children: [
|
|
358
353
|
/* @__PURE__ */ v("span", {
|
|
359
354
|
className: "text-sm font-medium text-text-primary",
|
|
360
|
-
children:
|
|
355
|
+
children: n(e.amount, e.currency)
|
|
361
356
|
}),
|
|
362
357
|
/* @__PURE__ */ v(ae, { status: e.status }),
|
|
363
358
|
e.purchaseDetail && /* @__PURE__ */ v("span", {
|
|
@@ -379,10 +374,10 @@ var C = () => {
|
|
|
379
374
|
className: "text-right shrink-0",
|
|
380
375
|
children: [/* @__PURE__ */ v("p", {
|
|
381
376
|
className: "text-xs text-text-secondary",
|
|
382
|
-
children:
|
|
377
|
+
children: r(e.createdAt)
|
|
383
378
|
}), e.processedAt && /* @__PURE__ */ y("p", {
|
|
384
379
|
className: "text-xs text-text-secondary mt-0.5",
|
|
385
|
-
children: ["Processed ",
|
|
380
|
+
children: ["Processed ", r(e.processedAt)]
|
|
386
381
|
})]
|
|
387
382
|
})]
|
|
388
383
|
}, e.id))
|
|
@@ -404,7 +399,6 @@ var C = () => {
|
|
|
404
399
|
]
|
|
405
400
|
});
|
|
406
401
|
};
|
|
407
|
-
//#endregion
|
|
408
402
|
export { C as UserRefundsPage };
|
|
409
403
|
|
|
410
404
|
//# sourceMappingURL=UserRefundsPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserRefundsPage.js","names":[],"sources":["../../../../../src/billing/modules/billing/pages/UserRefundsPage.tsx"],"sourcesContent":["/**\n * Billing Module - User Refunds Page\n * Shows the user's refund request history and allows submitting new requests.\n */\n\nimport { useState, useEffect, useMemo, useRef, type FC, type FormEvent } from 'react';\nimport {\n PlusCircle,\n X,\n Clock,\n CheckCircle,\n XCircle,\n Loader2,\n Search,\n CreditCard,\n} from 'lucide-react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { formatCurrency, formatDateTime } from '../../../shared/utils';\nimport { PageHeader } from '../../../shared/components';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n useGetBillingAccountsCheckoutQuery,\n useGetTransactionLazyQuery,\n useGetRefundRecordsQuery,\n useCreateRefundRecordMutation,\n type GetRefundRecordsQuery,\n type GetTransactionQuery,\n} from '../../../../generated/global-operations';\nimport { RefundRecordStatus } from '../../../../generated/global-types';\n\ntype RefundItem = NonNullable<GetRefundRecordsQuery['getRefundRecords']['records']>[number];\ntype TxnLookup = NonNullable<GetTransactionQuery['getTransaction']>;\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// ============================================================================\n// Status helpers\n// ============================================================================\n\nconst STATUS_CONFIG: Record<\n RefundRecordStatus,\n { label: string; className: string; icon: FC<{ className?: string }> }\n> = {\n [RefundRecordStatus.Pending]: {\n label: 'In Review',\n className: 'bg-status-warning-bg/20 text-status-warning-text border-status-warning-border',\n icon: ({ className }) => <Clock className={className} />,\n },\n [RefundRecordStatus.Processing]: {\n label: 'Processing',\n className: 'bg-action-primary-bg/15 text-action-primary-bg border-action-primary-bg/30',\n icon: ({ className }) => <Loader2 className={`${className} animate-spin`} />,\n },\n [RefundRecordStatus.Completed]: {\n label: 'Refunded',\n className: 'bg-status-success-bg/20 text-status-success-text border-status-success-border',\n icon: ({ className }) => <CheckCircle className={className} />,\n },\n [RefundRecordStatus.Failed]: {\n label: 'Failed',\n className: 'bg-status-error-bg/20 text-status-error-text border-status-error-border',\n icon: ({ className }) => <XCircle className={className} />,\n },\n [RefundRecordStatus.Skipped]: {\n label: 'Closed',\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }) => <XCircle className={className} />,\n },\n};\n\nfunction StatusBadge({ status }: { status: string }) {\n const cfg = STATUS_CONFIG[status as RefundRecordStatus] ?? {\n label: status,\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }: { className?: string }) => <Clock className={className} />,\n };\n const Icon = cfg.icon;\n return (\n <span\n className={`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${cfg.className}`}\n >\n <Icon className=\"size-3\" />\n {cfg.label}\n </span>\n );\n}\n\n// ============================================================================\n// Main page\n// ============================================================================\n\nexport const UserRefundsPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => {\n const v = t(key);\n return v === key ? fallback : v;\n };\n const navigateTo = useBillingNavigate();\n\n // Form state\n const [showForm, setShowForm] = useState(false);\n const [txnIdInput, setTxnIdInput] = useState('');\n const [lookedUpTxn, setLookedUpTxn] = useState<TxnLookup | null>(null);\n const [txnNotFound, setTxnNotFound] = useState(false);\n const [reason, setReason] = useState('');\n const [amount, setAmount] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n const [formSuccess, setFormSuccess] = useState(false);\n\n // All billing accounts\n const { data: accountsData, loading: accountsLoading } = useGetBillingAccountsCheckoutQuery({\n fetchPolicy: 'cache-and-network',\n });\n type BillingAccount = NonNullable<typeof accountsData>['getBillingAccountsByOrg'][number];\n const accounts = useMemo<BillingAccount[]>(\n () => accountsData?.getBillingAccountsByOrg ?? [],\n [accountsData]\n );\n\n // Default to the first account; user can switch\n const [selectedAccountId, setSelectedAccountId] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (!selectedAccountId && accounts.length > 0) {\n setSelectedAccountId(accounts[0].id);\n }\n }, [accounts, selectedAccountId]);\n\n const selectedAccount = accounts.find((a) => a.id === selectedAccountId);\n\n // Transaction lookup by ID (lazy — fires when user enters a valid UUID)\n const [fetchTxn, { data: txnLookupData, loading: txnLookupLoading, error: txnLookupError }] =\n useGetTransactionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Track the \"active\" lookup key so we only apply results for the latest request\n const lastLookupKey = useRef('');\n\n useEffect(() => {\n if (txnLookupLoading) return;\n const txn = txnLookupData?.getTransaction;\n if (txn) {\n setLookedUpTxn(txn);\n setTxnNotFound(false);\n setAmount(String(txn.amount));\n } else if (txnLookupData !== undefined || txnLookupError) {\n setLookedUpTxn(null);\n setTxnNotFound(true);\n setAmount('');\n }\n }, [txnLookupData, txnLookupLoading, txnLookupError]);\n\n const triggerLookup = (txnId: string, accountId: string) => {\n const key = `${txnId}::${accountId}`;\n lastLookupKey.current = key;\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n fetchTxn({ variables: { id: txnId, billingAccountId: accountId } });\n };\n\n const handleTxnIdChange = (value: string) => {\n setTxnIdInput(value);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(value.trim()) && selectedAccountId) {\n triggerLookup(value.trim(), selectedAccountId);\n }\n };\n\n // When account changes, re-fetch the transaction if one is entered\n const handleAccountChange = (accountId: string) => {\n setSelectedAccountId(accountId);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(txnIdInput.trim())) {\n triggerLookup(txnIdInput.trim(), accountId);\n }\n };\n\n // Refund history for selected account\n const {\n data: refundsData,\n loading: refundsLoading,\n refetch: refetchRefunds,\n } = useGetRefundRecordsQuery({\n variables: { billingAccountId: selectedAccountId, pageSize: 20, page: 1 },\n skip: !selectedAccountId,\n fetchPolicy: 'cache-and-network',\n });\n const refunds = refundsData?.getRefundRecords.records ?? [];\n\n const [createRefund, { loading: isSubmitting }] = useCreateRefundRecordMutation({\n refetchQueries: ['GetRefundRecords'],\n });\n\n const getGatewayInfo = (txn: TxnLookup | null) => {\n if (!txn) return null;\n if (txn.stripePaymentId) return { provider: 'STRIPE', gatewayPaymentId: txn.stripePaymentId };\n if (txn.razorpayPaymentId)\n return { provider: 'RAZORPAY', gatewayPaymentId: txn.razorpayPaymentId };\n return null;\n };\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault();\n setFormError(null);\n\n if (!lookedUpTxn || !reason.trim() || !amount) {\n setFormError('Enter a valid transaction ID, an amount, and a reason.');\n return;\n }\n const gatewayInfo = getGatewayInfo(lookedUpTxn);\n if (!gatewayInfo) {\n setFormError('No payment gateway info found for this transaction. Please contact support.');\n return;\n }\n const parsedAmount = parseFloat(amount);\n if (isNaN(parsedAmount) || parsedAmount <= 0) {\n setFormError('Please enter a valid amount greater than 0.');\n return;\n }\n if (parsedAmount > lookedUpTxn.amount) {\n setFormError(\n `Cannot exceed the original payment amount (${formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}).`\n );\n return;\n }\n\n try {\n await createRefund({\n variables: {\n billingAccountId: selectedAccountId,\n provider: gatewayInfo.provider,\n gatewayPaymentId: gatewayInfo.gatewayPaymentId,\n amount: parsedAmount,\n currency: lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD',\n transactionId: lookedUpTxn.id,\n reason: reason.trim(),\n notes: `Requested by user via billing portal`,\n },\n });\n setFormSuccess(true);\n setShowForm(false);\n resetFormFields();\n await refetchRefunds();\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Failed to submit refund request.');\n }\n };\n\n const resetFormFields = () => {\n setTxnIdInput('');\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setReason('');\n setAmount('');\n setFormError(null);\n };\n\n const resetForm = () => {\n setShowForm(false);\n setFormSuccess(false);\n resetFormFields();\n };\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl\">\n <PageHeader\n title={tr('billing.refunds.title', 'Refunds')}\n description={tr(\n 'billing.refunds.description',\n 'View your refund requests and submit new ones'\n )}\n actions={\n !showForm ? (\n <button\n type=\"button\"\n onClick={() => {\n setShowForm(true);\n setFormSuccess(false);\n }}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors\"\n >\n <PlusCircle className=\"size-4\" />\n {tr('billing.refunds.requestRefund', 'Request Refund')}\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n {tr(\n 'billing.refunds.userPurpose',\n 'Request money back for a payment and follow where each request stands. Paste the transaction ID of the charge you want refunded, tell us how much and why, and track every request here from \"In Review\" through to \"Refunded\".'\n )}\n </PagePurpose>\n\n {/* Billing account switcher */}\n {!accountsLoading && accounts.length > 1 && (\n <div className=\"flex items-center gap-3\">\n <CreditCard className=\"size-4 text-text-secondary shrink-0\" />\n <label htmlFor=\"accountSwitch\" className=\"text-sm text-text-secondary shrink-0\">\n {tr('billing.refunds.account', 'Billing account')}\n </label>\n <select\n id=\"accountSwitch\"\n value={selectedAccountId ?? ''}\n onChange={(e) => handleAccountChange(e.target.value)}\n className=\"flex-1 px-3 py-1.5 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n {accounts.map((a) => (\n <option key={a.id} value={a.id}>\n {a.name} ({a.currency}) — {a.email}\n </option>\n ))}\n </select>\n </div>\n )}\n\n {/* Success banner */}\n {formSuccess && (\n <div className=\"flex items-center justify-between p-4 rounded-lg border border-status-success-border bg-status-success-bg/10\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-4 text-status-success-text\" />\n <p className=\"text-sm text-status-success-text font-medium\">\n {tr(\n 'billing.refunds.submitted',\n 'Refund request submitted. Our team will review it shortly.'\n )}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => setFormSuccess(false)}\n className=\"text-status-success-text hover:opacity-70\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n )}\n\n {/* Request Refund Form */}\n {showForm && (\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"flex items-center justify-between p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.newRequest', 'New Refund Request')}\n </h2>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"p-1 rounded hover:bg-bg-sunken transition-colors\"\n >\n <X className=\"size-4 text-text-secondary\" />\n </button>\n </div>\n\n <form onSubmit={handleSubmit} className=\"p-4 space-y-4\">\n {formError && (\n <div className=\"p-3 rounded-lg border border-status-error-border bg-status-error-bg/10\">\n <p className=\"text-sm text-status-error-text\">{formError}</p>\n </div>\n )}\n\n {/* Transaction ID lookup */}\n <div>\n <label htmlFor=\"txnId\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.transactionId', 'Transaction ID')} *\n </label>\n <div className=\"relative\">\n <input\n id=\"txnId\"\n type=\"text\"\n value={txnIdInput}\n onChange={(e) => handleTxnIdChange(e.target.value)}\n placeholder=\"Paste your transaction ID...\"\n className=\"w-full pl-3 pr-9 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm font-mono\"\n />\n <div className=\"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-secondary\">\n {txnLookupLoading ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Search className=\"size-4\" />\n )}\n </div>\n </div>\n\n {/* Transaction lookup result */}\n {lookedUpTxn && (\n <div className=\"mt-2 p-3 rounded-button border border-status-success-border bg-status-success-bg/10 text-sm space-y-0.5\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-3.5 text-status-success-text shrink-0\" />\n <span className=\"font-medium text-text-primary\">\n {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n <span className=\"text-text-secondary\">·</span>\n <span className=\"text-text-secondary\">\n {formatDateTime(lookedUpTxn.createdAt)}\n </span>\n {lookedUpTxn.stripePaymentId && (\n <span className=\"text-xs text-text-secondary\">Stripe</span>\n )}\n {lookedUpTxn.razorpayPaymentId && (\n <span className=\"text-xs text-text-secondary\">Razorpay</span>\n )}\n </div>\n {lookedUpTxn.description && (\n <p className=\"text-xs text-text-secondary pl-5\">{lookedUpTxn.description}</p>\n )}\n </div>\n )}\n {txnNotFound && txnIdInput.length > 0 && !txnLookupLoading && (\n <p className=\"mt-1 text-xs text-status-error-text\">\n {tr(\n 'billing.refunds.txnNotFound',\n 'Transaction not found in this billing account.'\n )}\n </p>\n )}\n {!UUID_RE.test(txnIdInput.trim()) && txnIdInput.length > 4 && (\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.txnIdHint',\n 'Transaction IDs look like: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n )}\n </p>\n )}\n </div>\n\n {/* Amount — only shown once transaction is found */}\n {lookedUpTxn && (\n <div>\n <label\n htmlFor=\"refundAmount\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.refunds.amount', 'Refund Amount')} *\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id=\"refundAmount\"\n type=\"number\"\n step=\"0.01\"\n min=\"0.01\"\n max={lookedUpTxn.amount}\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n required\n className=\"w-40 px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm\"\n placeholder=\"0.00\"\n />\n <span className=\"text-sm text-text-secondary\">\n {lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD'}\n </span>\n <span className=\"text-xs text-text-secondary\">\n max {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n </div>\n </div>\n )}\n\n {/* Reason */}\n <div>\n <label htmlFor=\"reason\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.reason', 'Reason for refund')} *\n </label>\n <textarea\n id=\"reason\"\n value={reason}\n onChange={(e) => setReason(e.target.value)}\n required\n rows={3}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm resize-none\"\n placeholder={tr(\n 'billing.refunds.reasonPlaceholder',\n 'Describe why you are requesting a refund...'\n )}\n />\n </div>\n\n <div className=\"flex items-center gap-3 pt-1\">\n <button\n type=\"submit\"\n disabled={isSubmitting || !lookedUpTxn || !reason.trim() || !amount}\n className=\"px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isSubmitting\n ? tr('billing.refunds.submitting', 'Submitting...')\n : tr('billing.refunds.submitRequest', 'Submit Request')}\n </button>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"px-4 py-2 text-sm border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n {tr('billing.common.cancel', 'Cancel')}\n </button>\n </div>\n </form>\n </div>\n )}\n\n {/* Refund history */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.history', 'Refund History')}\n </h2>\n </div>\n\n {accountsLoading || refundsLoading ? (\n <div className=\"p-8 flex items-center justify-center\">\n <Loader2 className=\"size-5 animate-spin text-text-secondary\" />\n </div>\n ) : refunds.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('billing.refunds.noRefunds', 'No refund requests yet')}\n description={tr(\n 'billing.refunds.noRefundsHint',\n 'If you have an issue with a payment, click \"Request Refund\" to get started.'\n )}\n />\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {refunds.map((r: RefundItem) => (\n <li\n key={r.id}\n className=\"flex items-start gap-4 p-4 hover:bg-bg-sunken transition-colors\"\n >\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-medium text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n </span>\n <StatusBadge status={r.status} />\n {r.purchaseDetail && (\n <span className=\"text-xs text-text-secondary truncate\">\n {r.purchaseDetail}\n </span>\n )}\n </div>\n {r.reason && (\n <p className=\"text-xs text-text-secondary mt-1 line-clamp-2\">{r.reason}</p>\n )}\n {r.errorMessage && r.status === RefundRecordStatus.Failed && (\n <p className=\"text-xs text-status-error-text mt-1\">{r.errorMessage}</p>\n )}\n </div>\n <div className=\"text-right shrink-0\">\n <p className=\"text-xs text-text-secondary\">{formatDateTime(r.createdAt)}</p>\n {r.processedAt && (\n <p className=\"text-xs text-text-secondary mt-0.5\">\n Processed {formatDateTime(r.processedAt)}\n </p>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n </div>\n\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.footer',\n 'Refund requests are reviewed by our team within 3–5 business days. For urgent issues, contact support.'\n )}{' '}\n <button\n type=\"button\"\n onClick={() => navigateTo('/transactions/' + selectedAccountId)}\n className=\"underline hover:no-underline\"\n >\n {tr('billing.refunds.viewTransactions', 'View all transactions')}\n </button>\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAkCA,IAAM,IAAU,mEAMV,IAGF;EACD,EAAmB,UAAU;EAC5B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAAC,GAAD,EAAkB,aAAY,CAAA;CACzD;EACC,EAAmB,aAAa;EAC/B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAAC,GAAD,EAAS,WAAW,GAAG,EAAU,eAAiB,CAAA;CAC7E;EACC,EAAmB,YAAY;EAC9B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAAC,GAAD,EAAwB,aAAY,CAAA;CAC/D;EACC,EAAmB,SAAS;EAC3B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kB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e,EAAE,SAAS;OAAK,CAAA,GAC1E,EAAE,eACD,kBAAC,KAAD;QAAG,WAAU;kBAAb,CAAkD,cACrC,EAAe,EAAE,WAAW,CACtC;SAEF;QACH;QA9BG,EAAE,EA8BL,CACL;IACC,CAAA,CAEH;;GAEL,kBAAC,KAAD;IAAG,WAAU;cAAb;KACG,EACC,0BACA,wGACF;KAAG;KACH,kBAAC,UAAD;MACE,MAAK;MACL,eAAe,EAAW,mBAAmB,CAAiB;MAC9D,WAAU;gBAET,EAAG,oCAAoC,uBAAuB;KACzD,CAAA;IACP;;EACA;;AAET"}
|
|
1
|
+
{"version":3,"file":"UserRefundsPage.js","names":["UUID_RE","STATUS_CONFIG","RefundRecordStatus","Clock","Loader2","className","CheckCircle","XCircle","StatusBadge","cfg","status","Icon","UserRefundsPage","useI18n","tr","v","t","key","fallback","navigateTo","useBillingNavigate","showForm","setShowForm","useState","txnIdInput","setTxnIdInput","lookedUpTxn","setLookedUpTxn","txnNotFound","setTxnNotFound","reason","setReason","amount","setAmount","formError","setFormError","formSuccess","setFormSuccess","accountsData","accountsLoading","useGetBillingAccountsCheckoutQuery","accounts","useMemo","selectedAccountId","setSelectedAccountId","selectedAccount","a","fetchTxn","txnLookupData","txnLookupLoading","txnLookupError","useGetTransactionLazyQuery","lastLookupKey","useRef","txn","triggerLookup","txnId","accountId","handleTxnIdChange","value","handleAccountChange","refundsData","refundsLoading","refetchRefunds","useGetRefundRecordsQuery","refunds","createRefund","isSubmitting","useCreateRefundRecordMutation","getGatewayInfo","handleSubmit","gatewayInfo","parsedAmount","formatCurrency","resetFormFields","err","resetForm","PageHeader","PlusCircle","PagePurpose","CreditCard","X","Search","formatDateTime","IllustratedEmptyState","r"],"sources":["../../../../../src/billing/modules/billing/pages/UserRefundsPage.tsx"],"sourcesContent":["/**\n * Billing Module - User Refunds Page\n * Shows the user's refund request history and allows submitting new requests.\n */\n\nimport { useState, useEffect, useMemo, useRef, type FC, type FormEvent } from 'react';\nimport {\n PlusCircle,\n X,\n Clock,\n CheckCircle,\n XCircle,\n Loader2,\n Search,\n CreditCard,\n} from 'lucide-react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { formatCurrency, formatDateTime } from '../../../shared/utils';\nimport { PageHeader } from '../../../shared/components';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport {\n useGetBillingAccountsCheckoutQuery,\n useGetTransactionLazyQuery,\n useGetRefundRecordsQuery,\n useCreateRefundRecordMutation,\n type GetRefundRecordsQuery,\n type GetTransactionQuery,\n} from '../../../../generated/global-operations';\nimport { RefundRecordStatus } from '../../../../generated/global-types';\n\ntype RefundItem = NonNullable<GetRefundRecordsQuery['getRefundRecords']['records']>[number];\ntype TxnLookup = NonNullable<GetTransactionQuery['getTransaction']>;\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n// ============================================================================\n// Status helpers\n// ============================================================================\n\nconst STATUS_CONFIG: Record<\n RefundRecordStatus,\n { label: string; className: string; icon: FC<{ className?: string }> }\n> = {\n [RefundRecordStatus.Pending]: {\n label: 'In Review',\n className: 'bg-status-warning-bg/20 text-status-warning-text border-status-warning-border',\n icon: ({ className }) => <Clock className={className} />,\n },\n [RefundRecordStatus.Processing]: {\n label: 'Processing',\n className: 'bg-action-primary-bg/15 text-action-primary-bg border-action-primary-bg/30',\n icon: ({ className }) => <Loader2 className={`${className} animate-spin`} />,\n },\n [RefundRecordStatus.Completed]: {\n label: 'Refunded',\n className: 'bg-status-success-bg/20 text-status-success-text border-status-success-border',\n icon: ({ className }) => <CheckCircle className={className} />,\n },\n [RefundRecordStatus.Failed]: {\n label: 'Failed',\n className: 'bg-status-error-bg/20 text-status-error-text border-status-error-border',\n icon: ({ className }) => <XCircle className={className} />,\n },\n [RefundRecordStatus.Skipped]: {\n label: 'Closed',\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }) => <XCircle className={className} />,\n },\n};\n\nfunction StatusBadge({ status }: { status: string }) {\n const cfg = STATUS_CONFIG[status as RefundRecordStatus] ?? {\n label: status,\n className: 'bg-bg-sunken text-text-secondary border-border-subtle',\n icon: ({ className }: { className?: string }) => <Clock className={className} />,\n };\n const Icon = cfg.icon;\n return (\n <span\n className={`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-xs font-medium ${cfg.className}`}\n >\n <Icon className=\"size-3\" />\n {cfg.label}\n </span>\n );\n}\n\n// ============================================================================\n// Main page\n// ============================================================================\n\nexport const UserRefundsPage: FC = () => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => {\n const v = t(key);\n return v === key ? fallback : v;\n };\n const navigateTo = useBillingNavigate();\n\n // Form state\n const [showForm, setShowForm] = useState(false);\n const [txnIdInput, setTxnIdInput] = useState('');\n const [lookedUpTxn, setLookedUpTxn] = useState<TxnLookup | null>(null);\n const [txnNotFound, setTxnNotFound] = useState(false);\n const [reason, setReason] = useState('');\n const [amount, setAmount] = useState('');\n const [formError, setFormError] = useState<string | null>(null);\n const [formSuccess, setFormSuccess] = useState(false);\n\n // All billing accounts\n const { data: accountsData, loading: accountsLoading } = useGetBillingAccountsCheckoutQuery({\n fetchPolicy: 'cache-and-network',\n });\n type BillingAccount = NonNullable<typeof accountsData>['getBillingAccountsByOrg'][number];\n const accounts = useMemo<BillingAccount[]>(\n () => accountsData?.getBillingAccountsByOrg ?? [],\n [accountsData]\n );\n\n // Default to the first account; user can switch\n const [selectedAccountId, setSelectedAccountId] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (!selectedAccountId && accounts.length > 0) {\n setSelectedAccountId(accounts[0].id);\n }\n }, [accounts, selectedAccountId]);\n\n const selectedAccount = accounts.find((a) => a.id === selectedAccountId);\n\n // Transaction lookup by ID (lazy — fires when user enters a valid UUID)\n const [fetchTxn, { data: txnLookupData, loading: txnLookupLoading, error: txnLookupError }] =\n useGetTransactionLazyQuery({ fetchPolicy: 'network-only' });\n\n // Track the \"active\" lookup key so we only apply results for the latest request\n const lastLookupKey = useRef('');\n\n useEffect(() => {\n if (txnLookupLoading) return;\n const txn = txnLookupData?.getTransaction;\n if (txn) {\n setLookedUpTxn(txn);\n setTxnNotFound(false);\n setAmount(String(txn.amount));\n } else if (txnLookupData !== undefined || txnLookupError) {\n setLookedUpTxn(null);\n setTxnNotFound(true);\n setAmount('');\n }\n }, [txnLookupData, txnLookupLoading, txnLookupError]);\n\n const triggerLookup = (txnId: string, accountId: string) => {\n const key = `${txnId}::${accountId}`;\n lastLookupKey.current = key;\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n fetchTxn({ variables: { id: txnId, billingAccountId: accountId } });\n };\n\n const handleTxnIdChange = (value: string) => {\n setTxnIdInput(value);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(value.trim()) && selectedAccountId) {\n triggerLookup(value.trim(), selectedAccountId);\n }\n };\n\n // When account changes, re-fetch the transaction if one is entered\n const handleAccountChange = (accountId: string) => {\n setSelectedAccountId(accountId);\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setAmount('');\n if (UUID_RE.test(txnIdInput.trim())) {\n triggerLookup(txnIdInput.trim(), accountId);\n }\n };\n\n // Refund history for selected account\n const {\n data: refundsData,\n loading: refundsLoading,\n refetch: refetchRefunds,\n } = useGetRefundRecordsQuery({\n variables: { billingAccountId: selectedAccountId, pageSize: 20, page: 1 },\n skip: !selectedAccountId,\n fetchPolicy: 'cache-and-network',\n });\n const refunds = refundsData?.getRefundRecords.records ?? [];\n\n const [createRefund, { loading: isSubmitting }] = useCreateRefundRecordMutation({\n refetchQueries: ['GetRefundRecords'],\n });\n\n const getGatewayInfo = (txn: TxnLookup | null) => {\n if (!txn) return null;\n if (txn.stripePaymentId) return { provider: 'STRIPE', gatewayPaymentId: txn.stripePaymentId };\n if (txn.razorpayPaymentId)\n return { provider: 'RAZORPAY', gatewayPaymentId: txn.razorpayPaymentId };\n return null;\n };\n\n const handleSubmit = async (e: FormEvent) => {\n e.preventDefault();\n setFormError(null);\n\n if (!lookedUpTxn || !reason.trim() || !amount) {\n setFormError('Enter a valid transaction ID, an amount, and a reason.');\n return;\n }\n const gatewayInfo = getGatewayInfo(lookedUpTxn);\n if (!gatewayInfo) {\n setFormError('No payment gateway info found for this transaction. Please contact support.');\n return;\n }\n const parsedAmount = parseFloat(amount);\n if (isNaN(parsedAmount) || parsedAmount <= 0) {\n setFormError('Please enter a valid amount greater than 0.');\n return;\n }\n if (parsedAmount > lookedUpTxn.amount) {\n setFormError(\n `Cannot exceed the original payment amount (${formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}).`\n );\n return;\n }\n\n try {\n await createRefund({\n variables: {\n billingAccountId: selectedAccountId,\n provider: gatewayInfo.provider,\n gatewayPaymentId: gatewayInfo.gatewayPaymentId,\n amount: parsedAmount,\n currency: lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD',\n transactionId: lookedUpTxn.id,\n reason: reason.trim(),\n notes: `Requested by user via billing portal`,\n },\n });\n setFormSuccess(true);\n setShowForm(false);\n resetFormFields();\n await refetchRefunds();\n } catch (err) {\n setFormError(err instanceof Error ? err.message : 'Failed to submit refund request.');\n }\n };\n\n const resetFormFields = () => {\n setTxnIdInput('');\n setLookedUpTxn(null);\n setTxnNotFound(false);\n setReason('');\n setAmount('');\n setFormError(null);\n };\n\n const resetForm = () => {\n setShowForm(false);\n setFormSuccess(false);\n resetFormFields();\n };\n\n return (\n <div className=\"space-y-6 p-6 max-w-3xl\">\n <PageHeader\n title={tr('billing.refunds.title', 'Refunds')}\n description={tr(\n 'billing.refunds.description',\n 'View your refund requests and submit new ones'\n )}\n actions={\n !showForm ? (\n <button\n type=\"button\"\n onClick={() => {\n setShowForm(true);\n setFormSuccess(false);\n }}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors\"\n >\n <PlusCircle className=\"size-4\" />\n {tr('billing.refunds.requestRefund', 'Request Refund')}\n </button>\n ) : undefined\n }\n />\n\n <PagePurpose>\n {tr(\n 'billing.refunds.userPurpose',\n 'Request money back for a payment and follow where each request stands. Paste the transaction ID of the charge you want refunded, tell us how much and why, and track every request here from \"In Review\" through to \"Refunded\".'\n )}\n </PagePurpose>\n\n {/* Billing account switcher */}\n {!accountsLoading && accounts.length > 1 && (\n <div className=\"flex items-center gap-3\">\n <CreditCard className=\"size-4 text-text-secondary shrink-0\" />\n <label htmlFor=\"accountSwitch\" className=\"text-sm text-text-secondary shrink-0\">\n {tr('billing.refunds.account', 'Billing account')}\n </label>\n <select\n id=\"accountSwitch\"\n value={selectedAccountId ?? ''}\n onChange={(e) => handleAccountChange(e.target.value)}\n className=\"flex-1 px-3 py-1.5 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary\"\n >\n {accounts.map((a) => (\n <option key={a.id} value={a.id}>\n {a.name} ({a.currency}) — {a.email}\n </option>\n ))}\n </select>\n </div>\n )}\n\n {/* Success banner */}\n {formSuccess && (\n <div className=\"flex items-center justify-between p-4 rounded-lg border border-status-success-border bg-status-success-bg/10\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-4 text-status-success-text\" />\n <p className=\"text-sm text-status-success-text font-medium\">\n {tr(\n 'billing.refunds.submitted',\n 'Refund request submitted. Our team will review it shortly.'\n )}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => setFormSuccess(false)}\n className=\"text-status-success-text hover:opacity-70\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n )}\n\n {/* Request Refund Form */}\n {showForm && (\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"flex items-center justify-between p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.newRequest', 'New Refund Request')}\n </h2>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"p-1 rounded hover:bg-bg-sunken transition-colors\"\n >\n <X className=\"size-4 text-text-secondary\" />\n </button>\n </div>\n\n <form onSubmit={handleSubmit} className=\"p-4 space-y-4\">\n {formError && (\n <div className=\"p-3 rounded-lg border border-status-error-border bg-status-error-bg/10\">\n <p className=\"text-sm text-status-error-text\">{formError}</p>\n </div>\n )}\n\n {/* Transaction ID lookup */}\n <div>\n <label htmlFor=\"txnId\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.transactionId', 'Transaction ID')} *\n </label>\n <div className=\"relative\">\n <input\n id=\"txnId\"\n type=\"text\"\n value={txnIdInput}\n onChange={(e) => handleTxnIdChange(e.target.value)}\n placeholder=\"Paste your transaction ID...\"\n className=\"w-full pl-3 pr-9 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm font-mono\"\n />\n <div className=\"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-secondary\">\n {txnLookupLoading ? (\n <Loader2 className=\"size-4 animate-spin\" />\n ) : (\n <Search className=\"size-4\" />\n )}\n </div>\n </div>\n\n {/* Transaction lookup result */}\n {lookedUpTxn && (\n <div className=\"mt-2 p-3 rounded-button border border-status-success-border bg-status-success-bg/10 text-sm space-y-0.5\">\n <div className=\"flex items-center gap-2\">\n <CheckCircle className=\"size-3.5 text-status-success-text shrink-0\" />\n <span className=\"font-medium text-text-primary\">\n {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n <span className=\"text-text-secondary\">·</span>\n <span className=\"text-text-secondary\">\n {formatDateTime(lookedUpTxn.createdAt)}\n </span>\n {lookedUpTxn.stripePaymentId && (\n <span className=\"text-xs text-text-secondary\">Stripe</span>\n )}\n {lookedUpTxn.razorpayPaymentId && (\n <span className=\"text-xs text-text-secondary\">Razorpay</span>\n )}\n </div>\n {lookedUpTxn.description && (\n <p className=\"text-xs text-text-secondary pl-5\">{lookedUpTxn.description}</p>\n )}\n </div>\n )}\n {txnNotFound && txnIdInput.length > 0 && !txnLookupLoading && (\n <p className=\"mt-1 text-xs text-status-error-text\">\n {tr(\n 'billing.refunds.txnNotFound',\n 'Transaction not found in this billing account.'\n )}\n </p>\n )}\n {!UUID_RE.test(txnIdInput.trim()) && txnIdInput.length > 4 && (\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.txnIdHint',\n 'Transaction IDs look like: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'\n )}\n </p>\n )}\n </div>\n\n {/* Amount — only shown once transaction is found */}\n {lookedUpTxn && (\n <div>\n <label\n htmlFor=\"refundAmount\"\n className=\"block text-sm font-medium text-text-primary mb-1\"\n >\n {tr('billing.refunds.amount', 'Refund Amount')} *\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id=\"refundAmount\"\n type=\"number\"\n step=\"0.01\"\n min=\"0.01\"\n max={lookedUpTxn.amount}\n value={amount}\n onChange={(e) => setAmount(e.target.value)}\n required\n className=\"w-40 px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm\"\n placeholder=\"0.00\"\n />\n <span className=\"text-sm text-text-secondary\">\n {lookedUpTxn.currency ?? selectedAccount?.currency ?? 'USD'}\n </span>\n <span className=\"text-xs text-text-secondary\">\n max {formatCurrency(lookedUpTxn.amount, lookedUpTxn.currency)}\n </span>\n </div>\n </div>\n )}\n\n {/* Reason */}\n <div>\n <label htmlFor=\"reason\" className=\"block text-sm font-medium text-text-primary mb-1\">\n {tr('billing.refunds.reason', 'Reason for refund')} *\n </label>\n <textarea\n id=\"reason\"\n value={reason}\n onChange={(e) => setReason(e.target.value)}\n required\n rows={3}\n className=\"w-full px-3 py-2 border border-border-subtle rounded-button bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] text-sm resize-none\"\n placeholder={tr(\n 'billing.refunds.reasonPlaceholder',\n 'Describe why you are requesting a refund...'\n )}\n />\n </div>\n\n <div className=\"flex items-center gap-3 pt-1\">\n <button\n type=\"submit\"\n disabled={isSubmitting || !lookedUpTxn || !reason.trim() || !amount}\n className=\"px-4 py-2 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-button hover:bg-action-primary-bgHover transition-colors disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n {isSubmitting\n ? tr('billing.refunds.submitting', 'Submitting...')\n : tr('billing.refunds.submitRequest', 'Submit Request')}\n </button>\n <button\n type=\"button\"\n onClick={resetForm}\n className=\"px-4 py-2 text-sm border border-border-subtle text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n {tr('billing.common.cancel', 'Cancel')}\n </button>\n </div>\n </form>\n </div>\n )}\n\n {/* Refund history */}\n <div className=\"border border-border-seam rounded-card bg-bg-surface shadow-elevation-1 overflow-hidden\">\n <div className=\"p-4 border-b border-border-subtle bg-bg-sunken\">\n <h2 className=\"font-semibold text-text-primary\">\n {tr('billing.refunds.history', 'Refund History')}\n </h2>\n </div>\n\n {accountsLoading || refundsLoading ? (\n <div className=\"p-8 flex items-center justify-center\">\n <Loader2 className=\"size-5 animate-spin text-text-secondary\" />\n </div>\n ) : refunds.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={tr('billing.refunds.noRefunds', 'No refund requests yet')}\n description={tr(\n 'billing.refunds.noRefundsHint',\n 'If you have an issue with a payment, click \"Request Refund\" to get started.'\n )}\n />\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {refunds.map((r: RefundItem) => (\n <li\n key={r.id}\n className=\"flex items-start gap-4 p-4 hover:bg-bg-sunken transition-colors\"\n >\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2 flex-wrap\">\n <span className=\"text-sm font-medium text-text-primary\">\n {formatCurrency(r.amount, r.currency)}\n </span>\n <StatusBadge status={r.status} />\n {r.purchaseDetail && (\n <span className=\"text-xs text-text-secondary truncate\">\n {r.purchaseDetail}\n </span>\n )}\n </div>\n {r.reason && (\n <p className=\"text-xs text-text-secondary mt-1 line-clamp-2\">{r.reason}</p>\n )}\n {r.errorMessage && r.status === RefundRecordStatus.Failed && (\n <p className=\"text-xs text-status-error-text mt-1\">{r.errorMessage}</p>\n )}\n </div>\n <div className=\"text-right shrink-0\">\n <p className=\"text-xs text-text-secondary\">{formatDateTime(r.createdAt)}</p>\n {r.processedAt && (\n <p className=\"text-xs text-text-secondary mt-0.5\">\n Processed {formatDateTime(r.processedAt)}\n </p>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n </div>\n\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'billing.refunds.footer',\n 'Refund requests are reviewed by our team within 3–5 business days. For urgent issues, contact support.'\n )}{' '}\n <button\n type=\"button\"\n onClick={() => navigateTo('/transactions/' + selectedAccountId)}\n className=\"underline hover:no-underline\"\n >\n {tr('billing.refunds.viewTransactions', 'View all transactions')}\n </button>\n </p>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAkCA,IAAMA,IAAU,mEAMVC,IAGF;EACDC,EAAmB,UAAU;EAC5B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACC,GAAD,EAAkB,aAAY,CAAA;CACzD;EACCD,EAAmB,aAAa;EAC/B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACE,GAAD,EAAS,WAAW,GAAGC,EAAU,eAAiB,CAAA;CAC7E;EACCH,EAAmB,YAAY;EAC9B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACI,GAAD,EAAwB,aAAY,CAAA;CAC/D;EACCJ,EAAmB,SAAS;EAC3B,OAAO;EACP,WAAW;EACX,OAAO,EAAE,mBAAgB,kBAACK,GAAD,EAAoB,a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age } from './RefundIssueLogsPage';
|
|
|
11
11
|
export { UserRefundsPage } from './UserRefundsPage';
|
|
12
12
|
export { BillingWebhookLogsPage } from './BillingWebhookLogsPage';
|
|
13
13
|
export { OrderCallbackLogsPage } from './OrderCallbackLogsPage';
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import "./InvoicesListPage.js";
|
|
2
|
-
import "./InvoiceDetailPage.js";
|
|
3
|
-
import "./TransactionsPage.js";
|
|
4
|
-
import "./PaymentMethodsPage.js";
|
|
5
|
-
import "./RefundsPage.js";
|
|
6
|
-
import "./RefundIssueLogsPage.js";
|
|
7
|
-
import "./UserRefundsPage.js";
|
|
8
|
-
import "./BillingWebhookLogsPage.js";
|
|
9
|
-
import "./OrderCallbackLogsPage.js";
|
|
1
|
+
import { InvoicesListPage as e } from "./InvoicesListPage.js";
|
|
2
|
+
import { InvoiceDetailPage as t } from "./InvoiceDetailPage.js";
|
|
3
|
+
import { TransactionsPage as n } from "./TransactionsPage.js";
|
|
4
|
+
import { PaymentMethodsPage as r } from "./PaymentMethodsPage.js";
|
|
5
|
+
import { RefundsPage as i } from "./RefundsPage.js";
|
|
6
|
+
import { RefundIssueLogsPage as a } from "./RefundIssueLogsPage.js";
|
|
7
|
+
import { UserRefundsPage as o } from "./UserRefundsPage.js";
|
|
8
|
+
import { BillingWebhookLogsPage as s } from "./BillingWebhookLogsPage.js";
|
|
9
|
+
import { OrderCallbackLogsPage as c } from "./OrderCallbackLogsPage.js";
|
|
10
|
+
export { s as BillingWebhookLogsPage, t as InvoiceDetailPage, e as InvoicesListPage, c as OrderCallbackLogsPage, r as PaymentMethodsPage, a as RefundIssueLogsPage, i as RefundsPage, n as TransactionsPage, o as UserRefundsPage };
|
|
@@ -3,7 +3,7 @@ import { useEffect as t, useRef as n, useState as r } from "react";
|
|
|
3
3
|
import { Building2 as i, Check as a, ChevronDown as o, CreditCard as s, Lock as c } from "lucide-react";
|
|
4
4
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
5
5
|
import { useI18n as d } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
6
|
-
|
|
6
|
+
// src/billing/modules/checkout/components/BillingAccountSelector.tsx
|
|
7
7
|
var f = ({ accounts: f, selectedAccountId: p, onSelect: m, isLoading: h = !1, disabled: g = !1, disabledMessage: _ }) => {
|
|
8
8
|
let { t: v } = d(), y = (e, t) => {
|
|
9
9
|
let n = v(e);
|
|
@@ -145,7 +145,6 @@ var f = ({ accounts: f, selectedAccountId: p, onSelect: m, isLoading: h = !1, di
|
|
|
145
145
|
]
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
|
-
//#endregion
|
|
149
148
|
export { f as BillingAccountSelector };
|
|
150
149
|
|
|
151
150
|
//# sourceMappingURL=BillingAccountSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BillingAccountSelector.js","names":[],"sources":["../../../../../src/billing/modules/checkout/components/BillingAccountSelector.tsx"],"sourcesContent":["/**\n * Billing Account Selector Component\n * Dropdown selector for choosing billing account in checkout\n */\n\nimport { type FC, useState, useRef, useEffect } from 'react';\nimport { Building2, CreditCard, ChevronDown, Check, Lock } from 'lucide-react';\nimport type { CheckoutBillingAccount } from '../types';\nimport { formatCurrency } from '../../../shared/utils/format';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\ninterface BillingAccountSelectorProps {\n accounts: CheckoutBillingAccount[];\n selectedAccountId: string | null;\n onSelect: (account: CheckoutBillingAccount) => void;\n isLoading?: boolean;\n disabled?: boolean;\n disabledMessage?: string;\n}\n\nexport const BillingAccountSelector: FC<BillingAccountSelectorProps> = ({\n accounts,\n selectedAccountId,\n onSelect,\n isLoading = false,\n disabled = false,\n disabledMessage,\n}) => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, []);\n\n // Close on escape key\n useEffect(() => {\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n };\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const selectedAccount = accounts.find((a) => a.id === selectedAccountId);\n\n if (isLoading) {\n return (\n <div className=\"space-y-2\">\n <div className=\"h-4 w-28 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-12 bg-bg-sunken animate-pulse rounded-lg\" />\n </div>\n );\n }\n\n if (accounts.length === 0) {\n return (\n <div className=\"rounded-lg border border-dashed border-border-subtle p-4 text-center\">\n <Building2 className=\"mx-auto size-6 text-text-secondary\" />\n <p className=\"mt-2 text-sm text-text-secondary\">No billing accounts found</p>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-2 relative\" ref={dropdownRef}>\n <div className=\"flex items-center justify-between\">\n <label className=\"text-sm font-medium text-text-primary\">\n {tr('billing.checkout.billingAccount', 'Billing Account')}\n </label>\n {disabled && (\n <span className=\"flex items-center gap-1 text-xs text-text-secondary\">\n <Lock className=\"size-3\" />\n Locked\n </span>\n )}\n </div>\n\n {/* Dropdown trigger */}\n <button\n type=\"button\"\n onClick={() => !disabled && setIsOpen(!isOpen)}\n disabled={disabled}\n className={`\n w-full flex items-center justify-between gap-3 p-3 rounded-lg border\n transition-colors text-left\n ${\n disabled\n ? 'border-border-subtle bg-bg-sunken cursor-not-allowed opacity-80'\n : isOpen\n ? 'border-border-strong ring-1 ring-[var(--color-focus-ring)]'\n : 'border-border-subtle hover:border-border-strong'\n }\n `}\n >\n {selectedAccount ? (\n <div className=\"flex items-center gap-3 min-w-0 flex-1\">\n <div\n className={`flex size-8 shrink-0 items-center justify-center rounded-full ${\n disabled\n ? 'bg-bg-sunken text-text-secondary'\n : 'bg-[var(--color-accent-soft)] text-text-link'\n }`}\n >\n <Building2 className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium text-text-primary truncate\">\n {selectedAccount.name}\n </span>\n {!selectedAccount.isActive && (\n <span className=\"text-xs px-1.5 py-0.5 rounded bg-status-error-bg-subtle text-status-error-text shrink-0\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary truncate\">{selectedAccount.email}</p>\n </div>\n <div className=\"shrink-0 text-right\">\n <div className=\"flex items-center gap-1 text-sm font-medium text-text-primary\">\n <CreditCard className=\"size-3.5 text-text-secondary\" />\n {formatCurrency(selectedAccount.creditAmount, 'CREDITS')}\n </div>\n </div>\n </div>\n ) : (\n <span className=\"text-text-secondary\">Select billing account</span>\n )}\n {disabled ? (\n <Lock className=\"size-4 shrink-0 text-text-secondary\" />\n ) : (\n <ChevronDown\n className={`size-4 shrink-0 text-text-secondary transition-transform ${\n isOpen ? 'rotate-180' : ''\n }`}\n />\n )}\n </button>\n\n {/* Disabled message */}\n {disabled && disabledMessage && (\n <p className=\"text-xs text-text-secondary\">{disabledMessage}</p>\n )}\n\n {/* Dropdown menu */}\n {isOpen && !disabled && (\n <div className=\"absolute left-0 right-0 z-50 mt-1 max-h-64 overflow-auto rounded-card border border-border-seam bg-bg-elevated shadow-elevation-3\">\n {accounts.map((account) => {\n const isSelected = account.id === selectedAccountId;\n return (\n <button\n key={account.id}\n type=\"button\"\n onClick={() => {\n onSelect(account);\n setIsOpen(false);\n }}\n className={`\n w-full flex items-center gap-3 p-3 text-left\n transition-colors\n ${isSelected ? 'bg-[var(--color-accent-soft)]' : 'hover:bg-bg-sunken'}\n `}\n >\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-text-link\">\n <Building2 className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium text-text-primary truncate\">{account.name}</span>\n {!account.isActive && (\n <span className=\"text-xs px-1.5 py-0.5 rounded bg-status-error-bg-subtle text-status-error-text shrink-0\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary truncate\">{account.email}</p>\n </div>\n <div className=\"shrink-0 flex items-center gap-2\">\n <div className=\"text-right\">\n <div className=\"flex items-center gap-1 text-sm font-medium text-text-primary\">\n <CreditCard className=\"size-3.5 text-text-secondary\" />\n {formatCurrency(account.creditAmount, 'CREDITS')}\n </div>\n </div>\n {isSelected && <Check className=\"size-4 text-text-link\" />}\n </div>\n </button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;AAoBA,IAAa,KAA2D,EACtE,aACA,sBACA,aACA,eAAY,IACZ,cAAW,IACX,yBACI;CACJ,IAAM,EAAE,SAAM,EAAQ,GAChB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAa,EAAE,CAAG;EACxB,OAAO,MAAe,IAAM,IAAW;CACzC,GACM,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,IAAc,EAAuB,IAAI;CAe/C,AAZA,QAAgB;EACd,IAAM,KAAsB,MAAsB;GAChD,AAAI,EAAY,WAAW,CAAC,EAAY,QAAQ,SAAS,EAAM,MAAc,KAC3E,EAAU,EAAK;EAEnB;EAGA,OADA,SAAS,iBAAiB,aAAa,CAAkB,SAC5C,SAAS,oBAAoB,aAAa,CAAkB;CAC3E,GAAG,CAAC,CAAC,GAGL,QAAgB;EACd,IAAM,KAAgB,MAAyB;GAC7C,AAAI,EAAM,QAAQ,YAChB,EAAU,EAAK;EAEnB;EAEA,IAAI,GAEF,OADA,SAAS,iBAAiB,WAAW,CAAY,SACpC,SAAS,oBAAoB,WAAW,CAAY;CAErE,GAAG,CA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A,CACtD;;MACC;QAnCD,EAAQ,EAmCP;IAEZ,CAAC;GACE,CAAA;EAEJ;;AAET"}
|
|
1
|
+
{"version":3,"file":"BillingAccountSelector.js","names":["BillingAccountSelector","useI18n","tr","translated","t","key","fallback","isOpen","setIsOpen","useState","dropdownRef","useRef","useEffect","handleClickOutside","event","handleEscape","selectedAccount","accounts","a","selectedAccountId","isLoading","Building2","disabled","Lock","CreditCard","formatCurrency","ChevronDown","disabledMessage","isSelected","account","onSelect","Check"],"sources":["../../../../../src/billing/modules/checkout/components/BillingAccountSelector.tsx"],"sourcesContent":["/**\n * Billing Account Selector Component\n * Dropdown selector for choosing billing account in checkout\n */\n\nimport { type FC, useState, useRef, useEffect } from 'react';\nimport { Building2, CreditCard, ChevronDown, Check, Lock } from 'lucide-react';\nimport type { CheckoutBillingAccount } from '../types';\nimport { formatCurrency } from '../../../shared/utils/format';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\ninterface BillingAccountSelectorProps {\n accounts: CheckoutBillingAccount[];\n selectedAccountId: string | null;\n onSelect: (account: CheckoutBillingAccount) => void;\n isLoading?: boolean;\n disabled?: boolean;\n disabledMessage?: string;\n}\n\nexport const BillingAccountSelector: FC<BillingAccountSelectorProps> = ({\n accounts,\n selectedAccountId,\n onSelect,\n isLoading = false,\n disabled = false,\n disabledMessage,\n}) => {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const translated = t(key);\n return translated === key ? fallback : translated;\n };\n const [isOpen, setIsOpen] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n\n // Close dropdown when clicking outside\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {\n setIsOpen(false);\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, []);\n\n // Close on escape key\n useEffect(() => {\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n setIsOpen(false);\n }\n };\n\n if (isOpen) {\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }\n }, [isOpen]);\n\n const selectedAccount = accounts.find((a) => a.id === selectedAccountId);\n\n if (isLoading) {\n return (\n <div className=\"space-y-2\">\n <div className=\"h-4 w-28 bg-bg-sunken animate-pulse rounded\" />\n <div className=\"h-12 bg-bg-sunken animate-pulse rounded-lg\" />\n </div>\n );\n }\n\n if (accounts.length === 0) {\n return (\n <div className=\"rounded-lg border border-dashed border-border-subtle p-4 text-center\">\n <Building2 className=\"mx-auto size-6 text-text-secondary\" />\n <p className=\"mt-2 text-sm text-text-secondary\">No billing accounts found</p>\n </div>\n );\n }\n\n return (\n <div className=\"space-y-2 relative\" ref={dropdownRef}>\n <div className=\"flex items-center justify-between\">\n <label className=\"text-sm font-medium text-text-primary\">\n {tr('billing.checkout.billingAccount', 'Billing Account')}\n </label>\n {disabled && (\n <span className=\"flex items-center gap-1 text-xs text-text-secondary\">\n <Lock className=\"size-3\" />\n Locked\n </span>\n )}\n </div>\n\n {/* Dropdown trigger */}\n <button\n type=\"button\"\n onClick={() => !disabled && setIsOpen(!isOpen)}\n disabled={disabled}\n className={`\n w-full flex items-center justify-between gap-3 p-3 rounded-lg border\n transition-colors text-left\n ${\n disabled\n ? 'border-border-subtle bg-bg-sunken cursor-not-allowed opacity-80'\n : isOpen\n ? 'border-border-strong ring-1 ring-[var(--color-focus-ring)]'\n : 'border-border-subtle hover:border-border-strong'\n }\n `}\n >\n {selectedAccount ? (\n <div className=\"flex items-center gap-3 min-w-0 flex-1\">\n <div\n className={`flex size-8 shrink-0 items-center justify-center rounded-full ${\n disabled\n ? 'bg-bg-sunken text-text-secondary'\n : 'bg-[var(--color-accent-soft)] text-text-link'\n }`}\n >\n <Building2 className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium text-text-primary truncate\">\n {selectedAccount.name}\n </span>\n {!selectedAccount.isActive && (\n <span className=\"text-xs px-1.5 py-0.5 rounded bg-status-error-bg-subtle text-status-error-text shrink-0\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary truncate\">{selectedAccount.email}</p>\n </div>\n <div className=\"shrink-0 text-right\">\n <div className=\"flex items-center gap-1 text-sm font-medium text-text-primary\">\n <CreditCard className=\"size-3.5 text-text-secondary\" />\n {formatCurrency(selectedAccount.creditAmount, 'CREDITS')}\n </div>\n </div>\n </div>\n ) : (\n <span className=\"text-text-secondary\">Select billing account</span>\n )}\n {disabled ? (\n <Lock className=\"size-4 shrink-0 text-text-secondary\" />\n ) : (\n <ChevronDown\n className={`size-4 shrink-0 text-text-secondary transition-transform ${\n isOpen ? 'rotate-180' : ''\n }`}\n />\n )}\n </button>\n\n {/* Disabled message */}\n {disabled && disabledMessage && (\n <p className=\"text-xs text-text-secondary\">{disabledMessage}</p>\n )}\n\n {/* Dropdown menu */}\n {isOpen && !disabled && (\n <div className=\"absolute left-0 right-0 z-50 mt-1 max-h-64 overflow-auto rounded-card border border-border-seam bg-bg-elevated shadow-elevation-3\">\n {accounts.map((account) => {\n const isSelected = account.id === selectedAccountId;\n return (\n <button\n key={account.id}\n type=\"button\"\n onClick={() => {\n onSelect(account);\n setIsOpen(false);\n }}\n className={`\n w-full flex items-center gap-3 p-3 text-left\n transition-colors\n ${isSelected ? 'bg-[var(--color-accent-soft)]' : 'hover:bg-bg-sunken'}\n `}\n >\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-text-link\">\n <Building2 className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium text-text-primary truncate\">{account.name}</span>\n {!account.isActive && (\n <span className=\"text-xs px-1.5 py-0.5 rounded bg-status-error-bg-subtle text-status-error-text shrink-0\">\n Inactive\n </span>\n )}\n </div>\n <p className=\"text-sm text-text-secondary truncate\">{account.email}</p>\n </div>\n <div className=\"shrink-0 flex items-center gap-2\">\n <div className=\"text-right\">\n <div className=\"flex items-center gap-1 text-sm font-medium text-text-primary\">\n <CreditCard className=\"size-3.5 text-text-secondary\" />\n {formatCurrency(account.creditAmount, 'CREDITS')}\n </div>\n </div>\n {isSelected && <Check className=\"size-4 text-text-link\" />}\n </div>\n </button>\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;AAoBA,IAAaA,KAA2D,EACtE,aACA,sBACA,aACA,eAAY,IACZ,cAAW,IACX,yBACI;CACJ,IAAM,EAAE,SAAMC,EAAQ,GAChBC,KAAM,GAAa,MAA6B;EACpD,IAAMC,IAAaC,EAAEC,CAAG;EACxB,OAAOF,MAAeE,IAAMC,IAAWH;CACzC,GACM,CAACI,GAAQC,KAAaC,EAAS,EAAK,GACpCC,IAAcC,EAAuB,IAAI;CAe/C,AAZAC,QAAgB;EACd,IAAMC,KAAsB,MAAsB;GAChD,AAAIH,EAAY,WAAW,CAACA,EAAY,QAAQ,SAASI,EAAM,MAAc,KAC3EN,EAAU,EAAK;EAEnB;EAGA,OADA,SAAS,iBAAiB,aAAaK,CAAkB,SAC5C,SAAS,oBAAoB,aAAaA,CAAkB;CAC3E,GAAG,CAAC,CAAC,GAGLD,QAAgB;EACd,IAAMG,KAAgB,MAAyB;GAC7C,AAAID,EAAM,QAAQ,YAChBN,EAAU,EAAK;EAEnB;EAEA,IAAID,GAEF,OADA,SAAS,iBAAiB,WAAWQ,CAAY,SACpC,SAAS,oBAAoB,WAAWA,CAAY;CAErE,GAAG,CAACR,CAAM,CAAC;CAEX,IAAMS,IAAkBC,EAAS,MAAM,MAAMC,EAAE,OAAOC,CAAiB;CAoBvE,OAlBIC,IAEA,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OAAD,EAAK,WAAU,8CAA+C,CAAA,GAC9D,kBAAC,OAAD,EAAK,WAAU,6CAA8C,CAAA,CAC1D;C,KAILH,EAAS,W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AAyB,CAAA,CACtD;;MACC;KAnCD,GAAAF,EAAQ,EAmCP;IAEZ,CAAC;GACE,CAAA;EAEJ;;AAET"}
|
|
@@ -2,7 +2,7 @@ import { useSetBillingAddressMutation as e, useUpdateBillingAccountMutation as t
|
|
|
2
2
|
import { useState as n } from "react";
|
|
3
3
|
import { Loader2 as r, MapPin as i, Phone as a, X as o } from "lucide-react";
|
|
4
4
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/billing/modules/checkout/components/CompleteBillingAccountModal.tsx
|
|
6
6
|
var l = [
|
|
7
7
|
{
|
|
8
8
|
value: "IN",
|
|
@@ -251,7 +251,6 @@ var d = ({ billingAccountId: u, hasPhone: d, hasAddress: f, onCompleted: p, onCa
|
|
|
251
251
|
})
|
|
252
252
|
});
|
|
253
253
|
};
|
|
254
|
-
//#endregion
|
|
255
254
|
export { d as CompleteBillingAccountModal, u as isBillingAccountComplete };
|
|
256
255
|
|
|
257
256
|
//# sourceMappingURL=CompleteBillingAccountModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompleteBillingAccountModal.js","names":[],"sources":["../../../../../src/billing/modules/checkout/components/CompleteBillingAccountModal.tsx"],"sourcesContent":["/**\n * Modal shown at checkout when the selected billing account is missing\n * a billing address or contact number — fields that can't be auto-filled\n * during account creation but are required by payment providers.\n */\n\nimport { type FC, useState } from 'react';\nimport { MapPin, Phone, Loader2, X } from 'lucide-react';\nimport {\n useSetBillingAddressMutation,\n useUpdateBillingAccountMutation,\n} from '../../../../generated/global-operations';\n\nconst COUNTRY_OPTIONS = [\n { value: 'IN', label: 'India' },\n { value: 'US', label: 'United States' },\n { value: 'GB', label: 'United Kingdom' },\n { value: 'AU', label: 'Australia' },\n { value: 'CA', label: 'Canada' },\n { value: 'SG', label: 'Singapore' },\n { value: 'DE', label: 'Germany' },\n { value: 'FR', label: 'France' },\n { value: 'AE', label: 'UAE' },\n];\n\ninterface FormState {\n contactNumber: string;\n line1: string;\n line2: string;\n city: string;\n state: string;\n postalCode: string;\n country: string;\n}\n\ninterface FormErrors {\n contactNumber?: string;\n line1?: string;\n city?: string;\n postalCode?: string;\n country?: string;\n}\n\ninterface Props {\n billingAccountId: string;\n /** Whether contactNumber is already filled on the account */\n hasPhone: boolean;\n /** Whether a billing address already exists (with line1 + postalCode) */\n hasAddress: boolean;\n onCompleted: () => void;\n onCancel: () => void;\n}\n\n/** Returns true when a billing account has everything required for checkout. */\nexport function isBillingAccountComplete(account: {\n contactNumber?: string | null;\n billingAddresses?: Array<{\n line1?: string | null;\n city?: string | null;\n postalCode?: string | null;\n country?: string | null;\n }> | null;\n}): boolean {\n const hasPhone = Boolean(account.contactNumber?.trim());\n const primaryAddress = account.billingAddresses?.[0];\n const hasAddress = Boolean(\n primaryAddress?.line1?.trim() &&\n primaryAddress?.city?.trim() &&\n primaryAddress?.postalCode?.trim() &&\n primaryAddress?.country?.trim()\n );\n return hasPhone && hasAddress;\n}\n\nexport const CompleteBillingAccountModal: FC<Props> = ({\n billingAccountId,\n hasPhone,\n hasAddress,\n onCompleted,\n onCancel,\n}) => {\n const [form, setForm] = useState<FormState>({\n contactNumber: '',\n line1: '',\n line2: '',\n city: '',\n state: '',\n postalCode: '',\n country: 'IN',\n });\n const [errors, setErrors] = useState<FormErrors>({});\n const [submitting, setSubmitting] = useState(false);\n const [serverError, setServerError] = useState<string | null>(null);\n\n const [setBillingAddress] = useSetBillingAddressMutation();\n const [updateBillingAccount] = useUpdateBillingAccountMutation();\n\n const set = (field: keyof FormState, value: string) =>\n setForm((prev) => ({ ...prev, [field]: value }));\n\n const validate = (): boolean => {\n const e: FormErrors = {};\n if (!hasPhone && !form.contactNumber.trim()) {\n e.contactNumber = 'Phone number is required for payment processing';\n }\n if (!hasAddress) {\n if (!form.line1.trim()) e.line1 = 'Street address is required';\n if (!form.city.trim()) e.city = 'City is required';\n if (!form.postalCode.trim()) e.postalCode = 'Postal code is required';\n if (!form.country.trim()) e.country = 'Country is required';\n }\n setErrors(e);\n return Object.keys(e).length === 0;\n };\n\n const handleSubmit = async () => {\n if (!validate()) return;\n setSubmitting(true);\n setServerError(null);\n\n try {\n const ops: Promise<unknown>[] = [];\n\n if (!hasPhone && form.contactNumber.trim()) {\n ops.push(\n updateBillingAccount({\n variables: {\n input: {\n id: billingAccountId,\n contactNumber: form.contactNumber.trim(),\n },\n },\n })\n );\n }\n\n if (!hasAddress) {\n ops.push(\n setBillingAddress({\n variables: {\n input: {\n billingAccountId,\n line1: form.line1.trim(),\n ...(form.line2.trim() ? { line2: form.line2.trim() } : {}),\n city: form.city.trim(),\n ...(form.state.trim() ? { state: form.state.trim() } : {}),\n postalCode: form.postalCode.trim(),\n country: form.country,\n },\n },\n })\n );\n }\n\n await Promise.all(ops);\n onCompleted();\n } catch {\n setServerError('Failed to save billing details. Please try again.');\n } finally {\n setSubmitting(false);\n }\n };\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4\">\n <div className=\"bg-bg-surface border border-border-seam rounded-card shadow-[var(--shadow-elevation-4)] w-full max-w-lg max-h-[90vh] overflow-y-auto\">\n {/* Header */}\n <div className=\"flex items-start justify-between p-6 border-b border-border-subtle\">\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Complete billing details</h2>\n <p className=\"text-sm text-text-secondary mt-1\">\n We need a few more details before processing your payment.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={onCancel}\n className=\"p-2 text-text-secondary hover:text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <div className=\"p-6 space-y-6\">\n {serverError && (\n <div className=\"p-3 rounded-lg bg-status-error-bg-subtle border border-status-error-border text-sm text-status-error-text\">\n {serverError}\n </div>\n )}\n\n {/* Phone */}\n {!hasPhone && (\n <section className=\"space-y-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <Phone className=\"size-4 text-text-secondary\" />\n Contact number\n </div>\n <div>\n <input\n type=\"tel\"\n value={form.contactNumber}\n onChange={(e) => set('contactNumber', e.target.value)}\n placeholder=\"+91 98765 43210\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.contactNumber ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.contactNumber && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.contactNumber}</p>\n )}\n </div>\n </section>\n )}\n\n {/* Address */}\n {!hasAddress && (\n <section className=\"space-y-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <MapPin className=\"size-4 text-text-secondary\" />\n Billing address\n </div>\n\n <div className=\"space-y-3\">\n {/* Country */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">Country</label>\n <select\n value={form.country}\n onChange={(e) => set('country', e.target.value)}\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.country ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n >\n {COUNTRY_OPTIONS.map((c) => (\n <option key={c.value} value={c.value}>\n {c.label}\n </option>\n ))}\n </select>\n </div>\n\n {/* Line 1 */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">Street address</label>\n <input\n type=\"text\"\n value={form.line1}\n onChange={(e) => set('line1', e.target.value)}\n placeholder=\"123 Main St\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.line1 ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.line1 && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.line1}</p>\n )}\n </div>\n\n {/* Line 2 */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">\n Apartment, suite, etc. <span className=\"text-text-muted\">(optional)</span>\n </label>\n <input\n type=\"text\"\n value={form.line2}\n onChange={(e) => set('line2', e.target.value)}\n placeholder=\"Apt 4B\"\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n\n {/* City + State */}\n <div className=\"grid grid-cols-2 gap-3\">\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">City</label>\n <input\n type=\"text\"\n value={form.city}\n onChange={(e) => set('city', e.target.value)}\n placeholder=\"Mumbai\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.city ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.city && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.city}</p>\n )}\n </div>\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">\n State <span className=\"text-text-muted\">(optional)</span>\n </label>\n <input\n type=\"text\"\n value={form.state}\n onChange={(e) => set('state', e.target.value)}\n placeholder=\"Maharashtra\"\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n\n {/* Postal code */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">Postal code</label>\n <input\n type=\"text\"\n value={form.postalCode}\n onChange={(e) => set('postalCode', e.target.value)}\n placeholder=\"400001\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.postalCode ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.postalCode && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.postalCode}</p>\n )}\n </div>\n </div>\n </section>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"flex items-center justify-end gap-3 p-6 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={onCancel}\n disabled={submitting}\n className=\"px-4 py-2 text-sm font-medium text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={submitting}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bgHover rounded-lg transition-colors disabled:opacity-50\"\n >\n {submitting && <Loader2 className=\"size-4 animate-spin\" />}\n Save and continue\n </button>\n </div>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;AAaA,IAAM,IAAkB;CACtB;EAAE,OAAO;EAAM,OAAO;CAAQ;CAC9B;EAAE,OAAO;EAAM,OAAO;CAAgB;CACtC;EAAE,OAAO;EAAM,OAAO;CAAiB;CACvC;EAAE,OAAO;EAAM,OAAO;CAAY;CAClC;EAAE,OAAO;EAAM,OAAO;CAAS;CAC/B;EAAE,OAAO;EAAM,OAAO;CAAY;CAClC;EAAE,OAAO;EAAM,OAAO;CAAU;CAChC;EAAE,OAAO;EAAM,OAAO;CAAS;CAC/B;EAAE,OAAO;EAAM,OAAO;CAAM;AAC9B;AA+BA,SAAgB,EAAyB,GAQ7B;CACV,IAAM,IAAW,EAAQ,EAAQ,eAAe,KAAK,GAC/C,IAAiB,EAAQ,mBAAmB,IAC5C,IAAa,GACjB,GAAgB,OAAO,KAAK,KAC5B,GAAgB,MAAM,KAAK,KAC3B,GAAgB,YAAY,KAAK,KACjC,GAAgB,SAAS,KAAK;CAEhC,OAAO,KAAY;AACrB;AAEA,IAAa,KAA0C,EACrD,qBACA,aACA,eACA,gBACA,kBACI;CACJ,IAAM,CAAC,GAAM,KAAW,EAAoB;EAC1C,eAAe;EACf,OAAO;EAC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SACE;;KAER;;IAGL,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,UAAU;MACV,WAAU;gBACX;KAEO,CAAA,GACR,kBAAC,UAAD;MACE,MAAK;MACL,SAAS,YA7Nc;OAC1B,MAAS,GAEd;QADA,EAAc,EAAI,GAClB,EAAe,IAAI;QAEnB,IAAI;SACF,IAAM,IAA0B,CAAC;SAkCjC,AAhCI,CAAC,KAAY,EAAK,cAAc,KAAK,KACvC,EAAI,KACF,EAAqB,EACnB,WAAW,EACT,OAAO;UACL,IAAI;UACJ,eAAe,EAAK,cAAc,KAAK;SACzC,EACF,EACF,CAAC,CACH,GAGG,KACH,EAAI,KACF,EAAkB,EAChB,WAAW,EACT,OAAO;UACL;UACA,OAAO,EAAK,MAAM,KAAK;UACvB,GAAI,EAAK,MAAM,KAAK,IAAI,EAAE,OAAO,EAAK,MAAM,KAAK,EAAE,IAAI,CAAC;UACxD,MAAM,EAAK,KAAK,KAAK;UACrB,GAAI,EAAK,MAAM,KAAK,IAAI,EAAE,OAAO,EAAK,MAAM,KAAK,EAAE,IAAI,CAAC;UACxD,YAAY,EAAK,WAAW,KAAK;UACjC,SAAS,EAAK;SAChB,EACF,EACF,CAAC,CACH,GAGF,MAAM,QAAQ,IAAI,CAAG,GACrB,EAAY;QACd,QAAQ;SACN,EAAe,mDAAmD;QACpE,UAAU;SACR,EAAc,EAAK;QACrB;OA1CmB;MA2CrB;MAgLU,UAAU;MACV,WAAU;gBAJZ,CAMG,KAAc,kBAAC,GAAD,EAAS,WAAU,sBAAuB,CAAA,GAAE,mBAErD;OACL;;GACF;;CACF,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"CompleteBillingAccountModal.js","names":["COUNTRY_OPTIONS","isBillingAccountComplete","hasPhone","account","primaryAddress","hasAddress","CompleteBillingAccountModal","form","setForm","useState","errors","setErrors","submitting","setSubmitting","serverError","setServerError","setBillingAddress","useSetBillingAddressMutation","updateBillingAccount","useUpdateBillingAccountMutation","set","prev","field","value","validate","onCancel","X","Phone","MapPin","c","ops","billingAccountId","onCompleted","Loader2"],"sources":["../../../../../src/billing/modules/checkout/components/CompleteBillingAccountModal.tsx"],"sourcesContent":["/**\n * Modal shown at checkout when the selected billing account is missing\n * a billing address or contact number — fields that can't be auto-filled\n * during account creation but are required by payment providers.\n */\n\nimport { type FC, useState } from 'react';\nimport { MapPin, Phone, Loader2, X } from 'lucide-react';\nimport {\n useSetBillingAddressMutation,\n useUpdateBillingAccountMutation,\n} from '../../../../generated/global-operations';\n\nconst COUNTRY_OPTIONS = [\n { value: 'IN', label: 'India' },\n { value: 'US', label: 'United States' },\n { value: 'GB', label: 'United Kingdom' },\n { value: 'AU', label: 'Australia' },\n { value: 'CA', label: 'Canada' },\n { value: 'SG', label: 'Singapore' },\n { value: 'DE', label: 'Germany' },\n { value: 'FR', label: 'France' },\n { value: 'AE', label: 'UAE' },\n];\n\ninterface FormState {\n contactNumber: string;\n line1: string;\n line2: string;\n city: string;\n state: string;\n postalCode: string;\n country: string;\n}\n\ninterface FormErrors {\n contactNumber?: string;\n line1?: string;\n city?: string;\n postalCode?: string;\n country?: string;\n}\n\ninterface Props {\n billingAccountId: string;\n /** Whether contactNumber is already filled on the account */\n hasPhone: boolean;\n /** Whether a billing address already exists (with line1 + postalCode) */\n hasAddress: boolean;\n onCompleted: () => void;\n onCancel: () => void;\n}\n\n/** Returns true when a billing account has everything required for checkout. */\nexport function isBillingAccountComplete(account: {\n contactNumber?: string | null;\n billingAddresses?: Array<{\n line1?: string | null;\n city?: string | null;\n postalCode?: string | null;\n country?: string | null;\n }> | null;\n}): boolean {\n const hasPhone = Boolean(account.contactNumber?.trim());\n const primaryAddress = account.billingAddresses?.[0];\n const hasAddress = Boolean(\n primaryAddress?.line1?.trim() &&\n primaryAddress?.city?.trim() &&\n primaryAddress?.postalCode?.trim() &&\n primaryAddress?.country?.trim()\n );\n return hasPhone && hasAddress;\n}\n\nexport const CompleteBillingAccountModal: FC<Props> = ({\n billingAccountId,\n hasPhone,\n hasAddress,\n onCompleted,\n onCancel,\n}) => {\n const [form, setForm] = useState<FormState>({\n contactNumber: '',\n line1: '',\n line2: '',\n city: '',\n state: '',\n postalCode: '',\n country: 'IN',\n });\n const [errors, setErrors] = useState<FormErrors>({});\n const [submitting, setSubmitting] = useState(false);\n const [serverError, setServerError] = useState<string | null>(null);\n\n const [setBillingAddress] = useSetBillingAddressMutation();\n const [updateBillingAccount] = useUpdateBillingAccountMutation();\n\n const set = (field: keyof FormState, value: string) =>\n setForm((prev) => ({ ...prev, [field]: value }));\n\n const validate = (): boolean => {\n const e: FormErrors = {};\n if (!hasPhone && !form.contactNumber.trim()) {\n e.contactNumber = 'Phone number is required for payment processing';\n }\n if (!hasAddress) {\n if (!form.line1.trim()) e.line1 = 'Street address is required';\n if (!form.city.trim()) e.city = 'City is required';\n if (!form.postalCode.trim()) e.postalCode = 'Postal code is required';\n if (!form.country.trim()) e.country = 'Country is required';\n }\n setErrors(e);\n return Object.keys(e).length === 0;\n };\n\n const handleSubmit = async () => {\n if (!validate()) return;\n setSubmitting(true);\n setServerError(null);\n\n try {\n const ops: Promise<unknown>[] = [];\n\n if (!hasPhone && form.contactNumber.trim()) {\n ops.push(\n updateBillingAccount({\n variables: {\n input: {\n id: billingAccountId,\n contactNumber: form.contactNumber.trim(),\n },\n },\n })\n );\n }\n\n if (!hasAddress) {\n ops.push(\n setBillingAddress({\n variables: {\n input: {\n billingAccountId,\n line1: form.line1.trim(),\n ...(form.line2.trim() ? { line2: form.line2.trim() } : {}),\n city: form.city.trim(),\n ...(form.state.trim() ? { state: form.state.trim() } : {}),\n postalCode: form.postalCode.trim(),\n country: form.country,\n },\n },\n })\n );\n }\n\n await Promise.all(ops);\n onCompleted();\n } catch {\n setServerError('Failed to save billing details. Please try again.');\n } finally {\n setSubmitting(false);\n }\n };\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center bg-bg-overlay p-4\">\n <div className=\"bg-bg-surface border border-border-seam rounded-card shadow-[var(--shadow-elevation-4)] w-full max-w-lg max-h-[90vh] overflow-y-auto\">\n {/* Header */}\n <div className=\"flex items-start justify-between p-6 border-b border-border-subtle\">\n <div>\n <h2 className=\"text-lg font-semibold text-text-primary\">Complete billing details</h2>\n <p className=\"text-sm text-text-secondary mt-1\">\n We need a few more details before processing your payment.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={onCancel}\n className=\"p-2 text-text-secondary hover:text-text-primary rounded-button hover:bg-bg-sunken transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n <div className=\"p-6 space-y-6\">\n {serverError && (\n <div className=\"p-3 rounded-lg bg-status-error-bg-subtle border border-status-error-border text-sm text-status-error-text\">\n {serverError}\n </div>\n )}\n\n {/* Phone */}\n {!hasPhone && (\n <section className=\"space-y-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <Phone className=\"size-4 text-text-secondary\" />\n Contact number\n </div>\n <div>\n <input\n type=\"tel\"\n value={form.contactNumber}\n onChange={(e) => set('contactNumber', e.target.value)}\n placeholder=\"+91 98765 43210\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.contactNumber ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.contactNumber && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.contactNumber}</p>\n )}\n </div>\n </section>\n )}\n\n {/* Address */}\n {!hasAddress && (\n <section className=\"space-y-3\">\n <div className=\"flex items-center gap-2 text-sm font-medium text-text-primary\">\n <MapPin className=\"size-4 text-text-secondary\" />\n Billing address\n </div>\n\n <div className=\"space-y-3\">\n {/* Country */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">Country</label>\n <select\n value={form.country}\n onChange={(e) => set('country', e.target.value)}\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface scheme-normal dark:scheme-dark [&_option]:bg-bg-surface [&_option]:text-text-primary text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.country ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n >\n {COUNTRY_OPTIONS.map((c) => (\n <option key={c.value} value={c.value}>\n {c.label}\n </option>\n ))}\n </select>\n </div>\n\n {/* Line 1 */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">Street address</label>\n <input\n type=\"text\"\n value={form.line1}\n onChange={(e) => set('line1', e.target.value)}\n placeholder=\"123 Main St\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.line1 ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.line1 && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.line1}</p>\n )}\n </div>\n\n {/* Line 2 */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">\n Apartment, suite, etc. <span className=\"text-text-muted\">(optional)</span>\n </label>\n <input\n type=\"text\"\n value={form.line2}\n onChange={(e) => set('line2', e.target.value)}\n placeholder=\"Apt 4B\"\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n\n {/* City + State */}\n <div className=\"grid grid-cols-2 gap-3\">\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">City</label>\n <input\n type=\"text\"\n value={form.city}\n onChange={(e) => set('city', e.target.value)}\n placeholder=\"Mumbai\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.city ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.city && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.city}</p>\n )}\n </div>\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">\n State <span className=\"text-text-muted\">(optional)</span>\n </label>\n <input\n type=\"text\"\n value={form.state}\n onChange={(e) => set('state', e.target.value)}\n placeholder=\"Maharashtra\"\n className=\"w-full px-3 py-2 text-sm border border-border-subtle rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n </div>\n\n {/* Postal code */}\n <div>\n <label className=\"block text-xs text-text-secondary mb-1\">Postal code</label>\n <input\n type=\"text\"\n value={form.postalCode}\n onChange={(e) => set('postalCode', e.target.value)}\n placeholder=\"400001\"\n className={`w-full px-3 py-2 text-sm border rounded-input bg-bg-surface text-text-primary placeholder:text-text-placeholder focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] ${\n errors.postalCode ? 'border-status-error-border' : 'border-border-subtle'\n }`}\n />\n {errors.postalCode && (\n <p className=\"mt-1 text-xs text-status-error-text\">{errors.postalCode}</p>\n )}\n </div>\n </div>\n </section>\n )}\n </div>\n\n {/* Footer */}\n <div className=\"flex items-center justify-end gap-3 p-6 border-t border-border-subtle\">\n <button\n type=\"button\"\n onClick={onCancel}\n disabled={submitting}\n className=\"px-4 py-2 text-sm font-medium text-text-secondary hover:text-text-primary hover:bg-bg-sunken rounded-lg transition-colors\"\n >\n Cancel\n </button>\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={submitting}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-action-primary-text bg-action-primary-bg hover:bg-action-primary-bgHover rounded-lg transition-colors disabled:opacity-50\"\n >\n {submitting && <Loader2 className=\"size-4 animate-spin\" />}\n Save and continue\n </button>\n </div>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;AAaA,IAAMA,IAAkB;CACtB;EAAE,OAAO;EAAM,OAAO;CAAQ;CAC9B;EAAE,OAAO;EAAM,OAAO;CAAgB;CACtC;EAAE,OAAO;EAAM,O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Ac,KAAK,KACvCuB,EAAI,KACFZ,EAAqB,EACnB,WAAW,EACT,OAAO;UACL,IAAIa;UACJ,eAAexB,EAAK,cAAc,KAAK;SACzC,EACF,EACF,CAAC,CACH,GAGGF,KACHyB,EAAI,KACFd,EAAkB,EAChB,WAAW,EACT,OAAO;UACL;UACA,OAAOT,EAAK,MAAM,KAAK;UACvB,GAAIA,EAAK,MAAM,KAAK,IAAI,EAAE,OAAOA,EAAK,MAAM,KAAK,EAAE,IAAI,CAAC;UACxD,MAAMA,EAAK,KAAK,KAAK;UACrB,GAAIA,EAAK,MAAM,KAAK,IAAI,EAAE,OAAOA,EAAK,MAAM,KAAK,EAAE,IAAI,CAAC;UACxD,YAAYA,EAAK,WAAW,KAAK;UACjC,SAASA,EAAK;SAChB,EACF,EACF,CAAC,CACH,GAGF,MAAM,QAAQ,IAAIuB,CAAG,GACrBE,EAAY;QACd,QAAQ;SACN,EAAe,mDAAmD;QACpE,UAAU;SACR,EAAc,EAAK;QACrB;OA3CkB;MA4CpB;MAgLU,UAAUpB;MACV,WAAU;MAJZ,UAAA,CAMGA,KAAc,kBAACqB,GAAD,EAAS,WAAU,sBAAuB,CAAA,GAAE,mBAErD;KACL,CAAA,CAAA;;GACF;;CACF,CAAA;AAET"}
|
|
@@ -3,7 +3,7 @@ import { useCallback as t, useState as n } from "react";
|
|
|
3
3
|
import { Coins as r, Minus as i, Plus as a } from "lucide-react";
|
|
4
4
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
import { useI18n as c } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
6
|
-
|
|
6
|
+
// src/billing/modules/checkout/components/CreditsAmountInput.tsx
|
|
7
7
|
var l = [
|
|
8
8
|
100,
|
|
9
9
|
500,
|
|
@@ -124,7 +124,6 @@ var l = [
|
|
|
124
124
|
]
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
|
-
//#endregion
|
|
128
127
|
export { u as CreditsAmountInput };
|
|
129
128
|
|
|
130
129
|
//# sourceMappingURL=CreditsAmountInput.js.map
|