@crossmint/client-sdk-react-ui 1.1.5 → 1.1.7

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/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Lt=Object.create;var b=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols,_t=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var J=(t,e,n)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))U.call(e,n)&&J(t,n,e[n]);if(I)for(var n of I(e))K.call(e,n)&&J(t,n,e[n]);return t};var k=(t,e)=>{var n={};for(var r in t)U.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&I)for(var r of I(t))e.indexOf(r)<0&&K.call(t,r)&&(n[r]=t[r]);return n};var Mt=(t,e)=>{for(var n in e)b(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Bt(e))!U.call(t,a)&&a!==n&&b(t,a,{get:()=>e[a],enumerable:!(r=Rt(e,a))||r.enumerable});return t};var T=(t,e,n)=>(n=t!=null?Lt(_t(t)):{},Q(e||!t||!t.__esModule?b(n,"default",{value:t,enumerable:!0}):n,t)),Dt=t=>Q(b({},"__esModule",{value:!0}),t);var w=(t,e,n)=>new Promise((r,a)=>{var m=o=>{try{d(n.next(o))}catch(i){a(i)}},u=o=>{try{d(n.throw(o))}catch(i){a(i)}},d=o=>o.done?r(o.value):Promise.resolve(o.value).then(m,u);d((n=n.apply(t,e)).next())});var Gt={};Mt(Gt,{CrossmintEvents:()=>B.CrossmintEvents,CrossmintNFTCollectionView:()=>Ht,CrossmintNFTDetail:()=>Ut,CrossmintPayButton:()=>Yt,CrossmintPaymentElement:()=>At,useCrossmintEvents:()=>B.useCrossmintEvents});module.exports=Dt(Gt);var v=require("@crossmint/client-sdk-base");var C="1.1.5";var X=require("react/jsx-runtime");function Ht(t){(0,v.assertValidNFTCollectionViewProps)(t);let e=(0,v.getNFTCollectionViewSrc)(t,C);return(0,X.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}var x=require("@crossmint/client-sdk-base");var Z=require("react/jsx-runtime");function Ut(t){(0,x.assertValidValidateNFTDetailProps)(t);let e=(0,x.getNFTDetailSrc)(t,C);return(0,Z.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}var L=require("@crossmint/client-sdk-base");var ot=require("@crossmint/client-sdk-base");var j=T(require("lodash.isequal"),1),N=require("react");function A(t,e){let n=(0,N.useRef)(e);(0,N.useEffect)(()=>{if(e.some((a,m)=>!(0,j.default)(a,n.current[m])))return n.current=e,t()},[e])}var et=T(require("bs58"),1),l=require("@crossmint/client-sdk-base");var E=require("react"),F=require("@crossmint/client-sdk-base");var tt=require("react/jsx-runtime");function V(n){var r=n,{onInternalEvent:t}=r,e=k(r,["onInternalEvent"]);let{getUrl:a,listenToEvents:m,listenToInternalEvents:u}=(0,F.crossmintIFrameService)(e),[d,o]=(0,E.useState)(0),[i]=(0,E.useState)(a(e));return(0,E.useEffect)(()=>{let c=m(s=>{var h;return(h=e.onEvent)==null?void 0:h.call(e,s.data)});return()=>{c()}},[]),(0,E.useEffect)(()=>{let c=u(s=>{let{type:h,payload:_}=s.data;h===F.IncomingInternalEvents.UI_HEIGHT_CHANGED&&o(_.height),t==null||t(s.data)});return()=>{c()}},[]),(0,tt.jsx)("iframe",{src:i,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none !important",border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${d}px`}})}var nt=require("react/jsx-runtime");function Y(t){let{emitInternalEvent:e}=(0,l.crossmintIFrameService)(t),{signer:n,paymentMethod:r}=t;function a(o){let{type:i,payload:c}=o;if(i===l.IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=c;console.log("[Crossmint] Received incoming transaction",s),m(s)}if(i===l.IncomingInternalEvents.CRYPTO_CHAIN_SWITCH){let{chain:s}=c;console.log("[Crossmint] Received change of chain",s);let h=n.handleChainSwitch;if(h==null)throw new Error("switchNetwork function should have been defined");h(s)}}function m(o){return w(this,null,function*(){try{let i;switch(r){case"SOL":i=yield u(n,o);break;case"ETH":i=yield d(n,o);break;default:throw new Error(`Unsupported payment method ${r}`)}console.log("[Crossmint] Signed and sent transaction",i),e({type:l.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:i}})}catch(i){console.error("[Crossmint] Failed to sign and send transaction",i),e({type:l.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function u(o,i){return w(this,null,function*(){let{Transaction:c}=yield import("@solana/web3.js"),s=c.from(et.default.decode(i));return console.log("[Crossmint] Deserialized SOL transaction",s),yield o.signAndSendTransaction(s)})}function d(o,i){return w(this,null,function*(){let{parse:c}=yield import("@ethersproject/transactions"),s=c(i);return console.log("[Crossmint] Deserialized ETH transaction",s),yield o.signAndSendTransaction(s)})}return A(()=>{e({type:"params-update",payload:(0,l.embeddedCheckoutPropsToUpdatableParamsPayload)(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs,..."chain"in t.signer?[t.signer.chain]:[]]),(0,nt.jsx)(V,p({onInternalEvent:a},t))}var it=require("react/jsx-runtime");function rt(t){if(!(0,ot.isCryptoEmbeddedCheckoutPropsWithSigner)(t))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return(0,it.jsx)(Y,p({},t))}var g=require("react"),O=require("@crossmint/client-sdk-base"),at=require("react/jsx-runtime");function st(t){let[e,n]=(0,g.useState)(0),{getIframeUrl:r,listenToEvents:a,emitQueryParams:m}=(0,O.crossmintPaymentService_OLD)(t),{listenToEvents:u}=(0,O.crossmintUiService_OLD)({environment:t.environment}),[d]=(0,g.useState)(r());return(0,g.useEffect)(()=>{let o=a(i=>{var c;return(c=t.onEvent)==null?void 0:c.call(t,i.data)});return()=>{o&&o()}},[]),(0,g.useEffect)(()=>{let o=u(i=>{let{type:c,payload:s}=i.data;switch(c){case"ui:height.changed":n(s.height);break;default:return}});return()=>{o&&o()}},[]),(0,g.useEffect)(()=>{m({recipient:t.recipient,mintConfig:t.mintConfig,locale:t.locale,currency:t.currency,whPassThroughArgs:t.whPassThroughArgs})},[t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs]),(0,at.jsx)("iframe",{src:d,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${e}px`}})}var G=require("react/jsx-runtime");function At(t){if((0,L.isFiatEmbeddedCheckoutProps)(t))return(0,G.jsx)(st,p({},t));if((0,L.isCryptoEmbeddedCheckoutProps)(t))return(0,G.jsx)(rt,p({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}var ut=require("react"),ht=require("react"),y=require("@crossmint/client-sdk-base");var R=require("react");function W(){let[t,e]=(0,R.useState)(!0);return(0,R.useEffect)(()=>{e(!1)},[]),{isServerSideRendering:t}}var mt=require("react-jss"),Vt="#1e1e1e",ct=t=>t==="light",dt=t=>({buttonBgColor:ct(t)?"white":Vt,paragraphColor:ct(t)?"black":"white"}),lt=(0,mt.createUseStyles)({"@global":{"@import":"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')"},crossmintButton:{display:"flex","flex-direction":"row","align-items":"center",padding:"0.875rem 0.875rem","font-weight":"900",transition:"opacity ease-in-out 0.25s","border-radius":"0.5rem","font-family":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',outline:"none",border:"none","box-shadow":"0px 8px 15px rgba(0, 0, 0, 0.1)","justify-content":"center",background:({buttonBgColor:t})=>t,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:t})=>t,margin:"0"}});var f=require("react/jsx-runtime");function Yt(t){let z=t,{className:e,disabled:n,onClick:r,style:a,tabIndex:m,theme:u="dark",mintTo:d,emailTo:o,listingId:i,auctionId:c,showOverlay:s=!0,mintConfig:h,whPassThroughArgs:_,environment:pt,paymentMethod:P,preferredSigninMethod:ft,dismissOverlayOnClick:gt,prepay:Ct,locale:$="en-US",currency:Et="usd",successCallbackURL:yt="",failureCallbackURL:bt="",loginEmail:Pt="",projectId:St,getButtonText:M,checkoutProps:q={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=z,D=k(z,["className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps"]),It="clientId"in D?D.clientId:D.collectionId,[S,kt]=(0,ht.useState)(!1),{isServerSideRendering:Tt}=W(),{connect:wt}=(0,y.crossmintModalService)({clientId:It,projectId:St,showOverlay:s,dismissOverlayOnClick:gt,setConnecting:kt,libVersion:C,environment:pt,clientName:y.clientNames.reactUi,locale:$,currency:Et,successCallbackURL:yt,failureCallbackURL:bt,loginEmail:Pt}),{getButtonText:vt,handleClick:xt}=(0,y.crossmintPayButtonService)({onClick:r,connecting:S,paymentMethod:P,locale:$,checkoutProps:q}),Nt=Ot=>xt(Ot,()=>{wt(h,d,o,i,_,P,ft,Ct,q)}),H=lt(dt(u)),Ft=(0,ut.useMemo)(()=>(0,f.jsx)("span",{className:H.crossmintParagraph,role:"button-paragraph",children:M!=null?M(S,P||"fiat"):vt(S)}),[S,M,P]);return(0,f.jsx)(f.Fragment,{children:!Tt&&(0,f.jsxs)("button",{className:`${H.crossmintButton} ${e||""}`,disabled:n,onClick:Nt,style:p({},a),tabIndex:m,children:[(0,f.jsx)("img",{className:H.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),Ft]})})}var B=require("@crossmint/client-sdk-base");0&&(module.exports={CrossmintEvents,CrossmintNFTCollectionView,CrossmintNFTDetail,CrossmintPayButton,CrossmintPaymentElement,useCrossmintEvents});
1
+ "use strict";var Lt=Object.create;var b=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols,_t=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var J=(t,e,n)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))U.call(e,n)&&J(t,n,e[n]);if(I)for(var n of I(e))K.call(e,n)&&J(t,n,e[n]);return t};var k=(t,e)=>{var n={};for(var r in t)U.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&I)for(var r of I(t))e.indexOf(r)<0&&K.call(t,r)&&(n[r]=t[r]);return n};var Mt=(t,e)=>{for(var n in e)b(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Bt(e))!U.call(t,a)&&a!==n&&b(t,a,{get:()=>e[a],enumerable:!(r=Rt(e,a))||r.enumerable});return t};var T=(t,e,n)=>(n=t!=null?Lt(_t(t)):{},Q(e||!t||!t.__esModule?b(n,"default",{value:t,enumerable:!0}):n,t)),Dt=t=>Q(b({},"__esModule",{value:!0}),t);var w=(t,e,n)=>new Promise((r,a)=>{var m=o=>{try{d(n.next(o))}catch(i){a(i)}},u=o=>{try{d(n.throw(o))}catch(i){a(i)}},d=o=>o.done?r(o.value):Promise.resolve(o.value).then(m,u);d((n=n.apply(t,e)).next())});var Gt={};Mt(Gt,{CrossmintEvents:()=>B.CrossmintEvents,CrossmintNFTCollectionView:()=>Ht,CrossmintNFTDetail:()=>Ut,CrossmintPayButton:()=>Yt,CrossmintPaymentElement:()=>At,useCrossmintEvents:()=>B.useCrossmintEvents});module.exports=Dt(Gt);var v=require("@crossmint/client-sdk-base");var C="1.1.7";var X=require("react/jsx-runtime");function Ht(t){(0,v.assertValidNFTCollectionViewProps)(t);let e=(0,v.getNFTCollectionViewSrc)(t,C);return(0,X.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}var x=require("@crossmint/client-sdk-base");var Z=require("react/jsx-runtime");function Ut(t){(0,x.assertValidValidateNFTDetailProps)(t);let e=(0,x.getNFTDetailSrc)(t,C);return(0,Z.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}var L=require("@crossmint/client-sdk-base");var ot=require("@crossmint/client-sdk-base");var j=T(require("lodash.isequal"),1),N=require("react");function A(t,e){let n=(0,N.useRef)(e);(0,N.useEffect)(()=>{if(e.some((a,m)=>!(0,j.default)(a,n.current[m])))return n.current=e,t()},[e])}var et=T(require("bs58"),1),l=require("@crossmint/client-sdk-base");var E=require("react"),F=require("@crossmint/client-sdk-base");var tt=require("react/jsx-runtime");function V(n){var r=n,{onInternalEvent:t}=r,e=k(r,["onInternalEvent"]);let{getUrl:a,listenToEvents:m,listenToInternalEvents:u}=(0,F.crossmintIFrameService)(e),[d,o]=(0,E.useState)(0),[i]=(0,E.useState)(a(e));return(0,E.useEffect)(()=>{let c=m(s=>{var h;return(h=e.onEvent)==null?void 0:h.call(e,s.data)});return()=>{c()}},[]),(0,E.useEffect)(()=>{let c=u(s=>{let{type:h,payload:_}=s.data;h===F.IncomingInternalEvents.UI_HEIGHT_CHANGED&&o(_.height),t==null||t(s.data)});return()=>{c()}},[]),(0,tt.jsx)("iframe",{src:i,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none !important",border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${d}px`}})}var nt=require("react/jsx-runtime");function Y(t){let{emitInternalEvent:e}=(0,l.crossmintIFrameService)(t),{signer:n,paymentMethod:r}=t;function a(o){let{type:i,payload:c}=o;if(i===l.IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=c;console.log("[Crossmint] Received incoming transaction",s),m(s)}if(i===l.IncomingInternalEvents.CRYPTO_CHAIN_SWITCH){let{chain:s}=c;console.log("[Crossmint] Received change of chain",s);let h=n.handleChainSwitch;if(h==null)throw new Error("switchNetwork function should have been defined");h(s)}}function m(o){return w(this,null,function*(){try{let i;switch(r){case"SOL":i=yield u(n,o);break;case"ETH":i=yield d(n,o);break;default:throw new Error(`Unsupported payment method ${r}`)}console.log("[Crossmint] Signed and sent transaction",i),e({type:l.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:i}})}catch(i){console.error("[Crossmint] Failed to sign and send transaction",i),e({type:l.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function u(o,i){return w(this,null,function*(){let{Transaction:c}=yield import("@solana/web3.js"),s=c.from(et.default.decode(i));return console.log("[Crossmint] Deserialized SOL transaction",s),yield o.signAndSendTransaction(s)})}function d(o,i){return w(this,null,function*(){let{parse:c}=yield import("@ethersproject/transactions"),s=c(i);return console.log("[Crossmint] Deserialized ETH transaction",s),yield o.signAndSendTransaction(s)})}return A(()=>{e({type:"params-update",payload:(0,l.embeddedCheckoutPropsToUpdatableParamsPayload)(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs,..."chain"in t.signer?[t.signer.chain]:[]]),(0,nt.jsx)(V,p({onInternalEvent:a},t))}var it=require("react/jsx-runtime");function rt(t){if(!(0,ot.isCryptoEmbeddedCheckoutPropsWithSigner)(t))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return(0,it.jsx)(Y,p({},t))}var g=require("react"),O=require("@crossmint/client-sdk-base"),at=require("react/jsx-runtime");function st(t){let[e,n]=(0,g.useState)(0),{getIframeUrl:r,listenToEvents:a,emitQueryParams:m}=(0,O.crossmintPaymentService_OLD)(t),{listenToEvents:u}=(0,O.crossmintUiService_OLD)({environment:t.environment}),[d]=(0,g.useState)(r());return(0,g.useEffect)(()=>{let o=a(i=>{var c;return(c=t.onEvent)==null?void 0:c.call(t,i.data)});return()=>{o&&o()}},[]),(0,g.useEffect)(()=>{let o=u(i=>{let{type:c,payload:s}=i.data;switch(c){case"ui:height.changed":n(s.height);break;default:return}});return()=>{o&&o()}},[]),(0,g.useEffect)(()=>{m({recipient:t.recipient,mintConfig:t.mintConfig,locale:t.locale,currency:t.currency,whPassThroughArgs:t.whPassThroughArgs})},[t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs]),(0,at.jsx)("iframe",{src:d,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${e}px`}})}var G=require("react/jsx-runtime");function At(t){if((0,L.isFiatEmbeddedCheckoutProps)(t))return(0,G.jsx)(st,p({},t));if((0,L.isCryptoEmbeddedCheckoutProps)(t))return(0,G.jsx)(rt,p({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}var ut=require("react"),ht=require("react"),y=require("@crossmint/client-sdk-base");var R=require("react");function W(){let[t,e]=(0,R.useState)(!0);return(0,R.useEffect)(()=>{e(!1)},[]),{isServerSideRendering:t}}var mt=require("react-jss"),Vt="#1e1e1e",ct=t=>t==="light",dt=t=>({buttonBgColor:ct(t)?"white":Vt,paragraphColor:ct(t)?"black":"white"}),lt=(0,mt.createUseStyles)({"@global":{"@import":"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')"},crossmintButton:{display:"flex","flex-direction":"row","align-items":"center",padding:"0.875rem 0.875rem","font-weight":"900",transition:"opacity ease-in-out 0.25s","border-radius":"0.5rem","font-family":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',outline:"none",border:"none","box-shadow":"0px 8px 15px rgba(0, 0, 0, 0.1)","justify-content":"center",background:({buttonBgColor:t})=>t,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:t})=>t,margin:"0"}});var f=require("react/jsx-runtime");function Yt(t){let z=t,{className:e,disabled:n,onClick:r,style:a,tabIndex:m,theme:u="dark",mintTo:d,emailTo:o,listingId:i,auctionId:c,showOverlay:s=!0,mintConfig:h,whPassThroughArgs:_,environment:pt,paymentMethod:P,preferredSigninMethod:ft,dismissOverlayOnClick:gt,prepay:Ct,locale:$="en-US",currency:Et="usd",successCallbackURL:yt="",failureCallbackURL:bt="",loginEmail:Pt="",projectId:St,getButtonText:M,checkoutProps:q={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=z,D=k(z,["className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps"]),It="clientId"in D?D.clientId:D.collectionId,[S,kt]=(0,ht.useState)(!1),{isServerSideRendering:Tt}=W(),{connect:wt}=(0,y.crossmintModalService)({clientId:It,projectId:St,showOverlay:s,dismissOverlayOnClick:gt,setConnecting:kt,libVersion:C,environment:pt,clientName:y.clientNames.reactUi,locale:$,currency:Et,successCallbackURL:yt,failureCallbackURL:bt,loginEmail:Pt}),{getButtonText:vt,handleClick:xt}=(0,y.crossmintPayButtonService)({onClick:r,connecting:S,paymentMethod:P,locale:$,checkoutProps:q}),Nt=Ot=>xt(Ot,()=>{wt(h,d,o,i,_,P,ft,Ct,q)}),H=lt(dt(u)),Ft=(0,ut.useMemo)(()=>(0,f.jsx)("span",{className:H.crossmintParagraph,role:"button-paragraph",children:M!=null?M(S,P||"fiat"):vt(S)}),[S,M,P]);return(0,f.jsx)(f.Fragment,{children:!Tt&&(0,f.jsxs)("button",{className:`${H.crossmintButton} ${e||""}`,disabled:n,onClick:Nt,style:p({},a),tabIndex:m,children:[(0,f.jsx)("img",{className:H.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),Ft]})})}var B=require("@crossmint/client-sdk-base");0&&(module.exports={CrossmintEvents,CrossmintNFTCollectionView,CrossmintNFTDetail,CrossmintPayButton,CrossmintPaymentElement,useCrossmintEvents});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatPaymentElement_OLD.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts"],"sourcesContent":["export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n","import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.1.5\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatPaymentElement_OLD } from \"./fiat/FiatPaymentElement_OLD\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatPaymentElement_OLD {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\nimport bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import { useEffect, useState } from \"react\";\n\nimport { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from \"@crossmint/client-sdk-base\";\nimport { CrossmintEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none !important\",\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\nimport { crossmintPaymentService_OLD, crossmintUiService_OLD } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatPaymentElement_OLD(props: FiatEmbeddedCheckoutProps) {\n const [height, setHeight] = useState(0);\n const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService_OLD(props);\n const { listenToEvents: listenToUiEvents } = crossmintUiService_OLD({ environment: props.environment });\n const [url] = useState(getIframeUrl());\n\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n const clearListener = listenToUiEvents((event: MessageEvent<any>) => {\n const { type, payload } = event.data;\n\n switch (type) {\n case \"ui:height.changed\":\n setHeight(payload.height);\n break;\n default:\n return;\n }\n });\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n emitQueryParams({\n recipient: props.recipient,\n mintConfig: props.mintConfig,\n locale: props.locale,\n currency: props.currency,\n whPassThroughArgs: props.whPassThroughArgs,\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n ></iframe>\n );\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService, CheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n"],"mappings":"ksCAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,sEAAAE,GAAA,uBAAAC,GAAA,uBAAAC,GAAA,4BAAAC,GAAA,6DAAAC,GAAAN,ICAA,IAAAO,EAA2E,sCCApE,IAAMC,EAAc,QDWnB,IAAAC,EAAA,6BAND,SAASC,GAA2BC,EAA+B,IACtE,qCAAkCA,CAAK,EAEvC,IAAMC,KAAM,2BAAwBD,EAAOE,CAAW,EAEtD,SACI,OAAC,UACG,IAAKD,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,IAAAE,EAAmE,sCAW3D,IAAAC,EAAA,6BAND,SAASC,GAAmBC,EAAuB,IACtD,qCAAkCA,CAAK,EAEvC,IAAMC,KAAM,mBAAgBD,EAAOE,CAAW,EAE9C,SACI,OAAC,UACG,IAAKD,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,IAAAE,EAIO,sC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Yf,GAAiB,MAAM,EACjDqB,GAAsBN,CAAU,EAC1C,EAEL,CAACA,EAAYL,EAAeV,CAAa,CAAC,EAE7C,SACI,mBACK,UAACiB,OACE,QAAC,UACG,UAAW,GAAGQ,EAAQ,eAAe,IAAIvC,GAAa,EAAE,GACxD,SAAUC,EACV,QAASoC,GACT,MAAOM,EAAA,GAAKxC,GACZ,SAAUC,EAEV,oBAAC,OACG,UAAWmC,EAAQ,aACnB,IAAI,qDACJ,IAAI,iBACR,EACCG,IACL,EAER,CAER,CVhIA,IAAAE,EAAoD","names":["src_exports","__export","CrossmintNFTCollectionView","CrossmintNFTDetail","CrossmintPayButton","CrossmintPaymentElement","__toCommonJS","import_client_sdk_base","LIB_VERSION","import_jsx_runtime","CrossmintNFTCollectionView","props","src","LIB_VERSION","import_client_sdk_base","import_jsx_runtime","CrossmintNFTDetail","props","src","LIB_VERSION","import_client_sdk_base","import_client_sdk_base","import_lodash","import_react","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","isEqual","import_bs58","import_client_sdk_base","import_react","import_client_sdk_base","import_jsx_runtime","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","height","setHeight","url","clearListener","event","type","payload","import_jsx_runtime","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","signer","paymentMethod","onInternalEvent","event","type","payload","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","CrossmintEmbeddedCheckoutIFrame","__spreadValues","import_jsx_runtime","CrossmintCryptoEmbeddedCheckout","props","CryptoEmbeddedCheckoutIFrame","__spreadValues","import_react","import_client_sdk_base","import_jsx_runtime","CrossmintFiatPaymentElement_OLD","props","height","setHeight","getIframeUrl","listenToEvents","emitQueryParams","listenToUiEvents","url","clearListener","event","_a","type","payload","import_jsx_runtime","CrossmintPaymentElement","props","CrossmintFiatPaymentElement_OLD","__spreadValues","CrossmintCryptoEmbeddedCheckout","import_react","import_client_sdk_base","import_react","useEnvironment","isServerSideRendering","setIsServerSideRendering","import_react_jss","DARK_BG","themeIsLight","theme","formatProps","useStyles","buttonBgColor","paragraphColor","import_jsx_runtime","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","isServerSideRendering","useEnvironment","connect","LIB_VERSION","getButtonTextInternal","handleClick","_handleClick","event","classes","useStyles","formatProps","content","__spreadValues","import_client_sdk_base"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatPaymentElement_OLD.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts"],"sourcesContent":["export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n","import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.1.7\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatPaymentElement_OLD } from \"./fiat/FiatPaymentElement_OLD\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatPaymentElement_OLD {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\nimport bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import { useEffect, useState } from \"react\";\n\nimport { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from \"@crossmint/client-sdk-base\";\nimport { CrossmintEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none !important\",\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\nimport { crossmintPaymentService_OLD, crossmintUiService_OLD } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatPaymentElement_OLD(props: FiatEmbeddedCheckoutProps) {\n const [height, setHeight] = useState(0);\n const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService_OLD(props);\n const { listenToEvents: listenToUiEvents } = crossmintUiService_OLD({ environment: props.environment });\n const [url] = useState(getIframeUrl());\n\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n const clearListener = listenToUiEvents((event: MessageEvent<any>) => {\n const { type, payload } = event.data;\n\n switch (type) {\n case \"ui:height.changed\":\n setHeight(payload.height);\n break;\n default:\n return;\n }\n });\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n emitQueryParams({\n recipient: props.recipient,\n mintConfig: props.mintConfig,\n locale: props.locale,\n currency: props.currency,\n whPassThroughArgs: props.whPassThroughArgs,\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n ></iframe>\n );\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"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EAAM,aAE5D,CAACG,EAAYC,EAAa,KAAI,aAAS,EAAK,EAC5C,CAAE,sBAAAC,EAAsB,EAAIC,EAAe,EAE3C,CAAE,QAAAC,EAAQ,KAAI,yBAAsB,CACtC,SAAUL,GACV,UAAAL,GACA,YAAAb,EACA,sBAAAM,GACA,cAAAc,GACA,WAAYI,EACZ,YAAArB,GACA,WAAY,cAAY,QACxB,OAAAK,EACA,SAAAC,GACA,mBAAAC,GACA,mBAAAC,GACA,WAAAC,EACJ,CAAC,EAEK,CAAE,cAAea,GAAuB,YAAAC,EAAY,KAAI,6BAA0B,CACpF,QAAAlC,EACA,WAAA2B,EACA,cAAAf,EACA,OAAAI,EACA,cAAAO,CACJ,CAAC,EAEKY,GAAgBC,IAClBF,GAAYE,GAAO,IAAM,CACrBL,GACItB,EACAL,EACAC,EACAC,EACAI,EACAE,EACAC,GACAE,GACAQ,CACJ,CACJ,CAAC,EAECc,EAAUC,GAAUC,GAAYpC,CAAK,CAAC,EAEtCqC,MAAU,YAAQ,OAEhB,OAAC,QAAK,UAAWH,EAAQ,mBAAoB,KAAK,mBAC7C,SAAAf,GAAiB,KACZA,EAAcK,EAAYf,GAAiB,MAAM,EACjDqB,GAAsBN,CAAU,EAC1C,EAEL,CAACA,EAAYL,EAAeV,CAAa,CAAC,EAE7C,SACI,mBACK,UAACiB,OACE,QAAC,UACG,UAAW,GAAGQ,EAAQ,eAAe,IAAIvC,GAAa,EAAE,GACxD,SAAUC,EACV,QAASoC,GACT,MAAOM,EAAA,GAAKxC,GACZ,SAAUC,EAEV,oBAAC,OACG,UAAWmC,EAAQ,aACnB,IAAI,qDACJ,IAAI,iBACR,EACCG,IACL,EAER,CAER,CVjIA,IAAAE,EAAoD","names":["src_exports","__export","CrossmintNFTCollectionView","CrossmintNFTDetail","CrossmintPayButton","CrossmintPaymentElement","__toCommonJS","import_client_sdk_base","LIB_VERSION","import_jsx_runtime","CrossmintNFTCollectionView","props","src","LIB_VERSION","import_client_sdk_base","import_jsx_runtime","CrossmintNFTDetail","props","src","LIB_VERSION","import_client_sdk_base","import_client_sdk_base","import_lodash","import_react","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","isEqual","import_bs58","import_client_sdk_base","import_react","import_client_sdk_base","import_jsx_runtime","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","height","setHeight","url","clearListener","event","type","payload","import_jsx_runtime","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","signer","paymentMethod","onInternalEvent","event","type","payload","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","CrossmintEmbeddedCheckoutIFrame","__spreadValues","import_jsx_runtime","CrossmintCryptoEmbeddedCheckout","props","CryptoEmbeddedCheckoutIFrame","__spreadValues","import_react","import_client_sdk_base","import_jsx_runtime","CrossmintFiatPaymentElement_OLD","props","height","setHeight","getIframeUrl","listenToEvents","emitQueryParams","listenToUiEvents","url","clearListener","event","_a","type","payload","import_jsx_runtime","CrossmintPaymentElement","props","CrossmintFiatPaymentElement_OLD","__spreadValues","CrossmintCryptoEmbeddedCheckout","import_react","import_client_sdk_base","import_react","useEnvironment","isServerSideRendering","setIsServerSideRendering","import_react_jss","DARK_BG","themeIsLight","theme","formatProps","useStyles","buttonBgColor","paragraphColor","import_jsx_runtime","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","isServerSideRendering","useEnvironment","connect","LIB_VERSION","getButtonTextInternal","handleClick","_handleClick","event","classes","useStyles","formatProps","content","__spreadValues","import_client_sdk_base"]}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var lt=Object.defineProperty;var C=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var R=(t,e,n)=>e in t?lt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,h=(t,e)=>{for(var n in e||(e={}))B.call(e,n)&&R(t,n,e[n]);if(C)for(var n of C(e))_.call(e,n)&&R(t,n,e[n]);return t};var E=(t,e)=>{var n={};for(var i in t)B.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&C)for(var i of C(t))e.indexOf(i)<0&&_.call(t,i)&&(n[i]=t[i]);return n};var y=(t,e,n)=>new Promise((i,c)=>{var m=o=>{try{d(n.next(o))}catch(r){c(r)}},l=o=>{try{d(n.throw(o))}catch(r){c(r)}},d=o=>o.done?i(o.value):Promise.resolve(o.value).then(m,l);d((n=n.apply(t,e)).next())});import{assertValidNFTCollectionViewProps as ut,getNFTCollectionViewSrc as ht}from"@crossmint/client-sdk-base";var p="1.1.5";import{jsx as pt}from"react/jsx-runtime";function Qt(t){ut(t);let e=ht(t,p);return pt("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}import{assertValidValidateNFTDetailProps as ft,getNFTDetailSrc as gt}from"@crossmint/client-sdk-base";import{jsx as Ct}from"react/jsx-runtime";function ee(t){ft(t);let e=gt(t,p);return Ct("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}import{isCryptoEmbeddedCheckoutProps as Rt,isFiatEmbeddedCheckoutProps as Bt}from"@crossmint/client-sdk-base";import{isCryptoEmbeddedCheckoutPropsWithSigner as xt}from"@crossmint/client-sdk-base";import Et from"lodash.isequal";import{useEffect as yt,useRef as bt}from"react";function k(t,e){let n=bt(e);yt(()=>{if(e.some((c,m)=>!Et(c,n.current[m])))return n.current=e,t()},[e])}import kt from"bs58";import{IncomingInternalEvents as H,OutgoingInternalEvents as U,crossmintIFrameService as Tt,embeddedCheckoutPropsToUpdatableParamsPayload as wt}from"@crossmint/client-sdk-base";import{useEffect as M,useState as D}from"react";import{IncomingInternalEvents as Pt,crossmintIFrameService as St}from"@crossmint/client-sdk-base";import{jsx as It}from"react/jsx-runtime";function T(n){var i=n,{onInternalEvent:t}=i,e=E(i,["onInternalEvent"]);let{getUrl:c,listenToEvents:m,listenToInternalEvents:l}=St(e),[d,o]=D(0),[r]=D(c(e));return M(()=>{let a=m(s=>{var u;return(u=e.onEvent)==null?void 0:u.call(e,s.data)});return()=>{a()}},[]),M(()=>{let a=l(s=>{let{type:u,payload:b}=s.data;u===Pt.UI_HEIGHT_CHANGED&&o(b.height),t==null||t(s.data)});return()=>{a()}},[]),It("iframe",{src:r,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none !important",border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${d}px`}})}import{jsx as vt}from"react/jsx-runtime";function w(t){let{emitInternalEvent:e}=Tt(t),{signer:n,paymentMethod:i}=t;function c(o){let{type:r,payload:a}=o;if(r===H.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=a;console.log("[Crossmint] Received incoming transaction",s),m(s)}if(r===H.CRYPTO_CHAIN_SWITCH){let{chain:s}=a;console.log("[Crossmint] Received change of chain",s);let u=n.handleChainSwitch;if(u==null)throw new Error("switchNetwork function should have been defined");u(s)}}function m(o){return y(this,null,function*(){try{let r;switch(i){case"SOL":r=yield l(n,o);break;case"ETH":r=yield d(n,o);break;default:throw new Error(`Unsupported payment method ${i}`)}console.log("[Crossmint] Signed and sent transaction",r),e({type:U.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:r}})}catch(r){console.error("[Crossmint] Failed to sign and send transaction",r),e({type:U.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function l(o,r){return y(this,null,function*(){let{Transaction:a}=yield import("@solana/web3.js"),s=a.from(kt.decode(r));return console.log("[Crossmint] Deserialized SOL transaction",s),yield o.signAndSendTransaction(s)})}function d(o,r){return y(this,null,function*(){let{parse:a}=yield import("@ethersproject/transactions"),s=a(r);return console.log("[Crossmint] Deserialized ETH transaction",s),yield o.signAndSendTransaction(s)})}return k(()=>{e({type:"params-update",payload:wt(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs,..."chain"in t.signer?[t.signer.chain]:[]]),vt(T,h({onInternalEvent:c},t))}import{jsx as Nt}from"react/jsx-runtime";function A(t){if(!xt(t))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return Nt(w,h({},t))}import{useEffect as v,useState as V}from"react";import{crossmintPaymentService_OLD as Ft,crossmintUiService_OLD as Ot}from"@crossmint/client-sdk-base";import{jsx as Lt}from"react/jsx-runtime";function Y(t){let[e,n]=V(0),{getIframeUrl:i,listenToEvents:c,emitQueryParams:m}=Ft(t),{listenToEvents:l}=Ot({environment:t.environment}),[d]=V(i());return v(()=>{let o=c(r=>{var a;return(a=t.onEvent)==null?void 0:a.call(t,r.data)});return()=>{o&&o()}},[]),v(()=>{let o=l(r=>{let{type:a,payload:s}=r.data;switch(a){case"ui:height.changed":n(s.height);break;default:return}});return()=>{o&&o()}},[]),v(()=>{m({recipient:t.recipient,mintConfig:t.mintConfig,locale:t.locale,currency:t.currency,whPassThroughArgs:t.whPassThroughArgs})},[t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs]),Lt("iframe",{src:d,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${e}px`}})}import{jsx as G}from"react/jsx-runtime";function Ae(t){if(Bt(t))return G(Y,h({},t));if(Rt(t))return G(A,h({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}import{useMemo as Ut}from"react";import{useState as At}from"react";import{clientNames as Vt,crossmintModalService as Yt,crossmintPayButtonService as Gt}from"@crossmint/client-sdk-base";import{useEffect as _t,useState as Mt}from"react";function x(){let[t,e]=Mt(!0);return _t(()=>{e(!1)},[]),{isServerSideRendering:t}}import{createUseStyles as Dt}from"react-jss";var Ht="#1e1e1e",W=t=>t==="light",$=t=>({buttonBgColor:W(t)?"white":Ht,paragraphColor:W(t)?"black":"white"}),q=Dt({"@global":{"@import":"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')"},crossmintButton:{display:"flex","flex-direction":"row","align-items":"center",padding:"0.875rem 0.875rem","font-weight":"900",transition:"opacity ease-in-out 0.25s","border-radius":"0.5rem","font-family":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',outline:"none",border:"none","box-shadow":"0px 8px 15px rgba(0, 0, 0, 0.1)","justify-content":"center",background:({buttonBgColor:t})=>t,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:t})=>t,margin:"0"}});import{Fragment as $t,jsx as N,jsxs as Wt}from"react/jsx-runtime";function rn(t){let L=t,{className:e,disabled:n,onClick:i,style:c,tabIndex:m,theme:l="dark",mintTo:d,emailTo:o,listingId:r,auctionId:a,showOverlay:s=!0,mintConfig:u,whPassThroughArgs:b,environment:z,paymentMethod:f,preferredSigninMethod:J,dismissOverlayOnClick:K,prepay:Q,locale:F="en-US",currency:X="usd",successCallbackURL:Z="",failureCallbackURL:j="",loginEmail:tt="",projectId:et,getButtonText:P,checkoutProps:O={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=L,S=E(L,["className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps"]),nt="clientId"in S?S.clientId:S.collectionId,[g,ot]=At(!1),{isServerSideRendering:rt}=x(),{connect:it}=Yt({clientId:nt,projectId:et,showOverlay:s,dismissOverlayOnClick:K,setConnecting:ot,libVersion:p,environment:z,clientName:Vt.reactUi,locale:F,currency:X,successCallbackURL:Z,failureCallbackURL:j,loginEmail:tt}),{getButtonText:st,handleClick:at}=Gt({onClick:i,connecting:g,paymentMethod:f,locale:F,checkoutProps:O}),ct=dt=>at(dt,()=>{it(u,d,o,r,b,f,J,Q,O)}),I=q($(l)),mt=Ut(()=>N("span",{className:I.crossmintParagraph,role:"button-paragraph",children:P!=null?P(g,f||"fiat"):st(g)}),[g,P,f]);return N($t,{children:!rt&&Wt("button",{className:`${I.crossmintButton} ${e||""}`,disabled:n,onClick:ct,style:h({},c),tabIndex:m,children:[N("img",{className:I.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),mt]})})}import{CrossmintEvents as un,useCrossmintEvents as hn}from"@crossmint/client-sdk-base";export{un as CrossmintEvents,Qt as CrossmintNFTCollectionView,ee as CrossmintNFTDetail,rn as CrossmintPayButton,Ae as CrossmintPaymentElement,hn as useCrossmintEvents};
1
+ var lt=Object.defineProperty;var C=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var R=(t,e,n)=>e in t?lt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,h=(t,e)=>{for(var n in e||(e={}))B.call(e,n)&&R(t,n,e[n]);if(C)for(var n of C(e))_.call(e,n)&&R(t,n,e[n]);return t};var E=(t,e)=>{var n={};for(var i in t)B.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&C)for(var i of C(t))e.indexOf(i)<0&&_.call(t,i)&&(n[i]=t[i]);return n};var y=(t,e,n)=>new Promise((i,c)=>{var m=o=>{try{d(n.next(o))}catch(r){c(r)}},l=o=>{try{d(n.throw(o))}catch(r){c(r)}},d=o=>o.done?i(o.value):Promise.resolve(o.value).then(m,l);d((n=n.apply(t,e)).next())});import{assertValidNFTCollectionViewProps as ut,getNFTCollectionViewSrc as ht}from"@crossmint/client-sdk-base";var p="1.1.7";import{jsx as pt}from"react/jsx-runtime";function Qt(t){ut(t);let e=ht(t,p);return pt("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}import{assertValidValidateNFTDetailProps as ft,getNFTDetailSrc as gt}from"@crossmint/client-sdk-base";import{jsx as Ct}from"react/jsx-runtime";function ee(t){ft(t);let e=gt(t,p);return Ct("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}import{isCryptoEmbeddedCheckoutProps as Rt,isFiatEmbeddedCheckoutProps as Bt}from"@crossmint/client-sdk-base";import{isCryptoEmbeddedCheckoutPropsWithSigner as xt}from"@crossmint/client-sdk-base";import Et from"lodash.isequal";import{useEffect as yt,useRef as bt}from"react";function k(t,e){let n=bt(e);yt(()=>{if(e.some((c,m)=>!Et(c,n.current[m])))return n.current=e,t()},[e])}import kt from"bs58";import{IncomingInternalEvents as H,OutgoingInternalEvents as U,crossmintIFrameService as Tt,embeddedCheckoutPropsToUpdatableParamsPayload as wt}from"@crossmint/client-sdk-base";import{useEffect as M,useState as D}from"react";import{IncomingInternalEvents as Pt,crossmintIFrameService as St}from"@crossmint/client-sdk-base";import{jsx as It}from"react/jsx-runtime";function T(n){var i=n,{onInternalEvent:t}=i,e=E(i,["onInternalEvent"]);let{getUrl:c,listenToEvents:m,listenToInternalEvents:l}=St(e),[d,o]=D(0),[r]=D(c(e));return M(()=>{let a=m(s=>{var u;return(u=e.onEvent)==null?void 0:u.call(e,s.data)});return()=>{a()}},[]),M(()=>{let a=l(s=>{let{type:u,payload:b}=s.data;u===Pt.UI_HEIGHT_CHANGED&&o(b.height),t==null||t(s.data)});return()=>{a()}},[]),It("iframe",{src:r,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none !important",border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${d}px`}})}import{jsx as vt}from"react/jsx-runtime";function w(t){let{emitInternalEvent:e}=Tt(t),{signer:n,paymentMethod:i}=t;function c(o){let{type:r,payload:a}=o;if(r===H.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=a;console.log("[Crossmint] Received incoming transaction",s),m(s)}if(r===H.CRYPTO_CHAIN_SWITCH){let{chain:s}=a;console.log("[Crossmint] Received change of chain",s);let u=n.handleChainSwitch;if(u==null)throw new Error("switchNetwork function should have been defined");u(s)}}function m(o){return y(this,null,function*(){try{let r;switch(i){case"SOL":r=yield l(n,o);break;case"ETH":r=yield d(n,o);break;default:throw new Error(`Unsupported payment method ${i}`)}console.log("[Crossmint] Signed and sent transaction",r),e({type:U.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:r}})}catch(r){console.error("[Crossmint] Failed to sign and send transaction",r),e({type:U.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function l(o,r){return y(this,null,function*(){let{Transaction:a}=yield import("@solana/web3.js"),s=a.from(kt.decode(r));return console.log("[Crossmint] Deserialized SOL transaction",s),yield o.signAndSendTransaction(s)})}function d(o,r){return y(this,null,function*(){let{parse:a}=yield import("@ethersproject/transactions"),s=a(r);return console.log("[Crossmint] Deserialized ETH transaction",s),yield o.signAndSendTransaction(s)})}return k(()=>{e({type:"params-update",payload:wt(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs,..."chain"in t.signer?[t.signer.chain]:[]]),vt(T,h({onInternalEvent:c},t))}import{jsx as Nt}from"react/jsx-runtime";function A(t){if(!xt(t))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return Nt(w,h({},t))}import{useEffect as v,useState as V}from"react";import{crossmintPaymentService_OLD as Ft,crossmintUiService_OLD as Ot}from"@crossmint/client-sdk-base";import{jsx as Lt}from"react/jsx-runtime";function Y(t){let[e,n]=V(0),{getIframeUrl:i,listenToEvents:c,emitQueryParams:m}=Ft(t),{listenToEvents:l}=Ot({environment:t.environment}),[d]=V(i());return v(()=>{let o=c(r=>{var a;return(a=t.onEvent)==null?void 0:a.call(t,r.data)});return()=>{o&&o()}},[]),v(()=>{let o=l(r=>{let{type:a,payload:s}=r.data;switch(a){case"ui:height.changed":n(s.height);break;default:return}});return()=>{o&&o()}},[]),v(()=>{m({recipient:t.recipient,mintConfig:t.mintConfig,locale:t.locale,currency:t.currency,whPassThroughArgs:t.whPassThroughArgs})},[t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs]),Lt("iframe",{src:d,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${e}px`}})}import{jsx as G}from"react/jsx-runtime";function Ae(t){if(Bt(t))return G(Y,h({},t));if(Rt(t))return G(A,h({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}import{useMemo as Ut}from"react";import{useState as At}from"react";import{clientNames as Vt,crossmintModalService as Yt,crossmintPayButtonService as Gt}from"@crossmint/client-sdk-base";import{useEffect as _t,useState as Mt}from"react";function x(){let[t,e]=Mt(!0);return _t(()=>{e(!1)},[]),{isServerSideRendering:t}}import{createUseStyles as Dt}from"react-jss";var Ht="#1e1e1e",W=t=>t==="light",$=t=>({buttonBgColor:W(t)?"white":Ht,paragraphColor:W(t)?"black":"white"}),q=Dt({"@global":{"@import":"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')"},crossmintButton:{display:"flex","flex-direction":"row","align-items":"center",padding:"0.875rem 0.875rem","font-weight":"900",transition:"opacity ease-in-out 0.25s","border-radius":"0.5rem","font-family":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',outline:"none",border:"none","box-shadow":"0px 8px 15px rgba(0, 0, 0, 0.1)","justify-content":"center",background:({buttonBgColor:t})=>t,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:t})=>t,margin:"0"}});import{Fragment as $t,jsx as N,jsxs as Wt}from"react/jsx-runtime";function rn(t){let L=t,{className:e,disabled:n,onClick:i,style:c,tabIndex:m,theme:l="dark",mintTo:d,emailTo:o,listingId:r,auctionId:a,showOverlay:s=!0,mintConfig:u,whPassThroughArgs:b,environment:z,paymentMethod:f,preferredSigninMethod:J,dismissOverlayOnClick:K,prepay:Q,locale:F="en-US",currency:X="usd",successCallbackURL:Z="",failureCallbackURL:j="",loginEmail:tt="",projectId:et,getButtonText:P,checkoutProps:O={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=L,S=E(L,["className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps"]),nt="clientId"in S?S.clientId:S.collectionId,[g,ot]=At(!1),{isServerSideRendering:rt}=x(),{connect:it}=Yt({clientId:nt,projectId:et,showOverlay:s,dismissOverlayOnClick:K,setConnecting:ot,libVersion:p,environment:z,clientName:Vt.reactUi,locale:F,currency:X,successCallbackURL:Z,failureCallbackURL:j,loginEmail:tt}),{getButtonText:st,handleClick:at}=Gt({onClick:i,connecting:g,paymentMethod:f,locale:F,checkoutProps:O}),ct=dt=>at(dt,()=>{it(u,d,o,r,b,f,J,Q,O)}),I=q($(l)),mt=Ut(()=>N("span",{className:I.crossmintParagraph,role:"button-paragraph",children:P!=null?P(g,f||"fiat"):st(g)}),[g,P,f]);return N($t,{children:!rt&&Wt("button",{className:`${I.crossmintButton} ${e||""}`,disabled:n,onClick:ct,style:h({},c),tabIndex:m,children:[N("img",{className:I.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),mt]})})}import{CrossmintEvents as un,useCrossmintEvents as hn}from"@crossmint/client-sdk-base";export{un as CrossmintEvents,Qt as CrossmintNFTCollectionView,ee as CrossmintNFTDetail,rn as CrossmintPayButton,Ae as CrossmintPaymentElement,hn as useCrossmintEvents};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatPaymentElement_OLD.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts","../src/index.ts"],"sourcesContent":["import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.1.5\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatPaymentElement_OLD } from \"./fiat/FiatPaymentElement_OLD\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatPaymentElement_OLD {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\nimport bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import { useEffect, useState } from \"react\";\n\nimport { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from \"@crossmint/client-sdk-base\";\nimport { CrossmintEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none !important\",\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\nimport { crossmintPaymentService_OLD, crossmintUiService_OLD } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatPaymentElement_OLD(props: FiatEmbeddedCheckoutProps) {\n const [height, setHeight] = useState(0);\n const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService_OLD(props);\n const { listenToEvents: listenToUiEvents } = crossmintUiService_OLD({ environment: props.environment });\n const [url] = useState(getIframeUrl());\n\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n const clearListener = listenToUiEvents((event: MessageEvent<any>) => {\n const { type, payload } = event.data;\n\n switch (type) {\n case \"ui:height.changed\":\n setHeight(payload.height);\n break;\n default:\n return;\n }\n });\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n emitQueryParams({\n recipient: props.recipient,\n mintConfig: props.mintConfig,\n locale: props.locale,\n currency: props.currency,\n whPassThroughArgs: props.whPassThroughArgs,\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n ></iframe>\n );\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService, CheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n","export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n"],"mappings":"0sBAAA,OAAS,qCAAAA,GAAmC,2BAAAC,OAA+B,6BCApE,IAAMC,EAAc,QDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,OAAS,qCAAAG,GAAmC,mBAAAC,OAAuB,6BAW3D,cAAAC,OAAA,oBAND,SAASC,GAAmBC,EAAuB,CACtDC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAgBH,EAAOI,CAAW,EAE9C,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,OAEI,iCAAAG,GACA,+BAAAC,OACG,6BCJP,OAAsC,2CAAAC,OAA+C,6BCArF,OAAOC,OAAa,iBACpB,OAAyC,aAAAC,GAAW,UAAAC,OAAc,QAEnD,SAARC,EAA+BC,EAA0BC,EAAoC,CAChG,IAAMC,EAAkBJ,GAAOG,CAAY,EAE3CJ,GAAU,IAAM,CAGZ,GAFmBI,EAAa,KAAK,CAACE,EAAKC,IAAM,CAACR,GAAQO,EAAKD,EAAgB,QAAQE,CAAC,CAAC,CAAC,EAGtF,OAAAF,EAAgB,QAAUD,EACnBD,EAAS,CAExB,EAAG,CA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,GAAiB,MAAM,EACjDwB,GAAsBT,CAAU,EAC1C,EAEL,CAACA,EAAYL,EAAeV,CAAa,CAAC,EAE7C,OACInB,EAAAD,GAAA,CACK,UAACsC,IACEpC,GAAC,UACG,UAAW,GAAG+C,EAAQ,eAAe,IAAI3C,GAAa,EAAE,GACxD,SAAUC,EACV,QAASwC,GACT,MAAOO,EAAA,GAAK7C,GACZ,SAAUC,EAEV,UAAAT,EAAC,OACG,UAAWgD,EAAQ,aACnB,IAAI,qDACJ,IAAI,iBACR,EACCG,IACL,EAER,CAER,CGhIA,OAAS,mBAAAG,GAAiB,sBAAAC,OAA0B","names":["assertValidNFTCollectionViewProps","getNFTCollectionViewSrc","LIB_VERSION","jsx","CrossmintNFTCollectionView","props","assertValidNFTCollectionViewProps","src","getNFTCollectionViewSrc","LIB_VERSION","assertValidValidateNFTDetailProps","getNFTDetailSrc","jsx","CrossmintNFTDetail","props","assertValidValidateNFTDetailProps","src","getNFTDetailSrc","LIB_VERSION","isCryptoEmbeddedCheckoutProps","isFiatEmbeddedCheckoutProps","isCryptoEmbeddedCheckoutPropsWithSigner","isEqual","useEffect","useRef","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","bs58","IncomingInternalEvents","OutgoingInternalEvents","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","useEffect","useState","IncomingInternalEvents","crossmintIFrameService","jsx","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","crossmintIFrameService","height","setHeight","useState","url","useEffect","clearListener","event","type","payload","IncomingInternalEvents","jsx","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","signer","paymentMethod","onInternalEvent","event","type","payload","IncomingInternalEvents","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","OutgoingInternalEvents","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintCryptoEmbeddedCheckout","props","isCryptoEmbeddedCheckoutPropsWithSigner","CryptoEmbeddedCheckoutIFrame","__spreadValues","useEffect","useState","crossmintPaymentService_OLD","crossmintUiService_OLD","jsx","CrossmintFiatPaymentElement_OLD","props","height","setHeight","getIframeUrl","listenToEvents","emitQueryParams","listenToUiEvents","url","clearListener","event","_a","type","payload","jsx","CrossmintPaymentElement","props","isFiatEmbeddedCheckoutProps","CrossmintFiatPaymentElement_OLD","__spreadValues","isCryptoEmbeddedCheckoutProps","CrossmintCryptoEmbeddedCheckout","useMemo","useState","clientNames","crossmintModalService","crossmintPayButtonService","useEffect","useState","useEnvironment","isServerSideRendering","setIsServerSideRendering","createUseStyles","DARK_BG","themeIsLight","theme","formatProps","useStyles","buttonBgColor","paragraphColor","Fragment","jsx","jsxs","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","useState","isServerSideRendering","useEnvironment","connect","crossmintModalService","LIB_VERSION","clientNames","getButtonTextInternal","handleClick","crossmintPayButtonService","_handleClick","event","classes","useStyles","formatProps","content","useMemo","__spreadValues","CrossmintEvents","useCrossmintEvents"]}
1
+ {"version":3,"sources":["../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatPaymentElement_OLD.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts","../src/index.ts"],"sourcesContent":["import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.1.7\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatPaymentElement_OLD } from \"./fiat/FiatPaymentElement_OLD\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatPaymentElement_OLD {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\nimport bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import { useEffect, useState } from \"react\";\n\nimport { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from \"@crossmint/client-sdk-base\";\nimport { CrossmintEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none !important\",\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\nimport { crossmintPaymentService_OLD, crossmintUiService_OLD } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatPaymentElement_OLD(props: FiatEmbeddedCheckoutProps) {\n const [height, setHeight] = useState(0);\n const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService_OLD(props);\n const { listenToEvents: listenToUiEvents } = crossmintUiService_OLD({ environment: props.environment });\n const [url] = useState(getIframeUrl());\n\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n const clearListener = listenToUiEvents((event: MessageEvent<any>) => {\n const { type, payload } = event.data;\n\n switch (type) {\n case \"ui:height.changed\":\n setHeight(payload.height);\n break;\n default:\n return;\n }\n });\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n emitQueryParams({\n recipient: props.recipient,\n mintConfig: props.mintConfig,\n locale: props.locale,\n currency: props.currency,\n whPassThroughArgs: props.whPassThroughArgs,\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n ></iframe>\n );\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n","export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n"],"mappings":"0sBAAA,OAAS,qCAAAA,GAAmC,2BAAAC,OAA+B,6BCApE,IAAMC,EAAc,QDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,OAAS,qCAAAG,GAAmC,mBAAAC,OAAuB,6BAW3D,cAAAC,OAAA,oBAND,SAASC,GAAmBC,EAAuB,CACtDC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAgBH,EAAOI,CAAW,EAE9C,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,OAEI,iCAAAG,GACA,+BAAAC,OACG,6BCJP,OAAsC,2CAAAC,OAA+C,6BCArF,OAAOC,OAAa,iBACpB,OAAyC,aAAAC,GAAW,UAAAC,OAAc,QAEnD,SAARC,EAA+BC,EAA0BC,EAAoC,C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C,EACAI,EACAE,EACAC,EACAE,EACAQ,CACJ,CACJ,CAAC,EAECkB,EAAUC,EAAUC,EAAYxC,CAAK,CAAC,EAEtCyC,GAAUC,GAAQ,IAEhBpD,EAAC,QAAK,UAAWgD,EAAQ,mBAAoB,KAAK,mBAC7C,SAAAnB,GAAiB,KACZA,EAAcK,EAAYf,GAAiB,MAAM,EACjDwB,GAAsBT,CAAU,EAC1C,EAEL,CAACA,EAAYL,EAAeV,CAAa,CAAC,EAE7C,OACInB,EAAAD,GAAA,CACK,UAACsC,IACEpC,GAAC,UACG,UAAW,GAAG+C,EAAQ,eAAe,IAAI3C,GAAa,EAAE,GACxD,SAAUC,EACV,QAASwC,GACT,MAAOO,EAAA,GAAK7C,GACZ,SAAUC,EAEV,UAAAT,EAAC,OACG,UAAWgD,EAAQ,aACnB,IAAI,qDACJ,IAAI,iBACR,EACCG,IACL,EAER,CAER,CGjIA,OAAS,mBAAAG,GAAiB,sBAAAC,OAA0B","names":["assertValidNFTCollectionViewProps","getNFTCollectionViewSrc","LIB_VERSION","jsx","CrossmintNFTCollectionView","props","assertValidNFTCollectionViewProps","src","getNFTCollectionViewSrc","LIB_VERSION","assertValidValidateNFTDetailProps","getNFTDetailSrc","jsx","CrossmintNFTDetail","props","assertValidValidateNFTDetailProps","src","getNFTDetailSrc","LIB_VERSION","isCryptoEmbeddedCheckoutProps","isFiatEmbeddedCheckoutProps","isCryptoEmbeddedCheckoutPropsWithSigner","isEqual","useEffect","useRef","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","bs58","IncomingInternalEvents","OutgoingInternalEvents","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","useEffect","useState","IncomingInternalEvents","crossmintIFrameService","jsx","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","crossmintIFrameService","height","setHeight","useState","url","useEffect","clearListener","event","type","payload","IncomingInternalEvents","jsx","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","signer","paymentMethod","onInternalEvent","event","type","payload","IncomingInternalEvents","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","OutgoingInternalEvents","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintCryptoEmbeddedCheckout","props","isCryptoEmbeddedCheckoutPropsWithSigner","CryptoEmbeddedCheckoutIFrame","__spreadValues","useEffect","useState","crossmintPaymentService_OLD","crossmintUiService_OLD","jsx","CrossmintFiatPaymentElement_OLD","props","height","setHeight","getIframeUrl","listenToEvents","emitQueryParams","listenToUiEvents","url","clearListener","event","_a","type","payload","jsx","CrossmintPaymentElement","props","isFiatEmbeddedCheckoutProps","CrossmintFiatPaymentElement_OLD","__spreadValues","isCryptoEmbeddedCheckoutProps","CrossmintCryptoEmbeddedCheckout","useMemo","useState","clientNames","crossmintModalService","crossmintPayButtonService","useEffect","useState","useEnvironment","isServerSideRendering","setIsServerSideRendering","createUseStyles","DARK_BG","themeIsLight","theme","formatProps","useStyles","buttonBgColor","paragraphColor","Fragment","jsx","jsxs","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","useState","isServerSideRendering","useEnvironment","connect","crossmintModalService","LIB_VERSION","clientNames","getButtonTextInternal","handleClick","crossmintPayButtonService","_handleClick","event","classes","useStyles","formatProps","content","useMemo","__spreadValues","CrossmintEvents","useCrossmintEvents"]}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "author": "Paella Labs Inc",
3
3
  "dependencies": {
4
- "@crossmint/client-sdk-base": "1.1.8",
5
- "@crossmint/common-sdk-base": "0.0.6",
4
+ "@crossmint/client-sdk-base": "1.1.10",
5
+ "@crossmint/common-sdk-base": "0.0.9",
6
6
  "@ethersproject/transactions": "5.7.0",
7
7
  "@solana/web3.js": "1.78.5",
8
8
  "bs58": "5.0.0",
@@ -49,6 +49,5 @@
49
49
  "sideEffects": false,
50
50
  "type": "module",
51
51
  "types": "./dist/index.d.ts",
52
- "version": "1.1.5",
53
- "gitHead": "23dfa1bcfd729fbdc0f073b342c99b7f6539d04e"
52
+ "version": "1.1.7"
54
53
  }
@@ -2,10 +2,11 @@ import { CSSProperties, MouseEvent, useMemo } from "react";
2
2
  import { useState } from "react";
3
3
 
4
4
  import {
5
+ CheckoutProps,
5
6
  CrossmintPayButtonProps,
6
7
  clientNames,
7
8
  crossmintModalService,
8
- crossmintPayButtonService, CheckoutProps,
9
+ crossmintPayButtonService,
9
10
  } from "@crossmint/client-sdk-base";
10
11
 
11
12
  import { LIB_VERSION } from "../../consts/version";
@@ -78,7 +79,7 @@ export function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {
78
79
  connecting,
79
80
  paymentMethod,
80
81
  locale,
81
- checkoutProps
82
+ checkoutProps,
82
83
  });
83
84
 
84
85
  const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>
@@ -0,0 +1,44 @@
1
+ import { CSSProperties, MouseEvent } from "react";
2
+
3
+ import { CrossmintVerificationButtonProps, crossmintVerificationService } from "@crossmint/client-sdk-base";
4
+ import { PopupWindow } from "@crossmint/client-sdk-window";
5
+
6
+ import { formatProps, useStyles } from "./styles";
7
+
8
+ export type CrossmintVerificationButtonReactProps = CrossmintVerificationButtonProps & {
9
+ onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
10
+ style?: CSSProperties;
11
+ children?: React.ReactNode;
12
+ className?: string;
13
+ };
14
+
15
+ export function CrossmintVerificationButton(props: CrossmintVerificationButtonReactProps) {
16
+ const { getUrl } = crossmintVerificationService({
17
+ collectionId: props.collectionId,
18
+ scopes: props.scopes,
19
+ environment: props.environment,
20
+ fields: props.fields,
21
+ });
22
+
23
+ // TODO: Do we want to support themes?
24
+ const classes = useStyles(formatProps("dark"));
25
+
26
+ async function onClick() {
27
+ PopupWindow.init(getUrl(), { width: 400, height: 666 });
28
+ }
29
+
30
+ return (
31
+ <button
32
+ onClick={onClick}
33
+ className={`${classes.crossmintButton} ${props.className || ""}`}
34
+ style={{ ...props.style }}
35
+ >
36
+ <img
37
+ className={classes.crossmintImg}
38
+ src="https://www.crossmint.io/assets/crossmint/logo.svg"
39
+ alt="Crossmint logo"
40
+ />
41
+ {props.children}
42
+ </button>
43
+ );
44
+ }
@@ -1 +1,2 @@
1
1
  export * from "./CrossmintPayButton";
2
+ // export * from "./CrossmintVerificationButton";
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.1.5";
1
+ export const LIB_VERSION = "1.1.7";