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

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 Ot=Object.create;var b=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols,_t=Object.getPrototypeOf,A=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,u=(t,e)=>{for(var n in e||(e={}))A.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)A.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 Dt=(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 s of Bt(e))!A.call(t,s)&&s!==n&&b(t,s,{get:()=>e[s],enumerable:!(r=Rt(e,s))||r.enumerable});return t};var T=(t,e,n)=>(n=t!=null?Ot(_t(t)):{},Q(e||!t||!t.__esModule?b(n,"default",{value:t,enumerable:!0}):n,t)),Mt=t=>Q(b({},"__esModule",{value:!0}),t);var v=(t,e,n)=>new Promise((r,s)=>{var m=o=>{try{d(n.next(o))}catch(i){s(i)}},l=o=>{try{d(n.throw(o))}catch(i){s(i)}},d=o=>o.done?r(o.value):Promise.resolve(o.value).then(m,l);d((n=n.apply(t,e)).next())});var Yt={};Dt(Yt,{CrossmintEvents:()=>B.CrossmintEvents,CrossmintNFTCollectionView:()=>Ut,CrossmintNFTDetail:()=>At,CrossmintPayButton:()=>Gt,CrossmintPaymentElement:()=>Ht,useCrossmintEvents:()=>B.useCrossmintEvents});module.exports=Mt(Yt);var w=require("@crossmint/client-sdk-base");var C="1.1.2";var X=require("react/jsx-runtime");function Ut(t){(0,w.assertValidNFTCollectionViewProps)(t);let e=(0,w.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 At(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 O=require("@crossmint/client-sdk-base");var ot=require("@crossmint/client-sdk-base");var j=T(require("lodash.isequal"),1),N=require("react");function H(t,e){let n=(0,N.useRef)(e);(0,N.useEffect)(()=>{if(e.some((s,m)=>!(0,j.default)(s,n.current[m])))return n.current=e,t()},[e])}var et=T(require("bs58"),1),p=require("@crossmint/client-sdk-base");var y=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:s,listenToEvents:m,listenToInternalEvents:l}=(0,F.crossmintIFrameService)(e),[d,o]=(0,y.useState)(0),[i]=(0,y.useState)(s(e));return(0,y.useEffect)(()=>{let c=m(a=>{var g;return(g=e.onEvent)==null?void 0:g.call(e,a.data)});return()=>{c()}},[]),(0,y.useEffect)(()=>{let c=l(a=>{let{type:g,payload:_}=a.data;g===F.IncomingInternalEvents.UI_HEIGHT_CHANGED&&o(_.height),t==null||t(a.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 G(t){let{emitInternalEvent:e}=(0,p.crossmintIFrameService)(t),{signer:n,paymentMethod:r}=t;function s(o){let{type:i,payload:c}=o;if(i===p.IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:a}=c;console.log("[Crossmint] Received incoming transaction",a),m(a)}}function m(o){return v(this,null,function*(){try{let i;switch(r){case"SOL":i=yield l(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:p.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:i}})}catch(i){console.error("[Crossmint] Failed to sign and send transaction",i),e({type:p.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function l(o,i){return v(this,null,function*(){let{Transaction:c}=yield import("@solana/web3.js"),a=c.from(et.default.decode(i));return console.log("[Crossmint] Deserialized SOL transaction",a),yield o.signAndSendTransaction(a)})}function d(o,i){return v(this,null,function*(){let{parse:c}=yield import("@ethersproject/transactions"),a=c(i);return console.log("[Crossmint] Deserialized ETH transaction",a),yield o.signAndSendTransaction(a)})}return H(()=>{e({type:"params-update",payload:(0,p.embeddedCheckoutPropsToUpdatableParamsPayload)(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs]),(0,nt.jsx)(V,u({onInternalEvent:s},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)(G,u({},t))}var f=require("react"),L=require("@crossmint/client-sdk-base"),at=require("react/jsx-runtime");function st(t){let[e,n]=(0,f.useState)(0),{getIframeUrl:r,listenToEvents:s,emitQueryParams:m}=(0,L.crossmintPaymentService_OLD)(t),{listenToEvents:l}=(0,L.crossmintUiService_OLD)({environment:t.environment}),[d]=(0,f.useState)(r());return(0,f.useEffect)(()=>{let o=s(i=>{var c;return(c=t.onEvent)==null?void 0:c.call(t,i.data)});return()=>{o&&o()}},[]),(0,f.useEffect)(()=>{let o=l(i=>{let{type:c,payload:a}=i.data;switch(c){case"ui:height.changed":n(a.height);break;default:return}});return()=>{o&&o()}},[]),(0,f.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 Y=require("react/jsx-runtime");function Ht(t){if((0,O.isFiatEmbeddedCheckoutProps)(t))return(0,Y.jsx)(st,u({},t));if((0,O.isCryptoEmbeddedCheckoutProps)(t))return(0,Y.jsx)(rt,u({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}var ut=require("react"),pt=require("react"),E=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 h=require("react/jsx-runtime");function Gt(t){let z=t,{className:e,disabled:n,onClick:r,style:s,tabIndex:m,theme:l="dark",mintTo:d,emailTo:o,listingId:i,auctionId:c,showOverlay:a=!0,mintConfig:g,whPassThroughArgs:_,environment:ht,paymentMethod:P,preferredSigninMethod:ft,dismissOverlayOnClick:gt,prepay:Ct,locale:$="en-US",currency:yt="usd",successCallbackURL:Et="",failureCallbackURL:bt="",loginEmail:Pt="",projectId:St,getButtonText:D,checkoutProps:q={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=z,M=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 M?M.clientId:M.collectionId,[S,kt]=(0,pt.useState)(!1),{isServerSideRendering:Tt}=W(),{connect:vt}=(0,E.crossmintModalService)({clientId:It,projectId:St,showOverlay:a,dismissOverlayOnClick:gt,setConnecting:kt,libVersion:C,environment:ht,clientName:E.clientNames.reactUi,locale:$,currency:yt,successCallbackURL:Et,failureCallbackURL:bt,loginEmail:Pt}),{getButtonText:wt,handleClick:xt}=(0,E.crossmintPayButtonService)({onClick:r,connecting:S,paymentMethod:P,locale:$,checkoutProps:q}),Nt=Lt=>xt(Lt,()=>{vt(g,d,o,i,_,P,ft,Ct,q)}),U=lt(dt(l)),Ft=(0,ut.useMemo)(()=>(0,h.jsx)("span",{className:U.crossmintParagraph,role:"button-paragraph",children:D!=null?D(S,P||"fiat"):wt(S)}),[S,D,P]);return(0,h.jsx)(h.Fragment,{children:!Tt&&(0,h.jsxs)("button",{className:`${U.crossmintButton} ${e||""}`,disabled:n,onClick:Nt,style:u({},s),tabIndex:m,children:[(0,h.jsx)("img",{className:U.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.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});
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 {\n NFTCollectionViewProps,\n assertValidNFTCollectionViewProps,\n getNFTCollectionViewSrc,\n} from \"@crossmint/client-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.2\";\n","import { NFTDetailProps, assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-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\";\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\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 }, [props.signer.address, props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\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,I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,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,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","__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.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,sCCJP,IAAAC,GAAqF,sCCArF,IAAAC,EAAoB,+BACpBC,EAAkE,iBAEnD,SAARC,EAA+BC,EAA0BC,EAAoC,CAChG,IAAMC,KAAkB,UAAOD,CAAY,KAE3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AAGQ,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"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { NFTCollectionViewProps, NFTDetailProps, CrossmintEmbeddedCheckoutProps, CrossmintPayButtonProps } from '@crossmint/client-sdk-base';
2
+ import { NFTCollectionViewProps, NFTDetailProps } from '@crossmint/common-sdk-base';
3
+ import { CrossmintEmbeddedCheckoutProps, CrossmintPayButtonProps } from '@crossmint/client-sdk-base';
3
4
  export { CrossmintEvent, CrossmintEventMap, CrossmintEvents, useCrossmintEvents } from '@crossmint/client-sdk-base';
4
5
  import { MouseEvent, CSSProperties } from 'react';
5
6
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { NFTCollectionViewProps, NFTDetailProps, CrossmintEmbeddedCheckoutProps, CrossmintPayButtonProps } from '@crossmint/client-sdk-base';
2
+ import { NFTCollectionViewProps, NFTDetailProps } from '@crossmint/common-sdk-base';
3
+ import { CrossmintEmbeddedCheckoutProps, CrossmintPayButtonProps } from '@crossmint/client-sdk-base';
3
4
  export { CrossmintEvent, CrossmintEventMap, CrossmintEvents, useCrossmintEvents } from '@crossmint/client-sdk-base';
4
5
  import { MouseEvent, CSSProperties } from 'react';
5
6
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var dt=Object.defineProperty;var C=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var R=(t,e,n)=>e in t?dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,u=(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 y=(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 E=(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 lt,getNFTCollectionViewSrc as ut}from"@crossmint/client-sdk-base";var h="1.1.2";import{jsx as pt}from"react/jsx-runtime";function Xt(t){lt(t);let e=ut(t,h);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 ht,getNFTDetailSrc as ft}from"@crossmint/client-sdk-base";import{jsx as gt}from"react/jsx-runtime";function oe(t){ht(t);let e=ft(t,h);return gt("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 Ct from"lodash.isequal";import{useEffect as yt,useRef as Et}from"react";function k(t,e){let n=Et(e);yt(()=>{if(e.some((c,m)=>!Ct(c,n.current[m])))return n.current=e,t()},[e])}import It from"bs58";import{IncomingInternalEvents as kt,OutgoingInternalEvents as U,crossmintIFrameService as Tt,embeddedCheckoutPropsToUpdatableParamsPayload as vt}from"@crossmint/client-sdk-base";import{useEffect as D,useState as M}from"react";import{IncomingInternalEvents as bt,crossmintIFrameService as Pt}from"@crossmint/client-sdk-base";import{jsx as St}from"react/jsx-runtime";function T(n){var i=n,{onInternalEvent:t}=i,e=y(i,["onInternalEvent"]);let{getUrl:c,listenToEvents:m,listenToInternalEvents:l}=Pt(e),[d,o]=M(0),[r]=M(c(e));return D(()=>{let a=m(s=>{var p;return(p=e.onEvent)==null?void 0:p.call(e,s.data)});return()=>{a()}},[]),D(()=>{let a=l(s=>{let{type:p,payload:b}=s.data;p===bt.UI_HEIGHT_CHANGED&&o(b.height),t==null||t(s.data)});return()=>{a()}},[]),St("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 wt}from"react/jsx-runtime";function v(t){let{emitInternalEvent:e}=Tt(t),{signer:n,paymentMethod:i}=t;function c(o){let{type:r,payload:a}=o;if(r===kt.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=a;console.log("[Crossmint] Received incoming transaction",s),m(s)}}function m(o){return E(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 E(this,null,function*(){let{Transaction:a}=yield import("@solana/web3.js"),s=a.from(It.decode(r));return console.log("[Crossmint] Deserialized SOL transaction",s),yield o.signAndSendTransaction(s)})}function d(o,r){return E(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:vt(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs]),wt(T,u({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(v,u({},t))}import{useEffect as w,useState as H}from"react";import{crossmintPaymentService_OLD as Ft,crossmintUiService_OLD as Lt}from"@crossmint/client-sdk-base";import{jsx as Ot}from"react/jsx-runtime";function V(t){let[e,n]=H(0),{getIframeUrl:i,listenToEvents:c,emitQueryParams:m}=Ft(t),{listenToEvents:l}=Lt({environment:t.environment}),[d]=H(i());return w(()=>{let o=c(r=>{var a;return(a=t.onEvent)==null?void 0:a.call(t,r.data)});return()=>{o&&o()}},[]),w(()=>{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()}},[]),w(()=>{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]),Ot("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 Ge(t){if(Bt(t))return G(V,u({},t));if(Rt(t))return G(A,u({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}import{useMemo as At}from"react";import{useState as Ht}from"react";import{clientNames as Vt,crossmintModalService as Gt,crossmintPayButtonService as Yt}from"@crossmint/client-sdk-base";import{useEffect as _t,useState as Dt}from"react";function x(){let[t,e]=Dt(!0);return _t(()=>{e(!1)},[]),{isServerSideRendering:t}}import{createUseStyles as Mt}from"react-jss";var Ut="#1e1e1e",Y=t=>t==="light",W=t=>({buttonBgColor:Y(t)?"white":Ut,paragraphColor:Y(t)?"black":"white"}),$=Mt({"@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 an(t){let O=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:p,whPassThroughArgs:b,environment:q,paymentMethod:f,preferredSigninMethod:z,dismissOverlayOnClick:J,prepay:K,locale:F="en-US",currency:Q="usd",successCallbackURL:X="",failureCallbackURL:Z="",loginEmail:j="",projectId:tt,getButtonText:P,checkoutProps:L={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=O,S=y(O,["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"]),et="clientId"in S?S.clientId:S.collectionId,[g,nt]=Ht(!1),{isServerSideRendering:ot}=x(),{connect:rt}=Gt({clientId:et,projectId:tt,showOverlay:s,dismissOverlayOnClick:J,setConnecting:nt,libVersion:h,environment:q,clientName:Vt.reactUi,locale:F,currency:Q,successCallbackURL:X,failureCallbackURL:Z,loginEmail:j}),{getButtonText:it,handleClick:st}=Yt({onClick:i,connecting:g,paymentMethod:f,locale:F,checkoutProps:L}),at=mt=>st(mt,()=>{rt(p,d,o,r,b,f,z,K,L)}),I=$(W(l)),ct=At(()=>N("span",{className:I.crossmintParagraph,role:"button-paragraph",children:P!=null?P(g,f||"fiat"):it(g)}),[g,P,f]);return N($t,{children:!ot&&Wt("button",{className:`${I.crossmintButton} ${e||""}`,disabled:n,onClick:at,style:u({},c),tabIndex:m,children:[N("img",{className:I.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),ct]})})}import{CrossmintEvents as hn,useCrossmintEvents as fn}from"@crossmint/client-sdk-base";export{hn as CrossmintEvents,Xt as CrossmintNFTCollectionView,oe as CrossmintNFTDetail,an as CrossmintPayButton,Ge as CrossmintPaymentElement,fn 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.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};
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 {\n NFTCollectionViewProps,\n assertValidNFTCollectionViewProps,\n getNFTCollectionViewSrc,\n} from \"@crossmint/client-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.2\";\n","import { NFTDetailProps, assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-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\";\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\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 }, [props.signer.address, props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\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,OAEI,qCAAAA,GACA,2BAAAC,OACG,6BCJA,IAAMC,EAAc,QDcnB,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,CE3BA,OAAyB,qCAAAG,GAAmC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,CACpF,QAAAtC,EACA,WAAA2B,EACA,cAAAf,EACA,OAAAI,EACA,cAAAO,CACJ,CAAC,EAEKgB,GAAgBC,IAClBH,GAAYG,GAAO,IAAM,CACrBR,GACIvB,EACAL,EACAC,EACAC,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,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","__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.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,E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BAAAM,EACA,cAAAc,GACA,WAAYM,EACZ,YAAAvB,EACA,WAAYwB,GAAY,QACxB,OAAAnB,EACA,SAAAC,EACA,mBAAAC,EACA,mBAAAC,EACA,WAAAC,EACJ,CAAC,EAEK,CAAE,cAAegB,GAAuB,YAAAC,EAAY,EAAIC,GAA0B,CACpF,QAAAtC,EACA,WAAA2B,EACA,cAAAf,EACA,OAAAI,EACA,cAAAO,CACJ,CAAC,EAEKgB,GAAgBC,IAClBH,GAAYG,GAAO,IAAM,CACrBR,GACIvB,EACAL,EACAC,EACAC,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,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"]}
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
- "name": "@crossmint/client-sdk-react-ui",
3
- "version": "1.1.2",
4
2
  "author": "Paella Labs Inc",
5
- "license": "Apache-2.0",
6
- "repository": "https://github.com/Crossmint/crossmint-sdk",
7
- "type": "module",
8
- "sideEffects": false,
9
- "main": "./dist/index.cjs",
10
- "module": "./dist/index.js",
11
- "types": "./dist/index.d.ts",
3
+ "dependencies": {
4
+ "@crossmint/client-sdk-base": "1.1.8",
5
+ "@crossmint/common-sdk-base": "0.0.6",
6
+ "@ethersproject/transactions": "5.7.0",
7
+ "@solana/web3.js": "1.78.5",
8
+ "bs58": "5.0.0",
9
+ "lodash.isequal": "4.5.0",
10
+ "react-jss": "10.10.0"
11
+ },
12
+ "devDependencies": {
13
+ "@types/lodash.isequal": "4.5.6",
14
+ "@types/react": "18.2.21",
15
+ "@types/react-dom": "18.2.7",
16
+ "react": "18.2.0",
17
+ "react-dom": "18.2.0"
18
+ },
12
19
  "exports": {
13
20
  "import": "./dist/index.js",
14
21
  "require": "./dist/index.cjs"
@@ -18,35 +25,30 @@
18
25
  "src",
19
26
  "LICENSE"
20
27
  ],
28
+ "license": "Apache-2.0",
29
+ "main": "./dist/index.cjs",
30
+ "module": "./dist/index.js",
31
+ "name": "@crossmint/client-sdk-react-ui",
32
+ "peerDependencies": {
33
+ "react": ">=17.0.2",
34
+ "react-dom": ">=17.0.2"
35
+ },
21
36
  "publishConfig": {
22
37
  "access": "public"
23
38
  },
39
+ "repository": "https://github.com/Crossmint/crossmint-sdk",
24
40
  "scripts": {
41
+ "build": "yarn clean && tsup src/index.ts --external react,react-dom --format esm,cjs --outDir ./dist --minify --dts --sourcemap",
42
+ "clean": "shx rm -rf dist/*",
25
43
  "create-version-file": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/consts/version.ts",
26
- "version": "yarn run create-version-file && git add .",
44
+ "dev": "yarn clean && tsup src/index.ts --external react,react-dom --format esm,cjs --outDir ./dist --dts --sourcemap --watch",
27
45
  "prebuild": "yarn run create-version-file",
28
- "clean": "shx rm -rf dist/*",
29
- "build": "yarn clean && tsup src/index.ts --external react,react-dom --format esm,cjs --outDir ./dist --minify --dts --sourcemap",
30
- "test": "jest"
31
- },
32
- "dependencies": {
33
- "@crossmint/client-sdk-base": "1.1.2",
34
- "@ethersproject/transactions": "5.7.0",
35
- "@solana/web3.js": "1.78.5",
36
- "bs58": "5.0.0",
37
- "lodash.isequal": "4.5.0",
38
- "react-jss": "10.10.0"
46
+ "test": "jest",
47
+ "version": "yarn run create-version-file && git add ."
39
48
  },
40
- "peerDependencies": {
41
- "react": ">=17.0.2",
42
- "react-dom": ">=17.0.2"
43
- },
44
- "devDependencies": {
45
- "@types/lodash.isequal": "4.5.6",
46
- "@types/react": "18.2.21",
47
- "@types/react-dom": "18.2.7",
48
- "react": "18.2.0",
49
- "react-dom": "18.2.0"
50
- },
51
- "gitHead": "463c91ad1669c7301dfd106660d84719f2a161a5"
49
+ "sideEffects": false,
50
+ "type": "module",
51
+ "types": "./dist/index.d.ts",
52
+ "version": "1.1.5",
53
+ "gitHead": "23dfa1bcfd729fbdc0f073b342c99b7f6539d04e"
52
54
  }
@@ -1,8 +1,5 @@
1
- import {
2
- NFTCollectionViewProps,
3
- assertValidNFTCollectionViewProps,
4
- getNFTCollectionViewSrc,
5
- } from "@crossmint/client-sdk-base";
1
+ import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from "@crossmint/client-sdk-base";
2
+ import { NFTCollectionViewProps } from "@crossmint/common-sdk-base";
6
3
 
7
4
  import { LIB_VERSION } from "../consts/version";
8
5
 
@@ -1,7 +1,7 @@
1
1
  import "@testing-library/jest-dom";
2
2
  import { render, screen } from "@testing-library/react";
3
3
 
4
- import { NFT } from "@crossmint/client-sdk-base";
4
+ import { NFT } from "@crossmint/common-sdk-base";
5
5
 
6
6
  import { CrossmintNFTDetail } from "./CrossmintNFTDetail";
7
7
 
@@ -1,4 +1,5 @@
1
- import { NFTDetailProps, assertValidValidateNFTDetailProps, getNFTDetailSrc } from "@crossmint/client-sdk-base";
1
+ import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from "@crossmint/client-sdk-base";
2
+ import { NFTDetailProps } from "@crossmint/common-sdk-base";
2
3
 
3
4
  import { LIB_VERSION } from "../consts/version";
4
5
 
@@ -11,6 +11,7 @@ import {
11
11
  crossmintIFrameService,
12
12
  embeddedCheckoutPropsToUpdatableParamsPayload,
13
13
  } from "@crossmint/client-sdk-base";
14
+ import { EVMBlockchainIncludingTestnet } from "@crossmint/common-sdk-base";
14
15
 
15
16
  import CrossmintEmbeddedCheckoutIFrame from "../EmbeddedCheckoutIFrame";
16
17
 
@@ -27,6 +28,17 @@ export default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedChecko
27
28
  console.log("[Crossmint] Received incoming transaction", serializedTransaction);
28
29
  handleIncomingTransaction(serializedTransaction);
29
30
  }
31
+
32
+ if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {
33
+ const { chain } = payload;
34
+ console.log("[Crossmint] Received change of chain", chain);
35
+
36
+ const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;
37
+ if (handleChainSwitch == null) {
38
+ throw new Error("switchNetwork function should have been defined");
39
+ }
40
+ handleChainSwitch(chain as EVMBlockchainIncludingTestnet);
41
+ }
30
42
  }
31
43
 
32
44
  async function handleIncomingTransaction(serializedTransaction: string) {
@@ -82,7 +94,15 @@ export default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedChecko
82
94
  type: "params-update",
83
95
  payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),
84
96
  });
85
- }, [props.signer.address, props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);
97
+ }, [
98
+ props.signer.address,
99
+ props.recipient,
100
+ props.mintConfig,
101
+ props.locale,
102
+ props.currency,
103
+ props.whPassThroughArgs,
104
+ ...("chain" in props.signer ? [props.signer.chain] : []),
105
+ ]);
86
106
 
87
107
  return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;
88
108
  }
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.1.2";
1
+ export const LIB_VERSION = "1.1.5";