@burdenoff/microfe-billing 2026.510.114
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/README.md +12 -0
- package/dist/billing/BillingAdminRoutes.d.ts +6 -0
- package/dist/billing/BillingAdminRoutes.d.ts.map +1 -0
- package/dist/billing/BillingAdminRoutes.js +359 -0
- package/dist/billing/BillingAdminRoutes.js.map +1 -0
- package/dist/billing/BillingRoot.d.ts +37 -0
- package/dist/billing/BillingRoot.d.ts.map +1 -0
- package/dist/billing/BillingRoot.js +190 -0
- package/dist/billing/BillingRoot.js.map +1 -0
- package/dist/billing/BillingUserRoutes.d.ts +7 -0
- package/dist/billing/BillingUserRoutes.d.ts.map +1 -0
- package/dist/billing/BillingUserRoutes.js +479 -0
- package/dist/billing/BillingUserRoutes.js.map +1 -0
- package/dist/billing/constants/permissions.d.ts +18 -0
- package/dist/billing/constants/permissions.d.ts.map +1 -0
- package/dist/billing/hooks/useBillingAccountSelection.d.ts +36 -0
- package/dist/billing/hooks/useBillingAccountSelection.d.ts.map +1 -0
- package/dist/billing/hooks/useBillingAccountSelection.js +81 -0
- package/dist/billing/hooks/useBillingAccountSelection.js.map +1 -0
- package/dist/billing/hooks/useBillingEventEmitter.d.ts +8 -0
- package/dist/billing/hooks/useBillingEventEmitter.d.ts.map +1 -0
- package/dist/billing/hooks/useBillingEventEmitter.js +15 -0
- package/dist/billing/hooks/useBillingEventEmitter.js.map +1 -0
- package/dist/billing/hooks/useBillingNavigate.d.ts +30 -0
- package/dist/billing/hooks/useBillingNavigate.d.ts.map +1 -0
- package/dist/billing/hooks/useBillingNavigate.js +23 -0
- package/dist/billing/hooks/useBillingNavigate.js.map +1 -0
- package/dist/billing/hooks/useBillingPermissions.d.ts +94 -0
- package/dist/billing/hooks/useBillingPermissions.d.ts.map +1 -0
- package/dist/billing/hooks/useBillingPermissions.js +78 -0
- package/dist/billing/hooks/useBillingPermissions.js.map +1 -0
- package/dist/billing/hooks/useDefaultBillingCurrency.d.ts +14 -0
- package/dist/billing/hooks/useDefaultBillingCurrency.d.ts.map +1 -0
- package/dist/billing/hooks/useDefaultBillingCurrency.js +23 -0
- package/dist/billing/hooks/useDefaultBillingCurrency.js.map +1 -0
- package/dist/billing/index.d.ts +31 -0
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/lib/native-purchases.d.ts +51 -0
- package/dist/billing/lib/native-purchases.d.ts.map +1 -0
- package/dist/billing/lib/native-purchases.js +44 -0
- package/dist/billing/lib/native-purchases.js.map +1 -0
- package/dist/billing/modules/addons/components/FloatingCartDrawer.d.ts +4 -0
- package/dist/billing/modules/addons/components/FloatingCartDrawer.d.ts.map +1 -0
- package/dist/billing/modules/addons/components/FloatingCartDrawer.js +179 -0
- package/dist/billing/modules/addons/components/FloatingCartDrawer.js.map +1 -0
- package/dist/billing/modules/addons/components/index.d.ts +5 -0
- package/dist/billing/modules/addons/components/index.d.ts.map +1 -0
- package/dist/billing/modules/addons/hooks/index.d.ts +6 -0
- package/dist/billing/modules/addons/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/addons/hooks/index.js +1 -0
- package/dist/billing/modules/addons/hooks/useAddons.d.ts +55 -0
- package/dist/billing/modules/addons/hooks/useAddons.d.ts.map +1 -0
- package/dist/billing/modules/addons/hooks/useAddons.js +77 -0
- package/dist/billing/modules/addons/hooks/useAddons.js.map +1 -0
- package/dist/billing/modules/addons/index.d.ts +7 -0
- package/dist/billing/modules/addons/index.d.ts.map +1 -0
- package/dist/billing/modules/addons/index.js +10 -0
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.d.ts +4 -0
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +266 -0
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -0
- package/dist/billing/modules/addons/pages/AddonCreatePage.d.ts +4 -0
- package/dist/billing/modules/addons/pages/AddonCreatePage.d.ts.map +1 -0
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +369 -0
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -0
- package/dist/billing/modules/addons/pages/AddonDetailPage.d.ts +4 -0
- package/dist/billing/modules/addons/pages/AddonDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +280 -0
- package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -0
- package/dist/billing/modules/addons/pages/AddonEditPage.d.ts +4 -0
- package/dist/billing/modules/addons/pages/AddonEditPage.d.ts.map +1 -0
- package/dist/billing/modules/addons/pages/AddonEditPage.js +396 -0
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -0
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.d.ts +4 -0
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.d.ts.map +1 -0
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +582 -0
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -0
- package/dist/billing/modules/addons/pages/AddonsListPage.d.ts +4 -0
- package/dist/billing/modules/addons/pages/AddonsListPage.d.ts.map +1 -0
- package/dist/billing/modules/addons/pages/AddonsListPage.js +744 -0
- package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -0
- package/dist/billing/modules/addons/pages/index.d.ts +11 -0
- package/dist/billing/modules/addons/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/addons/pages/index.js +6 -0
- package/dist/billing/modules/addons/store/addonCartStore.d.ts +38 -0
- package/dist/billing/modules/addons/store/addonCartStore.d.ts.map +1 -0
- package/dist/billing/modules/addons/store/addonCartStore.js +74 -0
- package/dist/billing/modules/addons/store/addonCartStore.js.map +1 -0
- package/dist/billing/modules/affiliate/api.d.ts +101 -0
- package/dist/billing/modules/affiliate/api.d.ts.map +1 -0
- package/dist/billing/modules/affiliate/api.js +38 -0
- package/dist/billing/modules/affiliate/api.js.map +1 -0
- package/dist/billing/modules/affiliate/index.d.ts +2 -0
- package/dist/billing/modules/affiliate/index.d.ts.map +1 -0
- package/dist/billing/modules/affiliate/index.js +2 -0
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.d.ts +4 -0
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.d.ts.map +1 -0
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +464 -0
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -0
- package/dist/billing/modules/analytics/index.d.ts +5 -0
- package/dist/billing/modules/analytics/index.d.ts.map +1 -0
- package/dist/billing/modules/analytics/index.js +3 -0
- package/dist/billing/modules/analytics/pages/AnalyticsPage.d.ts +4 -0
- package/dist/billing/modules/analytics/pages/AnalyticsPage.d.ts.map +1 -0
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +469 -0
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -0
- package/dist/billing/modules/analytics/pages/index.d.ts +5 -0
- package/dist/billing/modules/analytics/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/analytics/pages/index.js +1 -0
- package/dist/billing/modules/billing/hooks/index.d.ts +10 -0
- package/dist/billing/modules/billing/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/billing/hooks/index.js +4 -0
- package/dist/billing/modules/billing/hooks/useInvoices.d.ts +67 -0
- package/dist/billing/modules/billing/hooks/useInvoices.d.ts.map +1 -0
- package/dist/billing/modules/billing/hooks/useInvoices.js +87 -0
- package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -0
- package/dist/billing/modules/billing/hooks/usePayments.d.ts +62 -0
- package/dist/billing/modules/billing/hooks/usePayments.d.ts.map +1 -0
- package/dist/billing/modules/billing/hooks/usePayments.js +3 -0
- package/dist/billing/modules/billing/hooks/useRefunds.d.ts +191 -0
- package/dist/billing/modules/billing/hooks/useRefunds.d.ts.map +1 -0
- package/dist/billing/modules/billing/hooks/useRefunds.js +162 -0
- package/dist/billing/modules/billing/hooks/useRefunds.js.map +1 -0
- package/dist/billing/modules/billing/hooks/useTransactions.d.ts +41 -0
- package/dist/billing/modules/billing/hooks/useTransactions.d.ts.map +1 -0
- package/dist/billing/modules/billing/hooks/useTransactions.js +55 -0
- package/dist/billing/modules/billing/hooks/useTransactions.js.map +1 -0
- package/dist/billing/modules/billing/index.d.ts +7 -0
- package/dist/billing/modules/billing/index.d.ts.map +1 -0
- package/dist/billing/modules/billing/index.js +11 -0
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.d.ts +4 -0
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +631 -0
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -0
- package/dist/billing/modules/billing/pages/InvoicesListPage.d.ts +4 -0
- package/dist/billing/modules/billing/pages/InvoicesListPage.d.ts.map +1 -0
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +382 -0
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -0
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.d.ts +4 -0
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.d.ts.map +1 -0
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +147 -0
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -0
- package/dist/billing/modules/billing/pages/RefundsPage.d.ts +4 -0
- package/dist/billing/modules/billing/pages/RefundsPage.d.ts.map +1 -0
- package/dist/billing/modules/billing/pages/RefundsPage.js +1074 -0
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -0
- package/dist/billing/modules/billing/pages/TransactionsPage.d.ts +4 -0
- package/dist/billing/modules/billing/pages/TransactionsPage.d.ts.map +1 -0
- package/dist/billing/modules/billing/pages/TransactionsPage.js +587 -0
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -0
- package/dist/billing/modules/billing/pages/index.d.ts +10 -0
- package/dist/billing/modules/billing/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/billing/pages/index.js +5 -0
- package/dist/billing/modules/checkout/components/AutoPayToggle.d.ts +14 -0
- package/dist/billing/modules/checkout/components/AutoPayToggle.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/AutoPayToggle.js +3 -0
- package/dist/billing/modules/checkout/components/BillingAccountSelector.d.ts +14 -0
- package/dist/billing/modules/checkout/components/BillingAccountSelector.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/BillingAccountSelector.js +151 -0
- package/dist/billing/modules/checkout/components/BillingAccountSelector.js.map +1 -0
- package/dist/billing/modules/checkout/components/CompactAutoPayToggle.d.ts +14 -0
- package/dist/billing/modules/checkout/components/CompactAutoPayToggle.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/CompactAutoPayToggle.js +4 -0
- package/dist/billing/modules/checkout/components/CreditsAmountInput.d.ts +14 -0
- package/dist/billing/modules/checkout/components/CreditsAmountInput.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/CreditsAmountInput.js +130 -0
- package/dist/billing/modules/checkout/components/CreditsAmountInput.js.map +1 -0
- package/dist/billing/modules/checkout/components/CreditsPaymentOption.d.ts +16 -0
- package/dist/billing/modules/checkout/components/CreditsPaymentOption.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/CreditsPaymentOption.js +5 -0
- package/dist/billing/modules/checkout/components/CurrencySelector.d.ts +19 -0
- package/dist/billing/modules/checkout/components/CurrencySelector.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/CurrencySelector.js +5 -0
- package/dist/billing/modules/checkout/components/NativeCheckoutView.d.ts +14 -0
- package/dist/billing/modules/checkout/components/NativeCheckoutView.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/NativeCheckoutView.js +273 -0
- package/dist/billing/modules/checkout/components/NativeCheckoutView.js.map +1 -0
- package/dist/billing/modules/checkout/components/OrderSummary.d.ts +22 -0
- package/dist/billing/modules/checkout/components/OrderSummary.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/OrderSummary.js +293 -0
- package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -0
- package/dist/billing/modules/checkout/components/PaymentProviderSelector.d.ts +19 -0
- package/dist/billing/modules/checkout/components/PaymentProviderSelector.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/PaymentProviderSelector.js +3 -0
- package/dist/billing/modules/checkout/components/PromoCodeInput.d.ts +19 -0
- package/dist/billing/modules/checkout/components/PromoCodeInput.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/PromoCodeInput.js +102 -0
- package/dist/billing/modules/checkout/components/PromoCodeInput.js.map +1 -0
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.d.ts +25 -0
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js +169 -0
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js.map +1 -0
- package/dist/billing/modules/checkout/components/SavedCardSelector.d.ts +13 -0
- package/dist/billing/modules/checkout/components/SavedCardSelector.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/SavedCardSelector.js +4 -0
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.d.ts +13 -0
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.js +78 -0
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.js.map +1 -0
- package/dist/billing/modules/checkout/components/StripePaymentForm.d.ts +16 -0
- package/dist/billing/modules/checkout/components/StripePaymentForm.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/StripePaymentForm.js +253 -0
- package/dist/billing/modules/checkout/components/StripePaymentForm.js.map +1 -0
- package/dist/billing/modules/checkout/components/SubscriptionSelector.d.ts +26 -0
- package/dist/billing/modules/checkout/components/SubscriptionSelector.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/SubscriptionSelector.js +84 -0
- package/dist/billing/modules/checkout/components/SubscriptionSelector.js.map +1 -0
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.d.ts +23 -0
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.js +229 -0
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.js.map +1 -0
- package/dist/billing/modules/checkout/components/index.d.ts +20 -0
- package/dist/billing/modules/checkout/components/index.d.ts.map +1 -0
- package/dist/billing/modules/checkout/components/index.js +16 -0
- package/dist/billing/modules/checkout/graphql/index.d.ts +6 -0
- package/dist/billing/modules/checkout/graphql/index.d.ts.map +1 -0
- package/dist/billing/modules/checkout/hooks/index.d.ts +9 -0
- package/dist/billing/modules/checkout/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/checkout/hooks/index.js +4 -0
- package/dist/billing/modules/checkout/hooks/useCheckout.d.ts +69 -0
- package/dist/billing/modules/checkout/hooks/useCheckout.d.ts.map +1 -0
- package/dist/billing/modules/checkout/hooks/useCheckout.js +377 -0
- package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -0
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.d.ts +26 -0
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.d.ts.map +1 -0
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.js +88 -0
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.js.map +1 -0
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.d.ts +19 -0
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.d.ts.map +1 -0
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.js +16 -0
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.js.map +1 -0
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.d.ts +59 -0
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.d.ts.map +1 -0
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.js +107 -0
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.js.map +1 -0
- package/dist/billing/modules/checkout/index.d.ts +24 -0
- package/dist/billing/modules/checkout/index.d.ts.map +1 -0
- package/dist/billing/modules/checkout/index.js +19 -0
- package/dist/billing/modules/checkout/pages/CheckoutPage.d.ts +4 -0
- package/dist/billing/modules/checkout/pages/CheckoutPage.d.ts.map +1 -0
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +1248 -0
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -0
- package/dist/billing/modules/checkout/pages/index.d.ts +5 -0
- package/dist/billing/modules/checkout/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/checkout/pages/index.js +1 -0
- package/dist/billing/modules/checkout/types/index.d.ts +270 -0
- package/dist/billing/modules/checkout/types/index.d.ts.map +1 -0
- package/dist/billing/modules/checkout/utils/storeOrder.d.ts +20 -0
- package/dist/billing/modules/checkout/utils/storeOrder.d.ts.map +1 -0
- package/dist/billing/modules/checkout/utils/storeOrder.js +27 -0
- package/dist/billing/modules/checkout/utils/storeOrder.js.map +1 -0
- package/dist/billing/modules/coupons/index.d.ts +5 -0
- package/dist/billing/modules/coupons/index.d.ts.map +1 -0
- package/dist/billing/modules/coupons/index.js +6 -0
- package/dist/billing/modules/coupons/pages/CouponDetailPage.d.ts +4 -0
- package/dist/billing/modules/coupons/pages/CouponDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +489 -0
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -0
- package/dist/billing/modules/coupons/pages/CouponsListPage.d.ts +4 -0
- package/dist/billing/modules/coupons/pages/CouponsListPage.d.ts.map +1 -0
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +544 -0
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -0
- package/dist/billing/modules/coupons/pages/CreateCouponPage.d.ts +4 -0
- package/dist/billing/modules/coupons/pages/CreateCouponPage.d.ts.map +1 -0
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +421 -0
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -0
- package/dist/billing/modules/coupons/pages/EditCouponPage.d.ts +4 -0
- package/dist/billing/modules/coupons/pages/EditCouponPage.d.ts.map +1 -0
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +379 -0
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -0
- package/dist/billing/modules/coupons/pages/index.d.ts +8 -0
- package/dist/billing/modules/coupons/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/coupons/pages/index.js +4 -0
- package/dist/billing/modules/credits/hooks/index.d.ts +5 -0
- package/dist/billing/modules/credits/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/credits/hooks/index.js +1 -0
- package/dist/billing/modules/credits/hooks/useCredits.d.ts +75 -0
- package/dist/billing/modules/credits/hooks/useCredits.d.ts.map +1 -0
- package/dist/billing/modules/credits/hooks/useCredits.js +78 -0
- package/dist/billing/modules/credits/hooks/useCredits.js.map +1 -0
- package/dist/billing/modules/credits/index.d.ts +6 -0
- package/dist/billing/modules/credits/index.d.ts.map +1 -0
- package/dist/billing/modules/credits/index.js +8 -0
- package/dist/billing/modules/credits/pages/AdminCreditsPage.d.ts +4 -0
- package/dist/billing/modules/credits/pages/AdminCreditsPage.d.ts.map +1 -0
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +140 -0
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -0
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.d.ts +4 -0
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.d.ts.map +1 -0
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +331 -0
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -0
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.d.ts +4 -0
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.d.ts.map +1 -0
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +770 -0
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -0
- package/dist/billing/modules/credits/pages/CreditsPage.d.ts +4 -0
- package/dist/billing/modules/credits/pages/CreditsPage.d.ts.map +1 -0
- package/dist/billing/modules/credits/pages/CreditsPage.js +324 -0
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -0
- package/dist/billing/modules/credits/pages/index.d.ts +8 -0
- package/dist/billing/modules/credits/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/credits/pages/index.js +4 -0
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.d.ts +14 -0
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.js +185 -0
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.js.map +1 -0
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.d.ts +111 -0
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js +388 -0
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js.map +1 -0
- package/dist/billing/modules/dashboard/components/BillingAccountCard.d.ts +16 -0
- package/dist/billing/modules/dashboard/components/BillingAccountCard.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/components/BillingAccountCard.js +146 -0
- package/dist/billing/modules/dashboard/components/BillingAccountCard.js.map +1 -0
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.d.ts +13 -0
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js +1044 -0
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -0
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.d.ts +15 -0
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.js +216 -0
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.js.map +1 -0
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.d.ts +27 -0
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js +193 -0
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js.map +1 -0
- package/dist/billing/modules/dashboard/components/index.d.ts +10 -0
- package/dist/billing/modules/dashboard/components/index.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/components/index.js +6 -0
- package/dist/billing/modules/dashboard/hooks/index.d.ts +6 -0
- package/dist/billing/modules/dashboard/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/hooks/index.js +2 -0
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.d.ts +17 -0
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.js +42 -0
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.js.map +1 -0
- package/dist/billing/modules/dashboard/hooks/useDashboard.d.ts +145 -0
- package/dist/billing/modules/dashboard/hooks/useDashboard.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/hooks/useDashboard.js +118 -0
- package/dist/billing/modules/dashboard/hooks/useDashboard.js.map +1 -0
- package/dist/billing/modules/dashboard/index.d.ts +8 -0
- package/dist/billing/modules/dashboard/index.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/index.js +12 -0
- package/dist/billing/modules/dashboard/pages/OverviewPage.d.ts +4 -0
- package/dist/billing/modules/dashboard/pages/OverviewPage.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +478 -0
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -0
- package/dist/billing/modules/dashboard/pages/index.d.ts +5 -0
- package/dist/billing/modules/dashboard/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/dashboard/pages/index.js +1 -0
- package/dist/billing/modules/discounts/index.d.ts +6 -0
- package/dist/billing/modules/discounts/index.d.ts.map +1 -0
- package/dist/billing/modules/discounts/index.js +3 -0
- package/dist/billing/modules/discounts/pages/DiscountsListPage.d.ts +4 -0
- package/dist/billing/modules/discounts/pages/DiscountsListPage.d.ts.map +1 -0
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +1009 -0
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -0
- package/dist/billing/modules/discounts/pages/index.d.ts +6 -0
- package/dist/billing/modules/discounts/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/discounts/pages/index.js +1 -0
- package/dist/billing/modules/earnings/api.d.ts +131 -0
- package/dist/billing/modules/earnings/api.d.ts.map +1 -0
- package/dist/billing/modules/earnings/api.js +122 -0
- package/dist/billing/modules/earnings/api.js.map +1 -0
- package/dist/billing/modules/earnings/index.d.ts +4 -0
- package/dist/billing/modules/earnings/index.d.ts.map +1 -0
- package/dist/billing/modules/earnings/index.js +4 -0
- package/dist/billing/modules/earnings/pages/EarningsPage.d.ts +4 -0
- package/dist/billing/modules/earnings/pages/EarningsPage.d.ts.map +1 -0
- package/dist/billing/modules/earnings/pages/EarningsPage.js +435 -0
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -0
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.d.ts +4 -0
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.d.ts.map +1 -0
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +273 -0
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -0
- package/dist/billing/modules/earnings/pages/PayoutsPage.d.ts +4 -0
- package/dist/billing/modules/earnings/pages/PayoutsPage.d.ts.map +1 -0
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +480 -0
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -0
- package/dist/billing/modules/plans/hooks/index.d.ts +7 -0
- package/dist/billing/modules/plans/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/plans/hooks/index.js +2 -0
- package/dist/billing/modules/plans/hooks/usePlans.d.ts +46 -0
- package/dist/billing/modules/plans/hooks/usePlans.d.ts.map +1 -0
- package/dist/billing/modules/plans/hooks/usePlans.js +77 -0
- package/dist/billing/modules/plans/hooks/usePlans.js.map +1 -0
- package/dist/billing/modules/plans/hooks/useQuotas.d.ts +27 -0
- package/dist/billing/modules/plans/hooks/useQuotas.d.ts.map +1 -0
- package/dist/billing/modules/plans/hooks/useQuotas.js +21 -0
- package/dist/billing/modules/plans/hooks/useQuotas.js.map +1 -0
- package/dist/billing/modules/plans/index.d.ts +7 -0
- package/dist/billing/modules/plans/index.d.ts.map +1 -0
- package/dist/billing/modules/plans/index.js +11 -0
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.d.ts +4 -0
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +264 -0
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -0
- package/dist/billing/modules/plans/pages/PlanCreatePage.d.ts +4 -0
- package/dist/billing/modules/plans/pages/PlanCreatePage.d.ts.map +1 -0
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +368 -0
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -0
- package/dist/billing/modules/plans/pages/PlanDetailPage.d.ts +4 -0
- package/dist/billing/modules/plans/pages/PlanDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +356 -0
- package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -0
- package/dist/billing/modules/plans/pages/PlanEditPage.d.ts +4 -0
- package/dist/billing/modules/plans/pages/PlanEditPage.d.ts.map +1 -0
- package/dist/billing/modules/plans/pages/PlanEditPage.js +395 -0
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -0
- package/dist/billing/modules/plans/pages/PlansBrowsePage.d.ts +4 -0
- package/dist/billing/modules/plans/pages/PlansBrowsePage.d.ts.map +1 -0
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +314 -0
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -0
- package/dist/billing/modules/plans/pages/PlansListPage.d.ts +4 -0
- package/dist/billing/modules/plans/pages/PlansListPage.d.ts.map +1 -0
- package/dist/billing/modules/plans/pages/PlansListPage.js +438 -0
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -0
- package/dist/billing/modules/plans/pages/index.d.ts +11 -0
- package/dist/billing/modules/plans/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/plans/pages/index.js +6 -0
- package/dist/billing/modules/quota/hooks/index.d.ts +6 -0
- package/dist/billing/modules/quota/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/quota/hooks/index.js +2 -0
- package/dist/billing/modules/quota/hooks/useQuota.d.ts +102 -0
- package/dist/billing/modules/quota/hooks/useQuota.d.ts.map +1 -0
- package/dist/billing/modules/quota/hooks/useQuota.js +63 -0
- package/dist/billing/modules/quota/hooks/useQuota.js.map +1 -0
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.d.ts +39 -0
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.d.ts.map +1 -0
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.js +67 -0
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.js.map +1 -0
- package/dist/billing/modules/quota/index.d.ts +6 -0
- package/dist/billing/modules/quota/index.d.ts.map +1 -0
- package/dist/billing/modules/quota/index.js +10 -0
- package/dist/billing/modules/quota/pages/QuotaPage.d.ts +4 -0
- package/dist/billing/modules/quota/pages/QuotaPage.d.ts.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaPage.js +337 -0
- package/dist/billing/modules/quota/pages/QuotaPage.js.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.d.ts +4 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.d.ts.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +273 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.d.ts +4 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +272 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.d.ts +4 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.d.ts.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +316 -0
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.d.ts +4 -0
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.d.ts.map +1 -0
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +401 -0
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -0
- package/dist/billing/modules/quota/pages/index.d.ts +9 -0
- package/dist/billing/modules/quota/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/quota/pages/index.js +5 -0
- package/dist/billing/modules/settings/index.d.ts +5 -0
- package/dist/billing/modules/settings/index.d.ts.map +1 -0
- package/dist/billing/modules/settings/index.js +4 -0
- package/dist/billing/modules/settings/pages/SettingsPage.d.ts +4 -0
- package/dist/billing/modules/settings/pages/SettingsPage.d.ts.map +1 -0
- package/dist/billing/modules/settings/pages/SettingsPage.js +632 -0
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -0
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.d.ts +4 -0
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.d.ts.map +1 -0
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +270 -0
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -0
- package/dist/billing/modules/settings/pages/index.d.ts +6 -0
- package/dist/billing/modules/settings/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/settings/pages/index.js +2 -0
- package/dist/billing/modules/store/graphql/index.d.ts +6 -0
- package/dist/billing/modules/store/graphql/index.d.ts.map +1 -0
- package/dist/billing/modules/store/graphql/index.js +1 -0
- package/dist/billing/modules/store/index.d.ts +6 -0
- package/dist/billing/modules/store/index.d.ts.map +1 -0
- package/dist/billing/modules/store/index.js +3 -0
- package/dist/billing/modules/store/pages/StoreCheckoutPage.d.ts +11 -0
- package/dist/billing/modules/store/pages/StoreCheckoutPage.d.ts.map +1 -0
- package/dist/billing/modules/store/pages/StoreCheckoutPage.js +18 -0
- package/dist/billing/modules/store/pages/StoreCheckoutPage.js.map +1 -0
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.d.ts +12 -0
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js +167 -0
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js.map +1 -0
- package/dist/billing/modules/subscriptions/hooks/index.d.ts +6 -0
- package/dist/billing/modules/subscriptions/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/hooks/index.js +1 -0
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts +92 -0
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js +136 -0
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js.map +1 -0
- package/dist/billing/modules/subscriptions/index.d.ts +7 -0
- package/dist/billing/modules/subscriptions/index.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/index.js +7 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.d.ts +4 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +551 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.d.ts +4 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +529 -0
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -0
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.d.ts +4 -0
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +430 -0
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -0
- package/dist/billing/modules/subscriptions/pages/index.d.ts +8 -0
- package/dist/billing/modules/subscriptions/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/subscriptions/pages/index.js +3 -0
- package/dist/billing/modules/usage/hooks/index.d.ts +6 -0
- package/dist/billing/modules/usage/hooks/index.d.ts.map +1 -0
- package/dist/billing/modules/usage/hooks/index.js +1 -0
- package/dist/billing/modules/usage/hooks/useUsage.d.ts +203 -0
- package/dist/billing/modules/usage/hooks/useUsage.d.ts.map +1 -0
- package/dist/billing/modules/usage/hooks/useUsage.js +271 -0
- package/dist/billing/modules/usage/hooks/useUsage.js.map +1 -0
- package/dist/billing/modules/usage/index.d.ts +6 -0
- package/dist/billing/modules/usage/index.d.ts.map +1 -0
- package/dist/billing/modules/usage/index.js +5 -0
- package/dist/billing/modules/usage/pages/UsagePage.d.ts +4 -0
- package/dist/billing/modules/usage/pages/UsagePage.d.ts.map +1 -0
- package/dist/billing/modules/usage/pages/UsagePage.js +817 -0
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -0
- package/dist/billing/modules/usage/pages/index.d.ts +5 -0
- package/dist/billing/modules/usage/pages/index.d.ts.map +1 -0
- package/dist/billing/modules/usage/pages/index.js +1 -0
- package/dist/billing/providers/BillingProvider.d.ts +16 -0
- package/dist/billing/providers/BillingProvider.d.ts.map +1 -0
- package/dist/billing/providers/BillingProvider.js +40 -0
- package/dist/billing/providers/BillingProvider.js.map +1 -0
- package/dist/billing/shared/components/AccessDenied.d.ts +8 -0
- package/dist/billing/shared/components/AccessDenied.d.ts.map +1 -0
- package/dist/billing/shared/components/AccessDenied.js +44 -0
- package/dist/billing/shared/components/AccessDenied.js.map +1 -0
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.d.ts +11 -0
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.d.ts.map +1 -0
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.js +230 -0
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.js.map +1 -0
- package/dist/billing/shared/components/EmptyState.d.ts +11 -0
- package/dist/billing/shared/components/EmptyState.d.ts.map +1 -0
- package/dist/billing/shared/components/EmptyState.js +27 -0
- package/dist/billing/shared/components/EmptyState.js.map +1 -0
- package/dist/billing/shared/components/GeoPricingOverridesEditor.d.ts +11 -0
- package/dist/billing/shared/components/GeoPricingOverridesEditor.d.ts.map +1 -0
- package/dist/billing/shared/components/GeoPricingOverridesEditor.js +1 -0
- package/dist/billing/shared/components/PageHeader.d.ts +11 -0
- package/dist/billing/shared/components/PageHeader.d.ts.map +1 -0
- package/dist/billing/shared/components/PageHeader.js +25 -0
- package/dist/billing/shared/components/PageHeader.js.map +1 -0
- package/dist/billing/shared/components/ServerError.d.ts +11 -0
- package/dist/billing/shared/components/ServerError.d.ts.map +1 -0
- package/dist/billing/shared/components/ServerError.js +75 -0
- package/dist/billing/shared/components/ServerError.js.map +1 -0
- package/dist/billing/shared/components/StatCard.d.ts +15 -0
- package/dist/billing/shared/components/StatCard.d.ts.map +1 -0
- package/dist/billing/shared/components/StatCard.js +37 -0
- package/dist/billing/shared/components/StatCard.js.map +1 -0
- package/dist/billing/shared/components/index.d.ts +11 -0
- package/dist/billing/shared/components/index.d.ts.map +1 -0
- package/dist/billing/shared/components/index.js +7 -0
- package/dist/billing/shared/index.d.ts +8 -0
- package/dist/billing/shared/index.d.ts.map +1 -0
- package/dist/billing/shared/types/graphql.d.ts +926 -0
- package/dist/billing/shared/types/graphql.d.ts.map +1 -0
- package/dist/billing/shared/types/graphql.js +30 -0
- package/dist/billing/shared/types/graphql.js.map +1 -0
- package/dist/billing/shared/types/index.d.ts +96 -0
- package/dist/billing/shared/types/index.d.ts.map +1 -0
- package/dist/billing/shared/utils/directActivityGraphql.d.ts +13 -0
- package/dist/billing/shared/utils/directActivityGraphql.d.ts.map +1 -0
- package/dist/billing/shared/utils/directActivityGraphql.js +2 -0
- package/dist/billing/shared/utils/directBillingGraphql.d.ts +13 -0
- package/dist/billing/shared/utils/directBillingGraphql.d.ts.map +1 -0
- package/dist/billing/shared/utils/directBillingGraphql.js +22 -0
- package/dist/billing/shared/utils/directBillingGraphql.js.map +1 -0
- package/dist/billing/shared/utils/error.d.ts +30 -0
- package/dist/billing/shared/utils/error.d.ts.map +1 -0
- package/dist/billing/shared/utils/error.js +16 -0
- package/dist/billing/shared/utils/error.js.map +1 -0
- package/dist/billing/shared/utils/format.d.ts +28 -0
- package/dist/billing/shared/utils/format.d.ts.map +1 -0
- package/dist/billing/shared/utils/format.js +65 -0
- package/dist/billing/shared/utils/format.js.map +1 -0
- package/dist/billing/shared/utils/gatewayGraphql.d.ts +15 -0
- package/dist/billing/shared/utils/gatewayGraphql.d.ts.map +1 -0
- package/dist/billing/shared/utils/gatewayGraphql.js +27 -0
- package/dist/billing/shared/utils/gatewayGraphql.js.map +1 -0
- package/dist/billing/shared/utils/index.d.ts +13 -0
- package/dist/billing/shared/utils/index.d.ts.map +1 -0
- package/dist/billing/shared/utils/index.js +8 -0
- package/dist/billing/shared/utils/navigation.d.ts +2 -0
- package/dist/billing/shared/utils/navigation.d.ts.map +1 -0
- package/dist/billing/shared/utils/navigation.js +8 -0
- package/dist/billing/shared/utils/navigation.js.map +1 -0
- package/dist/billing/shared/utils/paymentTheme.d.ts +18 -0
- package/dist/billing/shared/utils/paymentTheme.d.ts.map +1 -0
- package/dist/billing/shared/utils/paymentTheme.js +32 -0
- package/dist/billing/shared/utils/paymentTheme.js.map +1 -0
- package/dist/billing/shared/utils/status.d.ts +28 -0
- package/dist/billing/shared/utils/status.d.ts.map +1 -0
- package/dist/billing/shared/utils/status.js +57 -0
- package/dist/billing/shared/utils/status.js.map +1 -0
- package/dist/billing/shared/utils/tokens.d.ts +156 -0
- package/dist/billing/shared/utils/tokens.d.ts.map +1 -0
- package/dist/billing/shared/utils/tokens.js +128 -0
- package/dist/billing/shared/utils/tokens.js.map +1 -0
- package/dist/billing/types/index.d.ts +268 -0
- package/dist/billing/types/index.d.ts.map +1 -0
- package/dist/billing/utils/index.d.ts +128 -0
- package/dist/billing/utils/index.d.ts.map +1 -0
- package/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/generated/global-operations.d.ts +9544 -0
- package/dist/generated/global-operations.d.ts.map +1 -0
- package/dist/generated/global-operations.js +3542 -0
- package/dist/generated/global-operations.js.map +1 -0
- package/dist/generated/global-types.d.ts +22208 -0
- package/dist/generated/global-types.d.ts.map +1 -0
- package/dist/generated/global-types.js +12 -0
- package/dist/generated/global-types.js.map +1 -0
- package/dist/generated/wspace-operations.d.ts +61 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -0
- package/dist/generated/wspace-operations.js +35 -0
- package/dist/generated/wspace-operations.js.map +1 -0
- package/dist/generated/wspace-types.d.ts +48578 -0
- package/dist/generated/wspace-types.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/@capacitor/core/dist/index.js +270 -0
- package/dist/node_modules/@capacitor/core/dist/index.js.map +1 -0
- package/dist/utils/nativeBridge.d.ts +3 -0
- package/dist/utils/nativeBridge.d.ts.map +1 -0
- package/dist/utils/nativeBridge.js +2 -0
- package/package.json +112 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { AccessDenied as e } from "../../../shared/components/AccessDenied.js";
|
|
2
|
+
import { PageHeader as t } from "../../../shared/components/PageHeader.js";
|
|
3
|
+
import "../../../shared/components/index.js";
|
|
4
|
+
import { useBillingPermissions as n } from "../../../hooks/useBillingPermissions.js";
|
|
5
|
+
import { useGetCouponLazyQuery as r, useUpdateCouponMutation as i } from "../../../../generated/global-operations.js";
|
|
6
|
+
import { useBillingNavigate as a } from "../../../hooks/useBillingNavigate.js";
|
|
7
|
+
import { CouponStatus as o } from "../../../../generated/global-types.js";
|
|
8
|
+
import { useEffect as s, useState as c } from "react";
|
|
9
|
+
import { AlertCircle as l, ArrowLeft as u, CheckCircle as d, Save as f } from "lucide-react";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
import { useI18n as h } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
12
|
+
//#region src/billing/modules/coupons/pages/EditCouponPage.tsx
|
|
13
|
+
var g = () => {
|
|
14
|
+
let { t: g } = h(), _ = (e, t) => {
|
|
15
|
+
let n = g(e);
|
|
16
|
+
return n === e ? t : n;
|
|
17
|
+
}, v = a(), y = n(), b = window.location.pathname.split("/").slice(-2)[0], [x, { data: S, loading: C, error: w }] = r(), [T, { loading: E }] = i(), [D, O] = c({
|
|
18
|
+
name: "",
|
|
19
|
+
description: "",
|
|
20
|
+
status: o.Active,
|
|
21
|
+
maxTotalUses: "",
|
|
22
|
+
maxUsesPerUser: "",
|
|
23
|
+
validUntil: ""
|
|
24
|
+
}), [k, A] = c({}), [j, M] = c(""), [N, P] = c(!1);
|
|
25
|
+
if (s(() => {
|
|
26
|
+
b && x({ variables: { id: b } });
|
|
27
|
+
}, [b, x]), s(() => {
|
|
28
|
+
if (S?.getCoupon) {
|
|
29
|
+
let e = S.getCoupon;
|
|
30
|
+
O({
|
|
31
|
+
name: e.name,
|
|
32
|
+
description: e.description || "",
|
|
33
|
+
status: e.status,
|
|
34
|
+
maxTotalUses: e.maxTotalUses?.toString() || "",
|
|
35
|
+
maxUsesPerUser: e.maxUsesPerUser.toString(),
|
|
36
|
+
validUntil: e.validUntil ? new Date(e.validUntil).toISOString().split("T")[0] : ""
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}, [S]), !y.canManageDiscounts) return /* @__PURE__ */ p(e, { message: "You don't have permission to manage coupons." });
|
|
40
|
+
let F = (e, t) => {
|
|
41
|
+
O((n) => ({
|
|
42
|
+
...n,
|
|
43
|
+
[e]: t
|
|
44
|
+
})), k[e] && A((t) => ({
|
|
45
|
+
...t,
|
|
46
|
+
[e]: ""
|
|
47
|
+
}));
|
|
48
|
+
}, I = () => {
|
|
49
|
+
let e = {};
|
|
50
|
+
return D.name.trim() || (e.name = "Name is required"), D.maxTotalUses && parseInt(D.maxTotalUses) < 1 && (e.maxTotalUses = "Must be at least 1"), D.maxUsesPerUser && parseInt(D.maxUsesPerUser) < 1 && (e.maxUsesPerUser = "Must be at least 1"), A(e), Object.keys(e).length === 0;
|
|
51
|
+
}, L = async (e) => {
|
|
52
|
+
if (e.preventDefault(), M(""), P(!1), I()) {
|
|
53
|
+
if (!b) {
|
|
54
|
+
M("Coupon ID is missing");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
let e = {};
|
|
59
|
+
D.name.trim() && (e.name = D.name.trim()), D.description.trim() && (e.description = D.description.trim()), D.status && (e.status = D.status), D.maxTotalUses && (e.maxTotalUses = parseInt(D.maxTotalUses)), D.maxUsesPerUser && (e.maxUsesPerUser = parseInt(D.maxUsesPerUser)), D.validUntil && (e.validUntil = new Date(D.validUntil).toISOString()), await T({ variables: {
|
|
60
|
+
id: b,
|
|
61
|
+
input: e
|
|
62
|
+
} }), P(!0), setTimeout(() => {
|
|
63
|
+
v("/coupons");
|
|
64
|
+
}, 1500);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.error("Failed to update coupon:", e), M(e instanceof Error ? e.message : "Failed to update coupon");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (C) return /* @__PURE__ */ m("div", {
|
|
71
|
+
className: "p-8",
|
|
72
|
+
children: [/* @__PURE__ */ p(t, {
|
|
73
|
+
title: _("billing.coupons.editTitle", "Edit Coupon"),
|
|
74
|
+
description: "Loading coupon data...",
|
|
75
|
+
actions: /* @__PURE__ */ m("button", {
|
|
76
|
+
onClick: () => v("/coupons"),
|
|
77
|
+
className: "px-4 py-2 rounded-lg border border-border text-foreground hover:bg-muted flex items-center gap-2",
|
|
78
|
+
children: [/* @__PURE__ */ p(u, { className: "h-4 w-4" }), "Back"]
|
|
79
|
+
})
|
|
80
|
+
}), /* @__PURE__ */ p("div", {
|
|
81
|
+
className: "flex items-center justify-center h-64",
|
|
82
|
+
children: /* @__PURE__ */ p("div", {
|
|
83
|
+
className: "text-muted-foreground",
|
|
84
|
+
children: "Loading coupon..."
|
|
85
|
+
})
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
if (w || !S?.getCoupon) return /* @__PURE__ */ m("div", {
|
|
89
|
+
className: "p-8",
|
|
90
|
+
children: [/* @__PURE__ */ p(t, {
|
|
91
|
+
title: "Edit Coupon",
|
|
92
|
+
description: "Coupon not found",
|
|
93
|
+
actions: /* @__PURE__ */ m("button", {
|
|
94
|
+
onClick: () => v("/coupons"),
|
|
95
|
+
className: "px-4 py-2 rounded-lg border border-border text-foreground hover:bg-muted flex items-center gap-2",
|
|
96
|
+
children: [/* @__PURE__ */ p(u, { className: "h-4 w-4" }), "Back"]
|
|
97
|
+
})
|
|
98
|
+
}), /* @__PURE__ */ p("div", {
|
|
99
|
+
className: "flex items-center justify-center h-64",
|
|
100
|
+
children: /* @__PURE__ */ p("div", {
|
|
101
|
+
className: "text-destructive",
|
|
102
|
+
children: w ? `Error: ${w.message}` : "Coupon not found"
|
|
103
|
+
})
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
let R = S.getCoupon;
|
|
107
|
+
return /* @__PURE__ */ m("div", {
|
|
108
|
+
className: "p-8",
|
|
109
|
+
children: [/* @__PURE__ */ p(t, {
|
|
110
|
+
title: "Edit Coupon",
|
|
111
|
+
description: `Editing: ${R.code}`,
|
|
112
|
+
actions: /* @__PURE__ */ m("button", {
|
|
113
|
+
onClick: () => v("/coupons"),
|
|
114
|
+
className: "px-4 py-2 rounded-lg border border-border text-foreground hover:bg-muted flex items-center gap-2",
|
|
115
|
+
children: [/* @__PURE__ */ p(u, { className: "h-4 w-4" }), "Back to Coupons"]
|
|
116
|
+
})
|
|
117
|
+
}), /* @__PURE__ */ p("div", {
|
|
118
|
+
className: "max-w-3xl mx-auto mt-8",
|
|
119
|
+
children: /* @__PURE__ */ m("form", {
|
|
120
|
+
onSubmit: L,
|
|
121
|
+
className: "space-y-6",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ m("div", {
|
|
124
|
+
className: "bg-muted/30 border border-border rounded-lg p-6",
|
|
125
|
+
children: [/* @__PURE__ */ p("h3", {
|
|
126
|
+
className: "text-lg font-semibold text-foreground mb-4",
|
|
127
|
+
children: "Coupon Details (Read-Only)"
|
|
128
|
+
}), /* @__PURE__ */ m("div", {
|
|
129
|
+
className: "grid grid-cols-2 gap-4 text-sm",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
|
|
132
|
+
className: "text-muted-foreground",
|
|
133
|
+
children: "Code:"
|
|
134
|
+
}), /* @__PURE__ */ p("span", {
|
|
135
|
+
className: "ml-2 font-mono font-medium text-foreground",
|
|
136
|
+
children: R.code
|
|
137
|
+
})] }),
|
|
138
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
|
|
139
|
+
className: "text-muted-foreground",
|
|
140
|
+
children: "Type:"
|
|
141
|
+
}), /* @__PURE__ */ p("span", {
|
|
142
|
+
className: "ml-2 text-foreground capitalize",
|
|
143
|
+
children: R.type.replace("_", " ").toLowerCase()
|
|
144
|
+
})] }),
|
|
145
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
|
|
146
|
+
className: "text-muted-foreground",
|
|
147
|
+
children: "Value:"
|
|
148
|
+
}), /* @__PURE__ */ p("span", {
|
|
149
|
+
className: "ml-2 text-foreground",
|
|
150
|
+
children: R.type === "PERCENTAGE" ? `${R.value}%` : `$${R.value}`
|
|
151
|
+
})] }),
|
|
152
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
|
|
153
|
+
className: "text-muted-foreground",
|
|
154
|
+
children: "Scope:"
|
|
155
|
+
}), /* @__PURE__ */ p("span", {
|
|
156
|
+
className: "ml-2 text-foreground",
|
|
157
|
+
children: R.scope
|
|
158
|
+
})] }),
|
|
159
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
|
|
160
|
+
className: "text-muted-foreground",
|
|
161
|
+
children: "Current Uses:"
|
|
162
|
+
}), /* @__PURE__ */ m("span", {
|
|
163
|
+
className: "ml-2 text-foreground",
|
|
164
|
+
children: [R.currentUses, R.maxTotalUses ? ` / ${R.maxTotalUses}` : ""]
|
|
165
|
+
})] }),
|
|
166
|
+
/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("span", {
|
|
167
|
+
className: "text-muted-foreground",
|
|
168
|
+
children: "Created:"
|
|
169
|
+
}), /* @__PURE__ */ p("span", {
|
|
170
|
+
className: "ml-2 text-foreground",
|
|
171
|
+
children: new Date(R.createdAt).toLocaleDateString()
|
|
172
|
+
})] })
|
|
173
|
+
]
|
|
174
|
+
})]
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ m("div", {
|
|
177
|
+
className: "bg-card border border-border rounded-lg p-6 space-y-6",
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ p("h3", {
|
|
180
|
+
className: "text-lg font-semibold text-foreground",
|
|
181
|
+
children: "Editable Fields"
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ m("div", {
|
|
184
|
+
className: "space-y-2",
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ m("label", {
|
|
187
|
+
htmlFor: "name",
|
|
188
|
+
className: "block text-sm font-medium text-foreground",
|
|
189
|
+
children: ["Name ", /* @__PURE__ */ p("span", {
|
|
190
|
+
className: "text-destructive",
|
|
191
|
+
children: "*"
|
|
192
|
+
})]
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ p("input", {
|
|
195
|
+
id: "name",
|
|
196
|
+
type: "text",
|
|
197
|
+
value: D.name,
|
|
198
|
+
onChange: (e) => F("name", e.target.value),
|
|
199
|
+
placeholder: "e.g., Welcome Discount",
|
|
200
|
+
className: "w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
201
|
+
}),
|
|
202
|
+
k.name && /* @__PURE__ */ p("p", {
|
|
203
|
+
className: "text-sm text-destructive",
|
|
204
|
+
children: k.name
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ m("div", {
|
|
209
|
+
className: "space-y-2",
|
|
210
|
+
children: [/* @__PURE__ */ p("label", {
|
|
211
|
+
htmlFor: "description",
|
|
212
|
+
className: "block text-sm font-medium text-foreground",
|
|
213
|
+
children: "Description"
|
|
214
|
+
}), /* @__PURE__ */ p("textarea", {
|
|
215
|
+
id: "description",
|
|
216
|
+
value: D.description,
|
|
217
|
+
onChange: (e) => F("description", e.target.value),
|
|
218
|
+
placeholder: "Optional description",
|
|
219
|
+
rows: 3,
|
|
220
|
+
className: "w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 resize-none"
|
|
221
|
+
})]
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ m("div", {
|
|
224
|
+
className: "space-y-2",
|
|
225
|
+
children: [/* @__PURE__ */ p("label", {
|
|
226
|
+
htmlFor: "status",
|
|
227
|
+
className: "block text-sm font-medium text-foreground",
|
|
228
|
+
children: "Status"
|
|
229
|
+
}), /* @__PURE__ */ m("select", {
|
|
230
|
+
id: "status",
|
|
231
|
+
value: D.status,
|
|
232
|
+
onChange: (e) => F("status", e.target.value),
|
|
233
|
+
className: "w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20",
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ p("option", {
|
|
236
|
+
value: "ACTIVE",
|
|
237
|
+
children: "Active"
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ p("option", {
|
|
240
|
+
value: "INACTIVE",
|
|
241
|
+
children: "Inactive"
|
|
242
|
+
}),
|
|
243
|
+
/* @__PURE__ */ p("option", {
|
|
244
|
+
value: "EXPIRED",
|
|
245
|
+
children: "Expired"
|
|
246
|
+
}),
|
|
247
|
+
/* @__PURE__ */ p("option", {
|
|
248
|
+
value: "DEPLETED",
|
|
249
|
+
children: "Depleted"
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
})]
|
|
253
|
+
}),
|
|
254
|
+
/* @__PURE__ */ m("div", {
|
|
255
|
+
className: "space-y-2",
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ p("label", {
|
|
258
|
+
htmlFor: "maxTotalUses",
|
|
259
|
+
className: "block text-sm font-medium text-foreground",
|
|
260
|
+
children: "Maximum Total Uses"
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ p("input", {
|
|
263
|
+
id: "maxTotalUses",
|
|
264
|
+
type: "number",
|
|
265
|
+
min: "1",
|
|
266
|
+
value: D.maxTotalUses,
|
|
267
|
+
onChange: (e) => F("maxTotalUses", e.target.value),
|
|
268
|
+
placeholder: "Leave empty for unlimited",
|
|
269
|
+
className: "w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
270
|
+
}),
|
|
271
|
+
k.maxTotalUses && /* @__PURE__ */ p("p", {
|
|
272
|
+
className: "text-sm text-destructive",
|
|
273
|
+
children: k.maxTotalUses
|
|
274
|
+
}),
|
|
275
|
+
/* @__PURE__ */ m("p", {
|
|
276
|
+
className: "text-sm text-muted-foreground",
|
|
277
|
+
children: [
|
|
278
|
+
"Current uses: ",
|
|
279
|
+
R.currentUses,
|
|
280
|
+
R.maxTotalUses ? ` / ${R.maxTotalUses}` : ""
|
|
281
|
+
]
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ m("div", {
|
|
286
|
+
className: "space-y-2",
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ p("label", {
|
|
289
|
+
htmlFor: "maxUsesPerUser",
|
|
290
|
+
className: "block text-sm font-medium text-foreground",
|
|
291
|
+
children: "Maximum Uses Per User"
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ p("input", {
|
|
294
|
+
id: "maxUsesPerUser",
|
|
295
|
+
type: "number",
|
|
296
|
+
min: "1",
|
|
297
|
+
value: D.maxUsesPerUser,
|
|
298
|
+
onChange: (e) => F("maxUsesPerUser", e.target.value),
|
|
299
|
+
placeholder: "e.g., 1",
|
|
300
|
+
className: "w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
301
|
+
}),
|
|
302
|
+
k.maxUsesPerUser && /* @__PURE__ */ p("p", {
|
|
303
|
+
className: "text-sm text-destructive",
|
|
304
|
+
children: k.maxUsesPerUser
|
|
305
|
+
})
|
|
306
|
+
]
|
|
307
|
+
}),
|
|
308
|
+
/* @__PURE__ */ m("div", {
|
|
309
|
+
className: "space-y-2",
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ p("label", {
|
|
312
|
+
htmlFor: "validUntil",
|
|
313
|
+
className: "block text-sm font-medium text-foreground",
|
|
314
|
+
children: "Valid Until"
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ p("input", {
|
|
317
|
+
id: "validUntil",
|
|
318
|
+
type: "date",
|
|
319
|
+
value: D.validUntil,
|
|
320
|
+
onChange: (e) => F("validUntil", e.target.value),
|
|
321
|
+
className: "w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
322
|
+
}),
|
|
323
|
+
/* @__PURE__ */ p("p", {
|
|
324
|
+
className: "text-sm text-muted-foreground",
|
|
325
|
+
children: "Leave empty for no expiration"
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
})
|
|
329
|
+
]
|
|
330
|
+
}),
|
|
331
|
+
j && /* @__PURE__ */ m("div", {
|
|
332
|
+
className: "flex items-start gap-3 p-4 rounded-lg bg-destructive/10 border border-destructive/20",
|
|
333
|
+
children: [/* @__PURE__ */ p(l, { className: "h-5 w-5 text-destructive mt-0.5" }), /* @__PURE__ */ m("div", {
|
|
334
|
+
className: "flex-1",
|
|
335
|
+
children: [/* @__PURE__ */ p("p", {
|
|
336
|
+
className: "text-sm font-medium text-destructive",
|
|
337
|
+
children: "Error"
|
|
338
|
+
}), /* @__PURE__ */ p("p", {
|
|
339
|
+
className: "text-sm text-destructive/90 mt-1",
|
|
340
|
+
children: j
|
|
341
|
+
})]
|
|
342
|
+
})]
|
|
343
|
+
}),
|
|
344
|
+
N && /* @__PURE__ */ m("div", {
|
|
345
|
+
className: "flex items-start gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-bg-subtle",
|
|
346
|
+
children: [/* @__PURE__ */ p(d, { className: "h-5 w-5 text-status-success-text mt-0.5" }), /* @__PURE__ */ m("div", {
|
|
347
|
+
className: "flex-1",
|
|
348
|
+
children: [/* @__PURE__ */ p("p", {
|
|
349
|
+
className: "text-sm font-medium text-status-success-text",
|
|
350
|
+
children: "Success"
|
|
351
|
+
}), /* @__PURE__ */ p("p", {
|
|
352
|
+
className: "text-sm text-status-success-text/90 mt-1",
|
|
353
|
+
children: "Coupon updated successfully! Redirecting..."
|
|
354
|
+
})]
|
|
355
|
+
})]
|
|
356
|
+
}),
|
|
357
|
+
/* @__PURE__ */ m("div", {
|
|
358
|
+
className: "flex gap-4 pt-4 border-t border-border",
|
|
359
|
+
children: [/* @__PURE__ */ m("button", {
|
|
360
|
+
type: "submit",
|
|
361
|
+
disabled: E || N,
|
|
362
|
+
className: "px-6 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",
|
|
363
|
+
children: [/* @__PURE__ */ p(f, { className: "h-4 w-4" }), E ? "Updating..." : "Update Coupon"]
|
|
364
|
+
}), /* @__PURE__ */ p("button", {
|
|
365
|
+
type: "button",
|
|
366
|
+
onClick: () => v("/coupons"),
|
|
367
|
+
className: "px-6 py-2 rounded-lg border border-border text-foreground hover:bg-muted",
|
|
368
|
+
children: "Cancel"
|
|
369
|
+
})]
|
|
370
|
+
})
|
|
371
|
+
]
|
|
372
|
+
})
|
|
373
|
+
})]
|
|
374
|
+
});
|
|
375
|
+
};
|
|
376
|
+
//#endregion
|
|
377
|
+
export { g as EditCouponPage };
|
|
378
|
+
|
|
379
|
+
//# sourceMappingURL=EditCouponPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditCouponPage.js","names":[],"sources":["../../../../../src/billing/modules/coupons/pages/EditCouponPage.tsx"],"sourcesContent":["/**\n * Edit Coupon Page\n *\n * Form for editing existing coupon codes\n * Note: Only certain fields can be edited (name, description, status, usage limits, expiration)\n * Code, type, value, and scope cannot be changed after creation\n */\n\nimport { type FC, useState, useEffect } from 'react';\nimport { useBillingNavigate } from '../../../hooks/useBillingNavigate';\nimport { ArrowLeft, Save, AlertCircle, CheckCircle } from 'lucide-react';\nimport { useBillingPermissions } from '../../../hooks/useBillingPermissions';\nimport { AccessDenied, PageHeader } from '../../../shared/components';\nimport {\n useGetCouponLazyQuery,\n useUpdateCouponMutation,\n} from '../../../../generated/global-operations';\nimport { Coupon, CouponStatus } from '../../../../generated/global-types';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\ninterface EditFormData {\n name: string;\n description: string;\n status: CouponStatus;\n maxTotalUses: string;\n maxUsesPerUser: string;\n validUntil: string;\n}\n\nexport const EditCouponPage: FC = () => {\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 navigateTo = useBillingNavigate();\n const permissions = useBillingPermissions();\n\n // Get coupon ID from URL\n const couponId = window.location.pathname.split('/').slice(-2)[0];\n\n const [getCoupon, { data, loading: loadingCoupon, error: loadError }] = useGetCouponLazyQuery();\n const [updateCoupon, { loading: updating }] = useUpdateCouponMutation();\n\n const [formData, setFormData] = useState<EditFormData>({\n name: '',\n description: '',\n status: CouponStatus.Active,\n maxTotalUses: '',\n maxUsesPerUser: '',\n validUntil: '',\n });\n\n const [errors, setErrors] = useState<Record<string, string>>({});\n const [submitError, setSubmitError] = useState('');\n const [submitSuccess, setSubmitSuccess] = useState(false);\n\n // Load coupon data\n useEffect(() => {\n if (couponId) {\n getCoupon({ variables: { id: couponId } });\n }\n }, [couponId, getCoupon]);\n\n // Populate form when data loads\n useEffect(() => {\n if (data?.getCoupon) {\n const coupon = data.getCoupon as Coupon;\n setFormData({\n name: coupon.name,\n description: coupon.description || '',\n status: coupon.status,\n maxTotalUses: coupon.maxTotalUses?.toString() || '',\n maxUsesPerUser: coupon.maxUsesPerUser.toString(),\n validUntil: coupon.validUntil\n ? new Date(coupon.validUntil).toISOString().split('T')[0]\n : '',\n });\n }\n }, [data]);\n\n // Check permissions\n if (!permissions.canManageDiscounts) {\n return <AccessDenied message=\"You don't have permission to manage coupons.\" />;\n }\n\n const handleInputChange = (field: keyof EditFormData, value: string) => {\n setFormData((prev) => ({ ...prev, [field]: value }));\n if (errors[field]) {\n setErrors((prev) => ({ ...prev, [field]: '' }));\n }\n };\n\n const validateForm = (): boolean => {\n const newErrors: Record<string, string> = {};\n\n if (!formData.name.trim()) {\n newErrors.name = 'Name is required';\n }\n\n if (formData.maxTotalUses && parseInt(formData.maxTotalUses) < 1) {\n newErrors.maxTotalUses = 'Must be at least 1';\n }\n\n if (formData.maxUsesPerUser && parseInt(formData.maxUsesPerUser) < 1) {\n newErrors.maxUsesPerUser = 'Must be at least 1';\n }\n\n setErrors(newErrors);\n return Object.keys(newErrors).length === 0;\n };\n\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n setSubmitError('');\n setSubmitSuccess(false);\n\n if (!validateForm()) {\n return;\n }\n\n if (!couponId) {\n setSubmitError('Coupon ID is missing');\n return;\n }\n\n try {\n const input: {\n name?: string;\n description?: string;\n status?: CouponStatus;\n maxTotalUses?: number;\n maxUsesPerUser?: number;\n validUntil?: string;\n } = {};\n\n if (formData.name.trim()) input.name = formData.name.trim();\n if (formData.description.trim()) input.description = formData.description.trim();\n if (formData.status) input.status = formData.status;\n if (formData.maxTotalUses) input.maxTotalUses = parseInt(formData.maxTotalUses);\n if (formData.maxUsesPerUser) input.maxUsesPerUser = parseInt(formData.maxUsesPerUser);\n if (formData.validUntil) input.validUntil = new Date(formData.validUntil).toISOString();\n\n await updateCoupon({\n variables: {\n id: couponId,\n input,\n },\n });\n\n setSubmitSuccess(true);\n setTimeout(() => {\n navigateTo('/coupons');\n }, 1500);\n } catch (error) {\n console.error('Failed to update coupon:', error);\n setSubmitError(error instanceof Error ? error.message : 'Failed to update coupon');\n }\n };\n\n if (loadingCoupon) {\n return (\n <div className=\"p-8\">\n <PageHeader\n title={tr('billing.coupons.editTitle', 'Edit Coupon')}\n description=\"Loading coupon data...\"\n actions={\n <button\n onClick={() => navigateTo('/coupons')}\n className=\"px-4 py-2 rounded-lg border border-border text-foreground hover:bg-muted flex items-center gap-2\"\n >\n <ArrowLeft className=\"h-4 w-4\" />\n Back\n </button>\n }\n />\n <div className=\"flex items-center justify-center h-64\">\n <div className=\"text-muted-foreground\">Loading coupon...</div>\n </div>\n </div>\n );\n }\n\n if (loadError || !data?.getCoupon) {\n return (\n <div className=\"p-8\">\n <PageHeader\n title=\"Edit Coupon\"\n description=\"Coupon not found\"\n actions={\n <button\n onClick={() => navigateTo('/coupons')}\n className=\"px-4 py-2 rounded-lg border border-border text-foreground hover:bg-muted flex items-center gap-2\"\n >\n <ArrowLeft className=\"h-4 w-4\" />\n Back\n </button>\n }\n />\n <div className=\"flex items-center justify-center h-64\">\n <div className=\"text-destructive\">\n {loadError ? `Error: ${loadError.message}` : 'Coupon not found'}\n </div>\n </div>\n </div>\n );\n }\n\n const coupon = data.getCoupon as Coupon;\n\n return (\n <div className=\"p-8\">\n <PageHeader\n title=\"Edit Coupon\"\n description={`Editing: ${coupon.code}`}\n actions={\n <button\n onClick={() => navigateTo('/coupons')}\n className=\"px-4 py-2 rounded-lg border border-border text-foreground hover:bg-muted flex items-center gap-2\"\n >\n <ArrowLeft className=\"h-4 w-4\" />\n Back to Coupons\n </button>\n }\n />\n\n <div className=\"max-w-3xl mx-auto mt-8\">\n <form onSubmit={handleSubmit} className=\"space-y-6\">\n {/* Read-only Information Card */}\n <div className=\"bg-muted/30 border border-border rounded-lg p-6\">\n <h3 className=\"text-lg font-semibold text-foreground mb-4\">\n Coupon Details (Read-Only)\n </h3>\n <div className=\"grid grid-cols-2 gap-4 text-sm\">\n <div>\n <span className=\"text-muted-foreground\">Code:</span>\n <span className=\"ml-2 font-mono font-medium text-foreground\">{coupon.code}</span>\n </div>\n <div>\n <span className=\"text-muted-foreground\">Type:</span>\n <span className=\"ml-2 text-foreground capitalize\">\n {coupon.type.replace('_', ' ').toLowerCase()}\n </span>\n </div>\n <div>\n <span className=\"text-muted-foreground\">Value:</span>\n <span className=\"ml-2 text-foreground\">\n {coupon.type === 'PERCENTAGE' ? `${coupon.value}%` : `$${coupon.value}`}\n </span>\n </div>\n <div>\n <span className=\"text-muted-foreground\">Scope:</span>\n <span className=\"ml-2 text-foreground\">{coupon.scope}</span>\n </div>\n <div>\n <span className=\"text-muted-foreground\">Current Uses:</span>\n <span className=\"ml-2 text-foreground\">\n {coupon.currentUses}\n {coupon.maxTotalUses ? ` / ${coupon.maxTotalUses}` : ''}\n </span>\n </div>\n <div>\n <span className=\"text-muted-foreground\">Created:</span>\n <span className=\"ml-2 text-foreground\">\n {new Date(coupon.createdAt).toLocaleDateString()}\n </span>\n </div>\n </div>\n </div>\n\n {/* Editable Fields Card */}\n <div className=\"bg-card border border-border rounded-lg p-6 space-y-6\">\n <h3 className=\"text-lg font-semibold text-foreground\">Editable Fields</h3>\n\n {/* Name */}\n <div className=\"space-y-2\">\n <label htmlFor=\"name\" className=\"block text-sm font-medium text-foreground\">\n Name <span className=\"text-destructive\">*</span>\n </label>\n <input\n id=\"name\"\n type=\"text\"\n value={formData.name}\n onChange={(e) => handleInputChange('name', e.target.value)}\n placeholder=\"e.g., Welcome Discount\"\n className=\"w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n {errors.name && <p className=\"text-sm text-destructive\">{errors.name}</p>}\n </div>\n\n {/* Description */}\n <div className=\"space-y-2\">\n <label htmlFor=\"description\" className=\"block text-sm font-medium text-foreground\">\n Description\n </label>\n <textarea\n id=\"description\"\n value={formData.description}\n onChange={(e) => handleInputChange('description', e.target.value)}\n placeholder=\"Optional description\"\n rows={3}\n className=\"w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 resize-none\"\n />\n </div>\n\n {/* Status */}\n <div className=\"space-y-2\">\n <label htmlFor=\"status\" className=\"block text-sm font-medium text-foreground\">\n Status\n </label>\n <select\n id=\"status\"\n value={formData.status}\n onChange={(e) => handleInputChange('status', e.target.value)}\n className=\"w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n >\n <option value=\"ACTIVE\">Active</option>\n <option value=\"INACTIVE\">Inactive</option>\n <option value=\"EXPIRED\">Expired</option>\n <option value=\"DEPLETED\">Depleted</option>\n </select>\n </div>\n\n {/* Max Total Uses */}\n <div className=\"space-y-2\">\n <label htmlFor=\"maxTotalUses\" className=\"block text-sm font-medium text-foreground\">\n Maximum Total Uses\n </label>\n <input\n id=\"maxTotalUses\"\n type=\"number\"\n min=\"1\"\n value={formData.maxTotalUses}\n onChange={(e) => handleInputChange('maxTotalUses', e.target.value)}\n placeholder=\"Leave empty for unlimited\"\n className=\"w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n {errors.maxTotalUses && (\n <p className=\"text-sm text-destructive\">{errors.maxTotalUses}</p>\n )}\n <p className=\"text-sm text-muted-foreground\">\n Current uses: {coupon.currentUses}\n {coupon.maxTotalUses ? ` / ${coupon.maxTotalUses}` : ''}\n </p>\n </div>\n\n {/* Max Uses Per User */}\n <div className=\"space-y-2\">\n <label htmlFor=\"maxUsesPerUser\" className=\"block text-sm font-medium text-foreground\">\n Maximum Uses Per User\n </label>\n <input\n id=\"maxUsesPerUser\"\n type=\"number\"\n min=\"1\"\n value={formData.maxUsesPerUser}\n onChange={(e) => handleInputChange('maxUsesPerUser', e.target.value)}\n placeholder=\"e.g., 1\"\n className=\"w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n {errors.maxUsesPerUser && (\n <p className=\"text-sm text-destructive\">{errors.maxUsesPerUser}</p>\n )}\n </div>\n\n {/* Valid Until */}\n <div className=\"space-y-2\">\n <label htmlFor=\"validUntil\" className=\"block text-sm font-medium text-foreground\">\n Valid Until\n </label>\n <input\n id=\"validUntil\"\n type=\"date\"\n value={formData.validUntil}\n onChange={(e) => handleInputChange('validUntil', e.target.value)}\n className=\"w-full px-4 py-2 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary/20\"\n />\n <p className=\"text-sm text-muted-foreground\">Leave empty for no expiration</p>\n </div>\n </div>\n\n {/* Error/Success Messages */}\n {submitError && (\n <div className=\"flex items-start gap-3 p-4 rounded-lg bg-destructive/10 border border-destructive/20\">\n <AlertCircle className=\"h-5 w-5 text-destructive mt-0.5\" />\n <div className=\"flex-1\">\n <p className=\"text-sm font-medium text-destructive\">Error</p>\n <p className=\"text-sm text-destructive/90 mt-1\">{submitError}</p>\n </div>\n </div>\n )}\n\n {submitSuccess && (\n <div className=\"flex items-start gap-3 p-4 rounded-lg bg-status-success-bg-subtle border border-status-success-bg-subtle\">\n <CheckCircle className=\"h-5 w-5 text-status-success-text mt-0.5\" />\n <div className=\"flex-1\">\n <p className=\"text-sm font-medium text-status-success-text\">Success</p>\n <p className=\"text-sm text-status-success-text/90 mt-1\">\n Coupon updated successfully! Redirecting...\n </p>\n </div>\n </div>\n )}\n\n {/* Actions */}\n <div className=\"flex gap-4 pt-4 border-t border-border\">\n <button\n type=\"submit\"\n disabled={updating || submitSuccess}\n className=\"px-6 py-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2\"\n >\n <Save className=\"h-4 w-4\" />\n {updating ? 'Updating...' : 'Update Coupon'}\n </button>\n <button\n type=\"button\"\n onClick={() => navigateTo('/coupons')}\n className=\"px-6 py-2 rounded-lg border border-border text-foreground hover:bg-muted\"\n >\n Cancel\n </button>\n </div>\n </form>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAa,UAA2B;CACtC,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAa,EAAE,EAAI;AACzB,SAAO,MAAe,IAAM,IAAW;IAEnC,IAAa,GAAoB,EACjC,IAAc,GAAuB,EAGrC,IAAW,OAAO,SAAS,SAAS,MAAM,IAAI,CAAC,MAAM,GAAG,CAAC,IAEz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coupon Pages
|
|
3
|
+
*/
|
|
4
|
+
export { CouponsListPage } from './CouponsListPage';
|
|
5
|
+
export { CreateCouponPage } from './CreateCouponPage';
|
|
6
|
+
export { EditCouponPage } from './EditCouponPage';
|
|
7
|
+
export { CouponDetailPage } from './CouponDetailPage';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/billing/modules/coupons/pages/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/billing/modules/credits/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./useCredits.js";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CreditTransaction, CreditNote } from '../../../shared/types';
|
|
2
|
+
|
|
3
|
+
interface UseCreditTransactionsOptions {
|
|
4
|
+
billingAccountId: string;
|
|
5
|
+
days?: number;
|
|
6
|
+
page?: number;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
}
|
|
9
|
+
interface UseCreditTransactionsResult {
|
|
10
|
+
transactions: CreditTransaction[];
|
|
11
|
+
pagination: {
|
|
12
|
+
page: number;
|
|
13
|
+
pageSize: number;
|
|
14
|
+
totalCount: number;
|
|
15
|
+
hasMore: boolean;
|
|
16
|
+
};
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
error: Error | undefined;
|
|
19
|
+
refetch: () => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
interface UseCreditTransactionResult {
|
|
22
|
+
transaction: CreditTransaction | null;
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
error: Error | undefined;
|
|
25
|
+
}
|
|
26
|
+
interface UseCostOfCreditsResult {
|
|
27
|
+
cost: number | null;
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
error: Error | undefined;
|
|
30
|
+
}
|
|
31
|
+
interface UseCreditNotesResult {
|
|
32
|
+
creditNotes: CreditNote[];
|
|
33
|
+
isLoading: boolean;
|
|
34
|
+
error: Error | undefined;
|
|
35
|
+
refetch: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hook for fetching credit transactions
|
|
39
|
+
*/
|
|
40
|
+
export declare function useCreditTransactions(options: UseCreditTransactionsOptions): UseCreditTransactionsResult;
|
|
41
|
+
/**
|
|
42
|
+
* Hook for fetching a single credit transaction
|
|
43
|
+
*/
|
|
44
|
+
export declare function useCreditTransaction(creditTransactionId: string | undefined): UseCreditTransactionResult;
|
|
45
|
+
/**
|
|
46
|
+
* Hook for getting cost of credits
|
|
47
|
+
*/
|
|
48
|
+
export declare function useCostOfCredits(creditAmount: number, currency: string): UseCostOfCreditsResult;
|
|
49
|
+
/**
|
|
50
|
+
* Hook for fetching credit notes
|
|
51
|
+
*/
|
|
52
|
+
export declare function useCreditNotes(): UseCreditNotesResult;
|
|
53
|
+
/**
|
|
54
|
+
* Hook for credit mutations
|
|
55
|
+
*/
|
|
56
|
+
export declare function useCreditMutations(): {
|
|
57
|
+
createCreditNote: (params: {
|
|
58
|
+
billingAccountId: string;
|
|
59
|
+
amount: number;
|
|
60
|
+
reason?: string;
|
|
61
|
+
invoiceId?: string;
|
|
62
|
+
currency?: string;
|
|
63
|
+
metadata?: Record<string, unknown>;
|
|
64
|
+
}) => Promise<CreditNote>;
|
|
65
|
+
grantCredits: (params: {
|
|
66
|
+
billingAccountId: string;
|
|
67
|
+
amount: number;
|
|
68
|
+
productId?: string;
|
|
69
|
+
reason?: string;
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
}) => Promise<CreditTransaction>;
|
|
72
|
+
isCreating: boolean;
|
|
73
|
+
};
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=useCredits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCredits.d.ts","sourceRoot":"","sources":["../../../../../src/billing/modules/credits/hooks/useCredits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EAEX,MAAM,uBAAuB,CAAC;AAE/B,UAAU,4BAA4B;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,2BAA2B;IACnC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,UAAU,0BAA0B;IAClC,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EA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} from "../../../hooks/useBillingEventEmitter.js";
|
|
3
|
+
import { directBillingGraphqlRequest as n } from "../../../shared/utils/directBillingGraphql.js";
|
|
4
|
+
import "../../../shared/utils/index.js";
|
|
5
|
+
import { GetCreditNotesDocument as r, GrantCreditsDocument as i, useCreateCreditNoteMutation as a, useGetBillingAccountCreditTransactionsQuery as o } from "../../../../generated/global-operations.js";
|
|
6
|
+
import { useCallback as s } from "react";
|
|
7
|
+
import { useApolloClient as c } from "@apollo/client/react";
|
|
8
|
+
//#region src/billing/modules/credits/hooks/useCredits.ts
|
|
9
|
+
function l(e) {
|
|
10
|
+
let { billingAccountId: t, days: n = 30, page: r = 1, pageSize: i = 20 } = e, { data: a, loading: c, error: l, refetch: u } = o({
|
|
11
|
+
variables: {
|
|
12
|
+
billingAccountID: t,
|
|
13
|
+
days: n,
|
|
14
|
+
page: r,
|
|
15
|
+
pageSize: i
|
|
16
|
+
},
|
|
17
|
+
skip: !t,
|
|
18
|
+
fetchPolicy: "cache-and-network"
|
|
19
|
+
}), d = a?.getBillingAccountCreditTransactions || {
|
|
20
|
+
creditTransactions: [],
|
|
21
|
+
page: 1,
|
|
22
|
+
pageSize: 20,
|
|
23
|
+
totalCount: 0,
|
|
24
|
+
hasMore: !1
|
|
25
|
+
}, f = s(async () => {
|
|
26
|
+
await u();
|
|
27
|
+
}, [u]);
|
|
28
|
+
return {
|
|
29
|
+
transactions: d.creditTransactions,
|
|
30
|
+
pagination: {
|
|
31
|
+
page: d.page,
|
|
32
|
+
pageSize: d.pageSize,
|
|
33
|
+
totalCount: d.totalCount,
|
|
34
|
+
hasMore: d.hasMore
|
|
35
|
+
},
|
|
36
|
+
isLoading: c,
|
|
37
|
+
error: l,
|
|
38
|
+
refetch: f
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function u() {
|
|
42
|
+
let o = c(), { apiGatewayUrl: l, authToken: u, orgId: d } = e(), { emit: f } = t(), [p, { loading: m }] = a();
|
|
43
|
+
return {
|
|
44
|
+
createCreditNote: s(async (e) => {
|
|
45
|
+
try {
|
|
46
|
+
let { data: t } = await p({ variables: e });
|
|
47
|
+
return await o.refetchQueries({ include: [r] }), t.createCreditNote;
|
|
48
|
+
} catch (e) {
|
|
49
|
+
throw console.error("Failed to create credit note:", e), e;
|
|
50
|
+
}
|
|
51
|
+
}, [p, o]),
|
|
52
|
+
grantCredits: s(async (e) => {
|
|
53
|
+
let t = await n({
|
|
54
|
+
apiGatewayUrl: l,
|
|
55
|
+
authToken: u,
|
|
56
|
+
orgId: d,
|
|
57
|
+
query: i,
|
|
58
|
+
variables: { input: e }
|
|
59
|
+
});
|
|
60
|
+
return await o.refetchQueries({ include: ["GetBillingAccountCreditTransactions"] }), f("billing.credits.granted", {
|
|
61
|
+
entityId: t.grantCredits.id,
|
|
62
|
+
source: "credits-admin",
|
|
63
|
+
amount: e.amount
|
|
64
|
+
}), t.grantCredits;
|
|
65
|
+
}, [
|
|
66
|
+
l,
|
|
67
|
+
u,
|
|
68
|
+
o,
|
|
69
|
+
f,
|
|
70
|
+
d
|
|
71
|
+
]),
|
|
72
|
+
isCreating: m
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { u as useCreditMutations, l as useCreditTransactions };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=useCredits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCredits.js","names":[],"sources":["../../../../../src/billing/modules/credits/hooks/useCredits.ts"],"sourcesContent":["/**\n * Credits Module - useCredits Hook\n * Provides access to credit transactions and mutations\n */\n\nimport { useApolloClient } from '@apollo/client/react';\nimport { useCallback } from 'react';\nimport {\n useGetBillingAccountCreditTransactionsQuery,\n useGetCreditTransactionDetailsQuery,\n useGetCostOfCreditsQuery,\n useGetCreditNotesQuery,\n useCreateCreditNoteMutation,\n GetCreditNotesDocument,\n GrantCreditsDocument,\n} from '../../../../generated/global-operations';\nimport { useBillingEventEmitter } from '../../../hooks/useBillingEventEmitter';\nimport { useBilling } from '../../../providers/BillingProvider';\nimport { directBillingGraphqlRequest } from '../../../shared/utils';\nimport type {\n CreditTransaction,\n CreditNote,\n PaginatedCreditTransactions,\n} from '../../../shared/types';\n\ninterface UseCreditTransactionsOptions {\n billingAccountId: string;\n days?: number;\n page?: number;\n pageSize?: number;\n}\n\ninterface UseCreditTransactionsResult {\n transactions: CreditTransaction[];\n pagination: {\n page: number;\n pageSize: number;\n totalCount: number;\n hasMore: boolean;\n };\n isLoading: boolean;\n error: Error | undefined;\n refetch: () => Promise<void>;\n}\n\ninterface UseCreditTransactionResult {\n transaction: CreditTransaction | null;\n isLoading: boolean;\n error: Error | undefined;\n}\n\ninterface UseCostOfCreditsResult {\n cost: number | null;\n isLoading: boolean;\n error: Error | undefined;\n}\n\ninterface UseCreditNotesResult {\n creditNotes: CreditNote[];\n isLoading: boolean;\n error: Error | undefined;\n refetch: () => Promise<void>;\n}\n\n/**\n * Hook for fetching credit transactions\n */\nexport function useCreditTransactions(\n options: UseCreditTransactionsOptions\n): UseCreditTransactionsResult {\n const { billingAccountId, days = 30, page = 1, pageSize = 20 } = options;\n\n const { data, loading, error, refetch } = useGetBillingAccountCreditTransactionsQuery({\n variables: { billingAccountID: billingAccountId, days, page, pageSize },\n skip: !billingAccountId,\n fetchPolicy: 'cache-and-network',\n });\n\n const result: PaginatedCreditTransactions = data?.getBillingAccountCreditTransactions || {\n creditTransactions: [],\n page: 1,\n pageSize: 20,\n totalCount: 0,\n hasMore: false,\n };\n\n const handleRefetch = useCallback(async () => {\n await refetch();\n }, [refetch]);\n\n return {\n transactions: result.creditTransactions,\n pagination: {\n page: result.page,\n pageSize: result.pageSize,\n totalCount: result.totalCount,\n hasMore: result.hasMore,\n },\n isLoading: loading,\n error: error as Error | undefined,\n refetch: handleRefetch,\n };\n}\n\n/**\n * Hook for fetching a single credit transaction\n */\nexport function useCreditTransaction(\n creditTransactionId: string | undefined\n): UseCreditTransactionResult {\n const { data, loading, error } = useGetCreditTransactionDetailsQuery({\n variables: { creditTransactionID: creditTransactionId! },\n skip: !creditTransactionId,\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n transaction: data?.getCreditTransactionDetails || null,\n isLoading: loading,\n error: error as Error | undefined,\n };\n}\n\n/**\n * Hook for getting cost of credits\n */\nexport function useCostOfCredits(creditAmount: number, currency: string): UseCostOfCreditsResult {\n const { data, loading, error } = useGetCostOfCreditsQuery({\n variables: { creditAmount, currency },\n skip: creditAmount <= 0 || !currency,\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n cost: data?.getCostOfCredits?.amount || null,\n isLoading: loading,\n error: error as Error | undefined,\n };\n}\n\n/**\n * Hook for fetching credit notes\n */\nexport function useCreditNotes(): UseCreditNotesResult {\n const { data, loading, error, refetch } = useGetCreditNotesQuery({\n fetchPolicy: 'cache-and-network',\n });\n\n const handleRefetch = useCallback(async () => {\n await refetch();\n }, [refetch]);\n\n return {\n creditNotes: data?.getCreditNotes || [],\n isLoading: loading,\n error: error as Error | undefined,\n refetch: handleRefetch,\n };\n}\n\n/**\n * Hook for credit mutations\n */\nexport function useCreditMutations() {\n const client = useApolloClient();\n const { apiGatewayUrl, authToken, orgId } = useBilling();\n const { emit } = useBillingEventEmitter();\n\n const [createCreditNoteMutation, { loading: isCreating }] = useCreateCreditNoteMutation();\n\n const createCreditNote = useCallback(\n async (params: {\n billingAccountId: string;\n amount: number;\n reason?: string;\n invoiceId?: string;\n currency?: string;\n metadata?: Record<string, unknown>;\n }): Promise<CreditNote> => {\n try {\n const { data } = await createCreditNoteMutation({\n variables: params,\n });\n await client.refetchQueries({ include: [GetCreditNotesDocument] });\n return data!.createCreditNote;\n } catch (error) {\n console.error('Failed to create credit note:', error);\n throw error;\n }\n },\n [createCreditNoteMutation, client]\n );\n\n const grantCredits = useCallback(\n async (params: {\n billingAccountId: string;\n amount: number;\n productId?: string;\n reason?: string;\n metadata?: Record<string, unknown>;\n }): Promise<CreditTransaction> => {\n const result = await directBillingGraphqlRequest<\n {\n grantCredits: CreditTransaction;\n },\n { input: typeof params }\n >({\n apiGatewayUrl,\n authToken,\n orgId,\n query: GrantCreditsDocument,\n variables: { input: params },\n });\n\n await client.refetchQueries({ include: ['GetBillingAccountCreditTransactions'] });\n emit('billing.credits.granted', {\n entityId: result.grantCredits.id,\n source: 'credits-admin',\n amount: params.amount,\n });\n return result.grantCredits;\n },\n [apiGatewayUrl, authToken, client, emit, orgId]\n );\n\n return {\n createCreditNote,\n grantCredits,\n isCreating,\n };\n}\n"],"mappings":";;;;;;;;AAmEA,SAAgB,EACd,GAC6B;CAC7B,IAAM,EAAE,qBAAkB,UAAO,IAAI,UAAO,GAAG,cAAW,OAAO,GAE3D,EAAE,SAAM,YAAS,UAAO,eAAY,EAA4C;EACpF,WAAW;GAAE,kBAAkB;GAAkB;GAAM;GAAM;GAAU;EACvE,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EAEI,IAAsC,GAAM,uCAAuC;EACvF,oBAAoB,EAAE;EACtB,MAAM;EACN,UAAU;EACV,YAAY;EACZ,SAAS;EACV,EAEK,IAAgB,EAAY,YAAY;AAC5C,QAAM,GAAS;IACd,CAAC,EAAQ,CAAC;AAEb,QAAO;EACL,cAAc,EAAO;EACrB,YAAY;GACV,MAAM,EAAO;GACb,UAAU,EAAO;GACjB,YAAY,EAAO;GACnB,SAAS,EAAO;GACjB;EACD,WAAW;EACJ;EACP,SAAS;EACV;;AA8DH,SAAgB,IAAqB;CACnC,IAAM,IAAS,GAAiB,EAC1B,EAAE,kBAAe,cAAW,aAAU,GAAY,EAClD,EAAE,YAAS,GAAwB,EAEnC,CAAC,GAA0B,EAAE,SAAS,OAAgB,GAA6B;AAyDzF,QAAO;EACL,kBAxDuB,EACvB,OAAO,MAOoB;AACzB,OAAI;IACF,IAAM,EAAE,YAAS,MAAM,EAAyB,EAC9C,WAAW,GACZ,CAAC;AAEF,WADA,MAAM,EAAO,eAAe,EAAE,SAAS,CAAC,EAAuB,EAAE,CAAC,EAC3D,EAA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