@cedros/pay-react 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -338,6 +338,7 @@ go get github.com/cedros-pay/server
338
338
  - `POST /paywall/v1/quote` - x402 payment quote (resource ID in body)
339
339
  - `POST /paywall/v1/verify` - Payment verification (resource ID in X-PAYMENT header)
340
340
  - `POST /paywall/v1/stripe-session` - Create Stripe checkout (single item)
341
+ - `GET /paywall/v1/stripe-session/verify` - Verify Stripe payment session (security-critical)
341
342
  - `POST /paywall/v1/cart/checkout` - Create Stripe checkout (cart)
342
343
  - `POST /paywall/v1/cart/quote` - Get x402 quote for cart items
343
344
  - `POST /paywall/v1/gasless-transaction` - Build gasless transaction (optional)
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./CedrosContext-B3iCqN6e.js"),e=require("./styles-D3XGpsqb.js");require("@solana/wallet-adapter-wallets");exports.CedrosProvider=t.CedrosProvider;exports.KNOWN_STABLECOINS=t.KNOWN_STABLECOINS;exports.LogLevel=t.LogLevel;exports.Logger=t.Logger;exports.RATE_LIMITER_PRESETS=t.RATE_LIMITER_PRESETS;exports.createLogger=t.createLogger;exports.createRateLimiter=t.createRateLimiter;exports.getLogger=t.getLogger;exports.useCedrosContext=t.useCedrosContext;exports.useCedrosTheme=t.useCedrosTheme;exports.validateConfig=t.validateConfig;exports.validateTokenMint=t.validateTokenMint;exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CryptoButton=e.CryptoButton;exports.ERROR_CATEGORIES=e.ERROR_CATEGORIES;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.formatCouponCodes=e.formatCouponCodes;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.parseCouponCodes=e.parseCouponCodes;exports.parseStructuredErrorResponse=e.parseErrorResponse;exports.usePaymentMode=e.usePaymentMode;exports.useX402Payment=e.useX402Payment;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./CedrosContext-B3iCqN6e.js"),e=require("./styles-61pRysGe.js");require("@solana/wallet-adapter-wallets");exports.CedrosProvider=t.CedrosProvider;exports.KNOWN_STABLECOINS=t.KNOWN_STABLECOINS;exports.LogLevel=t.LogLevel;exports.Logger=t.Logger;exports.RATE_LIMITER_PRESETS=t.RATE_LIMITER_PRESETS;exports.createLogger=t.createLogger;exports.createRateLimiter=t.createRateLimiter;exports.getLogger=t.getLogger;exports.useCedrosContext=t.useCedrosContext;exports.useCedrosTheme=t.useCedrosTheme;exports.validateConfig=t.validateConfig;exports.validateTokenMint=t.validateTokenMint;exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.CryptoButton=e.CryptoButton;exports.ERROR_CATEGORIES=e.ERROR_CATEGORIES;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.formatCouponCodes=e.formatCouponCodes;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.parseCouponCodes=e.parseCouponCodes;exports.parseStructuredErrorResponse=e.parseErrorResponse;exports.usePaymentMode=e.usePaymentMode;exports.useX402Payment=e.useX402Payment;
@@ -1,5 +1,5 @@
1
1
  import { C as r, K as t, L as o, b as n, R as m, d as i, c as d, g, u as E, a as C, v as P, e as c } from "./CedrosContext-vX9uqZKp.mjs";
2
- import { C as R, m as p, E as y, b as S, P as L, a as l, d as T, i as M, g as f, e as v, h as O, f as _, l as I, k as N, p as b, j as h, c as x, n as A } from "./styles-zgmHs6Hs.mjs";
2
+ import { C as R, m as p, E as y, b as S, P as L, a as l, d as T, i as M, g as f, e as v, h as O, f as _, l as I, k as N, p as b, j as h, c as x, n as A } from "./styles-DI2LPVdQ.mjs";
3
3
  import "@solana/wallet-adapter-wallets";
4
4
  export {
5
5
  R as CEDROS_EVENTS,
@@ -1 +1 @@
1
- {"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../src/i18n/useTranslation.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAA8C,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAGvH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,CAAC,EAAE,WAAW,CAAC;IACf,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAiD7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,GAAE,OAAc,GAAG,MAAM,CA0B1F"}
1
+ {"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../src/i18n/useTranslation.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAA8C,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAGvH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2BAA2B;IAC3B,CAAC,EAAE,WAAW,CAAC;IACf,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAgE7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,GAAE,OAAc,GAAG,MAAM,CA0B1F"}
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export type { IStripeManager } from './managers/StripeManager';
23
23
  export type { IX402Manager } from './managers/X402Manager';
24
24
  export type { IWalletManager } from './managers/WalletManager';
25
25
  export type { IRouteDiscoveryManager } from './managers/RouteDiscoveryManager';
26
- export { validateConfig, parseCouponCodes, formatCouponCodes, calculateDiscountPercentage, createRateLimiter, RATE_LIMITER_PRESETS, type RateLimiter, type RateLimiterConfig, createCircuitBreaker, CircuitState, CircuitBreakerOpenError, CIRCUIT_BREAKER_PRESETS, type CircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerStats, retryWithBackoff, RETRY_PRESETS, type RetryConfig, type RetryStats, createWalletPool, WalletPool, generateCSP, generateCSPDirectives, formatCSP, RPC_PROVIDERS, CSP_PRESETS, type CSPConfig, type CSPDirectives, type CSPFormat, } from './utils';
26
+ export { validateConfig, parseCouponCodes, formatCouponCodes, calculateDiscountPercentage, stackCheckoutCoupons, type Coupon, createRateLimiter, RATE_LIMITER_PRESETS, type RateLimiter, type RateLimiterConfig, createCircuitBreaker, CircuitState, CircuitBreakerOpenError, CIRCUIT_BREAKER_PRESETS, type CircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerStats, retryWithBackoff, RETRY_PRESETS, type RetryConfig, type RetryStats, createWalletPool, WalletPool, generateCSP, generateCSPDirectives, formatCSP, RPC_PROVIDERS, CSP_PRESETS, type CSPConfig, type CSPDirectives, type CSPFormat, } from './utils';
27
27
  export { LogLevel, Logger, getLogger, createLogger, type LoggerConfig, } from './utils/logger';
28
28
  export { CEDROS_EVENTS, emitPaymentStart, emitWalletConnect, emitWalletConnected, emitWalletError, emitPaymentProcessing, emitPaymentSuccess, emitPaymentError, type PaymentStartDetail, type WalletConnectDetail, type WalletErrorDetail, type PaymentProcessingDetail, type PaymentSuccessDetail, type PaymentErrorDetail, type WalletProvider, } from './utils';
29
29
  export { parseStructuredErrorResponse, isRetryableError, getUserErrorMessage, } from './utils';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),m=require("react"),A=require("@solana/wallet-adapter-react"),s=require("./styles-D3XGpsqb.js"),i=require("./CedrosContext-B3iCqN6e.js"),J=require("@solana/web3.js");function Z(t){switch(t){case"mainnet-beta":return"https://api.mainnet-beta.solana.com";case"devnet":return"https://api.devnet.solana.com";case"testnet":return"https://api.testnet.solana.com";default:return"https://api.mainnet-beta.solana.com"}}function ee(t){try{const r=new URL(t);return`${r.protocol}//${r.host}`}catch{return t}}function K(t={}){const{solanaCluster:r="mainnet-beta",solanaEndpoint:o,customRpcProviders:n=[],allowUnsafeScripts:a=!1,additionalScriptSrc:e=[],additionalConnectSrc:P=[],additionalFrameSrc:h=[],includeStripe:g=!0}=t,d=["'self'"];a&&d.push("'unsafe-inline'","'unsafe-eval'"),g&&d.push("https://js.stripe.com"),d.push(...e);const u=["'self'"];g&&u.push("https://api.stripe.com","https://*.stripe.com");const k=Z(r);if(u.push(k),u.push("https://*.solana.com"),o){const T=ee(o);u.includes(T)||u.push(T)}n.forEach(T=>{u.includes(T)||u.push(T)}),u.push(...P);const v=["'self'"];return g&&v.push("https://js.stripe.com","https://checkout.stripe.com"),v.push(...h),{scriptSrc:d,connectSrc:u,frameSrc:v}}function V(t,r="header"){const{scriptSrc:o,connectSrc:n,frameSrc:a}=t;switch(r){case"header":case"meta":case"nextjs":case"nginx":{const e=[];return o.length>0&&e.push(`script-src ${o.join(" ")}`),n.length>0&&e.push(`connect-src ${n.join(" ")}`),a.length>0&&e.push(`frame-src ${a.join(" ")}`),e.join("; ")}case"helmet":{const e={};return o.length>0&&(e.scriptSrc=o),n.length>0&&(e.connectSrc=n),a.length>0&&(e.frameSrc=a),e}case"directives":return{scriptSrc:o,connectSrc:n,frameSrc:a};default:throw new Error(`Unknown CSP format: ${r}`)}}function te(t={},r="header"){const o=K(t);return V(o,r)}const re={HELIUS:"https://*.helius-rpc.com",QUICKNODE:"https://*.quicknode.pro",ALCHEMY:"https://*.alchemy.com",ANKR:"https://rpc.ankr.com",TRITON:"https://*.rpcpool.com"},se={MAINNET_CUSTOM_RPC:t=>({solanaCluster:"mainnet-beta",solanaEndpoint:t,allowUnsafeScripts:!1}),MAINNET_NEXTJS:t=>({solanaCluster:"mainnet-beta",solanaEndpoint:t,allowUnsafeScripts:!0}),DEVNET:()=>({solanaCluster:"devnet",allowUnsafeScripts:!0}),CRYPTO_ONLY:t=>({solanaCluster:"mainnet-beta",solanaEndpoint:t,includeStripe:!1}),STRIPE_ONLY:()=>({solanaCluster:"mainnet-beta",includeStripe:!0,customRpcProviders:[]})},G=({resource:t,items:r,label:o,cardLabel:n,cryptoLabel:a,showCard:e=!0,showCrypto:P=!0,onPaymentAttempt:h,onPaymentSuccess:g,onPaymentError:d,onStripeSuccess:u,onCryptoSuccess:k,onStripeError:v,onCryptoError:T,customerEmail:p,successUrl:l,cancelUrl:c,metadata:E,couponCode:w,autoDetectWallets:R=!0,testPageUrl:b,hideMessages:q=!1,renderModal:N})=>{const I=i.useCedrosTheme(),[U,y]=m.useState(!1),{status:Y,processPayment:D,processCartCheckout:B}=s.useStripeCheckout(),{isCartMode:M,effectiveResource:L}=s.usePaymentMode(t,r),{t:_}=s.useTranslation(),z=o||_("ui.purchase"),Q=n||_("ui.card"),X=a||_("ui.usdc_solana"),W=m.useCallback(async()=>{if(R&&e){const{detectSolanaWallets:f}=await Promise.resolve().then(()=>require("./walletDetection-bNmV5ItZ.js"));if(!f()){const j=M?void 0:L,O=M&&r?s.getCartItemCount(r):void 0;s.emitPaymentStart("stripe",j,O),h&&h("stripe"),s.emitPaymentProcessing("stripe",j,O);let C;M&&r?C=await B(r,l,c,E,p,w):L&&(C=await D(L,l,c,E,p,w)),C&&C.success&&C.transactionId?(s.emitPaymentSuccess("stripe",C.transactionId,j,O),u?u(C.transactionId):g&&g(C.transactionId)):C&&!C.success&&C.error&&(s.emitPaymentError("stripe",C.error,j,O),v?v(C.error):d&&d(C.error));return}}y(!0)},[R,e,M,r,L,B,D,l,c,E,p,w,g,d,u,v,h]),H=m.useMemo(()=>M&&r?`purchase-cart-${r.map(f=>f.resource).join("-")}`:`purchase-${L||"unknown"}`,[M,r,L]),F=m.useMemo(()=>s.createDedupedClickHandler(H,W),[H,W]),x=Y==="loading",$={isOpen:U,onClose:()=>y(!1),resource:M?void 0:L,items:M?r:void 0,cardLabel:Q,cryptoLabel:X,showCard:e,showCrypto:P,onPaymentAttempt:h,onPaymentSuccess:f=>{y(!1),g?.(f)},onPaymentError:f=>{y(!1),d?.(f)},onStripeSuccess:f=>{y(!1),u?.(f)},onCryptoSuccess:f=>{y(!1),k?.(f)},onStripeError:f=>{y(!1),v?.(f)},onCryptoError:f=>{y(!1),T?.(f)},customerEmail:p,successUrl:l,cancelUrl:c,metadata:E,couponCode:w,testPageUrl:b,hideMessages:q};return S.jsxs("div",{className:I.unstyled?"":I.className,style:I.unstyled?{}:I.style,children:[S.jsx("button",{onClick:F,disabled:x,className:I.unstyled?"":"cedros-theme__button cedros-theme__stripe",style:{width:"100%",cursor:x?"not-allowed":"pointer",opacity:x?.6:1},type:"button",children:x?_("ui.processing"):z}),N?N($):S.jsx(s.PaymentModal,{...$})]})};function oe(t){const{resource:r,items:o,checkout:n={},display:a={},callbacks:e={},advanced:P={}}=t,{config:h,walletPool:g}=i.useCedrosContext(),d=i.useCedrosTheme(),{isCartMode:u}=s.usePaymentMode(r,o),k=m.useMemo(()=>({marginTop:"0.5rem",fontSize:"0.875rem",color:d.tokens.surfaceText,opacity:.7,textAlign:"center"}),[d.tokens.surfaceText]),v=m.useMemo(()=>P.wallets&&P.wallets.length>0?P.wallets:g.getAdapters(),[P.wallets,g]),T=m.useMemo(()=>o?s.getCartItemCount(o):0,[o]),p=m.useMemo(()=>e.onPaymentSuccess?y=>e.onPaymentSuccess({transactionId:y,method:"stripe"}):void 0,[e.onPaymentSuccess]),l=m.useMemo(()=>e.onPaymentSuccess?y=>e.onPaymentSuccess({transactionId:y,method:"crypto"}):void 0,[e.onPaymentSuccess]),c=m.useMemo(()=>e.onPaymentError?y=>e.onPaymentError({message:y,method:"stripe"}):void 0,[e.onPaymentError]),E=m.useMemo(()=>e.onPaymentError?y=>e.onPaymentError({message:y,method:"crypto"}):void 0,[e.onPaymentError]),w=h.solanaEndpoint??J.clusterApiUrl(h.solanaCluster);if(!r&&(!o||o.length===0))return i.getLogger().error('CedrosPay: Must provide either "resource" or "items" prop'),S.jsx("div",{className:a.className,style:{color:d.tokens.errorText},children:"Configuration error: No resource or items provided"});const R=a.showCard??!0,b=a.showCrypto??!0,q=a.showPurchaseButton??!1,N=a.layout??"vertical",I=a.hideMessages??!1,U=P.autoDetectWallets??!0;return S.jsx("div",{className:d.unstyled?a.className:d.className,style:d.unstyled?{}:d.style,children:S.jsx(A.ConnectionProvider,{endpoint:w,children:S.jsx(A.WalletProvider,{wallets:v,autoConnect:!1,children:S.jsx("div",{className:d.unstyled?a.className:`cedros-theme__pay ${a.className||""}`,children:S.jsxs("div",{className:d.unstyled?"":`cedros-theme__pay-content cedros-theme__pay-content--${N}`,children:[q?S.jsx(G,{resource:u?void 0:r||o?.[0]?.resource,items:u?o:void 0,label:a.purchaseLabel,cardLabel:a.cardLabel,cryptoLabel:a.cryptoLabel,showCard:R,showCrypto:b,onPaymentAttempt:e.onPaymentAttempt,onPaymentSuccess:p,onPaymentError:c,onStripeSuccess:p,onCryptoSuccess:l,onStripeError:c,onCryptoError:E,customerEmail:n.customerEmail,successUrl:n.successUrl,cancelUrl:n.cancelUrl,metadata:n.metadata,couponCode:n.couponCode,autoDetectWallets:U,testPageUrl:P.testPageUrl,hideMessages:I,renderModal:a.renderModal}):S.jsxs(S.Fragment,{children:[R&&S.jsx(s.StripeButton,{resource:u?void 0:r||o?.[0]?.resource,items:u?o:void 0,customerEmail:n.customerEmail,successUrl:n.successUrl,cancelUrl:n.cancelUrl,metadata:n.metadata,couponCode:n.couponCode,label:a.cardLabel,onAttempt:e.onPaymentAttempt,onSuccess:p,onError:c}),b&&S.jsx(s.CryptoButton,{resource:u?void 0:r||o?.[0]?.resource,items:u?o:void 0,metadata:n.metadata,couponCode:n.couponCode,label:a.cryptoLabel,onAttempt:e.onPaymentAttempt,onSuccess:l,onError:E,testPageUrl:P.testPageUrl,hideMessages:I})]}),u&&o&&o.length>1&&!I&&S.jsxs("div",{style:k,children:["Checking out ",T," items"]})]})})})})})}function ne(){const{x402Manager:t,walletManager:r}=i.useCedrosContext(),{publicKey:o,signTransaction:n}=A.useWallet(),[a,e]=m.useState({status:"idle",error:null,transactionId:null}),[P,h]=m.useState(null),[g,d]=m.useState(null),u=m.useCallback(async p=>{try{e(c=>({...c,status:"loading"}));const l=await t.requestQuote({resource:p});if(!t.validateRequirement(l))throw new Error("Invalid refund requirement received from server");return h(l),e(c=>({...c,status:"idle"})),l}catch(l){const c=i.formatError(l,"Failed to fetch refund requirement");throw e({status:"error",error:c,transactionId:null}),l}},[t]),k=m.useCallback(async(p,l)=>{if(!o||!n)throw new Error("Wallet not connected");try{e({status:"loading",error:null,transactionId:null});const c=await t.requestQuote({resource:p,couponCode:l});if(!t.validateRequirement(c))throw new Error("Invalid refund requirement received");h(c);const E=await r.buildTransaction({requirement:c,payerPublicKey:o}),w=await r.signTransaction({transaction:E,signTransaction:n}),R=r.buildPaymentPayload({requirement:c,signedTx:w,payerPublicKey:o}),b=await t.submitPayment({resource:p,payload:R,couponCode:l,metadata:void 0,resourceType:"refund"});return b.settlement&&d(b.settlement),e({status:"success",error:null,transactionId:b.transactionId||w.signature}),b}catch(c){const E=i.formatError(c,"Refund payment failed");throw e({status:"error",error:E,transactionId:null}),c}},[o,n,t,r]),v=m.useCallback(async p=>{if(!o||!n)throw new Error("Wallet not connected");try{e({status:"loading",error:null,transactionId:null});const l=await t.requestQuote({resource:p});if(!t.validateRequirement(l))throw new Error("Invalid refund requirement received");h(l);const{transaction:c}=await t.buildGaslessTransaction({resourceId:p,userWallet:o.toString(),feePayer:l.extra.feePayer}),E=r.deserializeTransaction(c),w=await r.partiallySignTransaction({transaction:E,signTransaction:n}),R=await t.submitGaslessTransaction({resource:p,partialTx:w,couponCode:void 0,metadata:void 0,resourceType:"refund",requirement:l});return R.settlement&&d(R.settlement),e({status:"success",error:null,transactionId:R.transactionId||"gasless-refund-tx"}),R}catch(l){const c=i.formatError(l,"Gasless refund payment failed");throw e({status:"error",error:c,transactionId:null}),l}},[o,n,t,r]),T=m.useCallback(()=>{e({status:"idle",error:null,transactionId:null}),h(null),d(null)},[]);return{state:a,requirement:P,settlement:g,fetchRefundQuote:u,processRefund:k,processGaslessRefund:v,reset:T}}function ae(){if(typeof window>"u")return{passed:!0,severity:"info",message:"HTTPS check skipped (SSR environment)"};const t=window.location.protocol==="https:",r=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1";return t||r?{passed:!0,severity:"info",message:"HTTPS enforced"}:{passed:!1,severity:"error",message:"Page not served over HTTPS",recommendation:"Enable HTTPS for all payment pages. Stripe.js requires HTTPS in production."}}function ce(){return typeof document>"u"?{passed:!0,severity:"info",message:"CSP check skipped (SSR environment)"}:document.querySelector('meta[http-equiv="Content-Security-Policy"]')?{passed:!0,severity:"info",message:"Content Security Policy detected"}:{passed:!1,severity:"warning",message:"No Content Security Policy detected",recommendation:"Configure CSP headers to protect against XSS and CDN compromise. Use generateCSP() helper from @cedros/pay-react."}}function ie(){return process.env.NODE_ENV==="development"||typeof window<"u"&&window.location.hostname==="localhost"?{passed:!0,severity:"info",message:"Running in development mode (some security checks relaxed)"}:{passed:!0,severity:"info",message:"Running in production mode"}}function le(){return{passed:!0,severity:"info",message:"Stripe.js loaded via @stripe/stripe-js package (CSP recommended, not SRI)",recommendation:"Ensure CSP script-src includes https://js.stripe.com"}}function ue(){return typeof window>"u"?{passed:!0,severity:"info",message:"Mixed content check skipped (SSR environment)"}:window.location.protocol==="https:"?{passed:!0,severity:"info",message:"Mixed content protection active (HTTPS page)"}:{passed:!0,severity:"info",message:"Mixed content check skipped (HTTP page)"}}function de(){const t=[ae(),ce(),ie(),le(),ue()],r=t.some(e=>e.severity==="error"&&!e.passed),o=t.some(e=>e.severity==="warning"&&!e.passed);let n,a;return r?(n="vulnerable",a="Security issues detected. Review errors and apply recommendations."):o?(n="warnings",a="Minor security warnings detected. Consider applying recommendations."):(n="secure",a="All security checks passed."),{checks:t,overallStatus:n,summary:a}}function me(t){process.env.NODE_ENV!=="production"&&(console.group("🔒 Cedros Pay Security Report"),console.log(`Status: ${t.overallStatus.toUpperCase()}`),console.log(`Summary: ${t.summary}`),console.log(""),t.checks.forEach(r=>{const o=r.passed?"✅":r.severity==="error"?"❌":"⚠️";console.log(`${o} ${r.message}`),r.recommendation&&console.log(` → ${r.recommendation}`)}),console.groupEnd())}const pe={CSP:"Use generateCSP() from @cedros/pay-react to generate Content Security Policy headers",HTTPS:"Always serve payment pages over HTTPS in production",PACKAGE_UPDATES:"Keep @stripe/stripe-js and @cedros/pay-react updated for security patches",AUDIT:"Run npm audit regularly to check for known vulnerabilities",MONITORING:"Monitor Stripe security advisories and apply updates promptly",NO_SRI:"Do NOT use SRI hashes for Stripe.js - use CSP instead"};exports.CEDROS_EVENTS=s.CEDROS_EVENTS;exports.CryptoButton=s.CryptoButton;exports.ERROR_CATEGORIES=s.ERROR_CATEGORIES;exports.PaymentMethodBadge=s.PaymentMethodBadge;exports.PaymentModal=s.PaymentModal;exports.ProductPrice=s.ProductPrice;exports.StripeButton=s.StripeButton;exports.calculateDiscountPercentage=s.calculateDiscountPercentage;exports.createTranslator=s.createTranslator;exports.detectLocale=s.detectLocale;exports.emitPaymentError=s.emitPaymentError;exports.emitPaymentProcessing=s.emitPaymentProcessing;exports.emitPaymentStart=s.emitPaymentStart;exports.emitPaymentSuccess=s.emitPaymentSuccess;exports.emitWalletConnect=s.emitWalletConnect;exports.emitWalletConnected=s.emitWalletConnected;exports.emitWalletError=s.emitWalletError;exports.formatCouponCodes=s.formatCouponCodes;exports.getAvailableLocales=s.getAvailableLocales;exports.getLocalizedError=s.getLocalizedError;exports.getUserErrorMessage=s.getUserErrorMessage;exports.isRetryableError=s.isRetryableError;exports.loadLocale=s.loadLocale;exports.parseCouponCodes=s.parseCouponCodes;exports.parseStructuredErrorResponse=s.parseErrorResponse;exports.useLocalizedError=s.useLocalizedError;exports.usePaymentMode=s.usePaymentMode;exports.useStripeCheckout=s.useStripeCheckout;exports.useTranslation=s.useTranslation;exports.useX402Payment=s.useX402Payment;exports.CIRCUIT_BREAKER_PRESETS=i.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=i.CedrosProvider;exports.CircuitBreakerOpenError=i.CircuitBreakerOpenError;exports.CircuitState=i.CircuitState;exports.LogLevel=i.LogLevel;exports.Logger=i.Logger;exports.RATE_LIMITER_PRESETS=i.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=i.RETRY_PRESETS;exports.WalletPool=i.WalletPool;exports.createCircuitBreaker=i.createCircuitBreaker;exports.createLogger=i.createLogger;exports.createRateLimiter=i.createRateLimiter;exports.createWalletPool=i.createWalletPool;exports.getLogger=i.getLogger;exports.retryWithBackoff=i.retryWithBackoff;exports.useCedrosContext=i.useCedrosContext;exports.useCedrosTheme=i.useCedrosTheme;exports.validateConfig=i.validateConfig;exports.CSP_PRESETS=se;exports.CedrosPay=oe;exports.PurchaseButton=G;exports.RPC_PROVIDERS=re;exports.SECURITY_RECOMMENDATIONS=pe;exports.formatCSP=V;exports.generateCSP=te;exports.generateCSPDirectives=K;exports.logSecurityReport=me;exports.useRefundVerification=ne;exports.validateSecurity=de;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),m=require("react"),A=require("@solana/wallet-adapter-react"),s=require("./styles-61pRysGe.js"),i=require("./CedrosContext-B3iCqN6e.js"),J=require("@solana/web3.js");function Z(t){switch(t){case"mainnet-beta":return"https://api.mainnet-beta.solana.com";case"devnet":return"https://api.devnet.solana.com";case"testnet":return"https://api.testnet.solana.com";default:return"https://api.mainnet-beta.solana.com"}}function ee(t){try{const r=new URL(t);return`${r.protocol}//${r.host}`}catch{return t}}function K(t={}){const{solanaCluster:r="mainnet-beta",solanaEndpoint:o,customRpcProviders:n=[],allowUnsafeScripts:a=!1,additionalScriptSrc:e=[],additionalConnectSrc:P=[],additionalFrameSrc:h=[],includeStripe:g=!0}=t,d=["'self'"];a&&d.push("'unsafe-inline'","'unsafe-eval'"),g&&d.push("https://js.stripe.com"),d.push(...e);const u=["'self'"];g&&u.push("https://api.stripe.com","https://*.stripe.com");const k=Z(r);if(u.push(k),u.push("https://*.solana.com"),o){const T=ee(o);u.includes(T)||u.push(T)}n.forEach(T=>{u.includes(T)||u.push(T)}),u.push(...P);const v=["'self'"];return g&&v.push("https://js.stripe.com","https://checkout.stripe.com"),v.push(...h),{scriptSrc:d,connectSrc:u,frameSrc:v}}function V(t,r="header"){const{scriptSrc:o,connectSrc:n,frameSrc:a}=t;switch(r){case"header":case"meta":case"nextjs":case"nginx":{const e=[];return o.length>0&&e.push(`script-src ${o.join(" ")}`),n.length>0&&e.push(`connect-src ${n.join(" ")}`),a.length>0&&e.push(`frame-src ${a.join(" ")}`),e.join("; ")}case"helmet":{const e={};return o.length>0&&(e.scriptSrc=o),n.length>0&&(e.connectSrc=n),a.length>0&&(e.frameSrc=a),e}case"directives":return{scriptSrc:o,connectSrc:n,frameSrc:a};default:throw new Error(`Unknown CSP format: ${r}`)}}function te(t={},r="header"){const o=K(t);return V(o,r)}const re={HELIUS:"https://*.helius-rpc.com",QUICKNODE:"https://*.quicknode.pro",ALCHEMY:"https://*.alchemy.com",ANKR:"https://rpc.ankr.com",TRITON:"https://*.rpcpool.com"},se={MAINNET_CUSTOM_RPC:t=>({solanaCluster:"mainnet-beta",solanaEndpoint:t,allowUnsafeScripts:!1}),MAINNET_NEXTJS:t=>({solanaCluster:"mainnet-beta",solanaEndpoint:t,allowUnsafeScripts:!0}),DEVNET:()=>({solanaCluster:"devnet",allowUnsafeScripts:!0}),CRYPTO_ONLY:t=>({solanaCluster:"mainnet-beta",solanaEndpoint:t,includeStripe:!1}),STRIPE_ONLY:()=>({solanaCluster:"mainnet-beta",includeStripe:!0,customRpcProviders:[]})},G=({resource:t,items:r,label:o,cardLabel:n,cryptoLabel:a,showCard:e=!0,showCrypto:P=!0,onPaymentAttempt:h,onPaymentSuccess:g,onPaymentError:d,onStripeSuccess:u,onCryptoSuccess:k,onStripeError:v,onCryptoError:T,customerEmail:p,successUrl:l,cancelUrl:c,metadata:E,couponCode:w,autoDetectWallets:R=!0,testPageUrl:b,hideMessages:q=!1,renderModal:N})=>{const I=i.useCedrosTheme(),[U,y]=m.useState(!1),{status:Y,processPayment:D,processCartCheckout:B}=s.useStripeCheckout(),{isCartMode:M,effectiveResource:L}=s.usePaymentMode(t,r),{t:_}=s.useTranslation(),z=o||_("ui.purchase"),Q=n||_("ui.card"),X=a||_("ui.usdc_solana"),W=m.useCallback(async()=>{if(R&&e){const{detectSolanaWallets:f}=await Promise.resolve().then(()=>require("./walletDetection-bNmV5ItZ.js"));if(!f()){const j=M?void 0:L,O=M&&r?s.getCartItemCount(r):void 0;s.emitPaymentStart("stripe",j,O),h&&h("stripe"),s.emitPaymentProcessing("stripe",j,O);let C;M&&r?C=await B(r,l,c,E,p,w):L&&(C=await D(L,l,c,E,p,w)),C&&C.success&&C.transactionId?(s.emitPaymentSuccess("stripe",C.transactionId,j,O),u?u(C.transactionId):g&&g(C.transactionId)):C&&!C.success&&C.error&&(s.emitPaymentError("stripe",C.error,j,O),v?v(C.error):d&&d(C.error));return}}y(!0)},[R,e,M,r,L,B,D,l,c,E,p,w,g,d,u,v,h]),H=m.useMemo(()=>M&&r?`purchase-cart-${r.map(f=>f.resource).join("-")}`:`purchase-${L||"unknown"}`,[M,r,L]),F=m.useMemo(()=>s.createDedupedClickHandler(H,W),[H,W]),x=Y==="loading",$={isOpen:U,onClose:()=>y(!1),resource:M?void 0:L,items:M?r:void 0,cardLabel:Q,cryptoLabel:X,showCard:e,showCrypto:P,onPaymentAttempt:h,onPaymentSuccess:f=>{y(!1),g?.(f)},onPaymentError:f=>{y(!1),d?.(f)},onStripeSuccess:f=>{y(!1),u?.(f)},onCryptoSuccess:f=>{y(!1),k?.(f)},onStripeError:f=>{y(!1),v?.(f)},onCryptoError:f=>{y(!1),T?.(f)},customerEmail:p,successUrl:l,cancelUrl:c,metadata:E,couponCode:w,testPageUrl:b,hideMessages:q};return S.jsxs("div",{className:I.unstyled?"":I.className,style:I.unstyled?{}:I.style,children:[S.jsx("button",{onClick:F,disabled:x,className:I.unstyled?"":"cedros-theme__button cedros-theme__stripe",style:{width:"100%",cursor:x?"not-allowed":"pointer",opacity:x?.6:1},type:"button",children:x?_("ui.processing"):z}),N?N($):S.jsx(s.PaymentModal,{...$})]})};function oe(t){const{resource:r,items:o,checkout:n={},display:a={},callbacks:e={},advanced:P={}}=t,{config:h,walletPool:g}=i.useCedrosContext(),d=i.useCedrosTheme(),{isCartMode:u}=s.usePaymentMode(r,o),k=m.useMemo(()=>({marginTop:"0.5rem",fontSize:"0.875rem",color:d.tokens.surfaceText,opacity:.7,textAlign:"center"}),[d.tokens.surfaceText]),v=m.useMemo(()=>P.wallets&&P.wallets.length>0?P.wallets:g.getAdapters(),[P.wallets,g]),T=m.useMemo(()=>o?s.getCartItemCount(o):0,[o]),p=m.useMemo(()=>e.onPaymentSuccess?y=>e.onPaymentSuccess({transactionId:y,method:"stripe"}):void 0,[e.onPaymentSuccess]),l=m.useMemo(()=>e.onPaymentSuccess?y=>e.onPaymentSuccess({transactionId:y,method:"crypto"}):void 0,[e.onPaymentSuccess]),c=m.useMemo(()=>e.onPaymentError?y=>e.onPaymentError({message:y,method:"stripe"}):void 0,[e.onPaymentError]),E=m.useMemo(()=>e.onPaymentError?y=>e.onPaymentError({message:y,method:"crypto"}):void 0,[e.onPaymentError]),w=h.solanaEndpoint??J.clusterApiUrl(h.solanaCluster);if(!r&&(!o||o.length===0))return i.getLogger().error('CedrosPay: Must provide either "resource" or "items" prop'),S.jsx("div",{className:a.className,style:{color:d.tokens.errorText},children:"Configuration error: No resource or items provided"});const R=a.showCard??!0,b=a.showCrypto??!0,q=a.showPurchaseButton??!1,N=a.layout??"vertical",I=a.hideMessages??!1,U=P.autoDetectWallets??!0;return S.jsx("div",{className:d.unstyled?a.className:d.className,style:d.unstyled?{}:d.style,children:S.jsx(A.ConnectionProvider,{endpoint:w,children:S.jsx(A.WalletProvider,{wallets:v,autoConnect:!1,children:S.jsx("div",{className:d.unstyled?a.className:`cedros-theme__pay ${a.className||""}`,children:S.jsxs("div",{className:d.unstyled?"":`cedros-theme__pay-content cedros-theme__pay-content--${N}`,children:[q?S.jsx(G,{resource:u?void 0:r||o?.[0]?.resource,items:u?o:void 0,label:a.purchaseLabel,cardLabel:a.cardLabel,cryptoLabel:a.cryptoLabel,showCard:R,showCrypto:b,onPaymentAttempt:e.onPaymentAttempt,onPaymentSuccess:p,onPaymentError:c,onStripeSuccess:p,onCryptoSuccess:l,onStripeError:c,onCryptoError:E,customerEmail:n.customerEmail,successUrl:n.successUrl,cancelUrl:n.cancelUrl,metadata:n.metadata,couponCode:n.couponCode,autoDetectWallets:U,testPageUrl:P.testPageUrl,hideMessages:I,renderModal:a.renderModal}):S.jsxs(S.Fragment,{children:[R&&S.jsx(s.StripeButton,{resource:u?void 0:r||o?.[0]?.resource,items:u?o:void 0,customerEmail:n.customerEmail,successUrl:n.successUrl,cancelUrl:n.cancelUrl,metadata:n.metadata,couponCode:n.couponCode,label:a.cardLabel,onAttempt:e.onPaymentAttempt,onSuccess:p,onError:c}),b&&S.jsx(s.CryptoButton,{resource:u?void 0:r||o?.[0]?.resource,items:u?o:void 0,metadata:n.metadata,couponCode:n.couponCode,label:a.cryptoLabel,onAttempt:e.onPaymentAttempt,onSuccess:l,onError:E,testPageUrl:P.testPageUrl,hideMessages:I})]}),u&&o&&o.length>1&&!I&&S.jsxs("div",{style:k,children:["Checking out ",T," items"]})]})})})})})}function ne(){const{x402Manager:t,walletManager:r}=i.useCedrosContext(),{publicKey:o,signTransaction:n}=A.useWallet(),[a,e]=m.useState({status:"idle",error:null,transactionId:null}),[P,h]=m.useState(null),[g,d]=m.useState(null),u=m.useCallback(async p=>{try{e(c=>({...c,status:"loading"}));const l=await t.requestQuote({resource:p});if(!t.validateRequirement(l))throw new Error("Invalid refund requirement received from server");return h(l),e(c=>({...c,status:"idle"})),l}catch(l){const c=i.formatError(l,"Failed to fetch refund requirement");throw e({status:"error",error:c,transactionId:null}),l}},[t]),k=m.useCallback(async(p,l)=>{if(!o||!n)throw new Error("Wallet not connected");try{e({status:"loading",error:null,transactionId:null});const c=await t.requestQuote({resource:p,couponCode:l});if(!t.validateRequirement(c))throw new Error("Invalid refund requirement received");h(c);const E=await r.buildTransaction({requirement:c,payerPublicKey:o}),w=await r.signTransaction({transaction:E,signTransaction:n}),R=r.buildPaymentPayload({requirement:c,signedTx:w,payerPublicKey:o}),b=await t.submitPayment({resource:p,payload:R,couponCode:l,metadata:void 0,resourceType:"refund"});return b.settlement&&d(b.settlement),e({status:"success",error:null,transactionId:b.transactionId||w.signature}),b}catch(c){const E=i.formatError(c,"Refund payment failed");throw e({status:"error",error:E,transactionId:null}),c}},[o,n,t,r]),v=m.useCallback(async p=>{if(!o||!n)throw new Error("Wallet not connected");try{e({status:"loading",error:null,transactionId:null});const l=await t.requestQuote({resource:p});if(!t.validateRequirement(l))throw new Error("Invalid refund requirement received");h(l);const{transaction:c}=await t.buildGaslessTransaction({resourceId:p,userWallet:o.toString(),feePayer:l.extra.feePayer}),E=r.deserializeTransaction(c),w=await r.partiallySignTransaction({transaction:E,signTransaction:n}),R=await t.submitGaslessTransaction({resource:p,partialTx:w,couponCode:void 0,metadata:void 0,resourceType:"refund",requirement:l});return R.settlement&&d(R.settlement),e({status:"success",error:null,transactionId:R.transactionId||"gasless-refund-tx"}),R}catch(l){const c=i.formatError(l,"Gasless refund payment failed");throw e({status:"error",error:c,transactionId:null}),l}},[o,n,t,r]),T=m.useCallback(()=>{e({status:"idle",error:null,transactionId:null}),h(null),d(null)},[]);return{state:a,requirement:P,settlement:g,fetchRefundQuote:u,processRefund:k,processGaslessRefund:v,reset:T}}function ae(){if(typeof window>"u")return{passed:!0,severity:"info",message:"HTTPS check skipped (SSR environment)"};const t=window.location.protocol==="https:",r=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1";return t||r?{passed:!0,severity:"info",message:"HTTPS enforced"}:{passed:!1,severity:"error",message:"Page not served over HTTPS",recommendation:"Enable HTTPS for all payment pages. Stripe.js requires HTTPS in production."}}function ce(){return typeof document>"u"?{passed:!0,severity:"info",message:"CSP check skipped (SSR environment)"}:document.querySelector('meta[http-equiv="Content-Security-Policy"]')?{passed:!0,severity:"info",message:"Content Security Policy detected"}:{passed:!1,severity:"warning",message:"No Content Security Policy detected",recommendation:"Configure CSP headers to protect against XSS and CDN compromise. Use generateCSP() helper from @cedros/pay-react."}}function ie(){return process.env.NODE_ENV==="development"||typeof window<"u"&&window.location.hostname==="localhost"?{passed:!0,severity:"info",message:"Running in development mode (some security checks relaxed)"}:{passed:!0,severity:"info",message:"Running in production mode"}}function le(){return{passed:!0,severity:"info",message:"Stripe.js loaded via @stripe/stripe-js package (CSP recommended, not SRI)",recommendation:"Ensure CSP script-src includes https://js.stripe.com"}}function ue(){return typeof window>"u"?{passed:!0,severity:"info",message:"Mixed content check skipped (SSR environment)"}:window.location.protocol==="https:"?{passed:!0,severity:"info",message:"Mixed content protection active (HTTPS page)"}:{passed:!0,severity:"info",message:"Mixed content check skipped (HTTP page)"}}function de(){const t=[ae(),ce(),ie(),le(),ue()],r=t.some(e=>e.severity==="error"&&!e.passed),o=t.some(e=>e.severity==="warning"&&!e.passed);let n,a;return r?(n="vulnerable",a="Security issues detected. Review errors and apply recommendations."):o?(n="warnings",a="Minor security warnings detected. Consider applying recommendations."):(n="secure",a="All security checks passed."),{checks:t,overallStatus:n,summary:a}}function me(t){process.env.NODE_ENV!=="production"&&(console.group("🔒 Cedros Pay Security Report"),console.log(`Status: ${t.overallStatus.toUpperCase()}`),console.log(`Summary: ${t.summary}`),console.log(""),t.checks.forEach(r=>{const o=r.passed?"✅":r.severity==="error"?"❌":"⚠️";console.log(`${o} ${r.message}`),r.recommendation&&console.log(` → ${r.recommendation}`)}),console.groupEnd())}const pe={CSP:"Use generateCSP() from @cedros/pay-react to generate Content Security Policy headers",HTTPS:"Always serve payment pages over HTTPS in production",PACKAGE_UPDATES:"Keep @stripe/stripe-js and @cedros/pay-react updated for security patches",AUDIT:"Run npm audit regularly to check for known vulnerabilities",MONITORING:"Monitor Stripe security advisories and apply updates promptly",NO_SRI:"Do NOT use SRI hashes for Stripe.js - use CSP instead"};exports.CEDROS_EVENTS=s.CEDROS_EVENTS;exports.CryptoButton=s.CryptoButton;exports.ERROR_CATEGORIES=s.ERROR_CATEGORIES;exports.PaymentMethodBadge=s.PaymentMethodBadge;exports.PaymentModal=s.PaymentModal;exports.ProductPrice=s.ProductPrice;exports.StripeButton=s.StripeButton;exports.calculateDiscountPercentage=s.calculateDiscountPercentage;exports.createTranslator=s.createTranslator;exports.detectLocale=s.detectLocale;exports.emitPaymentError=s.emitPaymentError;exports.emitPaymentProcessing=s.emitPaymentProcessing;exports.emitPaymentStart=s.emitPaymentStart;exports.emitPaymentSuccess=s.emitPaymentSuccess;exports.emitWalletConnect=s.emitWalletConnect;exports.emitWalletConnected=s.emitWalletConnected;exports.emitWalletError=s.emitWalletError;exports.formatCouponCodes=s.formatCouponCodes;exports.getAvailableLocales=s.getAvailableLocales;exports.getLocalizedError=s.getLocalizedError;exports.getUserErrorMessage=s.getUserErrorMessage;exports.isRetryableError=s.isRetryableError;exports.loadLocale=s.loadLocale;exports.parseCouponCodes=s.parseCouponCodes;exports.parseStructuredErrorResponse=s.parseErrorResponse;exports.stackCheckoutCoupons=s.stackCheckoutCoupons;exports.useLocalizedError=s.useLocalizedError;exports.usePaymentMode=s.usePaymentMode;exports.useStripeCheckout=s.useStripeCheckout;exports.useTranslation=s.useTranslation;exports.useX402Payment=s.useX402Payment;exports.CIRCUIT_BREAKER_PRESETS=i.CIRCUIT_BREAKER_PRESETS;exports.CedrosProvider=i.CedrosProvider;exports.CircuitBreakerOpenError=i.CircuitBreakerOpenError;exports.CircuitState=i.CircuitState;exports.LogLevel=i.LogLevel;exports.Logger=i.Logger;exports.RATE_LIMITER_PRESETS=i.RATE_LIMITER_PRESETS;exports.RETRY_PRESETS=i.RETRY_PRESETS;exports.WalletPool=i.WalletPool;exports.createCircuitBreaker=i.createCircuitBreaker;exports.createLogger=i.createLogger;exports.createRateLimiter=i.createRateLimiter;exports.createWalletPool=i.createWalletPool;exports.getLogger=i.getLogger;exports.retryWithBackoff=i.retryWithBackoff;exports.useCedrosContext=i.useCedrosContext;exports.useCedrosTheme=i.useCedrosTheme;exports.validateConfig=i.validateConfig;exports.CSP_PRESETS=se;exports.CedrosPay=oe;exports.PurchaseButton=G;exports.RPC_PROVIDERS=re;exports.SECURITY_RECOMMENDATIONS=pe;exports.formatCSP=V;exports.generateCSP=te;exports.generateCSPDirectives=K;exports.logSecurityReport=me;exports.useRefundVerification=ne;exports.validateSecurity=de;
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsxs as q, jsx as E, Fragment as te } from "react/jsx-runtime";
2
- import M, { useState as O, useCallback as N, useMemo as G } from "react";
2
+ import M, { useState as O, useCallback as k, useMemo as G } from "react";
3
3
  import { ConnectionProvider as se, WalletProvider as re, useWallet as oe } from "@solana/wallet-adapter-react";
4
- import { u as ne, c as V, o as ae, q as Y, e as ce, g as ie, h as le, i as ue, r as de, P as pe, S as me, m as fe } from "./styles-zgmHs6Hs.mjs";
5
- import { C as Be, E as Ke, b as Ge, a as Ve, d as Ye, z as ze, w as Qe, s as Fe, t as Xe, v as Je, f as Ze, y as et, A as tt, l as st, k as rt, x as ot, p as nt, j as at, B as ct, n as it } from "./styles-zgmHs6Hs.mjs";
4
+ import { u as ne, c as V, o as ae, q as Y, e as ce, g as ie, h as le, i as ue, r as de, P as pe, S as me, m as fe } from "./styles-DI2LPVdQ.mjs";
5
+ import { C as Be, E as Ke, b as Ge, a as Ve, d as Ye, A as ze, x as Qe, t as Fe, v as Xe, w as Je, f as Ze, z as et, B as tt, l as st, k as rt, y as ot, p as nt, j as at, s as ct, D as it, n as lt } from "./styles-DI2LPVdQ.mjs";
6
6
  import { a as z, u as Q, g as he, f as j } from "./CedrosContext-vX9uqZKp.mjs";
7
- import { k as ut, C as dt, j as pt, i as mt, L as ft, b as ht, R as yt, l as St, W as gt, h as Ct, d as Pt, c as vt, m as Et, r as wt, v as Tt } from "./CedrosContext-vX9uqZKp.mjs";
7
+ import { k as dt, C as pt, j as mt, i as ft, L as ht, b as yt, R as St, l as gt, W as Ct, h as Pt, d as vt, c as Et, m as wt, r as Tt, v as Rt } from "./CedrosContext-vX9uqZKp.mjs";
8
8
  import { clusterApiUrl as ye } from "@solana/web3.js";
9
9
  function Se(t) {
10
10
  switch (t) {
@@ -149,9 +149,9 @@ const Ue = {
149
149
  autoDetectWallets: C = !0,
150
150
  testPageUrl: w,
151
151
  hideMessages: A = !1,
152
- renderModal: k
152
+ renderModal: N
153
153
  }) => {
154
- const T = z(), [D, d] = O(!1), { status: F, processPayment: H, processCartCheckout: W } = ne(), { isCartMode: R, effectiveResource: I } = V(t, s), { t: L } = ae(), X = r || L("ui.purchase"), J = o || L("ui.card"), Z = n || L("ui.usdc_solana"), $ = N(async () => {
154
+ const T = z(), [D, d] = O(!1), { status: F, processPayment: H, processCartCheckout: W } = ne(), { isCartMode: R, effectiveResource: I } = V(t, s), { t: L } = ae(), X = r || L("ui.purchase"), J = o || L("ui.card"), Z = n || L("ui.usdc_solana"), $ = k(async () => {
155
155
  if (C && e) {
156
156
  const { detectSolanaWallets: p } = await import("./walletDetection-JZR3UCOa.mjs");
157
157
  if (!p()) {
@@ -232,7 +232,7 @@ const Ue = {
232
232
  children: _ ? L("ui.processing") : X
233
233
  }
234
234
  ),
235
- k ? k(K) : /* @__PURE__ */ E(pe, { ...K })
235
+ N ? N(K) : /* @__PURE__ */ E(pe, { ...K })
236
236
  ] });
237
237
  };
238
238
  function Oe(t) {
@@ -263,8 +263,8 @@ function Oe(t) {
263
263
  ), v = m.solanaEndpoint ?? ye(m.solanaCluster);
264
264
  if (!s && (!r || r.length === 0))
265
265
  return he().error('CedrosPay: Must provide either "resource" or "items" prop'), /* @__PURE__ */ E("div", { className: n.className, style: { color: l.tokens.errorText }, children: "Configuration error: No resource or items provided" });
266
- const C = n.showCard ?? !0, w = n.showCrypto ?? !0, A = n.showPurchaseButton ?? !1, k = n.layout ?? "vertical", T = n.hideMessages ?? !1, D = h.autoDetectWallets ?? !0;
267
- return /* @__PURE__ */ E("div", { className: l.unstyled ? n.className : l.className, style: l.unstyled ? {} : l.style, children: /* @__PURE__ */ E(se, { endpoint: v, children: /* @__PURE__ */ E(re, { wallets: g, autoConnect: !1, children: /* @__PURE__ */ E("div", { className: l.unstyled ? n.className : `cedros-theme__pay ${n.className || ""}`, children: /* @__PURE__ */ q("div", { className: l.unstyled ? "" : `cedros-theme__pay-content cedros-theme__pay-content--${k}`, children: [
266
+ const C = n.showCard ?? !0, w = n.showCrypto ?? !0, A = n.showPurchaseButton ?? !1, N = n.layout ?? "vertical", T = n.hideMessages ?? !1, D = h.autoDetectWallets ?? !0;
267
+ return /* @__PURE__ */ E("div", { className: l.unstyled ? n.className : l.className, style: l.unstyled ? {} : l.style, children: /* @__PURE__ */ E(se, { endpoint: v, children: /* @__PURE__ */ E(re, { wallets: g, autoConnect: !1, children: /* @__PURE__ */ E("div", { className: l.unstyled ? n.className : `cedros-theme__pay ${n.className || ""}`, children: /* @__PURE__ */ q("div", { className: l.unstyled ? "" : `cedros-theme__pay-content cedros-theme__pay-content--${N}`, children: [
268
268
  A ? /* @__PURE__ */ E(
269
269
  ve,
270
270
  {
@@ -337,7 +337,7 @@ function Ae() {
337
337
  status: "idle",
338
338
  error: null,
339
339
  transactionId: null
340
- }), [h, m] = O(null), [y, l] = O(null), i = N(
340
+ }), [h, m] = O(null), [y, l] = O(null), i = k(
341
341
  async (u) => {
342
342
  try {
343
343
  e((a) => ({ ...a, status: "loading" }));
@@ -355,7 +355,7 @@ function Ae() {
355
355
  }
356
356
  },
357
357
  [t]
358
- ), b = N(
358
+ ), b = k(
359
359
  async (u, c) => {
360
360
  if (!r || !o)
361
361
  throw new Error("Wallet not connected");
@@ -402,7 +402,7 @@ function Ae() {
402
402
  }
403
403
  },
404
404
  [r, o, t, s]
405
- ), g = N(
405
+ ), g = k(
406
406
  async (u) => {
407
407
  if (!r || !o)
408
408
  throw new Error("Wallet not connected");
@@ -448,7 +448,7 @@ function Ae() {
448
448
  }
449
449
  },
450
450
  [r, o, t, s]
451
- ), P = N(() => {
451
+ ), P = k(() => {
452
452
  e({
453
453
  status: "idle",
454
454
  error: null,
@@ -565,32 +565,32 @@ const He = {
565
565
  };
566
566
  export {
567
567
  Be as CEDROS_EVENTS,
568
- ut as CIRCUIT_BREAKER_PRESETS,
568
+ dt as CIRCUIT_BREAKER_PRESETS,
569
569
  qe as CSP_PRESETS,
570
570
  Oe as CedrosPay,
571
- dt as CedrosProvider,
572
- pt as CircuitBreakerOpenError,
573
- mt as CircuitState,
571
+ pt as CedrosProvider,
572
+ mt as CircuitBreakerOpenError,
573
+ ft as CircuitState,
574
574
  fe as CryptoButton,
575
575
  Ke as ERROR_CATEGORIES,
576
- ft as LogLevel,
577
- ht as Logger,
576
+ ht as LogLevel,
577
+ yt as Logger,
578
578
  Ge as PaymentMethodBadge,
579
579
  pe as PaymentModal,
580
580
  Ve as ProductPrice,
581
581
  ve as PurchaseButton,
582
- yt as RATE_LIMITER_PRESETS,
583
- St as RETRY_PRESETS,
582
+ St as RATE_LIMITER_PRESETS,
583
+ gt as RETRY_PRESETS,
584
584
  Ue as RPC_PROVIDERS,
585
585
  He as SECURITY_RECOMMENDATIONS,
586
586
  me as StripeButton,
587
- gt as WalletPool,
587
+ Ct as WalletPool,
588
588
  Ye as calculateDiscountPercentage,
589
- Ct as createCircuitBreaker,
590
- Pt as createLogger,
591
- vt as createRateLimiter,
589
+ Pt as createCircuitBreaker,
590
+ vt as createLogger,
591
+ Et as createRateLimiter,
592
592
  ze as createTranslator,
593
- Et as createWalletPool,
593
+ wt as createWalletPool,
594
594
  Qe as detectLocale,
595
595
  ue as emitPaymentError,
596
596
  ie as emitPaymentProcessing,
@@ -612,15 +612,16 @@ export {
612
612
  je as logSecurityReport,
613
613
  nt as parseCouponCodes,
614
614
  at as parseStructuredErrorResponse,
615
- wt as retryWithBackoff,
615
+ Tt as retryWithBackoff,
616
+ ct as stackCheckoutCoupons,
616
617
  Q as useCedrosContext,
617
618
  z as useCedrosTheme,
618
- ct as useLocalizedError,
619
+ it as useLocalizedError,
619
620
  V as usePaymentMode,
620
621
  Ae as useRefundVerification,
621
622
  ne as useStripeCheckout,
622
623
  ae as useTranslation,
623
- it as useX402Payment,
624
- Tt as validateConfig,
624
+ lt as useX402Payment,
625
+ Rt as validateConfig,
625
626
  De as validateSecurity
626
627
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./CedrosContext-B3iCqN6e.js"),e=require("./styles-D3XGpsqb.js");require("@solana/wallet-adapter-wallets");exports.CedrosProvider=r.CedrosProvider;exports.LogLevel=r.LogLevel;exports.Logger=r.Logger;exports.RATE_LIMITER_PRESETS=r.RATE_LIMITER_PRESETS;exports.createLogger=r.createLogger;exports.createRateLimiter=r.createRateLimiter;exports.getLogger=r.getLogger;exports.useCedrosContext=r.useCedrosContext;exports.useCedrosTheme=r.useCedrosTheme;exports.validateConfig=r.validateConfig;exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.ERROR_CATEGORIES=e.ERROR_CATEGORIES;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.StripeButton=e.StripeButton;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.formatCouponCodes=e.formatCouponCodes;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.parseCouponCodes=e.parseCouponCodes;exports.parseStructuredErrorResponse=e.parseErrorResponse;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./CedrosContext-B3iCqN6e.js"),e=require("./styles-61pRysGe.js");require("@solana/wallet-adapter-wallets");exports.CedrosProvider=r.CedrosProvider;exports.LogLevel=r.LogLevel;exports.Logger=r.Logger;exports.RATE_LIMITER_PRESETS=r.RATE_LIMITER_PRESETS;exports.createLogger=r.createLogger;exports.createRateLimiter=r.createRateLimiter;exports.getLogger=r.getLogger;exports.useCedrosContext=r.useCedrosContext;exports.useCedrosTheme=r.useCedrosTheme;exports.validateConfig=r.validateConfig;exports.CEDROS_EVENTS=e.CEDROS_EVENTS;exports.ERROR_CATEGORIES=e.ERROR_CATEGORIES;exports.PaymentMethodBadge=e.PaymentMethodBadge;exports.PaymentModal=e.PaymentModal;exports.ProductPrice=e.ProductPrice;exports.StripeButton=e.StripeButton;exports.calculateDiscountPercentage=e.calculateDiscountPercentage;exports.emitPaymentError=e.emitPaymentError;exports.emitPaymentProcessing=e.emitPaymentProcessing;exports.emitPaymentStart=e.emitPaymentStart;exports.emitPaymentSuccess=e.emitPaymentSuccess;exports.formatCouponCodes=e.formatCouponCodes;exports.getUserErrorMessage=e.getUserErrorMessage;exports.isRetryableError=e.isRetryableError;exports.parseCouponCodes=e.parseCouponCodes;exports.parseStructuredErrorResponse=e.parseErrorResponse;exports.usePaymentMode=e.usePaymentMode;exports.useStripeCheckout=e.useStripeCheckout;
@@ -1,5 +1,5 @@
1
1
  import { C as r, L as t, b as o, R as i, d as m, c as g, g as n, u, a as c, v as d } from "./CedrosContext-vX9uqZKp.mjs";
2
- import { C, E as P, b as R, P as p, a as S, S as y, d as L, i as l, g as T, e as f, h as M, f as h, l as v, k as _, p as b, j as x, c as I, u as O } from "./styles-zgmHs6Hs.mjs";
2
+ import { C, E as P, b as R, P as p, a as S, S as y, d as L, i as l, g as T, e as f, h as M, f as h, l as v, k as _, p as b, j as x, c as I, u as O } from "./styles-DI2LPVdQ.mjs";
3
3
  import "@solana/wallet-adapter-wallets";
4
4
  export {
5
5
  C as CEDROS_EVENTS,
@@ -0,0 +1 @@
1
+ "use strict";const u=require("react/jsx-runtime"),i=require("react"),l=require("./CedrosContext-B3iCqN6e.js"),Ie=require("@solana/wallet-adapter-react"),Re=require("@solana/wallet-adapter-base"),Ge=require("@solana/wallet-adapter-react-ui");require("@solana/wallet-adapter-wallets");function Ve(e){return!e||!e.coupon_codes?[]:e.coupon_codes.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Xe(e,t=", "){return e.join(t)}function Ke(e,t){return e<=0?0:(e-t)/e*100}function Qe(e,t){if(!t||t.length===0)return e;let n=e,o=0;for(const r of t)if(r.discountType==="percentage"){const a=1-r.discountValue/100;n=n*a}else r.discountType==="fixed"&&(o+=r.discountValue);return n=n-o,n<0&&(n=0),Math.ceil(n*100)/100}function ke(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return 1;const n=Math.floor(t);return n>0?n:1}function Se(e){return e.map(t=>({resource:t.resource,quantity:ke(t.quantity),metadata:t.metadata}))}function Y(e){return e.reduce((t,n)=>t+ke(n.quantity),0)}function Ze(e){return!!(e&&e.length>0&&(e.length>1||e.length===1&&(e[0].quantity??1)>1))}const Je={invalid_payment_proof:{message:"Payment verification failed",action:"Please try your payment again. If this continues, contact support.",technicalHint:"Invalid payment proof format"},invalid_signature:{message:"Transaction signature is invalid",action:"Please approve the transaction in your wallet and try again.",technicalHint:"Transaction signature verification failed"},invalid_transaction:{message:"Transaction format is invalid",action:"Please try your payment again. If this continues, try updating your wallet app.",technicalHint:"Malformed transaction structure"},transaction_not_found:{message:"Transaction not found on the blockchain",action:"Your transaction may still be processing. Please wait a moment and check your wallet, or try again.",technicalHint:"Transaction signature not found on-chain"},transaction_not_confirmed:{message:"Transaction is still processing",action:"Please wait a moment for the blockchain to confirm your transaction, then try again.",technicalHint:"Transaction not yet confirmed"},transaction_failed:{message:"Transaction failed on the blockchain",action:"Check your wallet for details. You may need to adjust your transaction settings or add more SOL for fees.",technicalHint:"On-chain transaction failure"},transaction_expired:{message:"Transaction took too long to process",action:"Please try your payment again. Consider increasing transaction priority if your wallet supports it.",technicalHint:"Transaction blockhash expired"},invalid_recipient:{message:"Payment was sent to the wrong address",action:"Please try again and ensure you approve the correct transaction in your wallet.",technicalHint:"Recipient address mismatch"},invalid_sender:{message:"Payment sender wallet is invalid",action:"Please reconnect your wallet and try again.",technicalHint:"Sender address validation failed"},unauthorized_refund_issuer:{message:"You are not authorized to issue refunds",action:"Only authorized accounts can process refunds. Please contact support if you believe this is an error.",technicalHint:"Refund issuer not in authorized list"},amount_below_minimum:{message:"Payment amount is too low",action:"Please check the required amount and try again.",technicalHint:"Amount below minimum threshold"},amount_mismatch:{message:"Payment amount does not match the quote",action:"The price may have changed. Please refresh and try your payment again.",technicalHint:"Amount does not match quote"},insufficient_funds_sol:{message:"Not enough SOL for transaction fees",action:"Add at least 0.001 SOL to your wallet to cover network fees, then try again.",technicalHint:"Insufficient SOL balance for fees"},insufficient_funds_token:{message:"Insufficient balance in your wallet",action:"Add more funds to your wallet and try again.",technicalHint:"Insufficient token balance"},invalid_token_mint:{message:"Incorrect payment token",action:"Please pay with the correct token as shown in the payment details.",technicalHint:"Token mint address mismatch"},not_spl_transfer:{message:"Transaction is not a valid token transfer",action:"Please ensure you are sending the correct token type from your wallet.",technicalHint:"Transaction is not an SPL token transfer"},missing_token_account:{message:"Token account not found",action:"Your wallet may need to create a token account first. Try again or use a different wallet.",technicalHint:"Associated token account does not exist"},invalid_token_program:{message:"Invalid token program",action:"Please try your payment again. If this continues, try using a different wallet.",technicalHint:"Token program ID mismatch"},missing_memo:{message:"Payment memo is required but was not included",action:"Please try your payment again and ensure transaction details are approved in your wallet.",technicalHint:"Required memo instruction missing"},invalid_memo:{message:"Payment memo format is invalid",action:"Please try your payment again.",technicalHint:"Memo does not match expected format"},payment_already_used:{message:"This payment has already been processed",action:"Check your transaction history. If you need to make another payment, please start a new transaction.",technicalHint:"Payment signature already recorded"},signature_reused:{message:"Transaction signature has already been used",action:"Please create a new payment transaction.",technicalHint:"Duplicate signature detected"},quote_expired:{message:"Payment quote has expired",action:"Prices are updated frequently. Please refresh and try your payment again.",technicalHint:"Quote timestamp expired"},missing_field:{message:"Required information is missing",action:"Please check all required fields and try again.",technicalHint:"Required field not provided"},invalid_field:{message:"Some information is invalid",action:"Please check your input and try again.",technicalHint:"Field validation failed"},invalid_amount:{message:"Payment amount is invalid",action:"Please check the amount and try again.",technicalHint:"Amount validation failed"},invalid_wallet:{message:"Wallet address is invalid",action:"Please reconnect your wallet and try again.",technicalHint:"Wallet address validation failed"},invalid_resource:{message:"Invalid item selection",action:"Please refresh the page and try again.",technicalHint:"Resource ID validation failed"},invalid_coupon:{message:"Invalid coupon code",action:"Please check the coupon code and try again.",technicalHint:"Coupon code format invalid"},invalid_cart_item:{message:"One or more cart items are invalid",action:"Please review your cart and try again.",technicalHint:"Cart item validation failed"},empty_cart:{message:"Your cart is empty",action:"Please add items to your cart before checking out.",technicalHint:"Cart contains no items"},resource_not_found:{message:"Item not found",action:"This item may no longer be available. Please refresh and try again.",technicalHint:"Resource not found in database"},cart_not_found:{message:"Shopping cart not found",action:"Your cart may have expired. Please start a new order.",technicalHint:"Cart ID not found"},refund_not_found:{message:"Refund not found",action:"Please check your refund reference number or contact support.",technicalHint:"Refund ID not found"},product_not_found:{message:"Product not available",action:"This product may no longer be available. Please browse our current selection.",technicalHint:"Product ID not found"},coupon_not_found:{message:"Coupon code not found",action:"Please check the coupon code or remove it to continue.",technicalHint:"Coupon code not in database"},session_not_found:{message:"Payment session expired",action:"Please start a new payment.",technicalHint:"Session ID not found or expired"},cart_already_paid:{message:"This order has already been paid",action:"Check your order history. If you need to make another purchase, please start a new order.",technicalHint:"Cart marked as paid"},refund_already_processed:{message:"This refund has already been processed",action:"Check your transaction history or contact support for details.",technicalHint:"Refund already completed"},coupon_expired:{message:"Coupon has expired",action:"Please remove the coupon code or use a different code.",technicalHint:"Coupon expiration date passed"},coupon_usage_limit_reached:{message:"Coupon usage limit reached",action:"This coupon has been fully redeemed. Please try a different code.",technicalHint:"Coupon max uses exceeded"},coupon_not_applicable:{message:"Coupon cannot be applied to this purchase",action:"Please check the coupon terms or remove it to continue.",technicalHint:"Coupon conditions not met"},coupon_wrong_payment_method:{message:"Coupon not valid for this payment method",action:"Try a different payment method or remove the coupon code.",technicalHint:"Coupon restricted to specific payment methods"},stripe_error:{message:"Card payment service temporarily unavailable",action:"Please try again in a moment, or use cryptocurrency payment instead.",technicalHint:"Stripe API error"},rpc_error:{message:"Blockchain network temporarily unavailable",action:"Please try again in a moment, or use card payment instead.",technicalHint:"Solana RPC error"},network_error:{message:"Network connection issue",action:"Please check your internet connection and try again.",technicalHint:"Network request failed"},internal_error:{message:"Something went wrong on our end",action:"Please try again. If this continues, contact support.",technicalHint:"Internal server error"},database_error:{message:"Service temporarily unavailable",action:"Please try again in a moment.",technicalHint:"Database operation failed"},config_error:{message:"Service configuration error",action:"Please contact support for assistance.",technicalHint:"Server misconfiguration"}};function ee(e){return Je[e]||{message:"An unexpected error occurred",action:"Please try again or contact support if this continues.",technicalHint:`Unknown error code: ${e}`}}const Ne=new Map,se=new Map,ie=new Map,xe=200,ue=2e3;function et(e){const t=ie.get(e);return t?Date.now()<t?!0:(ie.delete(e),!1):!1}function tt(e,t=xe){const n=Date.now()+t;ie.set(e,n)}function nt(e,t=ue){const n=Ne.get(e);if(!n)return!1;const r=Date.now()-n;return r<t?(l.getLogger().debug(`[Deduplication] Duplicate request blocked: ${e} (${r}ms ago)`),!0):!1}function rt(e){Ne.set(e,Date.now())}function ot(e){return se.get(e)||null}function at(e,t){se.set(e,t);const n=()=>{se.delete(e),rt(e)};return t.then(n,n),t}async function st(e,t,n={}){const{windowMs:o=ue,throwOnDuplicate:r=!0}=n,a=ot(e);if(a)return l.getLogger().debug(`[Deduplication] Reusing in-flight request: ${e}`),a;if(nt(e,o)){if(r)throw new Error(`Duplicate request blocked: ${e}`);return l.getLogger().warn(`[Deduplication] Duplicate request blocked but not throwing: ${e}`),Promise.reject(new Error("Duplicate request"))}const f=t();return at(e,f)}function de(e,t,n={}){const{cooldownMs:o=xe,deduplicationWindowMs:r=ue}=n;return async()=>{if(et(e)){l.getLogger().debug(`[Deduplication] Button in cooldown: ${e}`);return}tt(e,o);try{await st(e,async()=>{const a=t();a instanceof Promise&&await a},{windowMs:r,throwOnDuplicate:!1})}catch(a){if(a instanceof Error&&a.message.includes("Duplicate request"))return;throw a}}}function Ee(e){return{background:"none",border:"none",fontSize:"1.5rem",cursor:"pointer",color:e,opacity:.6,padding:"0.25rem",lineHeight:1}}const H={PAYMENT_START:"cedros:payment:start",WALLET_CONNECT:"cedros:wallet:connect",WALLET_CONNECTED:"cedros:wallet:connected",WALLET_ERROR:"cedros:wallet:error",PAYMENT_PROCESSING:"cedros:payment:processing",PAYMENT_SUCCESS:"cedros:payment:success",PAYMENT_ERROR:"cedros:payment:error"};function W(e,t){if(typeof window>"u")return;const n=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!1});window.dispatchEvent(n)}function fe(e,t,n){W(H.PAYMENT_START,{timestamp:Date.now(),method:e,resource:t,itemCount:n})}function ce(e){W(H.WALLET_CONNECT,{timestamp:Date.now(),wallet:e})}function De(e,t){W(H.WALLET_CONNECTED,{timestamp:Date.now(),wallet:e,publicKey:t})}function J(e,t){W(H.WALLET_ERROR,{timestamp:Date.now(),wallet:t,error:e})}function te(e,t,n){W(H.PAYMENT_PROCESSING,{timestamp:Date.now(),method:e,resource:t,itemCount:n})}function me(e,t,n,o){W(H.PAYMENT_SUCCESS,{timestamp:Date.now(),method:e,transactionId:t,resource:n,itemCount:o})}function G(e,t,n,o){W(H.PAYMENT_ERROR,{timestamp:Date.now(),method:e,error:t,resource:n,itemCount:o})}var le=(e=>(e.INVALID_PAYMENT_PROOF="invalid_payment_proof",e.INVALID_SIGNATURE="invalid_signature",e.INVALID_TRANSACTION="invalid_transaction",e.TRANSACTION_NOT_FOUND="transaction_not_found",e.TRANSACTION_NOT_CONFIRMED="transaction_not_confirmed",e.TRANSACTION_FAILED="transaction_failed",e.TRANSACTION_EXPIRED="transaction_expired",e.INVALID_RECIPIENT="invalid_recipient",e.INVALID_SENDER="invalid_sender",e.UNAUTHORIZED_REFUND_ISSUER="unauthorized_refund_issuer",e.AMOUNT_BELOW_MINIMUM="amount_below_minimum",e.AMOUNT_MISMATCH="amount_mismatch",e.INSUFFICIENT_FUNDS_SOL="insufficient_funds_sol",e.INSUFFICIENT_FUNDS_TOKEN="insufficient_funds_token",e.INVALID_TOKEN_MINT="invalid_token_mint",e.NOT_SPL_TRANSFER="not_spl_transfer",e.MISSING_TOKEN_ACCOUNT="missing_token_account",e.INVALID_TOKEN_PROGRAM="invalid_token_program",e.MISSING_MEMO="missing_memo",e.INVALID_MEMO="invalid_memo",e.PAYMENT_ALREADY_USED="payment_already_used",e.SIGNATURE_REUSED="signature_reused",e.QUOTE_EXPIRED="quote_expired",e.MISSING_FIELD="missing_field",e.INVALID_FIELD="invalid_field",e.INVALID_AMOUNT="invalid_amount",e.INVALID_WALLET="invalid_wallet",e.INVALID_RESOURCE="invalid_resource",e.INVALID_COUPON="invalid_coupon",e.INVALID_CART_ITEM="invalid_cart_item",e.EMPTY_CART="empty_cart",e.RESOURCE_NOT_FOUND="resource_not_found",e.CART_NOT_FOUND="cart_not_found",e.REFUND_NOT_FOUND="refund_not_found",e.PRODUCT_NOT_FOUND="product_not_found",e.COUPON_NOT_FOUND="coupon_not_found",e.SESSION_NOT_FOUND="session_not_found",e.CART_ALREADY_PAID="cart_already_paid",e.REFUND_ALREADY_PROCESSED="refund_already_processed",e.COUPON_EXPIRED="coupon_expired",e.COUPON_USAGE_LIMIT_REACHED="coupon_usage_limit_reached",e.COUPON_NOT_APPLICABLE="coupon_not_applicable",e.COUPON_WRONG_PAYMENT_METHOD="coupon_wrong_payment_method",e.STRIPE_ERROR="stripe_error",e.RPC_ERROR="rpc_error",e.NETWORK_ERROR="network_error",e.INTERNAL_ERROR="internal_error",e.DATABASE_ERROR="database_error",e.CONFIG_ERROR="config_error",e))(le||{});class A extends Error{code;retryable;details;httpStatus;constructor(t,n,o=!1,r,a){super(n),this.name="PaymentError",this.code=t,this.retryable=o,this.details=r,this.httpStatus=a,Object.setPrototypeOf(this,A.prototype)}canRetry(){return this.retryable}is(t){return this.code===t}isInCategory(t){return t.includes(this.code)}getUserMessage(){const t=this.getErrorInfo();return t.action?`${t.message} ${t.action}`:t.message}getShortMessage(){return this.getErrorInfo().message}getAction(){return this.getErrorInfo().action}getErrorInfo(){return ee(this.code)}static fromErrorResponse(t,n){return new A(t.error.code,t.error.message,t.error.retryable,t.error.details,n)}static fromUnknown(t){return t instanceof A?t:t instanceof Error?new A("internal_error",t.message,!1):new A("internal_error",String(t),!1)}}const it={INSUFFICIENT_FUNDS:["insufficient_funds_sol","insufficient_funds_token"],TRANSACTION_PENDING:["transaction_not_confirmed","transaction_not_found"],VALIDATION:["missing_field","invalid_field","invalid_amount","invalid_wallet","invalid_resource","invalid_cart_item","empty_cart"],COUPON:["invalid_coupon","coupon_not_found","coupon_expired","coupon_usage_limit_reached","coupon_not_applicable","coupon_wrong_payment_method"],RETRYABLE:["transaction_not_confirmed","rpc_error","network_error","stripe_error"],NOT_FOUND:["resource_not_found","cart_not_found","refund_not_found","product_not_found","coupon_not_found","session_not_found"]};async function ct(e){const t=e.status;try{const n=await e.json();if(n.error&&typeof n.error.code=="string"){const o=n;return A.fromErrorResponse(o,t)}return new A(le.INTERNAL_ERROR,n.error||n.message||"An unknown error occurred",!1,void 0,t)}catch{return new A(le.INTERNAL_ERROR,e.statusText||"Request failed",!1,void 0,t)}}function lt(e){return e instanceof A&&e.canRetry()}function ut(e){return e instanceof A?e.getUserMessage():e instanceof Error?e.message:String(e)}function Le(){const{stripeManager:e}=l.useCedrosContext(),[t,n]=i.useState({status:"idle",error:null,transactionId:null}),o=i.useCallback(async(f,p,k,y,v,b)=>{n({status:"loading",error:null,transactionId:null});const _={resource:f,successUrl:p,cancelUrl:k,metadata:y,customerEmail:v,couponCode:b},P=await e.processPayment(_);return n({status:P.success?"success":"error",error:P.success?null:P.error||"Payment failed",transactionId:P.success&&P.transactionId||null}),P},[e]),r=i.useCallback(async(f,p,k,y,v,b)=>{n({status:"loading",error:null,transactionId:null});const _=Se(f),P=await e.processCartCheckout({items:_,successUrl:p,cancelUrl:k,metadata:y,customerEmail:v,couponCode:b});return n({status:P.success?"success":"error",error:P.success?null:P.error||"Cart checkout failed",transactionId:P.success&&P.transactionId||null}),P},[e]),a=i.useCallback(()=>{n({status:"idle",error:null,transactionId:null})},[]);return{...t,processPayment:o,processCartCheckout:r,reset:a}}function pe(e,t){const n=Ze(t),o=e||(t?.length===1?t[0].resource:"");return{isCartMode:n,effectiveResource:o}}const dt=(e,t,n)=>{const o=e[t];return o?typeof o=="function"?o():Promise.resolve(o):new Promise((r,a)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(a.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},ae=new Map;let Z=null;async function Te(e){if(ae.has(e))return ae.get(e);try{const t=await dt(Object.assign({"./translations/ar.json":()=>Promise.resolve().then(()=>require("./ar-LVoQZTFI.js")),"./translations/bn.json":()=>Promise.resolve().then(()=>require("./bn-BR5Cv1T4.js")),"./translations/de.json":()=>Promise.resolve().then(()=>require("./de-pQxy-oD1.js")),"./translations/en.json":()=>Promise.resolve().then(()=>require("./en-D-uY3ltT.js")),"./translations/es.json":()=>Promise.resolve().then(()=>require("./es-D24cg8dD.js")),"./translations/fil.json":()=>Promise.resolve().then(()=>require("./fil-BOBft9G-.js")),"./translations/fr.json":()=>Promise.resolve().then(()=>require("./fr-Ct9ub8Fa.js")),"./translations/he.json":()=>Promise.resolve().then(()=>require("./he-DtQqRKRq.js")),"./translations/id.json":()=>Promise.resolve().then(()=>require("./id-CiM2mL7C.js")),"./translations/in.json":()=>Promise.resolve().then(()=>require("./in-Bzcjmxcc.js")),"./translations/it.json":()=>Promise.resolve().then(()=>require("./it-Blb_pIJl.js")),"./translations/jp.json":()=>Promise.resolve().then(()=>require("./jp-9NHyIuwY.js")),"./translations/kr.json":()=>Promise.resolve().then(()=>require("./kr-DvzJ-0yX.js")),"./translations/ms.json":()=>Promise.resolve().then(()=>require("./ms-BOAu5pUB.js")),"./translations/nl.json":()=>Promise.resolve().then(()=>require("./nl-WHh_DfO8.js")),"./translations/pa.json":()=>Promise.resolve().then(()=>require("./pa-B7kIhZCF.js")),"./translations/pl.json":()=>Promise.resolve().then(()=>require("./pl-H0hBKdvF.js")),"./translations/pt.json":()=>Promise.resolve().then(()=>require("./pt-DwGrViQ3.js")),"./translations/ru.json":()=>Promise.resolve().then(()=>require("./ru-CB2m0UDT.js")),"./translations/ta.json":()=>Promise.resolve().then(()=>require("./ta-CAS197uN.js")),"./translations/th.json":()=>Promise.resolve().then(()=>require("./th-Cpz2cFcg.js")),"./translations/tr.json":()=>Promise.resolve().then(()=>require("./tr-hQrEFk86.js")),"./translations/uk.json":()=>Promise.resolve().then(()=>require("./uk-DrK2Sv8C.js")),"./translations/ur.json":()=>Promise.resolve().then(()=>require("./ur-D5-7mN9a.js")),"./translations/vn.json":()=>Promise.resolve().then(()=>require("./vn-B_iut9YL.js")),"./translations/zh.json":()=>Promise.resolve().then(()=>require("./zh-PR82dCHr.js"))}),`./translations/${e}.json`,3),n=t.default||t;return ae.set(e,n),n}catch{return null}}async function ft(){if(Z)return Z;const e=Object.assign({"./translations/ar.json":()=>Promise.resolve().then(()=>require("./ar-LVoQZTFI.js")),"./translations/bn.json":()=>Promise.resolve().then(()=>require("./bn-BR5Cv1T4.js")),"./translations/de.json":()=>Promise.resolve().then(()=>require("./de-pQxy-oD1.js")),"./translations/en.json":()=>Promise.resolve().then(()=>require("./en-D-uY3ltT.js")),"./translations/es.json":()=>Promise.resolve().then(()=>require("./es-D24cg8dD.js")),"./translations/fil.json":()=>Promise.resolve().then(()=>require("./fil-BOBft9G-.js")),"./translations/fr.json":()=>Promise.resolve().then(()=>require("./fr-Ct9ub8Fa.js")),"./translations/he.json":()=>Promise.resolve().then(()=>require("./he-DtQqRKRq.js")),"./translations/id.json":()=>Promise.resolve().then(()=>require("./id-CiM2mL7C.js")),"./translations/in.json":()=>Promise.resolve().then(()=>require("./in-Bzcjmxcc.js")),"./translations/it.json":()=>Promise.resolve().then(()=>require("./it-Blb_pIJl.js")),"./translations/jp.json":()=>Promise.resolve().then(()=>require("./jp-9NHyIuwY.js")),"./translations/kr.json":()=>Promise.resolve().then(()=>require("./kr-DvzJ-0yX.js")),"./translations/ms.json":()=>Promise.resolve().then(()=>require("./ms-BOAu5pUB.js")),"./translations/nl.json":()=>Promise.resolve().then(()=>require("./nl-WHh_DfO8.js")),"./translations/pa.json":()=>Promise.resolve().then(()=>require("./pa-B7kIhZCF.js")),"./translations/pl.json":()=>Promise.resolve().then(()=>require("./pl-H0hBKdvF.js")),"./translations/pt.json":()=>Promise.resolve().then(()=>require("./pt-DwGrViQ3.js")),"./translations/ru.json":()=>Promise.resolve().then(()=>require("./ru-CB2m0UDT.js")),"./translations/ta.json":()=>Promise.resolve().then(()=>require("./ta-CAS197uN.js")),"./translations/th.json":()=>Promise.resolve().then(()=>require("./th-Cpz2cFcg.js")),"./translations/tr.json":()=>Promise.resolve().then(()=>require("./tr-hQrEFk86.js")),"./translations/uk.json":()=>Promise.resolve().then(()=>require("./uk-DrK2Sv8C.js")),"./translations/ur.json":()=>Promise.resolve().then(()=>require("./ur-D5-7mN9a.js")),"./translations/vn.json":()=>Promise.resolve().then(()=>require("./vn-B_iut9YL.js")),"./translations/zh.json":()=>Promise.resolve().then(()=>require("./zh-PR82dCHr.js"))}),t=[];for(const n in e){const o=n.match(/\.\/translations\/([a-z]{2,3}(?:-[A-Z]{2})?)\.json$/);o&&t.push(o[1])}return Z=t.length>0?t:["en"],Z}function Oe(){return typeof navigator>"u"?"en":(navigator.language||navigator.userLanguage||"en").split("-")[0].toLowerCase()}async function je(e){let t=await Te(e);if(t||(t=await Te("en"),t))return t;throw new Error("Critical: No translation files found, not even en.json")}function Ae(e){return(t,n)=>{const o=t.split(".");let r=e;for(const a of o)if(r&&typeof r=="object"&&a in r)r=r[a];else return t;return typeof r!="string"?t:n?Object.entries(n).reduce((a,[f,p])=>a.replace(new RegExp(`\\{${f}\\}`,"g"),p),r):r}}function mt(e,t,n=!0){const o=t.errors[e];if(!o){const r=ee(e);return n&&r.action?`${r.message} ${r.action}`:r.message}return n&&o.action?`${o.message} ${o.action}`:o.message}function ne(e){const[t,n]=i.useState(null),[o,r]=i.useState(!0),a=i.useMemo(()=>e||Oe(),[e]);return i.useEffect(()=>{let p=!1;return(async()=>{r(!0);try{const y=await je(a);p||(n(y),r(!1))}catch(y){console.error("[CedrosPay] Failed to load translations:",y),p||r(!1)}})(),()=>{p=!0}},[a]),{t:i.useMemo(()=>t?Ae(t):p=>({"ui.purchase":"Purchase","ui.pay_with_card":"Pay with Card","ui.pay_with_crypto":"Pay with USDC","ui.pay_with_usdc":"Pay with USDC","ui.card":"Card","ui.usdc_solana":"USDC (Solana)","ui.crypto":"Crypto","ui.processing":"Processing...","ui.loading":"Loading...","ui.connect_wallet":"Connect Wallet","ui.connecting":"Connecting..."})[p]||p,[t]),locale:a,isLoading:o,translations:t}}function pt(e,t=!0){const{translations:n}=ne();if(!n){const r=ee(e);return t&&r.action?`${r.message} ${r.action}`:r.message}const o=n.errors[e];if(!o){const r=ee(e);return t&&r.action?`${r.message} ${r.action}`:r.message}return t&&o.action?`${o.message} ${o.action}`:o.message}function qe({resource:e,items:t,successUrl:n,cancelUrl:o,metadata:r,customerEmail:a,couponCode:f,label:p,disabled:k=!1,onAttempt:y,onSuccess:v,onError:b,className:_=""}){const{status:P,error:E,transactionId:q,processPayment:h,processCartCheckout:w}=Le(),c=l.useCedrosTheme(),{isCartMode:C,effectiveResource:d}=pe(e,t),{t:m,translations:S}=ne(),R=p||m("ui.pay_with_card"),N=c.unstyled?_:`${c.className} cedros-theme__stripe-button ${_}`.trim(),g=E&&typeof E!="string"?E?.code??null:null,D=E?typeof E=="string"?E:(O=>{if(!O||!S)return"";const I=S.errors[O];return I?I.action?`${I.message} ${I.action}`:I.message:""})(g):null,x=i.useCallback(async()=>{l.getLogger().debug("[StripeButton] executePayment with couponCode:",f);const O=C&&t?Y(t):void 0;if(fe("stripe",d,O),y&&y("stripe"),!C&&!d){const B="Invalid payment configuration: missing resource or items";l.getLogger().error("[StripeButton]",B),G("stripe",B,d,O),b&&b(B);return}let I;te("stripe",d,O),C&&t?(l.getLogger().debug("[StripeButton] Processing cart checkout with coupon:",f),I=await w(t,n,o,r,a,f)):d&&(l.getLogger().debug("[StripeButton] Processing single payment with coupon:",f),I=await h(d,n,o,r,a,f)),I&&I.success&&I.transactionId?(me("stripe",I.transactionId,d,O),v&&v(I.transactionId)):I&&!I.success&&I.error&&(G("stripe",I.error,d,O),b&&b(I.error))},[f,C,d,t,n,o,r,a,w,h,y,v,b]),M=i.useMemo(()=>C&&t?`stripe-cart-${t.map(O=>O.resource).join("-")}`:`stripe-${d||"unknown"}`,[C,t,d]),V=i.useMemo(()=>de(M,x),[M,x]),X=P==="loading",re=k||X;return u.jsxs("div",{className:N,style:c.unstyled?{}:c.style,children:[u.jsx("button",{onClick:V,disabled:re,className:c.unstyled?_:"cedros-theme__button cedros-theme__stripe",type:"button",children:X?m("ui.processing"):R}),D&&u.jsx("div",{className:c.unstyled?"":"cedros-theme__error",children:D}),q&&u.jsx("div",{className:c.unstyled?"":"cedros-theme__success",children:m("ui.payment_successful")})]})}function Me(){const{x402Manager:e,walletManager:t}=l.useCedrosContext(),{publicKey:n,signTransaction:o}=Ie.useWallet(),[r,a]=i.useState({status:"idle",error:null,transactionId:null}),[f,p]=i.useState(null),[k,y]=i.useState(null),v=i.useCallback(()=>{if(!n){const h="Wallet not connected";return a({status:"error",error:h,transactionId:null}),{valid:!1,error:h}}if(!o){const h="Wallet does not support signing";return a({status:"error",error:h,transactionId:null}),{valid:!1,error:h}}return{valid:!0}},[n,o]),b=i.useCallback(async h=>{try{a(c=>({...c,status:"loading"}));const w=await e.requestQuote({resource:h});if(!e.validateRequirement(w))throw new Error("Invalid requirement received from server");return p(w),a(c=>({...c,status:"idle"})),w}catch(w){const c=l.formatError(w,"Failed to fetch requirement");throw a({status:"error",error:c,transactionId:null}),w}},[e]),_=i.useCallback(async(h,w,c,C,d="regular")=>{if(!!h.extra?.feePayer){console.log("⚡ [useX402Payment] GASLESS FLOW - Backend pays fees"),console.log("🔨 [useX402Payment] Requesting backend to build gasless transaction");const{transaction:S,blockhash:R}=await e.buildGaslessTransaction({resourceId:w,userWallet:n.toString(),feePayer:h.extra.feePayer,couponCode:c});console.log("📦 [useX402Payment] Deserializing transaction from backend");const N=t.deserializeTransaction(S);console.log("✍️ [useX402Payment] Requesting wallet to partially sign (transfer authority only)");const g=await t.partiallySignTransaction({transaction:N,signTransaction:o,blockhash:R});console.log("📤 [useX402Payment] Submitting partially-signed transaction to backend");const L=await e.submitGaslessTransaction({resource:w,partialTx:g,couponCode:c,metadata:C,resourceType:d,requirement:h});return L.success&&L.settlement&&y(L.settlement),L}else{const S=await t.buildTransaction({requirement:h,payerPublicKey:n}),R=await t.signTransaction({transaction:S,signTransaction:o}),N=t.buildPaymentPayload({requirement:h,signedTx:R,payerPublicKey:n}),g=await e.submitPayment({resource:w,payload:N,couponCode:c,metadata:C,resourceType:d});return g.success&&g.settlement&&y(g.settlement),g}},[n,o,e,t]),P=i.useCallback(async(h,w,c)=>{const C=v();if(!C.valid)return{success:!1,error:C.error};a({status:"loading",error:null,transactionId:null});try{console.log("🔍 [useX402Payment] Fetching fresh quote for resource:",h);const d=await e.requestQuote({resource:h,couponCode:w});console.log("✅ [useX402Payment] Got quote:",{payTo:d.payTo,amount:d.maxAmountRequired}),p(d),console.log("⚙️ [useX402Payment] Executing payment flow with fresh requirement");const m=await _(d,h,w,c,"regular");return m.success?a({status:"success",error:null,transactionId:m.transactionId||"payment-success"}):a({status:"error",error:m.error||"Payment failed",transactionId:null}),m}catch(d){const m=l.formatError(d,"Payment failed");return a({status:"error",error:m,transactionId:null}),{success:!1,error:m}}},[v,e,_]),E=i.useCallback(async(h,w,c)=>{const C=v();if(!C.valid)return{success:!1,error:C.error};a({status:"loading",error:null,transactionId:null});try{const d=Se(h),m=await e.requestCartQuote({items:d,metadata:w,couponCode:c}),S=m.cartId,R=m.quote;if(!e.validateRequirement(R))throw new Error("Invalid cart quote received from server");p(R);const N=await _(R,S,c,w,"cart");return N.success?a({status:"success",error:null,transactionId:N.transactionId||"cart-payment-success"}):a({status:"error",error:N.error||"Cart payment failed",transactionId:null}),N}catch(d){const m=l.formatError(d,"Cart payment failed");return a({status:"error",error:m,transactionId:null}),{success:!1,error:m}}},[v,e,_]),q=i.useCallback(()=>{a({status:"idle",error:null,transactionId:null}),p(null),y(null)},[]);return{...r,requirement:f,settlement:k,fetchQuote:b,processPayment:P,processCartPayment:E,reset:q}}function He({resource:e,items:t,label:n,disabled:o=!1,onAttempt:r,onSuccess:a,onError:f,className:p="",testPageUrl:k,hideMessages:y=!1,metadata:v,couponCode:b}){const{connected:_,connecting:P,connect:E,disconnect:q,select:h,wallets:w,wallet:c,publicKey:C}=Ie.useWallet(),{status:d,error:m,transactionId:S,processPayment:R,processCartPayment:N}=Me(),g=l.useCedrosTheme(),{solanaError:L}=l.useCedrosContext(),{isCartMode:D,effectiveResource:x}=pe(e,t),{t:M,translations:V}=ne(),X=n||M("ui.pay_with_crypto"),re=m&&typeof m!="string"?m?.code??null:null,O=L&&typeof L!="string"?L?.code??null:null,I=s=>{if(!s||!V)return"";const T=V.errors[s];return T?T.action?`${T.message} ${T.action}`:T.message:""},B=m?typeof m=="string"?m:I(re):null,ge=L?typeof L=="string"?L:I(O):null,he=i.useRef(R),ye=i.useRef(N);i.useEffect(()=>{he.current=R,ye.current=N},[R,N]);const Ue=i.useMemo(()=>w.map(s=>`${s.adapter.name}-${s.readyState}`).join(","),[w]),K=i.useMemo(()=>w.filter(({readyState:s})=>s===Re.WalletReadyState.Installed||s===Re.WalletReadyState.Loadable),[Ue]);i.useEffect(()=>{if(d==="success"&&S){const s=D&&t?Y(t):void 0;me("crypto",S,x,s),a&&a(S)}},[d,S,a,D,t,x]),i.useEffect(()=>{if(d==="error"&&m){const s=D&&t?Y(t):void 0;G("crypto",m,x,s),f&&f(m)}},[d,m,f,D,t,x]);const _e=typeof window<"u"&&window.top!==window.self,[we,F]=i.useState(!1),[ve,oe]=i.useState(!1),[$,U]=i.useState(null),z=L;i.useEffect(()=>{let s=!1;return s||(async()=>{if(ve&&c&&!_&&!P){l.getLogger().debug("[CryptoButton] Wallet detected, attempting auto-connect:",c.adapter.name),oe(!1),ce(c.adapter.name);try{await E(),s||l.getLogger().debug("[CryptoButton] Auto-connect successful")}catch(j){if(!s){l.getLogger().error("[CryptoButton] Auto-connect failed:",j);const Q=j instanceof Error?j.message:"Failed to connect wallet";J(Q,c.adapter.name),U(null)}}}})(),()=>{s=!0}},[c,ve,_,P,E]),i.useEffect(()=>{if(l.getLogger().debug("[CryptoButton] Payment useEffect triggered",{connected:_,hasPendingPayment:!!$,hasPublicKey:!!C,pendingPaymentType:$?.type}),_&&$&&C&&c){De(c.adapter.name,C.toString()),l.getLogger().debug("[CryptoButton] All conditions met! Processing pending payment:",$);const s=$;U(null),F(!1);const T=s.type==="cart"&&s.items?Y(s.items):void 0;te("crypto",s.resource,T),s.type==="cart"&&s.items?(l.getLogger().debug("[CryptoButton] Auto-processing cart payment"),ye.current(s.items,s.metadata,s.couponCode)):s.type==="single"&&s.resource&&(l.getLogger().debug("[CryptoButton] Auto-processing single payment"),he.current(s.resource,s.couponCode,s.metadata))}},[_,$,C,c]);const be=i.useCallback(async()=>{l.getLogger().debug("[CryptoButton] executePaymentFlow called",{connected:_,wallet:c?.adapter.name,couponCode:b,isCartMode:D,hasItems:!!t,effectiveResource:x});const s=D&&t?Y(t):void 0;if(fe("crypto",x,s),r&&r("crypto"),z){l.getLogger().error("[CryptoButton] Solana dependencies missing:",z),G("crypto",z,x,s),f&&f(z);return}if(_e){const T=k||window.location.href;window.open(T,"_blank","noopener,noreferrer");return}if(_)te("crypto",x,s),D&&t?(l.getLogger().debug("[CryptoButton] Processing cart payment with coupon:",b),await N(t,v,b)):x&&(l.getLogger().debug("[CryptoButton] Processing single payment with coupon:",b),await R(x,b,v));else{let T=!1;if(D&&t?(l.getLogger().debug("[CryptoButton] Setting pending cart payment with coupon:",b),U({type:"cart",items:t,metadata:v,couponCode:b}),T=!0):x&&(l.getLogger().debug("[CryptoButton] Setting pending single payment with coupon:",b),U({type:"single",resource:x,metadata:v,couponCode:b}),T=!0),!T){l.getLogger().error("[CryptoButton] No valid payment to process");return}try{if(c)l.getLogger().debug("[CryptoButton] Wallet already selected, connecting:",c.adapter.name),ce(c.adapter.name),await E();else{if(l.getLogger().debug("[CryptoButton] No wallet selected, showing selector. Available wallets:",K.map(j=>j.adapter.name)),K.length===0){U(null);const j="No wallets available";throw J(j),new Error(j)}F(!0)}}catch(j){U(null);const Q=j instanceof Error?j.message:"Failed to connect wallet";l.getLogger().error("[CryptoButton] Connection error:",Q),J(Q,c?.adapter.name)}}},[_,c,b,D,t,x,_e,k,K,E,v,N,R,z,r,f]),Pe=i.useMemo(()=>D&&t?`crypto-cart-${t.map(s=>s.resource).join("-")}`:`crypto-${x||"unknown"}`,[D,t,x]),We=i.useMemo(()=>de(Pe,be,{cooldownMs:200,deduplicationWindowMs:0}),[Pe,be]),Ce=d==="loading",Be=o||Ce||P||!!z,Fe=Ce?M("ui.processing"):X,$e=i.useCallback(async()=>{try{oe(!1),_&&await q(),h(null),F(!0)}catch(s){l.getLogger().error("Failed to change wallet:",s)}},[_,q,h]),ze=i.useCallback(s=>{l.getLogger().debug("[CryptoButton] Wallet clicked:",s),F(!1),h(s),oe(!0),l.getLogger().debug("[CryptoButton] Wallet selected, useEffect will auto-connect")},[h]),Ye=i.useCallback(async()=>{try{await q(),U(null),typeof window<"u"&&window.localStorage&&window.localStorage.removeItem("walletName")}catch(s){l.getLogger().error("Failed to disconnect wallet:",s)}},[q]);return u.jsxs("div",{className:g.unstyled?p:`${g.className} cedros-theme__crypto-button ${p||""}`,style:g.unstyled?{}:g.style,children:[u.jsx("button",{onClick:We,disabled:Be,className:g.unstyled?p:"cedros-theme__button cedros-theme__crypto",type:"button",children:Fe}),we&&!y&&u.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:g.tokens.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:()=>F(!1),children:u.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:g.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 ${g.tokens.modalBorder}`},onClick:s=>s.stopPropagation(),children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[u.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:g.tokens.surfaceText},children:M("wallet.select_wallet")}),u.jsx("button",{onClick:()=>F(!1),style:Ee(g.tokens.surfaceText),"aria-label":"Close modal",type:"button",children:"×"})]}),u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:K.map(s=>u.jsxs("button",{onClick:()=>ze(s.adapter.name),style:{width:"100%",padding:"1rem",backgroundColor:g.tokens.surfaceBackground,border:`1px solid ${g.tokens.surfaceBorder}`,borderRadius:"0.5rem",cursor:"pointer",fontSize:"1rem",textAlign:"left",color:g.tokens.surfaceText,display:"flex",alignItems:"center",gap:"1rem",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=g.tokens.modalBackground,T.currentTarget.style.borderColor=g.tokens.surfaceText,T.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:T=>{T.currentTarget.style.backgroundColor=g.tokens.surfaceBackground,T.currentTarget.style.borderColor=g.tokens.surfaceBorder,T.currentTarget.style.transform="translateY(0)"},type:"button",children:[u.jsx(Ge.WalletIcon,{wallet:s,style:{width:"24px",height:"24px"}}),u.jsx("span",{style:{fontWeight:500},children:s.adapter.name})]},s.adapter.name))})]})}),_&&!y&&!we&&u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem",fontSize:"0.75rem",color:g.tokens.surfaceText,opacity:.7},children:[u.jsx("button",{onClick:$e,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:"Change Wallet"}),u.jsx("button",{onClick:Ye,style:{background:"none",border:"none",padding:0,color:"inherit",textDecoration:"none",cursor:"pointer",fontSize:"inherit"},type:"button",children:M("ui.disconnect")})]}),!y&&ge&&u.jsx("div",{className:g.unstyled?"":"cedros-theme__error",children:ge}),!y&&B&&u.jsx("div",{className:g.unstyled?"":"cedros-theme__error",children:B}),!y&&S&&u.jsx("div",{className:g.unstyled?"":"cedros-theme__success",children:M("ui.payment_successful")})]})}const gt=({isOpen:e,onClose:t,resource:n,items:o,cardLabel:r="Card",cryptoLabel:a="USDC (Solana)",showCard:f=!0,showCrypto:p=!0,onPaymentAttempt:k,onPaymentSuccess:y,onPaymentError:v,onStripeSuccess:b,onCryptoSuccess:_,onStripeError:P,onCryptoError:E,customerEmail:q,successUrl:h,cancelUrl:w,metadata:c,couponCode:C,testPageUrl:d,hideMessages:m=!1})=>{const{tokens:S}=l.useCedrosTheme();return i.useEffect(()=>{const R=N=>{N.key==="Escape"&&e&&t()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e,t]),i.useEffect(()=>{if(e){const R=window.scrollY;return document.body.style.position="fixed",document.body.style.top=`-${R}px`,document.body.style.width="100%",document.body.style.overflowY="scroll",()=>{const N=document.body.style.top?Math.abs(parseInt(document.body.style.top.replace("px",""),10)):0;document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflowY="",window.scrollTo(0,N)}}},[e]),e?u.jsx("div",{className:"cedros-modal-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:S.modalOverlay,display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem"},onClick:t,children:u.jsxs("div",{className:"cedros-modal-content",style:{backgroundColor:S.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 ${S.modalBorder}`},onClick:R=>R.stopPropagation(),children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.5rem"},children:[u.jsx("h3",{style:{margin:0,fontSize:"1.25rem",fontWeight:600,color:S.surfaceText},children:"Choose Payment Method"}),u.jsx("button",{onClick:t,style:Ee(S.surfaceText),"aria-label":"Close modal",children:"×"})]}),u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[f&&u.jsx(qe,{resource:n,items:o,label:r,onAttempt:k,onSuccess:b||y,onError:P||v,customerEmail:q,successUrl:h,cancelUrl:w,metadata:c,couponCode:C}),p&&u.jsx(He,{resource:n,items:o,label:a,onAttempt:k,onSuccess:_||y,onError:E||v,testPageUrl:d,hideMessages:m,metadata:c,couponCode:C})]})]})}):null};function ht({product:e,paymentMethod:t,showOriginalPrice:n=!1,className:o="",style:r={}}){const a=t==="stripe",f=a?e.fiatAmount:e.cryptoAmount,p=a?e.effectiveFiatAmount:e.effectiveCryptoAmount,k=a?e.fiatCurrency.toUpperCase():e.cryptoToken,y=a?e.hasStripeCoupon:e.hasCryptoCoupon,v=a?e.stripeDiscountPercent:e.cryptoDiscountPercent;return u.jsxs("div",{className:o,style:r,children:[n&&y&&u.jsxs("span",{style:{textDecoration:"line-through",opacity:.6,marginRight:"0.5rem",fontSize:"0.875em"},children:[f.toFixed(2)," ",k]}),u.jsxs("span",{style:{fontWeight:600},children:[p.toFixed(2)," ",k]}),y&&v>0&&u.jsxs("span",{style:{marginLeft:"0.5rem",padding:"0.125rem 0.375rem",backgroundColor:"#10b981",color:"white",borderRadius:"0.25rem",fontSize:"0.75em",fontWeight:600},children:[v,"% OFF"]})]})}function yt({product:e,paymentMethod:t,className:n="",style:o={}}){const r=t==="stripe",a=r?e.hasStripeCoupon:e.hasCryptoCoupon,f=r?e.stripeDiscountPercent:e.cryptoDiscountPercent,p=r?e.stripeCouponCode:e.cryptoCouponCode;if(!a||f===0)return null;const k=r?`${f}% off with card!`:`${f}% off with crypto!`;return u.jsxs("div",{className:n,style:{display:"inline-flex",alignItems:"center",padding:"0.5rem 0.75rem",backgroundColor:r?"#6366f1":"#10b981",color:"white",borderRadius:"0.375rem",fontSize:"0.875rem",fontWeight:600,...o},children:[k,p&&u.jsxs("span",{style:{marginLeft:"0.5rem",opacity:.8,fontSize:"0.75em",fontWeight:400},children:["(",p,")"]})]})}exports.CEDROS_EVENTS=H;exports.CryptoButton=He;exports.ERROR_CATEGORIES=it;exports.PaymentMethodBadge=yt;exports.PaymentModal=gt;exports.ProductPrice=ht;exports.StripeButton=qe;exports.calculateDiscountPercentage=Ke;exports.createDedupedClickHandler=de;exports.createTranslator=Ae;exports.detectLocale=Oe;exports.emitPaymentError=G;exports.emitPaymentProcessing=te;exports.emitPaymentStart=fe;exports.emitPaymentSuccess=me;exports.emitWalletConnect=ce;exports.emitWalletConnected=De;exports.emitWalletError=J;exports.formatCouponCodes=Xe;exports.getAvailableLocales=ft;exports.getCartItemCount=Y;exports.getLocalizedError=mt;exports.getUserErrorMessage=ut;exports.isRetryableError=lt;exports.loadLocale=je;exports.parseCouponCodes=Ve;exports.parseErrorResponse=ct;exports.stackCheckoutCoupons=Qe;exports.useLocalizedError=pt;exports.usePaymentMode=pe;exports.useStripeCheckout=Le;exports.useTranslation=ne;exports.useX402Payment=Me;