@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.
Files changed (372) hide show
  1. package/README.md +190 -38
  2. package/dist/{CedrosContext-CFEXGwQg.mjs → CedrosContext-DUT3cLZg.mjs} +683 -372
  3. package/dist/CedrosContext-efFL4kQz.js +11 -0
  4. package/dist/admin/index.d.ts +9 -0
  5. package/dist/admin/index.d.ts.map +1 -0
  6. package/dist/admin/plugin.d.ts +9 -0
  7. package/dist/admin/plugin.d.ts.map +1 -0
  8. package/dist/admin/types.d.ts +115 -0
  9. package/dist/admin/types.d.ts.map +1 -0
  10. package/dist/components/CedrosPay.d.ts.map +1 -1
  11. package/dist/components/CreditsButton.d.ts +42 -0
  12. package/dist/components/CreditsButton.d.ts.map +1 -0
  13. package/dist/components/CreditsSubscribeButton.d.ts +55 -0
  14. package/dist/components/CreditsSubscribeButton.d.ts.map +1 -0
  15. package/dist/components/CryptoButton.d.ts.map +1 -1
  16. package/dist/components/CryptoSubscribeButton.d.ts.map +1 -1
  17. package/dist/components/PaymentModal.d.ts +8 -2
  18. package/dist/components/PaymentModal.d.ts.map +1 -1
  19. package/dist/components/PurchaseButton.d.ts +14 -3
  20. package/dist/components/PurchaseButton.d.ts.map +1 -1
  21. package/dist/components/SubscriptionManagementPanel.d.ts.map +1 -1
  22. package/dist/components/admin/AISettingsSection.d.ts +3 -0
  23. package/dist/components/admin/AISettingsSection.d.ts.map +1 -0
  24. package/dist/components/admin/AdminAuthManager.d.ts +95 -0
  25. package/dist/components/admin/AdminAuthManager.d.ts.map +1 -0
  26. package/dist/components/admin/CedrosPayAdminDashboard.d.ts +40 -0
  27. package/dist/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -0
  28. package/dist/components/admin/ConfigEditor.d.ts +13 -0
  29. package/dist/components/admin/ConfigEditor.d.ts.map +1 -0
  30. package/dist/components/admin/CouponsSection.d.ts +3 -0
  31. package/dist/components/admin/CouponsSection.d.ts.map +1 -0
  32. package/dist/components/admin/Dropdown.d.ts +29 -0
  33. package/dist/components/admin/Dropdown.d.ts.map +1 -0
  34. package/dist/components/admin/FAQSection.d.ts +3 -0
  35. package/dist/components/admin/FAQSection.d.ts.map +1 -0
  36. package/dist/components/admin/MessagingSection.d.ts +10 -0
  37. package/dist/components/admin/MessagingSection.d.ts.map +1 -0
  38. package/dist/components/admin/OverviewSection.d.ts +3 -0
  39. package/dist/components/admin/OverviewSection.d.ts.map +1 -0
  40. package/dist/components/admin/PaymentSettingsSection.d.ts +3 -0
  41. package/dist/components/admin/PaymentSettingsSection.d.ts.map +1 -0
  42. package/dist/components/admin/ProductVariationsEditor.d.ts +14 -0
  43. package/dist/components/admin/ProductVariationsEditor.d.ts.map +1 -0
  44. package/dist/components/admin/ProductsSection.d.ts +3 -0
  45. package/dist/components/admin/ProductsSection.d.ts.map +1 -0
  46. package/dist/components/admin/RefundsSection.d.ts +3 -0
  47. package/dist/components/admin/RefundsSection.d.ts.map +1 -0
  48. package/dist/components/admin/SettingsSection.d.ts +10 -0
  49. package/dist/components/admin/SettingsSection.d.ts.map +1 -0
  50. package/dist/components/admin/SingleCategorySettings.d.ts +21 -0
  51. package/dist/components/admin/SingleCategorySettings.d.ts.map +1 -0
  52. package/dist/components/admin/StatsBar.d.ts +19 -0
  53. package/dist/components/admin/StatsBar.d.ts.map +1 -0
  54. package/dist/components/admin/StorefrontSection.d.ts +3 -0
  55. package/dist/components/admin/StorefrontSection.d.ts.map +1 -0
  56. package/dist/components/admin/SubscriptionsSection.d.ts +3 -0
  57. package/dist/components/admin/SubscriptionsSection.d.ts.map +1 -0
  58. package/dist/components/admin/TransactionsSection.d.ts +3 -0
  59. package/dist/components/admin/TransactionsSection.d.ts.map +1 -0
  60. package/dist/components/admin/VariantInventoryGrid.d.ts +19 -0
  61. package/dist/components/admin/VariantInventoryGrid.d.ts.map +1 -0
  62. package/dist/components/admin/VariationTypeEditor.d.ts +15 -0
  63. package/dist/components/admin/VariationTypeEditor.d.ts.map +1 -0
  64. package/dist/components/admin/configApi.d.ts +104 -0
  65. package/dist/components/admin/configApi.d.ts.map +1 -0
  66. package/dist/components/admin/icons.d.ts +50 -0
  67. package/dist/components/admin/icons.d.ts.map +1 -0
  68. package/dist/components/admin/index.d.ts +16 -0
  69. package/dist/components/admin/index.d.ts.map +1 -0
  70. package/dist/components/admin/sections-more.d.ts +12 -0
  71. package/dist/components/admin/sections-more.d.ts.map +1 -0
  72. package/dist/components/admin/sections.d.ts +12 -0
  73. package/dist/components/admin/sections.d.ts.map +1 -0
  74. package/dist/components/admin/types.d.ts +324 -0
  75. package/dist/components/admin/types.d.ts.map +1 -0
  76. package/dist/components/admin/useAdminAuth.d.ts +50 -0
  77. package/dist/components/admin/useAdminAuth.d.ts.map +1 -0
  78. package/dist/components/admin/useAutosave.d.ts +56 -0
  79. package/dist/components/admin/useAutosave.d.ts.map +1 -0
  80. package/dist/components/admin/useProductVariations.d.ts +56 -0
  81. package/dist/components/admin/useProductVariations.d.ts.map +1 -0
  82. package/dist/components/subscriptionPanelStyles.d.ts +2 -3
  83. package/dist/components/subscriptionPanelStyles.d.ts.map +1 -1
  84. package/dist/context/CedrosContext.d.ts +2 -0
  85. package/dist/context/CedrosContext.d.ts.map +1 -1
  86. package/dist/context/ThemeContext.d.ts +6 -0
  87. package/dist/context/ThemeContext.d.ts.map +1 -1
  88. package/dist/crypto-only.d.ts +1 -1
  89. package/dist/crypto-only.d.ts.map +1 -1
  90. package/dist/crypto-only.js +1 -1
  91. package/dist/crypto-only.mjs +16 -17
  92. package/dist/ecommerce/__tests__/cartCheckoutRequirements.test.d.ts +2 -0
  93. package/dist/ecommerce/__tests__/cartCheckoutRequirements.test.d.ts.map +1 -0
  94. package/dist/ecommerce/__tests__/cartProviderPersistence.test.d.ts +2 -0
  95. package/dist/ecommerce/__tests__/cartProviderPersistence.test.d.ts.map +1 -0
  96. package/dist/ecommerce/__tests__/cartReducer.test.d.ts +2 -0
  97. package/dist/ecommerce/__tests__/cartReducer.test.d.ts.map +1 -0
  98. package/dist/ecommerce/__tests__/cartServerMerge.test.d.ts +2 -0
  99. package/dist/ecommerce/__tests__/cartServerMerge.test.d.ts.map +1 -0
  100. package/dist/ecommerce/__tests__/checkoutPaymentMethods.test.d.ts +2 -0
  101. package/dist/ecommerce/__tests__/checkoutPaymentMethods.test.d.ts.map +1 -0
  102. package/dist/ecommerce/__tests__/checkoutReturn.test.d.ts +2 -0
  103. package/dist/ecommerce/__tests__/checkoutReturn.test.d.ts.map +1 -0
  104. package/dist/ecommerce/__tests__/checkoutSchema.test.d.ts +2 -0
  105. package/dist/ecommerce/__tests__/checkoutSchema.test.d.ts.map +1 -0
  106. package/dist/ecommerce/__tests__/mockAdapter.test.d.ts +2 -0
  107. package/dist/ecommerce/__tests__/mockAdapter.test.d.ts.map +1 -0
  108. package/dist/ecommerce/adapters/CommerceAdapter.d.ts +235 -0
  109. package/dist/ecommerce/adapters/CommerceAdapter.d.ts.map +1 -0
  110. package/dist/ecommerce/adapters/mock/mockAdapter.d.ts +3 -0
  111. package/dist/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -0
  112. package/dist/ecommerce/adapters/paywall/paywallAdapter.d.ts +6 -0
  113. package/dist/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -0
  114. package/dist/ecommerce/components/cart/CartLineItem.d.ts +12 -0
  115. package/dist/ecommerce/components/cart/CartLineItem.d.ts.map +1 -0
  116. package/dist/ecommerce/components/cart/CartPageContent.d.ts +6 -0
  117. package/dist/ecommerce/components/cart/CartPageContent.d.ts.map +1 -0
  118. package/dist/ecommerce/components/cart/CartPanel.d.ts +5 -0
  119. package/dist/ecommerce/components/cart/CartPanel.d.ts.map +1 -0
  120. package/dist/ecommerce/components/cart/CartSidebar.d.ts +11 -0
  121. package/dist/ecommerce/components/cart/CartSidebar.d.ts.map +1 -0
  122. package/dist/ecommerce/components/cart/CartSummary.d.ts +13 -0
  123. package/dist/ecommerce/components/cart/CartSummary.d.ts.map +1 -0
  124. package/dist/ecommerce/components/cart/PromoCodeInput.d.ts +6 -0
  125. package/dist/ecommerce/components/cart/PromoCodeInput.d.ts.map +1 -0
  126. package/dist/ecommerce/components/catalog/Breadcrumbs.d.ts +9 -0
  127. package/dist/ecommerce/components/catalog/Breadcrumbs.d.ts.map +1 -0
  128. package/dist/ecommerce/components/catalog/CategoryNav.d.ts +8 -0
  129. package/dist/ecommerce/components/catalog/CategoryNav.d.ts.map +1 -0
  130. package/dist/ecommerce/components/catalog/FilterPanel.d.ts +29 -0
  131. package/dist/ecommerce/components/catalog/FilterPanel.d.ts.map +1 -0
  132. package/dist/ecommerce/components/catalog/Price.d.ts +9 -0
  133. package/dist/ecommerce/components/catalog/Price.d.ts.map +1 -0
  134. package/dist/ecommerce/components/catalog/ProductCard.d.ts +14 -0
  135. package/dist/ecommerce/components/catalog/ProductCard.d.ts.map +1 -0
  136. package/dist/ecommerce/components/catalog/ProductGallery.d.ts +6 -0
  137. package/dist/ecommerce/components/catalog/ProductGallery.d.ts.map +1 -0
  138. package/dist/ecommerce/components/catalog/ProductGrid.d.ts +20 -0
  139. package/dist/ecommerce/components/catalog/ProductGrid.d.ts.map +1 -0
  140. package/dist/ecommerce/components/catalog/QuantitySelector.d.ts +8 -0
  141. package/dist/ecommerce/components/catalog/QuantitySelector.d.ts.map +1 -0
  142. package/dist/ecommerce/components/catalog/QuickViewDialog.d.ts +10 -0
  143. package/dist/ecommerce/components/catalog/QuickViewDialog.d.ts.map +1 -0
  144. package/dist/ecommerce/components/catalog/SearchInput.d.ts +7 -0
  145. package/dist/ecommerce/components/catalog/SearchInput.d.ts.map +1 -0
  146. package/dist/ecommerce/components/catalog/VariantSelector.d.ts +19 -0
  147. package/dist/ecommerce/components/catalog/VariantSelector.d.ts.map +1 -0
  148. package/dist/ecommerce/components/chat/ShopChatPanel.d.ts +4 -0
  149. package/dist/ecommerce/components/chat/ShopChatPanel.d.ts.map +1 -0
  150. package/dist/ecommerce/components/checkout/AddressForm.d.ts +9 -0
  151. package/dist/ecommerce/components/checkout/AddressForm.d.ts.map +1 -0
  152. package/dist/ecommerce/components/checkout/CheckoutCancelPage.d.ts +24 -0
  153. package/dist/ecommerce/components/checkout/CheckoutCancelPage.d.ts.map +1 -0
  154. package/dist/ecommerce/components/checkout/CheckoutForm.d.ts +4 -0
  155. package/dist/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -0
  156. package/dist/ecommerce/components/checkout/CheckoutLayout.d.ts +6 -0
  157. package/dist/ecommerce/components/checkout/CheckoutLayout.d.ts.map +1 -0
  158. package/dist/ecommerce/components/checkout/CheckoutReceipt.d.ts +8 -0
  159. package/dist/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -0
  160. package/dist/ecommerce/components/checkout/CheckoutSuccessPage.d.ts +29 -0
  161. package/dist/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -0
  162. package/dist/ecommerce/components/checkout/InventoryVerificationDialog.d.ts +19 -0
  163. package/dist/ecommerce/components/checkout/InventoryVerificationDialog.d.ts.map +1 -0
  164. package/dist/ecommerce/components/checkout/OrderReview.d.ts +4 -0
  165. package/dist/ecommerce/components/checkout/OrderReview.d.ts.map +1 -0
  166. package/dist/ecommerce/components/checkout/PaymentStep.d.ts +15 -0
  167. package/dist/ecommerce/components/checkout/PaymentStep.d.ts.map +1 -0
  168. package/dist/ecommerce/components/checkout/ShippingMethodSelector.d.ts +9 -0
  169. package/dist/ecommerce/components/checkout/ShippingMethodSelector.d.ts.map +1 -0
  170. package/dist/ecommerce/components/faq/FAQItem.d.ts +29 -0
  171. package/dist/ecommerce/components/faq/FAQItem.d.ts.map +1 -0
  172. package/dist/ecommerce/components/faq/FAQItem.test.d.ts +7 -0
  173. package/dist/ecommerce/components/faq/FAQItem.test.d.ts.map +1 -0
  174. package/dist/ecommerce/components/faq/FAQList.d.ts +15 -0
  175. package/dist/ecommerce/components/faq/FAQList.d.ts.map +1 -0
  176. package/dist/ecommerce/components/faq/index.d.ts +3 -0
  177. package/dist/ecommerce/components/faq/index.d.ts.map +1 -0
  178. package/dist/ecommerce/components/general/EmptyState.d.ts +8 -0
  179. package/dist/ecommerce/components/general/EmptyState.d.ts.map +1 -0
  180. package/dist/ecommerce/components/general/ErrorBoundary.d.ts +16 -0
  181. package/dist/ecommerce/components/general/ErrorBoundary.d.ts.map +1 -0
  182. package/dist/ecommerce/components/general/ErrorState.d.ts +7 -0
  183. package/dist/ecommerce/components/general/ErrorState.d.ts.map +1 -0
  184. package/dist/ecommerce/components/general/toast.d.ts +19 -0
  185. package/dist/ecommerce/components/general/toast.d.ts.map +1 -0
  186. package/dist/ecommerce/components/orders/OrderCard.d.ts +7 -0
  187. package/dist/ecommerce/components/orders/OrderCard.d.ts.map +1 -0
  188. package/dist/ecommerce/components/orders/OrderDetails.d.ts +7 -0
  189. package/dist/ecommerce/components/orders/OrderDetails.d.ts.map +1 -0
  190. package/dist/ecommerce/components/orders/OrderList.d.ts +7 -0
  191. package/dist/ecommerce/components/orders/OrderList.d.ts.map +1 -0
  192. package/dist/ecommerce/components/ui/accordion.d.ts +7 -0
  193. package/dist/ecommerce/components/ui/accordion.d.ts.map +1 -0
  194. package/dist/ecommerce/components/ui/badge.d.ts +10 -0
  195. package/dist/ecommerce/components/ui/badge.d.ts.map +1 -0
  196. package/dist/ecommerce/components/ui/button.d.ts +12 -0
  197. package/dist/ecommerce/components/ui/button.d.ts.map +1 -0
  198. package/dist/ecommerce/components/ui/card.d.ts +8 -0
  199. package/dist/ecommerce/components/ui/card.d.ts.map +1 -0
  200. package/dist/ecommerce/components/ui/dialog.d.ts +13 -0
  201. package/dist/ecommerce/components/ui/dialog.d.ts.map +1 -0
  202. package/dist/ecommerce/components/ui/input.d.ts +5 -0
  203. package/dist/ecommerce/components/ui/input.d.ts.map +1 -0
  204. package/dist/ecommerce/components/ui/label.d.ts +3 -0
  205. package/dist/ecommerce/components/ui/label.d.ts.map +1 -0
  206. package/dist/ecommerce/components/ui/select.d.ts +9 -0
  207. package/dist/ecommerce/components/ui/select.d.ts.map +1 -0
  208. package/dist/ecommerce/components/ui/separator.d.ts +4 -0
  209. package/dist/ecommerce/components/ui/separator.d.ts.map +1 -0
  210. package/dist/ecommerce/components/ui/sheet.d.ts +21 -0
  211. package/dist/ecommerce/components/ui/sheet.d.ts.map +1 -0
  212. package/dist/ecommerce/components/ui/skeleton.d.ts +3 -0
  213. package/dist/ecommerce/components/ui/skeleton.d.ts.map +1 -0
  214. package/dist/ecommerce/components/ui/tabs.d.ts +7 -0
  215. package/dist/ecommerce/components/ui/tabs.d.ts.map +1 -0
  216. package/dist/ecommerce/components/ui/textarea.d.ts +5 -0
  217. package/dist/ecommerce/components/ui/textarea.d.ts.map +1 -0
  218. package/dist/ecommerce/config/context.d.ts +13 -0
  219. package/dist/ecommerce/config/context.d.ts.map +1 -0
  220. package/dist/ecommerce/config/types.d.ts +48 -0
  221. package/dist/ecommerce/config/types.d.ts.map +1 -0
  222. package/dist/ecommerce/hooks/checkoutReturn.d.ts +3 -0
  223. package/dist/ecommerce/hooks/checkoutReturn.d.ts.map +1 -0
  224. package/dist/ecommerce/hooks/useAIRelatedProducts.d.ts +33 -0
  225. package/dist/ecommerce/hooks/useAIRelatedProducts.d.ts.map +1 -0
  226. package/dist/ecommerce/hooks/useCartInventory.d.ts +42 -0
  227. package/dist/ecommerce/hooks/useCartInventory.d.ts.map +1 -0
  228. package/dist/ecommerce/hooks/useCatalogUrlState.d.ts +15 -0
  229. package/dist/ecommerce/hooks/useCatalogUrlState.d.ts.map +1 -0
  230. package/dist/ecommerce/hooks/useCategories.d.ts +7 -0
  231. package/dist/ecommerce/hooks/useCategories.d.ts.map +1 -0
  232. package/dist/ecommerce/hooks/useCheckoutResultFromUrl.d.ts +4 -0
  233. package/dist/ecommerce/hooks/useCheckoutResultFromUrl.d.ts.map +1 -0
  234. package/dist/ecommerce/hooks/useHoldExpiry.d.ts +34 -0
  235. package/dist/ecommerce/hooks/useHoldExpiry.d.ts.map +1 -0
  236. package/dist/ecommerce/hooks/useInventoryVerification.d.ts +41 -0
  237. package/dist/ecommerce/hooks/useInventoryVerification.d.ts.map +1 -0
  238. package/dist/ecommerce/hooks/useOrders.d.ts +7 -0
  239. package/dist/ecommerce/hooks/useOrders.d.ts.map +1 -0
  240. package/dist/ecommerce/hooks/usePaymentMethodsConfig.d.ts +6 -0
  241. package/dist/ecommerce/hooks/usePaymentMethodsConfig.d.ts.map +1 -0
  242. package/dist/ecommerce/hooks/useProduct.d.ts +7 -0
  243. package/dist/ecommerce/hooks/useProduct.d.ts.map +1 -0
  244. package/dist/ecommerce/hooks/useProducts.d.ts +8 -0
  245. package/dist/ecommerce/hooks/useProducts.d.ts.map +1 -0
  246. package/dist/ecommerce/hooks/useShippingMethods.d.ts +10 -0
  247. package/dist/ecommerce/hooks/useShippingMethods.d.ts.map +1 -0
  248. package/dist/ecommerce/hooks/useStorefrontSettings.d.ts +32 -0
  249. package/dist/ecommerce/hooks/useStorefrontSettings.d.ts.map +1 -0
  250. package/dist/ecommerce/hooks/useSubscriptionData.d.ts +8 -0
  251. package/dist/ecommerce/hooks/useSubscriptionData.d.ts.map +1 -0
  252. package/dist/ecommerce/index.d.ts +98 -0
  253. package/dist/ecommerce/index.d.ts.map +1 -0
  254. package/dist/ecommerce/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts +10 -0
  255. package/dist/ecommerce/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts.map +1 -0
  256. package/dist/ecommerce/state/cart/CartProvider.d.ts +27 -0
  257. package/dist/ecommerce/state/cart/CartProvider.d.ts.map +1 -0
  258. package/dist/ecommerce/state/cart/cartReducer.d.ts +35 -0
  259. package/dist/ecommerce/state/cart/cartReducer.d.ts.map +1 -0
  260. package/dist/ecommerce/state/checkout/checkoutSchema.d.ts +21 -0
  261. package/dist/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -0
  262. package/dist/ecommerce/state/checkout/useCheckout.d.ts +34 -0
  263. package/dist/ecommerce/state/checkout/useCheckout.d.ts.map +1 -0
  264. package/dist/ecommerce/templates/CartTemplate.d.ts +5 -0
  265. package/dist/ecommerce/templates/CartTemplate.d.ts.map +1 -0
  266. package/dist/ecommerce/templates/CategoryTemplate.d.ts +11 -0
  267. package/dist/ecommerce/templates/CategoryTemplate.d.ts.map +1 -0
  268. package/dist/ecommerce/templates/CheckoutTemplate.d.ts +9 -0
  269. package/dist/ecommerce/templates/CheckoutTemplate.d.ts.map +1 -0
  270. package/dist/ecommerce/templates/ProductTemplate.d.ts +11 -0
  271. package/dist/ecommerce/templates/ProductTemplate.d.ts.map +1 -0
  272. package/dist/ecommerce/templates/PurchaseHistoryTemplate.d.ts +6 -0
  273. package/dist/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -0
  274. package/dist/ecommerce/templates/ReceiptTemplate.d.ts +19 -0
  275. package/dist/ecommerce/templates/ReceiptTemplate.d.ts.map +1 -0
  276. package/dist/ecommerce/templates/ShopTemplate.d.ts +15 -0
  277. package/dist/ecommerce/templates/ShopTemplate.d.ts.map +1 -0
  278. package/dist/ecommerce/templates/SubscriptionTemplate.d.ts +15 -0
  279. package/dist/ecommerce/templates/SubscriptionTemplate.d.ts.map +1 -0
  280. package/dist/ecommerce/testing/adapterContract.d.ts +11 -0
  281. package/dist/ecommerce/testing/adapterContract.d.ts.map +1 -0
  282. package/dist/ecommerce/types.d.ts +164 -0
  283. package/dist/ecommerce/types.d.ts.map +1 -0
  284. package/dist/ecommerce/utils/cartCheckoutRequirements.d.ts +18 -0
  285. package/dist/ecommerce/utils/cartCheckoutRequirements.d.ts.map +1 -0
  286. package/dist/ecommerce/utils/cartItemMetadata.d.ts +3 -0
  287. package/dist/ecommerce/utils/cartItemMetadata.d.ts.map +1 -0
  288. package/dist/ecommerce/utils/cn.d.ts +3 -0
  289. package/dist/ecommerce/utils/cn.d.ts.map +1 -0
  290. package/dist/ecommerce/utils/money.d.ts +6 -0
  291. package/dist/ecommerce/utils/money.d.ts.map +1 -0
  292. package/dist/ecommerce/utils/storage.d.ts +5 -0
  293. package/dist/ecommerce/utils/storage.d.ts.map +1 -0
  294. package/dist/en-BXheDBal.mjs +19 -0
  295. package/dist/en-Yikrt96u.js +1 -0
  296. package/dist/hooks/useCreditsPayment.d.ts +64 -0
  297. package/dist/hooks/useCreditsPayment.d.ts.map +1 -0
  298. package/dist/hooks/useCreditsSubscription.d.ts +42 -0
  299. package/dist/hooks/useCreditsSubscription.d.ts.map +1 -0
  300. package/dist/hooks/usePaymentMode.d.ts.map +1 -1
  301. package/dist/hooks/useStripeCheckout.d.ts +1 -0
  302. package/dist/hooks/useStripeCheckout.d.ts.map +1 -1
  303. package/dist/hooks/useSubscriptionManagement.d.ts +4 -0
  304. package/dist/hooks/useSubscriptionManagement.d.ts.map +1 -1
  305. package/dist/hooks/useX402Payment.d.ts +1 -0
  306. package/dist/hooks/useX402Payment.d.ts.map +1 -1
  307. package/dist/index-DPl2S6i0.js +136 -0
  308. package/dist/index-SV9PXby1.mjs +26838 -0
  309. package/dist/index.d.ts +10 -2
  310. package/dist/index.d.ts.map +1 -1
  311. package/dist/index.js +1 -1
  312. package/dist/index.mjs +79 -1922
  313. package/dist/magic-string.es-B81Zo59j.js +10 -0
  314. package/dist/magic-string.es-uPKorP4O.mjs +663 -0
  315. package/dist/managers/CreditsManager.d.ts +151 -0
  316. package/dist/managers/CreditsManager.d.ts.map +1 -0
  317. package/dist/managers/ManagerCache.d.ts +2 -0
  318. package/dist/managers/ManagerCache.d.ts.map +1 -1
  319. package/dist/managers/RouteDiscoveryManager.d.ts.map +1 -1
  320. package/dist/managers/StripeManager.d.ts.map +1 -1
  321. package/dist/managers/X402Manager.d.ts.map +1 -1
  322. package/dist/pay-react.css +1 -1
  323. package/dist/sections-BsFQxfHN.mjs +10 -0
  324. package/dist/sections-CTqBNAKW.js +1 -0
  325. package/dist/stripe-only.d.ts +1 -1
  326. package/dist/stripe-only.d.ts.map +1 -1
  327. package/dist/stripe-only.js +1 -1
  328. package/dist/stripe-only.mjs +12 -13
  329. package/dist/styles-C4-_hbgr.js +1 -0
  330. package/dist/styles-QcAsIVWl.mjs +1909 -0
  331. package/dist/telemetry.js +1 -1
  332. package/dist/telemetry.mjs +1 -1
  333. package/dist/testing/index.js +147 -1
  334. package/dist/testing/index.mjs +10555 -103
  335. package/dist/types/componentOptions.d.ts +14 -4
  336. package/dist/types/componentOptions.d.ts.map +1 -1
  337. package/dist/types/errors.d.ts +26 -4
  338. package/dist/types/errors.d.ts.map +1 -1
  339. package/dist/types/index.d.ts +115 -0
  340. package/dist/types/index.d.ts.map +1 -1
  341. package/dist/utils/cartHelpers.d.ts +3 -0
  342. package/dist/utils/cartHelpers.d.ts.map +1 -1
  343. package/dist/utils/cspHelper.d.ts +7 -1
  344. package/dist/utils/cspHelper.d.ts.map +1 -1
  345. package/dist/utils/csvHelpers.d.ts +62 -0
  346. package/dist/utils/csvHelpers.d.ts.map +1 -0
  347. package/dist/utils/csvHelpers.test.d.ts +2 -0
  348. package/dist/utils/csvHelpers.test.d.ts.map +1 -0
  349. package/dist/utils/dateHelpers.d.ts +24 -0
  350. package/dist/utils/dateHelpers.d.ts.map +1 -0
  351. package/dist/utils/eventEmitter.d.ts +1 -1
  352. package/dist/utils/eventEmitter.d.ts.map +1 -1
  353. package/dist/utils/fetchWithTimeout.d.ts +3 -3
  354. package/dist/utils/index.d.ts +2 -1
  355. package/dist/utils/index.d.ts.map +1 -1
  356. package/dist/utils/tokenMintValidator.d.ts +10 -6
  357. package/dist/utils/tokenMintValidator.d.ts.map +1 -1
  358. package/dist/utils/uuid.d.ts.map +1 -1
  359. package/dist/uuid-C5B8o31X.js +1 -0
  360. package/dist/uuid-_z3jSatJ.mjs +17 -0
  361. package/package.json +25 -9
  362. package/dist/CedrosContext-DbndTsTA.js +0 -11
  363. package/dist/en-C739WV_-.mjs +0 -19
  364. package/dist/en-Cz4OpvN-.js +0 -1
  365. package/dist/styles-DFcRS8Uu.mjs +0 -1626
  366. package/dist/styles-Dup9uK6S.js +0 -1
  367. package/dist/utils/uuid-shim.d.ts +0 -9
  368. package/dist/utils/uuid-shim.d.ts.map +0 -1
  369. package/dist/uuid-C0iMjdcc.js +0 -1
  370. package/dist/uuid-UlzrVY8Y.mjs +0 -17
  371. package/dist/walletDetection-JZR3UCOa.mjs +0 -27
  372. package/dist/walletDetection-bNmV5ItZ.js +0 -1
@@ -0,0 +1,11 @@
1
+ "use strict";var He=Object.create;var oe=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var Ge=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var Ye=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ve(e))!Je.call(r,a)&&a!==t&&oe(r,a,{get:()=>e[a],enumerable:!(n=Ke(e,a))||n.enumerable});return r};var se=(r,e,t)=>(t=r!=null?He(Ge(r)):{},Ye(e||!r||!r.__esModule?oe(t,"default",{value:r,enumerable:!0}):t,r));const Z=require("react/jsx-runtime"),E=require("react"),R=require("./uuid-C5B8o31X.js"),k=require("@solana/web3.js"),ce=require("@solana/spl-token"),le=require("@solana/wallet-adapter-wallets");var me="https://js.stripe.com/v3",Xe=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var Ze=function(){for(var e=document.querySelectorAll('script[src^="'.concat(me,'"]')),t=0;t<e.length;t++){var n=e[t];if(Xe.test(n.src))return n}return null},ue=function(e){var t="",n=document.createElement("script");n.src="".concat(me).concat(t);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(n),n},_e=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"4.6.0",startTime:t})},L=null,Q=null,W=null,$e=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},et=function(e,t){return function(){window.Stripe?e(window.Stripe):t(new Error("Stripe.js not available"))}},tt=function(e){return L!==null?L:(L=new Promise(function(t,n){if(typeof window>"u"||typeof document>"u"){t(null);return}if(window.Stripe){t(window.Stripe);return}try{var a=Ze();if(!(a&&e)){if(!a)a=ue(e);else if(a&&W!==null&&Q!==null){var i;a.removeEventListener("load",W),a.removeEventListener("error",Q),(i=a.parentNode)===null||i===void 0||i.removeChild(a),a=ue(e)}}W=et(t,n),Q=$e(n),a.addEventListener("load",W),a.addEventListener("error",Q)}catch(o){n(o);return}}),L.catch(function(t){return L=null,Promise.reject(t)}))},rt=function(e,t,n){if(e===null)return null;var a=e.apply(void 0,t);return _e(a,n),a},F,ge=!1,be=function(){return F||(F=tt(null).catch(function(e){return F=null,Promise.reject(e)}),F)};Promise.resolve().then(function(){return be()}).catch(function(r){ge||console.warn(r)});var ve=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];ge=!0;var a=Date.now();return be().then(function(i){return rt(i,t,a)})},Ee=(r=>(r[r.DEBUG=0]="DEBUG",r[r.INFO=1]="INFO",r[r.WARN=2]="WARN",r[r.ERROR=3]="ERROR",r[r.SILENT=4]="SILENT",r))(Ee||{});class te{config;constructor(e){this.config=e}setLevel(e){this.config.level=e}getLevel(){return this.config.level}debug(...e){this.config.level<=0&&this.log("DEBUG",console.log,e)}info(...e){this.config.level<=1&&this.log("INFO",console.info,e)}warn(...e){this.config.level<=2&&this.log("WARN",console.warn,e)}error(...e){this.config.level<=3&&this.log("ERROR",console.error,e)}log(e,t,n){const a=this.config.prefix?`${this.config.prefix} `:"",i=new Date().toISOString();t(`[${i}] ${a}[${e}]`,...n)}}const nt=()=>typeof process<"u"&&process.env.NODE_ENV==="development"?0:2;let K=null;function c(){return K||(K=new te({level:nt(),prefix:"[CedrosPay]"})),K}function at(r){K=r}function Ce(r){return new te(r)}function M(r,e){return r instanceof Error?r.message:typeof r=="string"?r:e}const it={service_unavailable:"Service temporarily unavailable. Please try again later or contact support.",server_insufficient_funds:"Service temporarily unavailable. Please try again later or contact support.",insufficient_funds_token:"Insufficient token balance in your wallet. Please add more tokens and try again.",insufficient_funds_sol:"Insufficient SOL for transaction fees. Please add some SOL to your wallet and try again.",insufficient_amount:"Payment amount is insufficient. Please check the required amount.",invalid_signature:"Transaction signature is invalid. Please try again.",send_failed:"Failed to send transaction. Please try again or contact support.",timeout:"Transaction timed out. Please check the blockchain explorer or try again."};async function v(r,e,t=!1){try{const n=await r.json();if(t&&n.verificationError){c().debug(`Payment verification failed: ${n.verificationError.code}`);const a=n.verificationError.code;return it[a]||n.verificationError.message||e}return typeof n.error=="string"?n.error:n.error&&typeof n.error=="object"&&"message"in n.error?n.error.message:e}catch{return await r.text()||e}}const ot=15e3;async function y(r,e={},t=ot){const n=new AbortController,a=e.signal;if(a?.aborted)throw n.abort(),new DOMException("The operation was aborted","AbortError");const i=setTimeout(()=>n.abort(),t);let o=null;a&&(o=()=>n.abort(),a.addEventListener("abort",o));try{return await fetch(r,{...e,signal:n.signal})}catch(s){throw s instanceof Error&&s.name==="AbortError"?a?.aborted?s:new Error(`Request timeout after ${t}ms`):s}finally{clearTimeout(i),a&&o&&a.removeEventListener("abort",o)}}function U(r){const{maxRequests:e,windowMs:t}=r;let n=e,a=Date.now();const i=e/t;function o(){const f=Date.now(),A=f-a;if(A>0){const h=A*i;n=Math.min(e,n+h),a=f}}function s(){return o(),n>=1?(n-=1,!0):!1}function u(){return o(),Math.floor(n)}function l(){if(o(),n>=1)return 0;const A=(1-n)/i;return Math.ceil(A)}function d(){n=e,a=Date.now()}return{tryConsume:s,getAvailableTokens:u,getTimeUntilRefill:l,reset:d}}const D={PAYMENT:{maxRequests:10,windowMs:6e4},QUOTE:{maxRequests:30,windowMs:6e4},STRICT:{maxRequests:5,windowMs:6e4},PERMISSIVE:{maxRequests:100,windowMs:6e4}};var Se=(r=>(r.CLOSED="CLOSED",r.OPEN="OPEN",r.HALF_OPEN="HALF_OPEN",r))(Se||{});class w extends Error{constructor(e){super(e),this.name="CircuitBreakerOpenError"}}function B(r){const{failureThreshold:e,timeout:t,name:n="circuit-breaker"}=r;let a="CLOSED",i=0,o=0,s=0,u=null,l=null,d=null;function f(){a==="OPEN"&&d!==null&&Date.now()>=d&&(c().debug(`[CircuitBreaker:${n}] Transitioning OPEN → HALF_OPEN (timeout expired)`),a="HALF_OPEN",d=null)}function A(){l=Date.now(),o++,a==="HALF_OPEN"?(c().debug(`[CircuitBreaker:${n}] Success in HALF_OPEN → CLOSED`),a="CLOSED",i=0):a==="CLOSED"&&(i=0)}function h(P){u=Date.now(),i++,c().warn(`[CircuitBreaker:${n}] Failure recorded (${i}/${e}):`,P.message),a==="HALF_OPEN"?(c().warn(`[CircuitBreaker:${n}] Failed in HALF_OPEN → OPEN`),a="OPEN",d=Date.now()+t):a==="CLOSED"&&i>=e&&(c().error(`[CircuitBreaker:${n}] Failure threshold reached (${i}) → OPEN`),a="OPEN",d=Date.now()+t)}async function p(P){if(f(),a==="OPEN"){s++;const C=d?Math.ceil((d-Date.now())/1e3):0;throw new w(`Circuit breaker is OPEN. Service is unavailable. Retry in ${C}s.`)}try{const C=await P();return A(),C}catch(C){throw h(C instanceof Error?C:new Error(String(C))),C}}function m(){return f(),a}function x(){return f(),{state:a,failures:i,successes:o,rejections:s,lastFailureTime:u,lastSuccessTime:l}}function O(){c().debug(`[CircuitBreaker:${n}] Manual reset → CLOSED`),a="CLOSED",i=0,o=0,s=0,u=null,l=null,d=null}function T(){c().warn(`[CircuitBreaker:${n}] Manual trip → OPEN`),a="OPEN",d=Date.now()+t}return{execute:p,getState:m,getStats:x,reset:O,trip:T}}const st={STRICT:{failureThreshold:3,timeout:6e4},STANDARD:{failureThreshold:5,timeout:3e4},LENIENT:{failureThreshold:10,timeout:15e3}};function ct(r,e){if(e>=3)return!1;const t=r.message.toLowerCase();return t.includes("network")||t.includes("timeout")||t.includes("fetch failed")||t.includes("econnrefused")||t.includes("503")||t.includes("502")||t.includes("500")||t.includes("429")?!0:(t.includes("400")||t.includes("401")||t.includes("403")||t.includes("404"),!1)}function lt(r,e,t,n,a){const i=e*Math.pow(t,r),o=Math.min(i,n);if(a){const s=Math.random()*o;return Math.floor(s)}return Math.floor(o)}function ut(r){return new Promise(e=>setTimeout(e,r))}async function g(r,e={}){const{maxRetries:t=3,initialDelayMs:n=1e3,backoffFactor:a=2,maxDelayMs:i=3e4,jitter:o=!0,shouldRetry:s=ct,name:u="retry"}=e;let l=null,d=0;for(let f=0;f<=t;f++)try{const A=await r();return f>0&&c().debug(`[Retry:${u}] Succeeded on attempt ${f+1}/${t+1} after ${d}ms`),A}catch(A){l=A instanceof Error?A:new Error(String(A));const h=f===t,p=s(l,f);if(h||!p)throw c().warn(`[Retry:${u}] Failed on attempt ${f+1}/${t+1}. ${h?"No more retries.":"Error not retryable."}`),l;const m=lt(f,n,a,i,o);d+=m,c().warn(`[Retry:${u}] Attempt ${f+1}/${t+1} failed: ${l.message}. Retrying in ${m}ms...`),await ut(m)}throw l||new Error("Retry failed with no error")}const b={QUICK:{maxRetries:3,initialDelayMs:1e3,backoffFactor:2,maxDelayMs:1e4},STANDARD:{maxRetries:3,initialDelayMs:2e3,backoffFactor:2,maxDelayMs:3e4},AGGRESSIVE:{maxRetries:5,initialDelayMs:500,backoffFactor:1.5,maxDelayMs:15e3},PATIENT:{maxRetries:5,initialDelayMs:5e3,backoffFactor:2,maxDelayMs:6e4}};class dt{stripe=null;publicKey;routeDiscovery;rateLimiter=U(D.PAYMENT);circuitBreaker=B({failureThreshold:5,timeout:1e4,name:"stripe-manager"});constructor(e,t){this.publicKey=e,this.routeDiscovery=t}async initialize(){if(!this.stripe&&(this.stripe=await ve(this.publicKey),!this.stripe))throw new Error("Failed to initialize Stripe")}async createSession(e){if(!this.rateLimiter.tryConsume())throw new Error("Rate limit exceeded for Stripe session creation. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/stripe-session");c().debug("[StripeManager] Creating session with request:",e),e.couponCode?c().debug("[StripeManager] Coupon code included:",e.couponCode):c().debug("[StripeManager] No coupon code in request");const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":R.generateUUID()},body:JSON.stringify(e)});if(!n.ok){const a=await v(n,"Failed to create Stripe session");throw new Error(a)}return await n.json()},{...b.STANDARD,name:"stripe-create-session"}))}catch(t){throw t instanceof w?(c().error("[StripeManager] Circuit breaker is OPEN - Stripe service unavailable"),new Error("Stripe payment service is temporarily unavailable. Please try again in a few moments.")):t}}async redirectToCheckout(e){if(this.stripe||await this.initialize(),!this.stripe)return{success:!1,error:"Stripe not initialized"};const t=await this.stripe.redirectToCheckout({sessionId:e});return t.error?{success:!1,error:t.error.message}:{success:!0}}async processPayment(e){try{const t=await this.createSession(e);return await this.redirectToCheckout(t.sessionId)}catch(t){return{success:!1,error:M(t,"Unknown error")}}}async processCartCheckout(e){const{items:t,successUrl:n,cancelUrl:a,metadata:i,customerEmail:o,couponCode:s}=e;if(!this.rateLimiter.tryConsume())return{success:!1,error:"Rate limit exceeded for cart checkout. Please try again later."};try{const u=await this.circuitBreaker.execute(async()=>await g(async()=>{const l=await this.routeDiscovery.buildUrl("/paywall/v1/cart/checkout"),d={items:t,successUrl:n,cancelUrl:a,metadata:i,customerEmail:o,coupon:s,couponCode:s},f=await y(l,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":R.generateUUID()},body:JSON.stringify(d)});if(!f.ok){const A=await v(f,"Failed to create cart checkout session");throw new Error(A)}return await f.json()},{...b.STANDARD,name:"stripe-cart-checkout"}));return await this.redirectToCheckout(u.sessionId)}catch(u){return u instanceof w?{success:!1,error:"Stripe payment service is temporarily unavailable. Please try again in a few moments."}:{success:!1,error:M(u,"Cart checkout failed")}}}}const Pe="3.7.8",ft=Pe,I=typeof Buffer=="function",de=typeof TextDecoder=="function"?new TextDecoder:void 0,fe=typeof TextEncoder=="function"?new TextEncoder:void 0,At="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",j=Array.prototype.slice.call(At),H=(r=>{let e={};return r.forEach((t,n)=>e[t]=n),e})(j),ht=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,S=String.fromCharCode.bind(String),Ae=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):r=>new Uint8Array(Array.prototype.slice.call(r,0)),xe=r=>r.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),Te=r=>r.replace(/[^A-Za-z0-9\+\/]/g,""),Re=r=>{let e,t,n,a,i="";const o=r.length%3;for(let s=0;s<r.length;){if((t=r.charCodeAt(s++))>255||(n=r.charCodeAt(s++))>255||(a=r.charCodeAt(s++))>255)throw new TypeError("invalid character found");e=t<<16|n<<8|a,i+=j[e>>18&63]+j[e>>12&63]+j[e>>6&63]+j[e&63]}return o?i.slice(0,o-3)+"===".substring(o):i},re=typeof btoa=="function"?r=>btoa(r):I?r=>Buffer.from(r,"binary").toString("base64"):Re,_=I?r=>Buffer.from(r).toString("base64"):r=>{let t=[];for(let n=0,a=r.length;n<a;n+=4096)t.push(S.apply(null,r.subarray(n,n+4096)));return re(t.join(""))},V=(r,e=!1)=>e?xe(_(r)):_(r),pt=r=>{if(r.length<2){var e=r.charCodeAt(0);return e<128?r:e<2048?S(192|e>>>6)+S(128|e&63):S(224|e>>>12&15)+S(128|e>>>6&63)+S(128|e&63)}else{var e=65536+(r.charCodeAt(0)-55296)*1024+(r.charCodeAt(1)-56320);return S(240|e>>>18&7)+S(128|e>>>12&63)+S(128|e>>>6&63)+S(128|e&63)}},yt=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ke=r=>r.replace(yt,pt),he=I?r=>Buffer.from(r,"utf8").toString("base64"):fe?r=>_(fe.encode(r)):r=>re(ke(r)),N=(r,e=!1)=>e?xe(he(r)):he(r),pe=r=>N(r,!0),wt=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,mt=r=>{switch(r.length){case 4:var e=(7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3),t=e-65536;return S((t>>>10)+55296)+S((t&1023)+56320);case 3:return S((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return S((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},Me=r=>r.replace(wt,mt),Ue=r=>{if(r=r.replace(/\s+/g,""),!ht.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(r.length&3));let e,t,n,a=[];for(let i=0;i<r.length;)e=H[r.charAt(i++)]<<18|H[r.charAt(i++)]<<12|(t=H[r.charAt(i++)])<<6|(n=H[r.charAt(i++)]),t===64?a.push(S(e>>16&255)):n===64?a.push(S(e>>16&255,e>>8&255)):a.push(S(e>>16&255,e>>8&255,e&255));return a.join("")},ne=typeof atob=="function"?r=>atob(Te(r)):I?r=>Buffer.from(r,"base64").toString("binary"):Ue,De=I?r=>Ae(Buffer.from(r,"base64")):r=>Ae(ne(r).split("").map(e=>e.charCodeAt(0))),Be=r=>De(Oe(r)),gt=I?r=>Buffer.from(r,"base64").toString("utf8"):de?r=>de.decode(De(r)):r=>Me(ne(r)),Oe=r=>Te(r.replace(/[-_]/g,e=>e=="-"?"+":"/")),$=r=>gt(Oe(r)),bt=r=>{if(typeof r!="string")return!1;const e=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},Ne=r=>({value:r,enumerable:!1,writable:!0,configurable:!0}),Ie=function(){const r=(e,t)=>Object.defineProperty(String.prototype,e,Ne(t));r("fromBase64",function(){return $(this)}),r("toBase64",function(e){return N(this,e)}),r("toBase64URI",function(){return N(this,!0)}),r("toBase64URL",function(){return N(this,!0)}),r("toUint8Array",function(){return Be(this)})},Le=function(){const r=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Ne(t));r("toBase64",function(e){return V(this,e)}),r("toBase64URI",function(){return V(this,!0)}),r("toBase64URL",function(){return V(this,!0)})},vt=()=>{Ie(),Le()},q={version:Pe,VERSION:ft,atob:ne,atobPolyfill:Ue,btoa:re,btoaPolyfill:Re,fromBase64:$,toBase64:N,encode:N,encodeURI:pe,encodeURL:pe,utob:ke,btou:Me,decode:$,isValid:bt,fromUint8Array:V,toUint8Array:Be,extendString:Ie,extendUint8Array:Le,extendBuiltins:vt};class Et{routeDiscovery;quoteRateLimiter=U(D.QUOTE);verifyRateLimiter=U(D.PAYMENT);circuitBreaker=B({failureThreshold:5,timeout:1e4,name:"x402-manager"});constructor(e){this.routeDiscovery=e}async requestQuote(e){const{resource:t,couponCode:n}=e;if(!this.quoteRateLimiter.tryConsume())throw new Error("Rate limit exceeded for quote requests. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const a="/paywall/v1/quote";c().debug("[X402Manager] Requesting quote",n?"with coupon":"without coupon");const i=await this.routeDiscovery.buildUrl(a),o=await y(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resource:t,couponCode:n||null})});if(o.status!==402)throw new Error(`Expected 402 status, got ${o.status}`);const s=await o.json();if(s.crypto)return s.crypto;if(s.accepts&&s.accepts.length>0)return s.accepts[0];throw new Error("Invalid x402 response: missing crypto or accepts field")},{...b.QUICK,name:"x402-quote"}))}catch(a){throw a instanceof w?(c().error("[X402Manager] Circuit breaker is OPEN - x402 service unavailable"),new Error("Payment service is temporarily unavailable. Please try again in a few moments.")):a}}async requestCartQuote(e){const{items:t,metadata:n,couponCode:a}=e;if(!this.quoteRateLimiter.tryConsume())throw new Error("Rate limit exceeded for cart quote requests. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const i=await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote"),o={items:t,metadata:n,coupon:a,couponCode:a},s=await y(i,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":R.generateUUID()},body:JSON.stringify(o)});if(s.status!==402&&!s.ok){const u=await v(s,"Failed to get cart quote");throw new Error(u)}return await s.json()},{...b.QUICK,name:"x402-cart-quote"}))}catch(i){throw i instanceof w?(c().error("[X402Manager] Circuit breaker is OPEN - cart quote service unavailable"),new Error("Payment service is temporarily unavailable. Please try again in a few moments.")):i}}buildPaymentHeader(e){const t=JSON.stringify(e);return q.encode(t)}parseSettlementResponse(e){const t=e.headers.get("X-PAYMENT-RESPONSE");if(!t)return null;try{const n=q.decode(t),a=JSON.parse(n);return typeof a.success!="boolean"?(c().error("Invalid settlement response: missing success field"),null):a}catch(n){return c().error("Failed to parse settlement response:",n),null}}async submitPayment(e){const{resource:t,payload:n,couponCode:a,metadata:i,resourceType:o="regular"}=e;if(!this.verifyRateLimiter.tryConsume())return{success:!1,error:"Rate limit exceeded for payment verification. Please try again later."};try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const u={...n,payload:{...n.payload,resource:t,resourceType:o,metadata:{...n.payload.metadata||{},...i||{},...a?{couponCode:a}:{}}}},l=this.buildPaymentHeader(u),d="/paywall/v1/verify";c().debug("[X402Manager] Submitting payment",{resourceType:o,hasCoupon:!!a,hasMetadata:!!i});const f=await this.routeDiscovery.buildUrl(d),A=await y(f,{method:"POST",headers:{"Content-Type":"application/json","X-PAYMENT":l,"Idempotency-Key":R.generateUUID()}});if(A.ok){const{settlement:p,transactionId:m}=await this.handlePaymentVerification(A,n.payload.signature);return{success:!0,transactionId:m,settlement:p||void 0}}return{success:!1,error:await v(A,"Payment verification failed",!0)}},{...b.STANDARD,name:"x402-verify"}))}catch(s){return s instanceof w?{success:!1,error:"Payment verification service is temporarily unavailable. Please try again in a few moments."}:{success:!1,error:M(s,"Unknown error")}}}async buildGaslessTransaction(e){const{resourceId:t,userWallet:n,feePayer:a,couponCode:i}=e;if(!this.quoteRateLimiter.tryConsume())throw new Error("Rate limit exceeded for gasless transaction requests. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const o=await this.routeDiscovery.buildUrl("/paywall/v1/gasless-transaction"),s=await y(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resourceId:t,userWallet:n,feePayer:a,couponCode:i})});if(!s.ok){const u=await v(s,"Failed to build gasless transaction");throw new Error(u)}return await s.json()},{...b.QUICK,name:"x402-gasless-build"}))}catch(o){throw o instanceof w?(c().error("[X402Manager] Circuit breaker is OPEN - gasless transaction service unavailable"),new Error("Gasless transaction service is temporarily unavailable. Please try again in a few moments.")):o}}async submitGaslessTransaction(e){const{resource:t,partialTx:n,couponCode:a,metadata:i,resourceType:o="regular",requirement:s}=e;if(!this.verifyRateLimiter.tryConsume())return{success:!1,error:"Rate limit exceeded for gasless transaction verification. Please try again later."};try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const l={x402Version:0,scheme:s?.scheme||"solana-spl-transfer",network:s?.network||"mainnet-beta",payload:{signature:"",transaction:n,feePayer:s?.extra?.feePayer||"",resource:t,resourceType:o,metadata:{...i||{},...a?{couponCode:a}:{}}}},d=this.buildPaymentHeader(l),A=await this.routeDiscovery.buildUrl("/paywall/v1/verify"),h=await y(A,{method:"POST",headers:{"Content-Type":"application/json","X-PAYMENT":d,"Idempotency-Key":R.generateUUID()}});if(h.ok){const{settlement:m,transactionId:x}=await this.handlePaymentVerification(h,"gasless-tx");return{success:!0,transactionId:x,settlement:m||void 0}}return{success:!1,error:await v(h,"Gasless transaction failed",!0)}},{...b.STANDARD,name:"x402-gasless-verify"}))}catch(u){return u instanceof w?{success:!1,error:"Gasless transaction verification service is temporarily unavailable. Please try again in a few moments."}:{success:!1,error:M(u,"Unknown error")}}}async handlePaymentVerification(e,t){const n=this.parseSettlementResponse(e),a=e.headers.get("Content-Type")||"";let i=t;if(a.includes("application/json"))try{i=(await e.json()).signature||t}catch(o){c().warn("Failed to parse JSON response body:",o)}return{settlement:n,transactionId:i}}validateRequirement(e){return!!(e.scheme&&e.network&&e.maxAmountRequired&&e.resource&&e.payTo&&e.asset&&e.maxTimeoutSeconds>0)}}function Ct(r){if(r.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let l=0;l<e.length;l++)e[l]=255;for(let l=0;l<r.length;l++){const d=r.charAt(l),f=d.charCodeAt(0);if(e[f]!==255)throw new TypeError(d+" is ambiguous");e[f]=l}const t=r.length,n=r.charAt(0),a=Math.log(t)/Math.log(256),i=Math.log(256)/Math.log(t);function o(l){if(l instanceof Uint8Array||(ArrayBuffer.isView(l)?l=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):Array.isArray(l)&&(l=Uint8Array.from(l))),!(l instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(l.length===0)return"";let d=0,f=0,A=0;const h=l.length;for(;A!==h&&l[A]===0;)A++,d++;const p=(h-A)*i+1>>>0,m=new Uint8Array(p);for(;A!==h;){let T=l[A],P=0;for(let C=p-1;(T!==0||P<f)&&C!==-1;C--,P++)T+=256*m[C]>>>0,m[C]=T%t>>>0,T=T/t>>>0;if(T!==0)throw new Error("Non-zero carry");f=P,A++}let x=p-f;for(;x!==p&&m[x]===0;)x++;let O=n.repeat(d);for(;x<p;++x)O+=r.charAt(m[x]);return O}function s(l){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;let d=0,f=0,A=0;for(;l[d]===n;)f++,d++;const h=(l.length-d)*a+1>>>0,p=new Uint8Array(h);for(;d<l.length;){const T=l.charCodeAt(d);if(T>255)return;let P=e[T];if(P===255)return;let C=0;for(let z=h-1;(P!==0||C<A)&&z!==-1;z--,C++)P+=t*p[z]>>>0,p[z]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");A=C,d++}let m=h-A;for(;m!==h&&p[m]===0;)m++;const x=new Uint8Array(f+(h-m));let O=f;for(;m!==h;)x[O++]=p[m++];return x}function u(l){const d=s(l);if(d)return d;throw new Error("Non-base"+t+" character")}return{encode:o,decodeUnsafe:s,decode:u}}var St="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuv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4FCI1Gl2W1JsZsw9zA+Bh3JmjkC0H5/0JV6JotNMatJIZ4v5PqwJe3r8xd+FNS3ynccdu+xtVdc27qwVdoomciZD5oXYey9KAFSAKO594sBKZNWUJTLXnt0BJbdF8FkQYvg3DQajYY2p+ixd5Ag7o92gw0pVVDDOP+WQxiEmKqgWJyTBsnsBk2Bxi2Unsv8S/4PmE8Hy/vy+Mij+aTAKZvg716IHfHX0/JMeFfmAnsZ39Q0qkfdPtq6+CxbGZ7wKDsK/8l/MVGuyd6faJFt5wyoOXuNrr3JC9EoBmjcOzkVw/6RNP49poZ1xzsX3q7B4HGfI/XSfRQq3HeZ2j12d0E3gCAube4oExaT1sx/v8F+f61QOsGdSaqM2im6qOGkSRkrRQ7L8hvS8vEYJeVkAbFvX5ov7e/egYYNToMHj651c5/rCVYtB9Ned6GvGN8R0x3t7+lsf8+ofhHRzpyvwxd6c5pREZVOKnXzplhJ61mki4JmAAAABFWElGugAAAEV4aWYAAElJKgAIAAAABgASAQMAAQAAAAEAAAAaAQUAAQAAAFYAAAAbAQUAAQAAAF4AAAAoAQMAAQAAAAIAAAATAgMAAQAAAAEAAABphwQAAQAAAGYAAAAAAAAASAAAAAEAAABIAAAAAQAAAAYAAJAHAAQAAAAwMjEwAZEHAAQAAAABAgMAAKAHAAQAAAAwMTAwAaADAAEAAAD//wAAAqAEAAEAAAA8AAAAA6AEAAEAAAA8AAAAAAAAAA==",xt="data:image/svg+xml,%3csvg%20width='868'%20height='868'%20viewBox='0%200%20868%20868'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='434'%20cy='434'%20r='434'%20fill='%231B262D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M234.563%20184H640.697C650.387%20184%20659.339%20189.164%20664.172%20197.542L782.495%20402.657C788.631%20413.294%20786.808%20426.72%20778.056%20435.346L452.368%20756.327C441.818%20766.724%20424.846%20766.724%20414.296%20756.327L89.0484%20435.78C80.0927%20426.954%2078.4157%20413.136%2085.0013%20402.433L211.48%20196.884C216.405%20188.879%20225.146%20184%20234.563%20184ZM588.257%20275.577V333.129H472.567V373.032C553.82%20377.296%20614.782%20394.81%20615.234%20415.802L615.231%20459.563C614.779%20480.556%20553.82%20498.069%20472.567%20502.333V600.259H395.746V502.333C314.492%20498.069%20253.531%20480.555%20253.078%20459.563L253.081%20415.802C253.533%20394.81%20314.492%20377.296%20395.746%20373.032V333.129H280.055V275.577H588.257ZM434.156%20472.268C520.868%20472.268%20593.345%20457.459%20611.082%20437.683C596.041%20420.912%20541.636%20407.713%20472.567%20404.089V445.867C460.187%20446.516%20447.336%20446.858%20434.156%20446.858C420.976%20446.858%20408.125%20446.516%20395.746%20445.867V404.089C326.676%20407.713%20272.271%20420.912%20257.23%20437.683C274.968%20457.459%20347.444%20472.268%20434.156%20472.268Z'%20fill='%23009393'/%3e%3c/svg%3e",Tt="data:image/webp;base64,UklGRqwEAABXRUJQVlA4WAoAAAAYAAAAOwAAOwAAQUxQSL8BAAABkGvbtmlLc5997yvbmW19gBnbDm2kjF5UmW3bthXZVZFdZ+81r+87Z1XlEaHIbSNlMstwos4XUBSTLAFQo/u01Zdf/yLDDze3zB/YwADJEoOoJAKg7oTdH4SF+XxiZlMgSESzwAJdVn2iUJzzOUMiLhQKf+/va2FtBLMBuu1zpHcsincUXhtoTKLsCTVX/KF3wrLhPLm/OWzZtjQWfZ7RhYyAC/lxMowpSzJYJAyFkZDQc21FBMUT7BqGjpHxf3m+XlEPUHE/f3vGgPzmw4awRUaTexkyJhwfNShctVgZXyJDXq4CUyjNy6Y4fVOBIkAPR2GcOE7Jm2NQ/RE9YzXht3a5VYvlOX0xF0fy+tp/ozBuQg6DzZYb6Bi7ed4rB5Mp/1Co4cNhLUo1StLxDIDqrynUoRswiF6nFnIxsDpnZ5WBW0GFZ1qZ8HfLDk5txHHsGDpSa6B0cXZEa+DsTr1M+P4qPdXwjynU4+1/a7oN3Sm6G+meSd27oHsHde++7puj+tYpv7G6b7vun6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xCpjxmKwqjjaYmCZfHsFu24GXo":{symbol:"PYUSD",decimals:6,icon:Tt},CASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH:{symbol:"CASH",decimals:6,icon:Rt}},G=Object.fromEntries(Object.entries(Fe).map(([r,e])=>[r,e.symbol]));function kt(r){return r in G}function ae(r,e="token mint",t=!1){if(!r||r.trim().length===0)return{isValid:!0,isKnownStablecoin:!1};const n=r.trim();if(kt(n))return{isValid:!0,isKnownStablecoin:!0,symbol:G[n]};const a=Object.entries(G).map(([i,o])=>` ${o}: ${i}`).join(`
2
+ `);return t?{isValid:!0,isKnownStablecoin:!1,warning:[`Warning: Unrecognized token mint address in ${e}`,` Provided: ${n}`,"","This token mint does not match any known stablecoin addresses.","You have set dangerouslyAllowUnknownMint=true, so this will proceed.","If this is a typo, payments will be sent to the wrong token and funds will be PERMANENTLY LOST.","","Known stablecoin mints (mainnet-beta):",a,"","Double-check your token mint address before deploying to production."].join(`
3
+ `)}:{isValid:!1,isKnownStablecoin:!1,error:[`SAFETY ERROR: Unrecognized token mint address in ${e}`,` Provided: ${n}`,"","This token mint does not match any known stablecoin addresses.","Using an unknown token mint can result in PERMANENT LOSS OF FUNDS if it's a typo.","","Known stablecoin mints (mainnet-beta):",a,"","If you are CERTAIN this is the correct mint address (custom token, testnet, or new stablecoin),","set dangerouslyAllowUnknownMint={true} in your CedrosProvider config:",""," <CedrosProvider"," config={{"," ...",' tokenMint: "'+n+'",'," dangerouslyAllowUnknownMint: true, // ⚠️ I have verified this mint address"," }}"," />","","⚠️ WARNING: Only enable dangerouslyAllowUnknownMint if you have TRIPLE-CHECKED the mint address."].join(`
4
+ `)}}function Mt(r,e="unknown",t=!1){return ae(r,`X402Requirement (resource: ${e})`,t)}class Ut{connection;cluster;endpoint;allowUnknownMint;rpcRateLimiter=U({maxRequests:50,windowMs:6e4});rpcCircuitBreaker=B({failureThreshold:5,timeout:1e4,name:"solana-rpc"});constructor(e="mainnet-beta",t,n=!1){this.cluster=e,this.endpoint=t,this.allowUnknownMint=n,this.connection=this.createConnection()}createConnection(){const e=this.endpoint??k.clusterApiUrl(this.cluster);return new k.Connection(e,"confirmed")}transformRpcError(e){const t=e instanceof Error?e.message:typeof e=="string"?e:String(e);return t.includes("403")||t.includes("Access forbidden")?new Error("Public Solana RPC access denied. Please configure a custom RPC endpoint (e.g., from Helius, QuickNode, or Alchemy) in your CedrosProvider config using the solanaEndpoint option."):t.includes("429")||t.includes("Too Many Requests")?new Error("Solana RPC rate limit exceeded. Please configure a custom RPC endpoint with higher limits in your CedrosProvider config using the solanaEndpoint option."):e instanceof Error?e:new Error(t)}async buildTransaction(e){const{requirement:t,payerPublicKey:n,blockhash:a}=e;if(!t||!t.payTo)throw new Error("Invalid requirement: missing payTo");c().debug("[WalletManager] Building transaction for resource:",t.resource);const i=new k.Transaction,o=this.resolveAmountInMinorUnits(t),s=t.asset;if(!s)throw new Error("asset is required in x402 requirement");const u=Mt(s,t.resource,this.allowUnknownMint);if(!u.isValid&&u.error)throw new Error(u.error);u.warning&&c().warn(u.warning);const l=new k.PublicKey(s),d=await ce.getAssociatedTokenAddress(l,n);if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");let f;try{f=await this.rpcCircuitBreaker.execute(async()=>await g(async()=>await this.connection.getAccountInfo(d),{...b.QUICK,name:"rpc-get-account-info"}))}catch(p){throw p instanceof w?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(p)}if(!f)throw new Error("Payer is missing an associated token account for this mint");let A;try{A=t.extra?.recipientTokenAccount?new k.PublicKey(t.extra.recipientTokenAccount):new k.PublicKey(t.payTo)}catch{throw new Error("We are currently unable to process payment, please try again later")}if(i.add(ce.createTransferInstruction(d,A,n,o)),t.extra?.memo){const{TransactionInstruction:p}=await import("@solana/web3.js"),m=new p({keys:[],programId:new k.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(t.extra.memo,"utf8")});i.add(m)}let h;if(a)h=a;else{if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{h=(await this.rpcCircuitBreaker.execute(async()=>await g(async()=>await this.connection.getLatestBlockhash(),{...b.QUICK,name:"rpc-get-blockhash"}))).blockhash}catch(p){throw p instanceof w?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(p)}}return i.recentBlockhash=h,t.extra?.feePayer?i.feePayer=new k.PublicKey(t.extra.feePayer):i.feePayer=n,i}resolveAmountInMinorUnits(e){const t=parseInt(e.maxAmountRequired,10);if(Number.isNaN(t)||t<=0)throw new Error("Invalid maxAmountRequired in requirement");return t}buildPaymentPayload(e){const{requirement:t,signedTx:n,payerPublicKey:a}=e;return{x402Version:0,scheme:t.scheme,network:t.network,payload:{signature:n.signature,transaction:n.serialized,payer:a.toString(),memo:t.extra?.memo,recipientTokenAccount:t.extra?.recipientTokenAccount}}}async signTransaction(e){const{transaction:t,signTransaction:n}=e;c().debug("[WalletManager] Requesting wallet to sign transaction");const a=await n(t),i=a.serialize(),o=a.signatures[0]?.signature;if(!o)throw new Error("Signed transaction missing signature");const s=ee.encode(o);return c().debug("[WalletManager] Transaction signed with signature:",s.substring(0,20)+"..."),{serialized:q.fromUint8Array(i),signature:s}}deserializeTransaction(e){try{const t=q.toUint8Array(e);return k.Transaction.from(t)}catch(t){throw new Error(`Failed to deserialize transaction: ${M(t,"Unknown error")}`)}}async partiallySignTransaction(e){const{transaction:t,signTransaction:n,blockhash:a}=e;a&&t.recentBlockhash!==a&&(t.recentBlockhash=a);const i=await n(t),o=i.signatures[0]?.signature;if(o){const u=ee.encode(o);c().debug("[WalletManager] Partially signed with signature:",u.substring(0,20)+"...")}const s=i.serialize({requireAllSignatures:!1,verifySignatures:!1});return q.fromUint8Array(s)}async getBalance(e){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{return await this.rpcCircuitBreaker.execute(async()=>await g(async()=>await this.connection.getBalance(e),{...b.QUICK,name:"rpc-get-balance"}))/k.LAMPORTS_PER_SOL}catch(t){throw t instanceof w?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(t)}}async verifyTransaction(e){if(!this.rpcRateLimiter.tryConsume())return c().warn("[WalletManager] RPC rate limit exceeded for transaction verification"),!1;try{return!!(await this.rpcCircuitBreaker.execute(async()=>await g(async()=>await this.connection.getSignatureStatus(e),{...b.QUICK,name:"rpc-verify-tx"}))).value?.confirmationStatus}catch(t){return t instanceof w&&c().warn("[WalletManager] Circuit breaker OPEN - cannot verify transaction"),!1}}}class Dt{stripe=null;publicKey;routeDiscovery;sessionRateLimiter=U(D.PAYMENT);statusRateLimiter=U(D.QUOTE);circuitBreaker=B({failureThreshold:5,timeout:1e4,name:"subscription-manager"});constructor(e,t){this.publicKey=e,this.routeDiscovery=t}async initialize(){if(!this.stripe&&(this.stripe=await ve(this.publicKey),!this.stripe))throw new Error("Failed to initialize Stripe")}async executeWithResilience(e,t,n,a){if(!e.tryConsume())throw new Error("Rate limit exceeded. Please try again later.");try{return await this.circuitBreaker.execute(()=>g(t,{...b.STANDARD,name:n}))}catch(i){throw i instanceof w?(c().error(`[SubscriptionManager] Circuit breaker OPEN for ${a}`),new Error("Service temporarily unavailable. Please try again in a few moments.")):i}}async createSubscriptionSession(e){if(!this.sessionRateLimiter.tryConsume())throw new Error("Rate limit exceeded for subscription session creation. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/stripe-session");c().debug("[SubscriptionManager] Creating subscription session:",{resource:e.resource,interval:e.interval,trialDays:e.trialDays});const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":R.generateUUID()},body:JSON.stringify(e)});if(!n.ok){const a=await v(n,"Failed to create subscription session");throw new Error(a)}return await n.json()},{...b.STANDARD,name:"subscription-create-session"}))}catch(t){throw t instanceof w?(c().error("[SubscriptionManager] Circuit breaker is OPEN - service unavailable"),new Error("Subscription service is temporarily unavailable. Please try again in a few moments.")):t}}async redirectToCheckout(e){if(this.stripe||await this.initialize(),!this.stripe)return{success:!1,error:"Stripe not initialized"};const t=await this.stripe.redirectToCheckout({sessionId:e});return t.error?{success:!1,error:t.error.message}:{success:!0,transactionId:e}}async processSubscription(e){try{const t=await this.createSubscriptionSession(e);return await this.redirectToCheckout(t.sessionId)}catch(t){return{success:!1,error:M(t,"Subscription failed")}}}async checkSubscriptionStatus(e){if(!this.statusRateLimiter.tryConsume())throw new Error("Rate limit exceeded for subscription status check. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const t=new URLSearchParams({resource:e.resource,userId:e.userId}),n=await this.routeDiscovery.buildUrl(`/paywall/v1/subscription/status?${t.toString()}`);c().debug("[SubscriptionManager] Checking subscription status:",e);const a=await y(n,{method:"GET",headers:{"Content-Type":"application/json"}});if(!a.ok){const i=await v(a,"Failed to check subscription status");throw new Error(i)}return await a.json()},{...b.STANDARD,name:"subscription-status-check"}))}catch(t){throw t instanceof w?(c().error("[SubscriptionManager] Circuit breaker is OPEN for status check"),new Error("Subscription status service is temporarily unavailable. Please try again in a few moments.")):t}}async requestSubscriptionQuote(e,t,n){if(!this.statusRateLimiter.tryConsume())throw new Error("Rate limit exceeded for subscription quote. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const a=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/quote"),i={resource:e,interval:t,couponCode:n?.couponCode,intervalDays:n?.intervalDays};c().debug("[SubscriptionManager] Requesting subscription quote:",i);const o=await y(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(o.status!==402&&!o.ok){const s=await v(o,"Failed to get subscription quote");throw new Error(s)}return await o.json()},{...b.STANDARD,name:"subscription-quote"}))}catch(a){throw a instanceof w?(c().error("[SubscriptionManager] Circuit breaker is OPEN for quote"),new Error("Subscription quote service is temporarily unavailable. Please try again in a few moments.")):a}}async cancelSubscription(e){return this.executeWithResilience(this.sessionRateLimiter,async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/cancel");c().debug("[SubscriptionManager] Canceling subscription:",e);const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await v(n,"Failed to cancel"));return await n.json()},"subscription-cancel","cancellation")}async getBillingPortalUrl(e){return this.executeWithResilience(this.statusRateLimiter,async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/portal");c().debug("[SubscriptionManager] Getting billing portal URL:",e);const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await v(n,"Failed to get portal"));return await n.json()},"subscription-portal","portal")}async activateX402Subscription(e){return this.executeWithResilience(this.sessionRateLimiter,async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/x402/activate");c().debug("[SubscriptionManager] Activating x402 subscription:",e);const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await v(n,"Failed to activate"));return await n.json()},"subscription-activate","activation")}}class Bt{routeDiscovery;rateLimiter=U(D.PAYMENT);queryRateLimiter=U(D.QUOTE);circuitBreaker=B({failureThreshold:5,timeout:1e4,name:"subscription-change-manager"});constructor(e){this.routeDiscovery=e}async executeWithResilience(e,t,n,a){if(!e.tryConsume())throw new Error("Rate limit exceeded. Please try again later.");try{return await this.circuitBreaker.execute(()=>g(t,{...b.STANDARD,name:n}))}catch(i){throw i instanceof w?(c().error(`[SubscriptionChangeManager] Circuit breaker OPEN for ${a}`),new Error("Service temporarily unavailable. Please try again in a few moments.")):i}}async changeSubscription(e){return this.executeWithResilience(this.rateLimiter,async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/change");c().debug("[SubscriptionChangeManager] Changing subscription:",e);const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json","Idempotency-Key":R.generateUUID()},body:JSON.stringify(e)});if(!n.ok)throw new Error(await v(n,"Failed to change subscription"));return await n.json()},"subscription-change","plan change")}async previewChange(e){return this.executeWithResilience(this.queryRateLimiter,async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/change/preview");c().debug("[SubscriptionChangeManager] Previewing subscription change:",e);const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await v(n,"Failed to preview change"));return await n.json()},"subscription-preview","change preview")}async getDetails(e,t){return this.executeWithResilience(this.queryRateLimiter,async()=>{const n=new URLSearchParams({resource:e,userId:t}),a=await this.routeDiscovery.buildUrl(`/paywall/v1/subscription/details?${n}`);c().debug("[SubscriptionChangeManager] Getting subscription details:",{resource:e,userId:t});const i=await y(a,{method:"GET",headers:{"Content-Type":"application/json"}});if(!i.ok)throw new Error(await v(i,"Failed to get subscription details"));return await i.json()},"subscription-details","details")}async cancel(e){return this.executeWithResilience(this.rateLimiter,async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/cancel");c().debug("[SubscriptionChangeManager] Canceling subscription:",e);const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await v(n,"Failed to cancel subscription"));return await n.json()},"subscription-cancel","cancellation")}async getBillingPortalUrl(e){return this.executeWithResilience(this.queryRateLimiter,async()=>{const t=await this.routeDiscovery.buildUrl("/paywall/v1/subscription/portal");c().debug("[SubscriptionChangeManager] Getting billing portal URL:",e);const n=await y(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(await v(n,"Failed to get billing portal URL"));return await n.json()},"subscription-portal","portal")}}class Ot{routeDiscovery;rateLimiter=U(D.PAYMENT);circuitBreaker=B({failureThreshold:5,timeout:1e4,name:"credits-manager"});constructor(e){this.routeDiscovery=e}async requestQuote(e,t){if(!this.rateLimiter.tryConsume())throw new Error("Rate limit exceeded for credits quote. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const n=await this.routeDiscovery.buildUrl("/paywall/v1/quote");c().debug("[CreditsManager] Requesting quote for resource:",e);const a=await y(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resource:e,couponCode:t})});if(a.status===402)return(await a.json()).credits||null;if(!a.ok){const i=await v(a,"Failed to get credits quote");throw new Error(i)}return null},{...b.STANDARD,name:"credits-quote"}))}catch(n){throw n instanceof w?(c().error("[CreditsManager] Circuit breaker is OPEN - credits service unavailable"),new Error("Credits service is temporarily unavailable. Please try again in a few moments.")):n}}async requestCartQuote(e,t){if(!this.rateLimiter.tryConsume())throw new Error("Rate limit exceeded for cart credits quote. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const n=await this.routeDiscovery.buildUrl("/paywall/v1/cart/quote");c().debug("[CreditsManager] Requesting cart quote for items:",e.length);const a=await y(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e,couponCode:t})});if(!a.ok){const o=await v(a,"Failed to get cart credits quote");throw new Error(o)}const i=await a.json();return i.credits?{cartId:i.cartId,credits:i.credits}:null},{...b.STANDARD,name:"credits-cart-quote"}))}catch(n){throw n instanceof w?new Error("Credits service is temporarily unavailable. Please try again in a few moments."):n}}async createHold(e){const{resource:t,couponCode:n,authToken:a}=e;if(!this.rateLimiter.tryConsume())throw new Error("Rate limit exceeded for credits hold. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const i=await this.routeDiscovery.buildUrl("/paywall/v1/credits/hold");c().debug("[CreditsManager] Creating hold for resource:",t);const o=await y(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`,"Idempotency-Key":R.generateUUID()},body:JSON.stringify({resource:t,couponCode:n})});if(!o.ok){const s=await v(o,"Failed to create credits hold");throw new Error(s)}return await o.json()},{...b.STANDARD,name:"credits-create-hold"}))}catch(i){throw i instanceof w?new Error("Credits service is temporarily unavailable. Please try again in a few moments."):i}}async createCartHold(e){const{cartId:t,authToken:n}=e;if(!this.rateLimiter.tryConsume())throw new Error("Rate limit exceeded for cart credits hold. Please try again later.");try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const a=await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${t}/credits/hold`);c().debug("[CreditsManager] Creating cart hold for cart:",t);const i=await y(a,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`,"Idempotency-Key":R.generateUUID()},body:JSON.stringify({})});if(!i.ok){const o=await v(i,"Failed to create cart credits hold");throw new Error(o)}return await i.json()},{...b.STANDARD,name:"credits-create-cart-hold"}))}catch(a){throw a instanceof w?new Error("Credits service is temporarily unavailable. Please try again in a few moments."):a}}async authorizePayment(e){const{resource:t,holdId:n,couponCode:a,authToken:i,metadata:o}=e;if(!this.rateLimiter.tryConsume())return{success:!1,error:"Rate limit exceeded for credits authorization. Please try again later.",errorCode:"rate_limit_exceeded"};try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const s=await this.routeDiscovery.buildUrl("/paywall/v1/credits/authorize");c().debug("[CreditsManager] Authorizing payment for resource:",t);const u=await y(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`,"Idempotency-Key":R.generateUUID()},body:JSON.stringify({resource:t,holdId:n,couponCode:a,...o&&{metadata:o}})});if(!u.ok){const d=await u.json().catch(()=>({}));return{success:!1,error:d.error?.message||"Credits authorization failed",errorCode:d.error?.code||"authorization_failed"}}return{success:!0,transactionId:(await u.json()).transactionId}},{...b.STANDARD,name:"credits-authorize"}))}catch(s){return s instanceof w?{success:!1,error:"Credits service is temporarily unavailable. Please try again in a few moments.",errorCode:"service_unavailable"}:{success:!1,error:M(s,"Credits authorization failed"),errorCode:"authorization_failed"}}}async authorizeCartPayment(e){const{cartId:t,holdId:n,authToken:a,metadata:i}=e;if(!this.rateLimiter.tryConsume())return{success:!1,error:"Rate limit exceeded for cart credits authorization. Please try again later.",errorCode:"rate_limit_exceeded"};try{return await this.circuitBreaker.execute(async()=>await g(async()=>{const o=await this.routeDiscovery.buildUrl(`/paywall/v1/cart/${t}/credits/authorize`);c().debug("[CreditsManager] Authorizing cart payment for cart:",t);const s=await y(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`,"Idempotency-Key":R.generateUUID()},body:JSON.stringify({holdId:n,...i&&{metadata:i}})});if(!s.ok){const l=await s.json().catch(d=>(c().error("[CreditsManager] Failed to parse error response JSON:",d,{cartId:t,status:s.status,statusText:s.statusText}),{}));return{success:!1,error:l.error?.message||"Cart credits authorization failed",errorCode:l.error?.code||"authorization_failed"}}return{success:!0,transactionId:(await s.json()).transactionId}},{...b.STANDARD,name:"credits-cart-authorize"}))}catch(o){return o instanceof w?{success:!1,error:"Credits service is temporarily unavailable. Please try again in a few moments.",errorCode:"service_unavailable"}:{success:!1,error:M(o,"Cart credits authorization failed"),errorCode:"authorization_failed"}}}async processPayment(e,t,n,a){try{const i=await this.createHold({resource:e,couponCode:n,authToken:t}),o=await this.authorizePayment({resource:e,holdId:i.holdId,couponCode:n,authToken:t,metadata:a});return{success:o.success,transactionId:o.transactionId,error:o.error}}catch(i){return{success:!1,error:M(i,"Credits payment failed")}}}}class Nt{serverUrl;routePrefix=null;discoveryPromise=null;maxRetries=3;baseDelayMs=1e3;constructor(e){this.serverUrl=e}async discoverPrefix(){if(this.routePrefix!==null)return this.routePrefix;if(this.discoveryPromise)return this.discoveryPromise;const e=(async()=>{let t=0;for(;t<this.maxRetries;)try{const n=await y(`${this.serverUrl}/cedros-health`);if(!n.ok){if(n.status>=400&&n.status<500)return c().warn(`Route discovery received ${n.status} - not retrying client error`),this.routePrefix="","";throw new Error(`Health check returned ${n.status}`)}const i=(await n.json()).routePrefix||"";return this.routePrefix=i,c().debug("Route discovery successful, prefix:",i||"(empty)"),i}catch(n){if(t++,t>=this.maxRetries)return c().warn(`Route discovery failed after ${t} attempts, using empty prefix for this request:`,n),"";const a=this.baseDelayMs*Math.pow(2,t-1);c().warn(`Route discovery failed (attempt ${t}/${this.maxRetries}), retrying in ${a}ms:`,n),await new Promise(i=>setTimeout(i,a))}return""})();this.discoveryPromise=e;try{return await this.discoveryPromise}finally{this.discoveryPromise===e&&(this.discoveryPromise=null)}}async buildUrl(e){const t=await this.discoverPrefix(),n=e.startsWith("/")?e:`/${e}`;return`${this.serverUrl}${t}${n}`}reset(){this.routePrefix=null,this.discoveryPromise=null}}const J=new Map;function je(r,e,t,n,a){return JSON.stringify({stripePublicKey:r,serverUrl:e,solanaCluster:t,solanaEndpoint:n||"",dangerouslyAllowUnknownMint:a||!1})}function It(r,e,t,n,a){const i=je(r,e,t,n,a);let o=J.get(i);if(o)return o.refCount++,c().debug(`[ManagerCache] Reusing cached managers (refCount: ${o.refCount}):`,{stripePublicKey:r.slice(0,10)+"...",serverUrl:e}),o;c().debug("[ManagerCache] Creating new manager instances:",{stripePublicKey:r.slice(0,10)+"...",serverUrl:e});const s=new Nt(e),u=new dt(r,s),l=new Et(s),d=new Ut(t,n,a??!1),f=new Dt(r,s),A=new Bt(s),h=new Ot(s);return o={stripeManager:u,x402Manager:l,walletManager:d,subscriptionManager:f,subscriptionChangeManager:A,creditsManager:h,routeDiscovery:s,refCount:1},J.set(i,o),o}function Lt(r,e,t,n,a){const i=je(r,e,t,n,a),o=J.get(i);if(!o){c().warn("[ManagerCache] Attempted to release non-existent managers:",{cacheKey:i});return}o.refCount--,c().debug(`[ManagerCache] Released manager reference (refCount: ${o.refCount}):`,{stripePublicKey:r.slice(0,10)+"...",serverUrl:e}),o.refCount<=0&&(J.delete(i),c().debug("[ManagerCache] Removed managers from cache (refCount reached 0)"))}const Ft=["stripePublicKey"],ye=new Set(["mainnet-beta","devnet","testnet"]);function jt(){if(typeof window<"u"&&window.location)return window.location.origin;throw new Error("serverUrl is required in SSR/Node environments. In browser environments, it defaults to window.location.origin")}function qe(r){const e=[];Ft.forEach(n=>{const a=r[n];(typeof a!="string"||a.trim().length===0)&&e.push({field:n,message:"must be a non-empty string"})});let t;if(r.serverUrl!==void 0)typeof r.serverUrl!="string"||r.serverUrl.trim().length===0?(e.push({field:"serverUrl",message:"must be a non-empty string when provided"}),t=""):t=r.serverUrl;else try{t=jt()}catch(n){e.push({field:"serverUrl",message:n instanceof Error?n.message:"failed to determine default"}),t=""}if(ye.has(r.solanaCluster)||e.push({field:"solanaCluster",message:`must be one of ${Array.from(ye).join(", ")}`}),r.solanaEndpoint!==void 0&&(typeof r.solanaEndpoint!="string"?e.push({field:"solanaEndpoint",message:"must be a string when provided"}):r.solanaEndpoint.trim().length===0?e.push({field:"solanaEndpoint",message:'must be a non-empty string when provided (e.g., "https://api.mainnet-beta.solana.com")'}):!r.solanaEndpoint.startsWith("http://")&&!r.solanaEndpoint.startsWith("https://")&&e.push({field:"solanaEndpoint",message:'must start with "http://" or "https://" (e.g., "https://api.mainnet-beta.solana.com")'})),r.tokenMint&&typeof r.tokenMint!="string"&&e.push({field:"tokenMint",message:"must be a string when provided"}),e.length>0){const n=e.map(a=>`- ${a.field} ${a.message}`).join(`
5
+ `);throw new Error(`Invalid Cedros configuration:
6
+ ${n}`)}if(r.tokenMint){const n=r.dangerouslyAllowUnknownMint===!0,a=ae(r.tokenMint,"CedrosConfig.tokenMint",n);if(!a.isValid&&a.error)throw new Error(a.error);a.warning&&c().warn(a.warning)}return{...r,serverUrl:t}}class ze{adapters=null;poolId;isCleanedUp=!1;constructor(e){this.poolId=e??`pool_${Date.now()}_${Math.random().toString(36).slice(2,11)}`,c().debug(`[WalletPool] Created pool: ${this.poolId}`)}getAdapters(){return typeof window>"u"?[]:this.isCleanedUp?(c().warn(`[WalletPool] Attempted to use pool after cleanup: ${this.poolId}`),[]):this.adapters!==null?this.adapters:(c().debug(`[WalletPool] Initializing adapters for pool: ${this.poolId}`),this.adapters=[new le.PhantomWalletAdapter,new le.SolflareWalletAdapter],this.adapters)}async cleanup(){if(this.isCleanedUp){c().debug(`[WalletPool] Pool already cleaned up: ${this.poolId}`);return}if(c().debug(`[WalletPool] Cleaning up pool: ${this.poolId}`),this.isCleanedUp=!0,this.adapters===null)return;const e=this.adapters.map(async t=>{try{t.connected&&(c().debug(`[WalletPool] Disconnecting wallet: ${t.name}`),await t.disconnect())}catch(n){c().warn(`[WalletPool] Failed to disconnect wallet ${t.name}:`,n)}});await Promise.allSettled(e),this.adapters=null,c().debug(`[WalletPool] Pool cleanup complete: ${this.poolId}`)}isInitialized(){return this.adapters!==null}getId(){return this.poolId}}function Qe(r){return new ze(r)}const qt=Object.freeze({surfaceBackground:"rgba(255, 255, 255, 0)",surfaceText:"#111827",surfaceBorder:"rgba(15, 23, 42, 0.08)",stripeBackground:"linear-gradient(135deg, #635bff 0%, #4f46e5 100%)",stripeText:"#ffffff",stripeShadow:"rgba(79, 70, 229, 0.25)",cryptoBackground:"linear-gradient(135deg, #14f195 0%, #9945ff 100%)",cryptoText:"#ffffff",cryptoShadow:"rgba(99, 102, 241, 0.25)",errorBackground:"#fee2e2",errorBorder:"#fca5a5",errorText:"#b91c1c",successBackground:"#dcfce7",successBorder:"#86efac",successText:"#166534",modalOverlay:"rgba(0, 0, 0, 0.5)",modalBackground:"#ffffff",modalBorder:"rgba(15, 23, 42, 0.08)",buttonBorderRadius:"8px",buttonPadding:"0.75rem 1.5rem",buttonFontSize:"1rem",buttonFontWeight:"600"}),zt=Object.freeze({surfaceBackground:"rgba(17, 24, 39, 0.6)",surfaceText:"#f9fafb",surfaceBorder:"rgba(148, 163, 184, 0.25)",stripeBackground:"linear-gradient(135deg, #4f46e5 0%, #3730a3 100%)",stripeText:"#f5f3ff",stripeShadow:"rgba(99, 102, 241, 0.35)",cryptoBackground:"linear-gradient(135deg, #1dd4a6 0%, #6d28d9 100%)",cryptoText:"#ecfeff",cryptoShadow:"rgba(75, 85, 99, 0.35)",errorBackground:"#7f1d1d",errorBorder:"#fca5a5",errorText:"#fecaca",successBackground:"#14532d",successBorder:"#4ade80",successText:"#bbf7d0",modalOverlay:"rgba(0, 0, 0, 0.75)",modalBackground:"#1f2937",modalBorder:"rgba(148, 163, 184, 0.25)",buttonBorderRadius:"8px",buttonPadding:"0.75rem 1.5rem",buttonFontSize:"1rem",buttonFontWeight:"600"}),Qt={surfaceBackground:"--cedros-surface-bg",surfaceText:"--cedros-surface-text",surfaceBorder:"--cedros-surface-border",stripeBackground:"--cedros-stripe-bg",stripeText:"--cedros-stripe-text",stripeShadow:"--cedros-stripe-shadow",cryptoBackground:"--cedros-crypto-bg",cryptoText:"--cedros-crypto-text",cryptoShadow:"--cedros-crypto-shadow",errorBackground:"--cedros-error-bg",errorBorder:"--cedros-error-border",errorText:"--cedros-error-text",successBackground:"--cedros-success-bg",successBorder:"--cedros-success-border",successText:"--cedros-success-text",modalOverlay:"--cedros-modal-overlay",modalBackground:"--cedros-modal-bg",modalBorder:"--cedros-modal-border",buttonBorderRadius:"--cedros-button-radius",buttonPadding:"--cedros-button-padding",buttonFontSize:"--cedros-button-font-size",buttonFontWeight:"--cedros-button-font-weight"},ie=E.createContext(null);function Wt(r,e){return{...r==="dark"?zt:qt,...e}}function Ht(r){const e=Object.entries(r).map(([t,n])=>[Qt[t],n]);return Object.fromEntries(e)}function Kt({initialMode:r="light",overrides:e,unstyled:t=!1,children:n}){const[a,i]=E.useState(r),[o,s]=E.useState(e),u=E.useRef(e);E.useEffect(()=>{if(e===u.current)return;(!e||!u.current?e!==u.current:Object.keys({...e,...u.current}).some(f=>e[f]!==u.current?.[f]))&&(u.current=e,s(e))},[e]);const l=E.useMemo(()=>{const d=Wt(a,o),f=t?{}:Ht(d),A=t?"":`cedros-theme-root cedros-theme cedros-theme--${a}`;return{mode:a,setMode:i,tokens:d,className:A,style:f,unstyled:t}},[a,o,t]);return Z.jsx(ie.Provider,{value:l,children:n})}function Vt(){const r=E.useContext(ie);if(!r)throw new Error("useCedrosTheme must be used within CedrosProvider");return r}function Gt(){return E.useContext(ie)}let Y=!1,X=!1;async function Jt(){if(Y)return X?{available:!0}:{available:!1,error:we()};try{return await import("@solana/web3.js"),Y=!0,X=!0,{available:!0}}catch{return Y=!0,X=!1,{available:!1,error:we()}}}function we(){return`Solana dependencies not installed. To use crypto payments, install them with:
7
+
8
+ npm install @solana/web3.js @solana/spl-token @solana/wallet-adapter-react @solana/wallet-adapter-react-ui @solana/wallet-adapter-wallets @solana/wallet-adapter-base
9
+
10
+ Or if you only need Stripe payments, hide the crypto button with:
11
+ <CedrosPay showCrypto={false} />`}function Yt(){return typeof process<"u"&&process.env.NODE_ENV==="development"?0:2}const We=E.createContext(null);function Xt({config:r,children:e}){const t=E.useMemo(()=>qe(r),[r]),n=E.useRef(null);n.current===null&&(n.current=Qe());const[a,i]=E.useState(null);E.useEffect(()=>{let s=!1;return Jt().then(u=>{s||(u.available?i(void 0):i(u.error||"Solana dependencies not available"))}),()=>{s=!0}},[]),E.useEffect(()=>{const s=t.logLevel??Yt(),u=Ce({level:s,prefix:"[CedrosPay]"});at(u)},[t.logLevel]),E.useEffect(()=>{const s=n.current;return()=>{s&&s.cleanup().catch(u=>{c().warn("[CedrosProvider] Wallet pool cleanup failed:",u)})}},[]),E.useEffect(()=>{const s=t.stripePublicKey,u=t.serverUrl??"",l=t.solanaCluster,d=t.solanaEndpoint,f=t.dangerouslyAllowUnknownMint;return()=>{Lt(s,u,l,d,f)}},[t.stripePublicKey,t.serverUrl,t.solanaCluster,t.solanaEndpoint,t.dangerouslyAllowUnknownMint]);const o=E.useMemo(()=>{const{stripeManager:s,x402Manager:u,walletManager:l,subscriptionManager:d,subscriptionChangeManager:f,creditsManager:A}=It(t.stripePublicKey,t.serverUrl??"",t.solanaCluster,t.solanaEndpoint,t.dangerouslyAllowUnknownMint);return{config:t,stripeManager:s,x402Manager:u,walletManager:l,subscriptionManager:d,subscriptionChangeManager:f,creditsManager:A,walletPool:n.current,solanaError:a}},[t,a]);return Z.jsx(We.Provider,{value:o,children:Z.jsx(Kt,{initialMode:t.theme??"light",overrides:t.themeOverrides,unstyled:t.unstyled??!1,children:e})})}function Zt(){const r=E.useContext(We);if(!r)throw new Error("useCedrosContext must be used within CedrosProvider");return r}exports.CIRCUIT_BREAKER_PRESETS=st;exports.CedrosProvider=Xt;exports.CircuitBreakerOpenError=w;exports.CircuitState=Se;exports.KNOWN_STABLECOINS=G;exports.LogLevel=Ee;exports.Logger=te;exports.RATE_LIMITER_PRESETS=D;exports.RETRY_PRESETS=b;exports.STABLECOIN_METADATA=Fe;exports.WalletPool=ze;exports.bs58=ee;exports.createCircuitBreaker=B;exports.createLogger=Ce;exports.createRateLimiter=U;exports.createWalletPool=Qe;exports.fetchWithTimeout=y;exports.formatError=M;exports.getLogger=c;exports.retryWithBackoff=g;exports.useCedrosContext=Zt;exports.useCedrosTheme=Vt;exports.useCedrosThemeOptional=Gt;exports.validateConfig=qe;exports.validateTokenMint=ae;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Admin Plugin Exports
3
+ *
4
+ * Exports the cedrosPayPlugin for use with cedros-login's AdminShell.
5
+ * The AdminShell component is owned by cedros-login.
6
+ */
7
+ export type { AdminPlugin, AdminSectionConfig, AdminGroupConfig, AdminSectionProps, HostContext, PluginContext, } from './types';
8
+ export { cedrosPayPlugin } from './plugin';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { AdminPlugin } from './types';
2
+ /**
3
+ * Cedros Pay admin plugin definition.
4
+ *
5
+ * Registers all cedros-pay admin sections for use in the unified AdminShell.
6
+ */
7
+ export declare const cedrosPayPlugin: AdminPlugin;
8
+ export default cedrosPayPlugin;
9
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/admin/plugin.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAiD,MAAM,SAAS,CAAC;AA4B1F;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,WAyE7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ /**
3
+ * Configuration for an admin section (sidebar item).
4
+ */
5
+ export interface AdminSectionConfig {
6
+ /** Unique section identifier */
7
+ id: string;
8
+ /** Display label in sidebar */
9
+ label: string;
10
+ /** Icon element (SVG) */
11
+ icon: ReactNode;
12
+ /** Sidebar group: 'Users', 'Store', 'Configuration' */
13
+ group?: string;
14
+ /** Sort order within group (lower = first) */
15
+ order?: number;
16
+ /** Required permission to view this section */
17
+ requiredPermission?: string;
18
+ }
19
+ /**
20
+ * Sidebar group configuration.
21
+ */
22
+ export interface AdminGroupConfig {
23
+ /** Group identifier */
24
+ id: string;
25
+ /** Display label */
26
+ label: string;
27
+ /** Sort order (lower = first) */
28
+ order?: number;
29
+ /** If true, group can be collapsed (default expanded) */
30
+ collapsible?: boolean;
31
+ }
32
+ /**
33
+ * Props passed to section components by the shell.
34
+ */
35
+ export interface AdminSectionProps {
36
+ /** Plugin context with auth and config, passed by AdminShell as pluginContext */
37
+ pluginContext: PluginContext;
38
+ }
39
+ /**
40
+ * Host context aggregated from all providers.
41
+ * The AdminShell collects this from the environment.
42
+ */
43
+ export interface HostContext {
44
+ /** cedros-login auth state (if available) */
45
+ cedrosLogin?: {
46
+ user: {
47
+ id: string;
48
+ email?: string;
49
+ } | null;
50
+ getAccessToken: () => string | null;
51
+ serverUrl: string;
52
+ };
53
+ /** cedros-pay auth state (if available) */
54
+ cedrosPay?: {
55
+ walletAddress?: string;
56
+ jwtToken?: string;
57
+ serverUrl: string;
58
+ };
59
+ /** Organization context (if available) */
60
+ org?: {
61
+ orgId: string;
62
+ role: string;
63
+ permissions: string[];
64
+ };
65
+ }
66
+ /**
67
+ * Plugin-specific context passed to section components.
68
+ * Each plugin's createPluginContext converts HostContext to this.
69
+ */
70
+ export interface PluginContext {
71
+ /** Backend server URL */
72
+ serverUrl: string;
73
+ /** Current user ID (if authenticated) */
74
+ userId?: string;
75
+ /** Get access token for API requests */
76
+ getAccessToken: () => string | null;
77
+ /** Check if user has a permission */
78
+ hasPermission: (permission: string) => boolean;
79
+ /** Organization ID (if in org context) */
80
+ orgId?: string;
81
+ /** Plugin-specific data */
82
+ pluginData?: Record<string, unknown>;
83
+ }
84
+ /**
85
+ * Admin plugin definition.
86
+ * Each package (cedros-login, cedros-pay) exports one of these.
87
+ */
88
+ export interface AdminPlugin {
89
+ /** Unique plugin identifier */
90
+ id: string;
91
+ /** Display name */
92
+ name: string;
93
+ /** Plugin version (semver) */
94
+ version: string;
95
+ /** Section configurations for sidebar */
96
+ sections: AdminSectionConfig[];
97
+ /** Optional group configurations */
98
+ groups?: AdminGroupConfig[];
99
+ /** Lazy-loaded section components keyed by section id */
100
+ components: Record<string, ComponentType<AdminSectionProps>>;
101
+ /**
102
+ * Convert host context to plugin-specific context.
103
+ * Called when rendering a section from this plugin.
104
+ */
105
+ createPluginContext: (hostContext: HostContext) => PluginContext;
106
+ /**
107
+ * Check if user has permission for a plugin-specific action.
108
+ */
109
+ checkPermission: (permission: string, hostContext: HostContext) => boolean;
110
+ /** CSS namespace for style isolation (e.g., 'cedros-admin') */
111
+ cssNamespace: string;
112
+ /** Optional CSS to inject or loader function */
113
+ styles?: string | (() => Promise<void>);
114
+ }
115
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/admin/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH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AAc,EACd,eAAe,EACf,eAAe,EACf,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEnB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB,yDAAyD;IACzD,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAmJ9C"}
1
+ {"version":3,"file":"CedrosPay.d.ts","sourceRoot":"","sources":["../../src/components/CedrosPay.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,eAAe,EACf,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEnB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB,yDAAyD;IACzD,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAgL9C"}
@@ -0,0 +1,42 @@
1
+ import { CartItem } from '../types';
2
+ /**
3
+ * Props for CreditsButton component
4
+ */
5
+ interface CreditsButtonProps {
6
+ /** Single resource ID (for single-item payments) */
7
+ resource?: string;
8
+ /** Multiple items (for cart checkout) - mutually exclusive with resource */
9
+ items?: CartItem[];
10
+ /**
11
+ * @deprecated No longer required - server determines price during hold creation.
12
+ * Kept for backwards compatibility but ignored.
13
+ */
14
+ creditsRequirement?: unknown;
15
+ /** JWT token from cedros-login for user authentication */
16
+ authToken?: string;
17
+ /** Metadata for tracking (e.g., userId, session) */
18
+ metadata?: Record<string, string>;
19
+ /** Optional coupon code for discount */
20
+ couponCode?: string;
21
+ /** Button label */
22
+ label?: string;
23
+ /** Disable button */
24
+ disabled?: boolean;
25
+ /** Track payment attempt for analytics */
26
+ onAttempt?: (method: 'credits') => void;
27
+ /** Called on successful payment */
28
+ onSuccess?: (transactionId: string) => void;
29
+ /** Called on payment error */
30
+ onError?: (error: string) => void;
31
+ /** Custom CSS class name */
32
+ className?: string;
33
+ }
34
+ /**
35
+ * Button component for Credits payments
36
+ *
37
+ * Handles payment using cedros-login credits balance.
38
+ * Requires user to be authenticated with cedros-login.
39
+ */
40
+ export declare function CreditsButton({ resource, items, authToken, metadata, couponCode, label, disabled, onAttempt, onSuccess, onError, className, }: CreditsButtonProps): import("react/jsx-runtime").JSX.Element;
41
+ export {};
42
+ //# sourceMappingURL=CreditsButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreditsButton.d.ts","sourceRoot":"","sources":["../../src/components/CreditsButton.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,UAAU,kBAAkB;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,mCAAmC;IACnC,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,8BAA8B;IAC9B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,SAAS,EACT,QAAQ,EACR,UAAU,EACV,KAAK,EACL,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,SAAc,GACf,EAAE,kBAAkB,2CAsIpB"}
@@ -0,0 +1,55 @@
1
+ import { BillingInterval, PaymentMethod } from '../types';
2
+ /**
3
+ * Props for CreditsSubscribeButton component
4
+ */
5
+ interface CreditsSubscribeButtonProps {
6
+ /** Resource/plan ID for the subscription */
7
+ resource: string;
8
+ /** Billing interval */
9
+ interval: BillingInterval;
10
+ /** Custom interval in days (only used when interval is 'custom') */
11
+ intervalDays?: number;
12
+ /** JWT token from cedros-login for authentication */
13
+ authToken?: string;
14
+ /** User ID from cedros-login for subscription status checks */
15
+ userId?: string;
16
+ /** Coupon code for discount */
17
+ couponCode?: string;
18
+ /** Custom button label */
19
+ label?: string;
20
+ /** Disable button */
21
+ disabled?: boolean;
22
+ /** Track subscription attempt for analytics */
23
+ onAttempt?: (method: PaymentMethod) => void;
24
+ /** Callback on successful subscription */
25
+ onSuccess?: (transactionId: string) => void;
26
+ /** Callback on error */
27
+ onError?: (error: string) => void;
28
+ /** Additional CSS class */
29
+ className?: string;
30
+ /** Hide inline success/error messages */
31
+ hideMessages?: boolean;
32
+ /** Auto-check subscription status on mount when userId is provided */
33
+ autoCheckStatus?: boolean;
34
+ }
35
+ /**
36
+ * Button component for credits subscription payments
37
+ *
38
+ * Handles subscription payments using cedros-login credits balance.
39
+ * Requires user to be authenticated with cedros-login.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * <CreditsSubscribeButton
44
+ * resource="plan-pro"
45
+ * interval="monthly"
46
+ * authToken={authToken}
47
+ * userId={userId}
48
+ * autoCheckStatus
49
+ * onSuccess={(txId) => console.log('Subscribed!', txId)}
50
+ * />
51
+ * ```
52
+ */
53
+ export declare function CreditsSubscribeButton({ resource, interval, intervalDays, authToken, userId, couponCode, label, disabled, onAttempt, onSuccess, onError, className, hideMessages, autoCheckStatus, }: CreditsSubscribeButtonProps): import("react/jsx-runtime").JSX.Element;
54
+ export {};
55
+ //# sourceMappingURL=CreditsSubscribeButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreditsSubscribeButton.d.ts","sourceRoot":"","sources":["../../src/components/CreditsSubscribeButton.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE/D;;GAEG;AACH,UAAU,2BAA2B;IACnC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MA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;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,SAAc,EACd,WAAW,EACX,YAAoB,EACpB,QAAQ,EACR,UAAU,GACX,EAAE,iBAAiB,2CAwgBnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"CryptoSubscribeButton.d.ts","sourceRoot":"","sources":["../../src/components/CryptoSubscribeButton.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,UAAU,0BAA0B;IAClC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,KAAK,IAAI,CAAC;IAClD,0CAA0C;IAC1C,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,KAAK,EACL,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,SAAc,EACd,WAAW,EACX,YAAoB,EACpB,eAAsB,GACvB,EAAE,0BAA0B,2CAue5B"}
1
+ {"version":3,"file":"CryptoSubscribeButton.d.ts","sourceRoot":"","sources":["../../src/components/CryptoSubscribeButton.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,UAAU,0BAA0B;IAClC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,KAAK,IAAI,CAAC;IAClD,0CAA0C;IAC1C,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,KAAK,EACL,QAAgB,EAChB,SAAS,EACT,SAAS,EACT,OAAO,EACP,SAAc,EACd,WAAW,EACX,YAAoB,EACpB,eAAsB,GACvB,EAAE,0BAA0B,2CA4f5B"}
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { CartItem } from '../types';
2
+ import { CartItem, PaymentMethod } from '../types';
3
3
  export interface PaymentModalProps {
4
4
  isOpen: boolean;
5
5
  onClose: () => void;
@@ -7,20 +7,26 @@ export interface PaymentModalProps {
7
7
  items?: CartItem[];
8
8
  cardLabel?: string;
9
9
  cryptoLabel?: string;
10
+ creditsLabel?: string;
10
11
  showCard?: boolean;
11
12
  showCrypto?: boolean;
12
- onPaymentAttempt?: (method: 'stripe' | 'crypto') => void;
13
+ showCredits?: boolean;
14
+ onPaymentAttempt?: (method: PaymentMethod) => void;
13
15
  onPaymentSuccess?: (txId: string) => void;
14
16
  onPaymentError?: (error: string) => void;
15
17
  onStripeSuccess?: (txId: string) => void;
16
18
  onCryptoSuccess?: (txId: string) => void;
19
+ onCreditsSuccess?: (txId: string) => void;
17
20
  onStripeError?: (error: string) => void;
18
21
  onCryptoError?: (error: string) => void;
22
+ onCreditsError?: (error: string) => void;
19
23
  customerEmail?: string;
20
24
  successUrl?: string;
21
25
  cancelUrl?: string;
22
26
  metadata?: Record<string, string>;
23
27
  couponCode?: string;
28
+ /** JWT token from cedros-login for credits payment authentication */
29
+ authToken?: string;
24
30
  testPageUrl?: string;
25
31
  hideMessages?: boolean;
26
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentModal.d.ts","sourceRoot":"","sources":["../../src/components/PaymentModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAKzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,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ACpB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+KpD,CAAC"}
@@ -1,25 +1,31 @@
1
1
  import { default as React } from 'react';
2
- import { CartItem } from '../types';
2
+ import { CartItem, PaymentMethod } from '../types';
3
3
  export interface PurchaseButtonProps {
4
4
  resource?: string;
5
5
  items?: CartItem[];
6
6
  label?: string;
7
7
  cardLabel?: string;
8
8
  cryptoLabel?: string;
9
+ creditsLabel?: string;
9
10
  showCard?: boolean;
10
11
  showCrypto?: boolean;
11
- onPaymentAttempt?: (method: 'stripe' | 'crypto') => void;
12
+ showCredits?: boolean;
13
+ onPaymentAttempt?: (method: PaymentMethod) => void;
12
14
  onPaymentSuccess?: (txId: string) => void;
13
15
  onPaymentError?: (error: string) => void;
14
16
  onStripeSuccess?: (txId: string) => void;
15
17
  onCryptoSuccess?: (txId: string) => void;
18
+ onCreditsSuccess?: (txId: string) => void;
16
19
  onStripeError?: (error: string) => void;
17
20
  onCryptoError?: (error: string) => void;
21
+ onCreditsError?: (error: string) => void;
18
22
  customerEmail?: string;
19
23
  successUrl?: string;
20
24
  cancelUrl?: string;
21
25
  metadata?: Record<string, string>;
22
26
  couponCode?: string;
27
+ /** JWT token from cedros-login for credits payment authentication */
28
+ authToken?: string;
23
29
  autoDetectWallets?: boolean;
24
30
  testPageUrl?: string;
25
31
  hideMessages?: boolean;
@@ -30,20 +36,25 @@ export interface PurchaseButtonProps {
30
36
  items?: CartItem[];
31
37
  cardLabel?: string;
32
38
  cryptoLabel?: string;
39
+ creditsLabel?: string;
33
40
  showCard?: boolean;
34
41
  showCrypto?: boolean;
35
- onPaymentAttempt?: (method: 'stripe' | 'crypto') => void;
42
+ showCredits?: boolean;
43
+ onPaymentAttempt?: (method: PaymentMethod) => void;
36
44
  onPaymentSuccess?: (txId: string) => void;
37
45
  onPaymentError?: (error: string) => void;
38
46
  onStripeSuccess?: (txId: string) => void;
39
47
  onCryptoSuccess?: (txId: string) => void;
48
+ onCreditsSuccess?: (txId: string) => void;
40
49
  onStripeError?: (error: string) => void;
41
50
  onCryptoError?: (error: string) => void;
51
+ onCreditsError?: (error: string) => void;
42
52
  customerEmail?: string;
43
53
  successUrl?: string;
44
54
  cancelUrl?: string;
45
55
  metadata?: Record<string, string>;
46
56
  couponCode?: string;
57
+ authToken?: string;
47
58
  testPageUrl?: string;
48
59
  hideMessages?: boolean;
49
60
  }) => React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"PurchaseButton.d.ts","sourceRoot":"","sources":["../../src/components/PurchaseButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAc9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,KAAK,IAAI,CAAC;IACzD,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,a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,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAC1C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACzC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACzC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACzC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAC1C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACxC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACxC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACzC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,KAAK,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA8MxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionManagementPanel.d.ts","sourceRoot":"","sources":["../../src/components/SubscriptionManagementPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AAQvE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;IACjC,yDAAyD;IACzD,qBAAqB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,KAAK,IAAI,CAAC;IACpF,6CAA6C;IAC7C,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,oCAAoC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAmED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,QAAQ,EACR,MAAM,EACN,cAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAyB,EACzB,SAAS,EACT,KAAK,GACN,EAAE,gCAAgC,2CA2LlC"}
1
+ {"version":3,"file":"SubscriptionManagementPanel.d.ts","sourceRoot":"","sources":["../../src/components/SubscriptionManagementPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AAQvE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;IACjC,yDAAyD;IACzD,qBAAqB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,KAAK,IAAI,CAAC;IACpF,6CAA6C;IAC7C,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,oCAAoC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAqED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,QAAQ,EACR,MAAM,EACN,cAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAyB,EACzB,SAAS,EACT,KAAK,GACN,EAAE,gCAAgC,2CA+LlC"}
@@ -0,0 +1,3 @@
1
+ import { SectionProps } from './types';
2
+ export declare function AISettingsSection({ serverUrl, apiKey, authManager }: SectionProps): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=AISettingsSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AISettingsSection.d.ts","sourceRoot":"","sources":["../../../src/components/admin/AISettingsSection.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EACV,YAAY,EAMb,MAAM,SAAS,CAAC;AAgHjB,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,YAAY,2CAogBjF"}