@crossmint/client-sdk-react-ui 1.1.9 → 1.1.10

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 Bt=Object.create;var y=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames,P=Object.getOwnPropertySymbols,Mt=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var z=(t,e,o)=>e in t?y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,c=(t,e)=>{for(var o in e||(e={}))D.call(e,o)&&z(t,o,e[o]);if(P)for(var o of P(e))J.call(e,o)&&z(t,o,e[o]);return t};var S=(t,e)=>{var o={};for(var n in t)D.call(t,n)&&e.indexOf(n)<0&&(o[n]=t[n]);if(t!=null&&P)for(var n of P(t))e.indexOf(n)<0&&J.call(t,n)&&(o[n]=t[n]);return o};var _t=(t,e)=>{for(var o in e)y(t,o,{get:e[o],enumerable:!0})},K=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Lt(e))!D.call(t,a)&&a!==o&&y(t,a,{get:()=>e[a],enumerable:!(n=Ot(e,a))||n.enumerable});return t};var T=(t,e,o)=>(o=t!=null?Bt(Mt(t)):{},K(e||!t||!t.__esModule?y(o,"default",{value:t,enumerable:!0}):o,t)),Ht=t=>K(y({},"__esModule",{value:!0}),t);var w=(t,e,o)=>new Promise((n,a)=>{var l=i=>{try{p(o.next(i))}catch(r){a(r)}},C=i=>{try{p(o.throw(i))}catch(r){a(r)}},p=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,C);p((o=o.apply(t,e)).next())});var Gt={};_t(Gt,{CrossmintEvents:()=>O.CrossmintEvents,CrossmintNFTCollectionView:()=>Dt,CrossmintNFTDetail:()=>Vt,CrossmintPayButton:()=>Yt,CrossmintPaymentElement:()=>Ut,useCrossmintEvents:()=>O.useCrossmintEvents});module.exports=Ht(Gt);var v=require("@crossmint/client-sdk-base");var f="1.1.9";var Q=require("react/jsx-runtime");function Dt(t){(0,v.assertValidNFTCollectionViewProps)(t);let e=(0,v.getNFTCollectionViewSrc)(t,f);return(0,Q.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}var F=require("@crossmint/client-sdk-base");var X=require("react/jsx-runtime");function Vt(t){(0,F.assertValidValidateNFTDetailProps)(t);let e=(0,F.getNFTDetailSrc)(t,f);return(0,X.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}var R=require("@crossmint/client-sdk-base");var ot=require("@crossmint/client-sdk-base");var Z=T(require("lodash.isequal"),1),x=require("react");function V(t,e){let o=(0,x.useRef)(e);(0,x.useEffect)(()=>{if(e.some((a,l)=>!(0,Z.default)(a,o.current[l])))return o.current=e,t()},[e])}var tt=T(require("bs58"),1),d=require("@crossmint/client-sdk-base");var g=require("react"),N=require("@crossmint/client-sdk-base");var j=require("react/jsx-runtime");function b(o){var n=o,{onInternalEvent:t}=n,e=S(n,["onInternalEvent"]);let{getUrl:a,listenToEvents:l,listenToInternalEvents:C}=(0,N.crossmintIFrameService)(e),[p,i]=(0,g.useState)(0),[r]=(0,g.useState)(a(e));return(0,g.useEffect)(()=>{let m=l(s=>{var u;return(u=e.onEvent)==null?void 0:u.call(e,s.data)});return()=>{m()}},[]),(0,g.useEffect)(()=>{let m=C(s=>{let{type:u,payload:L}=s.data;u===N.IncomingInternalEvents.UI_HEIGHT_CHANGED&&i(L.height),t==null||t(s.data)});return()=>{m()}},[]),(0,j.jsx)("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:`${p}px`}})}var et=require("react/jsx-runtime");function U(t){let{emitInternalEvent:e}=(0,d.crossmintIFrameService)(t),{signer:o,paymentMethod:n}=t;function a(i){let{type:r,payload:m}=i;if(r===d.IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=m;console.log("[Crossmint] Received incoming transaction",s),l(s)}if(r===d.IncomingInternalEvents.CRYPTO_CHAIN_SWITCH){let{chain:s}=m;console.log("[Crossmint] Received change of chain",s);let u=o.handleChainSwitch;if(u==null)throw new Error("switchNetwork function should have been defined");u(s)}}function l(i){return w(this,null,function*(){try{let r;switch(n){case"SOL":r=yield C(o,i);break;case"ETH":r=yield p(o,i);break;default:throw new Error(`Unsupported payment method ${n}`)}console.log("[Crossmint] Signed and sent transaction",r),e({type:d.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:r}})}catch(r){console.error("[Crossmint] Failed to sign and send transaction",r),e({type:d.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function C(i,r){return w(this,null,function*(){let{Transaction:m}=yield import("@solana/web3.js"),s=m.from(tt.default.decode(r));return console.log("[Crossmint] Deserialized SOL transaction",s),yield i.signAndSendTransaction(s)})}function p(i,r){return w(this,null,function*(){let{parse:m}=yield import("@ethersproject/transactions"),s=m(r);return console.log("[Crossmint] Deserialized ETH transaction",s),yield i.signAndSendTransaction(s)})}return V(()=>{e({type:"params-update",payload:(0,d.embeddedCheckoutPropsToUpdatableParamsPayload)(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs,..."chain"in t.signer?[t.signer.chain]:[]]),(0,et.jsx)(b,c({onInternalEvent:a},t))}var rt=require("react/jsx-runtime");function nt(t){if(!(0,ot.isCryptoEmbeddedCheckoutPropsWithSigner)(t))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return(0,rt.jsx)(U,c({},t))}var it=require("react/jsx-runtime");function A(t){return(0,it.jsx)(b,c({},t))}var at=require("react/jsx-runtime");function st(t){return(0,at.jsx)(A,c({},t))}var Y=require("react/jsx-runtime");function Ut(t){if((0,R.isFiatEmbeddedCheckoutProps)(t))return(0,Y.jsx)(st,c({},t));if((0,R.isCryptoEmbeddedCheckoutProps)(t))return(0,Y.jsx)(nt,c({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}var pt=require("react"),ut=require("react"),E=require("@crossmint/client-sdk-base");var B=require("react");function G(){let[t,e]=(0,B.useState)(!0);return(0,B.useEffect)(()=>{e(!1)},[]),{isServerSideRendering:t}}var mt=require("react-jss"),At="#1e1e1e",ct=t=>t==="light",dt=t=>({buttonBgColor:ct(t)?"white":At,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 Yt(t){let q=t,{className:e,disabled:o,onClick:n,style:a,tabIndex:l,theme:C="dark",mintTo:p,emailTo:i,listingId:r,auctionId:m,showOverlay:s=!0,mintConfig:u,whPassThroughArgs:L,environment:ht,paymentMethod:I,preferredSigninMethod:Ct,dismissOverlayOnClick:ft,prepay:gt,locale:W="en-US",currency:Et="usd",successCallbackURL:yt="",failureCallbackURL:bt="",loginEmail:It="",projectId:kt,getButtonText:M,checkoutProps:$={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=q,_=S(q,["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"]),Pt="clientId"in _?_.clientId:_.collectionId,[k,St]=(0,ut.useState)(!1),{isServerSideRendering:Tt}=G(),{connect:wt}=(0,E.crossmintModalService)({clientId:Pt,projectId:kt,showOverlay:s,dismissOverlayOnClick:ft,setConnecting:St,libVersion:f,environment:ht,clientName:E.clientNames.reactUi,locale:W,currency:Et,successCallbackURL:yt,failureCallbackURL:bt,loginEmail:It}),{getButtonText:vt,handleClick:Ft}=(0,E.crossmintPayButtonService)({onClick:n,connecting:k,paymentMethod:I,locale:W,checkoutProps:$}),xt=Rt=>Ft(Rt,()=>{wt(u,p,i,r,L,I,Ct,gt,$)}),H=lt(dt(C)),Nt=(0,pt.useMemo)(()=>(0,h.jsx)("span",{className:H.crossmintParagraph,role:"button-paragraph",children:M!=null?M(k,I||"fiat"):vt(k)}),[k,M,I]);return(0,h.jsx)(h.Fragment,{children:!Tt&&(0,h.jsxs)("button",{className:`${H.crossmintButton} ${e||""}`,disabled:o,onClick:xt,style:c({},a),tabIndex:l,children:[(0,h.jsx)("img",{className:H.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),Nt]})})}var O=require("@crossmint/client-sdk-base");0&&(module.exports={CrossmintEvents,CrossmintNFTCollectionView,CrossmintNFTDetail,CrossmintPayButton,CrossmintPaymentElement,useCrossmintEvents});
1
+ "use strict";var Be=Object.create;var y=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames,P=Object.getOwnPropertySymbols,Me=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var z=(e,t,o)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,c=(e,t)=>{for(var o in t||(t={}))D.call(t,o)&&z(e,o,t[o]);if(P)for(var o of P(t))J.call(t,o)&&z(e,o,t[o]);return e};var S=(e,t)=>{var o={};for(var n in e)D.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&P)for(var n of P(e))t.indexOf(n)<0&&J.call(e,n)&&(o[n]=e[n]);return o};var _e=(e,t)=>{for(var o in t)y(e,o,{get:t[o],enumerable:!0})},K=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Le(t))!D.call(e,a)&&a!==o&&y(e,a,{get:()=>t[a],enumerable:!(n=Oe(t,a))||n.enumerable});return e};var T=(e,t,o)=>(o=e!=null?Be(Me(e)):{},K(t||!e||!e.__esModule?y(o,"default",{value:e,enumerable:!0}):o,e)),He=e=>K(y({},"__esModule",{value:!0}),e);var w=(e,t,o)=>new Promise((n,a)=>{var l=i=>{try{u(o.next(i))}catch(r){a(r)}},C=i=>{try{u(o.throw(i))}catch(r){a(r)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(l,C);u((o=o.apply(e,t)).next())});var Ge={};_e(Ge,{CrossmintEvents:()=>O.CrossmintEvents,CrossmintNFTCollectionView:()=>De,CrossmintNFTDetail:()=>Ve,CrossmintPayButton:()=>Ye,CrossmintPaymentElement:()=>Ue,useCrossmintEvents:()=>O.useCrossmintEvents});module.exports=He(Ge);var v=require("@crossmint/client-sdk-base");var f="1.1.10";var Q=require("react/jsx-runtime");function De(e){(0,v.assertValidNFTCollectionViewProps)(e);let t=(0,v.getNFTCollectionViewSrc)(e,f);return(0,Q.jsx)("iframe",{src:t,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}var F=require("@crossmint/client-sdk-base");var X=require("react/jsx-runtime");function Ve(e){(0,F.assertValidValidateNFTDetailProps)(e);let t=(0,F.getNFTDetailSrc)(e,f);return(0,X.jsx)("iframe",{src:t,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}var R=require("@crossmint/client-sdk-base");var oe=require("@crossmint/client-sdk-base");var Z=T(require("lodash.isequal"),1),x=require("react");function V(e,t){let o=(0,x.useRef)(t);(0,x.useEffect)(()=>{if(t.some((a,l)=>!(0,Z.default)(a,o.current[l])))return o.current=t,e()},[t])}var ee=T(require("bs58"),1),d=require("@crossmint/client-sdk-base");var g=require("react"),N=require("@crossmint/client-sdk-base");var j=require("react/jsx-runtime");function b(o){var n=o,{onInternalEvent:e}=n,t=S(n,["onInternalEvent"]);let{getUrl:a,listenToEvents:l,listenToInternalEvents:C}=(0,N.crossmintIFrameService)(t),[u,i]=(0,g.useState)(0),[r]=(0,g.useState)(a(t));return(0,g.useEffect)(()=>{let m=l(s=>{var p;return(p=t.onEvent)==null?void 0:p.call(t,s.data)});return()=>{m()}},[]),(0,g.useEffect)(()=>{let m=C(s=>{let{type:p,payload:L}=s.data;p===N.IncomingInternalEvents.UI_HEIGHT_CHANGED&&i(L.height),e==null||e(s.data)});return()=>{m()}},[]),(0,j.jsx)("iframe",{src:r,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none",border:"none",padding:"0px",width:"100%",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",transform:"translate(0px)",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${u}px`}})}var te=require("react/jsx-runtime");function U(e){let{emitInternalEvent:t}=(0,d.crossmintIFrameService)(e),{signer:o,paymentMethod:n}=e;function a(i){let{type:r,payload:m}=i;if(r===d.IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=m;console.log("[Crossmint] Received incoming transaction",s),l(s)}if(r===d.IncomingInternalEvents.CRYPTO_CHAIN_SWITCH){let{chain:s}=m;console.log("[Crossmint] Received change of chain",s);let p=o.handleChainSwitch;if(p==null)throw new Error("switchNetwork function should have been defined");p(s)}}function l(i){return w(this,null,function*(){try{let r;switch(n){case"SOL":r=yield C(o,i);break;case"ETH":r=yield u(o,i);break;default:throw new Error(`Unsupported payment method ${n}`)}console.log("[Crossmint] Signed and sent transaction",r),t({type:d.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:r}})}catch(r){console.error("[Crossmint] Failed to sign and send transaction",r),t({type:d.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function C(i,r){return w(this,null,function*(){let{Transaction:m}=yield import("@solana/web3.js"),s=m.from(ee.default.decode(r));return console.log("[Crossmint] Deserialized SOL transaction",s),yield i.signAndSendTransaction(s)})}function u(i,r){return w(this,null,function*(){let{parse:m}=yield import("@ethersproject/transactions"),s=m(r);return console.log("[Crossmint] Deserialized ETH transaction",s),yield i.signAndSendTransaction(s)})}return V(()=>{t({type:"params-update",payload:(0,d.embeddedCheckoutPropsToUpdatableParamsPayload)(e)})},[e.signer.address,e.recipient,e.mintConfig,e.locale,e.currency,e.whPassThroughArgs,..."chain"in e.signer?[e.signer.chain]:[]]),(0,te.jsx)(b,c({onInternalEvent:a},e))}var re=require("react/jsx-runtime");function ne(e){if(!(0,oe.isCryptoEmbeddedCheckoutPropsWithSigner)(e))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return(0,re.jsx)(U,c({},e))}var ie=require("react/jsx-runtime");function A(e){return(0,ie.jsx)(b,c({},e))}var ae=require("react/jsx-runtime");function se(e){return(0,ae.jsx)(A,c({},e))}var Y=require("react/jsx-runtime");function Ue(e){if((0,R.isFiatEmbeddedCheckoutProps)(e))return(0,Y.jsx)(se,c({},e));if((0,R.isCryptoEmbeddedCheckoutProps)(e))return(0,Y.jsx)(ne,c({},e));throw new Error("Unsupported: Fiat is the only supported payment method.")}var ue=require("react"),pe=require("react"),E=require("@crossmint/client-sdk-base");var B=require("react");function G(){let[e,t]=(0,B.useState)(!0);return(0,B.useEffect)(()=>{t(!1)},[]),{isServerSideRendering:e}}var me=require("react-jss"),Ae="#1e1e1e",ce=e=>e==="light",de=e=>({buttonBgColor:ce(e)?"white":Ae,paragraphColor:ce(e)?"black":"white"}),le=(0,me.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:e})=>e,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:e})=>e,margin:"0"}});var h=require("react/jsx-runtime");function Ye(e){let q=e,{className:t,disabled:o,onClick:n,style:a,tabIndex:l,theme:C="dark",mintTo:u,emailTo:i,listingId:r,auctionId:m,showOverlay:s=!0,mintConfig:p,whPassThroughArgs:L,environment:he,paymentMethod:I,preferredSigninMethod:Ce,dismissOverlayOnClick:fe,prepay:ge,locale:W="en-US",currency:Ee="usd",successCallbackURL:ye="",failureCallbackURL:be="",loginEmail:Ie="",projectId:ke,getButtonText:M,checkoutProps:$={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=q,_=S(q,["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"]),Pe="clientId"in _?_.clientId:_.collectionId,[k,Se]=(0,pe.useState)(!1),{isServerSideRendering:Te}=G(),{connect:we}=(0,E.crossmintModalService)({clientId:Pe,projectId:ke,showOverlay:s,dismissOverlayOnClick:fe,setConnecting:Se,libVersion:f,environment:he,clientName:E.clientNames.reactUi,locale:W,currency:Ee,successCallbackURL:ye,failureCallbackURL:be,loginEmail:Ie}),{getButtonText:ve,handleClick:Fe}=(0,E.crossmintPayButtonService)({onClick:n,connecting:k,paymentMethod:I,locale:W,checkoutProps:$}),xe=Re=>Fe(Re,()=>{we(p,u,i,r,L,I,Ce,ge,$)}),H=le(de(C)),Ne=(0,ue.useMemo)(()=>(0,h.jsx)("span",{className:H.crossmintParagraph,role:"button-paragraph",children:M!=null?M(k,I||"fiat"):ve(k)}),[k,M,I]);return(0,h.jsx)(h.Fragment,{children:!Te&&(0,h.jsxs)("button",{className:`${H.crossmintButton} ${t||""}`,disabled:o,onClick:xe,style:c({},a),tabIndex:l,children:[(0,h.jsx)("img",{className:H.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),Ne]})})}var O=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/FiatEmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckout.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.9\";\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 { CrossmintFiatEmbeddedCheckout } from \"./fiat/FiatEmbeddedCheckout\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout on v2 major publish, prior announcement since its a breaking change\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatEmbeddedCheckout {...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 { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {\n return <CrossmintEmbeddedCheckoutIFrame {...props} />;\n}\n","import FiatEmbeddedCheckoutIFrame from \"@/components/embed/fiat/FiatEmbeddedCheckoutIFrame\";\nimport { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {\n return <FiatEmbeddedCheckoutIFrame {...props} />;\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n"],"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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AAe,EAE3C,CAAE,QAAAC,EAAQ,KAAI,yBAAsB,CACtC,SAAUL,GACV,UAAAL,GACA,YAAAb,EACA,sBAAAM,GACA,cAAAc,GACA,WAAYI,EACZ,YAAArB,GACA,WAAY,cAAY,QACxB,OAAAK,EACA,SAAAC,GACA,mBAAAC,GACA,mBAAAC,GACA,WAAAC,EACJ,CAAC,EAEK,CAAE,cAAea,GAAuB,YAAAC,EAAY,KAAI,6BAA0B,CACpF,QAAAlC,EACA,WAAA2B,EACA,cAAAf,EACA,OAAAI,EACA,cAAAO,CACJ,CAAC,EAEKY,GAAgBC,IAClBF,GAAYE,GAAO,IAAM,CACrBL,GACItB,EACAL,EACAC,EACAC,EACAI,EACAE,EACAC,GACAE,GACAQ,CACJ,CACJ,CAAC,EAECc,EAAUC,GAAUC,GAAYpC,CAAK,CAAC,EAEtCqC,MAAU,YAAQ,OAEhB,OAAC,QAAK,UAAWH,EAAQ,mBAAoB,KAAK,mBAC7C,SAAAf,GAAiB,KACZA,EAAcK,EAAYf,GAAiB,MAAM,EACjDqB,GAAsBN,CAAU,EAC1C,EAEL,CAACA,EAAYL,EAAeV,CAAa,CAAC,EAE7C,SACI,mBACK,UAACiB,OACE,QAAC,UACG,UAAW,GAAGQ,EAAQ,eAAe,IAAIvC,GAAa,EAAE,GACxD,SAAUC,EACV,QAASoC,GACT,MAAOM,EAAA,GAAKxC,GACZ,SAAUC,EAEV,oBAAC,OACG,UAAWmC,EAAQ,aACnB,IAAI,qDACJ,IAAI,iBACR,EACCG,IACL,EAER,CAER,CXjIA,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_jsx_runtime","FiatEmbeddedCheckoutIFrame","props","CrossmintEmbeddedCheckoutIFrame","__spreadValues","import_jsx_runtime","CrossmintFiatEmbeddedCheckout","props","FiatEmbeddedCheckoutIFrame","__spreadValues","import_jsx_runtime","CrossmintPaymentElement","props","CrossmintFiatEmbeddedCheckout","__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/FiatEmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckout.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.10\";\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 { CrossmintFiatEmbeddedCheckout } from \"./fiat/FiatEmbeddedCheckout\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout on v2 major publish, prior announcement since its a breaking change\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatEmbeddedCheckout {...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\",\n border: \"none\",\n padding: \"0px\",\n width: \"100%\",\n minWidth: \"100%\",\n overflow: \"hidden\",\n display: \"block\",\n userSelect: \"none\",\n transform: \"translate(0px)\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {\n return <CrossmintEmbeddedCheckoutIFrame {...props} />;\n}\n","import FiatEmbeddedCheckoutIFrame from \"@/components/embed/fiat/FiatEmbeddedCheckoutIFrame\";\nimport { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {\n return <FiatEmbeddedCheckoutIFrame {...props} />;\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) =>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rossmintNFTCollectionView","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_jsx_runtime","FiatEmbeddedCheckoutIFrame","props","CrossmintEmbeddedCheckoutIFrame","__spreadValues","import_jsx_runtime","CrossmintFiatEmbeddedCheckout","props","FiatEmbeddedCheckoutIFrame","__spreadValues","import_jsx_runtime","CrossmintPaymentElement","props","CrossmintFiatEmbeddedCheckout","__spreadValues","CrossmintCryptoEmbeddedCheckout","import_react","import_client_sdk_base","import_react","useEnvironment","isServerSideRendering","setIsServerSideRendering","import_react_jss","DARK_BG","themeIsLight","theme","formatProps","useStyles","buttonBgColor","paragraphColor","import_jsx_runtime","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","isServerSideRendering","useEnvironment","connect","LIB_VERSION","getButtonTextInternal","handleClick","_handleClick","event","classes","useStyles","formatProps","content","__spreadValues","import_client_sdk_base"]}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var dt=Object.defineProperty;var E=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var O=(t,e,o)=>e in t?dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,a=(t,e)=>{for(var o in e||(e={}))L.call(e,o)&&O(t,o,e[o]);if(E)for(var o of E(e))M.call(e,o)&&O(t,o,e[o]);return t};var y=(t,e)=>{var o={};for(var r in t)L.call(t,r)&&e.indexOf(r)<0&&(o[r]=t[r]);if(t!=null&&E)for(var r of E(t))e.indexOf(r)<0&&M.call(t,r)&&(o[r]=t[r]);return o};var b=(t,e,o)=>new Promise((r,m)=>{var d=i=>{try{l(o.next(i))}catch(n){m(n)}},u=i=>{try{l(o.throw(i))}catch(n){m(n)}},l=i=>i.done?r(i.value):Promise.resolve(i.value).then(d,u);l((o=o.apply(t,e)).next())});import{assertValidNFTCollectionViewProps as lt,getNFTCollectionViewSrc as pt}from"@crossmint/client-sdk-base";var h="1.1.9";import{jsx as ut}from"react/jsx-runtime";function Jt(t){lt(t);let e=pt(t,h);return ut("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 Ct}from"@crossmint/client-sdk-base";import{jsx as ft}from"react/jsx-runtime";function jt(t){ht(t);let e=Ct(t,h);return ft("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 vt}from"@crossmint/client-sdk-base";import gt from"lodash.isequal";import{useEffect as Et,useRef as yt}from"react";function T(t,e){let o=yt(e);Et(()=>{if(e.some((m,d)=>!gt(m,o.current[d])))return o.current=e,t()},[e])}import Pt from"bs58";import{IncomingInternalEvents as D,OutgoingInternalEvents as V,crossmintIFrameService as St,embeddedCheckoutPropsToUpdatableParamsPayload as Tt}from"@crossmint/client-sdk-base";import{useEffect as _,useState as H}from"react";import{IncomingInternalEvents as bt,crossmintIFrameService as It}from"@crossmint/client-sdk-base";import{jsx as kt}from"react/jsx-runtime";function C(o){var r=o,{onInternalEvent:t}=r,e=y(r,["onInternalEvent"]);let{getUrl:m,listenToEvents:d,listenToInternalEvents:u}=It(e),[l,i]=H(0),[n]=H(m(e));return _(()=>{let c=d(s=>{var p;return(p=e.onEvent)==null?void 0:p.call(e,s.data)});return()=>{c()}},[]),_(()=>{let c=u(s=>{let{type:p,payload:I}=s.data;p===bt.UI_HEIGHT_CHANGED&&i(I.height),t==null||t(s.data)});return()=>{c()}},[]),kt("iframe",{src:n,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:`${l}px`}})}import{jsx as wt}from"react/jsx-runtime";function w(t){let{emitInternalEvent:e}=St(t),{signer:o,paymentMethod:r}=t;function m(i){let{type:n,payload:c}=i;if(n===D.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=c;console.log("[Crossmint] Received incoming transaction",s),d(s)}if(n===D.CRYPTO_CHAIN_SWITCH){let{chain:s}=c;console.log("[Crossmint] Received change of chain",s);let p=o.handleChainSwitch;if(p==null)throw new Error("switchNetwork function should have been defined");p(s)}}function d(i){return b(this,null,function*(){try{let n;switch(r){case"SOL":n=yield u(o,i);break;case"ETH":n=yield l(o,i);break;default:throw new Error(`Unsupported payment method ${r}`)}console.log("[Crossmint] Signed and sent transaction",n),e({type:V.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:n}})}catch(n){console.error("[Crossmint] Failed to sign and send transaction",n),e({type:V.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function u(i,n){return b(this,null,function*(){let{Transaction:c}=yield import("@solana/web3.js"),s=c.from(Pt.decode(n));return console.log("[Crossmint] Deserialized SOL transaction",s),yield i.signAndSendTransaction(s)})}function l(i,n){return b(this,null,function*(){let{parse:c}=yield import("@ethersproject/transactions"),s=c(n);return console.log("[Crossmint] Deserialized ETH transaction",s),yield i.signAndSendTransaction(s)})}return T(()=>{e({type:"params-update",payload:Tt(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs,..."chain"in t.signer?[t.signer.chain]:[]]),wt(C,a({onInternalEvent:m},t))}import{jsx as Ft}from"react/jsx-runtime";function U(t){if(!vt(t))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return Ft(w,a({},t))}import{jsx as xt}from"react/jsx-runtime";function v(t){return xt(C,a({},t))}import{jsx as Nt}from"react/jsx-runtime";function A(t){return Nt(v,a({},t))}import{jsx as Y}from"react/jsx-runtime";function Ye(t){if(Bt(t))return Y(A,a({},t));if(Rt(t))return Y(U,a({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}import{useMemo as Ht}from"react";import{useState as Dt}from"react";import{clientNames as Vt,crossmintModalService as Ut,crossmintPayButtonService as At}from"@crossmint/client-sdk-base";import{useEffect as Ot,useState as Lt}from"react";function F(){let[t,e]=Lt(!0);return Ot(()=>{e(!1)},[]),{isServerSideRendering:t}}import{createUseStyles as Mt}from"react-jss";var _t="#1e1e1e",G=t=>t==="light",W=t=>({buttonBgColor:G(t)?"white":_t,paragraphColor:G(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 Gt,jsx as x,jsxs as Yt}from"react/jsx-runtime";function so(t){let B=t,{className:e,disabled:o,onClick:r,style:m,tabIndex:d,theme:u="dark",mintTo:l,emailTo:i,listingId:n,auctionId:c,showOverlay:s=!0,mintConfig:p,whPassThroughArgs:I,environment:q,paymentMethod:f,preferredSigninMethod:z,dismissOverlayOnClick:J,prepay:K,locale:N="en-US",currency:Q="usd",successCallbackURL:X="",failureCallbackURL:Z="",loginEmail:j="",projectId:tt,getButtonText:k,checkoutProps:R={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=B,P=y(B,["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 P?P.clientId:P.collectionId,[g,ot]=Dt(!1),{isServerSideRendering:nt}=F(),{connect:rt}=Ut({clientId:et,projectId:tt,showOverlay:s,dismissOverlayOnClick:J,setConnecting:ot,libVersion:h,environment:q,clientName:Vt.reactUi,locale:N,currency:Q,successCallbackURL:X,failureCallbackURL:Z,loginEmail:j}),{getButtonText:it,handleClick:st}=At({onClick:r,connecting:g,paymentMethod:f,locale:N,checkoutProps:R}),at=mt=>st(mt,()=>{rt(p,l,i,n,I,f,z,K,R)}),S=$(W(u)),ct=Ht(()=>x("span",{className:S.crossmintParagraph,role:"button-paragraph",children:k!=null?k(g,f||"fiat"):it(g)}),[g,k,f]);return x(Gt,{children:!nt&&Yt("button",{className:`${S.crossmintButton} ${e||""}`,disabled:o,onClick:at,style:a({},m),tabIndex:d,children:[x("img",{className:S.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),ct]})})}import{CrossmintEvents as ho,useCrossmintEvents as Co}from"@crossmint/client-sdk-base";export{ho as CrossmintEvents,Jt as CrossmintNFTCollectionView,jt as CrossmintNFTDetail,so as CrossmintPayButton,Ye as CrossmintPaymentElement,Co as useCrossmintEvents};
1
+ var de=Object.defineProperty;var E=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var O=(e,t,o)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,a=(e,t)=>{for(var o in t||(t={}))L.call(t,o)&&O(e,o,t[o]);if(E)for(var o of E(t))M.call(t,o)&&O(e,o,t[o]);return e};var y=(e,t)=>{var o={};for(var r in e)L.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&E)for(var r of E(e))t.indexOf(r)<0&&M.call(e,r)&&(o[r]=e[r]);return o};var b=(e,t,o)=>new Promise((r,m)=>{var d=i=>{try{l(o.next(i))}catch(n){m(n)}},p=i=>{try{l(o.throw(i))}catch(n){m(n)}},l=i=>i.done?r(i.value):Promise.resolve(i.value).then(d,p);l((o=o.apply(e,t)).next())});import{assertValidNFTCollectionViewProps as le,getNFTCollectionViewSrc as ue}from"@crossmint/client-sdk-base";var h="1.1.10";import{jsx as pe}from"react/jsx-runtime";function Je(e){le(e);let t=ue(e,h);return pe("iframe",{src:t,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}import{assertValidValidateNFTDetailProps as he,getNFTDetailSrc as Ce}from"@crossmint/client-sdk-base";import{jsx as fe}from"react/jsx-runtime";function je(e){he(e);let t=Ce(e,h);return fe("iframe",{src:t,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}import{isCryptoEmbeddedCheckoutProps as Re,isFiatEmbeddedCheckoutProps as Be}from"@crossmint/client-sdk-base";import{isCryptoEmbeddedCheckoutPropsWithSigner as ve}from"@crossmint/client-sdk-base";import ge from"lodash.isequal";import{useEffect as Ee,useRef as ye}from"react";function T(e,t){let o=ye(t);Ee(()=>{if(t.some((m,d)=>!ge(m,o.current[d])))return o.current=t,e()},[t])}import Pe from"bs58";import{IncomingInternalEvents as D,OutgoingInternalEvents as V,crossmintIFrameService as Se,embeddedCheckoutPropsToUpdatableParamsPayload as Te}from"@crossmint/client-sdk-base";import{useEffect as _,useState as H}from"react";import{IncomingInternalEvents as be,crossmintIFrameService as Ie}from"@crossmint/client-sdk-base";import{jsx as ke}from"react/jsx-runtime";function C(o){var r=o,{onInternalEvent:e}=r,t=y(r,["onInternalEvent"]);let{getUrl:m,listenToEvents:d,listenToInternalEvents:p}=Ie(t),[l,i]=H(0),[n]=H(m(t));return _(()=>{let c=d(s=>{var u;return(u=t.onEvent)==null?void 0:u.call(t,s.data)});return()=>{c()}},[]),_(()=>{let c=p(s=>{let{type:u,payload:I}=s.data;u===be.UI_HEIGHT_CHANGED&&i(I.height),e==null||e(s.data)});return()=>{c()}},[]),ke("iframe",{src:n,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none",border:"none",padding:"0px",width:"100%",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",transform:"translate(0px)",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${l}px`}})}import{jsx as we}from"react/jsx-runtime";function w(e){let{emitInternalEvent:t}=Se(e),{signer:o,paymentMethod:r}=e;function m(i){let{type:n,payload:c}=i;if(n===D.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=c;console.log("[Crossmint] Received incoming transaction",s),d(s)}if(n===D.CRYPTO_CHAIN_SWITCH){let{chain:s}=c;console.log("[Crossmint] Received change of chain",s);let u=o.handleChainSwitch;if(u==null)throw new Error("switchNetwork function should have been defined");u(s)}}function d(i){return b(this,null,function*(){try{let n;switch(r){case"SOL":n=yield p(o,i);break;case"ETH":n=yield l(o,i);break;default:throw new Error(`Unsupported payment method ${r}`)}console.log("[Crossmint] Signed and sent transaction",n),t({type:V.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:n}})}catch(n){console.error("[Crossmint] Failed to sign and send transaction",n),t({type:V.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function p(i,n){return b(this,null,function*(){let{Transaction:c}=yield import("@solana/web3.js"),s=c.from(Pe.decode(n));return console.log("[Crossmint] Deserialized SOL transaction",s),yield i.signAndSendTransaction(s)})}function l(i,n){return b(this,null,function*(){let{parse:c}=yield import("@ethersproject/transactions"),s=c(n);return console.log("[Crossmint] Deserialized ETH transaction",s),yield i.signAndSendTransaction(s)})}return T(()=>{t({type:"params-update",payload:Te(e)})},[e.signer.address,e.recipient,e.mintConfig,e.locale,e.currency,e.whPassThroughArgs,..."chain"in e.signer?[e.signer.chain]:[]]),we(C,a({onInternalEvent:m},e))}import{jsx as Fe}from"react/jsx-runtime";function U(e){if(!ve(e))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return Fe(w,a({},e))}import{jsx as xe}from"react/jsx-runtime";function v(e){return xe(C,a({},e))}import{jsx as Ne}from"react/jsx-runtime";function A(e){return Ne(v,a({},e))}import{jsx as Y}from"react/jsx-runtime";function Yt(e){if(Be(e))return Y(A,a({},e));if(Re(e))return Y(U,a({},e));throw new Error("Unsupported: Fiat is the only supported payment method.")}import{useMemo as He}from"react";import{useState as De}from"react";import{clientNames as Ve,crossmintModalService as Ue,crossmintPayButtonService as Ae}from"@crossmint/client-sdk-base";import{useEffect as Oe,useState as Le}from"react";function F(){let[e,t]=Le(!0);return Oe(()=>{t(!1)},[]),{isServerSideRendering:e}}import{createUseStyles as Me}from"react-jss";var _e="#1e1e1e",G=e=>e==="light",W=e=>({buttonBgColor:G(e)?"white":_e,paragraphColor:G(e)?"black":"white"}),$=Me({"@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:e})=>e,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:e})=>e,margin:"0"}});import{Fragment as Ge,jsx as x,jsxs as Ye}from"react/jsx-runtime";function so(e){let B=e,{className:t,disabled:o,onClick:r,style:m,tabIndex:d,theme:p="dark",mintTo:l,emailTo:i,listingId:n,auctionId:c,showOverlay:s=!0,mintConfig:u,whPassThroughArgs:I,environment:q,paymentMethod:f,preferredSigninMethod:z,dismissOverlayOnClick:J,prepay:K,locale:N="en-US",currency:Q="usd",successCallbackURL:X="",failureCallbackURL:Z="",loginEmail:j="",projectId:ee,getButtonText:k,checkoutProps:R={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=B,P=y(B,["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"]),te="clientId"in P?P.clientId:P.collectionId,[g,oe]=De(!1),{isServerSideRendering:ne}=F(),{connect:re}=Ue({clientId:te,projectId:ee,showOverlay:s,dismissOverlayOnClick:J,setConnecting:oe,libVersion:h,environment:q,clientName:Ve.reactUi,locale:N,currency:Q,successCallbackURL:X,failureCallbackURL:Z,loginEmail:j}),{getButtonText:ie,handleClick:se}=Ae({onClick:r,connecting:g,paymentMethod:f,locale:N,checkoutProps:R}),ae=me=>se(me,()=>{re(u,l,i,n,I,f,z,K,R)}),S=$(W(p)),ce=He(()=>x("span",{className:S.crossmintParagraph,role:"button-paragraph",children:k!=null?k(g,f||"fiat"):ie(g)}),[g,k,f]);return x(Ge,{children:!ne&&Ye("button",{className:`${S.crossmintButton} ${t||""}`,disabled:o,onClick:ae,style:a({},m),tabIndex:d,children:[x("img",{className:S.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),ce]})})}import{CrossmintEvents as ho,useCrossmintEvents as Co}from"@crossmint/client-sdk-base";export{ho as CrossmintEvents,Je as CrossmintNFTCollectionView,je as CrossmintNFTDetail,so as CrossmintPayButton,Yt as CrossmintPaymentElement,Co 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/FiatEmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckout.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.9\";\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 { CrossmintFiatEmbeddedCheckout } from \"./fiat/FiatEmbeddedCheckout\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout on v2 major publish, prior announcement since its a breaking change\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatEmbeddedCheckout {...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 { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {\n return <CrossmintEmbeddedCheckoutIFrame {...props} />;\n}\n","import FiatEmbeddedCheckoutIFrame from \"@/components/embed/fiat/FiatEmbeddedCheckoutIFrame\";\nimport { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {\n return <FiatEmbeddedCheckoutIFrame {...props} />;\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n","export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n"],"mappings":"0sBAAA,OAAS,qCAAAA,GAAmC,2BAAAC,OAA+B,6BCApE,IAAMC,EAAc,QDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,O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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","jsx","FiatEmbeddedCheckoutIFrame","props","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintFiatEmbeddedCheckout","props","FiatEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintPaymentElement","props","isFiatEmbeddedCheckoutProps","CrossmintFiatEmbeddedCheckout","__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/FiatEmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckout.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.10\";\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 { CrossmintFiatEmbeddedCheckout } from \"./fiat/FiatEmbeddedCheckout\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout on v2 major publish, prior announcement since its a breaking change\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatEmbeddedCheckout {...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\",\n border: \"none\",\n padding: \"0px\",\n width: \"100%\",\n minWidth: \"100%\",\n overflow: \"hidden\",\n display: \"block\",\n userSelect: \"none\",\n transform: \"translate(0px)\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {\n return <CrossmintEmbeddedCheckoutIFrame {...props} />;\n}\n","import FiatEmbeddedCheckoutIFrame from \"@/components/embed/fiat/FiatEmbeddedCheckoutIFrame\";\nimport { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {\n return <FiatEmbeddedCheckoutIFrame {...props} />;\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n","export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n"],"mappings":"0sBAAA,OAAS,qCAAAA,GAAmC,2BAAAC,OAA+B,6BCApE,IAAMC,EAAc,SDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,OAAS,qCAAAG,GAAmC,mBAAAC,OAAuB,6BAW3D,cAAAC,OAAA,oBAND,SAASC,GAAmBC,EAAuB,CACtDC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAgBH,EAAOI,CAAW,EAE9C,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,OAE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AAC,EACA,WAAAC,CACJ,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,CGjIA,OAAS,mBAAAG,GAAiB,sBAAAC,OAA0B","names":["assertValidNFTCollectionViewProps","getNFTCollectionViewSrc","LIB_VERSION","jsx","CrossmintNFTCollectionView","props","assertValidNFTCollectionViewProps","src","getNFTCollectionViewSrc","LIB_VERSION","assertValidValidateNFTDetailProps","getNFTDetailSrc","jsx","CrossmintNFTDetail","props","assertValidValidateNFTDetailProps","src","getNFTDetailSrc","LIB_VERSION","isCryptoEmbeddedCheckoutProps","isFiatEmbeddedCheckoutProps","isCryptoEmbeddedCheckoutPropsWithSigner","isEqual","useEffect","useRef","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","bs58","IncomingInternalEvents","OutgoingInternalEvents","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","useEffect","useState","IncomingInternalEvents","crossmintIFrameService","jsx","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","crossmintIFrameService","height","setHeight","useState","url","useEffect","clearListener","event","type","payload","IncomingInternalEvents","jsx","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","signer","paymentMethod","onInternalEvent","event","type","payload","IncomingInternalEvents","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","OutgoingInternalEvents","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintCryptoEmbeddedCheckout","props","isCryptoEmbeddedCheckoutPropsWithSigner","CryptoEmbeddedCheckoutIFrame","__spreadValues","jsx","FiatEmbeddedCheckoutIFrame","props","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintFiatEmbeddedCheckout","props","FiatEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintPaymentElement","props","isFiatEmbeddedCheckoutProps","CrossmintFiatEmbeddedCheckout","__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
@@ -49,6 +49,5 @@
49
49
  "sideEffects": false,
50
50
  "type": "module",
51
51
  "types": "./dist/index.d.ts",
52
- "version": "1.1.9",
53
- "gitHead": "174ee9dbe81149942af4e03b4810c6dc0a81f36f"
52
+ "version": "1.1.10"
54
53
  }
@@ -17,13 +17,13 @@ describe("CrossmintPaymentElement", () => {
17
17
  expect(iframe).toHaveAttribute("src");
18
18
  expect(iframe).toHaveAttribute("id", "crossmint-embedded-checkout.iframe");
19
19
  expect(iframe).toHaveStyle({
20
- padding: "0px !important",
21
- width: "100% !important",
22
- minWidth: "100% !important",
23
- overflow: "hidden !important",
24
- display: "block !important",
20
+ padding: "0px",
21
+ width: "100%",
22
+ minWidth: "100%",
23
+ overflow: "hidden",
24
+ display: "block",
25
25
  userSelect: "none",
26
- transform: "translate(0px) !important",
26
+ transform: "translate(0px)",
27
27
  opacity: "1",
28
28
  transition: "ease 0s, opacity 0.4s ease 0.1s",
29
29
  });
@@ -49,15 +49,15 @@ export default function CrossmintEmbeddedCheckoutIFrame({
49
49
  role="crossmint-embedded-checkout.iframe"
50
50
  allow="payment *"
51
51
  style={{
52
- boxShadow: "none !important",
53
- border: "none !important",
54
- padding: "0px !important",
55
- width: "100% !important",
56
- minWidth: "100% !important",
57
- overflow: "hidden !important",
58
- display: "block !important",
52
+ boxShadow: "none",
53
+ border: "none",
54
+ padding: "0px",
55
+ width: "100%",
56
+ minWidth: "100%",
57
+ overflow: "hidden",
58
+ display: "block",
59
59
  userSelect: "none",
60
- transform: "translate(0px) !important",
60
+ transform: "translate(0px)",
61
61
  opacity: "1",
62
62
  transition: "ease 0s, opacity 0.4s ease 0.1s",
63
63
  height: `${height}px`,
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.1.9";
1
+ export const LIB_VERSION = "1.1.10";