@crossmint/client-sdk-react-ui 1.1.8 → 1.1.9
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/embed/fiat/FiatEmbeddedCheckout.tsx +6 -0
- package/src/components/embed/fiat/FiatEmbeddedCheckoutIFrame.tsx +0 -3
- package/src/components/embed/index.tsx +3 -3
- package/src/consts/version.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Lt=Object.create;var b=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols,_t=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var J=(t,e,n)=>e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,p=(t,e)=>{for(var n in e||(e={}))U.call(e,n)&&J(t,n,e[n]);if(I)for(var n of I(e))K.call(e,n)&&J(t,n,e[n]);return t};var k=(t,e)=>{var n={};for(var r in t)U.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&I)for(var r of I(t))e.indexOf(r)<0&&K.call(t,r)&&(n[r]=t[r]);return n};var Mt=(t,e)=>{for(var n in e)b(t,n,{get:e[n],enumerable:!0})},Q=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Bt(e))!U.call(t,a)&&a!==n&&b(t,a,{get:()=>e[a],enumerable:!(r=Rt(e,a))||r.enumerable});return t};var T=(t,e,n)=>(n=t!=null?Lt(_t(t)):{},Q(e||!t||!t.__esModule?b(n,"default",{value:t,enumerable:!0}):n,t)),Dt=t=>Q(b({},"__esModule",{value:!0}),t);var w=(t,e,n)=>new Promise((r,a)=>{var m=o=>{try{d(n.next(o))}catch(i){a(i)}},u=o=>{try{d(n.throw(o))}catch(i){a(i)}},d=o=>o.done?r(o.value):Promise.resolve(o.value).then(m,u);d((n=n.apply(t,e)).next())});var Gt={};Mt(Gt,{CrossmintEvents:()=>B.CrossmintEvents,CrossmintNFTCollectionView:()=>Ht,CrossmintNFTDetail:()=>Ut,CrossmintPayButton:()=>Yt,CrossmintPaymentElement:()=>At,useCrossmintEvents:()=>B.useCrossmintEvents});module.exports=Dt(Gt);var v=require("@crossmint/client-sdk-base");var C="1.1.8";var X=require("react/jsx-runtime");function Ht(t){(0,v.assertValidNFTCollectionViewProps)(t);let e=(0,v.getNFTCollectionViewSrc)(t,C);return(0,X.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}var x=require("@crossmint/client-sdk-base");var Z=require("react/jsx-runtime");function Ut(t){(0,x.assertValidValidateNFTDetailProps)(t);let e=(0,x.getNFTDetailSrc)(t,C);return(0,Z.jsx)("iframe",{src:e,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}var L=require("@crossmint/client-sdk-base");var ot=require("@crossmint/client-sdk-base");var j=T(require("lodash.isequal"),1),N=require("react");function A(t,e){let n=(0,N.useRef)(e);(0,N.useEffect)(()=>{if(e.some((a,m)=>!(0,j.default)(a,n.current[m])))return n.current=e,t()},[e])}var et=T(require("bs58"),1),l=require("@crossmint/client-sdk-base");var E=require("react"),F=require("@crossmint/client-sdk-base");var tt=require("react/jsx-runtime");function V(n){var r=n,{onInternalEvent:t}=r,e=k(r,["onInternalEvent"]);let{getUrl:a,listenToEvents:m,listenToInternalEvents:u}=(0,F.crossmintIFrameService)(e),[d,o]=(0,E.useState)(0),[i]=(0,E.useState)(a(e));return(0,E.useEffect)(()=>{let c=m(s=>{var h;return(h=e.onEvent)==null?void 0:h.call(e,s.data)});return()=>{c()}},[]),(0,E.useEffect)(()=>{let c=u(s=>{let{type:h,payload:_}=s.data;h===F.IncomingInternalEvents.UI_HEIGHT_CHANGED&&o(_.height),t==null||t(s.data)});return()=>{c()}},[]),(0,tt.jsx)("iframe",{src:i,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none !important",border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${d}px`}})}var nt=require("react/jsx-runtime");function Y(t){let{emitInternalEvent:e}=(0,l.crossmintIFrameService)(t),{signer:n,paymentMethod:r}=t;function a(o){let{type:i,payload:c}=o;if(i===l.IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION){let{serializedTransaction:s}=c;console.log("[Crossmint] Received incoming transaction",s),m(s)}if(i===l.IncomingInternalEvents.CRYPTO_CHAIN_SWITCH){let{chain:s}=c;console.log("[Crossmint] Received change of chain",s);let h=n.handleChainSwitch;if(h==null)throw new Error("switchNetwork function should have been defined");h(s)}}function m(o){return w(this,null,function*(){try{let i;switch(r){case"SOL":i=yield u(n,o);break;case"ETH":i=yield d(n,o);break;default:throw new Error(`Unsupported payment method ${r}`)}console.log("[Crossmint] Signed and sent transaction",i),e({type:l.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,payload:{txId:i}})}catch(i){console.error("[Crossmint] Failed to sign and send transaction",i),e({type:l.OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,payload:{}})}})}function u(o,i){return w(this,null,function*(){let{Transaction:c}=yield import("@solana/web3.js"),s=c.from(et.default.decode(i));return console.log("[Crossmint] Deserialized SOL transaction",s),yield o.signAndSendTransaction(s)})}function d(o,i){return w(this,null,function*(){let{parse:c}=yield import("@ethersproject/transactions"),s=c(i);return console.log("[Crossmint] Deserialized ETH transaction",s),yield o.signAndSendTransaction(s)})}return A(()=>{e({type:"params-update",payload:(0,l.embeddedCheckoutPropsToUpdatableParamsPayload)(t)})},[t.signer.address,t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs,..."chain"in t.signer?[t.signer.chain]:[]]),(0,nt.jsx)(V,p({onInternalEvent:a},t))}var it=require("react/jsx-runtime");function rt(t){if(!(0,ot.isCryptoEmbeddedCheckoutPropsWithSigner)(t))throw new Error("Invalid parameters: signer is required in versions < 2.0.0");return(0,it.jsx)(Y,p({},t))}var g=require("react"),O=require("@crossmint/client-sdk-base"),at=require("react/jsx-runtime");function st(t){let[e,n]=(0,g.useState)(0),{getIframeUrl:r,listenToEvents:a,emitQueryParams:m}=(0,O.crossmintPaymentService_OLD)(t),{listenToEvents:u}=(0,O.crossmintUiService_OLD)({environment:t.environment}),[d]=(0,g.useState)(r());return(0,g.useEffect)(()=>{let o=a(i=>{var c;return(c=t.onEvent)==null?void 0:c.call(t,i.data)});return()=>{o&&o()}},[]),(0,g.useEffect)(()=>{let o=u(i=>{let{type:c,payload:s}=i.data;switch(c){case"ui:height.changed":n(s.height);break;default:return}});return()=>{o&&o()}},[]),(0,g.useEffect)(()=>{m({recipient:t.recipient,mintConfig:t.mintConfig,locale:t.locale,currency:t.currency,whPassThroughArgs:t.whPassThroughArgs})},[t.recipient,t.mintConfig,t.locale,t.currency,t.whPassThroughArgs]),(0,at.jsx)("iframe",{src:d,id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{border:"none !important",padding:"0px !important",width:"100% !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none",transform:"translate(0px) !important",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${e}px`}})}var G=require("react/jsx-runtime");function At(t){if((0,L.isFiatEmbeddedCheckoutProps)(t))return(0,G.jsx)(st,p({},t));if((0,L.isCryptoEmbeddedCheckoutProps)(t))return(0,G.jsx)(rt,p({},t));throw new Error("Unsupported: Fiat is the only supported payment method.")}var ut=require("react"),ht=require("react"),y=require("@crossmint/client-sdk-base");var R=require("react");function W(){let[t,e]=(0,R.useState)(!0);return(0,R.useEffect)(()=>{e(!1)},[]),{isServerSideRendering:t}}var mt=require("react-jss"),Vt="#1e1e1e",ct=t=>t==="light",dt=t=>({buttonBgColor:ct(t)?"white":Vt,paragraphColor:ct(t)?"black":"white"}),lt=(0,mt.createUseStyles)({"@global":{"@import":"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')"},crossmintButton:{display:"flex","flex-direction":"row","align-items":"center",padding:"0.875rem 0.875rem","font-weight":"900",transition:"opacity ease-in-out 0.25s","border-radius":"0.5rem","font-family":'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',outline:"none",border:"none","box-shadow":"0px 8px 15px rgba(0, 0, 0, 0.1)","justify-content":"center",background:({buttonBgColor:t})=>t,"&:hover:enabled":{opacity:"0.6",cursor:"pointer"}},crossmintImg:{width:"21px",height:"21px","margin-right":"0.875rem"},crossmintParagraph:{color:({paragraphColor:t})=>t,margin:"0"}});var f=require("react/jsx-runtime");function Yt(t){let z=t,{className:e,disabled:n,onClick:r,style:a,tabIndex:m,theme:u="dark",mintTo:d,emailTo:o,listingId:i,auctionId:c,showOverlay:s=!0,mintConfig:h,whPassThroughArgs:_,environment:pt,paymentMethod:P,preferredSigninMethod:ft,dismissOverlayOnClick:gt,prepay:Ct,locale:$="en-US",currency:Et="usd",successCallbackURL:yt="",failureCallbackURL:bt="",loginEmail:Pt="",projectId:St,getButtonText:M,checkoutProps:q={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=z,D=k(z,["className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps"]),It="clientId"in D?D.clientId:D.collectionId,[S,kt]=(0,ht.useState)(!1),{isServerSideRendering:Tt}=W(),{connect:wt}=(0,y.crossmintModalService)({clientId:It,projectId:St,showOverlay:s,dismissOverlayOnClick:gt,setConnecting:kt,libVersion:C,environment:pt,clientName:y.clientNames.reactUi,locale:$,currency:Et,successCallbackURL:yt,failureCallbackURL:bt,loginEmail:Pt}),{getButtonText:vt,handleClick:xt}=(0,y.crossmintPayButtonService)({onClick:r,connecting:S,paymentMethod:P,locale:$,checkoutProps:q}),Nt=Ot=>xt(Ot,()=>{wt(h,d,o,i,_,P,ft,Ct,q)}),H=lt(dt(u)),Ft=(0,ut.useMemo)(()=>(0,f.jsx)("span",{className:H.crossmintParagraph,role:"button-paragraph",children:M!=null?M(S,P||"fiat"):vt(S)}),[S,M,P]);return(0,f.jsx)(f.Fragment,{children:!Tt&&(0,f.jsxs)("button",{className:`${H.crossmintButton} ${e||""}`,disabled:n,onClick:Nt,style:p({},a),tabIndex:m,children:[(0,f.jsx)("img",{className:H.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),Ft]})})}var B=require("@crossmint/client-sdk-base");0&&(module.exports={CrossmintEvents,CrossmintNFTCollectionView,CrossmintNFTDetail,CrossmintPayButton,CrossmintPaymentElement,useCrossmintEvents});
|
|
1
|
+
"use strict";var 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});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatPaymentElement_OLD.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts"],"sourcesContent":["export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n","import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.1.8\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatPaymentElement_OLD } from \"./fiat/FiatPaymentElement_OLD\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatPaymentElement_OLD {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\nimport bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import { useEffect, useState } from \"react\";\n\nimport { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from \"@crossmint/client-sdk-base\";\nimport { CrossmintEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none !important\",\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\nimport { crossmintPaymentService_OLD, crossmintUiService_OLD } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatPaymentElement_OLD(props: FiatEmbeddedCheckoutProps) {\n const [height, setHeight] = useState(0);\n const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService_OLD(props);\n const { listenToEvents: listenToUiEvents } = crossmintUiService_OLD({ environment: props.environment });\n const [url] = useState(getIframeUrl());\n\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n const clearListener = listenToUiEvents((event: MessageEvent<any>) => {\n const { type, payload } = event.data;\n\n switch (type) {\n case \"ui:height.changed\":\n setHeight(payload.height);\n break;\n default:\n return;\n }\n });\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n emitQueryParams({\n recipient: props.recipient,\n mintConfig: props.mintConfig,\n locale: props.locale,\n currency: props.currency,\n whPassThroughArgs: props.whPassThroughArgs,\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n ></iframe>\n );\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n"],"mappings":"ksCAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,sEAAAE,GAAA,uBAAAC,GAAA,uBAAAC,GAAA,4BAAAC,GAAA,6DAAAC,GAAAN,ICAA,IAAAO,EAA2E,sCCApE,IAAMC,EAAc,QDWnB,IAAAC,EAAA,6BAND,SAASC,GAA2BC,EAA+B,IACtE,qCAAkCA,CAAK,EAEvC,IAAMC,KAAM,2BAAwBD,EAAOE,CAAW,EAEtD,SACI,OAAC,UACG,IAAKD,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,IAAAE,EAAmE,sCAW3D,IAAAC,EAAA,6BAND,SAASC,GAAmBC,EAAuB,IACtD,qCAAkCA,CAAK,EAEvC,IAAMC,KAAM,mBAAgBD,EAAOE,CAAW,EAE9C,SACI,OAAC,UACG,IAAKD,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,IAAAE,EAIO,sCCJP,IAAAC,GAAqF,sCCArF,IAAAC,EAAoB,+BACpBC,EAAkE,iBAEnD,SAARC,EAA+BC,EAA0BC,EAAoC,CAChG,IAAMC,KAAkB,UAAOD,CAAY,KAE3C,aAAU,IAAM,CAGZ,GAFmBA,EAAa,KAAK,CAACE,EAAKC,IAAM,IAAC,EAAAC,SAAQF,EAAKD,EAAgB,QAAQE,CAAC,CAAC,CAAC,EAGtF,OAAAF,EAAgB,QAAUD,EACnBD,EAAS,CAExB,EAAG,CAACC,CAAY,CAAC,CACrB,CCbA,IAAAK,GAAiB,qBA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export","CrossmintNFTCollectionView","CrossmintNFTDetail","CrossmintPayButton","CrossmintPaymentElement","__toCommonJS","import_client_sdk_base","LIB_VERSION","import_jsx_runtime","CrossmintNFTCollectionView","props","src","LIB_VERSION","import_client_sdk_base","import_jsx_runtime","CrossmintNFTDetail","props","src","LIB_VERSION","import_client_sdk_base","import_client_sdk_base","import_lodash","import_react","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","isEqual","import_bs58","import_client_sdk_base","import_react","import_client_sdk_base","import_jsx_runtime","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","height","setHeight","url","clearListener","event","type","payload","import_jsx_runtime","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","signer","paymentMethod","onInternalEvent","event","type","payload","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","CrossmintEmbeddedCheckoutIFrame","__spreadValues","import_jsx_runtime","CrossmintCryptoEmbeddedCheckout","props","CryptoEmbeddedCheckoutIFrame","__spreadValues","import_react","import_client_sdk_base","import_jsx_runtime","CrossmintFiatPaymentElement_OLD","props","height","setHeight","getIframeUrl","listenToEvents","emitQueryParams","listenToUiEvents","url","clearListener","event","_a","type","payload","import_jsx_runtime","CrossmintPaymentElement","props","CrossmintFiatPaymentElement_OLD","__spreadValues","CrossmintCryptoEmbeddedCheckout","import_react","import_client_sdk_base","import_react","useEnvironment","isServerSideRendering","setIsServerSideRendering","import_react_jss","DARK_BG","themeIsLight","theme","formatProps","useStyles","buttonBgColor","paragraphColor","import_jsx_runtime","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","isServerSideRendering","useEnvironment","connect","LIB_VERSION","getButtonTextInternal","handleClick","_handleClick","event","classes","useStyles","formatProps","content","__spreadValues","import_client_sdk_base"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/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,qCAAkCA,CAAK,EAEvC,IAAMC,KAAM,2BAAwBD,EAAOE,CAAW,EAEtD,SACI,OAAC,UACG,IAAKD,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,IAAAE,EAAmE,sCAW3D,IAAAC,EAAA,6BAND,SAASC,GAAmBC,EAAuB,IACtD,qCAAkCA,CAAK,EAEvC,IAAMC,KAAM,mBAAgBD,EAAOE,CAAW,EAE9C,SACI,OAAC,UACG,IAAKD,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,IAAAE,EAIO,sCCJP,IAAAC,GAAqF,sCCArF,IAAAC,EAAoB,+BACpBC,EAAkE,iBAEnD,SAARC,EAA+BC,EAA0BC,EAAoC,CAChG,IAAMC,KAAkB,UAAOD,CAAY,KAE3C,aAAU,IAAM,CAGZ,GAFmBA,EAAa,KAAK,CAACE,EAAKC,IAAM,IAAC,EAAAC,SAAQF,EAAKD,EAAgB,QAAQE,CAAC,C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ACK,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"]}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
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};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatPaymentElement_OLD.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts","../src/index.ts"],"sourcesContent":["import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.1.8\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatPaymentElement_OLD } from \"./fiat/FiatPaymentElement_OLD\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatPaymentElement_OLD {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\nimport bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import { useEffect, useState } from \"react\";\n\nimport { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from \"@crossmint/client-sdk-base\";\nimport { CrossmintEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none !important\",\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\nimport { crossmintPaymentService_OLD, crossmintUiService_OLD } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatPaymentElement_OLD(props: FiatEmbeddedCheckoutProps) {\n const [height, setHeight] = useState(0);\n const { getIframeUrl, listenToEvents, emitQueryParams } = crossmintPaymentService_OLD(props);\n const { listenToEvents: listenToUiEvents } = crossmintUiService_OLD({ environment: props.environment });\n const [url] = useState(getIframeUrl());\n\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n const clearListener = listenToUiEvents((event: MessageEvent<any>) => {\n const { type, payload } = event.data;\n\n switch (type) {\n case \"ui:height.changed\":\n setHeight(payload.height);\n break;\n default:\n return;\n }\n });\n\n return () => {\n if (clearListener) {\n clearListener();\n }\n };\n }, []);\n\n useEffect(() => {\n emitQueryParams({\n recipient: props.recipient,\n mintConfig: props.mintConfig,\n locale: props.locale,\n currency: props.currency,\n whPassThroughArgs: props.whPassThroughArgs,\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n border: \"none !important\",\n padding: \"0px !important\",\n width: \"100% !important\",\n minWidth: \"100% !important\",\n overflow: \"hidden !important\",\n display: \"block !important\",\n userSelect: \"none\",\n transform: \"translate(0px) !important\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n ></iframe>\n );\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\r\n\r\nexport default function useEnvironment() {\r\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\r\n useEffect(() => {\r\n setIsServerSideRendering(false);\r\n }, []);\r\n\r\n return { isServerSideRendering };\r\n}\r\n","import { createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport const useStyles = createUseStyles({\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n});\n","export * from \"./components\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n"],"mappings":"0sBAAA,OAAS,qCAAAA,GAAmC,2BAAAC,OAA+B,6BCApE,IAAMC,EAAc,QDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,OAAS,qCAAAG,GAAmC,mBAAAC,OAAuB,6BAW3D,cAAAC,OAAA,oBAND,SAASC,GAAmBC,EAAuB,CACtDC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAgBH,EAAOI,CAAW,EAE9C,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,OAEI,iCAAAG,GACA,+BAAAC,OACG,6BCJP,OAAsC,2CAAAC,OAA+C,6BCArF,OAAOC,OAAa,iBACpB,OAAyC,aAAAC,GAAW,UAAAC,OAAc,QAEnD,SAARC,EAA+BC,EAA0BC,EAAoC,CAChG,IAAMC,EAAkBJ,GAAOG,CAAY,EAE3CJ,GAAU,IAAM,CAG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AAUC,EAAUC,EAAYxC,CAAK,CAAC,EAEtCyC,GAAUC,GAAQ,IAEhBpD,EAAC,QAAK,UAAWgD,EAAQ,mBAAoB,KAAK,mBAC7C,SAAAnB,GAAiB,KACZA,EAAcK,EAAYf,GAAiB,MAAM,EACjDwB,GAAsBT,CAAU,EAC1C,EAEL,CAACA,EAAYL,EAAeV,CAAa,CAAC,EAE7C,OACInB,EAAAD,GAAA,CACK,UAACsC,IACEpC,GAAC,UACG,UAAW,GAAG+C,EAAQ,eAAe,IAAI3C,GAAa,EAAE,GACxD,SAAUC,EACV,QAASwC,GACT,MAAOO,EAAA,GAAK7C,GACZ,SAAUC,EAEV,UAAAT,EAAC,OACG,UAAWgD,EAAQ,aACnB,IAAI,qDACJ,IAAI,iBACR,EACCG,IACL,EAER,CAER,CGjIA,OAAS,mBAAAG,GAAiB,sBAAAC,OAA0B","names":["assertValidNFTCollectionViewProps","getNFTCollectionViewSrc","LIB_VERSION","jsx","CrossmintNFTCollectionView","props","assertValidNFTCollectionViewProps","src","getNFTCollectionViewSrc","LIB_VERSION","assertValidValidateNFTDetailProps","getNFTDetailSrc","jsx","CrossmintNFTDetail","props","assertValidValidateNFTDetailProps","src","getNFTDetailSrc","LIB_VERSION","isCryptoEmbeddedCheckoutProps","isFiatEmbeddedCheckoutProps","isCryptoEmbeddedCheckoutPropsWithSigner","isEqual","useEffect","useRef","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","bs58","IncomingInternalEvents","OutgoingInternalEvents","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","useEffect","useState","IncomingInternalEvents","crossmintIFrameService","jsx","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","crossmintIFrameService","height","setHeight","useState","url","useEffect","clearListener","event","type","payload","IncomingInternalEvents","jsx","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","signer","paymentMethod","onInternalEvent","event","type","payload","IncomingInternalEvents","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","OutgoingInternalEvents","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintCryptoEmbeddedCheckout","props","isCryptoEmbeddedCheckoutPropsWithSigner","CryptoEmbeddedCheckoutIFrame","__spreadValues","useEffect","useState","crossmintPaymentService_OLD","crossmintUiService_OLD","jsx","CrossmintFiatPaymentElement_OLD","props","height","setHeight","getIframeUrl","listenToEvents","emitQueryParams","listenToUiEvents","url","clearListener","event","_a","type","payload","jsx","CrossmintPaymentElement","props","isFiatEmbeddedCheckoutProps","CrossmintFiatPaymentElement_OLD","__spreadValues","isCryptoEmbeddedCheckoutProps","CrossmintCryptoEmbeddedCheckout","useMemo","useState","clientNames","crossmintModalService","crossmintPayButtonService","useEffect","useState","useEnvironment","isServerSideRendering","setIsServerSideRendering","createUseStyles","DARK_BG","themeIsLight","theme","formatProps","useStyles","buttonBgColor","paragraphColor","Fragment","jsx","jsxs","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","useState","isServerSideRendering","useEnvironment","connect","crossmintModalService","LIB_VERSION","clientNames","getButtonTextInternal","handleClick","crossmintPayButtonService","_handleClick","event","classes","useStyles","formatProps","content","useMemo","__spreadValues","CrossmintEvents","useCrossmintEvents"]}
|
|
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"],"m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Q,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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Paella Labs Inc",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@crossmint/client-sdk-base": "1.1.
|
|
5
|
-
"@crossmint/common-sdk-base": "0.0.
|
|
4
|
+
"@crossmint/client-sdk-base": "1.1.12",
|
|
5
|
+
"@crossmint/common-sdk-base": "0.0.11",
|
|
6
6
|
"@ethersproject/transactions": "5.7.0",
|
|
7
7
|
"@solana/web3.js": "1.78.5",
|
|
8
8
|
"bs58": "5.0.0",
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
"sideEffects": false,
|
|
50
50
|
"type": "module",
|
|
51
51
|
"types": "./dist/index.d.ts",
|
|
52
|
-
"version": "1.1.
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"version": "1.1.9",
|
|
53
|
+
"gitHead": "174ee9dbe81149942af4e03b4810c6dc0a81f36f"
|
|
54
54
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import FiatEmbeddedCheckoutIFrame from "@/components/embed/fiat/FiatEmbeddedCheckoutIFrame";
|
|
2
|
+
import { FiatEmbeddedCheckoutProps } from "@crossmint/client-sdk-base";
|
|
3
|
+
|
|
4
|
+
export function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {
|
|
5
|
+
return <FiatEmbeddedCheckoutIFrame {...props} />;
|
|
6
|
+
}
|
|
@@ -3,8 +3,5 @@ import { FiatEmbeddedCheckoutProps } from "@crossmint/client-sdk-base";
|
|
|
3
3
|
import CrossmintEmbeddedCheckoutIFrame from "../EmbeddedCheckoutIFrame";
|
|
4
4
|
|
|
5
5
|
export default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {
|
|
6
|
-
throw new Error(
|
|
7
|
-
"Unsupported: This component should not be called yet, as its a placeholder for the v2 fiat checkout."
|
|
8
|
-
);
|
|
9
6
|
return <CrossmintEmbeddedCheckoutIFrame {...props} />;
|
|
10
7
|
}
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "@crossmint/client-sdk-base";
|
|
6
6
|
|
|
7
7
|
import { CrossmintCryptoEmbeddedCheckout } from "./crypto/CryptoEmbeddedCheckout";
|
|
8
|
-
import {
|
|
8
|
+
import { CrossmintFiatEmbeddedCheckout } from "./fiat/FiatEmbeddedCheckout";
|
|
9
9
|
|
|
10
|
-
// TODO: Rename to CrossmintEmbeddedCheckout
|
|
10
|
+
// TODO: Rename to CrossmintEmbeddedCheckout on v2 major publish, prior announcement since its a breaking change
|
|
11
11
|
export function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {
|
|
12
12
|
if (isFiatEmbeddedCheckoutProps(props)) {
|
|
13
|
-
return <
|
|
13
|
+
return <CrossmintFiatEmbeddedCheckout {...props} />;
|
|
14
14
|
}
|
|
15
15
|
if (isCryptoEmbeddedCheckoutProps(props)) {
|
|
16
16
|
return <CrossmintCryptoEmbeddedCheckout {...props} />;
|
package/src/consts/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.1.
|
|
1
|
+
export const LIB_VERSION = "1.1.9";
|