coinley-checkout 0.1.0 → 0.1.1

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.
@@ -1,4 +1,4 @@
1
- (function(m,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],M):(m=typeof globalThis<"u"?globalThis:m||self,M(m.CoinleyCheckout={},m.React))})(this,function(m,M){"use strict";var he={exports:{}},q={};/**
1
+ (function(m,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],M):(m=typeof globalThis<"u"?globalThis:m||self,M(m.CoinleyCheckout={},m.React))})(this,function(m,M){"use strict";var he={exports:{}},$={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var De;function et(){if(De)return q;De=1;var n=M,a=Symbol.for("react.element"),i=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,x=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function p(C,o,D){var h,I={},R=null,b=null;D!==void 0&&(R=""+D),o.key!==void 0&&(R=""+o.key),o.ref!==void 0&&(b=o.ref);for(h in o)l.call(o,h)&&!f.hasOwnProperty(h)&&(I[h]=o[h]);if(C&&C.defaultProps)for(h in o=C.defaultProps,o)I[h]===void 0&&(I[h]=o[h]);return{$$typeof:a,type:C,key:R,ref:b,props:I,_owner:x.current}}return q.Fragment=i,q.jsx=p,q.jsxs=p,q}var ee={};/**
9
+ */var De;function et(){if(De)return $;De=1;var a=M,n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,x=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function w(A,o,D){var h,C={},R=null,b=null;D!==void 0&&(R=""+D),o.key!==void 0&&(R=""+o.key),o.ref!==void 0&&(b=o.ref);for(h in o)l.call(o,h)&&!f.hasOwnProperty(h)&&(C[h]=o[h]);if(A&&A.defaultProps)for(h in o=A.defaultProps,o)C[h]===void 0&&(C[h]=o[h]);return{$$typeof:n,type:A,key:R,ref:b,props:C,_owner:x.current}}return $.Fragment=i,$.jsx=w,$.jsxs=w,$}var ee={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,19 +14,19 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ie;function tt(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&function(){var n=M,a=Symbol.for("react.element"),i=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),p=Symbol.for("react.provider"),C=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),z=Symbol.iterator,_="@@iterator";function Q(e){if(e===null||typeof e!="object")return null;var r=z&&e[z]||e[_];return typeof r=="function"?r:null}var E=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var r=arguments.length,s=new Array(r>1?r-1:0),c=1;c<r;c++)s[c-1]=arguments[c];te("error",e,s)}}function te(e,r,s){{var c=E.ReactDebugCurrentFrame,y=c.getStackAddendum();y!==""&&(r+="%s",s=s.concat([y]));var j=s.map(function(g){return String(g)});j.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,j)}}var Y=!1,V=!1,re=!1,ne=!1,U=!1,J;J=Symbol.for("react.module.reference");function B(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===f||U||e===x||e===D||e===h||ne||e===b||Y||V||re||typeof e=="object"&&e!==null&&(e.$$typeof===R||e.$$typeof===I||e.$$typeof===p||e.$$typeof===C||e.$$typeof===o||e.$$typeof===J||e.getModuleId!==void 0))}function Z(e,r,s){var c=e.displayName;if(c)return c;var y=r.displayName||r.name||"";return y!==""?s+"("+y+")":s}function F(e){return e.displayName||"Context"}function w(e){if(e==null)return null;if(typeof e.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case l:return"Fragment";case i:return"Portal";case f:return"Profiler";case x:return"StrictMode";case D:return"Suspense";case h:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C:var r=e;return F(r)+".Consumer";case p:var s=e;return F(s._context)+".Provider";case o:return Z(e,e.render,"ForwardRef");case I:var c=e.displayName||null;return c!==null?c:w(e.type)||"Memo";case R:{var y=e,j=y._payload,g=y._init;try{return w(g(j))}catch{return null}}}return null}var G=Object.assign,N=0,ce,ae,le,se,ue,u,L;function de(){}de.__reactDisabledLog=!0;function xe(){{if(N===0){ce=console.log,ae=console.info,le=console.warn,se=console.error,ue=console.group,u=console.groupCollapsed,L=console.groupEnd;var e={configurable:!0,enumerable:!0,value:de,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}}function fe(){{if(N--,N===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:G({},e,{value:ce}),info:G({},e,{value:ae}),warn:G({},e,{value:le}),error:G({},e,{value:se}),group:G({},e,{value:ue}),groupCollapsed:G({},e,{value:u}),groupEnd:G({},e,{value:L})})}N<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var we=E.ReactCurrentDispatcher,pe;function ge(e,r,s){{if(pe===void 0)try{throw Error()}catch(y){var c=y.stack.trim().match(/\n( *(at )?)/);pe=c&&c[1]||""}return`
18
- `+pe+e}}var Ne=!1,Me;{var wt=typeof WeakMap=="function"?WeakMap:Map;Me=new wt}function Ue(e,r){if(!e||Ne)return"";{var s=Me.get(e);if(s!==void 0)return s}var c;Ne=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=we.current,we.current=null,xe();try{if(r){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(A){c=A}Reflect.construct(e,[],g)}else{try{g.call()}catch(A){c=A}e.call(g.prototype)}}else{try{throw Error()}catch(A){c=A}e()}}catch(A){if(A&&c&&typeof A.stack=="string"){for(var d=A.stack.split(`
19
- `),k=c.stack.split(`
20
- `),v=d.length-1,T=k.length-1;v>=1&&T>=0&&d[v]!==k[T];)T--;for(;v>=1&&T>=0;v--,T--)if(d[v]!==k[T]){if(v!==1||T!==1)do if(v--,T--,T<0||d[v]!==k[T]){var P=`
21
- `+d[v].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&Me.set(e,P),P}while(v>=1&&T>=0);break}}}finally{Ne=!1,we.current=j,fe(),Error.prepareStackTrace=y}var K=e?e.displayName||e.name:"",$=K?ge(K):"";return typeof e=="function"&&Me.set(e,$),$}function pt(e,r,s){return Ue(e,!1)}function Nt(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ye(e,r,s){if(e==null)return"";if(typeof e=="function")return Ue(e,Nt(e));if(typeof e=="string")return ge(e);switch(e){case D:return ge("Suspense");case h:return ge("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case o:return pt(e.render);case I:return ye(e.type,r,s);case R:{var c=e,y=c._payload,j=c._init;try{return ye(j(y),r,s)}catch{}}}return""}var oe=Object.prototype.hasOwnProperty,Fe={},We=E.ReactDebugCurrentFrame;function me(e){if(e){var r=e._owner,s=ye(e.type,e._source,r?r.type:null);We.setExtraStackFrame(s)}else We.setExtraStackFrame(null)}function vt(e,r,s,c,y){{var j=Function.call.bind(oe);for(var g in e)if(j(e,g)){var d=void 0;try{if(typeof e[g]!="function"){var k=Error((c||"React class")+": "+s+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw k.name="Invariant Violation",k}d=e[g](r,g,c,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(v){d=v}d&&!(d instanceof Error)&&(me(y),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",s,g,typeof d),me(null)),d instanceof Error&&!(d.message in Fe)&&(Fe[d.message]=!0,me(y),S("Failed %s type: %s",s,d.message),me(null))}}}var bt=Array.isArray;function ve(e){return bt(e)}function St(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,s=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function Lt(e){try{return Ge(e),!1}catch{return!0}}function Ge(e){return""+e}function Qe(e){if(Lt(e))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",St(e)),Ge(e)}var ie=E.ReactCurrentOwner,Tt={key:!0,ref:!0,__self:!0,__source:!0},Ze,Be,be;be={};function Ct(e){if(oe.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Dt(e){if(oe.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function It(e,r){if(typeof e.ref=="string"&&ie.current&&r&&ie.current.stateNode!==r){var s=w(ie.current.type);be[s]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',w(ie.current.type),e.ref),be[s]=!0)}}function Et(e,r){{var s=function(){Ze||(Ze=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function kt(e,r){{var s=function(){Be||(Be=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var At=function(e,r,s,c,y,j,g){var d={$$typeof:a,type:e,key:r,ref:s,props:g,_owner:j};return d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(d,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function Ot(e,r,s,c,y){{var j,g={},d=null,k=null;s!==void 0&&(Qe(s),d=""+s),Dt(r)&&(Qe(r.key),d=""+r.key),Ct(r)&&(k=r.ref,It(r,y));for(j in r)oe.call(r,j)&&!Tt.hasOwnProperty(j)&&(g[j]=r[j]);if(e&&e.defaultProps){var v=e.defaultProps;for(j in v)g[j]===void 0&&(g[j]=v[j])}if(d||k){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&Et(g,T),k&&kt(g,T)}return At(e,d,k,y,c,ie.current,g)}}var Se=E.ReactCurrentOwner,$e=E.ReactDebugCurrentFrame;function X(e){if(e){var r=e._owner,s=ye(e.type,e._source,r?r.type:null);$e.setExtraStackFrame(s)}else $e.setExtraStackFrame(null)}var Le;Le=!1;function Te(e){return typeof e=="object"&&e!==null&&e.$$typeof===a}function He(){{if(Se.current){var e=w(Se.current.type);if(e)return`
17
+ */var Ce;function tt(){return Ce||(Ce=1,process.env.NODE_ENV!=="production"&&function(){var a=M,n=Symbol.for("react.element"),i=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),w=Symbol.for("react.provider"),A=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),z=Symbol.iterator,U="@@iterator";function W(e){if(e===null||typeof e!="object")return null;var r=z&&e[z]||e[U];return typeof r=="function"?r:null}var I=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var r=arguments.length,s=new Array(r>1?r-1:0),c=1;c<r;c++)s[c-1]=arguments[c];te("error",e,s)}}function te(e,r,s){{var c=I.ReactDebugCurrentFrame,y=c.getStackAddendum();y!==""&&(r+="%s",s=s.concat([y]));var j=s.map(function(g){return String(g)});j.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,j)}}var Y=!1,X=!1,re=!1,ae=!1,F=!1,J;J=Symbol.for("react.module.reference");function Z(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===f||F||e===x||e===D||e===h||ae||e===b||Y||X||re||typeof e=="object"&&e!==null&&(e.$$typeof===R||e.$$typeof===C||e.$$typeof===w||e.$$typeof===A||e.$$typeof===o||e.$$typeof===J||e.getModuleId!==void 0))}function B(e,r,s){var c=e.displayName;if(c)return c;var y=r.displayName||r.name||"";return y!==""?s+"("+y+")":s}function _(e){return e.displayName||"Context"}function p(e){if(e==null)return null;if(typeof e.tag=="number"&&S("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case l:return"Fragment";case i:return"Portal";case f:return"Profiler";case x:return"StrictMode";case D:return"Suspense";case h:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case A:var r=e;return _(r)+".Consumer";case w:var s=e;return _(s._context)+".Provider";case o:return B(e,e.render,"ForwardRef");case C:var c=e.displayName||null;return c!==null?c:p(e.type)||"Memo";case R:{var y=e,j=y._payload,g=y._init;try{return p(g(j))}catch{return null}}}return null}var G=Object.assign,N=0,ce,ne,le,se,ue,u,L;function de(){}de.__reactDisabledLog=!0;function xe(){{if(N===0){ce=console.log,ne=console.info,le=console.warn,se=console.error,ue=console.group,u=console.groupCollapsed,L=console.groupEnd;var e={configurable:!0,enumerable:!0,value:de,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}}function fe(){{if(N--,N===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:G({},e,{value:ce}),info:G({},e,{value:ne}),warn:G({},e,{value:le}),error:G({},e,{value:se}),group:G({},e,{value:ue}),groupCollapsed:G({},e,{value:u}),groupEnd:G({},e,{value:L})})}N<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=I.ReactCurrentDispatcher,we;function ge(e,r,s){{if(we===void 0)try{throw Error()}catch(y){var c=y.stack.trim().match(/\n( *(at )?)/);we=c&&c[1]||""}return`
18
+ `+we+e}}var Ne=!1,Me;{var wt=typeof WeakMap=="function"?WeakMap:Map;Me=new wt}function Fe(e,r){if(!e||Ne)return"";{var s=Me.get(e);if(s!==void 0)return s}var c;Ne=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var j;j=pe.current,pe.current=null,xe();try{if(r){var g=function(){throw Error()};if(Object.defineProperty(g.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(g,[])}catch(k){c=k}Reflect.construct(e,[],g)}else{try{g.call()}catch(k){c=k}e.call(g.prototype)}}else{try{throw Error()}catch(k){c=k}e()}}catch(k){if(k&&c&&typeof k.stack=="string"){for(var d=k.stack.split(`
19
+ `),E=c.stack.split(`
20
+ `),v=d.length-1,T=E.length-1;v>=1&&T>=0&&d[v]!==E[T];)T--;for(;v>=1&&T>=0;v--,T--)if(d[v]!==E[T]){if(v!==1||T!==1)do if(v--,T--,T<0||d[v]!==E[T]){var P=`
21
+ `+d[v].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),typeof e=="function"&&Me.set(e,P),P}while(v>=1&&T>=0);break}}}finally{Ne=!1,pe.current=j,fe(),Error.prepareStackTrace=y}var K=e?e.displayName||e.name:"",H=K?ge(K):"";return typeof e=="function"&&Me.set(e,H),H}function Nt(e,r,s){return Fe(e,!1)}function vt(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function ye(e,r,s){if(e==null)return"";if(typeof e=="function")return Fe(e,vt(e));if(typeof e=="string")return ge(e);switch(e){case D:return ge("Suspense");case h:return ge("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case o:return Nt(e.render);case C:return ye(e.type,r,s);case R:{var c=e,y=c._payload,j=c._init;try{return ye(j(y),r,s)}catch{}}}return""}var oe=Object.prototype.hasOwnProperty,_e={},Qe=I.ReactDebugCurrentFrame;function me(e){if(e){var r=e._owner,s=ye(e.type,e._source,r?r.type:null);Qe.setExtraStackFrame(s)}else Qe.setExtraStackFrame(null)}function bt(e,r,s,c,y){{var j=Function.call.bind(oe);for(var g in e)if(j(e,g)){var d=void 0;try{if(typeof e[g]!="function"){var E=Error((c||"React class")+": "+s+" type `"+g+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[g]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw E.name="Invariant Violation",E}d=e[g](r,g,c,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(v){d=v}d&&!(d instanceof Error)&&(me(y),S("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",s,g,typeof d),me(null)),d instanceof Error&&!(d.message in _e)&&(_e[d.message]=!0,me(y),S("Failed %s type: %s",s,d.message),me(null))}}}var St=Array.isArray;function ve(e){return St(e)}function Lt(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,s=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function Tt(e){try{return Ge(e),!1}catch{return!0}}function Ge(e){return""+e}function We(e){if(Tt(e))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Lt(e)),Ge(e)}var ie=I.ReactCurrentOwner,At={key:!0,ref:!0,__self:!0,__source:!0},Be,Ze,be;be={};function Dt(e){if(oe.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ct(e){if(oe.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function It(e,r){if(typeof e.ref=="string"&&ie.current&&r&&ie.current.stateNode!==r){var s=p(ie.current.type);be[s]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',p(ie.current.type),e.ref),be[s]=!0)}}function Et(e,r){{var s=function(){Be||(Be=!0,S("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function kt(e,r){{var s=function(){Ze||(Ze=!0,S("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var Ot=function(e,r,s,c,y,j,g){var d={$$typeof:n,type:e,key:r,ref:s,props:g,_owner:j};return d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(d,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function Pt(e,r,s,c,y){{var j,g={},d=null,E=null;s!==void 0&&(We(s),d=""+s),Ct(r)&&(We(r.key),d=""+r.key),Dt(r)&&(E=r.ref,It(r,y));for(j in r)oe.call(r,j)&&!At.hasOwnProperty(j)&&(g[j]=r[j]);if(e&&e.defaultProps){var v=e.defaultProps;for(j in v)g[j]===void 0&&(g[j]=v[j])}if(d||E){var T=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&Et(g,T),E&&kt(g,T)}return Ot(e,d,E,y,c,ie.current,g)}}var Se=I.ReactCurrentOwner,He=I.ReactDebugCurrentFrame;function q(e){if(e){var r=e._owner,s=ye(e.type,e._source,r?r.type:null);He.setExtraStackFrame(s)}else He.setExtraStackFrame(null)}var Le;Le=!1;function Te(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Ve(){{if(Se.current){var e=p(Se.current.type);if(e)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function Pt(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),s=e.lineNumber;return`
23
+ Check the render method of \``+e+"`."}return""}}function Rt(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),s=e.lineNumber;return`
24
24
 
25
- Check your code at `+r+":"+s+"."}return""}}var Ve={};function Rt(e){{var r=He();if(!r){var s=typeof e=="string"?e:e.displayName||e.name;s&&(r=`
25
+ Check your code at `+r+":"+s+"."}return""}}var Xe={};function zt(e){{var r=Ve();if(!r){var s=typeof e=="string"?e:e.displayName||e.name;s&&(r=`
26
26
 
27
- Check the top-level render call using <`+s+">.")}return r}}function Je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=Rt(r);if(Ve[s])return;Ve[s]=!0;var c="";e&&e._owner&&e._owner!==Se.current&&(c=" It was passed a child from "+w(e._owner.type)+"."),X(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,c),X(null)}}function Xe(e,r){{if(typeof e!="object")return;if(ve(e))for(var s=0;s<e.length;s++){var c=e[s];Te(c)&&Je(c,r)}else if(Te(e))e._store&&(e._store.validated=!0);else if(e){var y=Q(e);if(typeof y=="function"&&y!==e.entries)for(var j=y.call(e),g;!(g=j.next()).done;)Te(g.value)&&Je(g.value,r)}}}function zt(e){{var r=e.type;if(r==null||typeof r=="string")return;var s;if(typeof r=="function")s=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===o||r.$$typeof===I))s=r.propTypes;else return;if(s){var c=w(r);vt(s,e.props,"prop",c,e)}else if(r.PropTypes!==void 0&&!Le){Le=!0;var y=w(r);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function _t(e){{for(var r=Object.keys(e.props),s=0;s<r.length;s++){var c=r[s];if(c!=="children"&&c!=="key"){X(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),X(null);break}}e.ref!==null&&(X(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),X(null))}}var Ke={};function qe(e,r,s,c,y,j){{var g=B(e);if(!g){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var k=Pt(y);k?d+=k:d+=He();var v;e===null?v="null":ve(e)?v="array":e!==void 0&&e.$$typeof===a?(v="<"+(w(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):v=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",v,d)}var T=Ot(e,r,s,y,j);if(T==null)return T;if(g){var P=r.children;if(P!==void 0)if(c)if(ve(P)){for(var K=0;K<P.length;K++)Xe(P[K],e);Object.freeze&&Object.freeze(P)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Xe(P,e)}if(oe.call(r,"key")){var $=w(e),A=Object.keys(r).filter(function(Qt){return Qt!=="key"}),Ce=A.length>0?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[$+Ce]){var Gt=A.length>0?"{"+A.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
27
+ Check the top-level render call using <`+s+">.")}return r}}function Je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=zt(r);if(Xe[s])return;Xe[s]=!0;var c="";e&&e._owner&&e._owner!==Se.current&&(c=" It was passed a child from "+p(e._owner.type)+"."),q(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,c),q(null)}}function qe(e,r){{if(typeof e!="object")return;if(ve(e))for(var s=0;s<e.length;s++){var c=e[s];Te(c)&&Je(c,r)}else if(Te(e))e._store&&(e._store.validated=!0);else if(e){var y=W(e);if(typeof y=="function"&&y!==e.entries)for(var j=y.call(e),g;!(g=j.next()).done;)Te(g.value)&&Je(g.value,r)}}}function Ut(e){{var r=e.type;if(r==null||typeof r=="string")return;var s;if(typeof r=="function")s=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===o||r.$$typeof===C))s=r.propTypes;else return;if(s){var c=p(r);bt(s,e.props,"prop",c,e)}else if(r.PropTypes!==void 0&&!Le){Le=!0;var y=p(r);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Yt(e){{for(var r=Object.keys(e.props),s=0;s<r.length;s++){var c=r[s];if(c!=="children"&&c!=="key"){q(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),q(null);break}}e.ref!==null&&(q(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),q(null))}}var Ke={};function $e(e,r,s,c,y,j){{var g=Z(e);if(!g){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var E=Rt(y);E?d+=E:d+=Ve();var v;e===null?v="null":ve(e)?v="array":e!==void 0&&e.$$typeof===n?(v="<"+(p(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):v=typeof e,S("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",v,d)}var T=Pt(e,r,s,y,j);if(T==null)return T;if(g){var P=r.children;if(P!==void 0)if(c)if(ve(P)){for(var K=0;K<P.length;K++)qe(P[K],e);Object.freeze&&Object.freeze(P)}else S("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else qe(P,e)}if(oe.call(r,"key")){var H=p(e),k=Object.keys(r).filter(function(Bt){return Bt!=="key"}),Ae=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[H+Ae]){var Wt=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
28
28
  let props = %s;
29
29
  <%s {...props} />
30
30
  React keys must be passed directly to JSX without using spread:
31
31
  let props = %s;
32
- <%s key={someKey} {...props} />`,Ce,$,Gt,$),Ke[$+Ce]=!0}}return e===l?_t(T):zt(T),T}}function Yt(e,r,s){return qe(e,r,s,!0)}function Ut(e,r,s){return qe(e,r,s,!1)}var Ft=Ut,Wt=Yt;ee.Fragment=l,ee.jsx=Ft,ee.jsxs=Wt}()),ee}process.env.NODE_ENV==="production"?he.exports=et():he.exports=tt();var t=he.exports;const Ee=M.createContext(),rt=()=>M.useContext(Ee),nt=({initialTheme:n="light",children:a})=>{const[i,l]=M.useState(n),x=()=>{l(f=>f==="light"?"dark":"light")};return M.useEffect(()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(i)},[i]),t.jsx(Ee.Provider,{value:{theme:i,setTheme:l,toggleTheme:x},children:a})};let O={apiKey:null,apiSecret:null,apiUrl:"http://localhost:9000"};const at=n=>{O={...O,...n},console.log("API initialized with:",O)},H=()=>({"Content-Type":"application/json","x-api-key":O.apiKey,"x-api-secret":O.apiSecret}),ke=async n=>{try{console.log("Creating payment with data:",n),console.log("API URL:",`${O.apiUrl}/api/payments/create`);const a=await fetch(`${O.apiUrl}/api/payments/create`,{method:"POST",headers:H(),body:JSON.stringify(n)});if(console.log("Create payment response status:",a.status),!a.ok){const l=await a.json();throw console.error("Error creating payment:",l),new Error(l.error||`Failed to create payment: ${a.status}`)}const i=await a.json();return console.log("Create payment response data:",i),i}catch(a){throw console.error("Create payment error:",a),a}},st=async n=>{try{console.log("Getting payment:",n);const a=await fetch(`${O.apiUrl}/api/payments/${n}`,{method:"GET",headers:H()});if(!a.ok){const l=await a.json();throw console.error("Error getting payment:",l),new Error(l.error||`Failed to get payment: ${a.status}`)}const i=await a.json();return console.log("Get payment response:",i),i}catch(a){throw console.error("Get payment error:",a),a}},Ae=async n=>{try{console.log("Processing payment with data:",n),console.log("API URL:",`${O.apiUrl}/api/payments/process`);const a=await fetch(`${O.apiUrl}/api/payments/process`,{method:"POST",headers:H(),body:JSON.stringify(n)});if(console.log("Process payment response status:",a.status),!a.ok){const l=await a.json();throw console.error("Error processing payment:",l),new Error(l.error||`Failed to process payment: ${a.status}`)}const i=await a.json();return console.log("Process payment response data:",i),i}catch(a){throw console.error("Process payment error:",a),a}},ot=async(n={})=>{try{const{page:a=1,limit:i=10,status:l,currency:x,startDate:f,endDate:p,search:C}=n,o=new URLSearchParams;o.append("page",a),o.append("limit",i),l&&o.append("status",l),x&&o.append("currency",x),f&&o.append("startDate",f),p&&o.append("endDate",p),C&&o.append("search",C);const D=`${O.apiUrl}/api/payments/merchant/list?${o.toString()}`,h=await fetch(D,{method:"GET",headers:H()});if(!h.ok){const I=await h.json();throw new Error(I.error||`Failed to get payments: ${h.status}`)}return await h.json()}catch(a){throw console.error("Get merchant payments error:",a),a}},it=async()=>{try{const n=await fetch(`${O.apiUrl}/api/payments/merchant/stats`,{method:"GET",headers:H()});if(!n.ok){const a=await n.json();throw new Error(a.error||`Failed to get payment stats: ${n.status}`)}return await n.json()}catch(n){throw console.error("Get merchant payment stats error:",n),n}},ct=async()=>{try{const n=await fetch(`${O.apiUrl}/api/payments/currencies`,{method:"GET",headers:H()});if(!n.ok){const a=await n.json();throw new Error(a.error||`Failed to get currencies: ${n.status}`)}return await n.json()}catch(n){return console.error("Get supported currencies error:",n),{currencies:[{id:"USDT",name:"Tether USD",network:"ethereum"},{id:"USDC",name:"USD Coin",network:"ethereum"},{id:"BNB",name:"Binance Coin",network:"binance"},{id:"SOL",name:"Solana",network:"solana"},{id:"USDC_SOL",name:"USD Coin (Solana)",network:"solana"}]}}},Oe=M.createContext(),lt=()=>M.useContext(Oe),ut=({apiKey:n,apiSecret:a,apiUrl:i="http://localhost:9000",debug:l=!1,children:x})=>{const[f,p]=M.useState(!1),[C,o]=M.useState(null);M.useEffect(()=>{if(!n||!a){o("API key and secret are required");return}try{at({apiKey:n,apiSecret:a,apiUrl:i}),p(!0),l&&console.log("Coinley SDK initialized with:",{apiKey:n,apiUrl:i})}catch(h){o(h.message),l&&console.error("Coinley SDK initialization error:",h)}},[n,a,i,l]);const D={apiKey:n,apiSecret:a,apiUrl:i,isInitialized:f,error:C,debug:l};return t.jsx(Oe.Provider,{value:D,children:x})},dt=({onSelect:n,selected:a,theme:i="light"})=>{console.log("PaymentMethods render:",{selected:a});const l=[{id:"USDT",name:"USDT",description:"Tether USD",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZX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MS45NDItLjA0NiAxLjI2MiAwIDEuODMxLjAzOCAxLjk3MS4wNDZ2Mi44MzdoMy45MXYtMi44MzljLS4yNTQtLjAyLS45ODMtLjA0Ny0xLjk4OC0uMDQ3LTEuMzAyIDAtMS44MjQuMDM5LTEuOTI1LjA0N3YtLjA0NWM0LjUxOS0uMTMgNy45NTQtLjg0MyA3Ljk1NC0xLjgzdi0zLjJjMC0uOTg3LTMuNDM1LTEuNjk5LTcuOTU0LTEuODN6Ii8+PC9nPjwvc3ZnPg=="},{id:"USDC",name:"USDC",description:"USD Coin",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzJCNzVFRCIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMS4yMDkgOS43MzlsLTIuOTQxIDIuOTQxYTMuMTMyIDMuMTMyIDAgMDAtNC41MzYgMGwtMi45NDItMi45NDFhNy42MjMgNy42MjMgMCAwMTEwLjQxOSAwek0xMC43OTEgMjIuMjYxbDIuOTQxLTIuOTQxYTMuMTMyIDMuMTMyIDAgMDA0LjUzNiAwbDIuOTQyIDIuOTQxYTcuNjIzIDcuNjIzIDAgMDEtMTAuNDE5IDB6bTExLjU3NS00LjI2MWgtNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAtNC41MzdoNC4xNTNhNy42MjEgNy42MjEgMCAwMTAgNC41Mzd6bS0xMy43OTMtNC41MzdoNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAgNC41MzdIOS42ODZhNy42MjEgNy42MjEgMCAwMTAtNC41Mzd6Ii8+PC9nPjwvc3ZnPg=="},{id:"BNB",name:"BNB",description:"Binance Coin",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaH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4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzJCNzVFRCIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMS4yMDkgOS43MzlsLTIuOTQxIDIuOTQxYTMuMTMyIDMuMTMyIDAgMDAtNC41MzYgMGwtMi45NDItMi45NDFhNy42MjMgNy42MjMgMCAwMTEwLjQxOSAwek0xMC43OTEgMjIuMjYxbDIuOTQxLTIuOTQxYTMuMTMyIDMuMTMyIDAgMDA0LjUzNiAwbDIuOTQyIDIuOTQxYTcuNjIzIDcuNjIzIDAgMDEtMTAuNDE5IDB6bTExLjU3NS00LjI2MWgtNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAtNC41MzdoNC4xNTNhNy42MjEgNy42MjEgMCAwMTAgNC41Mzd6bS0xMy43OTMtNC41MzdoNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAgNC41MzdIOS42ODZhNy42MjEgNy42MjEgMCAwMTAtNC41Mzd6Ii8+PC9nPjwvc3ZnPg=="}],x=f=>{console.log("Method selected:",f),n(f)};return t.jsxs("div",{children:[t.jsx("h3",{className:`text-lg font-medium mb-3 ${i==="dark"?"text-white":"text-gray-800"}`,children:"Select Payment Method"}),t.jsx("div",{className:"space-y-2",children:l.map(f=>t.jsxs("button",{onClick:()=>x(f.id),className:`w-full flex items-center p-3 rounded-lg transition-colors ${a===f.id?i==="dark"?"bg-blue-900/30 border border-blue-500":"bg-blue-50 border border-blue-500":i==="dark"?"bg-gray-700 hover:bg-gray-600 border border-gray-700":"bg-white hover:bg-gray-50 border border-gray-200"}`,children:[t.jsx("div",{className:"flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mr-3",children:t.jsx("img",{src:f.logo,alt:f.name,className:"h-6 w-6"})}),t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx("h4",{className:`font-medium ${i==="dark"?"text-white":"text-gray-900"}`,children:f.name}),t.jsx("p",{className:`text-sm ${i==="dark"?"text-gray-300":"text-gray-500"}`,children:f.description})]}),a===f.id&&t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-blue-500",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})]},f.id))})]})},je=({status:n,theme:a="light",message:i})=>{console.log("PaymentStatus render:",{status:n,message:i});const l=()=>{switch(n){case"processing":return t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20"});case"success":return t.jsx("div",{className:"rounded-full h-12 w-12 bg-green-100 flex items-center justify-center",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})});case"error":return t.jsx("div",{className:"rounded-full h-12 w-12 bg-red-100 flex items-center justify-center",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})});default:return null}},x=()=>{switch(n){case"processing":return"Processing Payment";case"success":return"Payment Successful";case"error":return"Payment Failed";default:return"Unknown Status"}},f=()=>{switch(n){case"processing":return a==="dark"?"text-blue-300":"text-blue-600";case"success":return a==="dark"?"text-green-300":"text-green-600";case"error":return a==="dark"?"text-red-300":"text-red-600";default:return a==="dark"?"text-gray-300":"text-gray-600"}};return t.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[t.jsx("div",{className:"mb-4",children:l()}),t.jsx("h3",{className:`text-xl font-bold mb-2 ${a==="dark"?"text-white":"text-gray-900"}`,children:x()}),t.jsx("p",{className:`text-center ${f()}`,children:i}),n==="processing"&&t.jsx("div",{className:`mt-4 text-xs ${a==="dark"?"text-gray-400":"text-gray-500"}`,children:"This may take a few moments. Please do not close this window."}),n==="success"&&t.jsx("div",{className:`mt-4 p-2 rounded ${a==="dark"?"bg-gray-700":"bg-gray-100"}`,children:t.jsx("p",{className:`text-xs ${a==="dark"?"text-gray-300":"text-gray-600"}`,children:"Your payment has been successfully processed. You will receive a confirmation shortly."})})]})},W=()=>typeof window<"u"&&typeof window.ethereum<"u",Pe=async()=>{if(!W())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_requestAccounts"})}catch(n){throw console.error("Error connecting to wallet:",n),n}},Re=async()=>{if(!W())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_accounts"})}catch(n){throw console.error("Error getting accounts:",n),n}},ft=async()=>{if(!W())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_chainId"})}catch(n){throw console.error("Error getting chain ID:",n),n}},ze=async n=>{if(!W())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_sendTransaction",params:[n]})}catch(a){throw console.error("Error sending transaction:",a),a}},gt=async(n,a,i)=>{if(!W())throw new Error("MetaMask is not installed");try{const x=(await window.ethereum.request({method:"eth_requestAccounts"}))[0],f="0xa9059cbb",p=a.slice(2).padStart(64,"0"),C=i.toString(16).padStart(64,"0"),o=`${f}${p}${C}`,D={from:x,to:n,data:o};return await window.ethereum.request({method:"eth_sendTransaction",params:[D]})}catch(l){throw console.error("Error sending token:",l),l}},Mt=async()=>{try{return(await Re()).length>0}catch{return!1}},yt=n=>({"0x1":"Ethereum Mainnet","0x3":"Ropsten Testnet","0x4":"Rinkeby Testnet","0x5":"Goerli Testnet","0x2a":"Kovan Testnet","0x38":"Binance Smart Chain","0x89":"Polygon","0xa86a":"Avalanche"})[n]||`Unknown Network (${n})`,mt=async(n,a)=>{if(!W())throw new Error("MetaMask is not installed");try{const i="0x70a08231",l=a.slice(2).padStart(64,"0"),x=`${i}${l}`,f=await window.ethereum.request({method:"eth_call",params:[{to:n,data:x},"latest"]});return parseInt(f,16).toString()}catch(i){throw console.error("Error getting token balance:",i),i}},ht={USDT:"0xdAC17F958D2ee523a2206206994597C13D831ec7",USDC:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",DAI:"0x6B175474E89094C44Da98b954EedeAC495271d0F",WETH:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",WBTC:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"},_e=({isOpen:n,onClose:a,payment:i,paymentStatus:l,selectedCurrency:x,onCurrencySelect:f,onPayment:p,error:C,theme:o="light",merchantName:D,transactionHash:h,walletConnected:I,onConnectWallet:R,testMode:b=!1})=>{const[z,_]=M.useState("select-currency"),[Q,E]=M.useState(!1);M.useEffect(()=>{E(W())},[]),M.useEffect(()=>{l==="loading"?_("processing"):l==="success"?_("success"):l==="error"?_("error"):l==="idle"&&i&&_("select-currency")},[l,i]);const S=w=>{f(w),_("confirm")},te=()=>{p()},Y=()=>{z==="confirm"&&_("select-currency")},V=()=>{a()},re=w=>parseFloat(w).toFixed(2),ne=w=>w?w.length<=14?w:`${w.slice(0,8)}...${w.slice(-6)}`:"",U=`fixed inset-0 z-50 overflow-y-auto ${o==="dark"?"bg-gray-900/75":"bg-black/50"}`,J=`relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl ${o==="dark"?"bg-gray-800 text-white":"bg-white text-gray-800"}`,B=`text-xl font-bold mb-4 ${o==="dark"?"text-white":"text-gray-900"}`,Z=`w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${o==="dark"?"bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500":"bg-blue-500 hover:bg-blue-600 text-white focus:ring-blue-500"}`,F=`w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${o==="dark"?"bg-gray-700 hover:bg-gray-600 text-white focus:ring-gray-500":"bg-gray-200 hover:bg-gray-300 text-gray-800 focus:ring-gray-500"}`;return n?t.jsx("div",{className:U,children:t.jsx("div",{className:"flex min-h-screen items-center justify-center p-4",children:t.jsxs("div",{className:J,children:[t.jsxs("div",{className:"flex justify-between items-center mb-6",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6 mr-2 text-blue-500",children:t.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.31-8.86c-1.77-.45-2.34-.94-2.34-1.67 0-.84.79-1.43 2.1-1.43 1.38 0 1.9.66 1.94 1.64h1.71c-.05-1.34-.87-2.57-2.49-2.97V5H10.9v1.69c-1.51.32-2.72 1.3-2.72 2.81 0 1.79 1.49 2.69 3.66 3.21 1.95.46 2.34 1.15 2.34 1.87 0 .53-.39 1.39-2.1 1.39-1.6 0-2.23-.72-2.32-1.64H8.04c.1 1.7 1.36 2.66 2.86 2.97V19h2.34v-1.67c1.52-.29 2.72-1.16 2.73-2.77-.01-2.2-1.9-2.96-3.66-3.42z"})}),t.jsx("h2",{className:B,children:"Coinley Pay"})]}),t.jsx("button",{onClick:V,className:`text-gray-500 hover:text-gray-700 focus:outline-none ${o==="dark"?"text-gray-400 hover:text-gray-300":""}`,children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"mb-6",children:[i&&t.jsxs("div",{className:`mb-6 p-4 rounded-lg ${o==="dark"?"bg-gray-700":"bg-gray-100"}`,children:[t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:D}),t.jsxs("div",{className:"flex justify-between items-center mt-2",children:[t.jsx("span",{className:`font-medium ${o==="dark"?"text-gray-300":"text-gray-700"}`,children:"Amount:"}),t.jsxs("span",{className:"font-bold text-xl",children:["$",re(i.totalAmount||i.amount)]})]}),t.jsx("div",{className:"text-xs mt-1 text-right",children:t.jsxs("span",{className:`${o==="dark"?"text-gray-400":"text-gray-500"}`,children:["Payment ID: ",i.id.slice(0,8),"..."]})})]}),z==="select-currency"&&t.jsx(dt,{onSelect:S,selected:x,theme:o}),z==="confirm"&&i&&t.jsxs("div",{children:[t.jsxs("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-gray-700":"bg-gray-100"}`,children:[t.jsx("h3",{className:`text-lg font-medium mb-2 ${o==="dark"?"text-white":"text-gray-800"}`,children:"Payment Details"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:o==="dark"?"text-gray-300":"text-gray-600",children:"Currency:"}),t.jsx("span",{className:"font-medium",children:x})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:o==="dark"?"text-gray-300":"text-gray-600",children:"Network:"}),t.jsx("span",{className:"font-medium",children:x==="SOL"||x==="USDC_SOL"?"Solana":"Ethereum"})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:o==="dark"?"text-gray-300":"text-gray-600",children:"Fee:"}),t.jsx("span",{className:"font-medium",children:"1.75%"})]})]})]}),b?t.jsx("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-blue-900/20":"bg-blue-50"}`,children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"bg-blue-500 rounded-full p-2 mr-3",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),t.jsxs("div",{children:[t.jsx("h3",{className:`font-medium ${o==="dark"?"text-white":"text-gray-800"}`,children:"Test Mode Payment"}),t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:'Click "Pay Now" to simulate a successful payment'})]})]})}):Q?t.jsxs("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-blue-900/20":"bg-blue-50"}`,children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"https://metamask.io/images/metamask-fox.svg",alt:"MetaMask",className:"w-8 h-8 mr-2"}),t.jsxs("div",{children:[t.jsx("h3",{className:`font-medium ${o==="dark"?"text-white":"text-gray-800"}`,children:"Pay with MetaMask"}),t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:I?"Your wallet is connected. Click 'Pay Now' to proceed.":"Click 'Connect Wallet' to proceed with payment."})]})]}),!I&&t.jsx("button",{onClick:R,className:`mt-3 ${Z}`,children:"Connect Wallet"})]}):t.jsxs("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-yellow-900/20":"bg-yellow-50"}`,children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-yellow-500 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),t.jsxs("div",{children:[t.jsx("h3",{className:`font-medium ${o==="dark"?"text-white":"text-gray-800"}`,children:"MetaMask Not Detected"}),t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:"Please install MetaMask extension to make payments"})]})]}),t.jsx("a",{href:"https://metamask.io/download/",target:"_blank",rel:"noopener noreferrer",className:`block mt-3 text-center ${Z}`,children:"Install MetaMask"})]}),t.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[t.jsx("button",{type:"button",onClick:Y,className:F,children:"Back"}),t.jsx("button",{type:"button",onClick:te,className:Z,disabled:!b&&Q&&!I,children:"Pay Now"})]})]}),z==="processing"&&t.jsx(je,{status:"processing",theme:o,message:"Processing your payment..."}),z==="success"&&t.jsxs("div",{children:[t.jsx(je,{status:"success",theme:o,message:"Payment successful!"}),h&&t.jsxs("div",{className:`mt-4 p-3 rounded-lg ${o==="dark"?"bg-gray-700":"bg-gray-100"}`,children:[t.jsx("p",{className:`text-xs ${o==="dark"?"text-gray-300":"text-gray-600"} mb-1`,children:"Transaction Hash:"}),t.jsx("p",{className:`text-sm font-mono break-all ${o==="dark"?"text-white":"text-gray-800"}`,children:ne(h)}),t.jsx("a",{href:`https://etherscan.io/tx/${h}`,target:"_blank",rel:"noopener noreferrer",className:`text-xs ${o==="dark"?"text-blue-400":"text-blue-600"} mt-2 inline-block`,children:"View on Etherscan →"})]})]}),z==="error"&&t.jsxs("div",{children:[t.jsx(je,{status:"error",theme:o,message:C||"An error occurred while processing your payment."}),t.jsx("button",{type:"button",onClick:Y,className:`mt-4 ${F}`,children:"Try Again"})]})]}),t.jsx("div",{className:`text-center text-xs ${o==="dark"?"text-gray-400":"text-gray-500"}`,children:t.jsx("p",{children:"Powered by Coinley - Secure Cryptocurrency Payments"})})]})})}):null},Ye=M.forwardRef(({apiKey:n,apiSecret:a,apiUrl:i,customerEmail:l,merchantName:x="Merchant",onSuccess:f,onError:p,onClose:C,theme:o,autoOpen:D=!1,debug:h=!1,testMode:I=!1},R)=>{const b=lt(),{theme:z}=rt(),[_,Q]=M.useState(D),[E,S]=M.useState(null),[te,Y]=M.useState("idle"),[V,re]=M.useState("USDT"),[ne,U]=M.useState(null),[J,B]=M.useState(null),[Z,F]=M.useState(!1);n||(b==null||b.apiKey),a||(b==null||b.apiSecret),i||(b==null||b.apiUrl);const w=o||z,G=h||(b==null?void 0:b.debug);M.useImperativeHandle(R,()=>({open:u=>{ce(u)},close:()=>{ae()},getPayment:()=>E}));const N=(u,L)=>{G&&console.log(`[Coinley SDK] ${u}`,L)};M.useEffect(()=>{(async()=>{if(W())try{const L=await window.ethereum.request({method:"eth_accounts"});F(L&&L.length>0)}catch(L){N("Error checking wallet connection:",L),F(!1)}else F(!1)})()},[]),M.useEffect(()=>{const u=L=>{F(L.length>0)};return window.ethereum&&window.ethereum.on("accountsChanged",u),()=>{window.ethereum&&window.ethereum.removeListener("accountsChanged",u)}},[]);const ce=async u=>{if(!u||!u.amount){U("Payment amount is required"),p&&p(new Error("Payment amount is required"));return}Y("loading"),Q(!0);try{N("Creating payment with details:",u);const L=await ke({amount:u.amount,currency:u.currency||"USDT",customerEmail:u.customerEmail||l,callbackUrl:u.callbackUrl,metadata:u.metadata||{}});N("Payment created:",L),S(L.payment),Y("idle"),U(null)}catch(L){N("Error creating payment:",L),U(L.message||"Failed to create payment"),Y("error"),p&&p(L)}},ae=()=>{Q(!1),B(null),C&&C()},le=u=>{N("Currency selected:",u),re(u)},se=async()=>{if(!W())return U("MetaMask is not installed. Please install MetaMask to make payments."),!1;try{const u=await Pe();return F(u.length>0),u.length>0}catch(u){return N("Error connecting to wallet:",u),U(u.message||"Failed to connect to wallet"),!1}},ue=async()=>{if(!E){U("No active payment to process");return}N("Starting payment process..."),Y("loading"),B(null);try{N("Processing payment:",{paymentId:E.id,currency:V});let u;if(I)N("Test mode: Generating mock transaction..."),u=`0x${Array.from({length:64},()=>Math.floor(Math.random()*16).toString(16)).join("")}`;else{if(!Z&&!await se())throw new Error("Please connect your wallet to proceed with payment");const de=E.merchantAddress||"0x742d35Cc6634C0532925a3b844Bc454e4438f44e",xe={from:await window.ethereum.request({method:"eth_requestAccounts"}).then(fe=>fe[0]),to:de,value:"0x0",data:"0x"};N("Sending transaction to wallet for approval..."),u=await ze(xe)}N("Transaction hash:",u),B(u),N("Sending process payment request to API...");const L=await Ae({paymentId:E.id,transactionHash:u,network:"ethereum"});N("Payment processed successfully:",L),Y("success"),f&&(N("Calling onSuccess callback..."),f(E.id,u))}catch(u){N("Payment error:",u),U(u.message||"Failed to process payment"),Y("error"),p&&p(u)}};return M.useEffect(()=>{D&&E&&Q(!0)},[D,E]),t.jsx(t.Fragment,{children:_&&t.jsx(_e,{isOpen:_,onClose:ae,payment:E,paymentStatus:te,selectedCurrency:V,onCurrencySelect:le,onPayment:ue,error:ne,theme:w,merchantName:x,transactionHash:J,walletConnected:Z,onConnectWallet:se,testMode:I})})});Ye.displayName="CoinleyCheckout";const Zt="",jt={apiUrl:"http://localhost:9000",debug:!1,testMode:!1,theme:"light"},xt="1.0.0";m.CoinleyCheckout=Ye,m.CoinleyModal=_e,m.CoinleyProvider=ut,m.DEFAULT_CONFIG=jt,m.TOKEN_ADDRESSES=ht,m.ThemeProvider=nt,m.VERSION=xt,m.connectWallet=Pe,m.createPayment=ke,m.getAccounts=Re,m.getChainId=ft,m.getMerchantPaymentStats=it,m.getMerchantPayments=ot,m.getNetworkName=yt,m.getPayment=st,m.getSupportedCurrencies=ct,m.getTokenBalance=mt,m.isMetaMaskInstalled=W,m.isWalletConnected=Mt,m.processPayment=Ae,m.sendToken=gt,m.sendTransaction=ze,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
32
+ <%s key={someKey} {...props} />`,Ae,H,Wt,H),Ke[H+Ae]=!0}}return e===l?Yt(T):Ut(T),T}}function Ft(e,r,s){return $e(e,r,s,!0)}function _t(e,r,s){return $e(e,r,s,!1)}var Qt=_t,Gt=Ft;ee.Fragment=l,ee.jsx=Qt,ee.jsxs=Gt}()),ee}process.env.NODE_ENV==="production"?he.exports=et():he.exports=tt();var t=he.exports;const Ie=M.createContext(),rt=()=>M.useContext(Ie),at=({initialTheme:a="light",children:n})=>{const[i,l]=M.useState(a),x=()=>{l(f=>f==="light"?"dark":"light")};return M.useEffect(()=>{document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(i)},[i]),t.jsx(Ie.Provider,{value:{theme:i,setTheme:l,toggleTheme:x},children:n})};let O={apiKey:null,apiSecret:null,apiUrl:"https://coinleyserver-production.up.railway.app"};const nt=a=>{O={...O,...a},console.log("API initialized with:",O)},V=()=>({"Content-Type":"application/json","x-api-key":O.apiKey,"x-api-secret":O.apiSecret}),Ee=async a=>{try{console.log("Creating payment with data:",a),console.log("API URL:",`${O.apiUrl}/api/payments/create`);const n=await fetch(`${O.apiUrl}/api/payments/create`,{method:"POST",headers:V(),body:JSON.stringify(a)});if(console.log("Create payment response status:",n.status),!n.ok){const l=await n.json();throw console.error("Error creating payment:",l),new Error(l.error||`Failed to create payment: ${n.status}`)}const i=await n.json();return console.log("Create payment response data:",i),i}catch(n){throw console.error("Create payment error:",n),n}},st=async a=>{try{console.log("Getting payment:",a);const n=await fetch(`${O.apiUrl}/api/payments/${a}`,{method:"GET",headers:V()});if(!n.ok){const l=await n.json();throw console.error("Error getting payment:",l),new Error(l.error||`Failed to get payment: ${n.status}`)}const i=await n.json();return console.log("Get payment response:",i),i}catch(n){throw console.error("Get payment error:",n),n}},ke=async a=>{try{console.log("Processing payment with data:",a),console.log("API URL:",`${O.apiUrl}/api/payments/process`);const n=await fetch(`${O.apiUrl}/api/payments/process`,{method:"POST",headers:V(),body:JSON.stringify(a)});if(console.log("Process payment response status:",n.status),!n.ok){const l=await n.json();throw console.error("Error processing payment:",l),new Error(l.error||`Failed to process payment: ${n.status}`)}const i=await n.json();return console.log("Process payment response data:",i),i}catch(n){throw console.error("Process payment error:",n),n}},ot=async(a={})=>{try{const{page:n=1,limit:i=10,status:l,currency:x,startDate:f,endDate:w,search:A}=a,o=new URLSearchParams;o.append("page",n),o.append("limit",i),l&&o.append("status",l),x&&o.append("currency",x),f&&o.append("startDate",f),w&&o.append("endDate",w),A&&o.append("search",A);const D=`${O.apiUrl}/api/payments/merchant/list?${o.toString()}`,h=await fetch(D,{method:"GET",headers:V()});if(!h.ok){const C=await h.json();throw new Error(C.error||`Failed to get payments: ${h.status}`)}return await h.json()}catch(n){throw console.error("Get merchant payments error:",n),n}},it=async()=>{try{const a=await fetch(`${O.apiUrl}/api/payments/merchant/stats`,{method:"GET",headers:V()});if(!a.ok){const n=await a.json();throw new Error(n.error||`Failed to get payment stats: ${a.status}`)}return await a.json()}catch(a){throw console.error("Get merchant payment stats error:",a),a}},ct=async()=>{try{const a=await fetch(`${O.apiUrl}/api/payments/currencies`,{method:"GET",headers:V()});if(!a.ok){const n=await a.json();throw new Error(n.error||`Failed to get currencies: ${a.status}`)}return await a.json()}catch(a){return console.error("Get supported currencies error:",a),{currencies:[{id:"USDT",name:"Tether USD",network:"ethereum"},{id:"USDC",name:"USD Coin",network:"ethereum"},{id:"BNB",name:"Binance Coin",network:"binance"},{id:"SOL",name:"Solana",network:"solana"},{id:"USDC_SOL",name:"USD Coin (Solana)",network:"solana"}]}}},Oe=M.createContext(),lt=()=>M.useContext(Oe),ut=({apiKey:a,apiSecret:n,apiUrl:i="https://coinleyserver-production.up.railway.app",debug:l=!1,children:x})=>{const[f,w]=M.useState(!1),[A,o]=M.useState(null);M.useEffect(()=>{if(!a||!n){o("API key and secret are required");return}try{nt({apiKey:a,apiSecret:n,apiUrl:i}),w(!0),l&&console.log("Coinley SDK initialized with:",{apiKey:a,apiUrl:i})}catch(h){o(h.message),l&&console.error("Coinley SDK initialization error:",h)}},[a,n,i,l]);const D={apiKey:a,apiSecret:n,apiUrl:i,isInitialized:f,error:A,debug:l};return t.jsx(Oe.Provider,{value:D,children:x})},dt=({onSelect:a,selected:n,theme:i="light"})=>{console.log("PaymentMethods render:",{selected:n});const l=[{id:"USDT",name:"USDT",description:"Tether USD",logo:"data:image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"},{id:"USDC_SOL",name:"USDC (Solana)",description:"USD Coin on Solana",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzJCNzVFRCIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yMS4yMDkgOS43MzlsLTIuOTQxIDIuOTQxYTMuMTMyIDMuMTMyIDAgMDAtNC41MzYgMGwtMi45NDItMi45NDFhNy42MjMgNy42MjMgMCAwMTEwLjQxOSAwek0xMC43OTEgMjIuMjYxbDIuOTQxLTIuOTQxYTMuMTMyIDMuMTMyIDAgMDA0LjUzNiAwbDIuOTQyIDIuOTQxYTcuNjIzIDcuNjIzIDAgMDEtMTAuNDE5IDB6bTExLjU3NS00LjI2MWgtNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAtNC41MzdoNC4xNTNhNy42MjEgNy42MjEgMCAwMTAgNC41Mzd6bS0xMy43OTMtNC41MzdoNC4xNTNhMy4xMzMgMy4xMzMgMCAwMDAgNC41MzdIOS42ODZhNy42MjEgNy42MjEgMCAwMTAtNC41Mzd6Ii8+PC9nPjwvc3ZnPg=="}],x=f=>{console.log("Method selected:",f),a(f)};return t.jsxs("div",{children:[t.jsx("h3",{className:`text-lg font-medium mb-3 ${i==="dark"?"text-white":"text-gray-800"}`,children:"Select Payment Method"}),t.jsx("div",{className:"space-y-2",children:l.map(f=>t.jsxs("button",{onClick:()=>x(f.id),className:`w-full flex items-center p-3 rounded-lg transition-colors ${n===f.id?i==="dark"?"bg-blue-900/30 border border-blue-500":"bg-blue-50 border border-blue-500":i==="dark"?"bg-gray-700 hover:bg-gray-600 border border-gray-700":"bg-white hover:bg-gray-50 border border-gray-200"}`,children:[t.jsx("div",{className:"flex-shrink-0 h-10 w-10 bg-white rounded-full flex items-center justify-center mr-3",children:t.jsx("img",{src:f.logo,alt:f.name,className:"h-6 w-6"})}),t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx("h4",{className:`font-medium ${i==="dark"?"text-white":"text-gray-900"}`,children:f.name}),t.jsx("p",{className:`text-sm ${i==="dark"?"text-gray-300":"text-gray-500"}`,children:f.description})]}),n===f.id&&t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-blue-500",viewBox:"0 0 20 20",fill:"currentColor",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})]},f.id))})]})},je=({status:a,theme:n="light",message:i})=>{console.log("PaymentStatus render:",{status:a,message:i});const l=()=>{switch(a){case"processing":return t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20"});case"success":return t.jsx("div",{className:"rounded-full h-12 w-12 bg-green-100 flex items-center justify-center",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})});case"error":return t.jsx("div",{className:"rounded-full h-12 w-12 bg-red-100 flex items-center justify-center",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})});default:return null}},x=()=>{switch(a){case"processing":return"Processing Payment";case"success":return"Payment Successful";case"error":return"Payment Failed";default:return"Unknown Status"}},f=()=>{switch(a){case"processing":return n==="dark"?"text-blue-300":"text-blue-600";case"success":return n==="dark"?"text-green-300":"text-green-600";case"error":return n==="dark"?"text-red-300":"text-red-600";default:return n==="dark"?"text-gray-300":"text-gray-600"}};return t.jsxs("div",{className:"flex flex-col items-center justify-center py-6",children:[t.jsx("div",{className:"mb-4",children:l()}),t.jsx("h3",{className:`text-xl font-bold mb-2 ${n==="dark"?"text-white":"text-gray-900"}`,children:x()}),t.jsx("p",{className:`text-center ${f()}`,children:i}),a==="processing"&&t.jsx("div",{className:`mt-4 text-xs ${n==="dark"?"text-gray-400":"text-gray-500"}`,children:"This may take a few moments. Please do not close this window."}),a==="success"&&t.jsx("div",{className:`mt-4 p-2 rounded ${n==="dark"?"bg-gray-700":"bg-gray-100"}`,children:t.jsx("p",{className:`text-xs ${n==="dark"?"text-gray-300":"text-gray-600"}`,children:"Your payment has been successfully processed. You will receive a confirmation shortly."})})]})},Q=()=>typeof window<"u"&&typeof window.ethereum<"u",Pe=async()=>{if(!Q())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_requestAccounts"})}catch(a){throw console.error("Error connecting to wallet:",a),a}},Re=async()=>{if(!Q())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_accounts"})}catch(a){throw console.error("Error getting accounts:",a),a}},ft=async()=>{if(!Q())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_chainId"})}catch(a){throw console.error("Error getting chain ID:",a),a}},ze=async a=>{if(!Q())throw new Error("MetaMask is not installed");try{return await window.ethereum.request({method:"eth_sendTransaction",params:[a]})}catch(n){throw console.error("Error sending transaction:",n),n}},gt=async(a,n,i)=>{if(!Q())throw new Error("MetaMask is not installed");try{const x=(await window.ethereum.request({method:"eth_requestAccounts"}))[0],f="0xa9059cbb",w=n.slice(2).padStart(64,"0"),A=i.toString(16).padStart(64,"0"),o=`${f}${w}${A}`,D={from:x,to:a,data:o};return await window.ethereum.request({method:"eth_sendTransaction",params:[D]})}catch(l){throw console.error("Error sending token:",l),l}},Mt=async()=>{try{return(await Re()).length>0}catch{return!1}},yt=a=>({"0x1":"Ethereum Mainnet","0x3":"Ropsten Testnet","0x4":"Rinkeby Testnet","0x5":"Goerli Testnet","0x2a":"Kovan Testnet","0x38":"Binance Smart Chain","0x89":"Polygon","0xa86a":"Avalanche"})[a]||`Unknown Network (${a})`,mt=async(a,n)=>{if(!Q())throw new Error("MetaMask is not installed");try{const i="0x70a08231",l=n.slice(2).padStart(64,"0"),x=`${i}${l}`,f=await window.ethereum.request({method:"eth_call",params:[{to:a,data:x},"latest"]});return parseInt(f,16).toString()}catch(i){throw console.error("Error getting token balance:",i),i}},ht={USDT:"0xdAC17F958D2ee523a2206206994597C13D831ec7",USDC:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",DAI:"0x6B175474E89094C44Da98b954EedeAC495271d0F",WETH:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",WBTC:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"},jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAcCAYAAACqAXueAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAiaSURBVHgB7VrdddNIFL4zNuDAw2orQDQATgUoUABQAU4FOGcLiF0BpoI4FcQ0QLQVxAHOvqLtwDyQOBBr9rszI2n058jeBEhOvnNkS6M7o7m6c39HRA3Qf/bxLR+l9uDIR/sXHD26trjTJeoMiO6/pEuCEBuHOBQfZuxfB9mQjpnv958d9/O9W2/w6+N4StcSHV+INoQhdoVQB7ju0Q1DUwFbiN1Cw6Wt+l+EHg4vu5TXdKHWIydgmFyv//xjWWhCzOyZB5pA0xo63zSrf0vjQNvZhNPvjTB/Gf9NNwx5DZZyQIoOSn5VOYxLaRaAUkHaFotpcgqhdmG6j7Aq4LNbXfqtMQ+VUts4xkrRDq7HdMOQF3BMkT3zcez1n30yJjmOJymNsv5WyCdZx0XIvzvB59cQ7qHur1SUtP/eYKH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L3NB0NXEBwD6JmwtE+yx6cVzfdR/5V4JhBgt/YM/O9GzbkM2fubfk2KlLl94MV+XmRW2Ga77B83RQnKyX7TAcC5WBhzKesyaDXO1HWfIe0MjSDYaGNmkEzGdG1QTGaP7m4S2GDxsYJURVlQcDxAIHUQ+1z48V+Jhzp+OSFEWy8mECwdgXlfbYNsh6tF1Xfoh7GslnN9Z0btZay8MmOFkw5YpR2MKW3BCNLO0O0HZqP78QfVYP/jx2mW5TAmcbZYTHxsYFYVNer2XfRyobjxWh1cT607T7d4qejPsrO0EzAgv0u/HH4OBeGaxPO94Q6plv8FECovJc8uTjKNvgPcUpIo0ZgmzUAAAAASUVORK5CYII=",Ue=({isOpen:a,onClose:n,payment:i,paymentStatus:l,selectedCurrency:x,onCurrencySelect:f,onPayment:w,error:A,theme:o="light",merchantName:D,transactionHash:h,walletConnected:C,onConnectWallet:R,testMode:b=!1})=>{const[z,U]=M.useState("select-currency"),[W,I]=M.useState(!1);M.useEffect(()=>{I(Q())},[]),M.useEffect(()=>{l==="loading"?U("processing"):l==="success"?U("success"):l==="error"?U("error"):l==="idle"&&i&&U("select-currency")},[l,i]);const S=p=>{f(p),U("confirm")},te=()=>{w()},Y=()=>{z==="confirm"&&U("select-currency")},X=()=>{n()},re=p=>parseFloat(p).toFixed(2),ae=p=>p?p.length<=14?p:`${p.slice(0,8)}...${p.slice(-6)}`:"",F=`fixed inset-0 z-50 overflow-y-auto ${o==="dark"?"bg-gray-900/75":"bg-black/50"}`,J=`relative p-6 w-full max-w-md mx-auto rounded-lg shadow-xl ${o==="dark"?"bg-gray-800 text-white":"bg-white text-gray-800"}`,Z=`text-xl font-bold mb-4 ${o==="dark"?"text-white":"text-gray-900"}`,B=`w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${o==="dark"?"bg-blue-600 hover:bg-blue-700 text-white focus:ring-blue-500":"bg-blue-500 hover:bg-blue-600 text-white focus:ring-blue-500"}`,_=`w-full py-2 px-4 rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${o==="dark"?"bg-gray-700 hover:bg-gray-600 text-white focus:ring-gray-500":"bg-gray-200 hover:bg-gray-300 text-gray-800 focus:ring-gray-500"}`;return a?t.jsx("div",{className:F,children:t.jsx("div",{className:"flex min-h-screen items-center justify-center p-4",children:t.jsxs("div",{className:J,children:[t.jsxs("div",{className:"flex justify-between items-center mb-6",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:jt}),t.jsx("h2",{className:Z,children:"Coinley Pay"})]}),t.jsx("button",{onClick:X,className:`text-gray-500 hover:text-gray-700 focus:outline-none ${o==="dark"?"text-gray-400 hover:text-gray-300":""}`,children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),t.jsxs("div",{className:"mb-6",children:[i&&t.jsxs("div",{className:`mb-6 p-4 rounded-lg ${o==="dark"?"bg-gray-700":"bg-gray-100"}`,children:[t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:D}),t.jsxs("div",{className:"flex justify-between items-center mt-2",children:[t.jsx("span",{className:`font-medium ${o==="dark"?"text-gray-300":"text-gray-700"}`,children:"Amount:"}),t.jsxs("span",{className:"font-bold text-xl",children:["$",re(i.totalAmount||i.amount)]})]}),t.jsx("div",{className:"text-xs mt-1 text-right",children:t.jsxs("span",{className:`${o==="dark"?"text-gray-400":"text-gray-500"}`,children:["Payment ID: ",i.id.slice(0,8),"..."]})})]}),z==="select-currency"&&t.jsx(dt,{onSelect:S,selected:x,theme:o}),z==="confirm"&&i&&t.jsxs("div",{children:[t.jsxs("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-gray-700":"bg-gray-100"}`,children:[t.jsx("h3",{className:`text-lg font-medium mb-2 ${o==="dark"?"text-white":"text-gray-800"}`,children:"Payment Details"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:o==="dark"?"text-gray-300":"text-gray-600",children:"Currency:"}),t.jsx("span",{className:"font-medium",children:x})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:o==="dark"?"text-gray-300":"text-gray-600",children:"Network:"}),t.jsx("span",{className:"font-medium",children:x==="SOL"||x==="USDC_SOL"?"Solana":"Ethereum"})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:o==="dark"?"text-gray-300":"text-gray-600",children:"Fee:"}),t.jsx("span",{className:"font-medium",children:"1.75%"})]})]})]}),b?t.jsx("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-blue-900/20":"bg-blue-50"}`,children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"bg-blue-500 rounded-full p-2 mr-3",children:t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),t.jsxs("div",{children:[t.jsx("h3",{className:`font-medium ${o==="dark"?"text-white":"text-gray-800"}`,children:"Test Mode Payment"}),t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:'Click "Pay Now" to simulate a successful payment'})]})]})}):W?t.jsxs("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-blue-900/20":"bg-blue-50"}`,children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"https://metamask.io/images/metamask-fox.svg",alt:"MetaMask",className:"w-8 h-8 mr-2"}),t.jsxs("div",{children:[t.jsx("h3",{className:`font-medium ${o==="dark"?"text-white":"text-gray-800"}`,children:"Pay with MetaMask"}),t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:C?"Your wallet is connected. Click 'Pay Now' to proceed.":"Click 'Connect Wallet' to proceed with payment."})]})]}),!C&&t.jsx("button",{onClick:R,className:`mt-3 ${B}`,children:"Connect Wallet"})]}):t.jsxs("div",{className:`p-4 rounded-lg mb-4 ${o==="dark"?"bg-yellow-900/20":"bg-yellow-50"}`,children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-yellow-500 mr-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),t.jsxs("div",{children:[t.jsx("h3",{className:`font-medium ${o==="dark"?"text-white":"text-gray-800"}`,children:"MetaMask Not Detected"}),t.jsx("p",{className:`text-sm ${o==="dark"?"text-gray-300":"text-gray-600"}`,children:"Please install MetaMask extension to make payments"})]})]}),t.jsx("a",{href:"https://metamask.io/download/",target:"_blank",rel:"noopener noreferrer",className:`block mt-3 text-center ${B}`,children:"Install MetaMask"})]}),t.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-3",children:[t.jsx("button",{type:"button",onClick:Y,className:_,children:"Back"}),t.jsx("button",{type:"button",onClick:te,className:B,disabled:!b&&W&&!C,children:"Pay Now"})]})]}),z==="processing"&&t.jsx(je,{status:"processing",theme:o,message:"Processing your payment..."}),z==="success"&&t.jsxs("div",{children:[t.jsx(je,{status:"success",theme:o,message:"Payment successful!"}),h&&t.jsxs("div",{className:`mt-4 p-3 rounded-lg ${o==="dark"?"bg-gray-700":"bg-gray-100"}`,children:[t.jsx("p",{className:`text-xs ${o==="dark"?"text-gray-300":"text-gray-600"} mb-1`,children:"Transaction Hash:"}),t.jsx("p",{className:`text-sm font-mono break-all ${o==="dark"?"text-white":"text-gray-800"}`,children:ae(h)}),t.jsx("a",{href:`https://etherscan.io/tx/${h}`,target:"_blank",rel:"noopener noreferrer",className:`text-xs ${o==="dark"?"text-blue-400":"text-blue-600"} mt-2 inline-block`,children:"View on Etherscan →"})]})]}),z==="error"&&t.jsxs("div",{children:[t.jsx(je,{status:"error",theme:o,message:A||"An error occurred while processing your payment."}),t.jsx("button",{type:"button",onClick:Y,className:`mt-4 ${_}`,children:"Try Again"})]})]}),t.jsx("div",{className:`text-center text-xs ${o==="dark"?"text-gray-400":"text-gray-500"}`,children:t.jsx("p",{children:"Powered by Coinley - Secure Cryptocurrency Payments"})})]})})}):null},Ye=M.forwardRef(({apiKey:a,apiSecret:n,apiUrl:i,customerEmail:l,merchantName:x="Merchant",onSuccess:f,onError:w,onClose:A,theme:o,autoOpen:D=!1,debug:h=!1,testMode:C=!1},R)=>{const b=lt(),{theme:z}=rt(),[U,W]=M.useState(D),[I,S]=M.useState(null),[te,Y]=M.useState("idle"),[X,re]=M.useState("USDT"),[ae,F]=M.useState(null),[J,Z]=M.useState(null),[B,_]=M.useState(!1);a||(b==null||b.apiKey),n||(b==null||b.apiSecret),i||(b==null||b.apiUrl);const p=o||z,G=h||(b==null?void 0:b.debug);M.useImperativeHandle(R,()=>({open:u=>{ce(u)},close:()=>{ne()},getPayment:()=>I}));const N=(u,L)=>{G&&console.log(`[Coinley SDK] ${u}`,L)};M.useEffect(()=>{(async()=>{if(Q())try{const L=await window.ethereum.request({method:"eth_accounts"});_(L&&L.length>0)}catch(L){N("Error checking wallet connection:",L),_(!1)}else _(!1)})()},[]),M.useEffect(()=>{const u=L=>{_(L.length>0)};return window.ethereum&&window.ethereum.on("accountsChanged",u),()=>{window.ethereum&&window.ethereum.removeListener("accountsChanged",u)}},[]);const ce=async u=>{if(!u||!u.amount){F("Payment amount is required"),w&&w(new Error("Payment amount is required"));return}Y("loading"),W(!0);try{N("Creating payment with details:",u);const L=await Ee({amount:u.amount,currency:u.currency||"USDT",customerEmail:u.customerEmail||l,callbackUrl:u.callbackUrl,metadata:u.metadata||{}});N("Payment created:",L),S(L.payment),Y("idle"),F(null)}catch(L){N("Error creating payment:",L),F(L.message||"Failed to create payment"),Y("error"),w&&w(L)}},ne=()=>{W(!1),Z(null),A&&A()},le=u=>{N("Currency selected:",u),re(u)},se=async()=>{if(!Q())return F("MetaMask is not installed. Please install MetaMask to make payments."),!1;try{const u=await Pe();return _(u.length>0),u.length>0}catch(u){return N("Error connecting to wallet:",u),F(u.message||"Failed to connect to wallet"),!1}},ue=async()=>{if(!I){F("No active payment to process");return}N("Starting payment process..."),Y("loading"),Z(null);try{N("Processing payment:",{paymentId:I.id,currency:X});let u;if(C)N("Test mode: Generating mock transaction..."),u=`0x${Array.from({length:64},()=>Math.floor(Math.random()*16).toString(16)).join("")}`;else{if(!B&&!await se())throw new Error("Please connect your wallet to proceed with payment");const de=I.merchantAddress||"0x742d35Cc6634C0532925a3b844Bc454e4438f44e",xe={from:await window.ethereum.request({method:"eth_requestAccounts"}).then(fe=>fe[0]),to:de,value:"0x0",data:"0x"};N("Sending transaction to wallet for approval..."),u=await ze(xe)}N("Transaction hash:",u),Z(u),N("Sending process payment request to API...");const L=await ke({paymentId:I.id,transactionHash:u,network:"ethereum"});N("Payment processed successfully:",L),Y("success"),f&&(N("Calling onSuccess callback..."),f(I.id,u))}catch(u){N("Payment error:",u),F(u.message||"Failed to process payment"),Y("error"),w&&w(u)}};return M.useEffect(()=>{D&&I&&W(!0)},[D,I]),t.jsx(t.Fragment,{children:U&&t.jsx(Ue,{isOpen:U,onClose:ne,payment:I,paymentStatus:te,selectedCurrency:X,onCurrencySelect:le,onPayment:ue,error:ae,theme:p,merchantName:x,transactionHash:J,walletConnected:B,onConnectWallet:se,testMode:C})})});Ye.displayName="CoinleyCheckout";const Zt="",xt={apiUrl:'https://coinleyserver-production.up.railway.app"',debug:!1,testMode:!1,theme:"light"},pt="1.0.0";m.CoinleyCheckout=Ye,m.CoinleyModal=Ue,m.CoinleyProvider=ut,m.DEFAULT_CONFIG=xt,m.TOKEN_ADDRESSES=ht,m.ThemeProvider=at,m.VERSION=pt,m.connectWallet=Pe,m.createPayment=Ee,m.getAccounts=Re,m.getChainId=ft,m.getMerchantPaymentStats=it,m.getMerchantPayments=ot,m.getNetworkName=yt,m.getPayment=st,m.getSupportedCurrencies=ct,m.getTokenBalance=mt,m.isMetaMaskInstalled=Q,m.isWalletConnected=Mt,m.processPayment=ke,m.sendToken=gt,m.sendTransaction=ze,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coinley-checkout",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A React SDK for Coinley cryptocurrency payment processing",
5
5
  "main": "dist/coinley-checkout.umd.js",
6
6
  "module": "dist/coinley-checkout.es.js",