@cedros/pay-react 1.1.30 → 1.1.32

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 (136) hide show
  1. package/README.md +53 -30
  2. package/dist/{AISettingsSection-BMh3hAb5.mjs → AISettingsSection-ChBtZVz7.mjs} +4 -4
  3. package/dist/{AISettingsSection-C0zqPbd6.js → AISettingsSection-DSROL7Lg.js} +2 -2
  4. package/dist/{AutosaveIndicator-3ctAnz8Y.mjs → AutosaveIndicator-BTa2YPNH.mjs} +1 -1
  5. package/dist/AutosaveIndicator-BgDnlrCW.js +1 -0
  6. package/dist/CedrosContext-3Dz7_9Ct.js +3 -0
  7. package/dist/{CedrosContext-5Gjveoba.mjs → CedrosContext-DQc_k5PG.mjs} +430 -314
  8. package/dist/ChatLogsSection-B5AdoZls.js +1 -0
  9. package/dist/{ChatLogsSection-BtJixYAp.mjs → ChatLogsSection-D8FX7Dmn.mjs} +2 -2
  10. package/dist/{ComplianceSection-BMnb1p4w.mjs → ComplianceSection-A1hgI_X2.mjs} +3 -3
  11. package/dist/ComplianceSection-UWfkNrmW.js +1 -0
  12. package/dist/CryptoButton-BQceZhbn.js +1 -0
  13. package/dist/{CryptoButton-Cl2kZbOP.mjs → CryptoButton-BuO_RZLj.mjs} +4 -5
  14. package/dist/{CustomersSection-dmwoBhcf.mjs → CustomersSection-BuSVgS16.mjs} +2 -2
  15. package/dist/CustomersSection-Rh552kcC.js +1 -0
  16. package/dist/DisputesSection-BtMdxOuD.js +1 -0
  17. package/dist/{DisputesSection-CHyLne76.mjs → DisputesSection-DqWrBCyC.mjs} +2 -2
  18. package/dist/Dropdown-CWYy2Rtt.js +1 -0
  19. package/dist/{Dropdown-BRSZlhik.mjs → Dropdown-DHCHYuTB.mjs} +1 -1
  20. package/dist/{ErrorBanner-lZJhCmDX.mjs → ErrorBanner-7naZtdtD.mjs} +1 -1
  21. package/dist/ErrorBanner-BOS1XAPu.js +1 -0
  22. package/dist/FAQSection-DczKj0C3.js +1 -0
  23. package/dist/{FAQSection-Di2xE9Sm.mjs → FAQSection-x0ya8PvI.mjs} +3 -3
  24. package/dist/{ImagesSection-D63PEjR6.mjs → ImagesSection-CMvHgbtL.mjs} +2 -2
  25. package/dist/ImagesSection-tRpBN-ls.js +1 -0
  26. package/dist/{InventorySection-Dp5Yu4TA.mjs → InventorySection-5PEOXciZ.mjs} +2 -2
  27. package/dist/InventorySection-clEVFr_r.js +1 -0
  28. package/dist/MessagingSection-BpwTsNW1.js +1 -0
  29. package/dist/{MessagingSection-BLCnCpEv.mjs → MessagingSection-Bt84iW-5.mjs} +3 -3
  30. package/dist/OrdersSection-Bsou3cwl.js +1 -0
  31. package/dist/{OrdersSection-Bd56F3cj.mjs → OrdersSection-kJzPO6CP.mjs} +2 -2
  32. package/dist/{PaymentSettingsSection-B5J56VAk.js → PaymentSettingsSection-CUgUJ7tm.js} +1 -1
  33. package/dist/{PaymentSettingsSection-52iw47Su.mjs → PaymentSettingsSection-s_XMFPik.mjs} +3 -3
  34. package/dist/{ReturnsSection-DUVeKrCd.mjs → ReturnsSection-BcwsQbrU.mjs} +2 -2
  35. package/dist/ReturnsSection-BwHv1HkV.js +1 -0
  36. package/dist/{SettingsSection-DKkHykaC.js → SettingsSection-B_feZEzU.js} +1 -1
  37. package/dist/{SettingsSection-vK9WIwXE.mjs → SettingsSection-OI1G3b40.mjs} +1 -1
  38. package/dist/{ShippingSection-CZRrXrlh.mjs → ShippingSection-B2GtSEvn.mjs} +2 -2
  39. package/dist/ShippingSection-DyTGH_Fh.js +1 -0
  40. package/dist/{SingleCategorySettings-C8xJ47_T.mjs → SingleCategorySettings-Cd76sY00.mjs} +4 -4
  41. package/dist/SingleCategorySettings-Ci6hJ0Xu.js +3 -0
  42. package/dist/{StatsBar-D4cOKG2e.mjs → StatsBar-B_lf0ph0.mjs} +1 -1
  43. package/dist/StatsBar-CVqsD8j2.js +1 -0
  44. package/dist/StorefrontSection-BxaWrsPc.js +1 -0
  45. package/dist/{StorefrontSection-uXSVbEAa.mjs → StorefrontSection-DW0q9GsC.mjs} +4 -4
  46. package/dist/{SubscriptionsSection-Ci_AZrWA.mjs → SubscriptionsSection-CNHPCync.mjs} +3 -3
  47. package/dist/SubscriptionsSection-QMoSKKot.js +1 -0
  48. package/dist/TaxSection-BKhh7kOv.js +1 -0
  49. package/dist/{TaxSection-BTukS_cU.mjs → TaxSection-BwLpiery.mjs} +2 -2
  50. package/dist/Token22Section-B_URxab9.js +1 -0
  51. package/dist/{Token22Section-DRsPJuTq.mjs → Token22Section-DyNDKGdU.mjs} +227 -212
  52. package/dist/{WalletManager-D-eoqUDy.mjs → WalletManager-CGR69MiR.mjs} +1 -1
  53. package/dist/{WalletManager-DXChB9LA.js → WalletManager-ZJbGQHrn.js} +1 -1
  54. package/dist/WebhooksSection-BIs2Qh-o.js +1 -0
  55. package/dist/{WebhooksSection-A8Y4ZGcj.mjs → WebhooksSection-bDVQE9Qp.mjs} +2 -2
  56. package/dist/admin.js +1 -1
  57. package/dist/admin.mjs +1 -1
  58. package/dist/crypto-only.js +1 -1
  59. package/dist/crypto-only.mjs +102 -105
  60. package/dist/{index-9QF_UfSN.mjs → index-CU6M10Rs.mjs} +13 -14
  61. package/dist/{index-Cq9ya93W.js → index-DVxx_62C.js} +10 -10
  62. package/dist/index.js +1 -1
  63. package/dist/index.mjs +31 -34
  64. package/dist/pay-react.css +1 -1
  65. package/dist/plugin-CuoGEYWr.mjs +339 -0
  66. package/dist/plugin-DNhaPAbC.js +1 -0
  67. package/dist/sections-BYdyCKFF.js +1 -0
  68. package/dist/{sections-more-Ixw6mM6R.mjs → sections-vLd_ind5.mjs} +263 -270
  69. package/dist/src/admin/plugin.d.ts.map +1 -1
  70. package/dist/src/admin/sectionIds.d.ts.map +1 -1
  71. package/dist/src/admin.d.ts +0 -7
  72. package/dist/src/admin.d.ts.map +1 -1
  73. package/dist/src/components/admin/LiquidityPoolTab.d.ts.map +1 -1
  74. package/dist/src/components/admin/PoolManagementView.d.ts.map +1 -1
  75. package/dist/src/components/admin/index.d.ts +0 -1
  76. package/dist/src/components/admin/index.d.ts.map +1 -1
  77. package/dist/src/index.d.ts +0 -1
  78. package/dist/src/index.d.ts.map +1 -1
  79. package/dist/src/managers/MeteoraPoolManager.d.ts.map +1 -1
  80. package/dist/src/utils/optionalPeerImport.d.ts +6 -0
  81. package/dist/src/utils/optionalPeerImport.d.ts.map +1 -0
  82. package/dist/stripe-only.js +1 -1
  83. package/dist/stripe-only.mjs +18 -19
  84. package/dist/styles-BwaDljnz.js +1 -0
  85. package/dist/{styles-DGagylUj.mjs → styles-fihm6qVA.mjs} +51 -52
  86. package/dist/testing/index.js +1 -1
  87. package/dist/testing/index.mjs +1 -1
  88. package/package.json +6 -8
  89. package/dist/AutosaveIndicator-DXRPr4P7.js +0 -1
  90. package/dist/CedrosContext-CCakH2SZ.js +0 -3
  91. package/dist/CedrosPayAdminDashboard-DaJ9JoGn.mjs +0 -250
  92. package/dist/CedrosPayAdminDashboard-Uvyh9p7A.js +0 -1
  93. package/dist/ChatLogsSection-FC3O536G.js +0 -1
  94. package/dist/ComplianceSection-BioTKm7k.js +0 -1
  95. package/dist/CryptoButton-DxFCYDlJ.js +0 -1
  96. package/dist/CustomersSection-z6ARxuex.js +0 -1
  97. package/dist/DisputesSection-BjHHQAi7.js +0 -1
  98. package/dist/Dropdown-j8o0OO5L.js +0 -1
  99. package/dist/ErrorBanner-CAgPnj62.js +0 -1
  100. package/dist/FAQSection-b34DMzgV.js +0 -1
  101. package/dist/ImagesSection-DGBA7iKY.js +0 -1
  102. package/dist/InventorySection-bVCECzX5.js +0 -1
  103. package/dist/LazyCedrosPayAdminDashboard-BqJDNrDI.mjs +0 -9
  104. package/dist/LazyCedrosPayAdminDashboard-CpfTtOBc.js +0 -1
  105. package/dist/MessagingSection-DU0dYNMy.js +0 -1
  106. package/dist/OrdersSection-FOFEAgs1.js +0 -1
  107. package/dist/ReturnsSection-BjpIVFfN.js +0 -1
  108. package/dist/ShippingSection-B5lk7zpS.js +0 -1
  109. package/dist/SingleCategorySettings-g7D-9lG1.js +0 -3
  110. package/dist/StatsBar-CWXw2ZT3.js +0 -1
  111. package/dist/StorefrontSection-BWnMB9k-.js +0 -1
  112. package/dist/SubscriptionsSection-DQfXkuDv.js +0 -1
  113. package/dist/TaxSection-cuPQISxZ.js +0 -1
  114. package/dist/ThemeContext-CFXyYx7A.js +0 -1
  115. package/dist/ThemeContext-l0bqcOGW.mjs +0 -126
  116. package/dist/Token22Section-CCfkDm8W.js +0 -1
  117. package/dist/WebhooksSection-CnEmaGH1.js +0 -1
  118. package/dist/icons-C3yDMnKE.mjs +0 -235
  119. package/dist/icons-Cjgd9YVo.js +0 -1
  120. package/dist/pay-react_false-CPX8Vyp9.mjs +0 -5
  121. package/dist/pay-react_false-DaeIe3_l.js +0 -1
  122. package/dist/sectionIds-D46-_-h-.js +0 -1
  123. package/dist/sectionIds-YktNxmRt.mjs +0 -124
  124. package/dist/sections-511_XBh4.js +0 -1
  125. package/dist/sections-CRaMa8ZB.mjs +0 -9
  126. package/dist/sections-more-Cgw2qJlA.js +0 -1
  127. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts +0 -40
  128. package/dist/src/components/admin/CedrosPayAdminDashboard.d.ts.map +0 -1
  129. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts +0 -4
  130. package/dist/src/components/admin/LazyCedrosPayAdminDashboard.d.ts.map +0 -1
  131. package/dist/src/standalone-admin.d.ts +0 -8
  132. package/dist/src/standalone-admin.d.ts.map +0 -1
  133. package/dist/standalone-admin.d.ts +0 -2
  134. package/dist/standalone-admin.js +0 -1
  135. package/dist/standalone-admin.mjs +0 -4
  136. package/dist/styles--fxb3lCl.js +0 -1
@@ -2,7 +2,7 @@ import { clusterApiUrl as b, Connection as C, Transaction as P, PublicKey as l,
2
2
  import { getAssociatedTokenAddress as T, createTransferInstruction as A } from "@solana/spl-token";
3
3
  import { g as u, b as d } from "./fetchWithTimeout-DmMOwL0Q.mjs";
4
4
  import { b as k } from "./index-BFt38o8Q.mjs";
5
- import { g as v, f as B, k as m, e as g, b as f, l as S } from "./CedrosContext-5Gjveoba.mjs";
5
+ import { g as v, f as B, k as m, e as g, b as f, m as S } from "./CedrosContext-DQc_k5PG.mjs";
6
6
  import { v as M } from "./tokenMintValidator-DAjQld0r.mjs";
7
7
  class Q {
8
8
  connection;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@solana/web3.js"),w=require("@solana/spl-token"),c=require("./fetchWithTimeout-CG0EKbhf.js"),y=require("./index-WcOlBYZJ.js"),n=require("./CedrosContext-CCakH2SZ.js"),E=require("./tokenMintValidator-DNBhoefh.js");class P{connection;cluster;endpoint;allowUnknownMint;rpcRateLimiter=n.createRateLimiter({maxRequests:50,windowMs:6e4});rpcCircuitBreaker=n.createCircuitBreaker({failureThreshold:5,timeout:1e4,name:"solana-rpc"});constructor(r="mainnet-beta",e,t=!1){this.cluster=r,this.endpoint=e,this.allowUnknownMint=t,this.connection=this.createConnection()}createConnection(){const r=this.endpoint??o.clusterApiUrl(this.cluster);return new o.Connection(r,"confirmed")}transformRpcError(r){const e=r instanceof Error?r.message:typeof r=="string"?r:String(r);return e.includes("403")||e.includes("Access forbidden")?new Error("Public Solana RPC access denied. Please configure a custom RPC endpoint (e.g., from Helius, QuickNode, or Alchemy) in your CedrosProvider config using the solanaEndpoint option."):e.includes("429")||e.includes("Too Many Requests")?new Error("Solana RPC rate limit exceeded. Please configure a custom RPC endpoint with higher limits in your CedrosProvider config using the solanaEndpoint option."):r instanceof Error?r:new Error(e)}async buildTransaction(r){const{requirement:e,payerPublicKey:t,blockhash:a}=r;if(!e||!e.payTo)throw new Error("Invalid requirement: missing payTo");c.getLogger().debug("[WalletManager] Building transaction for resource:",e.resource);const i=new o.Transaction,l=this.resolveAmountInMinorUnits(e),u=e.asset;if(!u)throw new Error("asset is required in x402 requirement");const g=E.validateX402Asset(u,e.resource,this.allowUnknownMint);if(!g.isValid&&g.error)throw new Error(g.error);g.warning&&c.getLogger().warn(g.warning);const p=new o.PublicKey(u),d=await w.getAssociatedTokenAddress(p,t);if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");let f;try{f=await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getAccountInfo(d),{...n.RETRY_PRESETS.QUICK,name:"rpc-get-account-info"}))}catch(s){throw s instanceof n.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}if(!f)throw new Error("Payer is missing an associated token account for this mint");let h;try{h=e.extra?.recipientTokenAccount?new o.PublicKey(e.extra.recipientTokenAccount):new o.PublicKey(e.payTo)}catch(s){throw c.getLogger().warn("[WalletManager] Failed to resolve recipient address:",s),new Error("We are currently unable to process payment, please try again later")}if(i.add(w.createTransferInstruction(d,h,t,l)),e.extra?.memo){const s=new o.TransactionInstruction({keys:[],programId:new o.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(e.extra.memo,"utf8")});i.add(s)}let m;if(a)m=a;else{if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{m=(await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getLatestBlockhash(),{...n.RETRY_PRESETS.QUICK,name:"rpc-get-blockhash"}))).blockhash}catch(s){throw s instanceof n.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}}return i.recentBlockhash=m,e.extra?.feePayer?i.feePayer=new o.PublicKey(e.extra.feePayer):i.feePayer=t,i}resolveAmountInMinorUnits(r){const e=r.maxAmountRequired;if(!/^\d+$/.test(e))throw new Error("Invalid maxAmountRequired in requirement: must be a non-negative integer string");const t=BigInt(e);if(t<=0n)throw new Error("Invalid maxAmountRequired in requirement");return t}buildPaymentPayload(r){const{requirement:e,signedTx:t,payerPublicKey:a}=r;return{x402Version:0,scheme:e.scheme,network:e.network,payload:{signature:t.signature,transaction:t.serialized,payer:a.toString(),memo:e.extra?.memo,recipientTokenAccount:e.extra?.recipientTokenAccount}}}async signTransaction(r){const{transaction:e,signTransaction:t}=r;c.getLogger().debug("[WalletManager] Requesting wallet to sign transaction");const a=await t(e),i=a.serialize(),l=a.signatures[0]?.signature;if(!l)throw new Error("Signed transaction missing signature");const u=y.bs58.encode(l);return c.getLogger().debug("[WalletManager] Transaction signed with signature:",u.substring(0,20)+"..."),{serialized:c.gBase64.fromUint8Array(i),signature:u}}deserializeTransaction(r){try{const e=c.gBase64.toUint8Array(r);return o.Transaction.from(e)}catch(e){throw new Error(`Failed to deserialize transaction: ${n.formatError(e,"Unknown error")}`)}}async partiallySignTransaction(r){const{transaction:e,signTransaction:t,blockhash:a}=r;a&&e.recentBlockhash!==a&&(e.recentBlockhash=a);const i=await t(e),l=i.signatures[0]?.signature;if(l){const g=y.bs58.encode(l);c.getLogger().debug("[WalletManager] Partially signed with signature:",g.substring(0,20)+"...")}const u=i.serialize({requireAllSignatures:!1,verifySignatures:!1});return c.gBase64.fromUint8Array(u)}async getBalance(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{return await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getBalance(r),{...n.RETRY_PRESETS.QUICK,name:"rpc-get-balance"}))/o.LAMPORTS_PER_SOL}catch(e){throw e instanceof n.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(e)}}async verifyTransaction(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded for transaction verification");try{return!!(await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getSignatureStatus(r),{...n.RETRY_PRESETS.QUICK,name:"rpc-verify-tx"}))).value?.confirmationStatus}catch(e){return e instanceof n.CircuitBreakerOpenError&&c.getLogger().warn("[WalletManager] Circuit breaker OPEN - cannot verify transaction"),!1}}}exports.WalletManager=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@solana/web3.js"),w=require("@solana/spl-token"),c=require("./fetchWithTimeout-CG0EKbhf.js"),y=require("./index-WcOlBYZJ.js"),n=require("./CedrosContext-3Dz7_9Ct.js"),E=require("./tokenMintValidator-DNBhoefh.js");class P{connection;cluster;endpoint;allowUnknownMint;rpcRateLimiter=n.createRateLimiter({maxRequests:50,windowMs:6e4});rpcCircuitBreaker=n.createCircuitBreaker({failureThreshold:5,timeout:1e4,name:"solana-rpc"});constructor(r="mainnet-beta",e,t=!1){this.cluster=r,this.endpoint=e,this.allowUnknownMint=t,this.connection=this.createConnection()}createConnection(){const r=this.endpoint??o.clusterApiUrl(this.cluster);return new o.Connection(r,"confirmed")}transformRpcError(r){const e=r instanceof Error?r.message:typeof r=="string"?r:String(r);return e.includes("403")||e.includes("Access forbidden")?new Error("Public Solana RPC access denied. Please configure a custom RPC endpoint (e.g., from Helius, QuickNode, or Alchemy) in your CedrosProvider config using the solanaEndpoint option."):e.includes("429")||e.includes("Too Many Requests")?new Error("Solana RPC rate limit exceeded. Please configure a custom RPC endpoint with higher limits in your CedrosProvider config using the solanaEndpoint option."):r instanceof Error?r:new Error(e)}async buildTransaction(r){const{requirement:e,payerPublicKey:t,blockhash:a}=r;if(!e||!e.payTo)throw new Error("Invalid requirement: missing payTo");c.getLogger().debug("[WalletManager] Building transaction for resource:",e.resource);const i=new o.Transaction,l=this.resolveAmountInMinorUnits(e),u=e.asset;if(!u)throw new Error("asset is required in x402 requirement");const g=E.validateX402Asset(u,e.resource,this.allowUnknownMint);if(!g.isValid&&g.error)throw new Error(g.error);g.warning&&c.getLogger().warn(g.warning);const p=new o.PublicKey(u),d=await w.getAssociatedTokenAddress(p,t);if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");let f;try{f=await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getAccountInfo(d),{...n.RETRY_PRESETS.QUICK,name:"rpc-get-account-info"}))}catch(s){throw s instanceof n.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}if(!f)throw new Error("Payer is missing an associated token account for this mint");let h;try{h=e.extra?.recipientTokenAccount?new o.PublicKey(e.extra.recipientTokenAccount):new o.PublicKey(e.payTo)}catch(s){throw c.getLogger().warn("[WalletManager] Failed to resolve recipient address:",s),new Error("We are currently unable to process payment, please try again later")}if(i.add(w.createTransferInstruction(d,h,t,l)),e.extra?.memo){const s=new o.TransactionInstruction({keys:[],programId:new o.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(e.extra.memo,"utf8")});i.add(s)}let m;if(a)m=a;else{if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{m=(await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getLatestBlockhash(),{...n.RETRY_PRESETS.QUICK,name:"rpc-get-blockhash"}))).blockhash}catch(s){throw s instanceof n.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(s)}}return i.recentBlockhash=m,e.extra?.feePayer?i.feePayer=new o.PublicKey(e.extra.feePayer):i.feePayer=t,i}resolveAmountInMinorUnits(r){const e=r.maxAmountRequired;if(!/^\d+$/.test(e))throw new Error("Invalid maxAmountRequired in requirement: must be a non-negative integer string");const t=BigInt(e);if(t<=0n)throw new Error("Invalid maxAmountRequired in requirement");return t}buildPaymentPayload(r){const{requirement:e,signedTx:t,payerPublicKey:a}=r;return{x402Version:0,scheme:e.scheme,network:e.network,payload:{signature:t.signature,transaction:t.serialized,payer:a.toString(),memo:e.extra?.memo,recipientTokenAccount:e.extra?.recipientTokenAccount}}}async signTransaction(r){const{transaction:e,signTransaction:t}=r;c.getLogger().debug("[WalletManager] Requesting wallet to sign transaction");const a=await t(e),i=a.serialize(),l=a.signatures[0]?.signature;if(!l)throw new Error("Signed transaction missing signature");const u=y.bs58.encode(l);return c.getLogger().debug("[WalletManager] Transaction signed with signature:",u.substring(0,20)+"..."),{serialized:c.gBase64.fromUint8Array(i),signature:u}}deserializeTransaction(r){try{const e=c.gBase64.toUint8Array(r);return o.Transaction.from(e)}catch(e){throw new Error(`Failed to deserialize transaction: ${n.formatError(e,"Unknown error")}`)}}async partiallySignTransaction(r){const{transaction:e,signTransaction:t,blockhash:a}=r;a&&e.recentBlockhash!==a&&(e.recentBlockhash=a);const i=await t(e),l=i.signatures[0]?.signature;if(l){const g=y.bs58.encode(l);c.getLogger().debug("[WalletManager] Partially signed with signature:",g.substring(0,20)+"...")}const u=i.serialize({requireAllSignatures:!1,verifySignatures:!1});return c.gBase64.fromUint8Array(u)}async getBalance(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded. Please try again in a moment.");try{return await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getBalance(r),{...n.RETRY_PRESETS.QUICK,name:"rpc-get-balance"}))/o.LAMPORTS_PER_SOL}catch(e){throw e instanceof n.CircuitBreakerOpenError?new Error("Solana RPC service is temporarily unavailable. Please try again in a few moments."):this.transformRpcError(e)}}async verifyTransaction(r){if(!this.rpcRateLimiter.tryConsume())throw new Error("RPC rate limit exceeded for transaction verification");try{return!!(await this.rpcCircuitBreaker.execute(async()=>await n.retryWithBackoff(async()=>await this.connection.getSignatureStatus(r),{...n.RETRY_PRESETS.QUICK,name:"rpc-verify-tx"}))).value?.confirmationStatus}catch(e){return e instanceof n.CircuitBreakerOpenError&&c.getLogger().warn("[WalletManager] Circuit breaker OPEN - cannot verify transaction"),!1}}}exports.WalletManager=P;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),q=require("./plugin-DNhaPAbC.js"),D=require("./ErrorBanner-BOS1XAPu.js"),E=require("./dateHelpers-BKW_lGND.js"),U=n=>n==="success"?"success":n==="failed"?"failed":n==="pending"||n==="processing"?"pending":"muted",x=(n,d=48)=>n.length>d?`${n.slice(0,d)}…`:n;function O({serverUrl:n,apiKey:d,authManager:j}){const[a,L]=s.useState("active"),[y,p]=s.useState([]),[c,W]=s.useState(0),[h,C]=s.useState("all"),[N,f]=s.useState(!0),[_,g]=s.useState([]),[k,T]=s.useState(0),[F,v]=s.useState(!1),[w,A]=s.useState(!1),[$,l]=s.useState(null),[z,o]=s.useState(null),r=s.useCallback(async(t,i)=>{if(j?.isAuthenticated())return j.fetchWithAuth(t,i);const S={"Content-Type":"application/json"};d&&(S["X-API-Key"]=d);const u=await fetch(`${n}${t}`,{...i,headers:{...S,...i?.headers}});if(!u.ok)throw new Error(`Request failed: ${u.status}`);if(u.status!==204)return u.json()},[n,d,j]),m=s.useCallback(async()=>{f(!0),l(null);try{const t=new URLSearchParams({limit:"100"});h!=="all"&&t.set("status",h);const i=await r(`/admin/webhooks?${t.toString()}`);p(i.webhooks??[]),W(i.count??0)}catch{l("Failed to load webhooks"),p([])}finally{f(!1)}},[r,h]);s.useEffect(()=>{m()},[m]);const b=s.useCallback(async()=>{v(!0),l(null);try{const t=await r("/admin/webhooks/dlq?limit=100");g(t.webhooks??[]),T(t.count??0),A(!0)}catch{l("Failed to load DLQ webhooks"),g([])}finally{v(!1)}},[r]),R=t=>{L(t),l(null),o(null),t==="dlq"&&!w&&b()},I=async t=>{o(null);try{await r(`/admin/webhooks/${encodeURIComponent(t)}/retry`,{method:"POST"}),m()}catch{o("Failed to retry webhook")}},B=async t=>{if(window.confirm("Delete this webhook?")){o(null);try{await r(`/admin/webhooks/${encodeURIComponent(t)}`,{method:"DELETE"}),m()}catch{o("Failed to delete webhook")}}},Q=async t=>{o(null);try{await r(`/admin/webhooks/dlq/${encodeURIComponent(t)}/retry`,{method:"POST"}),b()}catch{o("Failed to retry DLQ webhook")}},P=async t=>{if(window.confirm("Delete this DLQ entry?")){o(null);try{await r(`/admin/webhooks/dlq/${encodeURIComponent(t)}`,{method:"DELETE"}),b()}catch{o("Failed to delete DLQ entry")}}};return e.jsxs("div",{children:[e.jsx("div",{className:"cedros-admin__section-header",children:e.jsx("h3",{className:"cedros-admin__section-title",children:"Webhooks"})}),e.jsx(D.ErrorBanner,{message:$}),e.jsx(D.ErrorBanner,{message:z}),e.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"1rem",borderBottom:"1px solid var(--cedros-admin-border, #e0e0e0)"},children:["active","dlq"].map(t=>e.jsx("button",{type:"button",onClick:()=>R(t),style:{padding:"0.5rem 1rem",fontSize:"0.85rem",fontWeight:a===t?600:400,background:"none",border:"none",borderBottom:a===t?"2px solid var(--cedros-admin-primary, #000)":"2px solid transparent",cursor:"pointer",color:a===t?"var(--cedros-admin-text, #333)":"var(--cedros-admin-text-muted, #888)",marginBottom:"-1px"},children:t==="active"?`Active Webhooks${c>0?` (${c})`:""}`:`Dead Letter Queue${k>0?` (${k})`:""}`},t))}),a==="active"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",alignItems:"center"},children:[e.jsxs("select",{className:"cedros-admin__input",value:h,onChange:t=>{C(t.target.value)},style:{width:"auto",fontSize:"0.85rem"},children:[e.jsx("option",{value:"all",children:"All statuses"}),e.jsx("option",{value:"pending",children:"Pending"}),e.jsx("option",{value:"processing",children:"Processing"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"success",children:"Success"})]}),e.jsxs("span",{style:{fontSize:"0.85rem",color:"var(--cedros-admin-text-muted, #888)"},children:[c," webhook",c!==1?"s":""]})]}),N?e.jsxs("div",{className:"cedros-admin__loading",children:[q.Icons.loading," Loading webhooks..."]}):y.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"No webhooks found."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Event Type"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Attempts"}),e.jsx("th",{children:"Last Error"}),e.jsx("th",{children:"Created"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:y.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{maxWidth:"200px"},children:e.jsx("span",{title:t.url,style:{fontSize:"0.8rem",fontFamily:"monospace"},children:x(t.url,40)})}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.eventType}),e.jsx("td",{children:e.jsx("span",{className:`cedros-admin__badge cedros-admin__badge--${U(t.status)}`,children:t.status})}),e.jsxs("td",{style:{fontSize:"0.85rem"},children:[t.attempts,"/",t.maxAttempts]}),e.jsx("td",{style:{fontSize:"0.8rem",maxWidth:"180px",color:"var(--cedros-admin-text-muted, #888)"},children:t.lastError?e.jsx("span",{title:t.lastError,children:x(t.lastError,40)}):"—"}),e.jsx("td",{style:{fontSize:"0.8rem"},children:E.formatDateTime(t.createdAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>I(t.id),children:"Retry"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>B(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})]}),a==="dlq"&&e.jsx(e.Fragment,{children:F?e.jsxs("div",{className:"cedros-admin__loading",children:[q.Icons.loading," Loading DLQ..."]}):_.length===0?e.jsx("div",{className:"cedros-admin__empty",children:"Dead Letter Queue is empty."}):e.jsx("div",{className:"cedros-admin__table-container",children:e.jsxs("table",{className:"cedros-admin__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"URL"}),e.jsx("th",{children:"Event Type"}),e.jsx("th",{children:"Attempts"}),e.jsx("th",{children:"Final Error"}),e.jsx("th",{children:"Moved to DLQ"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:_.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{maxWidth:"200px"},children:e.jsx("span",{title:t.url,style:{fontSize:"0.8rem",fontFamily:"monospace"},children:x(t.url,40)})}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.eventType}),e.jsx("td",{style:{fontSize:"0.85rem"},children:t.totalAttempts}),e.jsx("td",{style:{fontSize:"0.8rem",maxWidth:"200px",color:"var(--cedros-admin-text-muted, #888)"},children:e.jsx("span",{title:t.finalError,children:x(t.finalError,40)})}),e.jsx("td",{style:{fontSize:"0.8rem"},children:E.formatDateTime(t.movedToDlqAt)}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",gap:"0.25rem"},children:[e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>Q(t.id),children:"Retry"}),e.jsx("button",{type:"button",className:"cedros-admin__button cedros-admin__button--ghost cedros-admin__button--sm",onClick:()=>P(t.id),style:{color:"var(--cedros-admin-danger, #c00)"},children:"Delete"})]})})]},t.id))})]})})})]})}exports.WebhooksSection=O;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as o, jsx as t, Fragment as q } from "react/jsx-runtime";
2
2
  import { useState as r, useCallback as _, useEffect as G } from "react";
3
- import { I as W } from "./icons-C3yDMnKE.mjs";
4
- import { E as C } from "./ErrorBanner-lZJhCmDX.mjs";
3
+ import { I as W } from "./plugin-CuoGEYWr.mjs";
4
+ import { E as C } from "./ErrorBanner-7naZtdtD.mjs";
5
5
  import { f as N } from "./dateHelpers-yvPkofYQ.mjs";
6
6
  const H = (n) => n === "success" ? "success" : n === "failed" ? "failed" : n === "pending" || n === "processing" ? "pending" : "muted", p = (n, s = 48) => n.length > s ? `${n.slice(0, s)}…` : n;
7
7
  function M({ serverUrl: n, apiKey: s, authManager: y }) {
package/dist/admin.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./sectionIds-D46-_-h-.js");exports.CEDROS_PAY_GROUPS=S.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=S.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=S.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=S.cedrosPayPlugin;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./plugin-DNhaPAbC.js");exports.CEDROS_PAY_GROUPS=S.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=S.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=S.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=S.cedrosPayPlugin;
package/dist/admin.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as a, a as C, b as O, c as P } from "./sectionIds-YktNxmRt.mjs";
1
+ import { C as a, a as C, b as O, c as P } from "./plugin-CuoGEYWr.mjs";
2
2
  export {
3
3
  a as CEDROS_PAY_GROUPS,
4
4
  C as CEDROS_PAY_SECTIONS,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./styles--fxb3lCl.js"),N=require("./index-Cq9ya93W.js"),l=require("./CedrosContext-CCakH2SZ.js"),f=require("./fetchWithTimeout-CG0EKbhf.js"),ue=require("./CryptoButton-DxFCYDlJ.js"),S=require("react/jsx-runtime"),o=require("react"),$=require("@solana/wallet-adapter-react"),ce=require("@solana/wallet-adapter-base"),xe=require("@solana/wallet-adapter-react-ui"),de=require("./ThemeContext-CFXyYx7A.js"),ge=require("./walletPool-BjTXX6Vn.js"),pe=require("./tokenMintValidator-DNBhoefh.js"),U=require("./sectionIds-D46-_-h-.js"),Te=require("./LazyCedrosPayAdminDashboard-CpfTtOBc.js");function me(){const{subscriptionManager:n,x402Manager:d,walletManager:b}=l.useCedrosContext(),{publicKey:u,signTransaction:k}=$.useWallet(),[h,y]=o.useState({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),[_,x]=o.useState(null),T=o.useRef(!1),R=o.useCallback(()=>{if(!u){const i="Wallet not connected";return y(r=>({...r,status:"error",error:i})),{valid:!1,error:i}}if(!k){const i="Wallet does not support signing";return y(r=>({...r,status:"error",error:i})),{valid:!1,error:i}}return{valid:!0}},[u,k]),B=o.useCallback(async i=>{if(!u)return y(r=>({...r,status:"error",error:"Wallet not connected"})),null;y(r=>({...r,status:"checking",error:null}));try{const r=await n.checkSubscriptionStatus({resource:i,userId:u.toString()});return y(a=>({...a,status:r.active?"success":"idle",subscriptionStatus:r.status,expiresAt:r.expiresAt||r.currentPeriodEnd||null})),r}catch(r){const a=l.formatError(r,"Failed to check subscription status");return y(g=>({...g,status:"error",error:a})),null}},[u,n]),W=o.useCallback(async(i,r,a)=>{y(g=>({...g,status:"loading",error:null}));try{const g=await n.requestSubscriptionQuote(i,r,a);return x(g),y(s=>({...s,status:"idle"})),g}catch(g){const s=l.formatError(g,"Failed to get subscription quote");return y(c=>({...c,status:"error",error:s})),null}},[n]),E=o.useCallback(async(i,r,a)=>{if(T.current)return{success:!1,error:"Payment already in progress"};const g=R();if(!g.valid)return{success:!1,error:g.error};T.current=!0,y(s=>({...s,status:"loading",error:null}));try{const s=await n.requestSubscriptionQuote(i,r,a);x(s);const c=s.requirement;if(!d.validateRequirement(c))throw new Error("Invalid subscription quote received from server");const P=!!c.extra?.feePayer;let C;if(P){const{transaction:w,blockhash:q}=await d.buildGaslessTransaction({resourceId:i,userWallet:u.toString(),feePayer:c.extra.feePayer,couponCode:a?.couponCode}),A=b.deserializeTransaction(w),M=await b.partiallySignTransaction({transaction:A,signTransaction:k,blockhash:q});C=await d.submitGaslessTransaction({resource:i,partialTx:M,couponCode:a?.couponCode,resourceType:"regular",requirement:c})}else{const w=await b.buildTransaction({requirement:c,payerPublicKey:u}),q=await b.signTransaction({transaction:w,signTransaction:k}),A=b.buildPaymentPayload({requirement:c,signedTx:q,payerPublicKey:u});C=await d.submitPayment({resource:i,payload:A,couponCode:a?.couponCode,resourceType:"regular"})}if(C.success){const w=await n.checkSubscriptionStatus({resource:i,userId:u.toString()});y({status:"success",error:null,sessionId:C.transactionId||null,subscriptionStatus:w.status,expiresAt:w.expiresAt||w.currentPeriodEnd||null})}else y(w=>({...w,status:"error",error:C.error||"Subscription payment failed"}));return C}catch(s){const c=l.formatError(s,"Subscription payment failed");return y(P=>({...P,status:"error",error:c})),{success:!1,error:c}}finally{T.current=!1}},[R,n,d,b,u,k]),I=o.useCallback(()=>{y({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),x(null)},[]);return{...h,quote:_,checkStatus:B,requestQuote:W,processPayment:E,reset:I}}function ke({resource:n,interval:d,intervalDays:b,couponCode:u,label:k,disabled:h=!1,onAttempt:y,onSuccess:_,onError:x,className:T="",testPageUrl:R,hideMessages:B=!1,autoCheckStatus:W=!0}){const{connected:E,connecting:I,connect:i,disconnect:r,select:a,wallets:g,wallet:s,publicKey:c}=$.useWallet(),{status:P,error:C,subscriptionStatus:w,expiresAt:q,checkStatus:A,processPayment:M}=me(),p=de.useCedrosTheme(),{solanaError:v}=l.useCedrosContext(),{t:L,translations:Q}=e.useTranslation(),fe=k||L("ui.subscribe_with_crypto"),V=o.useRef(_),X=o.useRef(x),H=o.useRef(M),J=o.useRef(A);V.current=_,X.current=x,H.current=M,J.current=A;const ye=C&&typeof C!="string"?C?.code??null:null,be=v&&typeof v!="string"?v?.code??null:null,Z=t=>{if(!t||!Q)return"";const m=Q.errors[t];return m?m.action?`${m.message} ${m.action}`:m.message:""},ee=C?typeof C=="string"?C:Z(ye):null,te=v?typeof v=="string"?v:Z(be):null,Ce=o.useMemo(()=>g.map(t=>`${t.adapter.name}-${t.readyState}`).join(","),[g]),z=o.useMemo(()=>g.filter(({readyState:t})=>t===ce.WalletReadyState.Installed||t===ce.WalletReadyState.Loadable),[Ce]);o.useEffect(()=>{W&&E&&c&&(f.getLogger().debug("[CryptoSubscribeButton] Auto-checking subscription status"),J.current(n))},[W,E,c,n]),o.useEffect(()=>{P==="success"&&w==="active"&&(e.emitPaymentSuccess("crypto","subscription-active",n),V.current?.("subscription-active"))},[P,w,n]),o.useEffect(()=>{P==="error"&&C&&(e.emitPaymentError("crypto",C,n),X.current?.(C))},[P,C,n]);const re=typeof window<"u"&&window.top!==window.self,[ne,F]=o.useState(!1),[oe,Y]=o.useState(!1),[ae,O]=o.useState(!1),D=v;o.useEffect(()=>{let t=!1;return t||(async()=>{if(oe&&s&&!E&&!I){f.getLogger().debug("[CryptoSubscribeButton] Wallet detected, attempting auto-connect:",s.adapter.name),Y(!1),e.emitWalletConnect(s.adapter.name);try{await i(),t||f.getLogger().debug("[CryptoSubscribeButton] Auto-connect successful")}catch(K){if(!t){f.getLogger().error("[CryptoSubscribeButton] Auto-connect failed:",K);const Re=K instanceof Error?K.message:"Failed to connect wallet";e.emitWalletError(Re,s.adapter.name),O(!1)}}}})(),()=>{t=!0}},[s,oe,E,I,i]),o.useEffect(()=>{E&&ae&&c&&s&&(e.emitWalletConnected(s.adapter.name,c.toString()),f.getLogger().debug("[CryptoSubscribeButton] Processing pending subscription payment"),O(!1),F(!1),e.emitPaymentProcessing("crypto",n),H.current(n,d,{couponCode:u,intervalDays:b}))},[E,ae,c,s,n,d,u,b]);const se=o.useCallback(async()=>{if(f.getLogger().debug("[CryptoSubscribeButton] executeSubscriptionFlow called",{connected:E,wallet:s?.adapter.name,resource:n,interval:d}),e.emitPaymentStart("crypto",n),y&&y("crypto"),D){f.getLogger().error("[CryptoSubscribeButton] Solana dependencies missing:",D),e.emitPaymentError("crypto",D,n),x&&x(D);return}if(re){const t=R||window.location.href;try{if(new URL(t,window.location.origin).origin!==window.location.origin)throw f.getLogger().error("[CryptoSubscribeButton] Blocked attempt to open external URL:",t),new Error("Cannot open external URLs from embedded context");window.open(t,"_blank","noopener,noreferrer")}catch(m){throw f.getLogger().error("[CryptoSubscribeButton] URL validation failed:",m),m}return}if(E)e.emitPaymentProcessing("crypto",n),await M(n,d,{couponCode:u,intervalDays:b});else{O(!0);try{if(s)f.getLogger().debug("[CryptoSubscribeButton] Wallet already selected, connecting:",s.adapter.name),e.emitWalletConnect(s.adapter.name),await i();else{if(f.getLogger().debug("[CryptoSubscribeButton] No wallet selected, showing selector"),z.length===0){O(!1);const t="No wallets available";throw e.emitWalletError(t),new Error(t)}F(!0)}}catch(t){O(!1);const m=t instanceof Error?t.message:"Failed to connect wallet";f.getLogger().error("[CryptoSubscribeButton] Connection error:",m),e.emitWalletError(m,s?.adapter.name)}}},[E,s,n,d,u,b,re,R,z,i,M,D,y,x]),ie=o.useMemo(()=>`crypto-subscribe-${n}-${d}`,[n,d]),Se=o.useMemo(()=>e.createDedupedClickHandler(ie,se,{cooldownMs:200,deduplicationWindowMs:0}),[ie,se]),le=P==="loading"||P==="checking",j=w==="active"||w==="trialing",Ee=h||le||I||!!D||j;let G=fe;if(le)G=L("ui.processing");else if(j&&q){const t=new Date(q).toLocaleDateString();G=`${L("ui.subscribed_until")} ${t}`}else j&&(G=L("ui.subscribed"));const Pe=o.useCallback(async()=>{try{Y(!1),E&&await r(),a(null),F(!0)}catch(t){f.getLogger().error("Failed to change wallet:",t)}},[E,r,a]),he=o.useCallback(t=>{f.getLogger().debug("[CryptoSubscribeButton] Wallet clicked:",t),F(!1),a(t),Y(!0)},[a]),we=o.useCallback(async()=>{try{if(await r(),O(!1),typeof window<"u"&&window.localStorage)try{window.localStorage.removeItem("walletName")}catch(t){t instanceof Error&&t.name==="QuotaExceededError"?f.getLogger().warn("localStorage quota exceeded when removing wallet preference"):f.getLogger().error("Failed to clear wallet preference from localStorage:",t)}}catch(t){f.getLogger().error("Failed to disconnect wallet:",t)}},[r]);return S.jsxs("div",{className:p.unstyled?T:`${p.className} cedros-theme__crypto-button ${T||""}`,style:p.unstyled?{}:p.style,children:[S.jsx("button",{onClick:Se,disabled:Ee,className:p.unstyled?T:"cedros-theme__button cedros-theme__crypto",type:"button",children:G}),ne&&!B&&S.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:p.tokens.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:()=>F(!1),children:S.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:p.tokens.modalBackground,borderRadius:"12px",padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",border:`1px solid ${p.tokens.modalBorder}`},onClick:t=>t.stopPropagation(),children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[S.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:p.tokens.surfaceText},children:L("wallet.select_wallet")}),S.jsx("button",{onClick:()=>F(!1),style:e.getModalCloseButtonStyles(p.tokens.surfaceText),"aria-label":"Close modal",type:"button",children:"×"})]}),S.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:z.map(t=>S.jsxs("button",{onClick:()=>he(t.adapter.name),style:{width:"100%",padding:"1rem",backgroundColor:p.tokens.surfaceBackground,border:`1px solid ${p.tokens.surfaceBorder}`,borderRadius:"0.5rem",cursor:"pointer",fontSize:"1rem",textAlign:"left",color:p.tokens.surfaceText,display:"flex",alignItems:"center",gap:"1rem",transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=p.tokens.modalBackground,m.currentTarget.style.borderColor=p.tokens.surfaceText,m.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=p.tokens.surfaceBackground,m.currentTarget.style.borderColor=p.tokens.surfaceBorder,m.currentTarget.style.transform="translateY(0)"},type:"button",children:[S.jsx(xe.WalletIcon,{wallet:t,style:{width:"24px",height:"24px"}}),S.jsx("span",{style:{fontWeight:500},children:t.adapter.name})]},t.adapter.name))})]})}),E&&!B&&!ne&&S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem",fontSize:"0.75rem",color:p.tokens.surfaceText,opacity:.7},children:[S.jsx("button",{onClick:Pe,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("wallet.change")}),S.jsx("button",{onClick:we,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("ui.disconnect")})]}),!B&&te&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:te}),!B&&ee&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:ee}),!B&&j&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__success",children:L("ui.subscription_active")})]})}function _e(){const{x402Manager:n,walletManager:d}=l.useCedrosContext(),{publicKey:b,signTransaction:u}=$.useWallet(),[k,h]=o.useState({status:"idle",error:null,transactionId:null}),[y,_]=o.useState(null),[x,T]=o.useState(null),R=o.useRef(!1),B=o.useCallback(async i=>{try{h(a=>({...a,status:"loading"}));const r=await n.requestQuote({resource:i});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received from server");return _(r),h(a=>({...a,status:"idle"})),r}catch(r){const a=l.formatError(r,"Failed to fetch refund requirement");throw h({status:"error",error:a,transactionId:null}),r}},[n]),W=o.useCallback(async(i,r)=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const a=await n.requestQuote({resource:i,couponCode:r});if(!n.validateRequirement(a))throw new Error("Invalid refund requirement received");_(a);const g=await d.buildTransaction({requirement:a,payerPublicKey:b}),s=await d.signTransaction({transaction:g,signTransaction:u}),c=d.buildPaymentPayload({requirement:a,signedTx:s,payerPublicKey:b}),P=await n.submitPayment({resource:i,payload:c,couponCode:r,metadata:void 0,resourceType:"refund"});return P.settlement&&T(P.settlement),h({status:"success",error:null,transactionId:P.transactionId||s.signature}),P}catch(a){const g=l.formatError(a,"Refund payment failed");throw h({status:"error",error:g,transactionId:null}),a}finally{R.current=!1}},[b,u,n,d]),E=o.useCallback(async i=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const r=await n.requestQuote({resource:i});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received");_(r);const{transaction:a}=await n.buildGaslessTransaction({resourceId:i,userWallet:b.toString(),feePayer:r.extra.feePayer}),g=d.deserializeTransaction(a),s=await d.partiallySignTransaction({transaction:g,signTransaction:u}),c=await n.submitGaslessTransaction({resource:i,partialTx:s,couponCode:void 0,metadata:void 0,resourceType:"refund",requirement:r});return c.settlement&&T(c.settlement),h({status:"success",error:null,transactionId:c.transactionId||"gasless-refund-tx"}),c}catch(r){const a=l.formatError(r,"Gasless refund payment failed");throw h({status:"error",error:a,transactionId:null}),r}finally{R.current=!1}},[b,u,n,d]),I=o.useCallback(()=>{h({status:"idle",error:null,transactionId:null}),_(null),T(null)},[]);return{state:k,requirement:y,settlement:x,fetchRefundQuote:B,processRefund:W,processGaslessRefund:E,reset:I}}exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CSP_PRESETS=e.CSP_PRESETS;exports.CedrosPay=e.CedrosPay;exports.CreditsButton=e.CreditsButton;exports.CreditsSubscribeButton=e.CreditsSubscribeButton;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.PurchaseButton=e.PurchaseButton;exports.RPC_PROVIDERS=e.RPC_PROVIDERS;exports.SECURITY_RECOMMENDATIONS=e.SECURITY_RECOMMENDATIONS;exports.StripeButton=e.StripeButton;exports.SubscribeButton=e.SubscribeButton;exports.SubscriptionManagementPanel=e.SubscriptionManagementPanel;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.createTranslator=e.createTranslator;exports.detectLocale=e.detectLocale;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.emitWalletConnect=e.emitWalletConnect;exports.emitWalletConnected=e.emitWalletConnected;exports.emitWalletError=e.emitWalletError;exports.formatCSP=e.formatCSP;exports.formatCouponCodes=e.formatCouponCodes;exports.generateCSP=e.generateCSP;exports.generateCSPDirectives=e.generateCSPDirectives;exports.getAvailableLocales=e.getAvailableLocales;exports.getLocalizedError=e.getLocalizedError;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.loadLocale=e.loadLocale;exports.logSecurityReport=e.logSecurityReport;exports.parseCouponCodes=e.parseCouponCodes;exports.stackCheckoutCoupons=e.stackCheckoutCoupons;exports.useCreditsPayment=e.useCreditsPayment;exports.useCreditsSubscription=e.useCreditsSubscription;exports.useLocalizedError=e.useLocalizedError;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;exports.useSubscription=e.useSubscription;exports.useSubscriptionManagement=e.useSubscriptionManagement;exports.useTranslation=e.useTranslation;exports.validateSecurity=e.validateSecurity;exports.ComplianceGatePage=N.ComplianceGatePage;exports.CreditsBalance=N.CreditsBalance;exports.ecommerce=N.index;exports.useComplianceCheck=N.useComplianceCheck;exports.useCreditsBalance=N.useCreditsBalance;exports.CIRCUIT_BREAKER_PRESETS=l.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=l.CedrosProvider;exports.CircuitBreakerOpenError=l.CircuitBreakerOpenError;exports.CircuitState=l.CircuitState;exports.ERROR_CATEGORIES=l.ERROR_CATEGORIES;exports.FEATURE_FLAG_NAMES=l.FEATURE_FLAG_NAMES;exports.FEATURE_FLAG_REGISTRY=l.FEATURE_FLAG_REGISTRY;exports.RATE_LIMITER_PRESETS=l.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=l.RETRY_PRESETS;exports.createCircuitBreaker=l.createCircuitBreaker;exports.createRateLimiter=l.createRateLimiter;exports.getFeatureFlagDefinition=l.getFeatureFlagDefinition;exports.getFeatureFlagDefinitions=l.getFeatureFlagDefinitions;exports.isFeatureEnabled=l.isFeatureEnabled;exports.parseFeatureFlagBoolean=l.parseFeatureFlagBoolean;exports.resolveFeatureFlags=l.resolveFeatureFlags;exports.retryWithBackoff=l.retryWithBackoff;exports.useCedrosContext=l.useCedrosContext;exports.validateConfig=l.validateConfig;exports.LogLevel=f.LogLevel;exports.Logger=f.Logger;exports.createLogger=f.createLogger;exports.getLogger=f.getLogger;exports.CryptoButton=ue.CryptoButton;exports.useX402Payment=ue.useX402Payment;exports.useCedrosTheme=de.useCedrosTheme;exports.WalletPool=ge.WalletPool;exports.createWalletPool=ge.createWalletPool;exports.KNOWN_STABLECOINS=pe.KNOWN_STABLECOINS;exports.validateTokenMint=pe.validateTokenMint;exports.CEDROS_PAY_GROUPS=U.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=U.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=U.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=U.cedrosPayPlugin;exports.CedrosPayAdminDashboard=Te.CedrosPayAdminDashboard;exports.CryptoSubscribeButton=ke;exports.useCryptoSubscription=me;exports.useRefundVerification=_e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./styles-BwaDljnz.js"),N=require("./index-DVxx_62C.js"),i=require("./CedrosContext-3Dz7_9Ct.js"),f=require("./fetchWithTimeout-CG0EKbhf.js"),ue=require("./CryptoButton-BQceZhbn.js"),S=require("react/jsx-runtime"),o=require("react"),$=require("@solana/wallet-adapter-react"),ce=require("@solana/wallet-adapter-base"),Re=require("@solana/wallet-adapter-react-ui"),de=require("./walletPool-BjTXX6Vn.js"),ge=require("./tokenMintValidator-DNBhoefh.js"),U=require("./plugin-DNhaPAbC.js");function pe(){const{subscriptionManager:n,x402Manager:d,walletManager:b}=i.useCedrosContext(),{publicKey:u,signTransaction:k}=$.useWallet(),[h,y]=o.useState({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),[_,x]=o.useState(null),T=o.useRef(!1),R=o.useCallback(()=>{if(!u){const l="Wallet not connected";return y(r=>({...r,status:"error",error:l})),{valid:!1,error:l}}if(!k){const l="Wallet does not support signing";return y(r=>({...r,status:"error",error:l})),{valid:!1,error:l}}return{valid:!0}},[u,k]),B=o.useCallback(async l=>{if(!u)return y(r=>({...r,status:"error",error:"Wallet not connected"})),null;y(r=>({...r,status:"checking",error:null}));try{const r=await n.checkSubscriptionStatus({resource:l,userId:u.toString()});return y(a=>({...a,status:r.active?"success":"idle",subscriptionStatus:r.status,expiresAt:r.expiresAt||r.currentPeriodEnd||null})),r}catch(r){const a=i.formatError(r,"Failed to check subscription status");return y(g=>({...g,status:"error",error:a})),null}},[u,n]),W=o.useCallback(async(l,r,a)=>{y(g=>({...g,status:"loading",error:null}));try{const g=await n.requestSubscriptionQuote(l,r,a);return x(g),y(s=>({...s,status:"idle"})),g}catch(g){const s=i.formatError(g,"Failed to get subscription quote");return y(c=>({...c,status:"error",error:s})),null}},[n]),E=o.useCallback(async(l,r,a)=>{if(T.current)return{success:!1,error:"Payment already in progress"};const g=R();if(!g.valid)return{success:!1,error:g.error};T.current=!0,y(s=>({...s,status:"loading",error:null}));try{const s=await n.requestSubscriptionQuote(l,r,a);x(s);const c=s.requirement;if(!d.validateRequirement(c))throw new Error("Invalid subscription quote received from server");const P=!!c.extra?.feePayer;let C;if(P){const{transaction:w,blockhash:M}=await d.buildGaslessTransaction({resourceId:l,userWallet:u.toString(),feePayer:c.extra.feePayer,couponCode:a?.couponCode}),q=b.deserializeTransaction(w),A=await b.partiallySignTransaction({transaction:q,signTransaction:k,blockhash:M});C=await d.submitGaslessTransaction({resource:l,partialTx:A,couponCode:a?.couponCode,resourceType:"regular",requirement:c})}else{const w=await b.buildTransaction({requirement:c,payerPublicKey:u}),M=await b.signTransaction({transaction:w,signTransaction:k}),q=b.buildPaymentPayload({requirement:c,signedTx:M,payerPublicKey:u});C=await d.submitPayment({resource:l,payload:q,couponCode:a?.couponCode,resourceType:"regular"})}if(C.success){const w=await n.checkSubscriptionStatus({resource:l,userId:u.toString()});y({status:"success",error:null,sessionId:C.transactionId||null,subscriptionStatus:w.status,expiresAt:w.expiresAt||w.currentPeriodEnd||null})}else y(w=>({...w,status:"error",error:C.error||"Subscription payment failed"}));return C}catch(s){const c=i.formatError(s,"Subscription payment failed");return y(P=>({...P,status:"error",error:c})),{success:!1,error:c}}finally{T.current=!1}},[R,n,d,b,u,k]),v=o.useCallback(()=>{y({status:"idle",error:null,sessionId:null,subscriptionStatus:null,expiresAt:null}),x(null)},[]);return{...h,quote:_,checkStatus:B,requestQuote:W,processPayment:E,reset:v}}function xe({resource:n,interval:d,intervalDays:b,couponCode:u,label:k,disabled:h=!1,onAttempt:y,onSuccess:_,onError:x,className:T="",testPageUrl:R,hideMessages:B=!1,autoCheckStatus:W=!0}){const{connected:E,connecting:v,connect:l,disconnect:r,select:a,wallets:g,wallet:s,publicKey:c}=$.useWallet(),{status:P,error:C,subscriptionStatus:w,expiresAt:M,checkStatus:q,processPayment:A}=pe(),p=i.useCedrosTheme(),{solanaError:I}=i.useCedrosContext(),{t:L,translations:Q}=e.useTranslation(),me=k||L("ui.subscribe_with_crypto"),V=o.useRef(_),X=o.useRef(x),H=o.useRef(A),J=o.useRef(q);V.current=_,X.current=x,H.current=A,J.current=q;const fe=C&&typeof C!="string"?C?.code??null:null,ye=I&&typeof I!="string"?I?.code??null:null,Z=t=>{if(!t||!Q)return"";const m=Q.errors[t];return m?m.action?`${m.message} ${m.action}`:m.message:""},ee=C?typeof C=="string"?C:Z(fe):null,te=I?typeof I=="string"?I:Z(ye):null,be=o.useMemo(()=>g.map(t=>`${t.adapter.name}-${t.readyState}`).join(","),[g]),z=o.useMemo(()=>g.filter(({readyState:t})=>t===ce.WalletReadyState.Installed||t===ce.WalletReadyState.Loadable),[be]);o.useEffect(()=>{W&&E&&c&&(f.getLogger().debug("[CryptoSubscribeButton] Auto-checking subscription status"),J.current(n))},[W,E,c,n]),o.useEffect(()=>{P==="success"&&w==="active"&&(e.emitPaymentSuccess("crypto","subscription-active",n),V.current?.("subscription-active"))},[P,w,n]),o.useEffect(()=>{P==="error"&&C&&(e.emitPaymentError("crypto",C,n),X.current?.(C))},[P,C,n]);const re=typeof window<"u"&&window.top!==window.self,[ne,F]=o.useState(!1),[oe,Y]=o.useState(!1),[ae,O]=o.useState(!1),D=I;o.useEffect(()=>{let t=!1;return t||(async()=>{if(oe&&s&&!E&&!v){f.getLogger().debug("[CryptoSubscribeButton] Wallet detected, attempting auto-connect:",s.adapter.name),Y(!1),e.emitWalletConnect(s.adapter.name);try{await l(),t||f.getLogger().debug("[CryptoSubscribeButton] Auto-connect successful")}catch(K){if(!t){f.getLogger().error("[CryptoSubscribeButton] Auto-connect failed:",K);const we=K instanceof Error?K.message:"Failed to connect wallet";e.emitWalletError(we,s.adapter.name),O(!1)}}}})(),()=>{t=!0}},[s,oe,E,v,l]),o.useEffect(()=>{E&&ae&&c&&s&&(e.emitWalletConnected(s.adapter.name,c.toString()),f.getLogger().debug("[CryptoSubscribeButton] Processing pending subscription payment"),O(!1),F(!1),e.emitPaymentProcessing("crypto",n),H.current(n,d,{couponCode:u,intervalDays:b}))},[E,ae,c,s,n,d,u,b]);const se=o.useCallback(async()=>{if(f.getLogger().debug("[CryptoSubscribeButton] executeSubscriptionFlow called",{connected:E,wallet:s?.adapter.name,resource:n,interval:d}),e.emitPaymentStart("crypto",n),y&&y("crypto"),D){f.getLogger().error("[CryptoSubscribeButton] Solana dependencies missing:",D),e.emitPaymentError("crypto",D,n),x&&x(D);return}if(re){const t=R||window.location.href;try{if(new URL(t,window.location.origin).origin!==window.location.origin)throw f.getLogger().error("[CryptoSubscribeButton] Blocked attempt to open external URL:",t),new Error("Cannot open external URLs from embedded context");window.open(t,"_blank","noopener,noreferrer")}catch(m){throw f.getLogger().error("[CryptoSubscribeButton] URL validation failed:",m),m}return}if(E)e.emitPaymentProcessing("crypto",n),await A(n,d,{couponCode:u,intervalDays:b});else{O(!0);try{if(s)f.getLogger().debug("[CryptoSubscribeButton] Wallet already selected, connecting:",s.adapter.name),e.emitWalletConnect(s.adapter.name),await l();else{if(f.getLogger().debug("[CryptoSubscribeButton] No wallet selected, showing selector"),z.length===0){O(!1);const t="No wallets available";throw e.emitWalletError(t),new Error(t)}F(!0)}}catch(t){O(!1);const m=t instanceof Error?t.message:"Failed to connect wallet";f.getLogger().error("[CryptoSubscribeButton] Connection error:",m),e.emitWalletError(m,s?.adapter.name)}}},[E,s,n,d,u,b,re,R,z,l,A,D,y,x]),ie=o.useMemo(()=>`crypto-subscribe-${n}-${d}`,[n,d]),Ce=o.useMemo(()=>e.createDedupedClickHandler(ie,se,{cooldownMs:200,deduplicationWindowMs:0}),[ie,se]),le=P==="loading"||P==="checking",j=w==="active"||w==="trialing",Se=h||le||v||!!D||j;let G=me;if(le)G=L("ui.processing");else if(j&&M){const t=new Date(M).toLocaleDateString();G=`${L("ui.subscribed_until")} ${t}`}else j&&(G=L("ui.subscribed"));const Ee=o.useCallback(async()=>{try{Y(!1),E&&await r(),a(null),F(!0)}catch(t){f.getLogger().error("Failed to change wallet:",t)}},[E,r,a]),Pe=o.useCallback(t=>{f.getLogger().debug("[CryptoSubscribeButton] Wallet clicked:",t),F(!1),a(t),Y(!0)},[a]),he=o.useCallback(async()=>{try{if(await r(),O(!1),typeof window<"u"&&window.localStorage)try{window.localStorage.removeItem("walletName")}catch(t){t instanceof Error&&t.name==="QuotaExceededError"?f.getLogger().warn("localStorage quota exceeded when removing wallet preference"):f.getLogger().error("Failed to clear wallet preference from localStorage:",t)}}catch(t){f.getLogger().error("Failed to disconnect wallet:",t)}},[r]);return S.jsxs("div",{className:p.unstyled?T:`${p.className} cedros-theme__crypto-button ${T||""}`,style:p.unstyled?{}:p.style,children:[S.jsx("button",{onClick:Ce,disabled:Se,className:p.unstyled?T:"cedros-theme__button cedros-theme__crypto",type:"button",children:G}),ne&&!B&&S.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:p.tokens.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:()=>F(!1),children:S.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:p.tokens.modalBackground,borderRadius:"12px",padding:"2rem",maxWidth:"400px",width:"100%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",border:`1px solid ${p.tokens.modalBorder}`},onClick:t=>t.stopPropagation(),children:[S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[S.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:p.tokens.surfaceText},children:L("wallet.select_wallet")}),S.jsx("button",{onClick:()=>F(!1),style:e.getModalCloseButtonStyles(p.tokens.surfaceText),"aria-label":"Close modal",type:"button",children:"×"})]}),S.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:z.map(t=>S.jsxs("button",{onClick:()=>Pe(t.adapter.name),style:{width:"100%",padding:"1rem",backgroundColor:p.tokens.surfaceBackground,border:`1px solid ${p.tokens.surfaceBorder}`,borderRadius:"0.5rem",cursor:"pointer",fontSize:"1rem",textAlign:"left",color:p.tokens.surfaceText,display:"flex",alignItems:"center",gap:"1rem",transition:"all 0.2s ease"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=p.tokens.modalBackground,m.currentTarget.style.borderColor=p.tokens.surfaceText,m.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:m=>{m.currentTarget.style.backgroundColor=p.tokens.surfaceBackground,m.currentTarget.style.borderColor=p.tokens.surfaceBorder,m.currentTarget.style.transform="translateY(0)"},type:"button",children:[S.jsx(Re.WalletIcon,{wallet:t,style:{width:"24px",height:"24px"}}),S.jsx("span",{style:{fontWeight:500},children:t.adapter.name})]},t.adapter.name))})]})}),E&&!B&&!ne&&S.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem",fontSize:"0.75rem",color:p.tokens.surfaceText,opacity:.7},children:[S.jsx("button",{onClick:Ee,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("wallet.change")}),S.jsx("button",{onClick:he,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:L("ui.disconnect")})]}),!B&&te&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:te}),!B&&ee&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__error",children:ee}),!B&&j&&S.jsx("div",{className:p.unstyled?"":"cedros-theme__success",children:L("ui.subscription_active")})]})}function Te(){const{x402Manager:n,walletManager:d}=i.useCedrosContext(),{publicKey:b,signTransaction:u}=$.useWallet(),[k,h]=o.useState({status:"idle",error:null,transactionId:null}),[y,_]=o.useState(null),[x,T]=o.useState(null),R=o.useRef(!1),B=o.useCallback(async l=>{try{h(a=>({...a,status:"loading"}));const r=await n.requestQuote({resource:l});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received from server");return _(r),h(a=>({...a,status:"idle"})),r}catch(r){const a=i.formatError(r,"Failed to fetch refund requirement");throw h({status:"error",error:a,transactionId:null}),r}},[n]),W=o.useCallback(async(l,r)=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const a=await n.requestQuote({resource:l,couponCode:r});if(!n.validateRequirement(a))throw new Error("Invalid refund requirement received");_(a);const g=await d.buildTransaction({requirement:a,payerPublicKey:b}),s=await d.signTransaction({transaction:g,signTransaction:u}),c=d.buildPaymentPayload({requirement:a,signedTx:s,payerPublicKey:b}),P=await n.submitPayment({resource:l,payload:c,couponCode:r,metadata:void 0,resourceType:"refund"});return P.settlement&&T(P.settlement),h({status:"success",error:null,transactionId:P.transactionId||s.signature}),P}catch(a){const g=i.formatError(a,"Refund payment failed");throw h({status:"error",error:g,transactionId:null}),a}finally{R.current=!1}},[b,u,n,d]),E=o.useCallback(async l=>{if(R.current)throw new Error("Refund already in progress");if(!b||!u)throw new Error("Wallet not connected");R.current=!0;try{h({status:"loading",error:null,transactionId:null});const r=await n.requestQuote({resource:l});if(!n.validateRequirement(r))throw new Error("Invalid refund requirement received");_(r);const{transaction:a}=await n.buildGaslessTransaction({resourceId:l,userWallet:b.toString(),feePayer:r.extra.feePayer}),g=d.deserializeTransaction(a),s=await d.partiallySignTransaction({transaction:g,signTransaction:u}),c=await n.submitGaslessTransaction({resource:l,partialTx:s,couponCode:void 0,metadata:void 0,resourceType:"refund",requirement:r});return c.settlement&&T(c.settlement),h({status:"success",error:null,transactionId:c.transactionId||"gasless-refund-tx"}),c}catch(r){const a=i.formatError(r,"Gasless refund payment failed");throw h({status:"error",error:a,transactionId:null}),r}finally{R.current=!1}},[b,u,n,d]),v=o.useCallback(()=>{h({status:"idle",error:null,transactionId:null}),_(null),T(null)},[]);return{state:k,requirement:y,settlement:x,fetchRefundQuote:B,processRefund:W,processGaslessRefund:E,reset:v}}exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CSP_PRESETS=e.CSP_PRESETS;exports.CedrosPay=e.CedrosPay;exports.CreditsButton=e.CreditsButton;exports.CreditsSubscribeButton=e.CreditsSubscribeButton;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.PurchaseButton=e.PurchaseButton;exports.RPC_PROVIDERS=e.RPC_PROVIDERS;exports.SECURITY_RECOMMENDATIONS=e.SECURITY_RECOMMENDATIONS;exports.StripeButton=e.StripeButton;exports.SubscribeButton=e.SubscribeButton;exports.SubscriptionManagementPanel=e.SubscriptionManagementPanel;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.createTranslator=e.createTranslator;exports.detectLocale=e.detectLocale;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.emitWalletConnect=e.emitWalletConnect;exports.emitWalletConnected=e.emitWalletConnected;exports.emitWalletError=e.emitWalletError;exports.formatCSP=e.formatCSP;exports.formatCouponCodes=e.formatCouponCodes;exports.generateCSP=e.generateCSP;exports.generateCSPDirectives=e.generateCSPDirectives;exports.getAvailableLocales=e.getAvailableLocales;exports.getLocalizedError=e.getLocalizedError;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.loadLocale=e.loadLocale;exports.logSecurityReport=e.logSecurityReport;exports.parseCouponCodes=e.parseCouponCodes;exports.stackCheckoutCoupons=e.stackCheckoutCoupons;exports.useCreditsPayment=e.useCreditsPayment;exports.useCreditsSubscription=e.useCreditsSubscription;exports.useLocalizedError=e.useLocalizedError;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;exports.useSubscription=e.useSubscription;exports.useSubscriptionManagement=e.useSubscriptionManagement;exports.useTranslation=e.useTranslation;exports.validateSecurity=e.validateSecurity;exports.ComplianceGatePage=N.ComplianceGatePage;exports.CreditsBalance=N.CreditsBalance;exports.ecommerce=N.index;exports.useComplianceCheck=N.useComplianceCheck;exports.useCreditsBalance=N.useCreditsBalance;exports.CIRCUIT_BREAKER_PRESETS=i.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=i.CedrosProvider;exports.CircuitBreakerOpenError=i.CircuitBreakerOpenError;exports.CircuitState=i.CircuitState;exports.ERROR_CATEGORIES=i.ERROR_CATEGORIES;exports.FEATURE_FLAG_NAMES=i.FEATURE_FLAG_NAMES;exports.FEATURE_FLAG_REGISTRY=i.FEATURE_FLAG_REGISTRY;exports.RATE_LIMITER_PRESETS=i.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=i.RETRY_PRESETS;exports.createCircuitBreaker=i.createCircuitBreaker;exports.createRateLimiter=i.createRateLimiter;exports.getFeatureFlagDefinition=i.getFeatureFlagDefinition;exports.getFeatureFlagDefinitions=i.getFeatureFlagDefinitions;exports.isFeatureEnabled=i.isFeatureEnabled;exports.parseFeatureFlagBoolean=i.parseFeatureFlagBoolean;exports.resolveFeatureFlags=i.resolveFeatureFlags;exports.retryWithBackoff=i.retryWithBackoff;exports.useCedrosContext=i.useCedrosContext;exports.useCedrosTheme=i.useCedrosTheme;exports.validateConfig=i.validateConfig;exports.LogLevel=f.LogLevel;exports.Logger=f.Logger;exports.createLogger=f.createLogger;exports.getLogger=f.getLogger;exports.CryptoButton=ue.CryptoButton;exports.useX402Payment=ue.useX402Payment;exports.WalletPool=de.WalletPool;exports.createWalletPool=de.createWalletPool;exports.KNOWN_STABLECOINS=ge.KNOWN_STABLECOINS;exports.validateTokenMint=ge.validateTokenMint;exports.CEDROS_PAY_GROUPS=U.CEDROS_PAY_GROUPS;exports.CEDROS_PAY_SECTIONS=U.CEDROS_PAY_SECTIONS;exports.CEDROS_PAY_SECTION_IDS=U.CEDROS_PAY_SECTION_IDS;exports.cedrosPayPlugin=U.cedrosPayPlugin;exports.CryptoSubscribeButton=xe;exports.useCryptoSubscription=pe;exports.useRefundVerification=Te;
@@ -1,21 +1,19 @@
1
- import { O as ke, q as ve, n as fe, s as Be, o as me, p as Ie, r as ye, t as V, V as _e, W as We } from "./styles-DGagylUj.mjs";
2
- import { C as Ve, a as He, b as Je, c as Xe, d as Ze, P as et, e as tt, f as rt, g as at, R as nt, S as st, h as ot, i as it, j as ct, k as lt, l as ut, m as dt, u as pt, v as ft, w as mt, x as yt, y as gt, z as bt, A as St, B as wt, D as Ct, E as ht, F as xt, G as Et, H as Pt, I as Rt, J as Tt, K as kt, L as vt, M as Bt, N as It, Q as _t } from "./styles-DGagylUj.mjs";
3
- import { C as qt, a as Mt, i as Lt, u as At, b as Ft } from "./index-9QF_UfSN.mjs";
4
- import { u as H, l as O } from "./CedrosContext-5Gjveoba.mjs";
5
- import { C as Nt, a as Ot, b as Gt, c as zt, E as Kt, F as Qt, d as $t, R as Ut, e as jt, f as Yt, g as Vt, h as Ht, i as Jt, j as Xt, p as Zt, r as er, k as tr, v as rr } from "./CedrosContext-5Gjveoba.mjs";
1
+ import { O as ke, q as ve, n as fe, s as Be, o as me, p as Ie, r as ye, t as V, V as _e, W as We } from "./styles-fihm6qVA.mjs";
2
+ import { C as Ye, a as Ve, b as He, c as Je, d as Xe, P as Ze, e as et, f as tt, g as rt, R as at, S as nt, h as st, i as ot, j as it, k as ct, l as lt, m as ut, u as dt, v as pt, w as ft, x as mt, y as yt, z as gt, A as bt, B as St, D as wt, E as Ct, F as ht, G as xt, H as Et, I as Pt, J as Rt, K as Tt, L as kt, M as vt, N as Bt, Q as It } from "./styles-fihm6qVA.mjs";
3
+ import { C as Wt, a as qt, i as Mt, u as Lt, b as Ft } from "./index-CU6M10Rs.mjs";
4
+ import { u as H, m as O, l as qe } from "./CedrosContext-DQc_k5PG.mjs";
5
+ import { C as Dt, a as Nt, b as Ot, c as Gt, E as zt, F as Kt, d as Qt, R as $t, e as Ut, f as jt, g as Yt, h as Vt, i as Ht, j as Jt, p as Xt, r as Zt, k as er, v as tr } from "./CedrosContext-DQc_k5PG.mjs";
6
6
  import { g as y } from "./fetchWithTimeout-DmMOwL0Q.mjs";
7
- import { L as nr, a as sr, c as or } from "./fetchWithTimeout-DmMOwL0Q.mjs";
8
- import { C as cr, u as lr } from "./CryptoButton-Cl2kZbOP.mjs";
7
+ import { L as ar, a as nr, c as sr } from "./fetchWithTimeout-DmMOwL0Q.mjs";
8
+ import { C as ir, u as cr } from "./CryptoButton-BuO_RZLj.mjs";
9
9
  import { jsxs as G, jsx as x } from "react/jsx-runtime";
10
10
  import { useState as B, useRef as N, useCallback as C, useMemo as $, useEffect as z } from "react";
11
11
  import { useWallet as J } from "@solana/wallet-adapter-react";
12
12
  import { WalletReadyState as ge } from "@solana/wallet-adapter-base";
13
- import { WalletIcon as qe } from "@solana/wallet-adapter-react-ui";
14
- import { u as Me } from "./ThemeContext-l0bqcOGW.mjs";
15
- import { WalletPool as dr, createWalletPool as pr } from "./walletPool-9MylB2QK.mjs";
16
- import { K as mr, a as yr } from "./tokenMintValidator-DAjQld0r.mjs";
17
- import { C as br, a as Sr, b as wr, c as Cr } from "./sectionIds-YktNxmRt.mjs";
18
- import { C as xr } from "./LazyCedrosPayAdminDashboard-BqJDNrDI.mjs";
13
+ import { WalletIcon as Me } from "@solana/wallet-adapter-react-ui";
14
+ import { WalletPool as ur, createWalletPool as dr } from "./walletPool-9MylB2QK.mjs";
15
+ import { K as fr, a as mr } from "./tokenMintValidator-DAjQld0r.mjs";
16
+ import { C as gr, a as br, b as Sr, c as wr } from "./plugin-CuoGEYWr.mjs";
19
17
  function Le() {
20
18
  const { subscriptionManager: r, x402Manager: c, walletManager: f } = H(), { publicKey: i, signTransaction: R } = J(), [S, p] = B({
21
19
  status: "idle",
@@ -211,7 +209,7 @@ function Le() {
211
209
  reset: I
212
210
  };
213
211
  }
214
- function $e({
212
+ function Qe({
215
213
  resource: r,
216
214
  interval: c,
217
215
  intervalDays: f,
@@ -242,7 +240,7 @@ function $e({
242
240
  expiresAt: q,
243
241
  checkStatus: M,
244
242
  processPayment: L
245
- } = Le(), u = Me(), { solanaError: _ } = H(), { t: v, translations: X } = ke(), be = R || v("ui.subscribe_with_crypto"), Z = N(T), ee = N(E), te = N(L), re = N(M);
243
+ } = Le(), u = qe(), { solanaError: _ } = H(), { t: v, translations: X } = ke(), be = R || v("ui.subscribe_with_crypto"), Z = N(T), ee = N(E), te = N(L), re = N(M);
246
244
  Z.current = T, ee.current = E, te.current = L, re.current = M;
247
245
  const Se = m && typeof m != "string" ? m?.code ?? null : null, we = _ && typeof _ != "string" ? _?.code ?? null : null, ae = (e) => {
248
246
  if (!e || !X) return "";
@@ -265,7 +263,7 @@ function $e({
265
263
  }, [b, w, r]), z(() => {
266
264
  b === "error" && m && (fe("crypto", m, r), ee.current?.(m));
267
265
  }, [b, m, r]);
268
- const oe = typeof window < "u" && window.top !== window.self, [ie, A] = B(!1), [ce, j] = B(!1), [le, F] = B(!1), D = _;
266
+ const oe = typeof window < "u" && window.top !== window.self, [ie, F] = B(!1), [ce, j] = B(!1), [le, A] = B(!1), D = _;
269
267
  z(() => {
270
268
  let e = !1;
271
269
  return e || (async () => {
@@ -280,7 +278,7 @@ function $e({
280
278
  if (!e) {
281
279
  y().error("[CryptoSubscribeButton] Auto-connect failed:", Y);
282
280
  const Te = Y instanceof Error ? Y.message : "Failed to connect wallet";
283
- V(Te, n.adapter.name), F(!1);
281
+ V(Te, n.adapter.name), A(!1);
284
282
  }
285
283
  }
286
284
  }
@@ -288,7 +286,7 @@ function $e({
288
286
  e = !0;
289
287
  };
290
288
  }, [n, ce, g, I, s]), z(() => {
291
- g && le && o && n && (Be(n.adapter.name, o.toString()), y().debug("[CryptoSubscribeButton] Processing pending subscription payment"), F(!1), A(!1), me("crypto", r), te.current(r, c, { couponCode: i, intervalDays: f }));
289
+ g && le && o && n && (Be(n.adapter.name, o.toString()), y().debug("[CryptoSubscribeButton] Processing pending subscription payment"), A(!1), F(!1), me("crypto", r), te.current(r, c, { couponCode: i, intervalDays: f }));
292
290
  }, [g, le, o, n, r, c, i, f]);
293
291
  const ue = C(async () => {
294
292
  if (y().debug("[CryptoSubscribeButton] executeSubscriptionFlow called", {
@@ -314,7 +312,7 @@ function $e({
314
312
  if (g)
315
313
  me("crypto", r), await L(r, c, { couponCode: i, intervalDays: f });
316
314
  else {
317
- F(!0);
315
+ A(!0);
318
316
  try {
319
317
  if (n)
320
318
  y().debug(
@@ -323,14 +321,14 @@ function $e({
323
321
  ), ye(n.adapter.name), await s();
324
322
  else {
325
323
  if (y().debug("[CryptoSubscribeButton] No wallet selected, showing selector"), U.length === 0) {
326
- F(!1);
324
+ A(!1);
327
325
  const e = "No wallets available";
328
326
  throw V(e), new Error(e);
329
327
  }
330
- A(!0);
328
+ F(!0);
331
329
  }
332
330
  } catch (e) {
333
- F(!1);
331
+ A(!1);
334
332
  const d = e instanceof Error ? e.message : "Failed to connect wallet";
335
333
  y().error("[CryptoSubscribeButton] Connection error:", d), V(d, n?.adapter.name);
336
334
  }
@@ -366,18 +364,18 @@ function $e({
366
364
  } else K && (Q = v("ui.subscribed"));
367
365
  const Ee = C(async () => {
368
366
  try {
369
- j(!1), g && await t(), a(null), A(!0);
367
+ j(!1), g && await t(), a(null), F(!0);
370
368
  } catch (e) {
371
369
  y().error("Failed to change wallet:", e);
372
370
  }
373
371
  }, [g, t, a]), Pe = C(
374
372
  (e) => {
375
- y().debug("[CryptoSubscribeButton] Wallet clicked:", e), A(!1), a(e), j(!0);
373
+ y().debug("[CryptoSubscribeButton] Wallet clicked:", e), F(!1), a(e), j(!0);
376
374
  },
377
375
  [a]
378
376
  ), Re = C(async () => {
379
377
  try {
380
- if (await t(), F(!1), typeof window < "u" && window.localStorage)
378
+ if (await t(), A(!1), typeof window < "u" && window.localStorage)
381
379
  try {
382
380
  window.localStorage.removeItem("walletName");
383
381
  } catch (e) {
@@ -420,7 +418,7 @@ function $e({
420
418
  zIndex: 9999,
421
419
  padding: "1rem"
422
420
  },
423
- onClick: () => A(!1),
421
+ onClick: () => F(!1),
424
422
  children: /* @__PURE__ */ G(
425
423
  "div",
426
424
  {
@@ -461,7 +459,7 @@ function $e({
461
459
  /* @__PURE__ */ x(
462
460
  "button",
463
461
  {
464
- onClick: () => A(!1),
462
+ onClick: () => F(!1),
465
463
  style: We(u.tokens.surfaceText),
466
464
  "aria-label": "Close modal",
467
465
  type: "button",
@@ -498,7 +496,7 @@ function $e({
498
496
  },
499
497
  type: "button",
500
498
  children: [
501
- /* @__PURE__ */ x(qe, { wallet: e, style: { width: "24px", height: "24px" } }),
499
+ /* @__PURE__ */ x(Me, { wallet: e, style: { width: "24px", height: "24px" } }),
502
500
  /* @__PURE__ */ x("span", { style: { fontWeight: 500 }, children: e.adapter.name })
503
501
  ]
504
502
  },
@@ -565,7 +563,7 @@ function $e({
565
563
  }
566
564
  );
567
565
  }
568
- function Ue() {
566
+ function $e() {
569
567
  const { x402Manager: r, walletManager: c } = H(), { publicKey: f, signTransaction: i } = J(), [R, S] = B({
570
568
  status: "idle",
571
569
  error: null,
@@ -709,50 +707,49 @@ function Ue() {
709
707
  };
710
708
  }
711
709
  export {
712
- Ve as CEDROS_EVENTS,
713
- br as CEDROS_PAY_GROUPS,
714
- Sr as CEDROS_PAY_SECTIONS,
715
- wr as CEDROS_PAY_SECTION_IDS,
716
- Nt as CIRCUIT_BREAKER_PRESETS,
717
- He as CSP_PRESETS,
718
- Je as CedrosPay,
719
- xr as CedrosPayAdminDashboard,
720
- Ot as CedrosProvider,
721
- Gt as CircuitBreakerOpenError,
722
- zt as CircuitState,
723
- qt as ComplianceGatePage,
724
- Mt as CreditsBalance,
725
- Xe as CreditsButton,
726
- Ze as CreditsSubscribeButton,
727
- cr as CryptoButton,
728
- $e as CryptoSubscribeButton,
729
- Kt as ERROR_CATEGORIES,
730
- Qt as FEATURE_FLAG_NAMES,
731
- $t as FEATURE_FLAG_REGISTRY,
732
- mr as KNOWN_STABLECOINS,
733
- nr as LogLevel,
734
- sr as Logger,
735
- et as PaymentMethodBadge,
736
- tt as PaymentModal,
737
- rt as ProductPrice,
738
- at as PurchaseButton,
739
- Ut as RATE_LIMITER_PRESETS,
740
- jt as RETRY_PRESETS,
741
- nt as RPC_PROVIDERS,
742
- st as SECURITY_RECOMMENDATIONS,
743
- ot as StripeButton,
744
- it as SubscribeButton,
745
- ct as SubscriptionManagementPanel,
746
- dr as WalletPool,
747
- lt as calculateDiscountPercentage,
748
- Cr as cedrosPayPlugin,
749
- Yt as createCircuitBreaker,
750
- or as createLogger,
751
- Vt as createRateLimiter,
752
- ut as createTranslator,
753
- pr as createWalletPool,
754
- dt as detectLocale,
755
- Lt as ecommerce,
710
+ Ye as CEDROS_EVENTS,
711
+ gr as CEDROS_PAY_GROUPS,
712
+ br as CEDROS_PAY_SECTIONS,
713
+ Sr as CEDROS_PAY_SECTION_IDS,
714
+ Dt as CIRCUIT_BREAKER_PRESETS,
715
+ Ve as CSP_PRESETS,
716
+ He as CedrosPay,
717
+ Nt as CedrosProvider,
718
+ Ot as CircuitBreakerOpenError,
719
+ Gt as CircuitState,
720
+ Wt as ComplianceGatePage,
721
+ qt as CreditsBalance,
722
+ Je as CreditsButton,
723
+ Xe as CreditsSubscribeButton,
724
+ ir as CryptoButton,
725
+ Qe as CryptoSubscribeButton,
726
+ zt as ERROR_CATEGORIES,
727
+ Kt as FEATURE_FLAG_NAMES,
728
+ Qt as FEATURE_FLAG_REGISTRY,
729
+ fr as KNOWN_STABLECOINS,
730
+ ar as LogLevel,
731
+ nr as Logger,
732
+ Ze as PaymentMethodBadge,
733
+ et as PaymentModal,
734
+ tt as ProductPrice,
735
+ rt as PurchaseButton,
736
+ $t as RATE_LIMITER_PRESETS,
737
+ Ut as RETRY_PRESETS,
738
+ at as RPC_PROVIDERS,
739
+ nt as SECURITY_RECOMMENDATIONS,
740
+ st as StripeButton,
741
+ ot as SubscribeButton,
742
+ it as SubscriptionManagementPanel,
743
+ ur as WalletPool,
744
+ ct as calculateDiscountPercentage,
745
+ wr as cedrosPayPlugin,
746
+ jt as createCircuitBreaker,
747
+ sr as createLogger,
748
+ Yt as createRateLimiter,
749
+ lt as createTranslator,
750
+ dr as createWalletPool,
751
+ ut as detectLocale,
752
+ Mt as ecommerce,
756
753
  fe as emitPaymentError,
757
754
  me as emitPaymentProcessing,
758
755
  Ie as emitPaymentStart,
@@ -760,41 +757,41 @@ export {
760
757
  ye as emitWalletConnect,
761
758
  Be as emitWalletConnected,
762
759
  V as emitWalletError,
763
- pt as formatCSP,
764
- ft as formatCouponCodes,
765
- mt as generateCSP,
766
- yt as generateCSPDirectives,
767
- gt as getAvailableLocales,
768
- Ht as getFeatureFlagDefinition,
769
- Jt as getFeatureFlagDefinitions,
770
- bt as getLocalizedError,
760
+ dt as formatCSP,
761
+ pt as formatCouponCodes,
762
+ ft as generateCSP,
763
+ mt as generateCSPDirectives,
764
+ yt as getAvailableLocales,
765
+ Vt as getFeatureFlagDefinition,
766
+ Ht as getFeatureFlagDefinitions,
767
+ gt as getLocalizedError,
771
768
  y as getLogger,
772
- St as getUserErrorMessage,
773
- Xt as isFeatureEnabled,
774
- wt as isRetryableError,
775
- Ct as loadLocale,
776
- ht as logSecurityReport,
777
- xt as parseCouponCodes,
778
- Zt as parseFeatureFlagBoolean,
779
- er as resolveFeatureFlags,
780
- tr as retryWithBackoff,
781
- Et as stackCheckoutCoupons,
769
+ bt as getUserErrorMessage,
770
+ Jt as isFeatureEnabled,
771
+ St as isRetryableError,
772
+ wt as loadLocale,
773
+ Ct as logSecurityReport,
774
+ ht as parseCouponCodes,
775
+ Xt as parseFeatureFlagBoolean,
776
+ Zt as resolveFeatureFlags,
777
+ er as retryWithBackoff,
778
+ xt as stackCheckoutCoupons,
782
779
  H as useCedrosContext,
783
- Me as useCedrosTheme,
784
- At as useComplianceCheck,
780
+ qe as useCedrosTheme,
781
+ Lt as useComplianceCheck,
785
782
  Ft as useCreditsBalance,
786
- Pt as useCreditsPayment,
787
- Rt as useCreditsSubscription,
783
+ Et as useCreditsPayment,
784
+ Pt as useCreditsSubscription,
788
785
  Le as useCryptoSubscription,
789
- Tt as useLocalizedError,
790
- kt as usePaymentMode,
791
- Ue as useRefundVerification,
792
- vt as useStripeCheckout,
793
- Bt as useSubscription,
794
- It as useSubscriptionManagement,
786
+ Rt as useLocalizedError,
787
+ Tt as usePaymentMode,
788
+ $e as useRefundVerification,
789
+ kt as useStripeCheckout,
790
+ vt as useSubscription,
791
+ Bt as useSubscriptionManagement,
795
792
  ke as useTranslation,
796
- lr as useX402Payment,
797
- rr as validateConfig,
798
- _t as validateSecurity,
799
- yr as validateTokenMint
793
+ cr as useX402Payment,
794
+ tr as validateConfig,
795
+ It as validateSecurity,
796
+ mr as validateTokenMint
800
797
  };
@@ -2,12 +2,11 @@ import { jsx as i, jsxs as v, Fragment as kt } from "react/jsx-runtime";
2
2
  import * as m from "react";
3
3
  import A, { useState as we, useCallback as Wt, useRef as es, useEffect as St, useLayoutEffect as jf } from "react";
4
4
  import { f as $l, g as Uf } from "./fetchWithTimeout-DmMOwL0Q.mjs";
5
- import { u as Fl, n as Vf, r as Bl, k as Zf, F as Hf, d as Wf, h as qf, i as Gf, j as Yf, p as Kf } from "./CedrosContext-5Gjveoba.mjs";
6
- import { u as jl } from "./ThemeContext-l0bqcOGW.mjs";
5
+ import { u as Fl, o as Vf, l as Bl, r as jl, k as Zf, F as Hf, d as Wf, h as qf, i as Gf, j as Yf, p as Kf } from "./CedrosContext-DQc_k5PG.mjs";
7
6
  import * as xo from "react-dom";
8
7
  import Ul from "react-dom";
9
8
  import { s as Ze } from "./safeHref-DqJPLPl5.mjs";
10
- import { L as Qf } from "./styles-DGagylUj.mjs";
9
+ import { L as Qf } from "./styles-fihm6qVA.mjs";
11
10
  function Jf() {
12
11
  const { config: e } = Fl(), [t, n] = we(!1), [r, o] = we(null), [a, s] = we(null);
13
12
  return { checkCompliance: Wt(
@@ -39,7 +38,7 @@ function Jf() {
39
38
  [e.serverUrl]
40
39
  ), loading: t, result: r, error: a };
41
40
  }
42
- function CC({
41
+ function NC({
43
42
  resources: e,
44
43
  onCleared: t,
45
44
  onBlocked: n,
@@ -48,7 +47,7 @@ function CC({
48
47
  wallet: a,
49
48
  children: s
50
49
  }) {
51
- const l = jl(), { checkCompliance: c, loading: d, result: f, error: u } = Jf(), g = es(!1);
50
+ const l = Bl(), { checkCompliance: c, loading: d, result: f, error: u } = Jf(), g = es(!1);
52
51
  St(() => {
53
52
  g.current || e.length === 0 || (g.current = !0, c(e, o, a));
54
53
  }, [e, o, a, c]), St(() => {
@@ -108,13 +107,13 @@ function Xf(e) {
108
107
  a();
109
108
  }, [a]), { ...n, refresh: a };
110
109
  }
111
- function _C({
110
+ function CC({
112
111
  authToken: e,
113
112
  className: t = "",
114
113
  formatBalance: n,
115
114
  showHeld: r = !1
116
115
  }) {
117
- const o = jl(), { available: a, held: s, currency: l, loading: c, error: d, refresh: f } = Xf(e), u = o.unstyled ? t : `${o.className} cedros-theme__credits-balance ${t}`.trim();
116
+ const o = Bl(), { available: a, held: s, currency: l, loading: c, error: d, refresh: f } = Xf(e), u = o.unstyled ? t : `${o.className} cedros-theme__credits-balance ${t}`.trim();
118
117
  if (!e)
119
118
  return null;
120
119
  const g = n ? n(a, l) : `${a} ${l}`;
@@ -154,7 +153,7 @@ function em({
154
153
  children: t
155
154
  }) {
156
155
  const n = A.useMemo(
157
- () => Bl({ featureFlags: e.featureFlags }),
156
+ () => jl({ featureFlags: e.featureFlags }),
158
157
  [e.featureFlags]
159
158
  ), r = A.useMemo(() => ({ config: e, featureFlags: n }), [e, n]);
160
159
  return /* @__PURE__ */ i(ts.Provider, { value: r, children: t });
@@ -11847,7 +11846,7 @@ xu.displayName = yu;
11847
11846
  function Os(e) {
11848
11847
  return e ? "open" : "closed";
11849
11848
  }
11850
- var wu = "DialogTitleWarning", [EC, ku] = Rb(wu, {
11849
+ var wu = "DialogTitleWarning", [_C, ku] = Rb(wu, {
11851
11850
  contentName: yn,
11852
11851
  titleName: Rs,
11853
11852
  docsSlug: "dialog"
@@ -18522,7 +18521,7 @@ function gC(e) {
18522
18521
  }
18523
18522
  }), [e, t]);
18524
18523
  }
18525
- const AC = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18524
+ const EC = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18526
18525
  __proto__: null,
18527
18526
  Accordion: Qu,
18528
18527
  AccordionContent: mr,
@@ -18635,7 +18634,7 @@ const AC = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18635
18634
  parseCheckoutReturn: ds,
18636
18635
  parseFeatureFlagBoolean: Kf,
18637
18636
  readCatalogUrlState: fs,
18638
- resolveFeatureFlags: Bl,
18637
+ resolveFeatureFlags: jl,
18639
18638
  useAIRelatedProducts: Pc,
18640
18639
  useCart: _t,
18641
18640
  useCartInventory: ps,
@@ -18660,9 +18659,9 @@ const AC = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
18660
18659
  validateCommerceAdapterContract: Av
18661
18660
  }, Symbol.toStringTag, { value: "Module" }));
18662
18661
  export {
18663
- CC as C,
18664
- _C as a,
18662
+ NC as C,
18663
+ CC as a,
18665
18664
  Xf as b,
18666
- AC as i,
18665
+ EC as i,
18667
18666
  Jf as u
18668
18667
  };