@cedros/pay-react 1.1.18 → 1.1.20

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 (710) hide show
  1. package/dist/{AISettingsSection-CD9IRyR1.mjs → AISettingsSection-BH-RXvk1.mjs} +10 -10
  2. package/dist/{AISettingsSection-C-thWh51.js → AISettingsSection-f5K0nUoQ.js} +1 -1
  3. package/dist/{AutosaveIndicator-DxemlKnX.js → AutosaveIndicator-CpTVtJIz.js} +1 -1
  4. package/dist/{AutosaveIndicator-G2CRN8hH.mjs → AutosaveIndicator-DTOaopUP.mjs} +1 -1
  5. package/dist/{CedrosContext-BnJ2Cf7R.mjs → CedrosContext-BE6P5PQ0.mjs} +241 -245
  6. package/dist/{CedrosContext-C26DlvLF.js → CedrosContext-D-lnoEkR.js} +3 -3
  7. package/dist/{CryptoButton-BdOtL7w-.mjs → CryptoButton-CksMkZjL.mjs} +48 -48
  8. package/dist/CryptoButton-Dy-g3bR0.js +1 -0
  9. package/dist/{FAQSection-CyYK9OAN.mjs → FAQSection-BO7ZfQMN.mjs} +4 -4
  10. package/dist/{FAQSection-_pm1ekTe.js → FAQSection-CVJ5w6cB.js} +1 -1
  11. package/dist/{MessagingSection-BHzf1Mhu.js → MessagingSection-CRFtSoE8.js} +1 -1
  12. package/dist/{MessagingSection-DO2yPTvs.mjs → MessagingSection-CmFYFdaw.mjs} +5 -5
  13. package/dist/{PaymentSettingsSection-DpENgoca.js → PaymentSettingsSection-BKDiep-C.js} +1 -1
  14. package/dist/{PaymentSettingsSection--Aqlne1F.mjs → PaymentSettingsSection-VDcgpOkp.mjs} +1 -1
  15. package/dist/{SettingsSection-CGKKGXWz.mjs → SettingsSection-B0TpaIOG.mjs} +1 -1
  16. package/dist/{SettingsSection-DNoODw7i.js → SettingsSection-DSlW47o4.js} +1 -1
  17. package/dist/SingleCategorySettings-BTXR7zex.js +3 -0
  18. package/dist/{SingleCategorySettings-8DCtLcow.mjs → SingleCategorySettings-Cwlehl0u.mjs} +62 -69
  19. package/dist/{StorefrontSection-Mzr1H51w.mjs → StorefrontSection-BAY9V1j6.mjs} +8 -8
  20. package/dist/{StorefrontSection-BEOMtSAg.js → StorefrontSection-DfN5yxkV.js} +1 -1
  21. package/dist/{SubscriptionsSection-4b29i-41.js → SubscriptionsSection-BboudRYv.js} +1 -1
  22. package/dist/{SubscriptionsSection-Dy1e15fe.mjs → SubscriptionsSection-D_RKCILr.mjs} +6 -6
  23. package/dist/{WalletManager-HXXyARQ7.mjs → WalletManager-D78miaJ2.mjs} +1 -1
  24. package/dist/{WalletManager-D6BYTwXn.js → WalletManager-QcfgQmap.js} +1 -1
  25. package/dist/crypto-only.d.ts +2 -23
  26. package/dist/crypto-only.js +1 -1
  27. package/dist/crypto-only.mjs +64 -63
  28. package/dist/{index-bbSf3B7-.mjs → index-75RhiLDq.mjs} +7192 -9782
  29. package/dist/index-B5ck27xb.js +84 -0
  30. package/dist/index.d.ts +2 -45
  31. package/dist/index.js +1 -1
  32. package/dist/index.mjs +64 -63
  33. package/dist/pay-react.css +1 -1
  34. package/dist/sections-BCdzdqlG.js +1 -0
  35. package/dist/sections-BIBMX6KS.mjs +8 -0
  36. package/dist/src/admin/index.d.ts.map +1 -0
  37. package/dist/src/admin/plugin.d.ts.map +1 -0
  38. package/dist/src/admin/types.d.ts.map +1 -0
  39. package/dist/src/components/CedrosPay.d.ts.map +1 -0
  40. package/dist/src/components/CreditsButton.d.ts.map +1 -0
  41. package/dist/src/components/CreditsSubscribeButton.d.ts.map +1 -0
  42. package/dist/src/components/CryptoButton.d.ts.map +1 -0
  43. package/dist/src/components/CryptoSubscribeButton.d.ts.map +1 -0
  44. package/dist/src/components/PaymentModal.d.ts.map +1 -0
  45. package/dist/src/components/ProductPrice.d.ts.map +1 -0
  46. package/dist/src/components/PurchaseButton.d.ts.map +1 -0
  47. package/dist/src/components/StripeButton.d.ts.map +1 -0
  48. package/dist/src/components/SubscribeButton.d.ts.map +1 -0
  49. package/dist/src/components/SubscriptionManagementPanel.d.ts.map +1 -0
  50. package/dist/src/components/admin/AISettingsSection.d.ts.map +1 -0
  51. package/dist/src/components/admin/AdminAuthManager.d.ts.map +1 -0
  52. package/dist/src/components/admin/AutosaveIndicator.d.ts.map +1 -0
  53. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +1 -0
  54. package/dist/src/components/admin/ConfigEditor.d.ts.map +1 -0
  55. package/dist/src/components/admin/CouponsSection.d.ts.map +1 -0
  56. package/dist/src/components/admin/Dropdown.d.ts.map +1 -0
  57. package/dist/src/components/admin/ErrorBanner.d.ts.map +1 -0
  58. package/dist/src/components/admin/FAQSection.d.ts.map +1 -0
  59. package/dist/src/components/admin/MessagingSection.d.ts.map +1 -0
  60. package/dist/src/components/admin/OverviewSection.d.ts.map +1 -0
  61. package/dist/src/components/admin/PaymentSettingsSection.d.ts.map +1 -0
  62. package/dist/src/components/admin/ProductVariationsEditor.d.ts.map +1 -0
  63. package/dist/src/components/admin/ProductsSection.d.ts.map +1 -0
  64. package/dist/src/components/admin/RefundsSection.d.ts.map +1 -0
  65. package/dist/src/components/admin/SecretArrayEditor.d.ts.map +1 -0
  66. package/dist/src/components/admin/SettingsSection.d.ts.map +1 -0
  67. package/dist/src/components/admin/SingleCategorySettings.d.ts.map +1 -0
  68. package/dist/src/components/admin/StatsBar.d.ts.map +1 -0
  69. package/dist/src/components/admin/StorefrontSection.d.ts.map +1 -0
  70. package/dist/src/components/admin/SubscriptionsSection.d.ts.map +1 -0
  71. package/dist/src/components/admin/Toggle.d.ts.map +1 -0
  72. package/dist/{components → src/components}/admin/TokenMintSelector.d.ts +1 -1
  73. package/dist/src/components/admin/TokenMintSelector.d.ts.map +1 -0
  74. package/dist/src/components/admin/TransactionsSection.d.ts.map +1 -0
  75. package/dist/src/components/admin/VariantInventoryGrid.d.ts.map +1 -0
  76. package/dist/src/components/admin/VariationTypeEditor.d.ts.map +1 -0
  77. package/dist/src/components/admin/configApi.d.ts.map +1 -0
  78. package/dist/src/components/admin/icons.d.ts.map +1 -0
  79. package/dist/{components → src/components}/admin/index.d.ts +1 -1
  80. package/dist/src/components/admin/index.d.ts.map +1 -0
  81. package/dist/src/components/admin/sections-more.d.ts.map +1 -0
  82. package/dist/src/components/admin/sections.d.ts.map +1 -0
  83. package/dist/src/components/admin/types.d.ts.map +1 -0
  84. package/dist/{components → src/components}/admin/useAdminAuth.d.ts +11 -23
  85. package/dist/src/components/admin/useAdminAuth.d.ts.map +1 -0
  86. package/dist/src/components/admin/useAutosave.d.ts.map +1 -0
  87. package/dist/src/components/admin/useProductVariations.d.ts.map +1 -0
  88. package/dist/src/components/subscriptionPanelStyles.d.ts.map +1 -0
  89. package/dist/src/context/CedrosContext.d.ts.map +1 -0
  90. package/dist/src/context/ThemeContext.d.ts.map +1 -0
  91. package/dist/src/context/index.d.ts.map +1 -0
  92. package/dist/src/crypto-only.d.ts +23 -0
  93. package/dist/src/crypto-only.d.ts.map +1 -0
  94. package/dist/src/ecommerce/__tests__/cartCheckoutRequirements.test.d.ts.map +1 -0
  95. package/dist/src/ecommerce/__tests__/cartProviderPersistence.test.d.ts.map +1 -0
  96. package/dist/src/ecommerce/__tests__/cartReducer.test.d.ts.map +1 -0
  97. package/dist/src/ecommerce/__tests__/cartServerMerge.test.d.ts.map +1 -0
  98. package/dist/src/ecommerce/__tests__/checkoutPaymentMethods.test.d.ts.map +1 -0
  99. package/dist/src/ecommerce/__tests__/checkoutReturn.test.d.ts.map +1 -0
  100. package/dist/src/ecommerce/__tests__/checkoutSchema.test.d.ts.map +1 -0
  101. package/dist/src/ecommerce/__tests__/inventoryHooks.test.d.ts.map +1 -0
  102. package/dist/src/ecommerce/__tests__/mockAdapter.test.d.ts.map +1 -0
  103. package/dist/src/ecommerce/__tests__/storage.test.d.ts.map +1 -0
  104. package/dist/src/ecommerce/adapters/CommerceAdapter.d.ts.map +1 -0
  105. package/dist/src/ecommerce/adapters/mock/mockAdapter.d.ts.map +1 -0
  106. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +1 -0
  107. package/dist/src/ecommerce/adapters/paywall/paywallAdapter.test.d.ts.map +1 -0
  108. package/dist/src/ecommerce/components/cart/CartLineItem.d.ts.map +1 -0
  109. package/dist/src/ecommerce/components/cart/CartPageContent.d.ts.map +1 -0
  110. package/dist/src/ecommerce/components/cart/CartPanel.d.ts.map +1 -0
  111. package/dist/src/ecommerce/components/cart/CartSidebar.d.ts.map +1 -0
  112. package/dist/src/ecommerce/components/cart/CartSummary.d.ts.map +1 -0
  113. package/dist/src/ecommerce/components/cart/PromoCodeInput.d.ts.map +1 -0
  114. package/dist/src/ecommerce/components/catalog/Breadcrumbs.d.ts.map +1 -0
  115. package/dist/src/ecommerce/components/catalog/CategoryNav.d.ts.map +1 -0
  116. package/dist/src/ecommerce/components/catalog/FilterPanel.d.ts.map +1 -0
  117. package/dist/src/ecommerce/components/catalog/Price.d.ts.map +1 -0
  118. package/dist/src/ecommerce/components/catalog/ProductCard.d.ts.map +1 -0
  119. package/dist/src/ecommerce/components/catalog/ProductGallery.d.ts.map +1 -0
  120. package/dist/src/ecommerce/components/catalog/ProductGrid.d.ts.map +1 -0
  121. package/dist/src/ecommerce/components/catalog/QuantitySelector.d.ts.map +1 -0
  122. package/dist/src/ecommerce/components/catalog/QuickViewDialog.d.ts.map +1 -0
  123. package/dist/src/ecommerce/components/catalog/SearchInput.d.ts.map +1 -0
  124. package/dist/src/ecommerce/components/catalog/VariantSelector.d.ts.map +1 -0
  125. package/dist/src/ecommerce/components/chat/ShopChatPanel.d.ts.map +1 -0
  126. package/dist/src/ecommerce/components/checkout/AddressForm.d.ts.map +1 -0
  127. package/dist/src/ecommerce/components/checkout/CheckoutCancelPage.d.ts.map +1 -0
  128. package/dist/src/ecommerce/components/checkout/CheckoutForm.d.ts.map +1 -0
  129. package/dist/src/ecommerce/components/checkout/CheckoutLayout.d.ts.map +1 -0
  130. package/dist/src/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +1 -0
  131. package/dist/src/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +1 -0
  132. package/dist/src/ecommerce/components/checkout/InventoryVerificationDialog.d.ts.map +1 -0
  133. package/dist/src/ecommerce/components/checkout/OrderReview.d.ts.map +1 -0
  134. package/dist/src/ecommerce/components/checkout/PaymentStep.d.ts.map +1 -0
  135. package/dist/src/ecommerce/components/checkout/ShippingMethodSelector.d.ts.map +1 -0
  136. package/dist/src/ecommerce/components/faq/FAQItem.d.ts.map +1 -0
  137. package/dist/src/ecommerce/components/faq/FAQItem.test.d.ts.map +1 -0
  138. package/dist/src/ecommerce/components/faq/FAQList.d.ts.map +1 -0
  139. package/dist/src/ecommerce/components/faq/index.d.ts.map +1 -0
  140. package/dist/src/ecommerce/components/general/EmptyState.d.ts.map +1 -0
  141. package/dist/src/ecommerce/components/general/ErrorBoundary.d.ts.map +1 -0
  142. package/dist/src/ecommerce/components/general/ErrorState.d.ts.map +1 -0
  143. package/dist/src/ecommerce/components/general/toast.d.ts.map +1 -0
  144. package/dist/src/ecommerce/components/orders/OrderCard.d.ts.map +1 -0
  145. package/dist/src/ecommerce/components/orders/OrderDetails.d.ts.map +1 -0
  146. package/dist/src/ecommerce/components/orders/OrderList.d.ts.map +1 -0
  147. package/dist/src/ecommerce/components/ui/accordion.d.ts.map +1 -0
  148. package/dist/src/ecommerce/components/ui/badge.d.ts.map +1 -0
  149. package/dist/src/ecommerce/components/ui/button.d.ts.map +1 -0
  150. package/dist/src/ecommerce/components/ui/card.d.ts.map +1 -0
  151. package/dist/src/ecommerce/components/ui/dialog.d.ts.map +1 -0
  152. package/dist/src/ecommerce/components/ui/input.d.ts.map +1 -0
  153. package/dist/src/ecommerce/components/ui/label.d.ts.map +1 -0
  154. package/dist/src/ecommerce/components/ui/select.d.ts.map +1 -0
  155. package/dist/src/ecommerce/components/ui/separator.d.ts.map +1 -0
  156. package/dist/src/ecommerce/components/ui/sheet.d.ts.map +1 -0
  157. package/dist/src/ecommerce/components/ui/skeleton.d.ts.map +1 -0
  158. package/dist/src/ecommerce/components/ui/tabs.d.ts.map +1 -0
  159. package/dist/src/ecommerce/components/ui/textarea.d.ts.map +1 -0
  160. package/dist/src/ecommerce/config/context.d.ts.map +1 -0
  161. package/dist/src/ecommerce/config/types.d.ts.map +1 -0
  162. package/dist/src/ecommerce/hooks/checkoutReturn.d.ts.map +1 -0
  163. package/dist/src/ecommerce/hooks/useAIRelatedProducts.d.ts.map +1 -0
  164. package/dist/src/ecommerce/hooks/useCartInventory.d.ts.map +1 -0
  165. package/dist/src/ecommerce/hooks/useCatalogUrlState.d.ts.map +1 -0
  166. package/dist/src/ecommerce/hooks/useCategories.d.ts.map +1 -0
  167. package/dist/src/ecommerce/hooks/useCheckoutResultFromUrl.d.ts.map +1 -0
  168. package/dist/src/ecommerce/hooks/useHoldExpiry.d.ts.map +1 -0
  169. package/dist/src/ecommerce/hooks/useInventoryVerification.d.ts.map +1 -0
  170. package/dist/src/ecommerce/hooks/useOrders.d.ts.map +1 -0
  171. package/dist/src/ecommerce/hooks/usePaymentMethodsConfig.d.ts.map +1 -0
  172. package/dist/src/ecommerce/hooks/useProduct.d.ts.map +1 -0
  173. package/dist/src/ecommerce/hooks/useProducts.d.ts.map +1 -0
  174. package/dist/src/ecommerce/hooks/useShippingMethods.d.ts.map +1 -0
  175. package/dist/src/ecommerce/hooks/useStorefrontSettings.d.ts.map +1 -0
  176. package/dist/src/ecommerce/hooks/useSubscriptionData.d.ts.map +1 -0
  177. package/dist/src/ecommerce/index.d.ts.map +1 -0
  178. package/dist/src/ecommerce/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts.map +1 -0
  179. package/dist/src/ecommerce/state/cart/CartProvider.d.ts.map +1 -0
  180. package/dist/src/ecommerce/state/cart/cartReducer.d.ts.map +1 -0
  181. package/dist/src/ecommerce/state/checkout/checkoutSchema.d.ts.map +1 -0
  182. package/dist/src/ecommerce/state/checkout/useCheckout.d.ts.map +1 -0
  183. package/dist/src/ecommerce/templates/CartTemplate.d.ts.map +1 -0
  184. package/dist/src/ecommerce/templates/CategoryTemplate.d.ts.map +1 -0
  185. package/dist/src/ecommerce/templates/CheckoutTemplate.d.ts.map +1 -0
  186. package/dist/src/ecommerce/templates/ProductTemplate.d.ts.map +1 -0
  187. package/dist/src/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +1 -0
  188. package/dist/src/ecommerce/templates/ReceiptTemplate.d.ts.map +1 -0
  189. package/dist/src/ecommerce/templates/ShopTemplate.d.ts.map +1 -0
  190. package/dist/src/ecommerce/templates/SubscriptionTemplate.d.ts.map +1 -0
  191. package/dist/src/ecommerce/testing/adapterContract.d.ts.map +1 -0
  192. package/dist/src/ecommerce/types.d.ts.map +1 -0
  193. package/dist/src/ecommerce/utils/cartCheckoutRequirements.d.ts.map +1 -0
  194. package/dist/src/ecommerce/utils/cartItemMetadata.d.ts.map +1 -0
  195. package/dist/src/ecommerce/utils/cn.d.ts.map +1 -0
  196. package/dist/src/ecommerce/utils/money.d.ts.map +1 -0
  197. package/dist/src/ecommerce/utils/storage.d.ts.map +1 -0
  198. package/dist/src/hooks/useCreditsPayment.d.ts.map +1 -0
  199. package/dist/src/hooks/useCreditsSubscription.d.ts.map +1 -0
  200. package/dist/src/hooks/useCryptoSubscription.d.ts.map +1 -0
  201. package/dist/src/hooks/usePaymentMode.d.ts.map +1 -0
  202. package/dist/src/hooks/useRefundVerification.d.ts.map +1 -0
  203. package/dist/src/hooks/useStripeCheckout.d.ts.map +1 -0
  204. package/dist/src/hooks/useSubscription.d.ts.map +1 -0
  205. package/dist/src/hooks/useSubscriptionManagement.d.ts.map +1 -0
  206. package/dist/src/hooks/useX402Payment.d.ts.map +1 -0
  207. package/dist/src/i18n/index.d.ts.map +1 -0
  208. package/dist/src/i18n/useTranslation.d.ts.map +1 -0
  209. package/dist/src/index.d.ts +45 -0
  210. package/dist/src/index.d.ts.map +1 -0
  211. package/dist/src/managers/CreditsManager.d.ts.map +1 -0
  212. package/dist/src/managers/ManagerCache.d.ts.map +1 -0
  213. package/dist/src/managers/RouteDiscoveryManager.d.ts +6 -0
  214. package/dist/src/managers/RouteDiscoveryManager.d.ts.map +1 -0
  215. package/dist/src/managers/StripeManager.d.ts.map +1 -0
  216. package/dist/src/managers/SubscriptionChangeManager.d.ts.map +1 -0
  217. package/dist/src/managers/SubscriptionManager.d.ts.map +1 -0
  218. package/dist/src/managers/WalletManager.d.ts.map +1 -0
  219. package/dist/src/managers/X402Manager.d.ts.map +1 -0
  220. package/dist/src/stripe-only.d.ts +49 -0
  221. package/dist/src/stripe-only.d.ts.map +1 -0
  222. package/dist/src/telemetry.d.ts +27 -0
  223. package/dist/src/telemetry.d.ts.map +1 -0
  224. package/dist/src/testing/__tests__/providers.test.d.ts.map +1 -0
  225. package/dist/src/testing/helpers.d.ts.map +1 -0
  226. package/dist/src/testing/index.d.ts +12 -0
  227. package/dist/src/testing/index.d.ts.map +1 -0
  228. package/dist/src/testing/mocks.d.ts.map +1 -0
  229. package/dist/src/testing/providers.d.ts.map +1 -0
  230. package/dist/src/types/componentOptions.d.ts.map +1 -0
  231. package/dist/src/types/errors.d.ts.map +1 -0
  232. package/dist/src/types/index.d.ts.map +1 -0
  233. package/dist/src/types/subscription.d.ts.map +1 -0
  234. package/dist/src/utils/__tests__/couponHelpers.test.d.ts.map +1 -0
  235. package/dist/src/utils/__tests__/cspHelper.test.d.ts.map +1 -0
  236. package/dist/src/utils/__tests__/fetchWithTimeout.test.d.ts.map +1 -0
  237. package/dist/src/utils/cartHelpers.d.ts.map +1 -0
  238. package/dist/src/utils/circuitBreaker.d.ts.map +1 -0
  239. package/dist/src/utils/couponHelpers.d.ts.map +1 -0
  240. package/dist/src/utils/cspHelper.d.ts.map +1 -0
  241. package/dist/src/utils/csvHelpers.d.ts.map +1 -0
  242. package/dist/src/utils/csvHelpers.test.d.ts.map +1 -0
  243. package/dist/src/utils/dateHelpers.d.ts.map +1 -0
  244. package/dist/src/utils/deprecation.d.ts.map +1 -0
  245. package/dist/src/utils/errorHandling.d.ts.map +1 -0
  246. package/dist/src/utils/errorMessages.d.ts.map +1 -0
  247. package/dist/src/utils/errorParser.d.ts.map +1 -0
  248. package/dist/src/utils/eventEmitter.d.ts.map +1 -0
  249. package/dist/src/utils/exponentialBackoff.d.ts.map +1 -0
  250. package/dist/src/utils/fetchWithTimeout.d.ts.map +1 -0
  251. package/dist/src/utils/index.d.ts.map +1 -0
  252. package/dist/src/utils/logger.d.ts.map +1 -0
  253. package/dist/src/utils/modalStyles.d.ts.map +1 -0
  254. package/dist/src/utils/rateLimiter.d.ts.map +1 -0
  255. package/dist/src/utils/requestDeduplication.d.ts.map +1 -0
  256. package/dist/src/utils/securityValidation.d.ts.map +1 -0
  257. package/dist/src/utils/solanaCheck.d.ts.map +1 -0
  258. package/dist/src/utils/telemetry.d.ts.map +1 -0
  259. package/dist/src/utils/tokenMintValidator.d.ts.map +1 -0
  260. package/dist/src/utils/uuid.d.ts.map +1 -0
  261. package/dist/src/utils/validateConfig.d.ts.map +1 -0
  262. package/dist/src/utils/walletDetection.d.ts.map +1 -0
  263. package/dist/src/utils/walletPool.d.ts.map +1 -0
  264. package/dist/stripe-only.d.ts +2 -14
  265. package/dist/stripe-only.js +1 -1
  266. package/dist/stripe-only.mjs +59 -62
  267. package/dist/styles--eKKnfdj.mjs +2578 -0
  268. package/dist/styles-BWrLnaUW.js +1 -0
  269. package/dist/telemetry.d.ts +2 -27
  270. package/dist/testing/index.d.ts +2 -12
  271. package/dist/testing/index.js +1 -1
  272. package/dist/testing/index.mjs +1 -1
  273. package/dist/{walletPool-DjA7J3a9.js → walletPool-BqNfOhB0.js} +1 -1
  274. package/dist/{walletPool-BV_z1lEA.mjs → walletPool-DShNjCQ6.mjs} +1 -1
  275. package/package.json +8 -3
  276. package/dist/CryptoButton-N8kRfNDO.js +0 -1
  277. package/dist/SingleCategorySettings-NLBYxM0O.js +0 -3
  278. package/dist/admin/index.d.ts.map +0 -1
  279. package/dist/admin/plugin.d.ts.map +0 -1
  280. package/dist/admin/types.d.ts.map +0 -1
  281. package/dist/components/CedrosPay.d.ts.map +0 -1
  282. package/dist/components/CreditsButton.d.ts.map +0 -1
  283. package/dist/components/CreditsSubscribeButton.d.ts.map +0 -1
  284. package/dist/components/CryptoButton.d.ts.map +0 -1
  285. package/dist/components/CryptoSubscribeButton.d.ts.map +0 -1
  286. package/dist/components/PaymentModal.d.ts.map +0 -1
  287. package/dist/components/ProductPrice.d.ts.map +0 -1
  288. package/dist/components/PurchaseButton.d.ts.map +0 -1
  289. package/dist/components/StripeButton.d.ts.map +0 -1
  290. package/dist/components/SubscribeButton.d.ts.map +0 -1
  291. package/dist/components/SubscriptionManagementPanel.d.ts.map +0 -1
  292. package/dist/components/admin/AISettingsSection.d.ts.map +0 -1
  293. package/dist/components/admin/AdminAuthManager.d.ts.map +0 -1
  294. package/dist/components/admin/AutosaveIndicator.d.ts.map +0 -1
  295. package/dist/components/admin/CedrosPayAdminDashboard.d.ts.map +0 -1
  296. package/dist/components/admin/ConfigEditor.d.ts.map +0 -1
  297. package/dist/components/admin/CouponsSection.d.ts.map +0 -1
  298. package/dist/components/admin/Dropdown.d.ts.map +0 -1
  299. package/dist/components/admin/ErrorBanner.d.ts.map +0 -1
  300. package/dist/components/admin/FAQSection.d.ts.map +0 -1
  301. package/dist/components/admin/MessagingSection.d.ts.map +0 -1
  302. package/dist/components/admin/OverviewSection.d.ts.map +0 -1
  303. package/dist/components/admin/PaymentSettingsSection.d.ts.map +0 -1
  304. package/dist/components/admin/ProductVariationsEditor.d.ts.map +0 -1
  305. package/dist/components/admin/ProductsSection.d.ts.map +0 -1
  306. package/dist/components/admin/RefundsSection.d.ts.map +0 -1
  307. package/dist/components/admin/SecretArrayEditor.d.ts.map +0 -1
  308. package/dist/components/admin/SettingsSection.d.ts.map +0 -1
  309. package/dist/components/admin/SingleCategorySettings.d.ts.map +0 -1
  310. package/dist/components/admin/StatsBar.d.ts.map +0 -1
  311. package/dist/components/admin/StorefrontSection.d.ts.map +0 -1
  312. package/dist/components/admin/SubscriptionsSection.d.ts.map +0 -1
  313. package/dist/components/admin/Toggle.d.ts.map +0 -1
  314. package/dist/components/admin/TokenMintSelector.d.ts.map +0 -1
  315. package/dist/components/admin/TransactionsSection.d.ts.map +0 -1
  316. package/dist/components/admin/VariantInventoryGrid.d.ts.map +0 -1
  317. package/dist/components/admin/VariationTypeEditor.d.ts.map +0 -1
  318. package/dist/components/admin/configApi.d.ts.map +0 -1
  319. package/dist/components/admin/icons.d.ts.map +0 -1
  320. package/dist/components/admin/index.d.ts.map +0 -1
  321. package/dist/components/admin/sections-more.d.ts.map +0 -1
  322. package/dist/components/admin/sections.d.ts.map +0 -1
  323. package/dist/components/admin/types.d.ts.map +0 -1
  324. package/dist/components/admin/useAdminAuth.d.ts.map +0 -1
  325. package/dist/components/admin/useAutosave.d.ts.map +0 -1
  326. package/dist/components/admin/useProductVariations.d.ts.map +0 -1
  327. package/dist/components/subscriptionPanelStyles.d.ts.map +0 -1
  328. package/dist/context/CedrosContext.d.ts.map +0 -1
  329. package/dist/context/ThemeContext.d.ts.map +0 -1
  330. package/dist/context/index.d.ts.map +0 -1
  331. package/dist/crypto-only.d.ts.map +0 -1
  332. package/dist/ecommerce/__tests__/cartCheckoutRequirements.test.d.ts.map +0 -1
  333. package/dist/ecommerce/__tests__/cartProviderPersistence.test.d.ts.map +0 -1
  334. package/dist/ecommerce/__tests__/cartReducer.test.d.ts.map +0 -1
  335. package/dist/ecommerce/__tests__/cartServerMerge.test.d.ts.map +0 -1
  336. package/dist/ecommerce/__tests__/checkoutPaymentMethods.test.d.ts.map +0 -1
  337. package/dist/ecommerce/__tests__/checkoutReturn.test.d.ts.map +0 -1
  338. package/dist/ecommerce/__tests__/checkoutSchema.test.d.ts.map +0 -1
  339. package/dist/ecommerce/__tests__/inventoryHooks.test.d.ts.map +0 -1
  340. package/dist/ecommerce/__tests__/mockAdapter.test.d.ts.map +0 -1
  341. package/dist/ecommerce/__tests__/storage.test.d.ts.map +0 -1
  342. package/dist/ecommerce/adapters/CommerceAdapter.d.ts.map +0 -1
  343. package/dist/ecommerce/adapters/mock/mockAdapter.d.ts.map +0 -1
  344. package/dist/ecommerce/adapters/paywall/paywallAdapter.d.ts.map +0 -1
  345. package/dist/ecommerce/adapters/paywall/paywallAdapter.test.d.ts.map +0 -1
  346. package/dist/ecommerce/components/cart/CartLineItem.d.ts.map +0 -1
  347. package/dist/ecommerce/components/cart/CartPageContent.d.ts.map +0 -1
  348. package/dist/ecommerce/components/cart/CartPanel.d.ts.map +0 -1
  349. package/dist/ecommerce/components/cart/CartSidebar.d.ts.map +0 -1
  350. package/dist/ecommerce/components/cart/CartSummary.d.ts.map +0 -1
  351. package/dist/ecommerce/components/cart/PromoCodeInput.d.ts.map +0 -1
  352. package/dist/ecommerce/components/catalog/Breadcrumbs.d.ts.map +0 -1
  353. package/dist/ecommerce/components/catalog/CategoryNav.d.ts.map +0 -1
  354. package/dist/ecommerce/components/catalog/FilterPanel.d.ts.map +0 -1
  355. package/dist/ecommerce/components/catalog/Price.d.ts.map +0 -1
  356. package/dist/ecommerce/components/catalog/ProductCard.d.ts.map +0 -1
  357. package/dist/ecommerce/components/catalog/ProductGallery.d.ts.map +0 -1
  358. package/dist/ecommerce/components/catalog/ProductGrid.d.ts.map +0 -1
  359. package/dist/ecommerce/components/catalog/QuantitySelector.d.ts.map +0 -1
  360. package/dist/ecommerce/components/catalog/QuickViewDialog.d.ts.map +0 -1
  361. package/dist/ecommerce/components/catalog/SearchInput.d.ts.map +0 -1
  362. package/dist/ecommerce/components/catalog/VariantSelector.d.ts.map +0 -1
  363. package/dist/ecommerce/components/chat/ShopChatPanel.d.ts.map +0 -1
  364. package/dist/ecommerce/components/checkout/AddressForm.d.ts.map +0 -1
  365. package/dist/ecommerce/components/checkout/CheckoutCancelPage.d.ts.map +0 -1
  366. package/dist/ecommerce/components/checkout/CheckoutForm.d.ts.map +0 -1
  367. package/dist/ecommerce/components/checkout/CheckoutLayout.d.ts.map +0 -1
  368. package/dist/ecommerce/components/checkout/CheckoutReceipt.d.ts.map +0 -1
  369. package/dist/ecommerce/components/checkout/CheckoutSuccessPage.d.ts.map +0 -1
  370. package/dist/ecommerce/components/checkout/InventoryVerificationDialog.d.ts.map +0 -1
  371. package/dist/ecommerce/components/checkout/OrderReview.d.ts.map +0 -1
  372. package/dist/ecommerce/components/checkout/PaymentStep.d.ts.map +0 -1
  373. package/dist/ecommerce/components/checkout/ShippingMethodSelector.d.ts.map +0 -1
  374. package/dist/ecommerce/components/faq/FAQItem.d.ts.map +0 -1
  375. package/dist/ecommerce/components/faq/FAQItem.test.d.ts.map +0 -1
  376. package/dist/ecommerce/components/faq/FAQList.d.ts.map +0 -1
  377. package/dist/ecommerce/components/faq/index.d.ts.map +0 -1
  378. package/dist/ecommerce/components/general/EmptyState.d.ts.map +0 -1
  379. package/dist/ecommerce/components/general/ErrorBoundary.d.ts.map +0 -1
  380. package/dist/ecommerce/components/general/ErrorState.d.ts.map +0 -1
  381. package/dist/ecommerce/components/general/toast.d.ts.map +0 -1
  382. package/dist/ecommerce/components/orders/OrderCard.d.ts.map +0 -1
  383. package/dist/ecommerce/components/orders/OrderDetails.d.ts.map +0 -1
  384. package/dist/ecommerce/components/orders/OrderList.d.ts.map +0 -1
  385. package/dist/ecommerce/components/ui/accordion.d.ts.map +0 -1
  386. package/dist/ecommerce/components/ui/badge.d.ts.map +0 -1
  387. package/dist/ecommerce/components/ui/button.d.ts.map +0 -1
  388. package/dist/ecommerce/components/ui/card.d.ts.map +0 -1
  389. package/dist/ecommerce/components/ui/dialog.d.ts.map +0 -1
  390. package/dist/ecommerce/components/ui/input.d.ts.map +0 -1
  391. package/dist/ecommerce/components/ui/label.d.ts.map +0 -1
  392. package/dist/ecommerce/components/ui/select.d.ts.map +0 -1
  393. package/dist/ecommerce/components/ui/separator.d.ts.map +0 -1
  394. package/dist/ecommerce/components/ui/sheet.d.ts.map +0 -1
  395. package/dist/ecommerce/components/ui/skeleton.d.ts.map +0 -1
  396. package/dist/ecommerce/components/ui/tabs.d.ts.map +0 -1
  397. package/dist/ecommerce/components/ui/textarea.d.ts.map +0 -1
  398. package/dist/ecommerce/config/context.d.ts.map +0 -1
  399. package/dist/ecommerce/config/types.d.ts.map +0 -1
  400. package/dist/ecommerce/hooks/checkoutReturn.d.ts.map +0 -1
  401. package/dist/ecommerce/hooks/useAIRelatedProducts.d.ts.map +0 -1
  402. package/dist/ecommerce/hooks/useCartInventory.d.ts.map +0 -1
  403. package/dist/ecommerce/hooks/useCatalogUrlState.d.ts.map +0 -1
  404. package/dist/ecommerce/hooks/useCategories.d.ts.map +0 -1
  405. package/dist/ecommerce/hooks/useCheckoutResultFromUrl.d.ts.map +0 -1
  406. package/dist/ecommerce/hooks/useHoldExpiry.d.ts.map +0 -1
  407. package/dist/ecommerce/hooks/useInventoryVerification.d.ts.map +0 -1
  408. package/dist/ecommerce/hooks/useOrders.d.ts.map +0 -1
  409. package/dist/ecommerce/hooks/usePaymentMethodsConfig.d.ts.map +0 -1
  410. package/dist/ecommerce/hooks/useProduct.d.ts.map +0 -1
  411. package/dist/ecommerce/hooks/useProducts.d.ts.map +0 -1
  412. package/dist/ecommerce/hooks/useShippingMethods.d.ts.map +0 -1
  413. package/dist/ecommerce/hooks/useStorefrontSettings.d.ts.map +0 -1
  414. package/dist/ecommerce/hooks/useSubscriptionData.d.ts.map +0 -1
  415. package/dist/ecommerce/index.d.ts.map +0 -1
  416. package/dist/ecommerce/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts.map +0 -1
  417. package/dist/ecommerce/state/cart/CartProvider.d.ts.map +0 -1
  418. package/dist/ecommerce/state/cart/cartReducer.d.ts.map +0 -1
  419. package/dist/ecommerce/state/checkout/checkoutSchema.d.ts.map +0 -1
  420. package/dist/ecommerce/state/checkout/useCheckout.d.ts.map +0 -1
  421. package/dist/ecommerce/templates/CartTemplate.d.ts.map +0 -1
  422. package/dist/ecommerce/templates/CategoryTemplate.d.ts.map +0 -1
  423. package/dist/ecommerce/templates/CheckoutTemplate.d.ts.map +0 -1
  424. package/dist/ecommerce/templates/ProductTemplate.d.ts.map +0 -1
  425. package/dist/ecommerce/templates/PurchaseHistoryTemplate.d.ts.map +0 -1
  426. package/dist/ecommerce/templates/ReceiptTemplate.d.ts.map +0 -1
  427. package/dist/ecommerce/templates/ShopTemplate.d.ts.map +0 -1
  428. package/dist/ecommerce/templates/SubscriptionTemplate.d.ts.map +0 -1
  429. package/dist/ecommerce/testing/adapterContract.d.ts.map +0 -1
  430. package/dist/ecommerce/types.d.ts.map +0 -1
  431. package/dist/ecommerce/utils/cartCheckoutRequirements.d.ts.map +0 -1
  432. package/dist/ecommerce/utils/cartItemMetadata.d.ts.map +0 -1
  433. package/dist/ecommerce/utils/cn.d.ts.map +0 -1
  434. package/dist/ecommerce/utils/money.d.ts.map +0 -1
  435. package/dist/ecommerce/utils/storage.d.ts.map +0 -1
  436. package/dist/hooks/useCreditsPayment.d.ts.map +0 -1
  437. package/dist/hooks/useCreditsSubscription.d.ts.map +0 -1
  438. package/dist/hooks/useCryptoSubscription.d.ts.map +0 -1
  439. package/dist/hooks/usePaymentMode.d.ts.map +0 -1
  440. package/dist/hooks/useRefundVerification.d.ts.map +0 -1
  441. package/dist/hooks/useStripeCheckout.d.ts.map +0 -1
  442. package/dist/hooks/useSubscription.d.ts.map +0 -1
  443. package/dist/hooks/useSubscriptionManagement.d.ts.map +0 -1
  444. package/dist/hooks/useX402Payment.d.ts.map +0 -1
  445. package/dist/i18n/index.d.ts.map +0 -1
  446. package/dist/i18n/useTranslation.d.ts.map +0 -1
  447. package/dist/index-B-0trqeD.js +0 -84
  448. package/dist/index.d.ts.map +0 -1
  449. package/dist/managers/CreditsManager.d.ts.map +0 -1
  450. package/dist/managers/ManagerCache.d.ts.map +0 -1
  451. package/dist/managers/RouteDiscoveryManager.d.ts +0 -75
  452. package/dist/managers/RouteDiscoveryManager.d.ts.map +0 -1
  453. package/dist/managers/StripeManager.d.ts.map +0 -1
  454. package/dist/managers/SubscriptionChangeManager.d.ts.map +0 -1
  455. package/dist/managers/SubscriptionManager.d.ts.map +0 -1
  456. package/dist/managers/WalletManager.d.ts.map +0 -1
  457. package/dist/managers/X402Manager.d.ts.map +0 -1
  458. package/dist/sections-CKwGmrzV.js +0 -1
  459. package/dist/sections-DpEdFL1B.mjs +0 -10
  460. package/dist/stripe-only.d.ts.map +0 -1
  461. package/dist/telemetry.d.ts.map +0 -1
  462. package/dist/testing/__tests__/providers.test.d.ts.map +0 -1
  463. package/dist/testing/helpers.d.ts.map +0 -1
  464. package/dist/testing/index.d.ts.map +0 -1
  465. package/dist/testing/mocks.d.ts.map +0 -1
  466. package/dist/testing/providers.d.ts.map +0 -1
  467. package/dist/types/componentOptions.d.ts.map +0 -1
  468. package/dist/types/errors.d.ts.map +0 -1
  469. package/dist/types/index.d.ts.map +0 -1
  470. package/dist/types/subscription.d.ts.map +0 -1
  471. package/dist/utils/__tests__/couponHelpers.test.d.ts.map +0 -1
  472. package/dist/utils/__tests__/cspHelper.test.d.ts.map +0 -1
  473. package/dist/utils/__tests__/fetchWithTimeout.test.d.ts.map +0 -1
  474. package/dist/utils/cartHelpers.d.ts.map +0 -1
  475. package/dist/utils/circuitBreaker.d.ts.map +0 -1
  476. package/dist/utils/couponHelpers.d.ts.map +0 -1
  477. package/dist/utils/cspHelper.d.ts.map +0 -1
  478. package/dist/utils/csvHelpers.d.ts.map +0 -1
  479. package/dist/utils/csvHelpers.test.d.ts.map +0 -1
  480. package/dist/utils/dateHelpers.d.ts.map +0 -1
  481. package/dist/utils/deprecation.d.ts.map +0 -1
  482. package/dist/utils/errorHandling.d.ts.map +0 -1
  483. package/dist/utils/errorMessages.d.ts.map +0 -1
  484. package/dist/utils/errorParser.d.ts.map +0 -1
  485. package/dist/utils/eventEmitter.d.ts.map +0 -1
  486. package/dist/utils/exponentialBackoff.d.ts.map +0 -1
  487. package/dist/utils/fetchWithTimeout.d.ts.map +0 -1
  488. package/dist/utils/index.d.ts.map +0 -1
  489. package/dist/utils/logger.d.ts.map +0 -1
  490. package/dist/utils/modalStyles.d.ts.map +0 -1
  491. package/dist/utils/rateLimiter.d.ts.map +0 -1
  492. package/dist/utils/requestDeduplication.d.ts.map +0 -1
  493. package/dist/utils/securityValidation.d.ts.map +0 -1
  494. package/dist/utils/solanaCheck.d.ts.map +0 -1
  495. package/dist/utils/telemetry.d.ts.map +0 -1
  496. package/dist/utils/tokenMintValidator.d.ts.map +0 -1
  497. package/dist/utils/uuid.d.ts.map +0 -1
  498. package/dist/utils/validateConfig.d.ts.map +0 -1
  499. package/dist/utils/walletDetection.d.ts.map +0 -1
  500. package/dist/utils/walletPool.d.ts.map +0 -1
  501. /package/dist/{admin → src/admin}/index.d.ts +0 -0
  502. /package/dist/{admin → src/admin}/plugin.d.ts +0 -0
  503. /package/dist/{admin → src/admin}/types.d.ts +0 -0
  504. /package/dist/{components → src/components}/CedrosPay.d.ts +0 -0
  505. /package/dist/{components → src/components}/CreditsButton.d.ts +0 -0
  506. /package/dist/{components → src/components}/CreditsSubscribeButton.d.ts +0 -0
  507. /package/dist/{components → src/components}/CryptoButton.d.ts +0 -0
  508. /package/dist/{components → src/components}/CryptoSubscribeButton.d.ts +0 -0
  509. /package/dist/{components → src/components}/PaymentModal.d.ts +0 -0
  510. /package/dist/{components → src/components}/ProductPrice.d.ts +0 -0
  511. /package/dist/{components → src/components}/PurchaseButton.d.ts +0 -0
  512. /package/dist/{components → src/components}/StripeButton.d.ts +0 -0
  513. /package/dist/{components → src/components}/SubscribeButton.d.ts +0 -0
  514. /package/dist/{components → src/components}/SubscriptionManagementPanel.d.ts +0 -0
  515. /package/dist/{components → src/components}/admin/AISettingsSection.d.ts +0 -0
  516. /package/dist/{components → src/components}/admin/AdminAuthManager.d.ts +0 -0
  517. /package/dist/{components → src/components}/admin/AutosaveIndicator.d.ts +0 -0
  518. /package/dist/{components → src/components}/admin/CedrosPayAdminDashboard.d.ts +0 -0
  519. /package/dist/{components → src/components}/admin/ConfigEditor.d.ts +0 -0
  520. /package/dist/{components → src/components}/admin/CouponsSection.d.ts +0 -0
  521. /package/dist/{components → src/components}/admin/Dropdown.d.ts +0 -0
  522. /package/dist/{components → src/components}/admin/ErrorBanner.d.ts +0 -0
  523. /package/dist/{components → src/components}/admin/FAQSection.d.ts +0 -0
  524. /package/dist/{components → src/components}/admin/MessagingSection.d.ts +0 -0
  525. /package/dist/{components → src/components}/admin/OverviewSection.d.ts +0 -0
  526. /package/dist/{components → src/components}/admin/PaymentSettingsSection.d.ts +0 -0
  527. /package/dist/{components → src/components}/admin/ProductVariationsEditor.d.ts +0 -0
  528. /package/dist/{components → src/components}/admin/ProductsSection.d.ts +0 -0
  529. /package/dist/{components → src/components}/admin/RefundsSection.d.ts +0 -0
  530. /package/dist/{components → src/components}/admin/SecretArrayEditor.d.ts +0 -0
  531. /package/dist/{components → src/components}/admin/SettingsSection.d.ts +0 -0
  532. /package/dist/{components → src/components}/admin/SingleCategorySettings.d.ts +0 -0
  533. /package/dist/{components → src/components}/admin/StatsBar.d.ts +0 -0
  534. /package/dist/{components → src/components}/admin/StorefrontSection.d.ts +0 -0
  535. /package/dist/{components → src/components}/admin/SubscriptionsSection.d.ts +0 -0
  536. /package/dist/{components → src/components}/admin/Toggle.d.ts +0 -0
  537. /package/dist/{components → src/components}/admin/TransactionsSection.d.ts +0 -0
  538. /package/dist/{components → src/components}/admin/VariantInventoryGrid.d.ts +0 -0
  539. /package/dist/{components → src/components}/admin/VariationTypeEditor.d.ts +0 -0
  540. /package/dist/{components → src/components}/admin/configApi.d.ts +0 -0
  541. /package/dist/{components → src/components}/admin/icons.d.ts +0 -0
  542. /package/dist/{components → src/components}/admin/sections-more.d.ts +0 -0
  543. /package/dist/{components → src/components}/admin/sections.d.ts +0 -0
  544. /package/dist/{components → src/components}/admin/types.d.ts +0 -0
  545. /package/dist/{components → src/components}/admin/useAutosave.d.ts +0 -0
  546. /package/dist/{components → src/components}/admin/useProductVariations.d.ts +0 -0
  547. /package/dist/{components → src/components}/subscriptionPanelStyles.d.ts +0 -0
  548. /package/dist/{context → src/context}/CedrosContext.d.ts +0 -0
  549. /package/dist/{context → src/context}/ThemeContext.d.ts +0 -0
  550. /package/dist/{context → src/context}/index.d.ts +0 -0
  551. /package/dist/{ecommerce → src/ecommerce}/__tests__/cartCheckoutRequirements.test.d.ts +0 -0
  552. /package/dist/{ecommerce → src/ecommerce}/__tests__/cartProviderPersistence.test.d.ts +0 -0
  553. /package/dist/{ecommerce → src/ecommerce}/__tests__/cartReducer.test.d.ts +0 -0
  554. /package/dist/{ecommerce → src/ecommerce}/__tests__/cartServerMerge.test.d.ts +0 -0
  555. /package/dist/{ecommerce → src/ecommerce}/__tests__/checkoutPaymentMethods.test.d.ts +0 -0
  556. /package/dist/{ecommerce → src/ecommerce}/__tests__/checkoutReturn.test.d.ts +0 -0
  557. /package/dist/{ecommerce → src/ecommerce}/__tests__/checkoutSchema.test.d.ts +0 -0
  558. /package/dist/{ecommerce → src/ecommerce}/__tests__/inventoryHooks.test.d.ts +0 -0
  559. /package/dist/{ecommerce → src/ecommerce}/__tests__/mockAdapter.test.d.ts +0 -0
  560. /package/dist/{ecommerce → src/ecommerce}/__tests__/storage.test.d.ts +0 -0
  561. /package/dist/{ecommerce → src/ecommerce}/adapters/CommerceAdapter.d.ts +0 -0
  562. /package/dist/{ecommerce → src/ecommerce}/adapters/mock/mockAdapter.d.ts +0 -0
  563. /package/dist/{ecommerce → src/ecommerce}/adapters/paywall/paywallAdapter.d.ts +0 -0
  564. /package/dist/{ecommerce → src/ecommerce}/adapters/paywall/paywallAdapter.test.d.ts +0 -0
  565. /package/dist/{ecommerce → src/ecommerce}/components/cart/CartLineItem.d.ts +0 -0
  566. /package/dist/{ecommerce → src/ecommerce}/components/cart/CartPageContent.d.ts +0 -0
  567. /package/dist/{ecommerce → src/ecommerce}/components/cart/CartPanel.d.ts +0 -0
  568. /package/dist/{ecommerce → src/ecommerce}/components/cart/CartSidebar.d.ts +0 -0
  569. /package/dist/{ecommerce → src/ecommerce}/components/cart/CartSummary.d.ts +0 -0
  570. /package/dist/{ecommerce → src/ecommerce}/components/cart/PromoCodeInput.d.ts +0 -0
  571. /package/dist/{ecommerce → src/ecommerce}/components/catalog/Breadcrumbs.d.ts +0 -0
  572. /package/dist/{ecommerce → src/ecommerce}/components/catalog/CategoryNav.d.ts +0 -0
  573. /package/dist/{ecommerce → src/ecommerce}/components/catalog/FilterPanel.d.ts +0 -0
  574. /package/dist/{ecommerce → src/ecommerce}/components/catalog/Price.d.ts +0 -0
  575. /package/dist/{ecommerce → src/ecommerce}/components/catalog/ProductCard.d.ts +0 -0
  576. /package/dist/{ecommerce → src/ecommerce}/components/catalog/ProductGallery.d.ts +0 -0
  577. /package/dist/{ecommerce → src/ecommerce}/components/catalog/ProductGrid.d.ts +0 -0
  578. /package/dist/{ecommerce → src/ecommerce}/components/catalog/QuantitySelector.d.ts +0 -0
  579. /package/dist/{ecommerce → src/ecommerce}/components/catalog/QuickViewDialog.d.ts +0 -0
  580. /package/dist/{ecommerce → src/ecommerce}/components/catalog/SearchInput.d.ts +0 -0
  581. /package/dist/{ecommerce → src/ecommerce}/components/catalog/VariantSelector.d.ts +0 -0
  582. /package/dist/{ecommerce → src/ecommerce}/components/chat/ShopChatPanel.d.ts +0 -0
  583. /package/dist/{ecommerce → src/ecommerce}/components/checkout/AddressForm.d.ts +0 -0
  584. /package/dist/{ecommerce → src/ecommerce}/components/checkout/CheckoutCancelPage.d.ts +0 -0
  585. /package/dist/{ecommerce → src/ecommerce}/components/checkout/CheckoutForm.d.ts +0 -0
  586. /package/dist/{ecommerce → src/ecommerce}/components/checkout/CheckoutLayout.d.ts +0 -0
  587. /package/dist/{ecommerce → src/ecommerce}/components/checkout/CheckoutReceipt.d.ts +0 -0
  588. /package/dist/{ecommerce → src/ecommerce}/components/checkout/CheckoutSuccessPage.d.ts +0 -0
  589. /package/dist/{ecommerce → src/ecommerce}/components/checkout/InventoryVerificationDialog.d.ts +0 -0
  590. /package/dist/{ecommerce → src/ecommerce}/components/checkout/OrderReview.d.ts +0 -0
  591. /package/dist/{ecommerce → src/ecommerce}/components/checkout/PaymentStep.d.ts +0 -0
  592. /package/dist/{ecommerce → src/ecommerce}/components/checkout/ShippingMethodSelector.d.ts +0 -0
  593. /package/dist/{ecommerce → src/ecommerce}/components/faq/FAQItem.d.ts +0 -0
  594. /package/dist/{ecommerce → src/ecommerce}/components/faq/FAQItem.test.d.ts +0 -0
  595. /package/dist/{ecommerce → src/ecommerce}/components/faq/FAQList.d.ts +0 -0
  596. /package/dist/{ecommerce → src/ecommerce}/components/faq/index.d.ts +0 -0
  597. /package/dist/{ecommerce → src/ecommerce}/components/general/EmptyState.d.ts +0 -0
  598. /package/dist/{ecommerce → src/ecommerce}/components/general/ErrorBoundary.d.ts +0 -0
  599. /package/dist/{ecommerce → src/ecommerce}/components/general/ErrorState.d.ts +0 -0
  600. /package/dist/{ecommerce → src/ecommerce}/components/general/toast.d.ts +0 -0
  601. /package/dist/{ecommerce → src/ecommerce}/components/orders/OrderCard.d.ts +0 -0
  602. /package/dist/{ecommerce → src/ecommerce}/components/orders/OrderDetails.d.ts +0 -0
  603. /package/dist/{ecommerce → src/ecommerce}/components/orders/OrderList.d.ts +0 -0
  604. /package/dist/{ecommerce → src/ecommerce}/components/ui/accordion.d.ts +0 -0
  605. /package/dist/{ecommerce → src/ecommerce}/components/ui/badge.d.ts +0 -0
  606. /package/dist/{ecommerce → src/ecommerce}/components/ui/button.d.ts +0 -0
  607. /package/dist/{ecommerce → src/ecommerce}/components/ui/card.d.ts +0 -0
  608. /package/dist/{ecommerce → src/ecommerce}/components/ui/dialog.d.ts +0 -0
  609. /package/dist/{ecommerce → src/ecommerce}/components/ui/input.d.ts +0 -0
  610. /package/dist/{ecommerce → src/ecommerce}/components/ui/label.d.ts +0 -0
  611. /package/dist/{ecommerce → src/ecommerce}/components/ui/select.d.ts +0 -0
  612. /package/dist/{ecommerce → src/ecommerce}/components/ui/separator.d.ts +0 -0
  613. /package/dist/{ecommerce → src/ecommerce}/components/ui/sheet.d.ts +0 -0
  614. /package/dist/{ecommerce → src/ecommerce}/components/ui/skeleton.d.ts +0 -0
  615. /package/dist/{ecommerce → src/ecommerce}/components/ui/tabs.d.ts +0 -0
  616. /package/dist/{ecommerce → src/ecommerce}/components/ui/textarea.d.ts +0 -0
  617. /package/dist/{ecommerce → src/ecommerce}/config/context.d.ts +0 -0
  618. /package/dist/{ecommerce → src/ecommerce}/config/types.d.ts +0 -0
  619. /package/dist/{ecommerce → src/ecommerce}/hooks/checkoutReturn.d.ts +0 -0
  620. /package/dist/{ecommerce → src/ecommerce}/hooks/useAIRelatedProducts.d.ts +0 -0
  621. /package/dist/{ecommerce → src/ecommerce}/hooks/useCartInventory.d.ts +0 -0
  622. /package/dist/{ecommerce → src/ecommerce}/hooks/useCatalogUrlState.d.ts +0 -0
  623. /package/dist/{ecommerce → src/ecommerce}/hooks/useCategories.d.ts +0 -0
  624. /package/dist/{ecommerce → src/ecommerce}/hooks/useCheckoutResultFromUrl.d.ts +0 -0
  625. /package/dist/{ecommerce → src/ecommerce}/hooks/useHoldExpiry.d.ts +0 -0
  626. /package/dist/{ecommerce → src/ecommerce}/hooks/useInventoryVerification.d.ts +0 -0
  627. /package/dist/{ecommerce → src/ecommerce}/hooks/useOrders.d.ts +0 -0
  628. /package/dist/{ecommerce → src/ecommerce}/hooks/usePaymentMethodsConfig.d.ts +0 -0
  629. /package/dist/{ecommerce → src/ecommerce}/hooks/useProduct.d.ts +0 -0
  630. /package/dist/{ecommerce → src/ecommerce}/hooks/useProducts.d.ts +0 -0
  631. /package/dist/{ecommerce → src/ecommerce}/hooks/useShippingMethods.d.ts +0 -0
  632. /package/dist/{ecommerce → src/ecommerce}/hooks/useStorefrontSettings.d.ts +0 -0
  633. /package/dist/{ecommerce → src/ecommerce}/hooks/useSubscriptionData.d.ts +0 -0
  634. /package/dist/{ecommerce → src/ecommerce}/index.d.ts +0 -0
  635. /package/dist/{ecommerce → src/ecommerce}/integrations/cedros-pay/useCedrosPayCheckoutAdapter.d.ts +0 -0
  636. /package/dist/{ecommerce → src/ecommerce}/state/cart/CartProvider.d.ts +0 -0
  637. /package/dist/{ecommerce → src/ecommerce}/state/cart/cartReducer.d.ts +0 -0
  638. /package/dist/{ecommerce → src/ecommerce}/state/checkout/checkoutSchema.d.ts +0 -0
  639. /package/dist/{ecommerce → src/ecommerce}/state/checkout/useCheckout.d.ts +0 -0
  640. /package/dist/{ecommerce → src/ecommerce}/templates/CartTemplate.d.ts +0 -0
  641. /package/dist/{ecommerce → src/ecommerce}/templates/CategoryTemplate.d.ts +0 -0
  642. /package/dist/{ecommerce → src/ecommerce}/templates/CheckoutTemplate.d.ts +0 -0
  643. /package/dist/{ecommerce → src/ecommerce}/templates/ProductTemplate.d.ts +0 -0
  644. /package/dist/{ecommerce → src/ecommerce}/templates/PurchaseHistoryTemplate.d.ts +0 -0
  645. /package/dist/{ecommerce → src/ecommerce}/templates/ReceiptTemplate.d.ts +0 -0
  646. /package/dist/{ecommerce → src/ecommerce}/templates/ShopTemplate.d.ts +0 -0
  647. /package/dist/{ecommerce → src/ecommerce}/templates/SubscriptionTemplate.d.ts +0 -0
  648. /package/dist/{ecommerce → src/ecommerce}/testing/adapterContract.d.ts +0 -0
  649. /package/dist/{ecommerce → src/ecommerce}/types.d.ts +0 -0
  650. /package/dist/{ecommerce → src/ecommerce}/utils/cartCheckoutRequirements.d.ts +0 -0
  651. /package/dist/{ecommerce → src/ecommerce}/utils/cartItemMetadata.d.ts +0 -0
  652. /package/dist/{ecommerce → src/ecommerce}/utils/cn.d.ts +0 -0
  653. /package/dist/{ecommerce → src/ecommerce}/utils/money.d.ts +0 -0
  654. /package/dist/{ecommerce → src/ecommerce}/utils/storage.d.ts +0 -0
  655. /package/dist/{hooks → src/hooks}/useCreditsPayment.d.ts +0 -0
  656. /package/dist/{hooks → src/hooks}/useCreditsSubscription.d.ts +0 -0
  657. /package/dist/{hooks → src/hooks}/useCryptoSubscription.d.ts +0 -0
  658. /package/dist/{hooks → src/hooks}/usePaymentMode.d.ts +0 -0
  659. /package/dist/{hooks → src/hooks}/useRefundVerification.d.ts +0 -0
  660. /package/dist/{hooks → src/hooks}/useStripeCheckout.d.ts +0 -0
  661. /package/dist/{hooks → src/hooks}/useSubscription.d.ts +0 -0
  662. /package/dist/{hooks → src/hooks}/useSubscriptionManagement.d.ts +0 -0
  663. /package/dist/{hooks → src/hooks}/useX402Payment.d.ts +0 -0
  664. /package/dist/{i18n → src/i18n}/index.d.ts +0 -0
  665. /package/dist/{i18n → src/i18n}/useTranslation.d.ts +0 -0
  666. /package/dist/{managers → src/managers}/CreditsManager.d.ts +0 -0
  667. /package/dist/{managers → src/managers}/ManagerCache.d.ts +0 -0
  668. /package/dist/{managers → src/managers}/StripeManager.d.ts +0 -0
  669. /package/dist/{managers → src/managers}/SubscriptionChangeManager.d.ts +0 -0
  670. /package/dist/{managers → src/managers}/SubscriptionManager.d.ts +0 -0
  671. /package/dist/{managers → src/managers}/WalletManager.d.ts +0 -0
  672. /package/dist/{managers → src/managers}/X402Manager.d.ts +0 -0
  673. /package/dist/{testing → src/testing}/__tests__/providers.test.d.ts +0 -0
  674. /package/dist/{testing → src/testing}/helpers.d.ts +0 -0
  675. /package/dist/{testing → src/testing}/mocks.d.ts +0 -0
  676. /package/dist/{testing → src/testing}/providers.d.ts +0 -0
  677. /package/dist/{types → src/types}/componentOptions.d.ts +0 -0
  678. /package/dist/{types → src/types}/errors.d.ts +0 -0
  679. /package/dist/{types → src/types}/index.d.ts +0 -0
  680. /package/dist/{types → src/types}/subscription.d.ts +0 -0
  681. /package/dist/{utils → src/utils}/__tests__/couponHelpers.test.d.ts +0 -0
  682. /package/dist/{utils → src/utils}/__tests__/cspHelper.test.d.ts +0 -0
  683. /package/dist/{utils → src/utils}/__tests__/fetchWithTimeout.test.d.ts +0 -0
  684. /package/dist/{utils → src/utils}/cartHelpers.d.ts +0 -0
  685. /package/dist/{utils → src/utils}/circuitBreaker.d.ts +0 -0
  686. /package/dist/{utils → src/utils}/couponHelpers.d.ts +0 -0
  687. /package/dist/{utils → src/utils}/cspHelper.d.ts +0 -0
  688. /package/dist/{utils → src/utils}/csvHelpers.d.ts +0 -0
  689. /package/dist/{utils → src/utils}/csvHelpers.test.d.ts +0 -0
  690. /package/dist/{utils → src/utils}/dateHelpers.d.ts +0 -0
  691. /package/dist/{utils → src/utils}/deprecation.d.ts +0 -0
  692. /package/dist/{utils → src/utils}/errorHandling.d.ts +0 -0
  693. /package/dist/{utils → src/utils}/errorMessages.d.ts +0 -0
  694. /package/dist/{utils → src/utils}/errorParser.d.ts +0 -0
  695. /package/dist/{utils → src/utils}/eventEmitter.d.ts +0 -0
  696. /package/dist/{utils → src/utils}/exponentialBackoff.d.ts +0 -0
  697. /package/dist/{utils → src/utils}/fetchWithTimeout.d.ts +0 -0
  698. /package/dist/{utils → src/utils}/index.d.ts +0 -0
  699. /package/dist/{utils → src/utils}/logger.d.ts +0 -0
  700. /package/dist/{utils → src/utils}/modalStyles.d.ts +0 -0
  701. /package/dist/{utils → src/utils}/rateLimiter.d.ts +0 -0
  702. /package/dist/{utils → src/utils}/requestDeduplication.d.ts +0 -0
  703. /package/dist/{utils → src/utils}/securityValidation.d.ts +0 -0
  704. /package/dist/{utils → src/utils}/solanaCheck.d.ts +0 -0
  705. /package/dist/{utils → src/utils}/telemetry.d.ts +0 -0
  706. /package/dist/{utils → src/utils}/tokenMintValidator.d.ts +0 -0
  707. /package/dist/{utils → src/utils}/uuid.d.ts +0 -0
  708. /package/dist/{utils → src/utils}/validateConfig.d.ts +0 -0
  709. /package/dist/{utils → src/utils}/walletDetection.d.ts +0 -0
  710. /package/dist/{utils → src/utils}/walletPool.d.ts +0 -0
@@ -0,0 +1,2578 @@
1
+ import { i as j, P as ke, u as re, o as be, a as V, m as pe } from "./CedrosContext-BE6P5PQ0.mjs";
2
+ import { jsxs as S, jsx as f, Fragment as me } from "react/jsx-runtime";
3
+ import q, { useState as Q, useRef as X, useCallback as I, useMemo as F, useEffect as te } from "react";
4
+ function xt(e) {
5
+ return !e || !e.coupon_codes ? [] : e.coupon_codes.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
6
+ }
7
+ function Et(e, t = ", ") {
8
+ return e.join(t);
9
+ }
10
+ function kt(e, t) {
11
+ return e <= 0 ? 0 : (e - t) / e * 100;
12
+ }
13
+ function _t(e, t) {
14
+ if (!t || t.length === 0)
15
+ return e;
16
+ let r = e, n = 0;
17
+ for (const s of t)
18
+ if (s.discountType === "percentage") {
19
+ const u = 1 - s.discountValue / 100;
20
+ r = r * u;
21
+ } else s.discountType === "fixed" && (n += s.discountValue);
22
+ return r = r - n, r < 0 && (r = 0), Math.ceil(r * 100) / 100;
23
+ }
24
+ function _e(e) {
25
+ const t = Number(e);
26
+ if (!Number.isFinite(t) || t <= 0)
27
+ return 1;
28
+ const r = Math.floor(t);
29
+ return r > 0 ? r : 1;
30
+ }
31
+ function Ce(e) {
32
+ return e.map((t) => ({
33
+ resource: t.resource,
34
+ quantity: _e(t.quantity),
35
+ variantId: t.variantId,
36
+ metadata: t.metadata
37
+ }));
38
+ }
39
+ function ge(e) {
40
+ return e.reduce((t, r) => t + _e(r.quantity), 0);
41
+ }
42
+ function $e(e) {
43
+ return !!(e && e.length > 0 && (e.length > 1 || e.length === 1 && (e[0].quantity ?? 1) > 1));
44
+ }
45
+ const ee = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(), fe = 1e3, Re = 200, Se = 2e3;
46
+ function Ae(e) {
47
+ const t = G.get(e);
48
+ return t ? Date.now() < t ? !0 : (G.delete(e), !1) : !1;
49
+ }
50
+ function qe(e, t = Re) {
51
+ const r = Date.now() + t;
52
+ if (G.set(e, r), G.size > fe) {
53
+ const n = Array.from(G.keys()).slice(0, G.size - fe);
54
+ for (const s of n)
55
+ G.delete(s);
56
+ }
57
+ }
58
+ function ze(e, t = Se) {
59
+ const r = ee.get(e);
60
+ if (!r)
61
+ return !1;
62
+ const s = Date.now() - r;
63
+ return s < t ? (j().debug(`[Deduplication] Duplicate request blocked: ${e} (${s}ms ago)`), !0) : !1;
64
+ }
65
+ function Ue(e) {
66
+ if (ee.set(e, Date.now()), ee.size > fe) {
67
+ const t = Array.from(ee.keys()).slice(0, ee.size - fe);
68
+ for (const r of t)
69
+ ee.delete(r);
70
+ }
71
+ }
72
+ function Oe(e) {
73
+ return we.get(e) || null;
74
+ }
75
+ function Fe(e, t) {
76
+ we.set(e, t);
77
+ const r = () => {
78
+ we.delete(e), Ue(e);
79
+ };
80
+ return t.then(r, r), t;
81
+ }
82
+ async function We(e, t, r = {}) {
83
+ const { windowMs: n = Se, throwOnDuplicate: s = !0 } = r, u = Oe(e);
84
+ if (u)
85
+ return j().debug(`[Deduplication] Reusing in-flight request: ${e}`), u;
86
+ if (ze(e, n)) {
87
+ if (s)
88
+ throw new Error(`Duplicate request blocked: ${e}`);
89
+ j().warn(`[Deduplication] Duplicate request blocked but not throwing: ${e}`);
90
+ return;
91
+ }
92
+ const g = t();
93
+ return Fe(e, g);
94
+ }
95
+ function se(e, t, r = {}) {
96
+ const { cooldownMs: n = Re, deduplicationWindowMs: s = Se } = r;
97
+ return async () => {
98
+ if (Ae(e)) {
99
+ j().debug(`[Deduplication] Button in cooldown: ${e}`);
100
+ return;
101
+ }
102
+ qe(e, n);
103
+ try {
104
+ await We(
105
+ e,
106
+ async () => {
107
+ const u = t();
108
+ u instanceof Promise && await u;
109
+ },
110
+ { windowMs: s, throwOnDuplicate: !1 }
111
+ );
112
+ } catch (u) {
113
+ if (u instanceof Error && u.message.includes("Duplicate request"))
114
+ return;
115
+ throw u;
116
+ }
117
+ };
118
+ }
119
+ function He(e) {
120
+ return {
121
+ background: "none",
122
+ border: "none",
123
+ fontSize: "1.5rem",
124
+ cursor: "pointer",
125
+ color: e,
126
+ opacity: 0.6,
127
+ padding: "0.25rem",
128
+ lineHeight: 1
129
+ };
130
+ }
131
+ const J = {
132
+ PAYMENT_START: "cedros:payment:start",
133
+ WALLET_CONNECT: "cedros:wallet:connect",
134
+ WALLET_CONNECTED: "cedros:wallet:connected",
135
+ WALLET_ERROR: "cedros:wallet:error",
136
+ PAYMENT_PROCESSING: "cedros:payment:processing",
137
+ PAYMENT_SUCCESS: "cedros:payment:success",
138
+ PAYMENT_ERROR: "cedros:payment:error"
139
+ };
140
+ function Z(e, t) {
141
+ if (typeof window > "u")
142
+ return;
143
+ const r = new CustomEvent(e, {
144
+ detail: t,
145
+ bubbles: !0,
146
+ cancelable: !1
147
+ });
148
+ window.dispatchEvent(r);
149
+ }
150
+ function oe(e, t, r) {
151
+ Z(J.PAYMENT_START, {
152
+ timestamp: Date.now(),
153
+ method: e,
154
+ resource: t,
155
+ itemCount: r
156
+ });
157
+ }
158
+ function Rt(e) {
159
+ Z(J.WALLET_CONNECT, {
160
+ timestamp: Date.now(),
161
+ wallet: e
162
+ });
163
+ }
164
+ function It(e, t) {
165
+ Z(J.WALLET_CONNECTED, {
166
+ timestamp: Date.now(),
167
+ wallet: e,
168
+ publicKey: t
169
+ });
170
+ }
171
+ function Mt(e, t) {
172
+ Z(J.WALLET_ERROR, {
173
+ timestamp: Date.now(),
174
+ wallet: t,
175
+ error: e
176
+ });
177
+ }
178
+ function ae(e, t, r) {
179
+ Z(J.PAYMENT_PROCESSING, {
180
+ timestamp: Date.now(),
181
+ method: e,
182
+ resource: t,
183
+ itemCount: r
184
+ });
185
+ }
186
+ function ie(e, t, r, n) {
187
+ Z(J.PAYMENT_SUCCESS, {
188
+ timestamp: Date.now(),
189
+ method: e,
190
+ transactionId: t,
191
+ resource: r,
192
+ itemCount: n
193
+ });
194
+ }
195
+ function Y(e, t, r, n) {
196
+ Z(J.PAYMENT_ERROR, {
197
+ timestamp: Date.now(),
198
+ method: e,
199
+ error: t,
200
+ resource: r,
201
+ itemCount: n
202
+ });
203
+ }
204
+ function Tt(e) {
205
+ return e instanceof ke && e.canRetry();
206
+ }
207
+ function Nt(e) {
208
+ return e instanceof ke ? e.getUserMessage() : e instanceof Error ? e.message : String(e);
209
+ }
210
+ function Ye(e) {
211
+ switch (e) {
212
+ case "mainnet-beta":
213
+ return "https://api.mainnet-beta.solana.com";
214
+ case "devnet":
215
+ return "https://api.devnet.solana.com";
216
+ case "testnet":
217
+ return "https://api.testnet.solana.com";
218
+ default:
219
+ return "https://api.mainnet-beta.solana.com";
220
+ }
221
+ }
222
+ function Qe(e) {
223
+ try {
224
+ const t = new URL(e);
225
+ return `${t.protocol}//${t.host}`;
226
+ } catch {
227
+ return e;
228
+ }
229
+ }
230
+ function Ve(e = {}) {
231
+ const {
232
+ solanaCluster: t = "mainnet-beta",
233
+ solanaEndpoint: r,
234
+ customRpcProviders: n = [],
235
+ allowUnsafeScripts: s = !1,
236
+ additionalScriptSrc: u = [],
237
+ additionalConnectSrc: g = [],
238
+ additionalFrameSrc: b = [],
239
+ includeStripe: h = !0,
240
+ includeSolana: c = !0
241
+ } = e;
242
+ s && console.warn(
243
+ "[CedrosPay] SECURITY WARNING: allowUnsafeScripts is enabled. This adds 'unsafe-inline' and 'unsafe-eval' to script-src, which significantly weakens CSP protection against XSS attacks. Only use this in development or if absolutely required by your framework."
244
+ );
245
+ const a = ["'self'"];
246
+ s && a.push("'unsafe-inline'", "'unsafe-eval'"), h && a.push("https://js.stripe.com"), a.push(...u);
247
+ const o = ["'self'"];
248
+ if (h && o.push("https://api.stripe.com", "https://*.stripe.com"), c) {
249
+ const i = Ye(t);
250
+ if (o.push(i), r) {
251
+ const l = Qe(r);
252
+ o.includes(l) || o.push(l);
253
+ }
254
+ n.forEach((l) => {
255
+ o.includes(l) || o.push(l);
256
+ });
257
+ }
258
+ o.push(...g);
259
+ const d = ["'self'"];
260
+ return h && d.push("https://js.stripe.com", "https://checkout.stripe.com"), d.push(...b), {
261
+ scriptSrc: a,
262
+ connectSrc: o,
263
+ frameSrc: d
264
+ };
265
+ }
266
+ function Ge(e, t = "header") {
267
+ const { scriptSrc: r, connectSrc: n, frameSrc: s } = e;
268
+ switch (t) {
269
+ case "header":
270
+ case "meta":
271
+ case "nextjs":
272
+ case "nginx": {
273
+ const u = [];
274
+ return r.length > 0 && u.push(`script-src ${r.join(" ")}`), n.length > 0 && u.push(`connect-src ${n.join(" ")}`), s.length > 0 && u.push(`frame-src ${s.join(" ")}`), u.join("; ");
275
+ }
276
+ case "helmet": {
277
+ const u = {};
278
+ return r.length > 0 && (u.scriptSrc = r), n.length > 0 && (u.connectSrc = n), s.length > 0 && (u.frameSrc = s), u;
279
+ }
280
+ case "directives":
281
+ return { scriptSrc: r, connectSrc: n, frameSrc: s };
282
+ default:
283
+ throw new Error(`Unknown CSP format: ${t}`);
284
+ }
285
+ }
286
+ function Dt(e = {}, t = "header") {
287
+ const r = Ve(e);
288
+ return Ge(r, t);
289
+ }
290
+ const jt = {
291
+ HELIUS: "https://*.helius-rpc.com",
292
+ QUICKNODE: "https://*.quicknode.pro",
293
+ ALCHEMY: "https://*.alchemy.com",
294
+ ANKR: "https://rpc.ankr.com",
295
+ TRITON: "https://*.rpcpool.com"
296
+ }, Bt = {
297
+ /**
298
+ * Mainnet production with custom RPC (recommended)
299
+ */
300
+ MAINNET_CUSTOM_RPC: (e) => ({
301
+ solanaCluster: "mainnet-beta",
302
+ solanaEndpoint: e,
303
+ allowUnsafeScripts: !1
304
+ }),
305
+ /**
306
+ * Mainnet with Next.js (may require unsafe-inline/eval for some setups)
307
+ * Note: Modern Next.js supports strict CSP without unsafe directives.
308
+ * Only enable allowUnsafeScripts if necessary and understand the security implications.
309
+ */
310
+ MAINNET_NEXTJS: (e) => ({
311
+ solanaCluster: "mainnet-beta",
312
+ solanaEndpoint: e,
313
+ allowUnsafeScripts: !1
314
+ }),
315
+ /**
316
+ * Devnet for testing
317
+ */
318
+ DEVNET: () => ({
319
+ solanaCluster: "devnet",
320
+ allowUnsafeScripts: !1
321
+ }),
322
+ /**
323
+ * Crypto-only payments (no Stripe)
324
+ */
325
+ CRYPTO_ONLY: (e) => ({
326
+ solanaCluster: "mainnet-beta",
327
+ solanaEndpoint: e,
328
+ includeStripe: !1
329
+ }),
330
+ /**
331
+ * Stripe-only payments (no Solana)
332
+ */
333
+ STRIPE_ONLY: () => ({
334
+ includeStripe: !0,
335
+ includeSolana: !1
336
+ })
337
+ };
338
+ function Ie() {
339
+ const { stripeManager: e } = re(), [t, r] = Q({
340
+ status: "idle",
341
+ error: null,
342
+ transactionId: null
343
+ }), n = X(!1), s = I(
344
+ async (b, h, c, a, o, d) => {
345
+ if (n.current)
346
+ return { success: !1, error: "Payment already in progress" };
347
+ n.current = !0, r({
348
+ status: "loading",
349
+ error: null,
350
+ transactionId: null
351
+ });
352
+ const i = {
353
+ resource: b,
354
+ successUrl: h,
355
+ cancelUrl: c,
356
+ metadata: a,
357
+ customerEmail: o,
358
+ couponCode: d
359
+ };
360
+ try {
361
+ const l = await e.processPayment(i);
362
+ return r({
363
+ status: l.success ? "success" : "error",
364
+ error: l.success ? null : l.error || "Payment failed",
365
+ transactionId: l.success && l.transactionId || null
366
+ }), l;
367
+ } catch (l) {
368
+ const p = l instanceof Error ? l.message : "Payment failed";
369
+ return r({
370
+ status: "error",
371
+ error: p,
372
+ transactionId: null
373
+ }), { success: !1, error: p };
374
+ } finally {
375
+ n.current = !1;
376
+ }
377
+ },
378
+ [e]
379
+ ), u = I(
380
+ async (b, h, c, a, o, d, i, l, p, m, w, y, k) => {
381
+ if (n.current)
382
+ return { success: !1, error: "Payment already in progress" };
383
+ n.current = !0, r({
384
+ status: "loading",
385
+ error: null,
386
+ transactionId: null
387
+ });
388
+ const P = Ce(b);
389
+ try {
390
+ const E = await e.processCartCheckout({
391
+ items: P,
392
+ successUrl: h,
393
+ cancelUrl: c,
394
+ metadata: a,
395
+ customerEmail: o,
396
+ customerName: i,
397
+ customerPhone: l,
398
+ shippingAddress: p,
399
+ billingAddress: m,
400
+ couponCode: d,
401
+ tipAmount: w,
402
+ shippingMethodId: y,
403
+ paymentMethodId: k
404
+ });
405
+ return r({
406
+ status: E.success ? "success" : "error",
407
+ error: E.success ? null : E.error || "Cart checkout failed",
408
+ transactionId: E.success && E.transactionId || null
409
+ }), E;
410
+ } catch (E) {
411
+ const M = E instanceof Error ? E.message : "Cart checkout failed";
412
+ return r({
413
+ status: "error",
414
+ error: M,
415
+ transactionId: null
416
+ }), { success: !1, error: M };
417
+ } finally {
418
+ n.current = !1;
419
+ }
420
+ },
421
+ [e]
422
+ ), g = I(() => {
423
+ r({
424
+ status: "idle",
425
+ error: null,
426
+ transactionId: null
427
+ }), n.current = !1;
428
+ }, []);
429
+ return {
430
+ ...t,
431
+ processPayment: s,
432
+ processCartCheckout: u,
433
+ reset: g
434
+ };
435
+ }
436
+ function he(e, t) {
437
+ return F(() => {
438
+ const r = $e(t), n = e || (t?.length === 1 ? t[0].resource : "");
439
+ return {
440
+ isCartMode: r,
441
+ effectiveResource: n
442
+ };
443
+ }, [e, t]);
444
+ }
445
+ const Ke = (e, t, r) => {
446
+ const n = e[t];
447
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((s, u) => {
448
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(u.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== r ? ". Note that variables only represent file names one level deep." : ""))));
449
+ });
450
+ }, ye = /* @__PURE__ */ new Map();
451
+ let de = null;
452
+ async function Ee(e) {
453
+ if (ye.has(e))
454
+ return ye.get(e);
455
+ try {
456
+ const t = await Ke(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-w27mU-4x.mjs"), "./translations/bn.json": () => import("./bn-Ba_k3Kex.mjs"), "./translations/de.json": () => import("./de-CoZiPFN7.mjs"), "./translations/en.json": () => import("./en-BXheDBal.mjs"), "./translations/es.json": () => import("./es-BWGIBp2f.mjs"), "./translations/fil.json": () => import("./fil-Czo27xmj.mjs"), "./translations/fr.json": () => import("./fr-DQ-2ThBv.mjs"), "./translations/he.json": () => import("./he-DpV1WnBQ.mjs"), "./translations/id.json": () => import("./id-BJMqsu19.mjs"), "./translations/in.json": () => import("./in-BxgxKLQH.mjs"), "./translations/it.json": () => import("./it-DZFFPALf.mjs"), "./translations/jp.json": () => import("./jp-ZExTrlHK.mjs"), "./translations/kr.json": () => import("./kr-DHX3i4Ht.mjs"), "./translations/ms.json": () => import("./ms-Cv1fdIi2.mjs"), "./translations/nl.json": () => import("./nl-BmGonsKb.mjs"), "./translations/pa.json": () => import("./pa-BfwcJIar.mjs"), "./translations/pl.json": () => import("./pl-DE5IB9xv.mjs"), "./translations/pt.json": () => import("./pt-CLzkqDzf.mjs"), "./translations/ru.json": () => import("./ru-DM6-oUR0.mjs"), "./translations/ta.json": () => import("./ta-A5HnrGb5.mjs"), "./translations/th.json": () => import("./th-3fbB3Ytp.mjs"), "./translations/tr.json": () => import("./tr-BrgfFFdq.mjs"), "./translations/uk.json": () => import("./uk-0hFun_g_.mjs"), "./translations/ur.json": () => import("./ur-CaOjJXai.mjs"), "./translations/vn.json": () => import("./vn-0nlIZFLP.mjs"), "./translations/zh.json": () => import("./zh-B4Endr1F.mjs") }), `./translations/${e}.json`, 3), r = t.default || t;
457
+ return ye.set(e, r), r;
458
+ } catch {
459
+ return null;
460
+ }
461
+ }
462
+ async function Lt() {
463
+ if (de)
464
+ return de;
465
+ const e = /* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-w27mU-4x.mjs"), "./translations/bn.json": () => import("./bn-Ba_k3Kex.mjs"), "./translations/de.json": () => import("./de-CoZiPFN7.mjs"), "./translations/en.json": () => import("./en-BXheDBal.mjs"), "./translations/es.json": () => import("./es-BWGIBp2f.mjs"), "./translations/fil.json": () => import("./fil-Czo27xmj.mjs"), "./translations/fr.json": () => import("./fr-DQ-2ThBv.mjs"), "./translations/he.json": () => import("./he-DpV1WnBQ.mjs"), "./translations/id.json": () => import("./id-BJMqsu19.mjs"), "./translations/in.json": () => import("./in-BxgxKLQH.mjs"), "./translations/it.json": () => import("./it-DZFFPALf.mjs"), "./translations/jp.json": () => import("./jp-ZExTrlHK.mjs"), "./translations/kr.json": () => import("./kr-DHX3i4Ht.mjs"), "./translations/ms.json": () => import("./ms-Cv1fdIi2.mjs"), "./translations/nl.json": () => import("./nl-BmGonsKb.mjs"), "./translations/pa.json": () => import("./pa-BfwcJIar.mjs"), "./translations/pl.json": () => import("./pl-DE5IB9xv.mjs"), "./translations/pt.json": () => import("./pt-CLzkqDzf.mjs"), "./translations/ru.json": () => import("./ru-DM6-oUR0.mjs"), "./translations/ta.json": () => import("./ta-A5HnrGb5.mjs"), "./translations/th.json": () => import("./th-3fbB3Ytp.mjs"), "./translations/tr.json": () => import("./tr-BrgfFFdq.mjs"), "./translations/uk.json": () => import("./uk-0hFun_g_.mjs"), "./translations/ur.json": () => import("./ur-CaOjJXai.mjs"), "./translations/vn.json": () => import("./vn-0nlIZFLP.mjs"), "./translations/zh.json": () => import("./zh-B4Endr1F.mjs") }), t = [];
466
+ for (const r in e) {
467
+ const n = r.match(/\.\/translations\/([a-z]{2,3}(?:-[A-Z]{2})?)\.json$/);
468
+ n && t.push(n[1]);
469
+ }
470
+ return de = t.length > 0 ? t : ["en"], de;
471
+ }
472
+ function Xe() {
473
+ return typeof navigator > "u" ? "en" : (navigator.language || navigator.userLanguage || "en").split("-")[0].toLowerCase();
474
+ }
475
+ async function Je(e) {
476
+ let t = await Ee(e);
477
+ if (t || (t = await Ee("en"), t))
478
+ return t;
479
+ throw new Error("Critical: No translation files found, not even en.json");
480
+ }
481
+ function Ze(e) {
482
+ return (t, r) => {
483
+ const n = t.split(".");
484
+ let s = e;
485
+ for (const u of n)
486
+ if (s && typeof s == "object" && u in s)
487
+ s = s[u];
488
+ else
489
+ return t;
490
+ return typeof s != "string" ? t : r ? Object.entries(r).reduce(
491
+ (u, [g, b]) => u.replace(new RegExp(`\\{${g}\\}`, "g"), b),
492
+ s
493
+ ) : s;
494
+ };
495
+ }
496
+ function $t(e, t, r = !0) {
497
+ const n = t.errors[e];
498
+ if (!n) {
499
+ const s = be(e);
500
+ return r && s.action ? `${s.message} ${s.action}` : s.message;
501
+ }
502
+ return r && n.action ? `${n.message} ${n.action}` : n.message;
503
+ }
504
+ function ne(e) {
505
+ const [t, r] = Q(null), [n, s] = Q(!0), u = F(() => e || Xe(), [e]);
506
+ return te(() => {
507
+ let b = !1;
508
+ return (async () => {
509
+ s(!0);
510
+ try {
511
+ const c = await Je(u);
512
+ b || (r(c), s(!1));
513
+ } catch (c) {
514
+ console.error("[CedrosPay] Failed to load translations:", c), b || s(!1);
515
+ }
516
+ })(), () => {
517
+ b = !0;
518
+ };
519
+ }, [u]), {
520
+ t: F(() => t ? Ze(t) : (b) => ({
521
+ "ui.purchase": "Purchase",
522
+ "ui.pay_with_card": "Pay with Card",
523
+ "ui.pay_with_crypto": "Pay with USDC",
524
+ "ui.pay_with_usdc": "Pay with USDC",
525
+ "ui.card": "Card",
526
+ "ui.usdc_solana": "USDC (Solana)",
527
+ "ui.crypto": "Crypto",
528
+ "ui.processing": "Processing...",
529
+ "ui.loading": "Loading...",
530
+ "ui.connect_wallet": "Connect Wallet",
531
+ "ui.connecting": "Connecting..."
532
+ })[b] || b, [t]),
533
+ locale: u,
534
+ isLoading: n,
535
+ translations: t
536
+ };
537
+ }
538
+ function At(e, t = !0) {
539
+ const { translations: r } = ne();
540
+ if (!r) {
541
+ const s = be(e);
542
+ return t && s.action ? `${s.message} ${s.action}` : s.message;
543
+ }
544
+ const n = r.errors[e];
545
+ if (!n) {
546
+ const s = be(e);
547
+ return t && s.action ? `${s.message} ${s.action}` : s.message;
548
+ }
549
+ return t && n.action ? `${n.message} ${n.action}` : n.message;
550
+ }
551
+ function Me({
552
+ resource: e,
553
+ items: t,
554
+ successUrl: r,
555
+ cancelUrl: n,
556
+ metadata: s,
557
+ customerEmail: u,
558
+ couponCode: g,
559
+ label: b,
560
+ disabled: h = !1,
561
+ onAttempt: c,
562
+ onSuccess: a,
563
+ onError: o,
564
+ className: d = ""
565
+ }) {
566
+ const { status: i, error: l, transactionId: p, processPayment: m, processCartCheckout: w } = Ie(), y = V(), { isCartMode: k, effectiveResource: P } = he(e, t), { t: E, translations: M } = ne(), $ = b || E("ui.pay_with_card"), z = y.unstyled ? d : `${y.className} cedros-theme__stripe-button ${d}`.trim(), U = l && typeof l != "string" ? l?.code ?? null : null, C = l ? typeof l == "string" ? l : ((x) => {
567
+ if (!x || !M) return "";
568
+ const R = M.errors[x];
569
+ return R ? R.action ? `${R.message} ${R.action}` : R.message : "";
570
+ })(U) : null, _ = I(async () => {
571
+ j().debug("[StripeButton] executePayment with couponCode:", g);
572
+ const x = k && t ? ge(t) : void 0;
573
+ if (oe("stripe", P, x), c && c("stripe"), !k && !P) {
574
+ const W = "Invalid payment configuration: missing resource or items";
575
+ j().error("[StripeButton]", W), Y("stripe", W, P, x), o && o(W);
576
+ return;
577
+ }
578
+ let R;
579
+ ae("stripe", P, x), k && t ? (j().debug("[StripeButton] Processing cart checkout with coupon:", g), R = await w(
580
+ t,
581
+ r,
582
+ n,
583
+ s,
584
+ u,
585
+ g
586
+ )) : P && (j().debug("[StripeButton] Processing single payment with coupon:", g), R = await m(
587
+ P,
588
+ r,
589
+ n,
590
+ s,
591
+ u,
592
+ g
593
+ )), R && R.success && R.transactionId ? (ie("stripe", R.transactionId, P, x), a && a(R.transactionId)) : R && !R.success && R.error && (Y("stripe", R.error, P, x), o && o(R.error));
594
+ }, [g, k, P, t, r, n, s, u, w, m, c, a, o]), A = F(() => k && t ? `stripe-cart-${t.map((x) => x.resource).join("-")}` : `stripe-${P || "unknown"}`, [k, t, P]), T = F(
595
+ () => se(A, _),
596
+ [A, _]
597
+ ), N = i === "loading", v = h || N;
598
+ return /* @__PURE__ */ S("div", { className: z, style: y.unstyled ? {} : y.style, children: [
599
+ /* @__PURE__ */ f(
600
+ "button",
601
+ {
602
+ onClick: T,
603
+ disabled: v,
604
+ className: y.unstyled ? d : "cedros-theme__button cedros-theme__stripe",
605
+ type: "button",
606
+ children: N ? E("ui.processing") : $
607
+ }
608
+ ),
609
+ C && /* @__PURE__ */ f("div", { className: y.unstyled ? "" : "cedros-theme__error", children: C }),
610
+ p && /* @__PURE__ */ f("div", { className: y.unstyled ? "" : "cedros-theme__success", children: E("ui.payment_successful") })
611
+ ] });
612
+ }
613
+ function et() {
614
+ const { creditsManager: e } = re(), [t, r] = Q({
615
+ status: "idle",
616
+ error: null,
617
+ transactionId: null,
618
+ requirement: null,
619
+ holdId: null
620
+ }), n = X(!1), s = I(
621
+ async (c, a) => {
622
+ r((o) => ({
623
+ ...o,
624
+ status: "loading",
625
+ error: null
626
+ }));
627
+ try {
628
+ const o = await e.requestQuote(c, a);
629
+ return r((d) => ({
630
+ ...d,
631
+ status: "idle",
632
+ requirement: o
633
+ })), o;
634
+ } catch (o) {
635
+ const d = o instanceof Error ? o.message : "Failed to fetch credits quote";
636
+ return r((i) => ({
637
+ ...i,
638
+ status: "error",
639
+ error: d
640
+ })), null;
641
+ }
642
+ },
643
+ [e]
644
+ ), u = I(
645
+ async (c, a) => {
646
+ r((o) => ({
647
+ ...o,
648
+ status: "loading",
649
+ error: null
650
+ }));
651
+ try {
652
+ const o = Ce(c), d = await e.requestCartQuote(o, a);
653
+ return r((i) => ({
654
+ ...i,
655
+ status: "idle"
656
+ })), d;
657
+ } catch (o) {
658
+ const d = o instanceof Error ? o.message : "Failed to fetch cart credits quote";
659
+ return r((i) => ({
660
+ ...i,
661
+ status: "error",
662
+ error: d
663
+ })), null;
664
+ }
665
+ },
666
+ [e]
667
+ ), g = I(
668
+ async (c, a, o, d) => {
669
+ if (n.current)
670
+ return { success: !1, error: "Payment already in progress" };
671
+ n.current = !0, r({
672
+ status: "loading",
673
+ error: null,
674
+ transactionId: null,
675
+ requirement: null,
676
+ holdId: null
677
+ });
678
+ try {
679
+ const i = await e.processPayment(c, a, o, d);
680
+ return r({
681
+ status: i.success ? "success" : "error",
682
+ error: i.success ? null : i.error || "Credits payment failed",
683
+ transactionId: i.success && i.transactionId || null,
684
+ requirement: null,
685
+ holdId: null
686
+ }), i;
687
+ } catch (i) {
688
+ const l = i instanceof Error ? i.message : "Credits payment failed";
689
+ return r({
690
+ status: "error",
691
+ error: l,
692
+ transactionId: null,
693
+ requirement: null,
694
+ holdId: null
695
+ }), { success: !1, error: l };
696
+ } finally {
697
+ n.current = !1;
698
+ }
699
+ },
700
+ [e]
701
+ ), b = I(
702
+ async (c, a, o, d) => {
703
+ if (n.current)
704
+ return { success: !1, error: "Payment already in progress" };
705
+ n.current = !0, r({
706
+ status: "loading",
707
+ error: null,
708
+ transactionId: null,
709
+ requirement: null,
710
+ holdId: null
711
+ });
712
+ let i = null;
713
+ try {
714
+ const l = Ce(c), p = await e.requestCartQuote(l, o);
715
+ if (!p)
716
+ return r({
717
+ status: "error",
718
+ error: "Credits payment not available for this cart",
719
+ transactionId: null,
720
+ requirement: null,
721
+ holdId: null
722
+ }), { success: !1, error: "Credits payment not available" };
723
+ i = (await e.createCartHold({
724
+ cartId: p.cartId,
725
+ authToken: a
726
+ })).holdId, r((y) => ({
727
+ ...y,
728
+ holdId: i
729
+ }));
730
+ const w = await e.authorizeCartPayment({
731
+ cartId: p.cartId,
732
+ holdId: i,
733
+ authToken: a,
734
+ metadata: d
735
+ });
736
+ if (!w.success && i)
737
+ try {
738
+ await e.releaseHold(i, a);
739
+ } catch (y) {
740
+ j().warn("[useCreditsPayment] Hold release failed, will expire server-side", {
741
+ holdId: i,
742
+ error: y instanceof Error ? y.message : String(y)
743
+ });
744
+ }
745
+ return r({
746
+ status: w.success ? "success" : "error",
747
+ error: w.success ? null : w.error || "Cart credits payment failed",
748
+ transactionId: w.success && w.transactionId || null,
749
+ requirement: null,
750
+ holdId: null
751
+ }), {
752
+ success: w.success,
753
+ transactionId: w.transactionId,
754
+ error: w.error
755
+ };
756
+ } catch (l) {
757
+ const p = l instanceof Error ? l.message : "Cart credits payment failed";
758
+ if (i)
759
+ try {
760
+ await e.releaseHold(i, a);
761
+ } catch (m) {
762
+ j().warn("[useCreditsPayment] Hold release failed, will expire server-side", {
763
+ holdId: i,
764
+ error: m instanceof Error ? m.message : String(m)
765
+ });
766
+ }
767
+ return r({
768
+ status: "error",
769
+ error: p,
770
+ transactionId: null,
771
+ requirement: null,
772
+ holdId: null
773
+ }), { success: !1, error: p };
774
+ } finally {
775
+ n.current = !1;
776
+ }
777
+ },
778
+ [e]
779
+ ), h = I(() => {
780
+ r({
781
+ status: "idle",
782
+ error: null,
783
+ transactionId: null,
784
+ requirement: null,
785
+ holdId: null
786
+ }), n.current = !1;
787
+ }, []);
788
+ return {
789
+ ...t,
790
+ fetchQuote: s,
791
+ fetchCartQuote: u,
792
+ processPayment: g,
793
+ processCartPayment: b,
794
+ reset: h
795
+ };
796
+ }
797
+ function Te({
798
+ resource: e,
799
+ items: t,
800
+ authToken: r,
801
+ metadata: n,
802
+ couponCode: s,
803
+ label: u,
804
+ disabled: g = !1,
805
+ onAttempt: b,
806
+ onSuccess: h,
807
+ onError: c,
808
+ className: a = ""
809
+ }) {
810
+ const { status: o, error: d, transactionId: i, processPayment: l, processCartPayment: p } = et(), m = V(), { isCartMode: w, effectiveResource: y } = he(e, t), { t: k, translations: P } = ne(), E = u || k("ui.pay_with_credits") || "Pay with Credits", M = m.unstyled ? a : `${m.className} cedros-theme__credits-button ${a}`.trim(), $ = d && typeof d != "string" ? d?.code ?? null : null, U = d ? typeof d == "string" ? d : ((N) => {
811
+ if (!N || !P) return "";
812
+ const v = P.errors[N];
813
+ return v ? v.action ? `${v.message} ${v.action}` : v.message : "";
814
+ })($) : null, D = I(async () => {
815
+ j().debug("[CreditsButton] executePayment");
816
+ const N = w && t ? ge(t) : void 0;
817
+ if (oe("credits", y, N), b && b("credits"), !r) {
818
+ const x = "Authentication required: please log in to pay with credits";
819
+ j().error("[CreditsButton]", x), Y("credits", x, y, N), c && c(x);
820
+ return;
821
+ }
822
+ if (!w && !y) {
823
+ const x = "Invalid payment configuration: missing resource";
824
+ j().error("[CreditsButton]", x), Y("credits", x, y, N), c && c(x);
825
+ return;
826
+ }
827
+ let v;
828
+ ae("credits", y, N), w && t ? (j().debug("[CreditsButton] Processing cart checkout"), v = await p(t, r, s, n)) : y && (j().debug("[CreditsButton] Processing single payment"), v = await l(y, r, s, n)), v && v.success && v.transactionId ? (ie("credits", v.transactionId, y, N), h && h(v.transactionId)) : v && !v.success && v.error && (Y("credits", v.error, y, N), c && c(v.error));
829
+ }, [
830
+ r,
831
+ w,
832
+ y,
833
+ t,
834
+ s,
835
+ n,
836
+ l,
837
+ p,
838
+ b,
839
+ h,
840
+ c
841
+ ]), C = F(() => w && t ? `credits-cart-${t.map((N) => N.resource).join("-")}` : `credits-${y || "unknown"}`, [w, t, y]), _ = F(
842
+ () => se(C, D),
843
+ [C, D]
844
+ ), A = o === "loading", T = g || A;
845
+ return /* @__PURE__ */ S("div", { className: M, style: m.unstyled ? {} : m.style, children: [
846
+ /* @__PURE__ */ f(
847
+ "button",
848
+ {
849
+ onClick: _,
850
+ disabled: T,
851
+ className: m.unstyled ? a : "cedros-theme__button cedros-theme__credits",
852
+ type: "button",
853
+ children: A ? k("ui.processing") : E
854
+ }
855
+ ),
856
+ U && /* @__PURE__ */ f("div", { className: m.unstyled ? "" : "cedros-theme__error", children: U }),
857
+ i && /* @__PURE__ */ f("div", { className: m.unstyled ? "" : "cedros-theme__success", children: k("ui.payment_successful") })
858
+ ] });
859
+ }
860
+ const tt = q.lazy(
861
+ () => import("./CryptoButton-CksMkZjL.mjs").then((e) => e.a).then((e) => ({ default: e.CryptoButton }))
862
+ ), rt = ({
863
+ isOpen: e,
864
+ onClose: t,
865
+ resource: r,
866
+ items: n,
867
+ cardLabel: s = "Card",
868
+ cryptoLabel: u = "USDC (Solana)",
869
+ creditsLabel: g = "Pay with Credits",
870
+ showCard: b = !0,
871
+ showCrypto: h = !0,
872
+ showCredits: c = !1,
873
+ onPaymentAttempt: a,
874
+ onPaymentSuccess: o,
875
+ onPaymentError: d,
876
+ onStripeSuccess: i,
877
+ onCryptoSuccess: l,
878
+ onCreditsSuccess: p,
879
+ onStripeError: m,
880
+ onCryptoError: w,
881
+ onCreditsError: y,
882
+ customerEmail: k,
883
+ successUrl: P,
884
+ cancelUrl: E,
885
+ metadata: M,
886
+ couponCode: $,
887
+ authToken: z,
888
+ testPageUrl: U,
889
+ hideMessages: D = !1
890
+ }) => {
891
+ const { tokens: C } = V();
892
+ return te(() => {
893
+ const _ = (A) => {
894
+ A.key === "Escape" && e && t();
895
+ };
896
+ return window.addEventListener("keydown", _), () => window.removeEventListener("keydown", _);
897
+ }, [e, t]), te(() => {
898
+ if (e) {
899
+ const _ = window.scrollY;
900
+ return document.body.style.position = "fixed", document.body.style.top = `-${_}px`, document.body.style.width = "100%", document.body.style.overflowY = "scroll", () => {
901
+ const A = document.body.style.top ? Math.abs(parseInt(document.body.style.top.replace("px", ""), 10)) : 0;
902
+ document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", document.body.style.overflowY = "", window.scrollTo(0, A);
903
+ };
904
+ }
905
+ }, [e]), e ? /* @__PURE__ */ f(
906
+ "div",
907
+ {
908
+ className: "cedros-modal-overlay",
909
+ style: {
910
+ position: "fixed",
911
+ top: 0,
912
+ left: 0,
913
+ right: 0,
914
+ bottom: 0,
915
+ backgroundColor: C.modalOverlay,
916
+ display: "flex",
917
+ alignItems: "center",
918
+ justifyContent: "center",
919
+ zIndex: 9999,
920
+ padding: "1rem"
921
+ },
922
+ onClick: t,
923
+ children: /* @__PURE__ */ S(
924
+ "div",
925
+ {
926
+ className: "cedros-modal-content",
927
+ style: {
928
+ backgroundColor: C.modalBackground,
929
+ borderRadius: "12px",
930
+ padding: "2rem",
931
+ maxWidth: "400px",
932
+ width: "100%",
933
+ boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
934
+ border: `1px solid ${C.modalBorder}`
935
+ },
936
+ onClick: (_) => _.stopPropagation(),
937
+ children: [
938
+ /* @__PURE__ */ S(
939
+ "div",
940
+ {
941
+ style: {
942
+ display: "flex",
943
+ justifyContent: "space-between",
944
+ alignItems: "center",
945
+ marginBottom: "1.5rem"
946
+ },
947
+ children: [
948
+ /* @__PURE__ */ f(
949
+ "h3",
950
+ {
951
+ style: {
952
+ margin: 0,
953
+ fontSize: "1.25rem",
954
+ fontWeight: 600,
955
+ color: C.surfaceText
956
+ },
957
+ children: "Choose Payment Method"
958
+ }
959
+ ),
960
+ /* @__PURE__ */ f(
961
+ "button",
962
+ {
963
+ type: "button",
964
+ onClick: t,
965
+ style: He(C.surfaceText),
966
+ "aria-label": "Close modal",
967
+ children: "×"
968
+ }
969
+ )
970
+ ]
971
+ }
972
+ ),
973
+ /* @__PURE__ */ S("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
974
+ b && /* @__PURE__ */ f(
975
+ Me,
976
+ {
977
+ resource: r,
978
+ items: n,
979
+ label: s,
980
+ onAttempt: a,
981
+ onSuccess: i || o,
982
+ onError: m || d,
983
+ customerEmail: k,
984
+ successUrl: P,
985
+ cancelUrl: E,
986
+ metadata: M,
987
+ couponCode: $
988
+ }
989
+ ),
990
+ h && /* @__PURE__ */ f(q.Suspense, { fallback: null, children: /* @__PURE__ */ f(
991
+ tt,
992
+ {
993
+ resource: r,
994
+ items: n,
995
+ label: u,
996
+ onAttempt: a,
997
+ onSuccess: l || o,
998
+ onError: w || d,
999
+ testPageUrl: U,
1000
+ hideMessages: D,
1001
+ metadata: M,
1002
+ couponCode: $
1003
+ }
1004
+ ) }),
1005
+ c && /* @__PURE__ */ f(
1006
+ Te,
1007
+ {
1008
+ resource: r,
1009
+ items: n,
1010
+ label: g,
1011
+ authToken: z,
1012
+ onAttempt: a ? () => a("credits") : void 0,
1013
+ onSuccess: p || o,
1014
+ onError: y || d,
1015
+ metadata: M,
1016
+ couponCode: $
1017
+ }
1018
+ )
1019
+ ] })
1020
+ ]
1021
+ }
1022
+ )
1023
+ }
1024
+ ) : null;
1025
+ }, nt = ({
1026
+ resource: e,
1027
+ items: t,
1028
+ label: r,
1029
+ cardLabel: n,
1030
+ cryptoLabel: s,
1031
+ creditsLabel: u,
1032
+ showCard: g = !0,
1033
+ showCrypto: b = !0,
1034
+ showCredits: h = !1,
1035
+ onPaymentAttempt: c,
1036
+ onPaymentSuccess: a,
1037
+ onPaymentError: o,
1038
+ onStripeSuccess: d,
1039
+ onCryptoSuccess: i,
1040
+ onCreditsSuccess: l,
1041
+ onStripeError: p,
1042
+ onCryptoError: m,
1043
+ onCreditsError: w,
1044
+ customerEmail: y,
1045
+ successUrl: k,
1046
+ cancelUrl: P,
1047
+ metadata: E,
1048
+ couponCode: M,
1049
+ authToken: $,
1050
+ autoDetectWallets: z = !0,
1051
+ testPageUrl: U,
1052
+ hideMessages: D = !1,
1053
+ renderModal: C
1054
+ }) => {
1055
+ const _ = V(), [A, T] = Q(!1), { status: N, processPayment: v, processCartCheckout: x } = Ie(), { isCartMode: R, effectiveResource: W } = he(e, t), { t: B } = ne(), H = r || B("ui.purchase"), De = n || B("ui.card"), je = s || B("ui.usdc_solana"), Be = u || B("ui.pay_with_credits") || "Pay with Credits", ve = I(async () => {
1056
+ if (z && g) {
1057
+ const { detectSolanaWallets: L } = await import("./walletDetection-JZR3UCOa.mjs");
1058
+ if (!L()) {
1059
+ const le = R ? void 0 : W, ue = R && t ? ge(t) : void 0;
1060
+ oe("stripe", le, ue), c && c("stripe"), ae("stripe", le, ue);
1061
+ let O;
1062
+ R && t ? O = await x(
1063
+ t,
1064
+ k,
1065
+ P,
1066
+ E,
1067
+ y,
1068
+ M
1069
+ ) : W && (O = await v(
1070
+ W,
1071
+ k,
1072
+ P,
1073
+ E,
1074
+ y,
1075
+ M
1076
+ )), O && O.success && O.transactionId ? (ie("stripe", O.transactionId, le, ue), d ? d(O.transactionId) : a && a(O.transactionId)) : O && !O.success && O.error && (Y("stripe", O.error, le, ue), p ? p(O.error) : o && o(O.error));
1077
+ return;
1078
+ }
1079
+ }
1080
+ T(!0);
1081
+ }, [z, g, R, t, W, x, v, k, P, E, y, M, a, o, d, p, c]), Pe = F(() => R && t ? `purchase-cart-${t.map((L) => L.resource).join("-")}` : `purchase-${W || "unknown"}`, [R, t, W]), Le = F(
1082
+ () => se(Pe, ve),
1083
+ [Pe, ve]
1084
+ ), ce = N === "loading", xe = {
1085
+ isOpen: A,
1086
+ onClose: () => T(!1),
1087
+ resource: R ? void 0 : W,
1088
+ items: R ? t : void 0,
1089
+ cardLabel: De,
1090
+ cryptoLabel: je,
1091
+ creditsLabel: Be,
1092
+ showCard: g,
1093
+ showCrypto: b,
1094
+ showCredits: h,
1095
+ onPaymentAttempt: c,
1096
+ onPaymentSuccess: (L) => {
1097
+ T(!1), a?.(L);
1098
+ },
1099
+ onPaymentError: (L) => {
1100
+ T(!1), o?.(L);
1101
+ },
1102
+ onStripeSuccess: (L) => {
1103
+ T(!1), d?.(L);
1104
+ },
1105
+ onCryptoSuccess: (L) => {
1106
+ T(!1), i?.(L);
1107
+ },
1108
+ onCreditsSuccess: (L) => {
1109
+ T(!1), l?.(L);
1110
+ },
1111
+ onStripeError: (L) => {
1112
+ T(!1), p?.(L);
1113
+ },
1114
+ onCryptoError: (L) => {
1115
+ T(!1), m?.(L);
1116
+ },
1117
+ onCreditsError: (L) => {
1118
+ T(!1), w?.(L);
1119
+ },
1120
+ customerEmail: y,
1121
+ successUrl: k,
1122
+ cancelUrl: P,
1123
+ metadata: E,
1124
+ couponCode: M,
1125
+ authToken: $,
1126
+ testPageUrl: U,
1127
+ hideMessages: D
1128
+ };
1129
+ return /* @__PURE__ */ S("div", { className: _.unstyled ? "" : _.className, style: _.unstyled ? {} : _.style, children: [
1130
+ /* @__PURE__ */ f(
1131
+ "button",
1132
+ {
1133
+ onClick: Le,
1134
+ disabled: ce,
1135
+ className: _.unstyled ? "" : "cedros-theme__button cedros-theme__stripe",
1136
+ style: {
1137
+ width: "100%",
1138
+ cursor: ce ? "not-allowed" : "pointer",
1139
+ opacity: ce ? 0.6 : 1
1140
+ },
1141
+ type: "button",
1142
+ children: ce ? B("ui.processing") : H
1143
+ }
1144
+ ),
1145
+ C ? C(xe) : /* @__PURE__ */ f(rt, { ...xe })
1146
+ ] });
1147
+ }, st = {
1148
+ "mainnet-beta": "https://api.mainnet-beta.solana.com",
1149
+ devnet: "https://api.devnet.solana.com",
1150
+ testnet: "https://api.testnet.solana.com"
1151
+ };
1152
+ function ot() {
1153
+ const [e, t] = q.useState(null);
1154
+ return q.useEffect(() => {
1155
+ let r = !1;
1156
+ return import("@solana/wallet-adapter-react").then((n) => {
1157
+ r || t(n);
1158
+ }), () => {
1159
+ r = !0;
1160
+ };
1161
+ }, []), e;
1162
+ }
1163
+ function at({
1164
+ endpoint: e,
1165
+ wallets: t,
1166
+ children: r
1167
+ }) {
1168
+ const n = ot();
1169
+ if (!n) return /* @__PURE__ */ f(me, { children: r });
1170
+ const { ConnectionProvider: s, WalletProvider: u } = n;
1171
+ return /* @__PURE__ */ f(s, { endpoint: e, children: /* @__PURE__ */ f(u, { wallets: t, autoConnect: !1, children: r }) });
1172
+ }
1173
+ const it = q.lazy(
1174
+ () => import("./CryptoButton-CksMkZjL.mjs").then((e) => e.a).then((e) => ({ default: e.CryptoButton }))
1175
+ );
1176
+ function qt(e) {
1177
+ const { resource: t, items: r, checkout: n = {}, display: s = {}, callbacks: u = {}, advanced: g = {} } = e, { config: b, walletPool: h } = re(), c = V(), { isCartMode: a } = he(t, r), o = s.showCrypto ?? !0, d = q.useMemo(() => ({
1178
+ marginTop: "0.5rem",
1179
+ fontSize: "0.875rem",
1180
+ color: c.tokens.surfaceText,
1181
+ opacity: 0.7,
1182
+ textAlign: "center"
1183
+ }), [c.tokens.surfaceText]), i = q.useMemo(
1184
+ () => o ? g.wallets && g.wallets.length > 0 ? g.wallets : h.getAdapters() : [],
1185
+ [g.wallets, h, o]
1186
+ ), l = q.useMemo(
1187
+ () => r ? ge(r) : 0,
1188
+ [r]
1189
+ ), { onPaymentSuccess: p, onPaymentError: m, onPaymentAttempt: w } = u, y = q.useCallback(
1190
+ (x) => p?.({ transactionId: x, method: "stripe" }),
1191
+ [p]
1192
+ ), k = q.useCallback(
1193
+ (x) => p?.({ transactionId: x, method: "crypto" }),
1194
+ [p]
1195
+ ), P = q.useCallback(
1196
+ (x) => m?.({ message: x, method: "stripe" }),
1197
+ [m]
1198
+ ), E = q.useCallback(
1199
+ (x) => m?.({ message: x, method: "crypto" }),
1200
+ [m]
1201
+ ), M = q.useCallback(
1202
+ (x) => p?.({ transactionId: x, method: "credits" }),
1203
+ [p]
1204
+ ), $ = q.useCallback(
1205
+ (x) => m?.({ message: x, method: "credits" }),
1206
+ [m]
1207
+ ), z = q.useCallback(
1208
+ () => w?.("credits"),
1209
+ [w]
1210
+ ), U = o ? b.solanaEndpoint ?? st[b.solanaCluster] : "";
1211
+ if (!t && (!r || r.length === 0))
1212
+ return j().error('CedrosPay: Must provide either "resource" or "items" prop'), /* @__PURE__ */ f("div", { className: s.className, style: { color: c.tokens.errorText }, children: "Configuration error: No resource or items provided" });
1213
+ const D = s.showCard ?? !0, C = s.showCredits ?? !1, _ = s.showPurchaseButton ?? !1, A = s.layout ?? "vertical", T = s.hideMessages ?? !1, N = g.autoDetectWallets ?? !0, v = /* @__PURE__ */ f("div", { className: c.unstyled ? s.className : `cedros-theme__pay ${s.className || ""}`, children: /* @__PURE__ */ S("div", { className: c.unstyled ? "" : `cedros-theme__pay-content cedros-theme__pay-content--${A}`, children: [
1214
+ _ ? /* @__PURE__ */ f(
1215
+ nt,
1216
+ {
1217
+ resource: a ? void 0 : t || r?.[0]?.resource,
1218
+ items: a ? r : void 0,
1219
+ label: s.purchaseLabel,
1220
+ cardLabel: s.cardLabel,
1221
+ cryptoLabel: s.cryptoLabel,
1222
+ showCard: D,
1223
+ showCrypto: o,
1224
+ onPaymentAttempt: u.onPaymentAttempt,
1225
+ onPaymentSuccess: y,
1226
+ onPaymentError: P,
1227
+ onStripeSuccess: y,
1228
+ onCryptoSuccess: k,
1229
+ onStripeError: P,
1230
+ onCryptoError: E,
1231
+ customerEmail: n.customerEmail,
1232
+ successUrl: n.successUrl,
1233
+ cancelUrl: n.cancelUrl,
1234
+ metadata: n.metadata,
1235
+ couponCode: n.couponCode,
1236
+ autoDetectWallets: N,
1237
+ testPageUrl: g.testPageUrl,
1238
+ hideMessages: T,
1239
+ renderModal: s.renderModal
1240
+ }
1241
+ ) : /* @__PURE__ */ S(me, { children: [
1242
+ D && /* @__PURE__ */ f(
1243
+ Me,
1244
+ {
1245
+ resource: a ? void 0 : t || r?.[0]?.resource,
1246
+ items: a ? r : void 0,
1247
+ customerEmail: n.customerEmail,
1248
+ successUrl: n.successUrl,
1249
+ cancelUrl: n.cancelUrl,
1250
+ metadata: n.metadata,
1251
+ couponCode: n.couponCode,
1252
+ label: s.cardLabel,
1253
+ onAttempt: u.onPaymentAttempt,
1254
+ onSuccess: y,
1255
+ onError: P
1256
+ }
1257
+ ),
1258
+ o && /* @__PURE__ */ f(q.Suspense, { fallback: null, children: /* @__PURE__ */ f(
1259
+ it,
1260
+ {
1261
+ resource: a ? void 0 : t || r?.[0]?.resource,
1262
+ items: a ? r : void 0,
1263
+ metadata: n.metadata,
1264
+ couponCode: n.couponCode,
1265
+ label: s.cryptoLabel,
1266
+ onAttempt: u.onPaymentAttempt,
1267
+ onSuccess: k,
1268
+ onError: E,
1269
+ testPageUrl: g.testPageUrl,
1270
+ hideMessages: T
1271
+ }
1272
+ ) }),
1273
+ C && /* @__PURE__ */ f(
1274
+ Te,
1275
+ {
1276
+ resource: a ? void 0 : t || r?.[0]?.resource,
1277
+ items: a ? r : void 0,
1278
+ authToken: n.authToken,
1279
+ metadata: n.metadata,
1280
+ couponCode: n.couponCode,
1281
+ label: s.creditsLabel,
1282
+ onAttempt: z,
1283
+ onSuccess: M,
1284
+ onError: $
1285
+ }
1286
+ )
1287
+ ] }),
1288
+ a && r && r.length > 1 && !T && /* @__PURE__ */ S("div", { style: d, children: [
1289
+ "Checking out ",
1290
+ l,
1291
+ " items"
1292
+ ] })
1293
+ ] }) });
1294
+ return /* @__PURE__ */ f("div", { className: c.unstyled ? s.className : c.className, style: c.unstyled ? {} : c.style, children: /* @__PURE__ */ f(at, { endpoint: U || "https://api.devnet.solana.com", wallets: i, children: v }) });
1295
+ }
1296
+ function zt({
1297
+ product: e,
1298
+ paymentMethod: t,
1299
+ showOriginalPrice: r = !1,
1300
+ className: n = "",
1301
+ style: s = {}
1302
+ }) {
1303
+ const u = t === "stripe", g = u ? e.fiatAmount : e.cryptoAmount, b = u ? e.effectiveFiatAmount : e.effectiveCryptoAmount, h = u ? e.fiatCurrency.toUpperCase() : e.cryptoToken, c = u ? e.hasStripeCoupon : e.hasCryptoCoupon, a = u ? e.stripeDiscountPercent : e.cryptoDiscountPercent;
1304
+ return /* @__PURE__ */ S("div", { className: n, style: s, children: [
1305
+ r && c && /* @__PURE__ */ S(
1306
+ "span",
1307
+ {
1308
+ style: {
1309
+ textDecoration: "line-through",
1310
+ opacity: 0.6,
1311
+ marginRight: "0.5rem",
1312
+ fontSize: "0.875em"
1313
+ },
1314
+ children: [
1315
+ g.toFixed(2),
1316
+ " ",
1317
+ h
1318
+ ]
1319
+ }
1320
+ ),
1321
+ /* @__PURE__ */ S("span", { style: { fontWeight: 600 }, children: [
1322
+ b.toFixed(2),
1323
+ " ",
1324
+ h
1325
+ ] }),
1326
+ c && a > 0 && /* @__PURE__ */ S(
1327
+ "span",
1328
+ {
1329
+ style: {
1330
+ marginLeft: "0.5rem",
1331
+ padding: "0.125rem 0.375rem",
1332
+ backgroundColor: "#10b981",
1333
+ color: "white",
1334
+ borderRadius: "0.25rem",
1335
+ fontSize: "0.75em",
1336
+ fontWeight: 600
1337
+ },
1338
+ children: [
1339
+ a,
1340
+ "% OFF"
1341
+ ]
1342
+ }
1343
+ )
1344
+ ] });
1345
+ }
1346
+ function Ut({
1347
+ product: e,
1348
+ paymentMethod: t,
1349
+ className: r = "",
1350
+ style: n = {}
1351
+ }) {
1352
+ const s = t === "stripe", u = s ? e.hasStripeCoupon : e.hasCryptoCoupon, g = s ? e.stripeDiscountPercent : e.cryptoDiscountPercent, b = s ? e.stripeCouponCode : e.cryptoCouponCode;
1353
+ if (!u || g === 0)
1354
+ return null;
1355
+ const h = s ? `${g}% off with card!` : `${g}% off with crypto!`;
1356
+ return /* @__PURE__ */ S(
1357
+ "div",
1358
+ {
1359
+ className: r,
1360
+ style: {
1361
+ display: "inline-flex",
1362
+ alignItems: "center",
1363
+ padding: "0.5rem 0.75rem",
1364
+ backgroundColor: s ? "#6366f1" : "#10b981",
1365
+ color: "white",
1366
+ borderRadius: "0.375rem",
1367
+ fontSize: "0.875rem",
1368
+ fontWeight: 600,
1369
+ ...n
1370
+ },
1371
+ children: [
1372
+ h,
1373
+ b && /* @__PURE__ */ S(
1374
+ "span",
1375
+ {
1376
+ style: {
1377
+ marginLeft: "0.5rem",
1378
+ opacity: 0.8,
1379
+ fontSize: "0.75em",
1380
+ fontWeight: 400
1381
+ },
1382
+ children: [
1383
+ "(",
1384
+ b,
1385
+ ")"
1386
+ ]
1387
+ }
1388
+ )
1389
+ ]
1390
+ }
1391
+ );
1392
+ }
1393
+ function ct() {
1394
+ const { subscriptionManager: e } = re(), [t, r] = Q({
1395
+ status: "idle",
1396
+ error: null,
1397
+ sessionId: null,
1398
+ subscriptionStatus: null,
1399
+ expiresAt: null
1400
+ }), n = X(!1), s = I(
1401
+ async (h) => {
1402
+ if (n.current)
1403
+ return { success: !1, error: "Payment already in progress" };
1404
+ n.current = !0, r((c) => ({
1405
+ ...c,
1406
+ status: "loading",
1407
+ error: null
1408
+ }));
1409
+ try {
1410
+ const c = await e.processSubscription(h);
1411
+ return r((a) => ({
1412
+ ...a,
1413
+ status: c.success ? "success" : "error",
1414
+ error: c.success ? null : c.error || "Subscription failed",
1415
+ sessionId: c.success && c.transactionId || null
1416
+ })), c;
1417
+ } catch (c) {
1418
+ const a = pe(c, "Subscription failed");
1419
+ return r((o) => ({
1420
+ ...o,
1421
+ status: "error",
1422
+ error: a
1423
+ })), { success: !1, error: a };
1424
+ } finally {
1425
+ n.current = !1;
1426
+ }
1427
+ },
1428
+ [e]
1429
+ ), u = I(
1430
+ async (h) => {
1431
+ r((c) => ({
1432
+ ...c,
1433
+ status: "checking",
1434
+ error: null
1435
+ }));
1436
+ try {
1437
+ const c = await e.checkSubscriptionStatus(h);
1438
+ return r((a) => ({
1439
+ ...a,
1440
+ status: c.active ? "success" : "idle",
1441
+ subscriptionStatus: c.status,
1442
+ expiresAt: c.expiresAt || c.currentPeriodEnd || null
1443
+ })), c;
1444
+ } catch (c) {
1445
+ const a = c instanceof Error ? c.message : "Failed to check subscription status";
1446
+ throw r((o) => ({
1447
+ ...o,
1448
+ status: "error",
1449
+ error: a
1450
+ })), c;
1451
+ }
1452
+ },
1453
+ [e]
1454
+ ), g = I(
1455
+ async (h, c, a) => {
1456
+ r((o) => ({
1457
+ ...o,
1458
+ status: "loading",
1459
+ error: null
1460
+ }));
1461
+ try {
1462
+ const o = await e.requestSubscriptionQuote(
1463
+ h,
1464
+ c,
1465
+ a
1466
+ );
1467
+ return r((d) => ({
1468
+ ...d,
1469
+ status: "idle"
1470
+ })), o;
1471
+ } catch (o) {
1472
+ const d = o instanceof Error ? o.message : "Failed to get subscription quote";
1473
+ throw r((i) => ({
1474
+ ...i,
1475
+ status: "error",
1476
+ error: d
1477
+ })), o;
1478
+ }
1479
+ },
1480
+ [e]
1481
+ ), b = I(() => {
1482
+ r({
1483
+ status: "idle",
1484
+ error: null,
1485
+ sessionId: null,
1486
+ subscriptionStatus: null,
1487
+ expiresAt: null
1488
+ });
1489
+ }, []);
1490
+ return {
1491
+ ...t,
1492
+ processSubscription: s,
1493
+ checkStatus: u,
1494
+ requestQuote: g,
1495
+ reset: b
1496
+ };
1497
+ }
1498
+ function Ot({
1499
+ resource: e,
1500
+ interval: t,
1501
+ intervalDays: r,
1502
+ trialDays: n,
1503
+ successUrl: s,
1504
+ cancelUrl: u,
1505
+ metadata: g,
1506
+ customerEmail: b,
1507
+ couponCode: h,
1508
+ label: c,
1509
+ disabled: a = !1,
1510
+ onAttempt: o,
1511
+ onSuccess: d,
1512
+ onError: i,
1513
+ className: l = ""
1514
+ }) {
1515
+ const { status: p, error: m, sessionId: w, processSubscription: y } = ct(), k = V(), { t: P, translations: E } = ne(), M = c || P("ui.subscribe"), $ = k.unstyled ? l : `${k.className} cedros-theme__stripe-button ${l}`.trim(), z = m && typeof m != "string" ? m?.code ?? null : null, D = m ? typeof m == "string" ? m : ((v) => {
1516
+ if (!v || !E) return "";
1517
+ const x = E.errors[v];
1518
+ return x ? x.action ? `${x.message} ${x.action}` : x.message : "";
1519
+ })(z) : null, C = I(async () => {
1520
+ j().debug("[SubscribeButton] executeSubscription:", {
1521
+ resource: e,
1522
+ interval: t,
1523
+ intervalDays: r,
1524
+ trialDays: n,
1525
+ couponCode: h
1526
+ }), oe("stripe", e), o && o("stripe"), ae("stripe", e);
1527
+ const v = await y({
1528
+ resource: e,
1529
+ interval: t,
1530
+ intervalDays: r,
1531
+ trialDays: n,
1532
+ customerEmail: b,
1533
+ metadata: g,
1534
+ couponCode: h,
1535
+ successUrl: s,
1536
+ cancelUrl: u
1537
+ });
1538
+ v.success && v.transactionId ? (ie("stripe", v.transactionId, e), d && d(v.transactionId)) : !v.success && v.error && (Y("stripe", v.error, e), i && i(v.error));
1539
+ }, [
1540
+ e,
1541
+ t,
1542
+ r,
1543
+ n,
1544
+ b,
1545
+ g,
1546
+ h,
1547
+ s,
1548
+ u,
1549
+ y,
1550
+ o,
1551
+ d,
1552
+ i
1553
+ ]), _ = F(() => `subscribe-${e}-${t}`, [e, t]), A = F(
1554
+ () => se(_, C),
1555
+ [_, C]
1556
+ ), T = p === "loading", N = a || T;
1557
+ return /* @__PURE__ */ S("div", { className: $, style: k.unstyled ? {} : k.style, children: [
1558
+ /* @__PURE__ */ f(
1559
+ "button",
1560
+ {
1561
+ onClick: A,
1562
+ disabled: N,
1563
+ className: k.unstyled ? l : "cedros-theme__button cedros-theme__stripe",
1564
+ type: "button",
1565
+ children: T ? P("ui.processing") : M
1566
+ }
1567
+ ),
1568
+ D && /* @__PURE__ */ f("div", { className: k.unstyled ? "" : "cedros-theme__error", children: D }),
1569
+ w && /* @__PURE__ */ f("div", { className: k.unstyled ? "" : "cedros-theme__success", children: P("ui.redirecting_to_checkout") })
1570
+ ] });
1571
+ }
1572
+ function lt() {
1573
+ const { subscriptionManager: e, creditsManager: t } = re(), [r, n] = Q({
1574
+ status: "idle",
1575
+ error: null,
1576
+ sessionId: null,
1577
+ subscriptionStatus: null,
1578
+ expiresAt: null,
1579
+ creditsRequirement: null
1580
+ }), s = X(!1), u = I(
1581
+ async (c, a) => {
1582
+ n((o) => ({
1583
+ ...o,
1584
+ status: "checking",
1585
+ error: null
1586
+ }));
1587
+ try {
1588
+ const o = await e.checkSubscriptionStatus({
1589
+ resource: c,
1590
+ userId: a
1591
+ });
1592
+ return n((d) => ({
1593
+ ...d,
1594
+ status: o.active ? "success" : "idle",
1595
+ subscriptionStatus: o.status,
1596
+ expiresAt: o.expiresAt || o.currentPeriodEnd || null
1597
+ })), o;
1598
+ } catch (o) {
1599
+ const d = pe(o, "Failed to check subscription status");
1600
+ return n((i) => ({
1601
+ ...i,
1602
+ status: "error",
1603
+ error: d
1604
+ })), null;
1605
+ }
1606
+ },
1607
+ [e]
1608
+ ), g = I(
1609
+ async (c, a, o) => {
1610
+ n((d) => ({
1611
+ ...d,
1612
+ status: "loading",
1613
+ error: null
1614
+ }));
1615
+ try {
1616
+ const d = await t.requestQuote(
1617
+ c,
1618
+ o?.couponCode
1619
+ );
1620
+ return n((i) => ({
1621
+ ...i,
1622
+ status: "idle",
1623
+ creditsRequirement: d
1624
+ })), d;
1625
+ } catch (d) {
1626
+ const i = pe(d, "Failed to get subscription quote");
1627
+ return n((l) => ({
1628
+ ...l,
1629
+ status: "error",
1630
+ error: i
1631
+ })), null;
1632
+ }
1633
+ },
1634
+ [t]
1635
+ ), b = I(
1636
+ async (c, a, o, d) => {
1637
+ if (s.current)
1638
+ return { success: !1, error: "Payment already in progress" };
1639
+ if (!o) {
1640
+ const i = "Authentication required for credits payment";
1641
+ return n((l) => ({ ...l, status: "error", error: i })), { success: !1, error: i };
1642
+ }
1643
+ s.current = !0, n((i) => ({
1644
+ ...i,
1645
+ status: "loading",
1646
+ error: null
1647
+ }));
1648
+ try {
1649
+ const i = await t.processPayment(
1650
+ c,
1651
+ o,
1652
+ d?.couponCode,
1653
+ {
1654
+ interval: a,
1655
+ ...d?.intervalDays && { intervalDays: String(d.intervalDays) }
1656
+ }
1657
+ );
1658
+ return i.success ? n({
1659
+ status: "success",
1660
+ error: null,
1661
+ sessionId: i.transactionId || null,
1662
+ subscriptionStatus: "active",
1663
+ expiresAt: null,
1664
+ // Will be updated on next status check
1665
+ creditsRequirement: null
1666
+ }) : n((l) => ({
1667
+ ...l,
1668
+ status: "error",
1669
+ error: i.error || "Credits subscription payment failed"
1670
+ })), i;
1671
+ } catch (i) {
1672
+ const l = pe(i, "Credits subscription payment failed");
1673
+ return n((p) => ({
1674
+ ...p,
1675
+ status: "error",
1676
+ error: l
1677
+ })), { success: !1, error: l };
1678
+ } finally {
1679
+ s.current = !1;
1680
+ }
1681
+ },
1682
+ [t]
1683
+ ), h = I(() => {
1684
+ n({
1685
+ status: "idle",
1686
+ error: null,
1687
+ sessionId: null,
1688
+ subscriptionStatus: null,
1689
+ expiresAt: null,
1690
+ creditsRequirement: null
1691
+ });
1692
+ }, []);
1693
+ return {
1694
+ ...r,
1695
+ checkStatus: u,
1696
+ requestQuote: g,
1697
+ processPayment: b,
1698
+ reset: h
1699
+ };
1700
+ }
1701
+ function Ft({
1702
+ resource: e,
1703
+ interval: t,
1704
+ intervalDays: r,
1705
+ authToken: n,
1706
+ userId: s,
1707
+ couponCode: u,
1708
+ label: g,
1709
+ disabled: b = !1,
1710
+ onAttempt: h,
1711
+ onSuccess: c,
1712
+ onError: a,
1713
+ className: o = "",
1714
+ hideMessages: d = !1,
1715
+ autoCheckStatus: i = !1
1716
+ }) {
1717
+ const {
1718
+ status: l,
1719
+ error: p,
1720
+ subscriptionStatus: m,
1721
+ expiresAt: w,
1722
+ checkStatus: y,
1723
+ processPayment: k
1724
+ } = lt(), P = V(), { t: E, translations: M } = ne(), $ = X(y);
1725
+ te(() => {
1726
+ $.current = y;
1727
+ }, [y]), te(() => {
1728
+ i && s && (j().debug("[CreditsSubscribeButton] Auto-checking subscription status", { resource: e, userId: s }), $.current(e, s));
1729
+ }, [i, s, e]);
1730
+ const z = g || E("ui.subscribe_with_credits") || "Subscribe with Credits", U = p && typeof p != "string" ? p?.code ?? null : null, C = p ? typeof p == "string" ? p : ((B) => {
1731
+ if (!B || !M) return "";
1732
+ const H = M.errors[B];
1733
+ return H ? H.action ? `${H.message} ${H.action}` : H.message : "";
1734
+ })(U) : null, _ = I(async () => {
1735
+ if (j().debug("[CreditsSubscribeButton] executeSubscriptionFlow", {
1736
+ resource: e,
1737
+ interval: t,
1738
+ intervalDays: r,
1739
+ hasAuthToken: !!n
1740
+ }), oe("credits", e), h && h("credits"), !n) {
1741
+ const H = "Authentication required: please log in to subscribe with credits";
1742
+ j().error("[CreditsSubscribeButton]", H), Y("credits", H, e), a && a(H);
1743
+ return;
1744
+ }
1745
+ ae("credits", e);
1746
+ const B = await k(e, t, n, {
1747
+ couponCode: u,
1748
+ intervalDays: r
1749
+ });
1750
+ B.success && B.transactionId ? (ie("credits", B.transactionId, e), c && c(B.transactionId)) : !B.success && B.error && (Y("credits", B.error, e), a && a(B.error));
1751
+ }, [
1752
+ e,
1753
+ t,
1754
+ r,
1755
+ n,
1756
+ u,
1757
+ k,
1758
+ h,
1759
+ c,
1760
+ a
1761
+ ]), A = F(() => `credits-subscribe-${e}-${t}`, [e, t]), T = F(
1762
+ () => se(A, _, {
1763
+ cooldownMs: 200,
1764
+ deduplicationWindowMs: 0
1765
+ }),
1766
+ [A, _]
1767
+ ), N = l === "loading" || l === "checking", v = m === "active" || m === "trialing", x = b || N || v;
1768
+ let R = z;
1769
+ if (N)
1770
+ R = E("ui.processing");
1771
+ else if (v && w) {
1772
+ const B = new Date(w).toLocaleDateString();
1773
+ R = `${E("ui.subscribed_until")} ${B}`;
1774
+ } else v && (R = E("ui.subscribed"));
1775
+ const W = P.unstyled ? o : `${P.className} cedros-theme__credits-button ${o}`.trim();
1776
+ return /* @__PURE__ */ S("div", { className: W, style: P.unstyled ? {} : P.style, children: [
1777
+ /* @__PURE__ */ f(
1778
+ "button",
1779
+ {
1780
+ onClick: T,
1781
+ disabled: x,
1782
+ className: P.unstyled ? o : "cedros-theme__button cedros-theme__credits",
1783
+ type: "button",
1784
+ children: R
1785
+ }
1786
+ ),
1787
+ !d && C && /* @__PURE__ */ f("div", { className: P.unstyled ? "" : "cedros-theme__error", children: C }),
1788
+ !d && v && /* @__PURE__ */ f("div", { className: P.unstyled ? "" : "cedros-theme__success", children: E("ui.subscription_active") })
1789
+ ] });
1790
+ }
1791
+ function ut() {
1792
+ const { subscriptionChangeManager: e } = re(), [t, r] = Q({
1793
+ status: "idle",
1794
+ error: null,
1795
+ subscription: null,
1796
+ changePreview: null,
1797
+ userId: null
1798
+ }), n = X(t);
1799
+ n.current = t;
1800
+ const s = I(
1801
+ async (o, d) => {
1802
+ r((i) => ({ ...i, status: "loading", error: null }));
1803
+ try {
1804
+ const i = await e.getDetails(o, d);
1805
+ return r((l) => ({
1806
+ ...l,
1807
+ status: "success",
1808
+ subscription: i,
1809
+ userId: d
1810
+ })), i;
1811
+ } catch (i) {
1812
+ const l = i instanceof Error ? i.message : "Failed to load subscription";
1813
+ return r((p) => ({ ...p, status: "error", error: l })), null;
1814
+ }
1815
+ },
1816
+ [e]
1817
+ ), u = I(
1818
+ async (o, d, i, l) => {
1819
+ r((p) => ({ ...p, status: "loading", error: null }));
1820
+ try {
1821
+ const p = {
1822
+ currentResource: o,
1823
+ newResource: d,
1824
+ userId: i,
1825
+ newInterval: l
1826
+ }, m = await e.previewChange(p);
1827
+ return r((w) => ({
1828
+ ...w,
1829
+ status: "idle",
1830
+ changePreview: m
1831
+ })), m;
1832
+ } catch (p) {
1833
+ const m = p instanceof Error ? p.message : "Failed to preview change";
1834
+ return r((w) => ({ ...w, status: "error", error: m })), null;
1835
+ }
1836
+ },
1837
+ [e]
1838
+ ), g = I(
1839
+ async (o) => {
1840
+ const { subscription: d, userId: i } = n.current;
1841
+ if (!d || !i)
1842
+ return r((l) => ({ ...l, status: "error", error: "No subscription loaded" })), null;
1843
+ r((l) => ({ ...l, status: "loading", error: null }));
1844
+ try {
1845
+ const l = {
1846
+ currentResource: d.resource,
1847
+ newResource: o.newResource,
1848
+ userId: i,
1849
+ newInterval: o.newInterval,
1850
+ prorationBehavior: o.prorationBehavior,
1851
+ immediate: o.immediate
1852
+ }, p = await e.changeSubscription(l);
1853
+ return p.success ? r((m) => ({
1854
+ ...m,
1855
+ status: "success",
1856
+ subscription: m.subscription ? {
1857
+ ...m.subscription,
1858
+ resource: p.newResource,
1859
+ interval: p.newInterval,
1860
+ status: p.status
1861
+ } : null,
1862
+ changePreview: null
1863
+ })) : r((m) => ({
1864
+ ...m,
1865
+ status: "error",
1866
+ error: p.error || "Failed to change subscription"
1867
+ })), p;
1868
+ } catch (l) {
1869
+ const p = l instanceof Error ? l.message : "Failed to change subscription";
1870
+ return r((m) => ({ ...m, status: "error", error: p })), null;
1871
+ }
1872
+ },
1873
+ [e]
1874
+ ), b = I(
1875
+ async (o) => {
1876
+ const { subscription: d, userId: i } = n.current;
1877
+ if (!d || !i)
1878
+ return r((l) => ({ ...l, status: "error", error: "No subscription loaded" })), null;
1879
+ r((l) => ({ ...l, status: "loading", error: null }));
1880
+ try {
1881
+ const l = {
1882
+ resource: d.resource,
1883
+ userId: i,
1884
+ immediate: o
1885
+ }, p = await e.cancel(l);
1886
+ if (p.success) {
1887
+ const m = o ? "canceled" : d.status;
1888
+ r((w) => ({
1889
+ ...w,
1890
+ status: "success",
1891
+ subscription: w.subscription ? {
1892
+ ...w.subscription,
1893
+ status: m,
1894
+ cancelAtPeriodEnd: !o
1895
+ } : null
1896
+ }));
1897
+ } else
1898
+ r((m) => ({
1899
+ ...m,
1900
+ status: "error",
1901
+ error: p.error || "Failed to cancel subscription"
1902
+ }));
1903
+ return p;
1904
+ } catch (l) {
1905
+ const p = l instanceof Error ? l.message : "Failed to cancel subscription";
1906
+ return r((m) => ({ ...m, status: "error", error: p })), null;
1907
+ }
1908
+ },
1909
+ [e]
1910
+ ), h = I(
1911
+ async (o, d) => {
1912
+ r((i) => ({ ...i, status: "loading", error: null }));
1913
+ try {
1914
+ const i = await e.getBillingPortalUrl({
1915
+ userId: o,
1916
+ returnUrl: d
1917
+ });
1918
+ try {
1919
+ if (new URL(i.url).protocol !== "https:")
1920
+ throw new Error("Billing portal URL must use HTTPS");
1921
+ } catch {
1922
+ throw new Error("Invalid billing portal URL");
1923
+ }
1924
+ return window.location.href = i.url, i;
1925
+ } catch (i) {
1926
+ const l = i instanceof Error ? i.message : "Failed to open billing portal";
1927
+ return r((p) => ({ ...p, status: "error", error: l })), null;
1928
+ }
1929
+ },
1930
+ [e]
1931
+ ), c = I(() => {
1932
+ r((o) => ({ ...o, changePreview: null }));
1933
+ }, []), a = I(() => {
1934
+ r({
1935
+ status: "idle",
1936
+ error: null,
1937
+ subscription: null,
1938
+ changePreview: null,
1939
+ userId: null
1940
+ });
1941
+ }, []);
1942
+ return {
1943
+ ...t,
1944
+ loadSubscription: s,
1945
+ previewChange: u,
1946
+ changeSubscription: g,
1947
+ cancelSubscription: b,
1948
+ openBillingPortal: h,
1949
+ clearPreview: c,
1950
+ reset: a
1951
+ };
1952
+ }
1953
+ const dt = {
1954
+ bg: "#fff",
1955
+ bgMuted: "#f9fafb",
1956
+ bgHighlight: "#eff6ff",
1957
+ text: "#111827",
1958
+ textMuted: "#6b7280",
1959
+ textFaint: "#9ca3af",
1960
+ border: "#e5e7eb",
1961
+ borderLight: "#f3f4f6",
1962
+ primary: "#3b82f6",
1963
+ error: "#ef4444",
1964
+ errorBg: "#fef2f2",
1965
+ errorBorder: "#fecaca",
1966
+ warningBg: "#fef3c7",
1967
+ warningBorder: "#fcd34d",
1968
+ warningText: "#92400e",
1969
+ buttonBg: "#f3f4f6",
1970
+ buttonBorder: "#d1d5db",
1971
+ buttonText: "#374151"
1972
+ }, pt = {
1973
+ bg: "#1e293b",
1974
+ bgMuted: "#334155",
1975
+ bgHighlight: "rgba(59, 130, 246, 0.15)",
1976
+ text: "#f1f5f9",
1977
+ textMuted: "#94a3b8",
1978
+ textFaint: "#64748b",
1979
+ border: "#475569",
1980
+ borderLight: "#334155",
1981
+ primary: "#3b82f6",
1982
+ error: "#ef4444",
1983
+ errorBg: "rgba(239, 68, 68, 0.15)",
1984
+ errorBorder: "rgba(239, 68, 68, 0.3)",
1985
+ warningBg: "rgba(245, 158, 11, 0.15)",
1986
+ warningBorder: "rgba(245, 158, 11, 0.3)",
1987
+ warningText: "#fbbf24",
1988
+ buttonBg: "#334155",
1989
+ buttonBorder: "#475569",
1990
+ buttonText: "#e2e8f0"
1991
+ };
1992
+ function ft(e) {
1993
+ const t = e ? pt : dt;
1994
+ return {
1995
+ container: {
1996
+ padding: "24px",
1997
+ backgroundColor: t.bg,
1998
+ borderRadius: "8px",
1999
+ border: `1px solid ${t.border}`,
2000
+ fontFamily: "system-ui, -apple-system, sans-serif",
2001
+ color: t.text
2002
+ },
2003
+ error: {
2004
+ padding: "12px 16px",
2005
+ backgroundColor: t.errorBg,
2006
+ border: `1px solid ${t.errorBorder}`,
2007
+ borderRadius: "6px",
2008
+ color: t.error,
2009
+ marginBottom: "16px"
2010
+ },
2011
+ loading: {
2012
+ padding: "24px",
2013
+ textAlign: "center",
2014
+ color: t.textMuted
2015
+ },
2016
+ details: {
2017
+ marginBottom: "24px"
2018
+ },
2019
+ title: {
2020
+ margin: "0 0 16px 0",
2021
+ fontSize: "18px",
2022
+ fontWeight: 600,
2023
+ color: t.text
2024
+ },
2025
+ detailRow: {
2026
+ display: "flex",
2027
+ justifyContent: "space-between",
2028
+ alignItems: "center",
2029
+ padding: "8px 0",
2030
+ borderBottom: `1px solid ${t.borderLight}`
2031
+ },
2032
+ label: {
2033
+ color: t.textMuted,
2034
+ fontSize: "14px"
2035
+ },
2036
+ value: {
2037
+ color: t.text,
2038
+ fontSize: "14px",
2039
+ fontWeight: 500
2040
+ },
2041
+ statusBadge: {
2042
+ padding: "4px 8px",
2043
+ borderRadius: "4px",
2044
+ color: "#fff",
2045
+ fontSize: "12px",
2046
+ fontWeight: 500,
2047
+ textTransform: "capitalize"
2048
+ },
2049
+ cancelNotice: {
2050
+ marginTop: "12px",
2051
+ padding: "8px 12px",
2052
+ backgroundColor: t.warningBg,
2053
+ border: `1px solid ${t.warningBorder}`,
2054
+ borderRadius: "6px",
2055
+ color: t.warningText,
2056
+ fontSize: "13px"
2057
+ },
2058
+ prorationPreview: {
2059
+ padding: "16px",
2060
+ backgroundColor: t.bgMuted,
2061
+ borderRadius: "8px",
2062
+ marginBottom: "24px"
2063
+ },
2064
+ previewTitle: {
2065
+ margin: "0 0 12px 0",
2066
+ fontSize: "16px",
2067
+ fontWeight: 600,
2068
+ color: t.text
2069
+ },
2070
+ previewDetails: {
2071
+ marginBottom: "16px"
2072
+ },
2073
+ previewRow: {
2074
+ display: "flex",
2075
+ justifyContent: "space-between",
2076
+ padding: "6px 0",
2077
+ fontSize: "14px",
2078
+ color: t.textMuted
2079
+ },
2080
+ previewTotal: {
2081
+ borderTop: `1px solid ${t.border}`,
2082
+ marginTop: "8px",
2083
+ paddingTop: "12px",
2084
+ fontWeight: 600,
2085
+ color: t.text
2086
+ },
2087
+ previewActions: {
2088
+ display: "flex",
2089
+ gap: "12px",
2090
+ justifyContent: "flex-end"
2091
+ },
2092
+ cancelButton: {
2093
+ padding: "8px 16px",
2094
+ backgroundColor: t.bg,
2095
+ border: `1px solid ${t.buttonBorder}`,
2096
+ borderRadius: "6px",
2097
+ color: t.buttonText,
2098
+ cursor: "pointer",
2099
+ fontSize: "14px"
2100
+ },
2101
+ confirmButton: {
2102
+ padding: "8px 16px",
2103
+ backgroundColor: t.primary,
2104
+ border: "none",
2105
+ borderRadius: "6px",
2106
+ color: "#fff",
2107
+ cursor: "pointer",
2108
+ fontSize: "14px",
2109
+ fontWeight: 500
2110
+ },
2111
+ plansSection: {
2112
+ marginBottom: "24px"
2113
+ },
2114
+ plansTitle: {
2115
+ margin: "0 0 12px 0",
2116
+ fontSize: "16px",
2117
+ fontWeight: 600,
2118
+ color: t.text
2119
+ },
2120
+ plansList: {
2121
+ display: "grid",
2122
+ gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))",
2123
+ gap: "16px"
2124
+ },
2125
+ planCard: {
2126
+ padding: "16px",
2127
+ backgroundColor: t.bg,
2128
+ border: `1px solid ${t.border}`,
2129
+ borderRadius: "8px",
2130
+ textAlign: "center"
2131
+ },
2132
+ currentPlan: {
2133
+ borderColor: t.primary,
2134
+ backgroundColor: t.bgHighlight
2135
+ },
2136
+ planName: {
2137
+ fontSize: "16px",
2138
+ fontWeight: 600,
2139
+ color: t.text,
2140
+ marginBottom: "4px"
2141
+ },
2142
+ planPrice: {
2143
+ fontSize: "14px",
2144
+ color: t.textMuted,
2145
+ marginBottom: "8px"
2146
+ },
2147
+ planDescription: {
2148
+ fontSize: "12px",
2149
+ color: t.textFaint,
2150
+ marginBottom: "12px"
2151
+ },
2152
+ currentBadge: {
2153
+ display: "inline-block",
2154
+ padding: "4px 8px",
2155
+ backgroundColor: t.primary,
2156
+ color: "#fff",
2157
+ borderRadius: "4px",
2158
+ fontSize: "12px",
2159
+ fontWeight: 500
2160
+ },
2161
+ changePlanButton: {
2162
+ padding: "8px 16px",
2163
+ backgroundColor: t.buttonBg,
2164
+ border: `1px solid ${t.buttonBorder}`,
2165
+ borderRadius: "6px",
2166
+ color: t.buttonText,
2167
+ cursor: "pointer",
2168
+ fontSize: "14px",
2169
+ width: "100%"
2170
+ },
2171
+ actions: {
2172
+ display: "flex",
2173
+ gap: "12px",
2174
+ justifyContent: "flex-end",
2175
+ paddingTop: "16px",
2176
+ borderTop: `1px solid ${t.border}`
2177
+ },
2178
+ portalButton: {
2179
+ padding: "10px 20px",
2180
+ backgroundColor: t.primary,
2181
+ border: "none",
2182
+ borderRadius: "6px",
2183
+ color: "#fff",
2184
+ cursor: "pointer",
2185
+ fontSize: "14px",
2186
+ fontWeight: 500
2187
+ },
2188
+ cancelSubscriptionButton: {
2189
+ padding: "10px 20px",
2190
+ backgroundColor: t.bg,
2191
+ border: `1px solid ${t.error}`,
2192
+ borderRadius: "6px",
2193
+ color: t.error,
2194
+ cursor: "pointer",
2195
+ fontSize: "14px"
2196
+ }
2197
+ };
2198
+ }
2199
+ function K(e, t) {
2200
+ return new Intl.NumberFormat("en-US", {
2201
+ style: "currency",
2202
+ currency: t.toUpperCase()
2203
+ }).format(e / 100);
2204
+ }
2205
+ function Ne(e) {
2206
+ return new Date(e).toLocaleDateString("en-US", {
2207
+ year: "numeric",
2208
+ month: "long",
2209
+ day: "numeric"
2210
+ });
2211
+ }
2212
+ function mt(e) {
2213
+ switch (e) {
2214
+ case "active":
2215
+ return "#22c55e";
2216
+ case "trialing":
2217
+ return "#3b82f6";
2218
+ case "past_due":
2219
+ return "#f59e0b";
2220
+ case "canceled":
2221
+ case "expired":
2222
+ return "#ef4444";
2223
+ default:
2224
+ return "#6b7280";
2225
+ }
2226
+ }
2227
+ function gt({
2228
+ preview: e,
2229
+ onConfirm: t,
2230
+ onCancel: r,
2231
+ isLoading: n,
2232
+ styles: s
2233
+ }) {
2234
+ const u = e.immediateAmount < 0;
2235
+ return /* @__PURE__ */ S("div", { className: "cedros-proration-preview", style: s.prorationPreview, children: [
2236
+ /* @__PURE__ */ f("h4", { style: s.previewTitle, children: "Change Preview" }),
2237
+ /* @__PURE__ */ S("div", { style: s.previewDetails, children: [
2238
+ /* @__PURE__ */ S("div", { style: s.previewRow, children: [
2239
+ /* @__PURE__ */ f("span", { children: "Current plan:" }),
2240
+ /* @__PURE__ */ S("span", { children: [
2241
+ K(e.currentPlanPrice, e.currency),
2242
+ "/period"
2243
+ ] })
2244
+ ] }),
2245
+ /* @__PURE__ */ S("div", { style: s.previewRow, children: [
2246
+ /* @__PURE__ */ f("span", { children: "New plan:" }),
2247
+ /* @__PURE__ */ S("span", { children: [
2248
+ K(e.newPlanPrice, e.currency),
2249
+ "/period"
2250
+ ] })
2251
+ ] }),
2252
+ /* @__PURE__ */ S("div", { style: s.previewRow, children: [
2253
+ /* @__PURE__ */ f("span", { children: "Days remaining:" }),
2254
+ /* @__PURE__ */ S("span", { children: [
2255
+ e.daysRemaining,
2256
+ " days"
2257
+ ] })
2258
+ ] }),
2259
+ e.prorationDetails && /* @__PURE__ */ S(me, { children: [
2260
+ /* @__PURE__ */ S("div", { style: s.previewRow, children: [
2261
+ /* @__PURE__ */ f("span", { children: "Unused credit:" }),
2262
+ /* @__PURE__ */ S("span", { children: [
2263
+ "-",
2264
+ K(e.prorationDetails.unusedCredit, e.currency)
2265
+ ] })
2266
+ ] }),
2267
+ /* @__PURE__ */ S("div", { style: s.previewRow, children: [
2268
+ /* @__PURE__ */ f("span", { children: "New plan cost:" }),
2269
+ /* @__PURE__ */ f("span", { children: K(e.prorationDetails.newPlanCost, e.currency) })
2270
+ ] })
2271
+ ] }),
2272
+ /* @__PURE__ */ S("div", { style: { ...s.previewRow, ...s.previewTotal }, children: [
2273
+ /* @__PURE__ */ f("span", { children: u ? "Credit to account:" : "Amount due now:" }),
2274
+ /* @__PURE__ */ f("span", { style: { color: u ? "#22c55e" : "#ef4444" }, children: K(Math.abs(e.immediateAmount), e.currency) })
2275
+ ] }),
2276
+ /* @__PURE__ */ S("div", { style: s.previewRow, children: [
2277
+ /* @__PURE__ */ f("span", { children: "Effective date:" }),
2278
+ /* @__PURE__ */ f("span", { children: Ne(e.effectiveDate) })
2279
+ ] })
2280
+ ] }),
2281
+ /* @__PURE__ */ S("div", { style: s.previewActions, children: [
2282
+ /* @__PURE__ */ f("button", { onClick: r, style: s.cancelButton, disabled: n, children: "Cancel" }),
2283
+ /* @__PURE__ */ f("button", { onClick: t, style: s.confirmButton, disabled: n, children: n ? "Processing..." : "Confirm Change" })
2284
+ ] })
2285
+ ] });
2286
+ }
2287
+ function Wt({
2288
+ resource: e,
2289
+ userId: t,
2290
+ availablePlans: r = [],
2291
+ onSubscriptionChanged: n,
2292
+ onSubscriptionCanceled: s,
2293
+ billingPortalReturnUrl: u,
2294
+ showBillingPortal: g = !1,
2295
+ className: b,
2296
+ style: h
2297
+ }) {
2298
+ const { mode: c } = V(), a = F(() => ft(c === "dark"), [c]), {
2299
+ subscription: o,
2300
+ changePreview: d,
2301
+ status: i,
2302
+ error: l,
2303
+ loadSubscription: p,
2304
+ previewChange: m,
2305
+ changeSubscription: w,
2306
+ cancelSubscription: y,
2307
+ openBillingPortal: k,
2308
+ clearPreview: P
2309
+ } = ut();
2310
+ te(() => {
2311
+ p(e, t);
2312
+ }, [e, t, p]);
2313
+ const E = X(null), M = I(
2314
+ async (C, _) => {
2315
+ E.current = { resource: C, interval: _ }, await m(e, C, t, _);
2316
+ },
2317
+ [e, t, m]
2318
+ ), $ = I(async () => {
2319
+ if (!d) return;
2320
+ const C = E.current;
2321
+ (await w({
2322
+ newResource: C?.resource || e,
2323
+ newInterval: C?.interval,
2324
+ immediate: !0
2325
+ }))?.success && C && C.interval && (n?.(C.resource, C.interval), E.current = null);
2326
+ }, [d, e, w, n]), z = I(
2327
+ async (C) => {
2328
+ (await y(C))?.success && s?.();
2329
+ },
2330
+ [y, s]
2331
+ ), U = I(() => {
2332
+ k(t, u);
2333
+ }, [t, u, k]), D = i === "loading";
2334
+ return /* @__PURE__ */ S("div", { className: `cedros-subscription-panel ${b || ""}`, style: { ...a.container, ...h }, children: [
2335
+ l && /* @__PURE__ */ f("div", { className: "cedros-subscription-error", style: a.error, children: l }),
2336
+ D && !o && /* @__PURE__ */ f("div", { className: "cedros-subscription-loading", style: a.loading, children: "Loading subscription..." }),
2337
+ o && /* @__PURE__ */ S(me, { children: [
2338
+ /* @__PURE__ */ S("div", { className: "cedros-subscription-details", style: a.details, children: [
2339
+ /* @__PURE__ */ f("h3", { style: a.title, children: "Current Subscription" }),
2340
+ /* @__PURE__ */ S("div", { style: a.detailRow, children: [
2341
+ /* @__PURE__ */ f("span", { style: a.label, children: "Plan:" }),
2342
+ /* @__PURE__ */ f("span", { style: a.value, children: o.resource })
2343
+ ] }),
2344
+ /* @__PURE__ */ S("div", { style: a.detailRow, children: [
2345
+ /* @__PURE__ */ f("span", { style: a.label, children: "Status:" }),
2346
+ /* @__PURE__ */ f(
2347
+ "span",
2348
+ {
2349
+ style: {
2350
+ ...a.statusBadge,
2351
+ backgroundColor: mt(o.status)
2352
+ },
2353
+ children: o.status
2354
+ }
2355
+ )
2356
+ ] }),
2357
+ /* @__PURE__ */ S("div", { style: a.detailRow, children: [
2358
+ /* @__PURE__ */ f("span", { style: a.label, children: "Price:" }),
2359
+ /* @__PURE__ */ S("span", { style: a.value, children: [
2360
+ K(o.pricePerPeriod, o.currency),
2361
+ "/",
2362
+ o.interval
2363
+ ] })
2364
+ ] }),
2365
+ /* @__PURE__ */ S("div", { style: a.detailRow, children: [
2366
+ /* @__PURE__ */ f("span", { style: a.label, children: "Current period ends:" }),
2367
+ /* @__PURE__ */ f("span", { style: a.value, children: Ne(o.currentPeriodEnd) })
2368
+ ] }),
2369
+ o.cancelAtPeriodEnd && /* @__PURE__ */ f("div", { style: a.cancelNotice, children: "Subscription will cancel at end of current period" })
2370
+ ] }),
2371
+ d && /* @__PURE__ */ f(
2372
+ gt,
2373
+ {
2374
+ preview: d,
2375
+ onConfirm: $,
2376
+ onCancel: P,
2377
+ isLoading: D,
2378
+ styles: a
2379
+ }
2380
+ ),
2381
+ r.length > 0 && !d && /* @__PURE__ */ S("div", { className: "cedros-available-plans", style: a.plansSection, children: [
2382
+ /* @__PURE__ */ f("h4", { style: a.plansTitle, children: "Available Plans" }),
2383
+ /* @__PURE__ */ f("div", { style: a.plansList, children: r.map((C) => {
2384
+ const _ = C.resource === o.resource;
2385
+ return /* @__PURE__ */ S(
2386
+ "div",
2387
+ {
2388
+ style: {
2389
+ ...a.planCard,
2390
+ ..._ ? a.currentPlan : {}
2391
+ },
2392
+ children: [
2393
+ /* @__PURE__ */ f("div", { style: a.planName, children: C.name }),
2394
+ /* @__PURE__ */ S("div", { style: a.planPrice, children: [
2395
+ K(C.price, C.currency),
2396
+ "/",
2397
+ C.interval
2398
+ ] }),
2399
+ C.description && /* @__PURE__ */ f("div", { style: a.planDescription, children: C.description }),
2400
+ _ ? /* @__PURE__ */ f("span", { style: a.currentBadge, children: "Current Plan" }) : /* @__PURE__ */ f(
2401
+ "button",
2402
+ {
2403
+ onClick: () => M(C.resource, C.interval),
2404
+ style: a.changePlanButton,
2405
+ disabled: D,
2406
+ children: C.price > o.pricePerPeriod ? "Upgrade" : "Downgrade"
2407
+ }
2408
+ )
2409
+ ]
2410
+ },
2411
+ C.resource
2412
+ );
2413
+ }) })
2414
+ ] }),
2415
+ /* @__PURE__ */ S("div", { className: "cedros-subscription-actions", style: a.actions, children: [
2416
+ g && o.paymentMethod === "stripe" && /* @__PURE__ */ f("button", { onClick: U, style: a.portalButton, disabled: D, children: "Manage Billing" }),
2417
+ o.status === "active" && !o.cancelAtPeriodEnd && /* @__PURE__ */ f(
2418
+ "button",
2419
+ {
2420
+ onClick: () => z(!1),
2421
+ style: a.cancelSubscriptionButton,
2422
+ disabled: D,
2423
+ children: "Cancel Subscription"
2424
+ }
2425
+ )
2426
+ ] })
2427
+ ] })
2428
+ ] });
2429
+ }
2430
+ function ht() {
2431
+ if (typeof window > "u")
2432
+ return {
2433
+ passed: !0,
2434
+ severity: "info",
2435
+ message: "HTTPS check skipped (SSR environment)"
2436
+ };
2437
+ const e = window.location.protocol === "https:", t = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1";
2438
+ return e || t ? {
2439
+ passed: !0,
2440
+ severity: "info",
2441
+ message: "HTTPS enforced"
2442
+ } : {
2443
+ passed: !1,
2444
+ severity: "error",
2445
+ message: "Page not served over HTTPS",
2446
+ recommendation: "Enable HTTPS for all payment pages. Stripe.js requires HTTPS in production."
2447
+ };
2448
+ }
2449
+ function yt() {
2450
+ return typeof document > "u" ? {
2451
+ passed: !0,
2452
+ severity: "info",
2453
+ message: "CSP check skipped (SSR environment)"
2454
+ } : document.querySelector('meta[http-equiv="Content-Security-Policy"]') ? {
2455
+ passed: !0,
2456
+ severity: "info",
2457
+ message: "Content Security Policy detected"
2458
+ } : {
2459
+ passed: !1,
2460
+ severity: "warning",
2461
+ message: "No Content Security Policy detected",
2462
+ recommendation: "Configure CSP headers to protect against XSS and CDN compromise. Use generateCSP() helper from @cedros/pay-react."
2463
+ };
2464
+ }
2465
+ function bt() {
2466
+ return process.env.NODE_ENV === "development" || typeof window < "u" && window.location.hostname === "localhost" ? {
2467
+ passed: !0,
2468
+ severity: "info",
2469
+ message: "Running in development mode (some security checks relaxed)"
2470
+ } : {
2471
+ passed: !0,
2472
+ severity: "info",
2473
+ message: "Running in production mode"
2474
+ };
2475
+ }
2476
+ function Ct() {
2477
+ return {
2478
+ passed: !0,
2479
+ severity: "info",
2480
+ message: "Stripe.js loaded via @stripe/stripe-js package (CSP recommended, not SRI)",
2481
+ recommendation: "Ensure CSP script-src includes https://js.stripe.com"
2482
+ };
2483
+ }
2484
+ function wt() {
2485
+ return typeof window > "u" ? {
2486
+ passed: !0,
2487
+ severity: "info",
2488
+ message: "Mixed content check skipped (SSR environment)"
2489
+ } : window.location.protocol === "https:" ? {
2490
+ passed: !0,
2491
+ severity: "info",
2492
+ message: "Mixed content protection active (HTTPS page)"
2493
+ } : {
2494
+ passed: !0,
2495
+ severity: "info",
2496
+ message: "Mixed content check skipped (HTTP page)"
2497
+ };
2498
+ }
2499
+ function Ht() {
2500
+ const e = [
2501
+ ht(),
2502
+ yt(),
2503
+ bt(),
2504
+ Ct(),
2505
+ wt()
2506
+ ], t = e.some((u) => u.severity === "error" && !u.passed), r = e.some((u) => u.severity === "warning" && !u.passed);
2507
+ let n, s;
2508
+ return t ? (n = "vulnerable", s = "Security issues detected. Review errors and apply recommendations.") : r ? (n = "warnings", s = "Minor security warnings detected. Consider applying recommendations.") : (n = "secure", s = "All security checks passed."), {
2509
+ checks: e,
2510
+ overallStatus: n,
2511
+ summary: s
2512
+ };
2513
+ }
2514
+ function Yt(e) {
2515
+ process.env.NODE_ENV !== "production" && (console.group("🔒 Cedros Pay Security Report"), console.log(`Status: ${e.overallStatus.toUpperCase()}`), console.log(`Summary: ${e.summary}`), console.log(""), e.checks.forEach((t) => {
2516
+ const r = t.passed ? "✅" : t.severity === "error" ? "❌" : "⚠️";
2517
+ console.log(`${r} ${t.message}`), t.recommendation && console.log(` → ${t.recommendation}`);
2518
+ }), console.groupEnd());
2519
+ }
2520
+ const Qt = {
2521
+ CSP: "Use generateCSP() from @cedros/pay-react to generate Content Security Policy headers",
2522
+ HTTPS: "Always serve payment pages over HTTPS in production",
2523
+ PACKAGE_UPDATES: "Keep @stripe/stripe-js and @cedros/pay-react updated for security patches",
2524
+ AUDIT: "Run npm audit regularly to check for known vulnerabilities",
2525
+ MONITORING: "Monitor Stripe security advisories and apply updates promptly",
2526
+ NO_SRI: "Do NOT use SRI hashes for Stripe.js - use CSP instead"
2527
+ };
2528
+ export {
2529
+ ae as A,
2530
+ ie as B,
2531
+ qt as C,
2532
+ Y as D,
2533
+ Tt as E,
2534
+ Nt as F,
2535
+ Ht as G,
2536
+ Yt as H,
2537
+ Qt as I,
2538
+ Xe as J,
2539
+ Je as K,
2540
+ Lt as L,
2541
+ Ze as M,
2542
+ $t as N,
2543
+ ne as O,
2544
+ nt as P,
2545
+ At as Q,
2546
+ jt as R,
2547
+ Me as S,
2548
+ Ce as T,
2549
+ ge as U,
2550
+ se as V,
2551
+ He as W,
2552
+ Te as a,
2553
+ rt as b,
2554
+ zt as c,
2555
+ Ut as d,
2556
+ Ot as e,
2557
+ Ft as f,
2558
+ Wt as g,
2559
+ et as h,
2560
+ he as i,
2561
+ ct as j,
2562
+ lt as k,
2563
+ ut as l,
2564
+ Et as m,
2565
+ kt as n,
2566
+ Dt as o,
2567
+ xt as p,
2568
+ Ve as q,
2569
+ Ge as r,
2570
+ _t as s,
2571
+ Bt as t,
2572
+ Ie as u,
2573
+ J as v,
2574
+ oe as w,
2575
+ Rt as x,
2576
+ It as y,
2577
+ Mt as z
2578
+ };