@cedros/pay-react 1.0.5 → 1.1.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/README.md +190 -38
- package/dist/{CedrosContext-CFEXGwQg.mjs → CedrosContext-DUT3cLZg.mjs} +683 -372
- package/dist/CedrosContext-efFL4kQz.js +11 -0
- package/dist/admin/index.d.ts +9 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/plugin.d.ts +9 -0
- package/dist/admin/plugin.d.ts.map +1 -0
- package/dist/admin/types.d.ts +115 -0
- package/dist/admin/types.d.ts.map +1 -0
- package/dist/components/CedrosPay.d.ts.map +1 -1
- package/dist/components/CreditsButton.d.ts +42 -0
- package/dist/components/CreditsButton.d.ts.map +1 -0
- package/dist/components/CreditsSubscribeButton.d.ts +55 -0
- package/dist/components/CreditsSubscribeButton.d.ts.map +1 -0
- package/dist/components/CryptoButton.d.ts.map +1 -1
- package/dist/components/CryptoSubscribeButton.d.ts.map +1 -1
- package/dist/components/PaymentModal.d.ts +8 -2
- package/dist/components/PaymentModal.d.ts.map +1 -1
- package/dist/components/PurchaseButton.d.ts +14 -3
- package/dist/components/PurchaseButton.d.ts.map +1 -1
- package/dist/components/SubscriptionManagementPanel.d.ts.map +1 -1
- package/dist/components/admin/AISettingsSection.d.ts +3 -0
- package/dist/components/admin/AISettingsSection.d.ts.map +1 -0
- package/dist/components/admin/AdminAuthManager.d.ts +95 -0
- package/dist/components/admin/AdminAuthManager.d.ts.map +1 -0
- package/dist/components/admin/CedrosPayAdminDashboard.d.ts +40 -0
- package/dist/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -0
- package/dist/components/admin/ConfigEditor.d.ts +13 -0
- package/dist/components/admin/ConfigEditor.d.ts.map +1 -0
- package/dist/components/admin/CouponsSection.d.ts +3 -0
- package/dist/components/admin/CouponsSection.d.ts.map +1 -0
- package/dist/components/admin/Dropdown.d.ts +29 -0
- package/dist/components/admin/Dropdown.d.ts.map +1 -0
- package/dist/components/admin/FAQSection.d.ts +3 -0
- package/dist/components/admin/FAQSection.d.ts.map +1 -0
- package/dist/components/admin/MessagingSection.d.ts +10 -0
- package/dist/components/admin/MessagingSection.d.ts.map +1 -0
- package/dist/components/admin/OverviewSection.d.ts +3 -0
- package/dist/components/admin/OverviewSection.d.ts.map +1 -0
- package/dist/components/admin/PaymentSettingsSection.d.ts +3 -0
- package/dist/components/admin/PaymentSettingsSection.d.ts.map +1 -0
- package/dist/components/admin/ProductVariationsEditor.d.ts +14 -0
- package/dist/components/admin/ProductVariationsEditor.d.ts.map +1 -0
- package/dist/components/admin/ProductsSection.d.ts +3 -0
- package/dist/components/admin/ProductsSection.d.ts.map +1 -0
- package/dist/components/admin/RefundsSection.d.ts +3 -0
- package/dist/components/admin/RefundsSection.d.ts.map +1 -0
- package/dist/components/admin/SettingsSection.d.ts +10 -0
- package/dist/components/admin/SettingsSection.d.ts.map +1 -0
- package/dist/components/admin/SingleCategorySettings.d.ts +21 -0
- package/dist/components/admin/SingleCategorySettings.d.ts.map +1 -0
- package/dist/components/admin/StatsBar.d.ts +19 -0
- package/dist/components/admin/StatsBar.d.ts.map +1 -0
- package/dist/components/admin/StorefrontSection.d.ts +3 -0
- package/dist/components/admin/StorefrontSection.d.ts.map +1 -0
- package/dist/components/admin/SubscriptionsSection.d.ts +3 -0
- package/dist/components/admin/SubscriptionsSection.d.ts.map +1 -0
- package/dist/components/admin/TransactionsSection.d.ts +3 -0
- package/dist/components/admin/TransactionsSection.d.ts.map +1 -0
- package/dist/components/admin/VariantInventoryGrid.d.ts +19 -0
- package/dist/components/admin/VariantInventoryGrid.d.ts.map +1 -0
- package/dist/components/admin/VariationTypeEditor.d.ts +15 -0
- package/dist/components/admin/VariationTypeEditor.d.ts.map +1 -0
- package/dist/components/admin/configApi.d.ts +104 -0
- package/dist/components/admin/configApi.d.ts.map +1 -0
- package/dist/components/admin/icons.d.ts +50 -0
- package/dist/components/admin/icons.d.ts.map +1 -0
- package/dist/components/admin/index.d.ts +16 -0
- package/dist/components/admin/index.d.ts.map +1 -0
- package/dist/components/admin/sections-more.d.ts +12 -0
- package/dist/components/admin/sections-more.d.ts.map +1 -0
- package/dist/components/admin/sections.d.ts +12 -0
- package/dist/components/admin/sections.d.ts.map +1 -0
- package/dist/components/admin/types.d.ts +324 -0
- package/dist/components/admin/types.d.ts.map +1 -0
- package/dist/components/admin/useAdminAuth.d.ts +50 -0
- package/dist/components/admin/useAdminAuth.d.ts.map +1 -0
- package/dist/components/admin/useAutosave.d.ts +56 -0
- package/dist/components/admin/useAutosave.d.ts.map +1 -0
- package/dist/components/admin/useProductVariations.d.ts +56 -0
- package/dist/components/admin/useProductVariations.d.ts.map +1 -0
- package/dist/components/subscriptionPanelStyles.d.ts +2 -3
- package/dist/components/subscriptionPanelStyles.d.ts.map +1 -1
- package/dist/context/CedrosContext.d.ts +2 -0
- package/dist/context/CedrosContext.d.ts.map +1 -1
- package/dist/context/ThemeContext.d.ts +6 -0
- package/dist/context/ThemeContext.d.ts.map +1 -1
- package/dist/crypto-only.d.ts +1 -1
- package/dist/crypto-only.d.ts.map +1 -1
- package/dist/crypto-only.js +1 -1
- package/dist/crypto-only.mjs +16 -17
- package/dist/ecommerce/__tests__/cartCheckoutRequirements.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/cartCheckoutRequirements.test.d.ts.map +1 -0
- package/dist/ecommerce/__tests__/cartProviderPersistence.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/cartProviderPersistence.test.d.ts.map +1 -0
- package/dist/ecommerce/__tests__/cartReducer.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/cartReducer.test.d.ts.map +1 -0
- package/dist/ecommerce/__tests__/cartServerMerge.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/cartServerMerge.test.d.ts.map +1 -0
- package/dist/ecommerce/__tests__/checkoutPaymentMethods.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/checkoutPaymentMethods.test.d.ts.map +1 -0
- package/dist/ecommerce/__tests__/checkoutReturn.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/checkoutReturn.test.d.ts.map +1 -0
- package/dist/ecommerce/__tests__/checkoutSchema.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/checkoutSchema.test.d.ts.map +1 -0
- package/dist/ecommerce/__tests__/mockAdapter.test.d.ts +2 -0
- package/dist/ecommerce/__tests__/mockAdapter.test.d.ts.map +1 -0
- package/dist/ecommerce/adapters/CommerceAdapter.d.ts +235 -0
- package/dist/ecommerce/adapters/CommerceAdapter.d.ts.map +1 -0
- package/dist/ecommerce/adapters/mock/mockAdapter.d.ts +3 -0
- package/dist/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -0
- package/dist/ecommerce/adapters/paywall/paywallAdapter.d.ts +6 -0
- package/dist/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -0
- package/dist/ecommerce/components/cart/CartLineItem.d.ts +12 -0
- package/dist/ecommerce/components/cart/CartLineItem.d.ts.map +1 -0
- package/dist/ecommerce/components/cart/CartPageContent.d.ts +6 -0
- package/dist/ecommerce/components/cart/CartPageContent.d.ts.map +1 -0
- package/dist/ecommerce/components/cart/CartPanel.d.ts +5 -0
- package/dist/ecommerce/components/cart/CartPanel.d.ts.map +1 -0
- package/dist/ecommerce/components/cart/CartSidebar.d.ts +11 -0
- package/dist/ecommerce/components/cart/CartSidebar.d.ts.map +1 -0
- package/dist/ecommerce/components/cart/CartSummary.d.ts +13 -0
- package/dist/ecommerce/components/cart/CartSummary.d.ts.map +1 -0
- package/dist/ecommerce/components/cart/PromoCodeInput.d.ts +6 -0
- package/dist/ecommerce/components/cart/PromoCodeInput.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/Breadcrumbs.d.ts +9 -0
- package/dist/ecommerce/components/catalog/Breadcrumbs.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/CategoryNav.d.ts +8 -0
- package/dist/ecommerce/components/catalog/CategoryNav.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/FilterPanel.d.ts +29 -0
- package/dist/ecommerce/components/catalog/FilterPanel.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/Price.d.ts +9 -0
- package/dist/ecommerce/components/catalog/Price.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/ProductCard.d.ts +14 -0
- package/dist/ecommerce/components/catalog/ProductCard.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/ProductGallery.d.ts +6 -0
- package/dist/ecommerce/components/catalog/ProductGallery.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/ProductGrid.d.ts +20 -0
- package/dist/ecommerce/components/catalog/ProductGrid.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/QuantitySelector.d.ts +8 -0
- package/dist/ecommerce/components/catalog/QuantitySelector.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/QuickViewDialog.d.ts +10 -0
- package/dist/ecommerce/components/catalog/QuickViewDialog.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/SearchInput.d.ts +7 -0
- package/dist/ecommerce/components/catalog/SearchInput.d.ts.map +1 -0
- package/dist/ecommerce/components/catalog/VariantSelector.d.ts +19 -0
- package/dist/ecommerce/components/catalog/VariantSelector.d.ts.map +1 -0
- package/dist/ecommerce/components/chat/ShopChatPanel.d.ts +4 -0
- package/dist/ecommerce/components/chat/ShopChatPanel.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/AddressForm.d.ts +9 -0
- package/dist/ecommerce/components/checkout/AddressForm.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/CheckoutCancelPage.d.ts +24 -0
- package/dist/ecommerce/components/checkout/CheckoutCancelPage.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/CheckoutForm.d.ts +4 -0
- package/dist/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/CheckoutLayout.d.ts +6 -0
- package/dist/ecommerce/components/checkout/CheckoutLayout.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/CheckoutReceipt.d.ts +8 -0
- package/dist/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/CheckoutSuccessPage.d.ts +29 -0
- package/dist/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/InventoryVerificationDialog.d.ts +19 -0
- package/dist/ecommerce/components/checkout/InventoryVerificationDialog.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/OrderReview.d.ts +4 -0
- package/dist/ecommerce/components/checkout/OrderReview.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/PaymentStep.d.ts +15 -0
- package/dist/ecommerce/components/checkout/PaymentStep.d.ts.map +1 -0
- package/dist/ecommerce/components/checkout/ShippingMethodSelector.d.ts +9 -0
- package/dist/ecommerce/components/checkout/ShippingMethodSelector.d.ts.map +1 -0
- package/dist/ecommerce/components/faq/FAQItem.d.ts +29 -0
- package/dist/ecommerce/components/faq/FAQItem.d.ts.map +1 -0
- package/dist/ecommerce/components/faq/FAQItem.test.d.ts +7 -0
- package/dist/ecommerce/components/faq/FAQItem.test.d.ts.map +1 -0
- package/dist/ecommerce/components/faq/FAQList.d.ts +15 -0
- package/dist/ecommerce/components/faq/FAQList.d.ts.map +1 -0
- package/dist/ecommerce/components/faq/index.d.ts +3 -0
- package/dist/ecommerce/components/faq/index.d.ts.map +1 -0
- package/dist/ecommerce/components/general/EmptyState.d.ts +8 -0
- package/dist/ecommerce/components/general/EmptyState.d.ts.map +1 -0
- package/dist/ecommerce/components/general/ErrorBoundary.d.ts +16 -0
- package/dist/ecommerce/components/general/ErrorBoundary.d.ts.map +1 -0
- package/dist/ecommerce/components/general/ErrorState.d.ts +7 -0
- package/dist/ecommerce/components/general/ErrorState.d.ts.map +1 -0
- package/dist/ecommerce/components/general/toast.d.ts +19 -0
- package/dist/ecommerce/components/general/toast.d.ts.map +1 -0
- package/dist/ecommerce/components/orders/OrderCard.d.ts +7 -0
- package/dist/ecommerce/components/orders/OrderCard.d.ts.map +1 -0
- package/dist/ecommerce/components/orders/OrderDetails.d.ts +7 -0
- package/dist/ecommerce/components/orders/OrderDetails.d.ts.map +1 -0
- package/dist/ecommerce/components/orders/OrderList.d.ts +7 -0
- package/dist/ecommerce/components/orders/OrderList.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/accordion.d.ts +7 -0
- package/dist/ecommerce/components/ui/accordion.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/badge.d.ts +10 -0
- package/dist/ecommerce/components/ui/badge.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/button.d.ts +12 -0
- package/dist/ecommerce/components/ui/button.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/card.d.ts +8 -0
- package/dist/ecommerce/components/ui/card.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/dialog.d.ts +13 -0
- package/dist/ecommerce/components/ui/dialog.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/input.d.ts +5 -0
- package/dist/ecommerce/components/ui/input.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/label.d.ts +3 -0
- package/dist/ecommerce/components/ui/label.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/select.d.ts +9 -0
- package/dist/ecommerce/components/ui/select.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/separator.d.ts +4 -0
- package/dist/ecommerce/components/ui/separator.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/sheet.d.ts +21 -0
- package/dist/ecommerce/components/ui/sheet.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/skeleton.d.ts +3 -0
- package/dist/ecommerce/components/ui/skeleton.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/tabs.d.ts +7 -0
- package/dist/ecommerce/components/ui/tabs.d.ts.map +1 -0
- package/dist/ecommerce/components/ui/textarea.d.ts +5 -0
- package/dist/ecommerce/components/ui/textarea.d.ts.map +1 -0
- package/dist/ecommerce/config/context.d.ts +13 -0
- package/dist/ecommerce/config/context.d.ts.map +1 -0
- package/dist/ecommerce/config/types.d.ts +48 -0
- package/dist/ecommerce/config/types.d.ts.map +1 -0
- package/dist/ecommerce/hooks/checkoutReturn.d.ts +3 -0
- package/dist/ecommerce/hooks/checkoutReturn.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useAIRelatedProducts.d.ts +33 -0
- package/dist/ecommerce/hooks/useAIRelatedProducts.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useCartInventory.d.ts +42 -0
- package/dist/ecommerce/hooks/useCartInventory.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useCatalogUrlState.d.ts +15 -0
- package/dist/ecommerce/hooks/useCatalogUrlState.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useCategories.d.ts +7 -0
- package/dist/ecommerce/hooks/useCategories.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useCheckoutResultFromUrl.d.ts +4 -0
- package/dist/ecommerce/hooks/useCheckoutResultFromUrl.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useHoldExpiry.d.ts +34 -0
- package/dist/ecommerce/hooks/useHoldExpiry.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useInventoryVerification.d.ts +41 -0
- package/dist/ecommerce/hooks/useInventoryVerification.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useOrders.d.ts +7 -0
- package/dist/ecommerce/hooks/useOrders.d.ts.map +1 -0
- package/dist/ecommerce/hooks/usePaymentMethodsConfig.d.ts +6 -0
- package/dist/ecommerce/hooks/usePaymentMethodsConfig.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useProduct.d.ts +7 -0
- package/dist/ecommerce/hooks/useProduct.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useProducts.d.ts +8 -0
- package/dist/ecommerce/hooks/useProducts.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useShippingMethods.d.ts +10 -0
- package/dist/ecommerce/hooks/useShippingMethods.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useStorefrontSettings.d.ts +32 -0
- package/dist/ecommerce/hooks/useStorefrontSettings.d.ts.map +1 -0
- package/dist/ecommerce/hooks/useSubscriptionData.d.ts +8 -0
- package/dist/ecommerce/hooks/useSubscriptionData.d.ts.map +1 -0
- package/dist/ecommerce/index.d.ts +98 -0
- package/dist/ecommerce/index.d.ts.map +1 -0
- package/dist/ecommerce/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts +10 -0
- package/dist/ecommerce/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts.map +1 -0
- package/dist/ecommerce/state/cart/CartProvider.d.ts +27 -0
- package/dist/ecommerce/state/cart/CartProvider.d.ts.map +1 -0
- package/dist/ecommerce/state/cart/cartReducer.d.ts +35 -0
- package/dist/ecommerce/state/cart/cartReducer.d.ts.map +1 -0
- package/dist/ecommerce/state/checkout/checkoutSchema.d.ts +21 -0
- package/dist/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -0
- package/dist/ecommerce/state/checkout/useCheckout.d.ts +34 -0
- package/dist/ecommerce/state/checkout/useCheckout.d.ts.map +1 -0
- package/dist/ecommerce/templates/CartTemplate.d.ts +5 -0
- package/dist/ecommerce/templates/CartTemplate.d.ts.map +1 -0
- package/dist/ecommerce/templates/CategoryTemplate.d.ts +11 -0
- package/dist/ecommerce/templates/CategoryTemplate.d.ts.map +1 -0
- package/dist/ecommerce/templates/CheckoutTemplate.d.ts +9 -0
- package/dist/ecommerce/templates/CheckoutTemplate.d.ts.map +1 -0
- package/dist/ecommerce/templates/ProductTemplate.d.ts +11 -0
- package/dist/ecommerce/templates/ProductTemplate.d.ts.map +1 -0
- package/dist/ecommerce/templates/PurchaseHistoryTemplate.d.ts +6 -0
- package/dist/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -0
- package/dist/ecommerce/templates/ReceiptTemplate.d.ts +19 -0
- package/dist/ecommerce/templates/ReceiptTemplate.d.ts.map +1 -0
- package/dist/ecommerce/templates/ShopTemplate.d.ts +15 -0
- package/dist/ecommerce/templates/ShopTemplate.d.ts.map +1 -0
- package/dist/ecommerce/templates/SubscriptionTemplate.d.ts +15 -0
- package/dist/ecommerce/templates/SubscriptionTemplate.d.ts.map +1 -0
- package/dist/ecommerce/testing/adapterContract.d.ts +11 -0
- package/dist/ecommerce/testing/adapterContract.d.ts.map +1 -0
- package/dist/ecommerce/types.d.ts +164 -0
- package/dist/ecommerce/types.d.ts.map +1 -0
- package/dist/ecommerce/utils/cartCheckoutRequirements.d.ts +18 -0
- package/dist/ecommerce/utils/cartCheckoutRequirements.d.ts.map +1 -0
- package/dist/ecommerce/utils/cartItemMetadata.d.ts +3 -0
- package/dist/ecommerce/utils/cartItemMetadata.d.ts.map +1 -0
- package/dist/ecommerce/utils/cn.d.ts +3 -0
- package/dist/ecommerce/utils/cn.d.ts.map +1 -0
- package/dist/ecommerce/utils/money.d.ts +6 -0
- package/dist/ecommerce/utils/money.d.ts.map +1 -0
- package/dist/ecommerce/utils/storage.d.ts +5 -0
- package/dist/ecommerce/utils/storage.d.ts.map +1 -0
- package/dist/en-BXheDBal.mjs +19 -0
- package/dist/en-Yikrt96u.js +1 -0
- package/dist/hooks/useCreditsPayment.d.ts +64 -0
- package/dist/hooks/useCreditsPayment.d.ts.map +1 -0
- package/dist/hooks/useCreditsSubscription.d.ts +42 -0
- package/dist/hooks/useCreditsSubscription.d.ts.map +1 -0
- package/dist/hooks/usePaymentMode.d.ts.map +1 -1
- package/dist/hooks/useStripeCheckout.d.ts +1 -0
- package/dist/hooks/useStripeCheckout.d.ts.map +1 -1
- package/dist/hooks/useSubscriptionManagement.d.ts +4 -0
- package/dist/hooks/useSubscriptionManagement.d.ts.map +1 -1
- package/dist/hooks/useX402Payment.d.ts +1 -0
- package/dist/hooks/useX402Payment.d.ts.map +1 -1
- package/dist/index-DPl2S6i0.js +136 -0
- package/dist/index-SV9PXby1.mjs +26838 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +79 -1922
- package/dist/magic-string.es-B81Zo59j.js +10 -0
- package/dist/magic-string.es-uPKorP4O.mjs +663 -0
- package/dist/managers/CreditsManager.d.ts +151 -0
- package/dist/managers/CreditsManager.d.ts.map +1 -0
- package/dist/managers/ManagerCache.d.ts +2 -0
- package/dist/managers/ManagerCache.d.ts.map +1 -1
- package/dist/managers/RouteDiscoveryManager.d.ts.map +1 -1
- package/dist/managers/StripeManager.d.ts.map +1 -1
- package/dist/managers/X402Manager.d.ts.map +1 -1
- package/dist/pay-react.css +1 -1
- package/dist/sections-BsFQxfHN.mjs +10 -0
- package/dist/sections-CTqBNAKW.js +1 -0
- package/dist/stripe-only.d.ts +1 -1
- package/dist/stripe-only.d.ts.map +1 -1
- package/dist/stripe-only.js +1 -1
- package/dist/stripe-only.mjs +12 -13
- package/dist/styles-C4-_hbgr.js +1 -0
- package/dist/styles-QcAsIVWl.mjs +1909 -0
- package/dist/telemetry.js +1 -1
- package/dist/telemetry.mjs +1 -1
- package/dist/testing/index.js +147 -1
- package/dist/testing/index.mjs +10555 -103
- package/dist/types/componentOptions.d.ts +14 -4
- package/dist/types/componentOptions.d.ts.map +1 -1
- package/dist/types/errors.d.ts +26 -4
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/index.d.ts +115 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/cartHelpers.d.ts +3 -0
- package/dist/utils/cartHelpers.d.ts.map +1 -1
- package/dist/utils/cspHelper.d.ts +7 -1
- package/dist/utils/cspHelper.d.ts.map +1 -1
- package/dist/utils/csvHelpers.d.ts +62 -0
- package/dist/utils/csvHelpers.d.ts.map +1 -0
- package/dist/utils/csvHelpers.test.d.ts +2 -0
- package/dist/utils/csvHelpers.test.d.ts.map +1 -0
- package/dist/utils/dateHelpers.d.ts +24 -0
- package/dist/utils/dateHelpers.d.ts.map +1 -0
- package/dist/utils/eventEmitter.d.ts +1 -1
- package/dist/utils/eventEmitter.d.ts.map +1 -1
- package/dist/utils/fetchWithTimeout.d.ts +3 -3
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/tokenMintValidator.d.ts +10 -6
- package/dist/utils/tokenMintValidator.d.ts.map +1 -1
- package/dist/utils/uuid.d.ts.map +1 -1
- package/dist/uuid-C5B8o31X.js +1 -0
- package/dist/uuid-_z3jSatJ.mjs +17 -0
- package/package.json +25 -9
- package/dist/CedrosContext-DbndTsTA.js +0 -11
- package/dist/en-C739WV_-.mjs +0 -19
- package/dist/en-Cz4OpvN-.js +0 -1
- package/dist/styles-DFcRS8Uu.mjs +0 -1626
- package/dist/styles-Dup9uK6S.js +0 -1
- package/dist/utils/uuid-shim.d.ts +0 -9
- package/dist/utils/uuid-shim.d.ts.map +0 -1
- package/dist/uuid-C0iMjdcc.js +0 -1
- package/dist/uuid-UlzrVY8Y.mjs +0 -17
- package/dist/walletDetection-JZR3UCOa.mjs +0 -27
- package/dist/walletDetection-bNmV5ItZ.js +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,1924 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { clusterApiUrl as He } from "@solana/web3.js";
|
|
9
|
-
import { WalletReadyState as Ee } from "@solana/wallet-adapter-base";
|
|
10
|
-
import { WalletIcon as Ke } from "@solana/wallet-adapter-react-ui";
|
|
11
|
-
import "@solana/wallet-adapter-wallets";
|
|
12
|
-
function Qe(e) {
|
|
13
|
-
switch (e) {
|
|
14
|
-
case "mainnet-beta":
|
|
15
|
-
return "https://api.mainnet-beta.solana.com";
|
|
16
|
-
case "devnet":
|
|
17
|
-
return "https://api.devnet.solana.com";
|
|
18
|
-
case "testnet":
|
|
19
|
-
return "https://api.testnet.solana.com";
|
|
20
|
-
default:
|
|
21
|
-
return "https://api.mainnet-beta.solana.com";
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function Ge(e) {
|
|
25
|
-
try {
|
|
26
|
-
const r = new URL(e);
|
|
27
|
-
return `${r.protocol}//${r.host}`;
|
|
28
|
-
} catch {
|
|
29
|
-
return e;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function Ye(e = {}) {
|
|
33
|
-
const {
|
|
34
|
-
solanaCluster: r = "mainnet-beta",
|
|
35
|
-
solanaEndpoint: t,
|
|
36
|
-
customRpcProviders: o = [],
|
|
37
|
-
allowUnsafeScripts: f = !1,
|
|
38
|
-
additionalScriptSrc: i = [],
|
|
39
|
-
additionalConnectSrc: h = [],
|
|
40
|
-
additionalFrameSrc: x = [],
|
|
41
|
-
includeStripe: m = !0
|
|
42
|
-
} = e, l = ["'self'"];
|
|
43
|
-
f && l.push("'unsafe-inline'", "'unsafe-eval'"), m && l.push("https://js.stripe.com"), l.push(...i);
|
|
44
|
-
const s = ["'self'"];
|
|
45
|
-
m && s.push("https://api.stripe.com", "https://*.stripe.com");
|
|
46
|
-
const b = Qe(r);
|
|
47
|
-
if (s.push(b), s.push("https://*.solana.com"), t) {
|
|
48
|
-
const d = Ge(t);
|
|
49
|
-
s.includes(d) || s.push(d);
|
|
50
|
-
}
|
|
51
|
-
o.forEach((d) => {
|
|
52
|
-
s.includes(d) || s.push(d);
|
|
53
|
-
}), s.push(...h);
|
|
54
|
-
const c = ["'self'"];
|
|
55
|
-
return m && c.push("https://js.stripe.com", "https://checkout.stripe.com"), c.push(...x), {
|
|
56
|
-
scriptSrc: l,
|
|
57
|
-
connectSrc: s,
|
|
58
|
-
frameSrc: c
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function Ve(e, r = "header") {
|
|
62
|
-
const { scriptSrc: t, connectSrc: o, frameSrc: f } = e;
|
|
63
|
-
switch (r) {
|
|
64
|
-
case "header":
|
|
65
|
-
case "meta":
|
|
66
|
-
case "nextjs":
|
|
67
|
-
case "nginx": {
|
|
68
|
-
const i = [];
|
|
69
|
-
return t.length > 0 && i.push(`script-src ${t.join(" ")}`), o.length > 0 && i.push(`connect-src ${o.join(" ")}`), f.length > 0 && i.push(`frame-src ${f.join(" ")}`), i.join("; ");
|
|
70
|
-
}
|
|
71
|
-
case "helmet": {
|
|
72
|
-
const i = {};
|
|
73
|
-
return t.length > 0 && (i.scriptSrc = t), o.length > 0 && (i.connectSrc = o), f.length > 0 && (i.frameSrc = f), i;
|
|
74
|
-
}
|
|
75
|
-
case "directives":
|
|
76
|
-
return { scriptSrc: t, connectSrc: o, frameSrc: f };
|
|
77
|
-
default:
|
|
78
|
-
throw new Error(`Unknown CSP format: ${r}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function ht(e = {}, r = "header") {
|
|
82
|
-
const t = Ye(e);
|
|
83
|
-
return Ve(t, r);
|
|
84
|
-
}
|
|
85
|
-
const bt = {
|
|
86
|
-
HELIUS: "https://*.helius-rpc.com",
|
|
87
|
-
QUICKNODE: "https://*.quicknode.pro",
|
|
88
|
-
ALCHEMY: "https://*.alchemy.com",
|
|
89
|
-
ANKR: "https://rpc.ankr.com",
|
|
90
|
-
TRITON: "https://*.rpcpool.com"
|
|
91
|
-
}, St = {
|
|
92
|
-
/**
|
|
93
|
-
* Mainnet production with custom RPC (recommended)
|
|
94
|
-
*/
|
|
95
|
-
MAINNET_CUSTOM_RPC: (e) => ({
|
|
96
|
-
solanaCluster: "mainnet-beta",
|
|
97
|
-
solanaEndpoint: e,
|
|
98
|
-
allowUnsafeScripts: !1
|
|
99
|
-
}),
|
|
100
|
-
/**
|
|
101
|
-
* Mainnet with Next.js (requires unsafe-inline/eval)
|
|
102
|
-
*/
|
|
103
|
-
MAINNET_NEXTJS: (e) => ({
|
|
104
|
-
solanaCluster: "mainnet-beta",
|
|
105
|
-
solanaEndpoint: e,
|
|
106
|
-
allowUnsafeScripts: !0
|
|
107
|
-
}),
|
|
108
|
-
/**
|
|
109
|
-
* Devnet for testing
|
|
110
|
-
*/
|
|
111
|
-
DEVNET: () => ({
|
|
112
|
-
solanaCluster: "devnet",
|
|
113
|
-
allowUnsafeScripts: !0
|
|
114
|
-
}),
|
|
115
|
-
/**
|
|
116
|
-
* Crypto-only payments (no Stripe)
|
|
117
|
-
*/
|
|
118
|
-
CRYPTO_ONLY: (e) => ({
|
|
119
|
-
solanaCluster: "mainnet-beta",
|
|
120
|
-
solanaEndpoint: e,
|
|
121
|
-
includeStripe: !1
|
|
122
|
-
}),
|
|
123
|
-
/**
|
|
124
|
-
* Stripe-only payments (no Solana)
|
|
125
|
-
*/
|
|
126
|
-
STRIPE_ONLY: () => ({
|
|
127
|
-
solanaCluster: "mainnet-beta",
|
|
128
|
-
includeStripe: !0,
|
|
129
|
-
// Don't include Solana RPC endpoints
|
|
130
|
-
customRpcProviders: []
|
|
131
|
-
})
|
|
132
|
-
}, Xe = ({
|
|
133
|
-
resource: e,
|
|
134
|
-
items: r,
|
|
135
|
-
label: t,
|
|
136
|
-
cardLabel: o,
|
|
137
|
-
cryptoLabel: f,
|
|
138
|
-
showCard: i = !0,
|
|
139
|
-
showCrypto: h = !0,
|
|
140
|
-
onPaymentAttempt: x,
|
|
141
|
-
onPaymentSuccess: m,
|
|
142
|
-
onPaymentError: l,
|
|
143
|
-
onStripeSuccess: s,
|
|
144
|
-
onCryptoSuccess: b,
|
|
145
|
-
onStripeError: c,
|
|
146
|
-
onCryptoError: d,
|
|
147
|
-
customerEmail: n,
|
|
148
|
-
successUrl: a,
|
|
149
|
-
cancelUrl: p,
|
|
150
|
-
metadata: C,
|
|
151
|
-
couponCode: P,
|
|
152
|
-
autoDetectWallets: y = !0,
|
|
153
|
-
testPageUrl: B,
|
|
154
|
-
hideMessages: N = !1,
|
|
155
|
-
renderModal: E
|
|
156
|
-
}) => {
|
|
157
|
-
const I = le(), [v, k] = U(!1), { status: q, processPayment: R, processCartCheckout: $ } = $e(), { isCartMode: _, effectiveResource: z } = Re(e, r), { t: O } = ge(), L = t || O("ui.purchase"), j = o || O("ui.card"), ue = f || O("ui.usdc_solana"), re = T(async () => {
|
|
158
|
-
if (y && i) {
|
|
159
|
-
const { detectSolanaWallets: A } = await import("./walletDetection-JZR3UCOa.mjs");
|
|
160
|
-
if (!A()) {
|
|
161
|
-
const K = _ ? void 0 : z, Q = _ && r ? Ie(r) : void 0;
|
|
162
|
-
he("stripe", K, Q), x && x("stripe"), ie("stripe", K, Q);
|
|
163
|
-
let M;
|
|
164
|
-
_ && r ? M = await $(
|
|
165
|
-
r,
|
|
166
|
-
a,
|
|
167
|
-
p,
|
|
168
|
-
C,
|
|
169
|
-
n,
|
|
170
|
-
P
|
|
171
|
-
) : z && (M = await R(
|
|
172
|
-
z,
|
|
173
|
-
a,
|
|
174
|
-
p,
|
|
175
|
-
C,
|
|
176
|
-
n,
|
|
177
|
-
P
|
|
178
|
-
)), M && M.success && M.transactionId ? (be("stripe", M.transactionId, K, Q), s ? s(M.transactionId) : m && m(M.transactionId)) : M && !M.success && M.error && (ce("stripe", M.error, K, Q), c ? c(M.error) : l && l(M.error));
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
k(!0);
|
|
183
|
-
}, [y, i, _, r, z, $, R, a, p, C, n, P, m, l, s, c, x]), te = F(() => _ && r ? `purchase-cart-${r.map((A) => A.resource).join("-")}` : `purchase-${z || "unknown"}`, [_, r, z]), ne = F(
|
|
184
|
-
() => Se(te, re),
|
|
185
|
-
[te, re]
|
|
186
|
-
), H = q === "loading", se = {
|
|
187
|
-
isOpen: v,
|
|
188
|
-
onClose: () => k(!1),
|
|
189
|
-
resource: _ ? void 0 : z,
|
|
190
|
-
items: _ ? r : void 0,
|
|
191
|
-
cardLabel: j,
|
|
192
|
-
cryptoLabel: ue,
|
|
193
|
-
showCard: i,
|
|
194
|
-
showCrypto: h,
|
|
195
|
-
onPaymentAttempt: x,
|
|
196
|
-
onPaymentSuccess: (A) => {
|
|
197
|
-
k(!1), m?.(A);
|
|
198
|
-
},
|
|
199
|
-
onPaymentError: (A) => {
|
|
200
|
-
k(!1), l?.(A);
|
|
201
|
-
},
|
|
202
|
-
onStripeSuccess: (A) => {
|
|
203
|
-
k(!1), s?.(A);
|
|
204
|
-
},
|
|
205
|
-
onCryptoSuccess: (A) => {
|
|
206
|
-
k(!1), b?.(A);
|
|
207
|
-
},
|
|
208
|
-
onStripeError: (A) => {
|
|
209
|
-
k(!1), c?.(A);
|
|
210
|
-
},
|
|
211
|
-
onCryptoError: (A) => {
|
|
212
|
-
k(!1), d?.(A);
|
|
213
|
-
},
|
|
214
|
-
customerEmail: n,
|
|
215
|
-
successUrl: a,
|
|
216
|
-
cancelUrl: p,
|
|
217
|
-
metadata: C,
|
|
218
|
-
couponCode: P,
|
|
219
|
-
testPageUrl: B,
|
|
220
|
-
hideMessages: N
|
|
221
|
-
};
|
|
222
|
-
return /* @__PURE__ */ w("div", { className: I.unstyled ? "" : I.className, style: I.unstyled ? {} : I.style, children: [
|
|
223
|
-
/* @__PURE__ */ u(
|
|
224
|
-
"button",
|
|
225
|
-
{
|
|
226
|
-
onClick: ne,
|
|
227
|
-
disabled: H,
|
|
228
|
-
className: I.unstyled ? "" : "cedros-theme__button cedros-theme__stripe",
|
|
229
|
-
style: {
|
|
230
|
-
width: "100%",
|
|
231
|
-
cursor: H ? "not-allowed" : "pointer",
|
|
232
|
-
opacity: H ? 0.6 : 1
|
|
233
|
-
},
|
|
234
|
-
type: "button",
|
|
235
|
-
children: H ? O("ui.processing") : L
|
|
236
|
-
}
|
|
237
|
-
),
|
|
238
|
-
E ? E(se) : /* @__PURE__ */ u(ze, { ...se })
|
|
239
|
-
] });
|
|
240
|
-
};
|
|
241
|
-
function wt(e) {
|
|
242
|
-
const { resource: r, items: t, checkout: o = {}, display: f = {}, callbacks: i = {}, advanced: h = {} } = e, { config: x, walletPool: m } = ee(), l = le(), { isCartMode: s } = Re(r, t), b = G.useMemo(() => ({
|
|
243
|
-
marginTop: "0.5rem",
|
|
244
|
-
fontSize: "0.875rem",
|
|
245
|
-
color: l.tokens.surfaceText,
|
|
246
|
-
opacity: 0.7,
|
|
247
|
-
textAlign: "center"
|
|
248
|
-
}), [l.tokens.surfaceText]), c = G.useMemo(
|
|
249
|
-
() => h.wallets && h.wallets.length > 0 ? h.wallets : m.getAdapters(),
|
|
250
|
-
[h.wallets, m]
|
|
251
|
-
), d = G.useMemo(
|
|
252
|
-
() => t ? Ie(t) : 0,
|
|
253
|
-
[t]
|
|
254
|
-
), n = G.useMemo(
|
|
255
|
-
() => i.onPaymentSuccess ? (k) => i.onPaymentSuccess({ transactionId: k, method: "stripe" }) : void 0,
|
|
256
|
-
[i.onPaymentSuccess]
|
|
257
|
-
), a = G.useMemo(
|
|
258
|
-
() => i.onPaymentSuccess ? (k) => i.onPaymentSuccess({ transactionId: k, method: "crypto" }) : void 0,
|
|
259
|
-
[i.onPaymentSuccess]
|
|
260
|
-
), p = G.useMemo(
|
|
261
|
-
() => i.onPaymentError ? (k) => i.onPaymentError({ message: k, method: "stripe" }) : void 0,
|
|
262
|
-
[i.onPaymentError]
|
|
263
|
-
), C = G.useMemo(
|
|
264
|
-
() => i.onPaymentError ? (k) => i.onPaymentError({ message: k, method: "crypto" }) : void 0,
|
|
265
|
-
[i.onPaymentError]
|
|
266
|
-
), P = x.solanaEndpoint ?? He(x.solanaCluster);
|
|
267
|
-
if (!r && (!t || t.length === 0))
|
|
268
|
-
return D().error('CedrosPay: Must provide either "resource" or "items" prop'), /* @__PURE__ */ u("div", { className: f.className, style: { color: l.tokens.errorText }, children: "Configuration error: No resource or items provided" });
|
|
269
|
-
const y = f.showCard ?? !0, B = f.showCrypto ?? !0, N = f.showPurchaseButton ?? !1, E = f.layout ?? "vertical", I = f.hideMessages ?? !1, v = h.autoDetectWallets ?? !0;
|
|
270
|
-
return /* @__PURE__ */ u("div", { className: l.unstyled ? f.className : l.className, style: l.unstyled ? {} : l.style, children: /* @__PURE__ */ u(De, { endpoint: P, children: /* @__PURE__ */ u(qe, { wallets: c, autoConnect: !1, children: /* @__PURE__ */ u("div", { className: l.unstyled ? f.className : `cedros-theme__pay ${f.className || ""}`, children: /* @__PURE__ */ w("div", { className: l.unstyled ? "" : `cedros-theme__pay-content cedros-theme__pay-content--${E}`, children: [
|
|
271
|
-
N ? /* @__PURE__ */ u(
|
|
272
|
-
Xe,
|
|
273
|
-
{
|
|
274
|
-
resource: s ? void 0 : r || t?.[0]?.resource,
|
|
275
|
-
items: s ? t : void 0,
|
|
276
|
-
label: f.purchaseLabel,
|
|
277
|
-
cardLabel: f.cardLabel,
|
|
278
|
-
cryptoLabel: f.cryptoLabel,
|
|
279
|
-
showCard: y,
|
|
280
|
-
showCrypto: B,
|
|
281
|
-
onPaymentAttempt: i.onPaymentAttempt,
|
|
282
|
-
onPaymentSuccess: n,
|
|
283
|
-
onPaymentError: p,
|
|
284
|
-
onStripeSuccess: n,
|
|
285
|
-
onCryptoSuccess: a,
|
|
286
|
-
onStripeError: p,
|
|
287
|
-
onCryptoError: C,
|
|
288
|
-
customerEmail: o.customerEmail,
|
|
289
|
-
successUrl: o.successUrl,
|
|
290
|
-
cancelUrl: o.cancelUrl,
|
|
291
|
-
metadata: o.metadata,
|
|
292
|
-
couponCode: o.couponCode,
|
|
293
|
-
autoDetectWallets: v,
|
|
294
|
-
testPageUrl: h.testPageUrl,
|
|
295
|
-
hideMessages: I,
|
|
296
|
-
renderModal: f.renderModal
|
|
297
|
-
}
|
|
298
|
-
) : /* @__PURE__ */ w(me, { children: [
|
|
299
|
-
y && /* @__PURE__ */ u(
|
|
300
|
-
Ue,
|
|
301
|
-
{
|
|
302
|
-
resource: s ? void 0 : r || t?.[0]?.resource,
|
|
303
|
-
items: s ? t : void 0,
|
|
304
|
-
customerEmail: o.customerEmail,
|
|
305
|
-
successUrl: o.successUrl,
|
|
306
|
-
cancelUrl: o.cancelUrl,
|
|
307
|
-
metadata: o.metadata,
|
|
308
|
-
couponCode: o.couponCode,
|
|
309
|
-
label: f.cardLabel,
|
|
310
|
-
onAttempt: i.onPaymentAttempt,
|
|
311
|
-
onSuccess: n,
|
|
312
|
-
onError: p
|
|
313
|
-
}
|
|
314
|
-
),
|
|
315
|
-
B && /* @__PURE__ */ u(
|
|
316
|
-
je,
|
|
317
|
-
{
|
|
318
|
-
resource: s ? void 0 : r || t?.[0]?.resource,
|
|
319
|
-
items: s ? t : void 0,
|
|
320
|
-
metadata: o.metadata,
|
|
321
|
-
couponCode: o.couponCode,
|
|
322
|
-
label: f.cryptoLabel,
|
|
323
|
-
onAttempt: i.onPaymentAttempt,
|
|
324
|
-
onSuccess: a,
|
|
325
|
-
onError: C,
|
|
326
|
-
testPageUrl: h.testPageUrl,
|
|
327
|
-
hideMessages: I
|
|
328
|
-
}
|
|
329
|
-
)
|
|
330
|
-
] }),
|
|
331
|
-
s && t && t.length > 1 && !I && /* @__PURE__ */ w("div", { style: b, children: [
|
|
332
|
-
"Checking out ",
|
|
333
|
-
d,
|
|
334
|
-
" items"
|
|
335
|
-
] })
|
|
336
|
-
] }) }) }) }) });
|
|
337
|
-
}
|
|
338
|
-
function Je() {
|
|
339
|
-
const { subscriptionManager: e } = ee(), [r, t] = U({
|
|
340
|
-
status: "idle",
|
|
341
|
-
error: null,
|
|
342
|
-
sessionId: null,
|
|
343
|
-
subscriptionStatus: null,
|
|
344
|
-
expiresAt: null
|
|
345
|
-
}), o = T(
|
|
346
|
-
async (x) => {
|
|
347
|
-
t((l) => ({
|
|
348
|
-
...l,
|
|
349
|
-
status: "loading",
|
|
350
|
-
error: null
|
|
351
|
-
}));
|
|
352
|
-
const m = await e.processSubscription(x);
|
|
353
|
-
return t((l) => ({
|
|
354
|
-
...l,
|
|
355
|
-
status: m.success ? "success" : "error",
|
|
356
|
-
error: m.success ? null : m.error || "Subscription failed",
|
|
357
|
-
sessionId: m.success && m.transactionId || null
|
|
358
|
-
})), m;
|
|
359
|
-
},
|
|
360
|
-
[e]
|
|
361
|
-
), f = T(
|
|
362
|
-
async (x) => {
|
|
363
|
-
t((m) => ({
|
|
364
|
-
...m,
|
|
365
|
-
status: "checking",
|
|
366
|
-
error: null
|
|
367
|
-
}));
|
|
368
|
-
try {
|
|
369
|
-
const m = await e.checkSubscriptionStatus(x);
|
|
370
|
-
return t((l) => ({
|
|
371
|
-
...l,
|
|
372
|
-
status: m.active ? "success" : "idle",
|
|
373
|
-
subscriptionStatus: m.status,
|
|
374
|
-
expiresAt: m.expiresAt || m.currentPeriodEnd || null
|
|
375
|
-
})), m;
|
|
376
|
-
} catch (m) {
|
|
377
|
-
const l = m instanceof Error ? m.message : "Failed to check subscription status";
|
|
378
|
-
throw t((s) => ({
|
|
379
|
-
...s,
|
|
380
|
-
status: "error",
|
|
381
|
-
error: l
|
|
382
|
-
})), m;
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
[e]
|
|
386
|
-
), i = T(
|
|
387
|
-
async (x, m, l) => {
|
|
388
|
-
t((s) => ({
|
|
389
|
-
...s,
|
|
390
|
-
status: "loading",
|
|
391
|
-
error: null
|
|
392
|
-
}));
|
|
393
|
-
try {
|
|
394
|
-
const s = await e.requestSubscriptionQuote(
|
|
395
|
-
x,
|
|
396
|
-
m,
|
|
397
|
-
l
|
|
398
|
-
);
|
|
399
|
-
return t((b) => ({
|
|
400
|
-
...b,
|
|
401
|
-
status: "idle"
|
|
402
|
-
})), s;
|
|
403
|
-
} catch (s) {
|
|
404
|
-
const b = s instanceof Error ? s.message : "Failed to get subscription quote";
|
|
405
|
-
throw t((c) => ({
|
|
406
|
-
...c,
|
|
407
|
-
status: "error",
|
|
408
|
-
error: b
|
|
409
|
-
})), s;
|
|
410
|
-
}
|
|
411
|
-
},
|
|
412
|
-
[e]
|
|
413
|
-
), h = T(() => {
|
|
414
|
-
t({
|
|
415
|
-
status: "idle",
|
|
416
|
-
error: null,
|
|
417
|
-
sessionId: null,
|
|
418
|
-
subscriptionStatus: null,
|
|
419
|
-
expiresAt: null
|
|
420
|
-
});
|
|
421
|
-
}, []);
|
|
422
|
-
return {
|
|
423
|
-
...r,
|
|
424
|
-
processSubscription: o,
|
|
425
|
-
checkStatus: f,
|
|
426
|
-
requestQuote: i,
|
|
427
|
-
reset: h
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
function Ct({
|
|
431
|
-
resource: e,
|
|
432
|
-
interval: r,
|
|
433
|
-
intervalDays: t,
|
|
434
|
-
trialDays: o,
|
|
435
|
-
successUrl: f,
|
|
436
|
-
cancelUrl: i,
|
|
437
|
-
metadata: h,
|
|
438
|
-
customerEmail: x,
|
|
439
|
-
couponCode: m,
|
|
440
|
-
label: l,
|
|
441
|
-
disabled: s = !1,
|
|
442
|
-
onAttempt: b,
|
|
443
|
-
onSuccess: c,
|
|
444
|
-
onError: d,
|
|
445
|
-
className: n = ""
|
|
446
|
-
}) {
|
|
447
|
-
const { status: a, error: p, sessionId: C, processSubscription: P } = Je(), y = le(), { t: B, translations: N } = ge(), E = l || B("ui.subscribe"), I = y.unstyled ? n : `${y.className} cedros-theme__stripe-button ${n}`.trim(), v = p && typeof p != "string" ? p?.code ?? null : null, q = p ? typeof p == "string" ? p : ((L) => {
|
|
448
|
-
if (!L || !N) return "";
|
|
449
|
-
const j = N.errors[L];
|
|
450
|
-
return j ? j.action ? `${j.message} ${j.action}` : j.message : "";
|
|
451
|
-
})(v) : null, R = T(async () => {
|
|
452
|
-
D().debug("[SubscribeButton] executeSubscription:", {
|
|
453
|
-
resource: e,
|
|
454
|
-
interval: r,
|
|
455
|
-
intervalDays: t,
|
|
456
|
-
trialDays: o,
|
|
457
|
-
couponCode: m
|
|
458
|
-
}), he("stripe", e), b && b("stripe"), ie("stripe", e);
|
|
459
|
-
const L = await P({
|
|
460
|
-
resource: e,
|
|
461
|
-
interval: r,
|
|
462
|
-
intervalDays: t,
|
|
463
|
-
trialDays: o,
|
|
464
|
-
customerEmail: x,
|
|
465
|
-
metadata: h,
|
|
466
|
-
couponCode: m,
|
|
467
|
-
successUrl: f,
|
|
468
|
-
cancelUrl: i
|
|
469
|
-
});
|
|
470
|
-
L.success && L.transactionId ? (be("stripe", L.transactionId, e), c && c(L.transactionId)) : !L.success && L.error && (ce("stripe", L.error, e), d && d(L.error));
|
|
471
|
-
}, [
|
|
472
|
-
e,
|
|
473
|
-
r,
|
|
474
|
-
t,
|
|
475
|
-
o,
|
|
476
|
-
x,
|
|
477
|
-
h,
|
|
478
|
-
m,
|
|
479
|
-
f,
|
|
480
|
-
i,
|
|
481
|
-
P,
|
|
482
|
-
b,
|
|
483
|
-
c,
|
|
484
|
-
d
|
|
485
|
-
]), $ = F(() => `subscribe-${e}-${r}`, [e, r]), _ = F(
|
|
486
|
-
() => Se($, R),
|
|
487
|
-
[$, R]
|
|
488
|
-
), z = a === "loading", O = s || z;
|
|
489
|
-
return /* @__PURE__ */ w("div", { className: I, style: y.unstyled ? {} : y.style, children: [
|
|
490
|
-
/* @__PURE__ */ u(
|
|
491
|
-
"button",
|
|
492
|
-
{
|
|
493
|
-
onClick: _,
|
|
494
|
-
disabled: O,
|
|
495
|
-
className: y.unstyled ? n : "cedros-theme__button cedros-theme__stripe",
|
|
496
|
-
type: "button",
|
|
497
|
-
children: z ? B("ui.processing") : E
|
|
498
|
-
}
|
|
499
|
-
),
|
|
500
|
-
q && /* @__PURE__ */ u("div", { className: y.unstyled ? "" : "cedros-theme__error", children: q }),
|
|
501
|
-
C && /* @__PURE__ */ u("div", { className: y.unstyled ? "" : "cedros-theme__success", children: B("ui.redirecting_to_checkout") })
|
|
502
|
-
] });
|
|
503
|
-
}
|
|
504
|
-
function Ze() {
|
|
505
|
-
const { subscriptionManager: e, x402Manager: r, walletManager: t } = ee(), { publicKey: o, signTransaction: f } = ye(), [i, h] = U({
|
|
506
|
-
status: "idle",
|
|
507
|
-
error: null,
|
|
508
|
-
sessionId: null,
|
|
509
|
-
subscriptionStatus: null,
|
|
510
|
-
expiresAt: null
|
|
511
|
-
}), [x, m] = U(null), l = T(() => {
|
|
512
|
-
if (!o) {
|
|
513
|
-
const n = "Wallet not connected";
|
|
514
|
-
return h((a) => ({ ...a, status: "error", error: n })), { valid: !1, error: n };
|
|
515
|
-
}
|
|
516
|
-
if (!f) {
|
|
517
|
-
const n = "Wallet does not support signing";
|
|
518
|
-
return h((a) => ({ ...a, status: "error", error: n })), { valid: !1, error: n };
|
|
519
|
-
}
|
|
520
|
-
return { valid: !0 };
|
|
521
|
-
}, [o, f]), s = T(
|
|
522
|
-
async (n) => {
|
|
523
|
-
if (!o)
|
|
524
|
-
return h((a) => ({
|
|
525
|
-
...a,
|
|
526
|
-
status: "error",
|
|
527
|
-
error: "Wallet not connected"
|
|
528
|
-
})), null;
|
|
529
|
-
h((a) => ({
|
|
530
|
-
...a,
|
|
531
|
-
status: "checking",
|
|
532
|
-
error: null
|
|
533
|
-
}));
|
|
534
|
-
try {
|
|
535
|
-
const a = await e.checkSubscriptionStatus({
|
|
536
|
-
resource: n,
|
|
537
|
-
userId: o.toString()
|
|
538
|
-
});
|
|
539
|
-
return h((p) => ({
|
|
540
|
-
...p,
|
|
541
|
-
status: a.active ? "success" : "idle",
|
|
542
|
-
subscriptionStatus: a.status,
|
|
543
|
-
expiresAt: a.expiresAt || a.currentPeriodEnd || null
|
|
544
|
-
})), a;
|
|
545
|
-
} catch (a) {
|
|
546
|
-
const p = Z(a, "Failed to check subscription status");
|
|
547
|
-
return h((C) => ({
|
|
548
|
-
...C,
|
|
549
|
-
status: "error",
|
|
550
|
-
error: p
|
|
551
|
-
})), null;
|
|
552
|
-
}
|
|
553
|
-
},
|
|
554
|
-
[o, e]
|
|
555
|
-
), b = T(
|
|
556
|
-
async (n, a, p) => {
|
|
557
|
-
h((C) => ({
|
|
558
|
-
...C,
|
|
559
|
-
status: "loading",
|
|
560
|
-
error: null
|
|
561
|
-
}));
|
|
562
|
-
try {
|
|
563
|
-
const C = await e.requestSubscriptionQuote(
|
|
564
|
-
n,
|
|
565
|
-
a,
|
|
566
|
-
p
|
|
567
|
-
);
|
|
568
|
-
return m(C), h((P) => ({
|
|
569
|
-
...P,
|
|
570
|
-
status: "idle"
|
|
571
|
-
})), C;
|
|
572
|
-
} catch (C) {
|
|
573
|
-
const P = Z(C, "Failed to get subscription quote");
|
|
574
|
-
return h((y) => ({
|
|
575
|
-
...y,
|
|
576
|
-
status: "error",
|
|
577
|
-
error: P
|
|
578
|
-
})), null;
|
|
579
|
-
}
|
|
580
|
-
},
|
|
581
|
-
[e]
|
|
582
|
-
), c = T(
|
|
583
|
-
async (n, a, p) => {
|
|
584
|
-
const C = l();
|
|
585
|
-
if (!C.valid)
|
|
586
|
-
return { success: !1, error: C.error };
|
|
587
|
-
h((P) => ({
|
|
588
|
-
...P,
|
|
589
|
-
status: "loading",
|
|
590
|
-
error: null
|
|
591
|
-
}));
|
|
592
|
-
try {
|
|
593
|
-
const P = await e.requestSubscriptionQuote(
|
|
594
|
-
n,
|
|
595
|
-
a,
|
|
596
|
-
p
|
|
597
|
-
);
|
|
598
|
-
m(P);
|
|
599
|
-
const y = P.requirement;
|
|
600
|
-
if (!r.validateRequirement(y))
|
|
601
|
-
throw new Error("Invalid subscription quote received from server");
|
|
602
|
-
const B = !!y.extra?.feePayer;
|
|
603
|
-
let N;
|
|
604
|
-
if (B) {
|
|
605
|
-
const { transaction: E, blockhash: I } = await r.buildGaslessTransaction({
|
|
606
|
-
resourceId: n,
|
|
607
|
-
userWallet: o.toString(),
|
|
608
|
-
feePayer: y.extra.feePayer,
|
|
609
|
-
couponCode: p?.couponCode
|
|
610
|
-
}), v = t.deserializeTransaction(E), k = await t.partiallySignTransaction({
|
|
611
|
-
transaction: v,
|
|
612
|
-
signTransaction: f,
|
|
613
|
-
blockhash: I
|
|
614
|
-
});
|
|
615
|
-
N = await r.submitGaslessTransaction({
|
|
616
|
-
resource: n,
|
|
617
|
-
partialTx: k,
|
|
618
|
-
couponCode: p?.couponCode,
|
|
619
|
-
resourceType: "regular",
|
|
620
|
-
requirement: y
|
|
621
|
-
});
|
|
622
|
-
} else {
|
|
623
|
-
const E = await t.buildTransaction({
|
|
624
|
-
requirement: y,
|
|
625
|
-
payerPublicKey: o
|
|
626
|
-
}), I = await t.signTransaction({
|
|
627
|
-
transaction: E,
|
|
628
|
-
signTransaction: f
|
|
629
|
-
}), v = t.buildPaymentPayload({
|
|
630
|
-
requirement: y,
|
|
631
|
-
signedTx: I,
|
|
632
|
-
payerPublicKey: o
|
|
633
|
-
});
|
|
634
|
-
N = await r.submitPayment({
|
|
635
|
-
resource: n,
|
|
636
|
-
payload: v,
|
|
637
|
-
couponCode: p?.couponCode,
|
|
638
|
-
resourceType: "regular"
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
if (N.success) {
|
|
642
|
-
const E = await e.checkSubscriptionStatus({
|
|
643
|
-
resource: n,
|
|
644
|
-
userId: o.toString()
|
|
645
|
-
});
|
|
646
|
-
h({
|
|
647
|
-
status: "success",
|
|
648
|
-
error: null,
|
|
649
|
-
sessionId: N.transactionId || null,
|
|
650
|
-
subscriptionStatus: E.status,
|
|
651
|
-
expiresAt: E.expiresAt || E.currentPeriodEnd || null
|
|
652
|
-
});
|
|
653
|
-
} else
|
|
654
|
-
h((E) => ({
|
|
655
|
-
...E,
|
|
656
|
-
status: "error",
|
|
657
|
-
error: N.error || "Subscription payment failed"
|
|
658
|
-
}));
|
|
659
|
-
return N;
|
|
660
|
-
} catch (P) {
|
|
661
|
-
const y = Z(P, "Subscription payment failed");
|
|
662
|
-
return h((B) => ({
|
|
663
|
-
...B,
|
|
664
|
-
status: "error",
|
|
665
|
-
error: y
|
|
666
|
-
})), { success: !1, error: y };
|
|
667
|
-
}
|
|
668
|
-
},
|
|
669
|
-
[
|
|
670
|
-
l,
|
|
671
|
-
e,
|
|
672
|
-
r,
|
|
673
|
-
t,
|
|
674
|
-
o,
|
|
675
|
-
f
|
|
676
|
-
]
|
|
677
|
-
), d = T(() => {
|
|
678
|
-
h({
|
|
679
|
-
status: "idle",
|
|
680
|
-
error: null,
|
|
681
|
-
sessionId: null,
|
|
682
|
-
subscriptionStatus: null,
|
|
683
|
-
expiresAt: null
|
|
684
|
-
}), m(null);
|
|
685
|
-
}, []);
|
|
686
|
-
return {
|
|
687
|
-
...i,
|
|
688
|
-
quote: x,
|
|
689
|
-
checkStatus: s,
|
|
690
|
-
requestQuote: b,
|
|
691
|
-
processPayment: c,
|
|
692
|
-
reset: d
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
function vt({
|
|
696
|
-
resource: e,
|
|
697
|
-
interval: r,
|
|
698
|
-
intervalDays: t,
|
|
699
|
-
couponCode: o,
|
|
700
|
-
label: f,
|
|
701
|
-
disabled: i = !1,
|
|
702
|
-
onAttempt: h,
|
|
703
|
-
onSuccess: x,
|
|
704
|
-
onError: m,
|
|
705
|
-
className: l = "",
|
|
706
|
-
testPageUrl: s,
|
|
707
|
-
hideMessages: b = !1,
|
|
708
|
-
autoCheckStatus: c = !0
|
|
709
|
-
}) {
|
|
710
|
-
const {
|
|
711
|
-
connected: d,
|
|
712
|
-
connecting: n,
|
|
713
|
-
connect: a,
|
|
714
|
-
disconnect: p,
|
|
715
|
-
select: C,
|
|
716
|
-
wallets: P,
|
|
717
|
-
wallet: y,
|
|
718
|
-
publicKey: B
|
|
719
|
-
} = ye(), {
|
|
720
|
-
status: N,
|
|
721
|
-
error: E,
|
|
722
|
-
subscriptionStatus: I,
|
|
723
|
-
expiresAt: v,
|
|
724
|
-
checkStatus: k,
|
|
725
|
-
processPayment: q
|
|
726
|
-
} = Ze(), R = le(), { solanaError: $ } = ee(), { t: _, translations: z } = ge(), O = f || _("ui.subscribe_with_crypto"), L = ke(q), j = ke(k);
|
|
727
|
-
Y(() => {
|
|
728
|
-
L.current = q, j.current = k;
|
|
729
|
-
}, [q, k]);
|
|
730
|
-
const ue = E && typeof E != "string" ? E?.code ?? null : null, re = $ && typeof $ != "string" ? $?.code ?? null : null, te = (S) => {
|
|
731
|
-
if (!S || !z) return "";
|
|
732
|
-
const W = z.errors[S];
|
|
733
|
-
return W ? W.action ? `${W.message} ${W.action}` : W.message : "";
|
|
734
|
-
}, ne = E ? typeof E == "string" ? E : te(ue) : null, H = $ ? typeof $ == "string" ? $ : te(re) : null, se = F(
|
|
735
|
-
() => P.map((S) => `${S.adapter.name}-${S.readyState}`).join(","),
|
|
736
|
-
[P]
|
|
737
|
-
), A = F(
|
|
738
|
-
() => P.filter(
|
|
739
|
-
({ readyState: S }) => S === Ee.Installed || S === Ee.Loadable
|
|
740
|
-
),
|
|
741
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
742
|
-
[se]
|
|
743
|
-
);
|
|
744
|
-
Y(() => {
|
|
745
|
-
c && d && B && (D().debug("[CryptoSubscribeButton] Auto-checking subscription status"), j.current(e));
|
|
746
|
-
}, [c, d, B, e]), Y(() => {
|
|
747
|
-
N === "success" && I === "active" && (be("crypto", "subscription-active", e), x && x("subscription-active"));
|
|
748
|
-
}, [N, I, e, x]), Y(() => {
|
|
749
|
-
N === "error" && E && (ce("crypto", E, e), m && m(E));
|
|
750
|
-
}, [N, E, e, m]);
|
|
751
|
-
const K = typeof window < "u" && window.top !== window.self, [Q, M] = U(!1), [we, de] = U(!1), [Ce, X] = U(!1), J = $;
|
|
752
|
-
Y(() => {
|
|
753
|
-
let S = !1;
|
|
754
|
-
return S || (async () => {
|
|
755
|
-
if (we && y && !d && !n) {
|
|
756
|
-
D().debug(
|
|
757
|
-
"[CryptoSubscribeButton] Wallet detected, attempting auto-connect:",
|
|
758
|
-
y.adapter.name
|
|
759
|
-
), de(!1), Te(y.adapter.name);
|
|
760
|
-
try {
|
|
761
|
-
await a(), S || D().debug("[CryptoSubscribeButton] Auto-connect successful");
|
|
762
|
-
} catch (pe) {
|
|
763
|
-
if (!S) {
|
|
764
|
-
D().error("[CryptoSubscribeButton] Auto-connect failed:", pe);
|
|
765
|
-
const Le = pe instanceof Error ? pe.message : "Failed to connect wallet";
|
|
766
|
-
fe(Le, y.adapter.name), X(!1);
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
})(), () => {
|
|
771
|
-
S = !0;
|
|
772
|
-
};
|
|
773
|
-
}, [y, we, d, n, a]), Y(() => {
|
|
774
|
-
d && Ce && B && y && (Oe(y.adapter.name, B.toString()), D().debug("[CryptoSubscribeButton] Processing pending subscription payment"), X(!1), M(!1), ie("crypto", e), L.current(e, r, { couponCode: o, intervalDays: t }));
|
|
775
|
-
}, [d, Ce, B, y, e, r, o, t]);
|
|
776
|
-
const ve = T(async () => {
|
|
777
|
-
if (D().debug("[CryptoSubscribeButton] executeSubscriptionFlow called", {
|
|
778
|
-
connected: d,
|
|
779
|
-
wallet: y?.adapter.name,
|
|
780
|
-
resource: e,
|
|
781
|
-
interval: r
|
|
782
|
-
}), he("crypto", e), h && h("crypto"), J) {
|
|
783
|
-
D().error("[CryptoSubscribeButton] Solana dependencies missing:", J), ce("crypto", J, e), m && m(J);
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
if (K) {
|
|
787
|
-
const S = s || window.location.href;
|
|
788
|
-
window.open(S, "_blank", "noopener,noreferrer");
|
|
789
|
-
return;
|
|
790
|
-
}
|
|
791
|
-
if (d)
|
|
792
|
-
ie("crypto", e), await q(e, r, { couponCode: o, intervalDays: t });
|
|
793
|
-
else {
|
|
794
|
-
X(!0);
|
|
795
|
-
try {
|
|
796
|
-
if (y)
|
|
797
|
-
D().debug(
|
|
798
|
-
"[CryptoSubscribeButton] Wallet already selected, connecting:",
|
|
799
|
-
y.adapter.name
|
|
800
|
-
), Te(y.adapter.name), await a();
|
|
801
|
-
else {
|
|
802
|
-
if (D().debug("[CryptoSubscribeButton] No wallet selected, showing selector"), A.length === 0) {
|
|
803
|
-
X(!1);
|
|
804
|
-
const S = "No wallets available";
|
|
805
|
-
throw fe(S), new Error(S);
|
|
806
|
-
}
|
|
807
|
-
M(!0);
|
|
808
|
-
}
|
|
809
|
-
} catch (S) {
|
|
810
|
-
X(!1);
|
|
811
|
-
const W = S instanceof Error ? S.message : "Failed to connect wallet";
|
|
812
|
-
D().error("[CryptoSubscribeButton] Connection error:", W), fe(W, y?.adapter.name);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
}, [
|
|
816
|
-
d,
|
|
817
|
-
y,
|
|
818
|
-
e,
|
|
819
|
-
r,
|
|
820
|
-
o,
|
|
821
|
-
t,
|
|
822
|
-
K,
|
|
823
|
-
s,
|
|
824
|
-
A,
|
|
825
|
-
a,
|
|
826
|
-
q,
|
|
827
|
-
J,
|
|
828
|
-
h,
|
|
829
|
-
m
|
|
830
|
-
]), xe = F(() => `crypto-subscribe-${e}-${r}`, [e, r]), Ne = F(
|
|
831
|
-
() => Se(xe, ve, {
|
|
832
|
-
cooldownMs: 200,
|
|
833
|
-
deduplicationWindowMs: 0
|
|
834
|
-
}),
|
|
835
|
-
[xe, ve]
|
|
836
|
-
), Pe = N === "loading" || N === "checking", oe = I === "active" || I === "trialing", Me = i || Pe || n || !!J || oe;
|
|
837
|
-
let ae = O;
|
|
838
|
-
if (Pe)
|
|
839
|
-
ae = _("ui.processing");
|
|
840
|
-
else if (oe && v) {
|
|
841
|
-
const S = new Date(v).toLocaleDateString();
|
|
842
|
-
ae = `${_("ui.subscribed_until")} ${S}`;
|
|
843
|
-
} else oe && (ae = _("ui.subscribed"));
|
|
844
|
-
const _e = T(async () => {
|
|
845
|
-
try {
|
|
846
|
-
de(!1), d && await p(), C(null), M(!0);
|
|
847
|
-
} catch (S) {
|
|
848
|
-
D().error("Failed to change wallet:", S);
|
|
849
|
-
}
|
|
850
|
-
}, [d, p, C]), Ae = T(
|
|
851
|
-
(S) => {
|
|
852
|
-
D().debug("[CryptoSubscribeButton] Wallet clicked:", S), M(!1), C(S), de(!0);
|
|
853
|
-
},
|
|
854
|
-
[C]
|
|
855
|
-
), We = T(async () => {
|
|
856
|
-
try {
|
|
857
|
-
await p(), X(!1), typeof window < "u" && window.localStorage && window.localStorage.removeItem("walletName");
|
|
858
|
-
} catch (S) {
|
|
859
|
-
D().error("Failed to disconnect wallet:", S);
|
|
860
|
-
}
|
|
861
|
-
}, [p]);
|
|
862
|
-
return /* @__PURE__ */ w(
|
|
863
|
-
"div",
|
|
864
|
-
{
|
|
865
|
-
className: R.unstyled ? l : `${R.className} cedros-theme__crypto-button ${l || ""}`,
|
|
866
|
-
style: R.unstyled ? {} : R.style,
|
|
867
|
-
children: [
|
|
868
|
-
/* @__PURE__ */ u(
|
|
869
|
-
"button",
|
|
870
|
-
{
|
|
871
|
-
onClick: Ne,
|
|
872
|
-
disabled: Me,
|
|
873
|
-
className: R.unstyled ? l : "cedros-theme__button cedros-theme__crypto",
|
|
874
|
-
type: "button",
|
|
875
|
-
children: ae
|
|
876
|
-
}
|
|
877
|
-
),
|
|
878
|
-
Q && !b && /* @__PURE__ */ u(
|
|
879
|
-
"div",
|
|
880
|
-
{
|
|
881
|
-
className: "cedros-modal-overlay",
|
|
882
|
-
style: {
|
|
883
|
-
position: "fixed",
|
|
884
|
-
top: 0,
|
|
885
|
-
left: 0,
|
|
886
|
-
right: 0,
|
|
887
|
-
bottom: 0,
|
|
888
|
-
backgroundColor: R.tokens.modalOverlay,
|
|
889
|
-
display: "flex",
|
|
890
|
-
alignItems: "center",
|
|
891
|
-
justifyContent: "center",
|
|
892
|
-
zIndex: 9999,
|
|
893
|
-
padding: "1rem"
|
|
894
|
-
},
|
|
895
|
-
onClick: () => M(!1),
|
|
896
|
-
children: /* @__PURE__ */ w(
|
|
897
|
-
"div",
|
|
898
|
-
{
|
|
899
|
-
className: "cedros-modal-content",
|
|
900
|
-
style: {
|
|
901
|
-
backgroundColor: R.tokens.modalBackground,
|
|
902
|
-
borderRadius: "12px",
|
|
903
|
-
padding: "2rem",
|
|
904
|
-
maxWidth: "400px",
|
|
905
|
-
width: "100%",
|
|
906
|
-
boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
|
|
907
|
-
border: `1px solid ${R.tokens.modalBorder}`
|
|
908
|
-
},
|
|
909
|
-
onClick: (S) => S.stopPropagation(),
|
|
910
|
-
children: [
|
|
911
|
-
/* @__PURE__ */ w(
|
|
912
|
-
"div",
|
|
913
|
-
{
|
|
914
|
-
style: {
|
|
915
|
-
display: "flex",
|
|
916
|
-
justifyContent: "space-between",
|
|
917
|
-
alignItems: "center",
|
|
918
|
-
marginBottom: "1.5rem"
|
|
919
|
-
},
|
|
920
|
-
children: [
|
|
921
|
-
/* @__PURE__ */ u(
|
|
922
|
-
"h3",
|
|
923
|
-
{
|
|
924
|
-
style: {
|
|
925
|
-
margin: 0,
|
|
926
|
-
fontSize: "1.25rem",
|
|
927
|
-
fontWeight: 600,
|
|
928
|
-
color: R.tokens.surfaceText
|
|
929
|
-
},
|
|
930
|
-
children: _("wallet.select_wallet")
|
|
931
|
-
}
|
|
932
|
-
),
|
|
933
|
-
/* @__PURE__ */ u(
|
|
934
|
-
"button",
|
|
935
|
-
{
|
|
936
|
-
onClick: () => M(!1),
|
|
937
|
-
style: Fe(R.tokens.surfaceText),
|
|
938
|
-
"aria-label": "Close modal",
|
|
939
|
-
type: "button",
|
|
940
|
-
children: "×"
|
|
941
|
-
}
|
|
942
|
-
)
|
|
943
|
-
]
|
|
944
|
-
}
|
|
945
|
-
),
|
|
946
|
-
/* @__PURE__ */ u("div", { style: { display: "flex", flexDirection: "column", gap: "0.75rem" }, children: A.map((S) => /* @__PURE__ */ w(
|
|
947
|
-
"button",
|
|
948
|
-
{
|
|
949
|
-
onClick: () => Ae(S.adapter.name),
|
|
950
|
-
style: {
|
|
951
|
-
width: "100%",
|
|
952
|
-
padding: "1rem",
|
|
953
|
-
backgroundColor: R.tokens.surfaceBackground,
|
|
954
|
-
border: `1px solid ${R.tokens.surfaceBorder}`,
|
|
955
|
-
borderRadius: "0.5rem",
|
|
956
|
-
cursor: "pointer",
|
|
957
|
-
fontSize: "1rem",
|
|
958
|
-
textAlign: "left",
|
|
959
|
-
color: R.tokens.surfaceText,
|
|
960
|
-
display: "flex",
|
|
961
|
-
alignItems: "center",
|
|
962
|
-
gap: "1rem",
|
|
963
|
-
transition: "all 0.2s ease"
|
|
964
|
-
},
|
|
965
|
-
onMouseEnter: (W) => {
|
|
966
|
-
W.currentTarget.style.backgroundColor = R.tokens.modalBackground, W.currentTarget.style.borderColor = R.tokens.surfaceText, W.currentTarget.style.transform = "translateY(-2px)";
|
|
967
|
-
},
|
|
968
|
-
onMouseLeave: (W) => {
|
|
969
|
-
W.currentTarget.style.backgroundColor = R.tokens.surfaceBackground, W.currentTarget.style.borderColor = R.tokens.surfaceBorder, W.currentTarget.style.transform = "translateY(0)";
|
|
970
|
-
},
|
|
971
|
-
type: "button",
|
|
972
|
-
children: [
|
|
973
|
-
/* @__PURE__ */ u(Ke, { wallet: S, style: { width: "24px", height: "24px" } }),
|
|
974
|
-
/* @__PURE__ */ u("span", { style: { fontWeight: 500 }, children: S.adapter.name })
|
|
975
|
-
]
|
|
976
|
-
},
|
|
977
|
-
S.adapter.name
|
|
978
|
-
)) })
|
|
979
|
-
]
|
|
980
|
-
}
|
|
981
|
-
)
|
|
982
|
-
}
|
|
983
|
-
),
|
|
984
|
-
d && !b && !Q && /* @__PURE__ */ w(
|
|
985
|
-
"div",
|
|
986
|
-
{
|
|
987
|
-
style: {
|
|
988
|
-
display: "flex",
|
|
989
|
-
justifyContent: "space-between",
|
|
990
|
-
marginTop: "0.5rem",
|
|
991
|
-
fontSize: "0.75rem",
|
|
992
|
-
color: R.tokens.surfaceText,
|
|
993
|
-
opacity: 0.7
|
|
994
|
-
},
|
|
995
|
-
children: [
|
|
996
|
-
/* @__PURE__ */ u(
|
|
997
|
-
"button",
|
|
998
|
-
{
|
|
999
|
-
onClick: _e,
|
|
1000
|
-
style: {
|
|
1001
|
-
background: "none",
|
|
1002
|
-
border: "none",
|
|
1003
|
-
padding: 0,
|
|
1004
|
-
color: "inherit",
|
|
1005
|
-
textDecoration: "none",
|
|
1006
|
-
cursor: "pointer",
|
|
1007
|
-
fontSize: "inherit"
|
|
1008
|
-
},
|
|
1009
|
-
type: "button",
|
|
1010
|
-
children: _("wallet.change")
|
|
1011
|
-
}
|
|
1012
|
-
),
|
|
1013
|
-
/* @__PURE__ */ u(
|
|
1014
|
-
"button",
|
|
1015
|
-
{
|
|
1016
|
-
onClick: We,
|
|
1017
|
-
style: {
|
|
1018
|
-
background: "none",
|
|
1019
|
-
border: "none",
|
|
1020
|
-
padding: 0,
|
|
1021
|
-
color: "inherit",
|
|
1022
|
-
textDecoration: "none",
|
|
1023
|
-
cursor: "pointer",
|
|
1024
|
-
fontSize: "inherit"
|
|
1025
|
-
},
|
|
1026
|
-
type: "button",
|
|
1027
|
-
children: _("ui.disconnect")
|
|
1028
|
-
}
|
|
1029
|
-
)
|
|
1030
|
-
]
|
|
1031
|
-
}
|
|
1032
|
-
),
|
|
1033
|
-
!b && H && /* @__PURE__ */ u("div", { className: R.unstyled ? "" : "cedros-theme__error", children: H }),
|
|
1034
|
-
!b && ne && /* @__PURE__ */ u("div", { className: R.unstyled ? "" : "cedros-theme__error", children: ne }),
|
|
1035
|
-
!b && oe && /* @__PURE__ */ u("div", { className: R.unstyled ? "" : "cedros-theme__success", children: _("ui.subscription_active") })
|
|
1036
|
-
]
|
|
1037
|
-
}
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
function et() {
|
|
1041
|
-
const { subscriptionChangeManager: e } = ee(), [r, t] = U({
|
|
1042
|
-
status: "idle",
|
|
1043
|
-
error: null,
|
|
1044
|
-
subscription: null,
|
|
1045
|
-
changePreview: null
|
|
1046
|
-
}), o = T(
|
|
1047
|
-
async (s, b) => {
|
|
1048
|
-
t((c) => ({ ...c, status: "loading", error: null }));
|
|
1049
|
-
try {
|
|
1050
|
-
const c = await e.getDetails(s, b);
|
|
1051
|
-
return t((d) => ({
|
|
1052
|
-
...d,
|
|
1053
|
-
status: "success",
|
|
1054
|
-
subscription: c
|
|
1055
|
-
})), c;
|
|
1056
|
-
} catch (c) {
|
|
1057
|
-
const d = c instanceof Error ? c.message : "Failed to load subscription";
|
|
1058
|
-
return t((n) => ({ ...n, status: "error", error: d })), null;
|
|
1059
|
-
}
|
|
1060
|
-
},
|
|
1061
|
-
[e]
|
|
1062
|
-
), f = T(
|
|
1063
|
-
async (s, b, c, d) => {
|
|
1064
|
-
t((n) => ({ ...n, status: "loading", error: null }));
|
|
1065
|
-
try {
|
|
1066
|
-
const n = {
|
|
1067
|
-
currentResource: s,
|
|
1068
|
-
newResource: b,
|
|
1069
|
-
userId: c,
|
|
1070
|
-
newInterval: d
|
|
1071
|
-
}, a = await e.previewChange(n);
|
|
1072
|
-
return t((p) => ({
|
|
1073
|
-
...p,
|
|
1074
|
-
status: "idle",
|
|
1075
|
-
changePreview: a
|
|
1076
|
-
})), a;
|
|
1077
|
-
} catch (n) {
|
|
1078
|
-
const a = n instanceof Error ? n.message : "Failed to preview change";
|
|
1079
|
-
return t((p) => ({ ...p, status: "error", error: a })), null;
|
|
1080
|
-
}
|
|
1081
|
-
},
|
|
1082
|
-
[e]
|
|
1083
|
-
), i = T(
|
|
1084
|
-
async (s) => {
|
|
1085
|
-
const { subscription: b } = r;
|
|
1086
|
-
if (!b)
|
|
1087
|
-
return t((c) => ({ ...c, status: "error", error: "No subscription loaded" })), null;
|
|
1088
|
-
t((c) => ({ ...c, status: "loading", error: null }));
|
|
1089
|
-
try {
|
|
1090
|
-
const c = {
|
|
1091
|
-
currentResource: b.resource,
|
|
1092
|
-
newResource: s.newResource,
|
|
1093
|
-
userId: b.id,
|
|
1094
|
-
// Use subscription ID as user identifier
|
|
1095
|
-
newInterval: s.newInterval,
|
|
1096
|
-
prorationBehavior: s.prorationBehavior,
|
|
1097
|
-
immediate: s.immediate
|
|
1098
|
-
}, d = await e.changeSubscription(c);
|
|
1099
|
-
return d.success ? t((n) => ({
|
|
1100
|
-
...n,
|
|
1101
|
-
status: "success",
|
|
1102
|
-
subscription: n.subscription ? {
|
|
1103
|
-
...n.subscription,
|
|
1104
|
-
resource: d.newResource,
|
|
1105
|
-
interval: d.newInterval,
|
|
1106
|
-
status: d.status
|
|
1107
|
-
} : null,
|
|
1108
|
-
changePreview: null
|
|
1109
|
-
})) : t((n) => ({
|
|
1110
|
-
...n,
|
|
1111
|
-
status: "error",
|
|
1112
|
-
error: d.error || "Failed to change subscription"
|
|
1113
|
-
})), d;
|
|
1114
|
-
} catch (c) {
|
|
1115
|
-
const d = c instanceof Error ? c.message : "Failed to change subscription";
|
|
1116
|
-
return t((n) => ({ ...n, status: "error", error: d })), null;
|
|
1117
|
-
}
|
|
1118
|
-
},
|
|
1119
|
-
[e, r.subscription]
|
|
1120
|
-
), h = T(
|
|
1121
|
-
async (s) => {
|
|
1122
|
-
const { subscription: b } = r;
|
|
1123
|
-
if (!b)
|
|
1124
|
-
return t((c) => ({ ...c, status: "error", error: "No subscription loaded" })), null;
|
|
1125
|
-
t((c) => ({ ...c, status: "loading", error: null }));
|
|
1126
|
-
try {
|
|
1127
|
-
const c = {
|
|
1128
|
-
resource: b.resource,
|
|
1129
|
-
userId: b.id,
|
|
1130
|
-
immediate: s
|
|
1131
|
-
}, d = await e.cancel(c);
|
|
1132
|
-
if (d.success) {
|
|
1133
|
-
const n = s ? "canceled" : b.status;
|
|
1134
|
-
t((a) => ({
|
|
1135
|
-
...a,
|
|
1136
|
-
status: "success",
|
|
1137
|
-
subscription: a.subscription ? {
|
|
1138
|
-
...a.subscription,
|
|
1139
|
-
status: n,
|
|
1140
|
-
cancelAtPeriodEnd: !s
|
|
1141
|
-
} : null
|
|
1142
|
-
}));
|
|
1143
|
-
} else
|
|
1144
|
-
t((n) => ({
|
|
1145
|
-
...n,
|
|
1146
|
-
status: "error",
|
|
1147
|
-
error: d.error || "Failed to cancel subscription"
|
|
1148
|
-
}));
|
|
1149
|
-
return d;
|
|
1150
|
-
} catch (c) {
|
|
1151
|
-
const d = c instanceof Error ? c.message : "Failed to cancel subscription";
|
|
1152
|
-
return t((n) => ({ ...n, status: "error", error: d })), null;
|
|
1153
|
-
}
|
|
1154
|
-
},
|
|
1155
|
-
[e, r.subscription]
|
|
1156
|
-
), x = T(
|
|
1157
|
-
async (s, b) => {
|
|
1158
|
-
t((c) => ({ ...c, status: "loading", error: null }));
|
|
1159
|
-
try {
|
|
1160
|
-
const c = await e.getBillingPortalUrl({
|
|
1161
|
-
userId: s,
|
|
1162
|
-
returnUrl: b
|
|
1163
|
-
});
|
|
1164
|
-
return window.location.href = c.url, c;
|
|
1165
|
-
} catch (c) {
|
|
1166
|
-
const d = c instanceof Error ? c.message : "Failed to open billing portal";
|
|
1167
|
-
return t((n) => ({ ...n, status: "error", error: d })), null;
|
|
1168
|
-
}
|
|
1169
|
-
},
|
|
1170
|
-
[e]
|
|
1171
|
-
), m = T(() => {
|
|
1172
|
-
t((s) => ({ ...s, changePreview: null }));
|
|
1173
|
-
}, []), l = T(() => {
|
|
1174
|
-
t({
|
|
1175
|
-
status: "idle",
|
|
1176
|
-
error: null,
|
|
1177
|
-
subscription: null,
|
|
1178
|
-
changePreview: null
|
|
1179
|
-
});
|
|
1180
|
-
}, []);
|
|
1181
|
-
return {
|
|
1182
|
-
...r,
|
|
1183
|
-
loadSubscription: o,
|
|
1184
|
-
previewChange: f,
|
|
1185
|
-
changeSubscription: i,
|
|
1186
|
-
cancelSubscription: h,
|
|
1187
|
-
openBillingPortal: x,
|
|
1188
|
-
clearPreview: m,
|
|
1189
|
-
reset: l
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
const g = {
|
|
1193
|
-
container: {
|
|
1194
|
-
padding: "24px",
|
|
1195
|
-
backgroundColor: "#fff",
|
|
1196
|
-
borderRadius: "8px",
|
|
1197
|
-
border: "1px solid #e5e7eb",
|
|
1198
|
-
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
1199
|
-
},
|
|
1200
|
-
error: {
|
|
1201
|
-
padding: "12px 16px",
|
|
1202
|
-
backgroundColor: "#fef2f2",
|
|
1203
|
-
border: "1px solid #fecaca",
|
|
1204
|
-
borderRadius: "6px",
|
|
1205
|
-
color: "#dc2626",
|
|
1206
|
-
marginBottom: "16px"
|
|
1207
|
-
},
|
|
1208
|
-
loading: {
|
|
1209
|
-
padding: "24px",
|
|
1210
|
-
textAlign: "center",
|
|
1211
|
-
color: "#6b7280"
|
|
1212
|
-
},
|
|
1213
|
-
details: {
|
|
1214
|
-
marginBottom: "24px"
|
|
1215
|
-
},
|
|
1216
|
-
title: {
|
|
1217
|
-
margin: "0 0 16px 0",
|
|
1218
|
-
fontSize: "18px",
|
|
1219
|
-
fontWeight: 600,
|
|
1220
|
-
color: "#111827"
|
|
1221
|
-
},
|
|
1222
|
-
detailRow: {
|
|
1223
|
-
display: "flex",
|
|
1224
|
-
justifyContent: "space-between",
|
|
1225
|
-
alignItems: "center",
|
|
1226
|
-
padding: "8px 0",
|
|
1227
|
-
borderBottom: "1px solid #f3f4f6"
|
|
1228
|
-
},
|
|
1229
|
-
label: {
|
|
1230
|
-
color: "#6b7280",
|
|
1231
|
-
fontSize: "14px"
|
|
1232
|
-
},
|
|
1233
|
-
value: {
|
|
1234
|
-
color: "#111827",
|
|
1235
|
-
fontSize: "14px",
|
|
1236
|
-
fontWeight: 500
|
|
1237
|
-
},
|
|
1238
|
-
statusBadge: {
|
|
1239
|
-
padding: "4px 8px",
|
|
1240
|
-
borderRadius: "4px",
|
|
1241
|
-
color: "#fff",
|
|
1242
|
-
fontSize: "12px",
|
|
1243
|
-
fontWeight: 500,
|
|
1244
|
-
textTransform: "capitalize"
|
|
1245
|
-
},
|
|
1246
|
-
cancelNotice: {
|
|
1247
|
-
marginTop: "12px",
|
|
1248
|
-
padding: "8px 12px",
|
|
1249
|
-
backgroundColor: "#fef3c7",
|
|
1250
|
-
border: "1px solid #fcd34d",
|
|
1251
|
-
borderRadius: "6px",
|
|
1252
|
-
color: "#92400e",
|
|
1253
|
-
fontSize: "13px"
|
|
1254
|
-
},
|
|
1255
|
-
prorationPreview: {
|
|
1256
|
-
padding: "16px",
|
|
1257
|
-
backgroundColor: "#f9fafb",
|
|
1258
|
-
borderRadius: "8px",
|
|
1259
|
-
marginBottom: "24px"
|
|
1260
|
-
},
|
|
1261
|
-
previewTitle: {
|
|
1262
|
-
margin: "0 0 12px 0",
|
|
1263
|
-
fontSize: "16px",
|
|
1264
|
-
fontWeight: 600,
|
|
1265
|
-
color: "#111827"
|
|
1266
|
-
},
|
|
1267
|
-
previewDetails: {
|
|
1268
|
-
marginBottom: "16px"
|
|
1269
|
-
},
|
|
1270
|
-
previewRow: {
|
|
1271
|
-
display: "flex",
|
|
1272
|
-
justifyContent: "space-between",
|
|
1273
|
-
padding: "6px 0",
|
|
1274
|
-
fontSize: "14px",
|
|
1275
|
-
color: "#4b5563"
|
|
1276
|
-
},
|
|
1277
|
-
previewTotal: {
|
|
1278
|
-
borderTop: "1px solid #e5e7eb",
|
|
1279
|
-
marginTop: "8px",
|
|
1280
|
-
paddingTop: "12px",
|
|
1281
|
-
fontWeight: 600,
|
|
1282
|
-
color: "#111827"
|
|
1283
|
-
},
|
|
1284
|
-
previewActions: {
|
|
1285
|
-
display: "flex",
|
|
1286
|
-
gap: "12px",
|
|
1287
|
-
justifyContent: "flex-end"
|
|
1288
|
-
},
|
|
1289
|
-
cancelButton: {
|
|
1290
|
-
padding: "8px 16px",
|
|
1291
|
-
backgroundColor: "#fff",
|
|
1292
|
-
border: "1px solid #d1d5db",
|
|
1293
|
-
borderRadius: "6px",
|
|
1294
|
-
color: "#374151",
|
|
1295
|
-
cursor: "pointer",
|
|
1296
|
-
fontSize: "14px"
|
|
1297
|
-
},
|
|
1298
|
-
confirmButton: {
|
|
1299
|
-
padding: "8px 16px",
|
|
1300
|
-
backgroundColor: "#3b82f6",
|
|
1301
|
-
border: "none",
|
|
1302
|
-
borderRadius: "6px",
|
|
1303
|
-
color: "#fff",
|
|
1304
|
-
cursor: "pointer",
|
|
1305
|
-
fontSize: "14px",
|
|
1306
|
-
fontWeight: 500
|
|
1307
|
-
},
|
|
1308
|
-
plansSection: {
|
|
1309
|
-
marginBottom: "24px"
|
|
1310
|
-
},
|
|
1311
|
-
plansTitle: {
|
|
1312
|
-
margin: "0 0 12px 0",
|
|
1313
|
-
fontSize: "16px",
|
|
1314
|
-
fontWeight: 600,
|
|
1315
|
-
color: "#111827"
|
|
1316
|
-
},
|
|
1317
|
-
plansList: {
|
|
1318
|
-
display: "grid",
|
|
1319
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))",
|
|
1320
|
-
gap: "16px"
|
|
1321
|
-
},
|
|
1322
|
-
planCard: {
|
|
1323
|
-
padding: "16px",
|
|
1324
|
-
backgroundColor: "#fff",
|
|
1325
|
-
border: "1px solid #e5e7eb",
|
|
1326
|
-
borderRadius: "8px",
|
|
1327
|
-
textAlign: "center"
|
|
1328
|
-
},
|
|
1329
|
-
currentPlan: {
|
|
1330
|
-
borderColor: "#3b82f6",
|
|
1331
|
-
backgroundColor: "#eff6ff"
|
|
1332
|
-
},
|
|
1333
|
-
planName: {
|
|
1334
|
-
fontSize: "16px",
|
|
1335
|
-
fontWeight: 600,
|
|
1336
|
-
color: "#111827",
|
|
1337
|
-
marginBottom: "4px"
|
|
1338
|
-
},
|
|
1339
|
-
planPrice: {
|
|
1340
|
-
fontSize: "14px",
|
|
1341
|
-
color: "#6b7280",
|
|
1342
|
-
marginBottom: "8px"
|
|
1343
|
-
},
|
|
1344
|
-
planDescription: {
|
|
1345
|
-
fontSize: "12px",
|
|
1346
|
-
color: "#9ca3af",
|
|
1347
|
-
marginBottom: "12px"
|
|
1348
|
-
},
|
|
1349
|
-
currentBadge: {
|
|
1350
|
-
display: "inline-block",
|
|
1351
|
-
padding: "4px 8px",
|
|
1352
|
-
backgroundColor: "#3b82f6",
|
|
1353
|
-
color: "#fff",
|
|
1354
|
-
borderRadius: "4px",
|
|
1355
|
-
fontSize: "12px",
|
|
1356
|
-
fontWeight: 500
|
|
1357
|
-
},
|
|
1358
|
-
changePlanButton: {
|
|
1359
|
-
padding: "8px 16px",
|
|
1360
|
-
backgroundColor: "#f3f4f6",
|
|
1361
|
-
border: "1px solid #d1d5db",
|
|
1362
|
-
borderRadius: "6px",
|
|
1363
|
-
color: "#374151",
|
|
1364
|
-
cursor: "pointer",
|
|
1365
|
-
fontSize: "14px",
|
|
1366
|
-
width: "100%"
|
|
1367
|
-
},
|
|
1368
|
-
actions: {
|
|
1369
|
-
display: "flex",
|
|
1370
|
-
gap: "12px",
|
|
1371
|
-
justifyContent: "flex-end",
|
|
1372
|
-
paddingTop: "16px",
|
|
1373
|
-
borderTop: "1px solid #e5e7eb"
|
|
1374
|
-
},
|
|
1375
|
-
portalButton: {
|
|
1376
|
-
padding: "10px 20px",
|
|
1377
|
-
backgroundColor: "#3b82f6",
|
|
1378
|
-
border: "none",
|
|
1379
|
-
borderRadius: "6px",
|
|
1380
|
-
color: "#fff",
|
|
1381
|
-
cursor: "pointer",
|
|
1382
|
-
fontSize: "14px",
|
|
1383
|
-
fontWeight: 500
|
|
1384
|
-
},
|
|
1385
|
-
cancelSubscriptionButton: {
|
|
1386
|
-
padding: "10px 20px",
|
|
1387
|
-
backgroundColor: "#fff",
|
|
1388
|
-
border: "1px solid #ef4444",
|
|
1389
|
-
borderRadius: "6px",
|
|
1390
|
-
color: "#ef4444",
|
|
1391
|
-
cursor: "pointer",
|
|
1392
|
-
fontSize: "14px"
|
|
1393
|
-
}
|
|
1394
|
-
};
|
|
1395
|
-
function V(e, r) {
|
|
1396
|
-
return new Intl.NumberFormat("en-US", {
|
|
1397
|
-
style: "currency",
|
|
1398
|
-
currency: r.toUpperCase()
|
|
1399
|
-
}).format(e / 100);
|
|
1400
|
-
}
|
|
1401
|
-
function Be(e) {
|
|
1402
|
-
return new Date(e).toLocaleDateString("en-US", {
|
|
1403
|
-
year: "numeric",
|
|
1404
|
-
month: "long",
|
|
1405
|
-
day: "numeric"
|
|
1406
|
-
});
|
|
1407
|
-
}
|
|
1408
|
-
function tt(e) {
|
|
1409
|
-
switch (e) {
|
|
1410
|
-
case "active":
|
|
1411
|
-
return "#22c55e";
|
|
1412
|
-
case "trialing":
|
|
1413
|
-
return "#3b82f6";
|
|
1414
|
-
case "past_due":
|
|
1415
|
-
return "#f59e0b";
|
|
1416
|
-
case "canceled":
|
|
1417
|
-
case "expired":
|
|
1418
|
-
return "#ef4444";
|
|
1419
|
-
default:
|
|
1420
|
-
return "#6b7280";
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
function rt({
|
|
1424
|
-
preview: e,
|
|
1425
|
-
onConfirm: r,
|
|
1426
|
-
onCancel: t,
|
|
1427
|
-
isLoading: o
|
|
1428
|
-
}) {
|
|
1429
|
-
const f = e.immediateAmount < 0;
|
|
1430
|
-
return /* @__PURE__ */ w("div", { className: "cedros-proration-preview", style: g.prorationPreview, children: [
|
|
1431
|
-
/* @__PURE__ */ u("h4", { style: g.previewTitle, children: "Change Preview" }),
|
|
1432
|
-
/* @__PURE__ */ w("div", { style: g.previewDetails, children: [
|
|
1433
|
-
/* @__PURE__ */ w("div", { style: g.previewRow, children: [
|
|
1434
|
-
/* @__PURE__ */ u("span", { children: "Current plan:" }),
|
|
1435
|
-
/* @__PURE__ */ w("span", { children: [
|
|
1436
|
-
V(e.currentPlanPrice, e.currency),
|
|
1437
|
-
"/period"
|
|
1438
|
-
] })
|
|
1439
|
-
] }),
|
|
1440
|
-
/* @__PURE__ */ w("div", { style: g.previewRow, children: [
|
|
1441
|
-
/* @__PURE__ */ u("span", { children: "New plan:" }),
|
|
1442
|
-
/* @__PURE__ */ w("span", { children: [
|
|
1443
|
-
V(e.newPlanPrice, e.currency),
|
|
1444
|
-
"/period"
|
|
1445
|
-
] })
|
|
1446
|
-
] }),
|
|
1447
|
-
/* @__PURE__ */ w("div", { style: g.previewRow, children: [
|
|
1448
|
-
/* @__PURE__ */ u("span", { children: "Days remaining:" }),
|
|
1449
|
-
/* @__PURE__ */ w("span", { children: [
|
|
1450
|
-
e.daysRemaining,
|
|
1451
|
-
" days"
|
|
1452
|
-
] })
|
|
1453
|
-
] }),
|
|
1454
|
-
e.prorationDetails && /* @__PURE__ */ w(me, { children: [
|
|
1455
|
-
/* @__PURE__ */ w("div", { style: g.previewRow, children: [
|
|
1456
|
-
/* @__PURE__ */ u("span", { children: "Unused credit:" }),
|
|
1457
|
-
/* @__PURE__ */ w("span", { children: [
|
|
1458
|
-
"-",
|
|
1459
|
-
V(e.prorationDetails.unusedCredit, e.currency)
|
|
1460
|
-
] })
|
|
1461
|
-
] }),
|
|
1462
|
-
/* @__PURE__ */ w("div", { style: g.previewRow, children: [
|
|
1463
|
-
/* @__PURE__ */ u("span", { children: "New plan cost:" }),
|
|
1464
|
-
/* @__PURE__ */ u("span", { children: V(e.prorationDetails.newPlanCost, e.currency) })
|
|
1465
|
-
] })
|
|
1466
|
-
] }),
|
|
1467
|
-
/* @__PURE__ */ w("div", { style: { ...g.previewRow, ...g.previewTotal }, children: [
|
|
1468
|
-
/* @__PURE__ */ u("span", { children: f ? "Credit to account:" : "Amount due now:" }),
|
|
1469
|
-
/* @__PURE__ */ u("span", { style: { color: f ? "#22c55e" : "#ef4444" }, children: V(Math.abs(e.immediateAmount), e.currency) })
|
|
1470
|
-
] }),
|
|
1471
|
-
/* @__PURE__ */ w("div", { style: g.previewRow, children: [
|
|
1472
|
-
/* @__PURE__ */ u("span", { children: "Effective date:" }),
|
|
1473
|
-
/* @__PURE__ */ u("span", { children: Be(e.effectiveDate) })
|
|
1474
|
-
] })
|
|
1475
|
-
] }),
|
|
1476
|
-
/* @__PURE__ */ w("div", { style: g.previewActions, children: [
|
|
1477
|
-
/* @__PURE__ */ u("button", { onClick: t, style: g.cancelButton, disabled: o, children: "Cancel" }),
|
|
1478
|
-
/* @__PURE__ */ u("button", { onClick: r, style: g.confirmButton, disabled: o, children: o ? "Processing..." : "Confirm Change" })
|
|
1479
|
-
] })
|
|
1480
|
-
] });
|
|
1481
|
-
}
|
|
1482
|
-
function xt({
|
|
1483
|
-
resource: e,
|
|
1484
|
-
userId: r,
|
|
1485
|
-
availablePlans: t = [],
|
|
1486
|
-
onSubscriptionChanged: o,
|
|
1487
|
-
onSubscriptionCanceled: f,
|
|
1488
|
-
billingPortalReturnUrl: i,
|
|
1489
|
-
showBillingPortal: h = !1,
|
|
1490
|
-
className: x,
|
|
1491
|
-
style: m
|
|
1492
|
-
}) {
|
|
1493
|
-
const {
|
|
1494
|
-
subscription: l,
|
|
1495
|
-
changePreview: s,
|
|
1496
|
-
status: b,
|
|
1497
|
-
error: c,
|
|
1498
|
-
loadSubscription: d,
|
|
1499
|
-
previewChange: n,
|
|
1500
|
-
changeSubscription: a,
|
|
1501
|
-
cancelSubscription: p,
|
|
1502
|
-
openBillingPortal: C,
|
|
1503
|
-
clearPreview: P
|
|
1504
|
-
} = et();
|
|
1505
|
-
Y(() => {
|
|
1506
|
-
d(e, r);
|
|
1507
|
-
}, [e, r, d]);
|
|
1508
|
-
const y = T(
|
|
1509
|
-
async (v, k) => {
|
|
1510
|
-
await n(e, v, r, k);
|
|
1511
|
-
},
|
|
1512
|
-
[e, r, n]
|
|
1513
|
-
), B = T(async () => {
|
|
1514
|
-
if (!s) return;
|
|
1515
|
-
const v = t.find(
|
|
1516
|
-
(q) => q.price === s.newPlanPrice && q.currency === s.currency
|
|
1517
|
-
);
|
|
1518
|
-
(await a({
|
|
1519
|
-
newResource: v?.resource || e,
|
|
1520
|
-
newInterval: v?.interval,
|
|
1521
|
-
immediate: !0
|
|
1522
|
-
}))?.success && v && o?.(v.resource, v.interval);
|
|
1523
|
-
}, [s, t, e, a, o]), N = T(
|
|
1524
|
-
async (v) => {
|
|
1525
|
-
(await p(v))?.success && f?.();
|
|
1526
|
-
},
|
|
1527
|
-
[p, f]
|
|
1528
|
-
), E = T(() => {
|
|
1529
|
-
C(r, i);
|
|
1530
|
-
}, [r, i, C]), I = b === "loading";
|
|
1531
|
-
return /* @__PURE__ */ w("div", { className: `cedros-subscription-panel ${x || ""}`, style: { ...g.container, ...m }, children: [
|
|
1532
|
-
c && /* @__PURE__ */ u("div", { className: "cedros-subscription-error", style: g.error, children: c }),
|
|
1533
|
-
I && !l && /* @__PURE__ */ u("div", { className: "cedros-subscription-loading", style: g.loading, children: "Loading subscription..." }),
|
|
1534
|
-
l && /* @__PURE__ */ w(me, { children: [
|
|
1535
|
-
/* @__PURE__ */ w("div", { className: "cedros-subscription-details", style: g.details, children: [
|
|
1536
|
-
/* @__PURE__ */ u("h3", { style: g.title, children: "Current Subscription" }),
|
|
1537
|
-
/* @__PURE__ */ w("div", { style: g.detailRow, children: [
|
|
1538
|
-
/* @__PURE__ */ u("span", { style: g.label, children: "Plan:" }),
|
|
1539
|
-
/* @__PURE__ */ u("span", { style: g.value, children: l.resource })
|
|
1540
|
-
] }),
|
|
1541
|
-
/* @__PURE__ */ w("div", { style: g.detailRow, children: [
|
|
1542
|
-
/* @__PURE__ */ u("span", { style: g.label, children: "Status:" }),
|
|
1543
|
-
/* @__PURE__ */ u(
|
|
1544
|
-
"span",
|
|
1545
|
-
{
|
|
1546
|
-
style: {
|
|
1547
|
-
...g.statusBadge,
|
|
1548
|
-
backgroundColor: tt(l.status)
|
|
1549
|
-
},
|
|
1550
|
-
children: l.status
|
|
1551
|
-
}
|
|
1552
|
-
)
|
|
1553
|
-
] }),
|
|
1554
|
-
/* @__PURE__ */ w("div", { style: g.detailRow, children: [
|
|
1555
|
-
/* @__PURE__ */ u("span", { style: g.label, children: "Price:" }),
|
|
1556
|
-
/* @__PURE__ */ w("span", { style: g.value, children: [
|
|
1557
|
-
V(l.pricePerPeriod, l.currency),
|
|
1558
|
-
"/",
|
|
1559
|
-
l.interval
|
|
1560
|
-
] })
|
|
1561
|
-
] }),
|
|
1562
|
-
/* @__PURE__ */ w("div", { style: g.detailRow, children: [
|
|
1563
|
-
/* @__PURE__ */ u("span", { style: g.label, children: "Current period ends:" }),
|
|
1564
|
-
/* @__PURE__ */ u("span", { style: g.value, children: Be(l.currentPeriodEnd) })
|
|
1565
|
-
] }),
|
|
1566
|
-
l.cancelAtPeriodEnd && /* @__PURE__ */ u("div", { style: g.cancelNotice, children: "Subscription will cancel at end of current period" })
|
|
1567
|
-
] }),
|
|
1568
|
-
s && /* @__PURE__ */ u(
|
|
1569
|
-
rt,
|
|
1570
|
-
{
|
|
1571
|
-
preview: s,
|
|
1572
|
-
onConfirm: B,
|
|
1573
|
-
onCancel: P,
|
|
1574
|
-
isLoading: I
|
|
1575
|
-
}
|
|
1576
|
-
),
|
|
1577
|
-
t.length > 0 && !s && /* @__PURE__ */ w("div", { className: "cedros-available-plans", style: g.plansSection, children: [
|
|
1578
|
-
/* @__PURE__ */ u("h4", { style: g.plansTitle, children: "Available Plans" }),
|
|
1579
|
-
/* @__PURE__ */ u("div", { style: g.plansList, children: t.map((v) => {
|
|
1580
|
-
const k = v.resource === l.resource;
|
|
1581
|
-
return /* @__PURE__ */ w(
|
|
1582
|
-
"div",
|
|
1583
|
-
{
|
|
1584
|
-
style: {
|
|
1585
|
-
...g.planCard,
|
|
1586
|
-
...k ? g.currentPlan : {}
|
|
1587
|
-
},
|
|
1588
|
-
children: [
|
|
1589
|
-
/* @__PURE__ */ u("div", { style: g.planName, children: v.name }),
|
|
1590
|
-
/* @__PURE__ */ w("div", { style: g.planPrice, children: [
|
|
1591
|
-
V(v.price, v.currency),
|
|
1592
|
-
"/",
|
|
1593
|
-
v.interval
|
|
1594
|
-
] }),
|
|
1595
|
-
v.description && /* @__PURE__ */ u("div", { style: g.planDescription, children: v.description }),
|
|
1596
|
-
k ? /* @__PURE__ */ u("span", { style: g.currentBadge, children: "Current Plan" }) : /* @__PURE__ */ u(
|
|
1597
|
-
"button",
|
|
1598
|
-
{
|
|
1599
|
-
onClick: () => y(v.resource, v.interval),
|
|
1600
|
-
style: g.changePlanButton,
|
|
1601
|
-
disabled: I,
|
|
1602
|
-
children: v.price > l.pricePerPeriod ? "Upgrade" : "Downgrade"
|
|
1603
|
-
}
|
|
1604
|
-
)
|
|
1605
|
-
]
|
|
1606
|
-
},
|
|
1607
|
-
v.resource
|
|
1608
|
-
);
|
|
1609
|
-
}) })
|
|
1610
|
-
] }),
|
|
1611
|
-
/* @__PURE__ */ w("div", { className: "cedros-subscription-actions", style: g.actions, children: [
|
|
1612
|
-
h && l.paymentMethod === "stripe" && /* @__PURE__ */ u("button", { onClick: E, style: g.portalButton, disabled: I, children: "Manage Billing" }),
|
|
1613
|
-
l.status === "active" && !l.cancelAtPeriodEnd && /* @__PURE__ */ u(
|
|
1614
|
-
"button",
|
|
1615
|
-
{
|
|
1616
|
-
onClick: () => N(!1),
|
|
1617
|
-
style: g.cancelSubscriptionButton,
|
|
1618
|
-
disabled: I,
|
|
1619
|
-
children: "Cancel Subscription"
|
|
1620
|
-
}
|
|
1621
|
-
)
|
|
1622
|
-
] })
|
|
1623
|
-
] })
|
|
1624
|
-
] });
|
|
1625
|
-
}
|
|
1626
|
-
function Pt() {
|
|
1627
|
-
const { x402Manager: e, walletManager: r } = ee(), { publicKey: t, signTransaction: o } = ye(), [f, i] = U({
|
|
1628
|
-
status: "idle",
|
|
1629
|
-
error: null,
|
|
1630
|
-
transactionId: null
|
|
1631
|
-
}), [h, x] = U(null), [m, l] = U(null), s = T(
|
|
1632
|
-
async (n) => {
|
|
1633
|
-
try {
|
|
1634
|
-
i((p) => ({ ...p, status: "loading" }));
|
|
1635
|
-
const a = await e.requestQuote({ resource: n });
|
|
1636
|
-
if (!e.validateRequirement(a))
|
|
1637
|
-
throw new Error("Invalid refund requirement received from server");
|
|
1638
|
-
return x(a), i((p) => ({ ...p, status: "idle" })), a;
|
|
1639
|
-
} catch (a) {
|
|
1640
|
-
const p = Z(a, "Failed to fetch refund requirement");
|
|
1641
|
-
throw i({
|
|
1642
|
-
status: "error",
|
|
1643
|
-
error: p,
|
|
1644
|
-
transactionId: null
|
|
1645
|
-
}), a;
|
|
1646
|
-
}
|
|
1647
|
-
},
|
|
1648
|
-
[e]
|
|
1649
|
-
), b = T(
|
|
1650
|
-
async (n, a) => {
|
|
1651
|
-
if (!t || !o)
|
|
1652
|
-
throw new Error("Wallet not connected");
|
|
1653
|
-
try {
|
|
1654
|
-
i({
|
|
1655
|
-
status: "loading",
|
|
1656
|
-
error: null,
|
|
1657
|
-
transactionId: null
|
|
1658
|
-
});
|
|
1659
|
-
const p = await e.requestQuote({ resource: n, couponCode: a });
|
|
1660
|
-
if (!e.validateRequirement(p))
|
|
1661
|
-
throw new Error("Invalid refund requirement received");
|
|
1662
|
-
x(p);
|
|
1663
|
-
const C = await r.buildTransaction({
|
|
1664
|
-
requirement: p,
|
|
1665
|
-
payerPublicKey: t
|
|
1666
|
-
}), P = await r.signTransaction({
|
|
1667
|
-
transaction: C,
|
|
1668
|
-
signTransaction: o
|
|
1669
|
-
}), y = r.buildPaymentPayload({
|
|
1670
|
-
requirement: p,
|
|
1671
|
-
signedTx: P,
|
|
1672
|
-
payerPublicKey: t
|
|
1673
|
-
}), B = await e.submitPayment({
|
|
1674
|
-
resource: n,
|
|
1675
|
-
payload: y,
|
|
1676
|
-
couponCode: a,
|
|
1677
|
-
metadata: void 0,
|
|
1678
|
-
// no metadata for refunds
|
|
1679
|
-
resourceType: "refund"
|
|
1680
|
-
});
|
|
1681
|
-
return B.settlement && l(B.settlement), i({
|
|
1682
|
-
status: "success",
|
|
1683
|
-
error: null,
|
|
1684
|
-
transactionId: B.transactionId || P.signature
|
|
1685
|
-
}), B;
|
|
1686
|
-
} catch (p) {
|
|
1687
|
-
const C = Z(p, "Refund payment failed");
|
|
1688
|
-
throw i({
|
|
1689
|
-
status: "error",
|
|
1690
|
-
error: C,
|
|
1691
|
-
transactionId: null
|
|
1692
|
-
}), p;
|
|
1693
|
-
}
|
|
1694
|
-
},
|
|
1695
|
-
[t, o, e, r]
|
|
1696
|
-
), c = T(
|
|
1697
|
-
async (n) => {
|
|
1698
|
-
if (!t || !o)
|
|
1699
|
-
throw new Error("Wallet not connected");
|
|
1700
|
-
try {
|
|
1701
|
-
i({
|
|
1702
|
-
status: "loading",
|
|
1703
|
-
error: null,
|
|
1704
|
-
transactionId: null
|
|
1705
|
-
});
|
|
1706
|
-
const a = await e.requestQuote({ resource: n });
|
|
1707
|
-
if (!e.validateRequirement(a))
|
|
1708
|
-
throw new Error("Invalid refund requirement received");
|
|
1709
|
-
x(a);
|
|
1710
|
-
const { transaction: p } = await e.buildGaslessTransaction({
|
|
1711
|
-
resourceId: n,
|
|
1712
|
-
userWallet: t.toString(),
|
|
1713
|
-
feePayer: a.extra.feePayer
|
|
1714
|
-
}), C = r.deserializeTransaction(p), P = await r.partiallySignTransaction({
|
|
1715
|
-
transaction: C,
|
|
1716
|
-
signTransaction: o
|
|
1717
|
-
}), y = await e.submitGaslessTransaction({
|
|
1718
|
-
resource: n,
|
|
1719
|
-
partialTx: P,
|
|
1720
|
-
couponCode: void 0,
|
|
1721
|
-
// no couponCode
|
|
1722
|
-
metadata: void 0,
|
|
1723
|
-
// no metadata
|
|
1724
|
-
resourceType: "refund",
|
|
1725
|
-
requirement: a
|
|
1726
|
-
});
|
|
1727
|
-
return y.settlement && l(y.settlement), i({
|
|
1728
|
-
status: "success",
|
|
1729
|
-
error: null,
|
|
1730
|
-
transactionId: y.transactionId || "gasless-refund-tx"
|
|
1731
|
-
}), y;
|
|
1732
|
-
} catch (a) {
|
|
1733
|
-
const p = Z(a, "Gasless refund payment failed");
|
|
1734
|
-
throw i({
|
|
1735
|
-
status: "error",
|
|
1736
|
-
error: p,
|
|
1737
|
-
transactionId: null
|
|
1738
|
-
}), a;
|
|
1739
|
-
}
|
|
1740
|
-
},
|
|
1741
|
-
[t, o, e, r]
|
|
1742
|
-
), d = T(() => {
|
|
1743
|
-
i({
|
|
1744
|
-
status: "idle",
|
|
1745
|
-
error: null,
|
|
1746
|
-
transactionId: null
|
|
1747
|
-
}), x(null), l(null);
|
|
1748
|
-
}, []);
|
|
1749
|
-
return {
|
|
1750
|
-
state: f,
|
|
1751
|
-
requirement: h,
|
|
1752
|
-
settlement: m,
|
|
1753
|
-
fetchRefundQuote: s,
|
|
1754
|
-
processRefund: b,
|
|
1755
|
-
processGaslessRefund: c,
|
|
1756
|
-
reset: d
|
|
1757
|
-
};
|
|
1758
|
-
}
|
|
1759
|
-
function nt() {
|
|
1760
|
-
if (typeof window > "u")
|
|
1761
|
-
return {
|
|
1762
|
-
passed: !0,
|
|
1763
|
-
severity: "info",
|
|
1764
|
-
message: "HTTPS check skipped (SSR environment)"
|
|
1765
|
-
};
|
|
1766
|
-
const e = window.location.protocol === "https:", r = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
|
|
1767
|
-
return e || r ? {
|
|
1768
|
-
passed: !0,
|
|
1769
|
-
severity: "info",
|
|
1770
|
-
message: "HTTPS enforced"
|
|
1771
|
-
} : {
|
|
1772
|
-
passed: !1,
|
|
1773
|
-
severity: "error",
|
|
1774
|
-
message: "Page not served over HTTPS",
|
|
1775
|
-
recommendation: "Enable HTTPS for all payment pages. Stripe.js requires HTTPS in production."
|
|
1776
|
-
};
|
|
1777
|
-
}
|
|
1778
|
-
function st() {
|
|
1779
|
-
return typeof document > "u" ? {
|
|
1780
|
-
passed: !0,
|
|
1781
|
-
severity: "info",
|
|
1782
|
-
message: "CSP check skipped (SSR environment)"
|
|
1783
|
-
} : document.querySelector('meta[http-equiv="Content-Security-Policy"]') ? {
|
|
1784
|
-
passed: !0,
|
|
1785
|
-
severity: "info",
|
|
1786
|
-
message: "Content Security Policy detected"
|
|
1787
|
-
} : {
|
|
1788
|
-
passed: !1,
|
|
1789
|
-
severity: "warning",
|
|
1790
|
-
message: "No Content Security Policy detected",
|
|
1791
|
-
recommendation: "Configure CSP headers to protect against XSS and CDN compromise. Use generateCSP() helper from @cedros/pay-react."
|
|
1792
|
-
};
|
|
1793
|
-
}
|
|
1794
|
-
function ot() {
|
|
1795
|
-
return process.env.NODE_ENV === "development" || typeof window < "u" && window.location.hostname === "localhost" ? {
|
|
1796
|
-
passed: !0,
|
|
1797
|
-
severity: "info",
|
|
1798
|
-
message: "Running in development mode (some security checks relaxed)"
|
|
1799
|
-
} : {
|
|
1800
|
-
passed: !0,
|
|
1801
|
-
severity: "info",
|
|
1802
|
-
message: "Running in production mode"
|
|
1803
|
-
};
|
|
1804
|
-
}
|
|
1805
|
-
function at() {
|
|
1806
|
-
return {
|
|
1807
|
-
passed: !0,
|
|
1808
|
-
severity: "info",
|
|
1809
|
-
message: "Stripe.js loaded via @stripe/stripe-js package (CSP recommended, not SRI)",
|
|
1810
|
-
recommendation: "Ensure CSP script-src includes https://js.stripe.com"
|
|
1811
|
-
};
|
|
1812
|
-
}
|
|
1813
|
-
function it() {
|
|
1814
|
-
return typeof window > "u" ? {
|
|
1815
|
-
passed: !0,
|
|
1816
|
-
severity: "info",
|
|
1817
|
-
message: "Mixed content check skipped (SSR environment)"
|
|
1818
|
-
} : window.location.protocol === "https:" ? {
|
|
1819
|
-
passed: !0,
|
|
1820
|
-
severity: "info",
|
|
1821
|
-
message: "Mixed content protection active (HTTPS page)"
|
|
1822
|
-
} : {
|
|
1823
|
-
passed: !0,
|
|
1824
|
-
severity: "info",
|
|
1825
|
-
message: "Mixed content check skipped (HTTP page)"
|
|
1826
|
-
};
|
|
1827
|
-
}
|
|
1828
|
-
function kt() {
|
|
1829
|
-
const e = [
|
|
1830
|
-
nt(),
|
|
1831
|
-
st(),
|
|
1832
|
-
ot(),
|
|
1833
|
-
at(),
|
|
1834
|
-
it()
|
|
1835
|
-
], r = e.some((i) => i.severity === "error" && !i.passed), t = e.some((i) => i.severity === "warning" && !i.passed);
|
|
1836
|
-
let o, f;
|
|
1837
|
-
return r ? (o = "vulnerable", f = "Security issues detected. Review errors and apply recommendations.") : t ? (o = "warnings", f = "Minor security warnings detected. Consider applying recommendations.") : (o = "secure", f = "All security checks passed."), {
|
|
1838
|
-
checks: e,
|
|
1839
|
-
overallStatus: o,
|
|
1840
|
-
summary: f
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
|
-
function Tt(e) {
|
|
1844
|
-
process.env.NODE_ENV !== "production" && (console.group("🔒 Cedros Pay Security Report"), console.log(`Status: ${e.overallStatus.toUpperCase()}`), console.log(`Summary: ${e.summary}`), console.log(""), e.checks.forEach((r) => {
|
|
1845
|
-
const t = r.passed ? "✅" : r.severity === "error" ? "❌" : "⚠️";
|
|
1846
|
-
console.log(`${t} ${r.message}`), r.recommendation && console.log(` → ${r.recommendation}`);
|
|
1847
|
-
}), console.groupEnd());
|
|
1848
|
-
}
|
|
1849
|
-
const Et = {
|
|
1850
|
-
CSP: "Use generateCSP() from @cedros/pay-react to generate Content Security Policy headers",
|
|
1851
|
-
HTTPS: "Always serve payment pages over HTTPS in production",
|
|
1852
|
-
PACKAGE_UPDATES: "Keep @stripe/stripe-js and @cedros/pay-react updated for security patches",
|
|
1853
|
-
AUDIT: "Run npm audit regularly to check for known vulnerabilities",
|
|
1854
|
-
MONITORING: "Monitor Stripe security advisories and apply updates promptly",
|
|
1855
|
-
NO_SRI: "Do NOT use SRI hashes for Stripe.js - use CSP instead"
|
|
1856
|
-
};
|
|
1
|
+
import { q as i, a as n, b as c, g as u, f as C, d as l, p as m, s as S, e as P, h as d, c as E, t as p, o as R, m as g, n as y, r as b, k as T, j as B, u as L, i as f, l as _, v as h } from "./index-SV9PXby1.mjs";
|
|
2
|
+
import "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
import { n as v, C as M, m as I, l as A, L as D, b as O, R as W, o as x, W as z, k as N, d as U, c as V, p as j, g as G, r as Y, u as q, a as F, v as K } from "./CedrosContext-DUT3cLZg.mjs";
|
|
5
|
+
import "@solana/web3.js";
|
|
6
|
+
import "@solana/wallet-adapter-react";
|
|
7
|
+
import { C as w, r as H, l as J, E as Q, b as Z, P as $, a as aa, S as ea, d as sa, D as ta, z as ra, i as oa, g as ia, e as na, h as ca, t as ua, s as Ca, v as la, f as ma, B as Sa, F as Pa, k as da, j as Ea, A as pa, p as Ra, y as ga, x as ya, G as ba, c as Ta, u as Ba, n as La, m as fa } from "./styles-QcAsIVWl.mjs";
|
|
1857
8
|
export {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
9
|
+
w as CEDROS_EVENTS,
|
|
10
|
+
v as CIRCUIT_BREAKER_PRESETS,
|
|
11
|
+
i as CSP_PRESETS,
|
|
12
|
+
n as CedrosPay,
|
|
13
|
+
c as CedrosPayAdminDashboard,
|
|
14
|
+
M as CedrosProvider,
|
|
15
|
+
I as CircuitBreakerOpenError,
|
|
16
|
+
A as CircuitState,
|
|
17
|
+
H as CreditsButton,
|
|
18
|
+
u as CreditsSubscribeButton,
|
|
19
|
+
J as CryptoButton,
|
|
20
|
+
C as CryptoSubscribeButton,
|
|
21
|
+
Q as ERROR_CATEGORIES,
|
|
22
|
+
D as LogLevel,
|
|
23
|
+
O as Logger,
|
|
24
|
+
Z as PaymentMethodBadge,
|
|
25
|
+
$ as PaymentModal,
|
|
26
|
+
aa as ProductPrice,
|
|
27
|
+
l as PurchaseButton,
|
|
28
|
+
W as RATE_LIMITER_PRESETS,
|
|
29
|
+
x as RETRY_PRESETS,
|
|
30
|
+
m as RPC_PROVIDERS,
|
|
31
|
+
S as SECURITY_RECOMMENDATIONS,
|
|
32
|
+
ea as StripeButton,
|
|
33
|
+
P as SubscribeButton,
|
|
34
|
+
d as SubscriptionManagementPanel,
|
|
35
|
+
z as WalletPool,
|
|
36
|
+
sa as calculateDiscountPercentage,
|
|
37
|
+
E as cedrosPayPlugin,
|
|
38
|
+
N as createCircuitBreaker,
|
|
39
|
+
U as createLogger,
|
|
40
|
+
V as createRateLimiter,
|
|
41
|
+
ta as createTranslator,
|
|
42
|
+
j as createWalletPool,
|
|
43
|
+
ra as detectLocale,
|
|
44
|
+
p as ecommerce,
|
|
45
|
+
oa as emitPaymentError,
|
|
46
|
+
ia as emitPaymentProcessing,
|
|
47
|
+
na as emitPaymentStart,
|
|
48
|
+
ca as emitPaymentSuccess,
|
|
49
|
+
ua as emitWalletConnect,
|
|
50
|
+
Ca as emitWalletConnected,
|
|
51
|
+
la as emitWalletError,
|
|
52
|
+
R as formatCSP,
|
|
53
|
+
ma as formatCouponCodes,
|
|
54
|
+
g as generateCSP,
|
|
55
|
+
y as generateCSPDirectives,
|
|
56
|
+
Sa as getAvailableLocales,
|
|
57
|
+
Pa as getLocalizedError,
|
|
58
|
+
G as getLogger,
|
|
59
|
+
da as getUserErrorMessage,
|
|
60
|
+
Ea as isRetryableError,
|
|
61
|
+
pa as loadLocale,
|
|
62
|
+
b as logSecurityReport,
|
|
63
|
+
Ra as parseCouponCodes,
|
|
64
|
+
Y as retryWithBackoff,
|
|
65
|
+
ga as stackCheckoutCoupons,
|
|
66
|
+
q as useCedrosContext,
|
|
67
|
+
F as useCedrosTheme,
|
|
68
|
+
ya as useCreditsPayment,
|
|
69
|
+
T as useCreditsSubscription,
|
|
70
|
+
B as useCryptoSubscription,
|
|
71
|
+
ba as useLocalizedError,
|
|
72
|
+
Ta as usePaymentMode,
|
|
73
|
+
L as useRefundVerification,
|
|
74
|
+
Ba as useStripeCheckout,
|
|
75
|
+
f as useSubscription,
|
|
76
|
+
_ as useSubscriptionManagement,
|
|
77
|
+
La as useTranslation,
|
|
78
|
+
fa as useX402Payment,
|
|
79
|
+
K as validateConfig,
|
|
80
|
+
h as validateSecurity
|
|
1924
81
|
};
|