@crossmint/client-sdk-react-ui 2.0.2 → 2.0.4
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/{chunk-JT3NR25K.js → chunk-2B3BRAGH.js} +1 -1
- package/dist/{chunk-VCW3P24O.js → chunk-6BZLFCRF.js} +1 -1
- package/dist/{chunk-OSZKXRWI.cjs → chunk-A6R7HDBM.cjs} +1 -1
- package/dist/{chunk-TEAP72MH.js → chunk-AE5SVA7I.js} +1 -1
- package/dist/{chunk-IWYN2XTH.cjs → chunk-BJXEVV7U.cjs} +1 -1
- package/dist/{chunk-H2FBPKPM.js → chunk-DXAJE3HC.js} +1 -1
- package/dist/{chunk-H24FAR4S.cjs → chunk-EM7VCISS.cjs} +1 -1
- package/dist/{chunk-THA42ZZ3.cjs → chunk-FEPFMUVU.cjs} +1 -1
- package/dist/chunk-HAAUJ7YI.js +1 -0
- package/dist/{chunk-G5UJVC6S.js → chunk-I2C2FB54.js} +1 -1
- package/dist/chunk-KARK5Z2D.cjs +1 -0
- package/dist/{chunk-6QTLBFTH.cjs → chunk-LIDU7UTR.cjs} +1 -1
- package/dist/{chunk-6WZW6KZ3.cjs → chunk-MB4Z6LUX.cjs} +1 -1
- package/dist/chunk-OBZYPTUP.js +11 -0
- package/dist/{chunk-PI6HNTXR.js → chunk-ONAKCA4D.js} +1 -1
- package/dist/{chunk-QJWHE3V5.cjs → chunk-OODXBWXT.cjs} +1 -1
- package/dist/{chunk-AG6QZ4ZH.cjs → chunk-SKAVRVZO.cjs} +1 -1
- package/dist/{chunk-72QCIJOJ.js → chunk-UYDOK7C2.js} +1 -1
- package/dist/{chunk-X2CWT5GV.cjs → chunk-V4WHA56U.cjs} +1 -1
- package/dist/{chunk-I62VLILX.js → chunk-VTJUGIIC.js} +1 -1
- package/dist/{chunk-K232ZA6H.cjs → chunk-VUQ52YK5.cjs} +1 -1
- package/dist/chunk-X5EEGZ3H.js +1 -0
- package/dist/{chunk-INQQGTE5.js → chunk-XJANLALP.js} +1 -1
- package/dist/{chunk-ALPTKMQQ.js → chunk-YTGYJDBB.js} +1 -1
- package/dist/{chunk-WI77DKHX.cjs → chunk-Z3RU4H6K.cjs} +1 -1
- package/dist/{chunk-27GDDXUI.cjs → chunk-ZIDK43ZX.cjs} +4 -4
- package/dist/components/CrossmintNFTCollectionView.cjs +1 -1
- package/dist/components/CrossmintNFTCollectionView.js +1 -1
- package/dist/components/CrossmintNFTDetail.cjs +1 -1
- package/dist/components/CrossmintNFTDetail.js +1 -1
- package/dist/components/auth/AuthForm.cjs +1 -1
- package/dist/components/auth/AuthForm.js +1 -1
- package/dist/components/auth/AuthFormBackButton.cjs +1 -1
- package/dist/components/auth/AuthFormBackButton.js +1 -1
- package/dist/components/auth/AuthFormDialog.cjs +1 -1
- package/dist/components/auth/AuthFormDialog.js +1 -1
- package/dist/components/auth/EmbeddedAuthForm.cjs +1 -1
- package/dist/components/auth/EmbeddedAuthForm.js +1 -1
- package/dist/components/auth/PasskeyPrompt.cjs +1 -1
- package/dist/components/auth/PasskeyPrompt.js +1 -1
- package/dist/components/auth/methods/email/EmailAuthFlow.cjs +1 -1
- package/dist/components/auth/methods/email/EmailAuthFlow.js +1 -1
- package/dist/components/auth/methods/email/EmailOTPInput.cjs +1 -1
- package/dist/components/auth/methods/email/EmailOTPInput.js +1 -1
- package/dist/components/auth/methods/email/EmailSignIn.cjs +1 -1
- package/dist/components/auth/methods/email/EmailSignIn.js +1 -1
- package/dist/components/auth/methods/farcaster/FarcasterSignIn.cjs +1 -1
- package/dist/components/auth/methods/farcaster/FarcasterSignIn.js +1 -1
- package/dist/components/auth/methods/google/ContinueWithGoogle.cjs +1 -1
- package/dist/components/auth/methods/google/ContinueWithGoogle.js +1 -1
- package/dist/components/auth/methods/google/GoogleSignIn.cjs +1 -1
- package/dist/components/auth/methods/google/GoogleSignIn.js +1 -1
- package/dist/components/auth/methods/twitter/TwitterSignIn.cjs +1 -1
- package/dist/components/auth/methods/twitter/TwitterSignIn.js +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlow.cjs +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlow.js +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlowButton.cjs +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlowButton.js +1 -1
- package/dist/components/auth/methods/web3/Web3Connectors.cjs +1 -1
- package/dist/components/auth/methods/web3/Web3Connectors.js +1 -1
- package/dist/components/common/Divider.cjs +1 -1
- package/dist/components/common/Divider.js +1 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.cjs +1 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.js +1 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3IFrame.cjs +1 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3IFrame.js +1 -1
- package/dist/components/embed/v3/index.cjs +1 -1
- package/dist/components/embed/v3/index.js +1 -1
- package/dist/components/hosted/CrossmintPayButton_DEPRECATED.cjs +1 -1
- package/dist/components/hosted/CrossmintPayButton_DEPRECATED.js +1 -1
- package/dist/components/hosted/index.cjs +1 -1
- package/dist/components/hosted/index.js +1 -1
- package/dist/components/hosted/v3/CrossmintHostedCheckoutV3.cjs +1 -1
- package/dist/components/hosted/v3/CrossmintHostedCheckoutV3.js +1 -1
- package/dist/components/hosted/v3/index.cjs +1 -1
- package/dist/components/hosted/v3/index.js +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/consts/version.cjs +1 -1
- package/dist/consts/version.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAuth.cjs +1 -1
- package/dist/hooks/useAuth.js +1 -1
- package/dist/hooks/useCrossmint.cjs +1 -1
- package/dist/hooks/useCrossmint.d.cts +2 -2
- package/dist/hooks/useCrossmint.d.ts +2 -2
- package/dist/hooks/useCrossmint.js +1 -1
- package/dist/hooks/useCrossmintAuth.cjs +1 -1
- package/dist/hooks/useCrossmintAuth.js +1 -1
- package/dist/hooks/useCrossmintCheckout.cjs +1 -1
- package/dist/hooks/useCrossmintCheckout.js +1 -1
- package/dist/hooks/useOAuthWindowListener.cjs +1 -1
- package/dist/hooks/useOAuthWindowListener.js +1 -1
- package/dist/hooks/useWallet.cjs +1 -1
- package/dist/hooks/useWallet.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/providers/CrossmintAuthProvider.cjs +1 -1
- package/dist/providers/CrossmintAuthProvider.js +1 -1
- package/dist/providers/CrossmintWalletProvider.cjs +1 -1
- package/dist/providers/CrossmintWalletProvider.js +1 -1
- package/dist/providers/auth/AuthFormProvider.cjs +1 -1
- package/dist/providers/auth/AuthFormProvider.js +1 -1
- package/dist/providers/dynamic/DynamicWalletProvider.cjs +1 -1
- package/dist/providers/dynamic/DynamicWalletProvider.js +1 -1
- package/dist/providers/index.cjs +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/utils/createCrossmintApiClient.cjs +1 -1
- package/dist/utils/createCrossmintApiClient.js +1 -1
- package/package.json +7 -7
- package/dist/chunk-2F4SKIIM.cjs +0 -1
- package/dist/chunk-6T3CVJ6Z.js +0 -11
- package/dist/chunk-F5Q5XTSI.js +0 -1
- package/dist/chunk-JESO24HE.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-XJANLALP.js";import{b as o}from"./chunk-HAAUJ7YI.js";import{createContext as h,useContext as l,useEffect as g,useState as s}from"react";import{jsx as k}from"react/jsx-runtime";var d=h(void 0);function b({children:e}){let[r,c]=s(void 0),[u,C]=s(void 0),{crossmint:m}=o(),a=i(m,{usageOrigin:"client"});return g(()=>{let n=t=>{if(t.origin!==new URL(a.baseUrl).origin||t.data.event!=="order:updated")return;let{order:f,orderClientSecret:p}=t.data.data;c(f),C(p)};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[r]),k(d.Provider,{value:{order:r,orderClientSecret:u},children:e})}function S(){let e=l(d);if(!e)throw new Error("useCrossmintCheckout must be used within a CrossmintCheckoutProvider");return e}export{b as a,S as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C}from"./chunk-EA7H4AXL.js";import{a}from"./chunk-
|
|
1
|
+
import{a as C}from"./chunk-EA7H4AXL.js";import{a}from"./chunk-XJANLALP.js";import{b as l}from"./chunk-HAAUJ7YI.js";import{a as m,b as u,c as s}from"./chunk-PXDN3KFO.js";import{crossmintHostedCheckoutV3Service as M,crossmintHostedCheckoutV3StylesService as N}from"@crossmint/client-sdk-base";import R from"clsx";import{useEffect as T,useState as j}from"react";import{jsx as d,jsxs as w}from"react/jsx-runtime";function z(f){let[h,k]=j(!1),{crossmint:y}=l(),P=a(y),c=f,{recipient:g,locale:H,lineItems:S,payment:V,appearance:v}=c,b=s(c,["recipient","locale","lineItems","payment","appearance"]),n={recipient:g,locale:H,lineItems:S,payment:V,appearance:v},x=M({apiClient:P,hostedCheckoutProps:n}),t=N(n),p=b,{onClick:r,className:E,children:e}=p,I=s(p,["onClick","className","children"]);function B(o){o.preventDefault(),o.stopPropagation(),x.createWindow(),r&&r(o)}let i=t.generateCss();return T(()=>{let{cleanup:o}=t.injectCss(i);return k(!0),o},[i]),h?w("button",u(m({onClick:B,className:R(t.identifiers.buttonClassNames,E)},I),{children:[d(C,{style:{marginRight:"12px",flex:"none"},displayType:"icon-only",id:t.identifiers.logoId,height:16,width:16}),e!=null?e:d("p",{style:{margin:0},children:t.getButtonText()})]})):null}export{z as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBJXEVV7Ucjs = require('./chunk-BJXEVV7U.cjs');var _clientsdkbase = require('@crossmint/client-sdk-base');var _jsxruntime = require('react/jsx-runtime');function n(r){_clientsdkbase.assertValidValidateNFTDetailProps.call(void 0, r);let o=_clientsdkbase.getNFTDetailSrc.call(void 0, r,_chunkBJXEVV7Ucjs.a);return _jsxruntime.jsx.call(void 0, "iframe",{src:o,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}exports.a = n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as o}from"./chunk-
|
|
1
|
+
import{q as o}from"./chunk-OBZYPTUP.js";import{jsx as m}from"react/jsx-runtime";function d(){return m(o,{className:"w-full"})}export{d as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="2.0.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="2.0.4";var c=s;exports.a = c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk-5X3MPD2V.js";import{a as y}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-5X3MPD2V.js";import{a as y}from"./chunk-XJANLALP.js";import{b as p}from"./chunk-HAAUJ7YI.js";import{a,b as l}from"./chunk-PXDN3KFO.js";import{lazy as v,useEffect as f,useRef as s,useState as C}from"react";import{crossmintEmbeddedCheckoutV3Service as S}from"@crossmint/client-sdk-base";import{Fragment as x,jsx as o,jsxs as H}from"react/jsx-runtime";var V=v(()=>import("./components/embed/v3/crypto/CryptoWalletConnectionHandler.js").then(t=>({default:t.CryptoWalletConnectionHandler})));function K(t){var m;let[e,P]=C(null),[b,g]=C(0),k=s((m=t.payment.crypto.payer)==null?void 0:m.initialChain),n=s(t);if(I(t,n.current)){let r=a({},t),u=w(t,k.current);u.shouldPreserve&&(r.payment.crypto.payer=u.updatedPayer),n.current=r}let{crossmint:E}=p(),d=y(E,{usageOrigin:"client"}),c=S({apiClient:d}),i=s(null);return f(()=>{let r=i.current;!r||e||P(c.iframe.createClient(r))},[i.current,e]),f(()=>{if(e!=null)return e.on("ui:height.changed",r=>g(r.height)),()=>{e.off("ui:height.changed")}},[e]),H(x,{children:[o("iframe",{ref:i,src:c.iframe.getUrl(n.current),id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none",border:"none",padding:"0px",width:"100%",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",transform:"translate(0px)",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${b}px`,backgroundColor:"transparent"}}),n.current.payment.crypto.enabled?n.current.payment.crypto.payer!=null?o(h,{payer:n.current.payment.crypto.payer,iframeClient:e}):o(V,{iframeClient:e,apiKeyEnvironment:d.parsedAPIKey.environment}):null,o("span",{id:"crossmint-focus-target",tabIndex:-1})]})}function I(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function w(t,e){return t.payment.crypto.payer&&e!=null?{shouldPreserve:!0,updatedPayer:l(a({},t.payment.crypto.payer),{initialChain:e})}:{shouldPreserve:!1}}export{K as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkQLPV72AEcjs = require('./chunk-QLPV72AE.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkQLPV72AEcjs = require('./chunk-QLPV72AE.cjs');var _chunkZ3RU4H6Kcjs = require('./chunk-Z3RU4H6K.cjs');var _chunkKARK5Z2Dcjs = require('./chunk-KARK5Z2D.cjs');var _chunk2WSEHVNPcjs = require('./chunk-2WSEHVNP.cjs');var _react = require('react');var _clientsdkbase = require('@crossmint/client-sdk-base');var _jsxruntime = require('react/jsx-runtime');var V=_react.lazy.call(void 0, ()=>Promise.resolve().then(() => _interopRequireWildcard(require("./components/embed/v3/crypto/CryptoWalletConnectionHandler.cjs"))).then(t=>({default:t.CryptoWalletConnectionHandler})));function J(t){var m;let[e,P]=_react.useState.call(void 0, null),[b,g]=_react.useState.call(void 0, 0),k=_react.useRef.call(void 0, (m=t.payment.crypto.payer)==null?void 0:m.initialChain),n=_react.useRef.call(void 0, t);if(I(t,n.current)){let r=_chunk2WSEHVNPcjs.a.call(void 0, {},t),u=w(t,k.current);u.shouldPreserve&&(r.payment.crypto.payer=u.updatedPayer),n.current=r}let{crossmint:E}=_chunkKARK5Z2Dcjs.b.call(void 0, ),d=_chunkZ3RU4H6Kcjs.a.call(void 0, E,{usageOrigin:"client"}),c=_clientsdkbase.crossmintEmbeddedCheckoutV3Service.call(void 0, {apiClient:d}),i=_react.useRef.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let r=i.current;!r||e||P(c.iframe.createClient(r))},[i.current,e]),_react.useEffect.call(void 0, ()=>{if(e!=null)return e.on("ui:height.changed",r=>g(r.height)),()=>{e.off("ui:height.changed")}},[e]),_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "iframe",{ref:i,src:c.iframe.getUrl(n.current),id:"crossmint-embedded-checkout.iframe",role:"crossmint-embedded-checkout.iframe",allow:"payment *",style:{boxShadow:"none",border:"none",padding:"0px",width:"100%",minWidth:"100%",overflow:"hidden",display:"block",userSelect:"none",transform:"translate(0px)",opacity:"1",transition:"ease 0s, opacity 0.4s ease 0.1s",height:`${b}px`,backgroundColor:"transparent"}}),n.current.payment.crypto.enabled?n.current.payment.crypto.payer!=null?_jsxruntime.jsx.call(void 0, _chunkQLPV72AEcjs.a,{payer:n.current.payment.crypto.payer,iframeClient:e}):_jsxruntime.jsx.call(void 0, V,{iframeClient:e,apiKeyEnvironment:d.parsedAPIKey.environment}):null,_jsxruntime.jsx.call(void 0, "span",{id:"crossmint-focus-target",tabIndex:-1})]})}function I(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function w(t,e){return t.payment.crypto.payer&&e!=null?{shouldPreserve:!0,updatedPayer:_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {},t.payment.crypto.payer),{initialChain:e})}:{shouldPreserve:!1}}exports.a = J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBJXEVV7Ucjs = require('./chunk-BJXEVV7U.cjs');var _clientsdkbase = require('@crossmint/client-sdk-base');var _jsxruntime = require('react/jsx-runtime');function m(o){_clientsdkbase.assertValidNFTCollectionViewProps.call(void 0, o);let i=_clientsdkbase.getNFTCollectionViewSrc.call(void 0, o,_chunkBJXEVV7Ucjs.a);return _jsxruntime.jsx.call(void 0, "iframe",{src:i,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}exports.a = m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext as p,useCallback as m,useContext as x,useMemo as a,useRef as v,useState as j}from"react";import{createCrossmint as h}from"@crossmint/common-sdk-base";import y from"lodash.isequal";import{jsx as P}from"react/jsx-runtime";var C=p(null);function J({children:r,apiKey:n,overrideBaseUrl:c}){let[f,d]=j(0),e=v(new Proxy(h({apiKey:n,overrideBaseUrl:c}),{set(t,i,u){return i==="jwt"&&t.jwt!==u&&d(w=>w+1),Reflect.set(t,i,u)}})),o=m(t=>{t!==e.current.jwt&&(e.current.jwt=t)},[]),s=m(t=>{y(t,e.current.experimental_customAuth)||(e.current.experimental_customAuth=t,e.current.jwt=t==null?void 0:t.jwt)},[]),l=a(()=>({get crossmint(){return e.current},setJwt:o,experimental_setCustomAuth:s}),[o,s,f]);return P(C.Provider,{value:l,children:r})}function N(r){let n=x(C);if(n==null)throw new Error(r!=null?r:"useCrossmint must be used within a CrossmintProvider");return n}export{J as a,N as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-X5EEGZ3H.js";import{assertValidNFTCollectionViewProps as r,getNFTCollectionViewSrc as t}from"@crossmint/client-sdk-base";import{jsx as n}from"react/jsx-runtime";function w(o){r(o);let i=t(o,e);return n("iframe",{src:i,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-collection-view"})}export{w as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _react = require('react');var _commonsdkbase = require('@crossmint/common-sdk-base');var _lodashisequal = require('lodash.isequal'); var _lodashisequal2 = _interopRequireDefault(_lodashisequal);var _jsxruntime = require('react/jsx-runtime');var C=_react.createContext.call(void 0, null);function E({children:r,apiKey:n,overrideBaseUrl:c}){let[f,d]=_react.useState.call(void 0, 0),e=_react.useRef.call(void 0, new Proxy(_commonsdkbase.createCrossmint.call(void 0, {apiKey:n,overrideBaseUrl:c}),{set(t,i,u){return i==="jwt"&&t.jwt!==u&&d(w=>w+1),Reflect.set(t,i,u)}})),o=_react.useCallback.call(void 0, t=>{t!==e.current.jwt&&(e.current.jwt=t)},[]),s=_react.useCallback.call(void 0, t=>{_lodashisequal2.default.call(void 0, t,e.current.experimental_customAuth)||(e.current.experimental_customAuth=t,e.current.jwt=t==null?void 0:t.jwt)},[]),l=_react.useMemo.call(void 0, ()=>({get crossmint(){return e.current},setJwt:o,experimental_setCustomAuth:s}),[o,s,f]);return _jsxruntime.jsx.call(void 0, C.Provider,{value:l,children:r})}function J(r){let n=_react.useContext.call(void 0, C);if(n==null)throw new Error(r!=null?r:"useCrossmint must be used within a CrossmintProvider");return n}exports.a = E; exports.b = J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZIDK43ZXcjs = require('./chunk-ZIDK43ZX.cjs');var _jsxruntime = require('react/jsx-runtime');function u(){return _jsxruntime.jsx.call(void 0, _chunkZIDK43ZXcjs.q,{className:"w-full"})}exports.a = u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWMBBIP2Ccjs = require('./chunk-WMBBIP2C.cjs');var _chunk2BOQSASOcjs = require('./chunk-2BOQSASO.cjs');var _chunkWABJHG6Bcjs = require('./chunk-WABJHG6B.cjs');var _chunkVI6TW7JTcjs = require('./chunk-VI6TW7JT.cjs');var _chunkTWX7ZBKZcjs = require('./chunk-TWX7ZBKZ.cjs');var _chunkQYQERFYLcjs = require('./chunk-QYQERFYL.cjs');var _reactvisuallyhidden = require('@radix-ui/react-visually-hidden');var _jsxruntime = require('react/jsx-runtime');function n({title:e,content:t,primaryButton:s,secondaryAction:l,appearance:r}){var u,a,y,f;return _jsxruntime.jsx.call(void 0, _chunkWMBBIP2Ccjs.a,{modal:!1,open:!0,onOpenChange:()=>{},children:_jsxruntime.jsxs.call(void 0, _chunkWMBBIP2Ccjs.e,{showCloseButton:!1,onInteractOutside:d=>d.preventDefault(),onOpenAutoFocus:d=>d.preventDefault(),className:"!p-0 !min-[480px]:p-0",style:{borderRadius:r==null?void 0:r.borderRadius,backgroundColor:(u=r==null?void 0:r.colors)==null?void 0:u.background},children:[_jsxruntime.jsx.call(void 0, _reactvisuallyhidden.VisuallyHidden,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _chunkWMBBIP2Ccjs.h,{children:e})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center left-1.5 relative",children:_jsxruntime.jsx.call(void 0, _chunkTWX7ZBKZcjs.a,{appearance:r})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center",children:_jsxruntime.jsx.call(void 0, "p",{style:{fontSize:"1.125rem",lineHeight:"1.75rem",fontWeight:"bold",color:((a=r==null?void 0:r.colors)==null?void 0:a.textPrimary)||"#20343E"},children:e})}),_jsxruntime.jsx.call(void 0, "div",{className:"mb-6",children:_jsxruntime.jsx.call(void 0, "div",{style:{fontWeight:"normal",color:((y=r==null?void 0:r.colors)==null?void 0:y.textSecondary)||"#67797F"},children:t})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4 justify-center",children:[s,l]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center pt-4",children:_jsxruntime.jsx.call(void 0, _chunk2BOQSASOcjs.a,{color:(f=r==null?void 0:r.colors)==null?void 0:f.textSecondary})})]})]})})}function R({state:e,appearance:t}){var s,l;switch(e.type){case"create-wallet":return _jsxruntime.jsx.call(void 0, n,{title:"Create Your Wallet",appearance:t,content:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:"mb-3",children:"You're about to create a wallet."}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{children:_jsxruntime.jsx.call(void 0, _chunkVI6TW7JTcjs.a,{})}),"Your wallet will be secured with a passkey"]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{children:_jsxruntime.jsx.call(void 0, _chunkQYQERFYLcjs.a,{})}),"Your device will ask you for your fingerprint, face, or screen lock to set it up"]})]})]}),primaryButton:_jsxruntime.jsx.call(void 0, c,{appearance:t,onClick:e.primaryActionOnClick,children:"Create Wallet"})});case"create-wallet-error":return _jsxruntime.jsx.call(void 0, n,{title:"Wallet Creation Failed",appearance:t,content:_jsxruntime.jsx.call(void 0, "div",{children:"We couldn't create your wallet. This could be due to rejecting the request, a timeout, or not having access to your passkey on this device."}),primaryButton:_jsxruntime.jsx.call(void 0, c,{appearance:t,onClick:e.primaryActionOnClick,children:"Try again"})});case"transaction":return _jsxruntime.jsx.call(void 0, n,{title:"
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWMBBIP2Ccjs = require('./chunk-WMBBIP2C.cjs');var _chunk2BOQSASOcjs = require('./chunk-2BOQSASO.cjs');var _chunkWABJHG6Bcjs = require('./chunk-WABJHG6B.cjs');var _chunkVI6TW7JTcjs = require('./chunk-VI6TW7JT.cjs');var _chunkTWX7ZBKZcjs = require('./chunk-TWX7ZBKZ.cjs');var _chunkQYQERFYLcjs = require('./chunk-QYQERFYL.cjs');var _reactvisuallyhidden = require('@radix-ui/react-visually-hidden');var _jsxruntime = require('react/jsx-runtime');function n({title:e,content:t,primaryButton:s,secondaryAction:l,appearance:r}){var u,a,y,f;return _jsxruntime.jsx.call(void 0, _chunkWMBBIP2Ccjs.a,{modal:!1,open:!0,onOpenChange:()=>{},children:_jsxruntime.jsxs.call(void 0, _chunkWMBBIP2Ccjs.e,{showCloseButton:!1,onInteractOutside:d=>d.preventDefault(),onOpenAutoFocus:d=>d.preventDefault(),className:"!p-0 !min-[480px]:p-0",style:{borderRadius:r==null?void 0:r.borderRadius,backgroundColor:(u=r==null?void 0:r.colors)==null?void 0:u.background},children:[_jsxruntime.jsx.call(void 0, _reactvisuallyhidden.VisuallyHidden,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _chunkWMBBIP2Ccjs.h,{children:e})}),_jsxruntime.jsxs.call(void 0, "div",{className:"relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center left-1.5 relative",children:_jsxruntime.jsx.call(void 0, _chunkTWX7ZBKZcjs.a,{appearance:r})}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center",children:_jsxruntime.jsx.call(void 0, "p",{style:{fontSize:"1.125rem",lineHeight:"1.75rem",fontWeight:"bold",color:((a=r==null?void 0:r.colors)==null?void 0:a.textPrimary)||"#20343E"},children:e})}),_jsxruntime.jsx.call(void 0, "div",{className:"mb-6",children:_jsxruntime.jsx.call(void 0, "div",{style:{fontWeight:"normal",color:((y=r==null?void 0:r.colors)==null?void 0:y.textSecondary)||"#67797F"},children:t})}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-4 justify-center",children:[s,l]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex justify-center pt-4",children:_jsxruntime.jsx.call(void 0, _chunk2BOQSASOcjs.a,{color:(f=r==null?void 0:r.colors)==null?void 0:f.textSecondary})})]})]})})}function R({state:e,appearance:t}){var s,l;switch(e.type){case"create-wallet":return _jsxruntime.jsx.call(void 0, n,{title:"Create Your Wallet",appearance:t,content:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:"mb-3",children:"You're about to create a wallet."}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{children:_jsxruntime.jsx.call(void 0, _chunkVI6TW7JTcjs.a,{})}),"Your wallet will be secured with a passkey"]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{children:_jsxruntime.jsx.call(void 0, _chunkQYQERFYLcjs.a,{})}),"Your device will ask you for your fingerprint, face, or screen lock to set it up"]})]})]}),primaryButton:_jsxruntime.jsx.call(void 0, c,{appearance:t,onClick:e.primaryActionOnClick,children:"Create Wallet"})});case"create-wallet-error":return _jsxruntime.jsx.call(void 0, n,{title:"Wallet Creation Failed",appearance:t,content:_jsxruntime.jsx.call(void 0, "div",{children:"We couldn't create your wallet. This could be due to rejecting the request, a timeout, or not having access to your passkey on this device."}),primaryButton:_jsxruntime.jsx.call(void 0, c,{appearance:t,onClick:e.primaryActionOnClick,children:"Try again"})});case"transaction":return _jsxruntime.jsx.call(void 0, n,{title:"Use Your Wallet",appearance:t,content:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-2",children:_jsxruntime.jsxs.call(void 0, "div",{className:"flex gap-2",children:[_jsxruntime.jsx.call(void 0, "div",{children:_jsxruntime.jsx.call(void 0, _chunkQYQERFYLcjs.a,{})}),_jsxruntime.jsx.call(void 0, "span",{children:"Your device will ask you for your fingerprint, face, or screen lock to authorize this action."})]})}),primaryButton:_jsxruntime.jsx.call(void 0, c,{appearance:t,onClick:e.primaryActionOnClick,children:"Use Wallet"})});case"transaction-error":return _jsxruntime.jsx.call(void 0, n,{title:"Wallet Access Failed",appearance:t,content:_jsxruntime.jsx.call(void 0, "div",{children:"We couldn't access your wallet. This could be due to rejecting the request, a timeout, or not having access to your passkey on this device."}),primaryButton:_jsxruntime.jsx.call(void 0, c,{appearance:t,onClick:e.primaryActionOnClick,children:"Try again"}),secondaryAction:_jsxruntime.jsx.call(void 0, "a",{href:"https://docs.crossmint.com/wallets/smart-wallets/users/troubleshoot",rel:"noopener noreferrer",target:"_blank",style:{padding:"0.875rem",width:"100%",textAlign:"center",textDecoration:"none",borderRadius:"0.5rem",fontWeight:"bold",backgroundColor:((s=t==null?void 0:t.colors)==null?void 0:s.inputBackground)||"#F0F2F4",color:((l=t==null?void 0:t.colors)==null?void 0:l.textSecondary)||"#00150D"},children:"Troubleshoot"})});case"not-supported":return _jsxruntime.jsx.call(void 0, n,{title:"Passkeys Not Supported on This Device",appearance:t,content:_jsxruntime.jsx.call(void 0, "div",{children:"To access your wallet with a passkey, switch to a device or browser that supports passkeys, such as Chrome or Safari on a smartphone, tablet, or modern computer"}),primaryButton:_jsxruntime.jsx.call(void 0, c,{appearance:t,onClick:e.primaryActionOnClick,children:"Understood"})});default:return null}}var c=({appearance:e,onClick:t,children:s})=>{var l,r;return _jsxruntime.jsxs.call(void 0, "button",{className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:e==null?void 0:e.borderRadius,backgroundColor:(l=e==null?void 0:e.colors)==null?void 0:l.buttonBackground},onClick:t,children:[_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(r=e==null?void 0:e.colors)==null?void 0:r.textPrimary},children:s}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:s})]})};exports.a = R;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{b as $t}from"./chunk-4KDASQO6.js";import{a as no}from"./chunk-GPOZTH2S.js";import{a as to}from"./chunk-JSNUJJQJ.js";import{a as qt,b as Jt,c as J}from"./chunk-VHNBXIOC.js";import{a as K}from"./chunk-TNCETEEL.js";import{a as Ht}from"./chunk-LD3MRJ3F.js";import{a as Kt}from"./chunk-BFHQZOV3.js";import{a as zt}from"./chunk-ONAKCA4D.js";import{a as jt,e as _t,h as Vt,i as Gt}from"./chunk-UDQUVZUQ.js";import{a as Lt}from"./chunk-2VBA64WU.js";import{a as Yt}from"./chunk-EMXNIC4M.js";import{a as ct}from"./chunk-RZG2PAKA.js";import{a as N}from"./chunk-NBJIJZGO.js";import{a as Qt}from"./chunk-SFDQPSSP.js";import{a as oo}from"./chunk-JPJKOERH.js";import{a as ro}from"./chunk-VWL76U5G.js";import{a as dt}from"./chunk-UAFW3OWA.js";import{a as eo}from"./chunk-VLDE23JX.js";import{a as Xt}from"./chunk-C3JRTLQP.js";import{a as Zt}from"./chunk-E4TBJMOO.js";import{a as ft}from"./chunk-WW6GUXHG.js";import{b as ut}from"./chunk-HAAUJ7YI.js";import{a as L,b as z,c as Q,d as v}from"./chunk-PXDN3KFO.js";import{createContext as Re,useCallback as Ue,useContext as Me,useEffect as Be,useState as St}from"react";import{CrossmintAuthenticationError as Le}from"@crossmint/common-sdk-auth";import{useContext as De}from"react";import{createContext as We,useEffect as No,useMemo as Io,useRef as ke,useState as st,useCallback as at}from"react";import{CrossmintAuth as Ee,getCookie as Fe}from"@crossmint/client-sdk-auth";import{validateApiKeyAndGetCrossmintBaseUrl as Oe}from"@crossmint/common-sdk-base";import{SESSION_PREFIX as Ne}from"@crossmint/common-sdk-auth";import{VisuallyHidden as Po}from"@radix-ui/react-visually-hidden";import me from"color";import{useState as Jo}from"react";import{useState as Wt}from"react";import{jsx as io}from"react/jsx-runtime";var Y=s=>{var i=s,{className:r,iconColor:o,ringColor:e,onClick:t}=i,n=Q(i,["className","iconColor","ringColor","onClick"]);let{setError:u}=b();return io("button",z(L({className:N("absolute left-4 top-4 min-[480px]:!left-6 min-[480px]:!top-6 rounded-full opacity-70 ring-offset-background text-cm-text-primary transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-cm-accent focus:ring-offset-2 disabled:pointer-events-none",r),onClick:m=>{u(null),t==null||t(m)}},n),{children:io(Qt,{className:"w-6 h-6",style:{color:o}})}))};import{jsx as R,jsxs as et}from"react/jsx-runtime";var Lo=6;function lo({otpEmailData:r,setOtpEmailData:o}){var x,p,C,h,P,F,k,S,I,T,D,_,E,B,G,q,f,O,$,At;let{crossmintAuth:e}=j(),{appearance:t,setDialogOpen:n,setStep:s,setError:i}=b(),[u,m]=Wt(""),[a,y]=Wt(!1),[l,c]=Wt(!1),w=()=>v(this,null,function*(){var V,X;c(!0);try{let ot=yield e==null?void 0:e.confirmEmailOtp((V=r==null?void 0:r.email)!=null?V:"",(X=r==null?void 0:r.emailId)!=null?X:"",u);yield e==null?void 0:e.handleRefreshAuthMaterial(ot),n(!1,!0),s("initial")}catch(ot){console.error("Error confirming email OTP",ot),i("Invalid code. Please try again."),y(!0)}finally{c(!1)}}),g=()=>v(this,null,function*(){var V;try{yield e==null?void 0:e.sendEmailOtp((V=r==null?void 0:r.email)!=null?V:"")}catch(X){i("Failed to resend code. Please try again.")}});return et("div",{children:[R(Y,{onClick:()=>{s("initial"),o(null)},iconColor:(x=t==null?void 0:t.colors)==null?void 0:x.textPrimary,ringColor:(p=t==null?void 0:t.colors)==null?void 0:p.accent}),et("div",{className:"flex flex-col items-center justify-start w-full",children:[R("div",{className:"relative left-3",children:R(Xt,{customAccentColor:(C=t==null?void 0:t.colors)==null?void 0:C.accent,customButtonBackgroundColor:(h=t==null?void 0:t.colors)==null?void 0:h.buttonBackground,customBackgroundColor:(P=t==null?void 0:t.colors)==null?void 0:P.background})}),R("p",{className:"text-base font-normal mt-4 mb-1 text-center text-cm-text-primary",style:{color:(F=t==null?void 0:t.colors)==null?void 0:F.textPrimary},children:"Check your email"}),et("p",{className:"text-center text-cm-text-secondary px-4",style:{color:(k=t==null?void 0:t.colors)==null?void 0:k.textSecondary},children:["A temporary login code has been sent to"," ",r!=null&&r.email?r.email:"your email address"]}),R("div",{className:"py-8",children:R(qt,{maxLength:Lo,value:u,onChange:V=>{m(V),y(!1),i(null)},onComplete:w,disabled:l,customStyles:{accent:(I=(S=t==null?void 0:t.colors)==null?void 0:S.accent)!=null?I:"#04AA6D",danger:(D=(T=t==null?void 0:t.colors)==null?void 0:T.danger)!=null?D:"#f44336",border:(E=(_=t==null?void 0:t.colors)==null?void 0:_.border)!=null?E:"#E5E7EB",textPrimary:(G=(B=t==null?void 0:t.colors)==null?void 0:B.textPrimary)!=null?G:"#909ca3",buttonBackground:(f=(q=t==null?void 0:t.colors)==null?void 0:q.buttonBackground)!=null?f:"#eff6ff",inputBackground:($=(O=t==null?void 0:t.colors)==null?void 0:O.inputBackground)!=null?$:"#FFFFFF",borderRadius:t==null?void 0:t.borderRadius},children:et(Jt,{children:[R(J,{index:0,hasError:a}),R(J,{index:1,hasError:a}),R(J,{index:2,hasError:a}),R(J,{index:3,hasError:a}),R(J,{index:4,hasError:a}),R(J,{index:5,hasError:a})]})})}),R("div",{className:"text-xs leading-tight text-cm-text-secondary text-center",children:et("span",{style:{color:(At=t==null?void 0:t.colors)==null?void 0:At.textSecondary},children:["Can't find the email? Check spam folder.",`
|
|
2
|
+
`,"Some emails may take several minutes to arrive."]})}),R(Yt,{initialSeconds:60,appearance:t,countdownText:V=>`Re-send code in ${V}s`,countdownCompleteText:"Re-send code",handleOnClick:g})]})]})}import{useState as Et}from"react";import $o from"color";import{isEmailValid as yt}from"@crossmint/common-sdk-auth";import{ChildWindow as jo,PopupWindow as _o}from"@crossmint/client-sdk-window";import{useEffect as Vo,useRef as Go,useState as zo}from"react";import{z as gt}from"zod";var Z=r=>{let{crossmintAuth:o}=j(),{oauthUrlMap:e,setError:t}=b(),[n,s]=zo(!1),i=Go(null);return Vo(()=>(i.current==null&&(i.current=new jo(window.opener||window.parent,"*",{incomingEvents:Ko})),()=>{i.current!=null&&i.current.off("authMaterialFromPopupCallback")}),[]),{createPopupAndSetupListeners:m=>v(void 0,null,function*(){if(i.current==null)throw new Error("Child window not initialized");s(!0),t(null);let a=new URL(e[r]);if(m!=null){let g=Array.from(a.searchParams.entries());a.search="",m&&a.searchParams.append("provider_login_hint",m),g.forEach(([d,x])=>{a.searchParams.append(d,x)})}let y=yield _o.init(a.toString(),{awaitToLoad:!1,crossOrigin:!0,width:400,height:700}),l=g=>v(void 0,null,function*(){var d;yield o==null?void 0:o.handleRefreshAuthMaterial(g.oneTimeSecret),(d=i.current)==null||d.off("authMaterialFromPopupCallback"),y.window.close(),s(!1)}),c=g=>{var d;t(g.error),(d=i.current)==null||d.off("errorFromPopupCallback"),y.window.close(),s(!1)};i.current.on("authMaterialFromPopupCallback",l),i.current.on("errorFromPopupCallback",c);let w=setInterval(()=>{var g,d;(g=y.window)!=null&&g.closed&&(clearInterval(w),s(!1),(d=i.current)==null||d.off("authMaterialFromPopupCallback"))},2500)}),isLoading:n}},Ko={authMaterialFromPopupCallback:gt.object({oneTimeSecret:gt.string()}),errorFromPopupCallback:gt.object({error:gt.string()})};import{jsx as kt,jsxs as Ho}from"react/jsx-runtime";function so({emailInput:r,appearance:o}){var n,s,i,u;let{createPopupAndSetupListeners:e,isLoading:t}=Z("google");return Ho("button",{type:"button",className:N("flex items-center gap-2 justify-center h-[32px] px-2.5 border border-cm-border rounded-xl bg-cm-background-primary","hover:bg-cm-hover focus:bg-cm-hover outline-none",t?"cursor-not-allowed hover:bg-cm-muted-primary":""),onClick:t?void 0:()=>e(r.trim().toLowerCase()),style:{backgroundColor:(n=o==null?void 0:o.colors)==null?void 0:n.buttonBackground,borderRadius:o==null?void 0:o.borderRadius},children:[kt(ft,{className:"max-h-[18px] max-w-[18px] h-[18px] w-[18px]"}),t?kt(K,{style:{color:(s=o==null?void 0:o.colors)==null?void 0:s.textSecondary,fill:(i=o==null?void 0:o.colors)==null?void 0:i.textPrimary,width:"18px",height:"18px"}}):kt("span",{className:"text-cm-accent",style:{color:(u=o==null?void 0:o.colors)==null?void 0:u.accent},children:"Continue"})]})}import{Fragment as qo,jsx as H,jsxs as Ft}from"react/jsx-runtime";function ao({setOtpEmailData:r}){var g,d,x,p,C,h,P,F,k,S,I,T,D,_;let{crossmintAuth:o}=j(),{appearance:e,defaultEmail:t,setStep:n,setError:s}=b(),[i,u]=Et(t!=null?t:""),[m,a]=Et(""),[y,l]=Et(!1),c=i.toLowerCase().includes("@gmail.com")&&!i.toLowerCase().includes("+")&&yt(i)&&!y;function w(E){return v(this,null,function*(){E.preventDefault(),l(!0);try{let B=i.trim().toLowerCase(),G=yield o==null?void 0:o.sendEmailOtp(B);r({email:B,emailId:G.emailId}),n("otp")}catch(B){l(!1),s("Failed to send email. Please try again or contact support.")}})}return H(qo,{children:H("div",{className:"flex flex-col items-start justify-start w-full rounded-lg",children:Ft("div",{className:"w-full",children:[H("label",{className:"text-cm-text-primary block mb-[5px]",style:{color:(g=e==null?void 0:e.colors)==null?void 0:g.textPrimary},children:"Email"}),Ft("form",{role:"form",className:"relative",onSubmit:E=>{if(c){E.preventDefault();return}yt(i)?w(E):E.preventDefault()},noValidate:!0,children:[H("label",{htmlFor:"emailInput",className:"sr-only",children:"Email"}),H("input",{className:N("flex-grow text-cm-text-primary text-left pl-[16px] h-[58px] w-full border border-cm-border rounded-xl bg-cm-background-primary placeholder:text-md","transition-none duration-200 ease-in-out","focus:outline-none focus-ring-custom","placeholder:[color:var(--placeholder-color)]",m?"border-red-500":"",c?"pr-[132px]":"pr-[80px]"),style:{color:(d=e==null?void 0:e.colors)==null?void 0:d.textPrimary,borderRadius:e==null?void 0:e.borderRadius,borderColor:m?(x=e==null?void 0:e.colors)==null?void 0:x.danger:(p=e==null?void 0:e.colors)==null?void 0:p.border,backgroundColor:(C=e==null?void 0:e.colors)==null?void 0:C.inputBackground,"--placeholder-color":(P=(h=e==null?void 0:e.colors)==null?void 0:h.textSecondary)!=null?P:"#67797F","--focus-ring-color":new $o((k=(F=e==null?void 0:e.colors)==null?void 0:F.accent)!=null?k:"#04AA6D").alpha(.18).toString()},type:"email",placeholder:"your@email.com",value:i,onChange:E=>{u(E.target.value),a(""),s(null)},readOnly:y,"aria-describedby":"emailError"}),Ft("div",{className:"absolute inset-y-0 right-0 flex items-center pr-4",children:[m&&H(dt,{customColor:(S=e==null?void 0:e.colors)==null?void 0:S.danger}),y&&H(K,{style:{color:(I=e==null?void 0:e.colors)==null?void 0:I.textSecondary,fill:(T=e==null?void 0:e.colors)==null?void 0:T.textPrimary}}),c?H(so,{emailInput:i,appearance:e}):!m&&!y?H("button",{type:"submit",className:N("font-medium text-cm-accent text-nowrap bg-cm-background-primary",yt(i)?"cursor-pointer":"!cursor-not-allowed opacity-60"),style:{color:(D=e==null?void 0:e.colors)==null?void 0:D.accent,backgroundColor:(_=e==null?void 0:e.colors)==null?void 0:_.inputBackground},disabled:!yt(i)||y,children:"Submit"}):null]})]}),m&&H("p",{className:"text-xs text-red-500 mb-2 pt-2",children:m})]})})})}import{jsx as mo}from"react/jsx-runtime";function uo(){let{step:r}=b(),[o,e]=Jo(null);return r==="otp"?mo(lo,{otpEmailData:o,setOtpEmailData:e}):r==="initial"?mo(ao,{setOtpEmailData:e}):null}import{jsx as Ot,jsxs as Xo}from"react/jsx-runtime";function co({appearance:r,text:o}){var t,n,s;let{step:e}=b();return e!=="initial"?null:Xo("div",{className:"flex items-center justify-center w-full pt-2 pb-3",children:[Ot("span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(t=r==null?void 0:r.colors)==null?void 0:t.border}}),o!=null?Ot("p",{className:"flex-none px-2 text-sm text-cm-text-primary",style:{color:(n=r==null?void 0:r.colors)==null?void 0:n.textSecondary},children:o}):null,Ot("span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(s=r==null?void 0:r.colors)==null?void 0:s.border}})]})}import{Fragment as Qo,jsx as ht,jsxs as fo}from"react/jsx-runtime";function go(o){var r=Q(o,[]);var m,a,y,l;let{step:e,appearance:t,isLoadingOauthUrlMap:n}=b(),{createPopupAndSetupListeners:s,isLoading:i}=Z("google"),u=n||i;return e!=="initial"?null:fo("button",z(L({className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",u?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(m=t==null?void 0:t.colors)==null?void 0:m.buttonBackground},onClick:u?void 0:()=>s()},r),{children:[fo(Qo,{children:[ht(ft,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),u?ht(K,{style:{color:(a=t==null?void 0:t.colors)==null?void 0:a.textSecondary,fill:(y=t==null?void 0:t.colors)==null?void 0:y.textPrimary}}):ht("span",{className:"font-medium",style:{margin:"0px 32px",color:(l=t==null?void 0:t.colors)==null?void 0:l.textPrimary},children:"Sign in with Google"})]}),ht("span",{className:"sr-only",children:"Sign in with Google"})]}))}import{useEffect as Nt,useMemo as Yo,useState as Zo}from"react";import{useSignIn as te,QRCode as oe}from"@farcaster/auth-kit";import{Fragment as re,jsx as U,jsxs as rt}from"react/jsx-runtime";function yo(){var n,s;let{step:r,appearance:o,setStep:e,setError:t}=b();return r==="initial"?U("div",{children:rt("button",{className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:o==null?void 0:o.borderRadius,backgroundColor:(n=o==null?void 0:o.colors)==null?void 0:n.buttonBackground},onClick:()=>{e("qrCode"),t(null)},children:[U(Zt,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),U("span",{className:"font-medium",style:{margin:"0px 32px",color:(s=o==null?void 0:o.colors)==null?void 0:s.textPrimary},children:"Sign in with Farcaster"}),U("span",{className:"sr-only",children:"Sign in with Farcaster"})]})}):r==="qrCode"?U(ee,{}):null}function ee(){var g,d,x,p,C,h,P,F,k;let{crossmintAuth:r}=j(),{appearance:o,setStep:e,setDialogOpen:t,setError:n}=b(),[s,i]=Zo(null),u=Yo(()=>({onSuccess:S=>{i(S)}}),[]),{signIn:m,url:a,connect:y,signOut:l,isConnected:c}=te(u),w=S=>v(this,null,function*(){n(null);try{let I=yield r==null?void 0:r.signInWithFarcaster(S);yield r==null?void 0:r.handleRefreshAuthMaterial(I),t(!1),e("initial")}catch(I){console.error("Error during Farcaster sign-in:",I),n("Failed to sign in with Farcaster")}});return Nt(()=>{s!=null&&w(s)},[s]),Nt(()=>{c&&m()},[c]),Nt(()=>{y()},[]),rt("div",{children:[U(Y,{onClick:()=>{l(),e("initial")},iconColor:(g=o==null?void 0:o.colors)==null?void 0:g.textPrimary,ringColor:(d=o==null?void 0:o.colors)==null?void 0:d.accent}),rt("div",{className:"flex flex-col items-center gap-4",children:[rt("div",{className:"text-center",children:[U("h3",{className:"text-lg font-semibold text-cm-text-primary mb-2",style:{color:(x=o==null?void 0:o.colors)==null?void 0:x.textPrimary},children:"Sign in with Farcaster"}),U("p",{className:"text-base font-normal text-cm-text-secondary",style:{color:(p=o==null?void 0:o.colors)==null?void 0:p.textSecondary},children:"Scan with your phone's camera to continue."})]}),U("div",{className:"bg-white aspect-square rounded-lg p-4",style:{backgroundColor:(C=o==null?void 0:o.colors)==null?void 0:C.inputBackground,borderRadius:o==null?void 0:o.borderRadius},children:a!=null?U(oe,{uri:a,size:280}):U("div",{className:"min-h-[246px] flex items-center justify-center",children:U(K,{style:{color:(h=o==null?void 0:o.colors)==null?void 0:h.textSecondary,fill:(P=o==null?void 0:o.colors)==null?void 0:P.textPrimary}})})}),a?rt(re,{children:[U("p",{className:"text-base text-center font-normal text-cm-text-secondary",style:{color:(F=o==null?void 0:o.colors)==null?void 0:F.textSecondary},children:"Alternatively, click on this link to open Warpcast."}),U("a",{href:a,rel:"noopener noreferrer",target:"_blank",className:"text-base font-normal text-cm-link",style:{color:(k=o==null?void 0:o.colors)==null?void 0:k.textLink},children:"Open Warpcast"})]}):null]})]})}import{Fragment as ne,jsx as xt,jsxs as ho}from"react/jsx-runtime";function xo(o){var r=Q(o,[]);var m,a,y,l;let{step:e,appearance:t,isLoadingOauthUrlMap:n}=b(),{createPopupAndSetupListeners:s,isLoading:i}=Z("twitter"),u=n||i;return e!=="initial"?null:ho("button",z(L({className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",u?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(m=t==null?void 0:t.colors)==null?void 0:m.buttonBackground},onClick:u?void 0:()=>s()},r),{children:[ho(ne,{children:[xt(oo,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),u?xt(K,{style:{color:(a=t==null?void 0:t.colors)==null?void 0:a.textSecondary,fill:(y=t==null?void 0:t.colors)==null?void 0:y.textPrimary}}):xt("span",{className:"font-medium",style:{margin:"0px 32px",color:(l=t==null?void 0:t.colors)==null?void 0:l.textPrimary},children:"Sign in with X"})]}),xt("span",{className:"sr-only",children:"Sign in with X"})]}))}import{jsx as pt,jsxs as ie}from"react/jsx-runtime";function po(){var n,s,i,u,m;let{step:r,appearance:o,setStep:e,setError:t}=b();return r!=="initial"?null:ie("button",{className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:o==null?void 0:o.borderRadius,borderColor:(n=o==null?void 0:o.colors)==null?void 0:n.border,backgroundColor:(s=o==null?void 0:o.colors)==null?void 0:s.buttonBackground},onClick:()=>{e("web3"),t(null)},children:[pt(ro,{className:"h-[21px] w-[21px] absolute left-[20px]",style:{color:(i=o==null?void 0:o.colors)==null?void 0:i.textPrimary}}),pt("span",{className:"font-medium",style:{margin:"0px 32px",color:(u=o==null?void 0:o.colors)==null?void 0:u.textPrimary},children:"Continue with a wallet"}),pt(eo,{className:"h-[21px] w-[21px] absolute right-[20px]",style:{color:(m=o==null?void 0:o.colors)==null?void 0:m.textSecondary}}),pt("span",{className:"sr-only",children:"Continue with a wallet"})]})}import{DynamicEmbeddedWidget as le}from"@dynamic-labs/sdk-react-core";import{Fragment as se,jsx as nt,jsxs as ae}from"react/jsx-runtime";function bo(){var t,n;let{appearance:r,step:o,setStep:e}=b();return o==="web3"?ae(se,{children:[nt(Y,{onClick:()=>e("initial"),iconColor:(t=r==null?void 0:r.colors)==null?void 0:t.textPrimary,ringColor:(n=r==null?void 0:r.colors)==null?void 0:n.accent}),nt("div",{className:"flex flex-col items-center",children:nt("div",{className:"flex flex-col gap-[10px] w-full",children:nt("div",{className:"widget-container",children:nt(le,{background:"none"})})})})]}):null}import{jsx as wo}from"react/jsx-runtime";function vo(){let{step:r}=b();return r.startsWith("web3")?wo(bo,{}):r==="initial"?wo(po,{}):null}import{jsx as M,jsxs as it}from"react/jsx-runtime";function Co({className:r}){var m,a,y,l,c,w,g,d,x,p,C,h,P;let{step:o,appearance:e,loginMethods:t,baseUrl:n,error:s,termsOfServiceText:i,authModalTitle:u}=b();return it("div",{className:N("relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",r),children:[s!=null?it("div",{className:"flex items-start justify-start w-full rounded-lg p-2 mt-4 bg-cm-danger-muted",style:{backgroundColor:new me((a=(m=e==null?void 0:e.colors)==null?void 0:m.danger)!=null?a:"#f44336").alpha(.12).toString()},children:[M("div",{className:"min-w-[20px]",children:M(dt,{customColor:(l=(y=e==null?void 0:e.colors)==null?void 0:y.danger)!=null?l:"#f44336"})}),M("p",{className:"ml-2 text-sm",style:{color:(w=(c=e==null?void 0:e.colors)==null?void 0:c.danger)!=null?w:"#f44336"},children:s})]}):null,o==="initial"?it("div",{children:[M("h1",{className:"text-2xl font-bold text-cm-text-primary",style:{color:(g=e==null?void 0:e.colors)==null?void 0:g.textPrimary},children:u!=null?u:"Sign in to Crossmint"}),M("p",{className:"text-base font-normal mb-3 text-cm-text-secondary",style:{color:(d=e==null?void 0:e.colors)==null?void 0:d.textSecondary},children:"Access using one of the options below."})]}):null,t.includes("google")?M(go,{}):null,t.includes("farcaster")?M(to,{baseUrl:n,children:M(yo,{})}):null,t.includes("twitter")?M(xo,{}):null,t.some(F=>F.startsWith("web3"))?M(vo,{}):null,t.includes("email")?it("div",{children:[t.length>1?M(co,{appearance:e,text:"OR"}):null,M(uo,{})]}):null,o==="initial"&&i!=null?it("div",{className:"text-sm text-center text-cm-text-secondary mt-2",style:{color:(x=e==null?void 0:e.colors)==null?void 0:x.textSecondary},children:[M("style",{children:`
|
|
3
|
+
p a {
|
|
4
|
+
color: ${(C=(p=e==null?void 0:e.colors)==null?void 0:p.textLink)!=null?C:"#1A74E9"};
|
|
5
|
+
}
|
|
6
|
+
`}),i]}):null,o==="initial"||o==="otp"?M(Lt,{className:"mt-1.5 md:mt-4 justify-center",color:(P=(h=e==null?void 0:e.colors)==null?void 0:h.textSecondary)!=null?P:"#67797F"}):null]})}import{useEffect as ue}from"react";import{jsx as tt,jsxs as ce}from"react/jsx-runtime";function bt({open:r}){var t,n,s;let{appearance:o,setDialogOpen:e}=b();return ue(()=>{document.body.style.overflow=r?"hidden":""},[r]),tt(jt,{modal:!1,open:r,onOpenChange:e,children:ce(_t,{onInteractOutside:i=>i.preventDefault(),onOpenAutoFocus:i=>i.preventDefault(),closeButtonColor:(t=o==null?void 0:o.colors)==null?void 0:t.textPrimary,closeButtonRingColor:(n=o==null?void 0:o.colors)==null?void 0:n.accent,className:"!p-0 !min-[480px]:p-0",style:{borderRadius:o==null?void 0:o.borderRadius,backgroundColor:(s=o==null?void 0:o.colors)==null?void 0:s.background},children:[tt(Po,{asChild:!0,children:tt(Vt,{children:"Crossmint Auth"})}),tt(Po,{asChild:!0,children:tt(Gt,{children:"Sign in via Crossmint"})}),tt(Co,{className:"max-w-[448px]"})]})})}import{useContext as Se}from"react";import{createContext as be,useMemo as we,useState as wt,useCallback as vt,useEffect as Ut,useContext as ve,useRef as Ct}from"react";import{CrossmintWallets as Ce}from"@crossmint/wallets-sdk";import{throwNotAvailable as Mt}from"@crossmint/client-sdk-react-base";import{createContext as de,useContext as fe,useCallback as It,useEffect as So,useMemo as Dt,useState as Tt}from"react";import{useDynamicContext as ge}from"@dynamic-labs/sdk-react-core";import{isEthereumWallet as ye}from"@dynamic-labs/ethereum";import{isSolanaWallet as he}from"@dynamic-labs/solana";import{EthereumWalletConnectors as Ao}from"@dynamic-labs/ethereum";import{SolanaWalletConnectors as Wo}from"@dynamic-labs/solana";import xe from"bs58";import{jsx as Rt}from"react/jsx-runtime";var ko=de(null);function Eo(){let r=fe(ko);return r||{isDynamicWalletConnected:!1,isDynamicProviderAvailable:!1,hasDynamicSdkLoaded:!0,getAdminSigner:()=>{throw new Error("useDynamicWallet must be used within DynamicWalletProvider")},initialize:()=>{},cleanup:()=>{}}}function pe({children:r,enabled:o,onSdkLoaded:e}){let[t,n]=Tt(),[s,i]=Tt(),[u,m]=Tt(!1),{primaryWallet:a,sdkHasLoaded:y,removeWallet:l,handleUnlinkWallet:c}=ge(),w=!!a,g=!o||y,d=It((h,P)=>{n(h),i(()=>P),m(!0)},[]),x=It(()=>{t==null&&a&&(l(a.id),c(a.id))},[t,a,l,c]);So(()=>{o&&(s==null||s(g),e==null||e(g))},[g,o,s,e]),So(()=>{t==null&&u&&x()},[t,x,u]);let p=It(()=>v(this,null,function*(){if(a==null)throw new Error("No connected wallet");try{if(ye(a)){let h=yield a.getWalletClient();return{type:"external-wallet",address:h.account.address,viemAccount:z(L({},h.account),{signMessage:P=>v(this,null,function*(){return yield h.signMessage({message:P.message})})})}}if(he(a)){let h=yield a.getSigner();return{type:"external-wallet",address:a.address,onSignTransaction:P=>v(this,null,function*(){return yield h.signTransaction(P)})}}throw new Error("Unsupported wallet type")}catch(h){throw console.error("Failed to get admin signer",h),new Error("Failed to get admin signer")}}),[a]),C=Dt(()=>({isDynamicWalletConnected:w,isDynamicProviderAvailable:!0,hasDynamicSdkLoaded:g,getAdminSigner:p,initialize:d,cleanup:x}),[w,g,p,d,x]);return Rt(ko.Provider,{value:C,children:r})}function Fo({children:r,enabled:o=!0,apiKeyEnvironment:e,loginMethods:t=["web3"],appearance:n,onSdkLoaded:s}){var a,y;let{crossmintAuth:i}=j(),u=Dt(()=>{var l,c;return`.powered-by-dynamic { display: none !important; }
|
|
7
|
+
.wallet-list__scroll-container { padding: 0px !important; }
|
|
8
|
+
.wallet-list__search-container { padding-left: 0px !important; padding-right: 0px !important; }
|
|
9
|
+
.dynamic-footer { display: none !important; }
|
|
10
|
+
h1 { color: ${(l=n==null?void 0:n.colors)==null?void 0:l.textPrimary} !important; }
|
|
11
|
+
* { color: ${(c=n==null?void 0:n.colors)==null?void 0:c.textSecondary} !important; }`},[(a=n==null?void 0:n.colors)==null?void 0:a.textPrimary,(y=n==null?void 0:n.colors)==null?void 0:y.textSecondary]),m=Dt(()=>{if(o)return t.includes("web3:evm-only")?[Ao]:t.includes("web3:solana-only")?[Wo]:[Ao,Wo]},[o,t]);return Rt(Ht,{apiKeyEnvironment:e,settings:{walletConnectors:m,cssOverrides:u,events:{onWalletRemoved(){console.log("[DynamicWalletProvider] onWalletRemoved")},onAuthFlowCancel(){console.log("[DynamicWalletProvider] onAuthFlowCancel")},onAuthFlowClose(){console.log("[DynamicWalletProvider] onAuthFlowClose")},onAuthFailure(l,c){console.error("[DynamicWalletProvider] onAuthFailure",l,c)},onAuthSuccess(l){console.log("[DynamicWalletProvider] onAuthSuccess",l)}},handlers:{handleConnectedWallet:l=>v(this,null,function*(){var w;if(!i)return console.error("[DynamicWalletProvider] crossmintAuth is not available"),!1;console.log("[DynamicWalletProvider] handleConnectedWallet",l);let c=l.address;if(c==null)return console.error("[DynamicWalletProvider] handleConnectedWallet: address is missing"),!1;try{let d=(yield $t(l))==="solana"?"solana":"evm",x=yield i.signInWithSmartWallet(c,d);if((x==null?void 0:x.challenge)==null)throw new Error("No challenge received from signInWithSmartWallet");let p=yield(w=l.connector)==null?void 0:w.proveOwnership(c,x.challenge);if(p==null)throw new Error("Failed to get signature from wallet");let C=p;if(d==="solana"){let P=Buffer.from(p,"base64");C=xe.encode(P)}let h=yield i.authenticateSmartWallet(c,d,C);if((h==null?void 0:h.oneTimeSecret)==null)throw new Error("No oneTimeSecret received from authenticateSmartWallet");return yield i.handleRefreshAuthMaterial(h.oneTimeSecret),!0}catch(g){return console.error("[DynamicWalletProvider] Error handling wallet connection:",g),!1}})}},children:Rt(pe,{enabled:o,onSdkLoaded:s,children:r})},`${e}-${t.join(",")}`)}import{createPortal as Oo}from"react-dom";import{jsx as Bt,jsxs as Pe}from"react/jsx-runtime";var Pt=be(null);function Ti(r){let o=ve(Pt);if(!o)throw new Error(`useWallet must be used within WalletProvider${r?` (${r})`:""}`);return o}function Di({children:r,showPasskeyHelpers:o=!0,appearance:e,createOnLogin:t}){var G,q;let{crossmint:n,experimental_setCustomAuth:s}=ut("CrossmintWalletProvider must be used within CrossmintProvider"),i=(G=n.experimental_customAuth)==null?void 0:G.email,{isDynamicWalletConnected:u,isDynamicProviderAvailable:m,getAdminSigner:a,hasDynamicSdkLoaded:y}=Eo(),[l,c]=wt({status:"not-loaded"}),[w,g]=wt({open:!1}),[d,x]=wt(!1),[p,C]=wt("initial"),h=Ct(!1),P=Ct(Mt("sendEmailWithOtp")),F=Ct(Mt("verifyOtp")),k=Ct(Mt("reject")),S=vt(f=>()=>new Promise(O=>{if(!o){O();return}g({type:f,open:!0,primaryActionOnClick:()=>{g({open:!1}),O()},secondaryActionOnClick:()=>{g({open:!1}),O()}})}),[o]),I=()=>v(this,null,function*(){try{yield P.current(),C("otp")}catch(f){console.error("Failed to send email OTP",f),k.current(new Error("Failed to send email OTP"))}}),T=f=>v(this,null,function*(){try{yield F.current(f),x(!1),C("initial")}catch(O){console.error("Failed to verify OTP",O),k.current(new Error("Failed to verify OTP"))}}),D=vt(f=>v(this,null,function*(){var O;if(l.status==="in-progress")return{startedCreation:!1};if(n.jwt==null)return{startedCreation:!1};try{c({status:"in-progress"}),((O=f==null?void 0:f.signer)==null?void 0:O.type)==="email"&&(f.signer.onAuthRequired=(X,ot,Mo,Bo)=>v(this,null,function*(){h.current=X,P.current=ot,F.current=Mo,k.current=Bo,X&&(x(!0),C("initial"))}));let $=f.signer.type==="passkey"&&o,V=yield Ce.from(n).getOrCreateWallet(z(L({},f),{options:L(L({},f.options),$&&{experimental_callbacks:{onWalletCreationStart:S("create-wallet"),onTransactionStart:S("transaction")}})}));return c({status:"loaded",wallet:V}),{startedCreation:!0}}catch($){return console.error("Failed to create wallet:",$),c({status:"error",error:$ instanceof Error?$:new Error(String($))}),{startedCreation:!1}}}),[n,l.status,S]),_=vt(()=>v(this,null,function*(){return yield Kt(n.apiKey)}),[n.apiKey]),E=vt(()=>{c({status:"not-loaded"})},[]);Ut(()=>{var f;(((f=n.experimental_customAuth)==null?void 0:f.jwt)!=null||n.jwt!=null)&&E()},[(q=n.experimental_customAuth)==null?void 0:q.jwt,n.jwt,E]),Ut(()=>{function f(){return v(this,null,function*(){if(!(l.status!=="not-loaded"||n.jwt==null||m&&!y||(t==null?void 0:t.chain)==null))try{let O=m&&u?yield a():t.signer;yield D({chain:t.chain,signer:O,owner:t.owner})}catch(O){console.error("Failed to create wallet:",O),s(void 0)}})}t!=null&&f()},[l.status,n.jwt,y,u,a,D,S,t==null?void 0:t.chain,t==null?void 0:t.signer,t==null?void 0:t.owner]),Ut(()=>{n.jwt==null&&l.status!=="not-loaded"&&E()},[n.jwt,l.status,E]);let B=we(()=>({walletState:l,setWalletState:c,showPasskeyHelpers:o,appearance:e,createPasskeyPrompt:S,getOrCreateWallet:D,createPasskeySigner:_,clearWallet:E}),[l,o,e,S,D,_,E]);return Bt(ct,{children:Pe(Pt.Provider,{value:B,children:[r,d&&i!=null?Oo(Bt(no,{rejectRef:k,email:i,open:d,setOpen:x,step:p,onSubmitOTP:T,onResendOTPCode:I,onSubmitEmail:I,appearance:e}),document.body):null,w.open?Oo(Bt(zt,{state:w,appearance:e}),document.body):null]})})}function _i(){let r=Se(Pt);if(!r)throw new Error("useWallet must be used within CrossmintAuthProvider or CrossmintWalletProvider");let{walletState:o,getOrCreateWallet:e,createPasskeySigner:t,clearWallet:n}=r;return{wallet:o.status==="loaded"?o.wallet:void 0,status:o.status,getOrCreateWallet:e,createPasskeySigner:t,clearWallet:n}}import{useContext as Ae}from"react";function Xi(){let r=Ae(lt);if(r===void 0)throw new Error("useAuth must be used within an AuthProvider");return r}import{Fragment as Te,jsx as mt,jsxs as To}from"react/jsx-runtime";var Ie={crossmintAuth:void 0,login:()=>{},logout:()=>{},jwt:void 0,user:void 0,status:"initializing",getUser:()=>{}},lt=We(Ie);function gl({children:r,appearance:o,termsOfServiceText:e,prefetchOAuthUrls:t=!0,authModalTitle:n,onLoginSuccess:s,loginMethods:i=["email","google"],refreshRoute:u,logoutRoute:m}){let[a,y]=st(void 0),{crossmint:l,setJwt:c,experimental_setCustomAuth:w}=ut("CrossmintAuthProvider must be used within CrossmintProvider"),g=ke(null),d=Io(()=>(g.current||(g.current=Ee.from(l,{callbacks:{onLogout:()=>{y(void 0),w(void 0)},onTokenRefresh:f=>{y(f.user),w({email:f.user.email,jwt:f.jwt})}},refreshRoute:u,logoutRoute:m})),g.current),[]),x=Oe(l.apiKey),[p,C]=st(!1),[h,P]=st(!1),[F,k]=st(void 0),[S,I]=st(!0),T=i.some(f=>f.startsWith("web3")),D=at(()=>{s==null||s()},[s]);No(()=>{if(l.jwt==null){let f=Fe(Ne);c(f)}P(!0)},[l.jwt,c]),No(()=>{l.jwt!=null&&p&&(C(!1),D())},[l.jwt,p,D]);let _=at(f=>{if(l.jwt!=null){console.log("User already logged in");return}f!=null&&typeof f=="string"&&k(f),C(!0)},[l.jwt]),E=at(()=>{console.log("Logging out"),d.logout()},[d]),B=at(()=>!h||T&&!S?"initializing":l.jwt!=null?"logged-in":p?"in-progress":"logged-out",[h,T,S,l.jwt,p]),G=at(()=>v(this,null,function*(){if(l.jwt==null){console.log("User not logged in");return}let f=yield d.getUser();return y(f),w(f),f}),[l.jwt,d,w]),q=Io(()=>({crossmintAuth:d,login:_,logout:E,jwt:l.jwt,user:a,status:B(),getUser:G}),[d,_,E,l.jwt,a,B,G]);return mt(ct,{children:mt(lt.Provider,{value:q,children:mt(Do,{setDialogOpen:(f,O)=>{C(f),O&&D()},preFetchOAuthUrls:B()==="logged-out"&&t,initialState:{appearance:o,loginMethods:i,termsOfServiceText:e,authModalTitle:n,baseUrl:x,defaultEmail:F},children:T?To(Fo,{apiKeyEnvironment:l.apiKey.includes("production")?"production":"staging",loginMethods:i,appearance:o,onSdkLoaded:I,children:[r,mt(bt,{open:p})]}):To(Te,{children:[r,mt(bt,{open:p})]})})})})}function j(){let r=De(lt);if(!r)throw new Error("useCrossmintAuth must be used within a CrossmintAuthProvider");return r}import{jsx as je}from"react/jsx-runtime";var Ro={google:"",twitter:""},Uo=Re(void 0),b=()=>{let r=Me(Uo);if(!r)throw new Error("useAuthForm must be used within an AuthFormProvider");return r},Do=({setDialogOpen:r,preFetchOAuthUrls:o,initialState:e,children:t})=>{let{crossmintAuth:n}=j(),[s,i]=St("initial"),[u,m]=St(null),[a,y]=St(Ro),[l,c]=St(!0),{loginMethods:w,baseUrl:g,appearance:d,termsOfServiceText:x,authModalTitle:p,defaultEmail:C}=e,h=Ue(()=>v(void 0,null,function*(){c(!0);try{let S=w.filter(T=>T in Ro).map(T=>v(void 0,null,function*(){let D=yield n==null?void 0:n.getOAuthUrl(T);return{[T]:D}})),I=Object.assign({},...yield Promise.all(S));y(I)}catch(k){m(k instanceof Le?k.message:"Unable to load oauth providers. Please try again later.")}finally{c(!1)}}),[w,n]);Be(()=>{o&&h()},[h,o]);let F={step:s,error:u,baseUrl:g,appearance:d,termsOfServiceText:x,authModalTitle:p,loginMethods:w,defaultEmail:C,oauthUrlMap:a,isLoadingOauthUrlMap:l,setDialogOpen:(k,S)=>{r==null||r(k,S),k||setTimeout(()=>i("initial"),250)},setError:m,setStep:i};return je(Uo.Provider,{value:F,children:t})};export{b as a,Do as b,Y as c,Lo as d,lo as e,Z as f,so as g,ao as h,uo as i,co as j,go as k,yo as l,xo as m,po as n,bo as o,vo as p,Co as q,bt as r,lt as s,gl as t,j as u,Eo as v,Fo as w,Pt as x,Ti as y,Di as z,_i as A,Xi as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,e as C,h as b}from"./chunk-UDQUVZUQ.js";import{a as h}from"./chunk-2VBA64WU.js";import{a as k}from"./chunk-NBJIJZGO.js";import{a as v}from"./chunk-77PBG2JJ.js";import{a as g}from"./chunk-HVZ5M3FY.js";import{a as m}from"./chunk-OOLXYAO7.js";import{VisuallyHidden as P}from"@radix-ui/react-visually-hidden";import{Fragment as N,jsx as o,jsxs as i}from"react/jsx-runtime";function n({title:e,content:t,primaryButton:s,secondaryAction:l,appearance:r}){var u,a,y,f;return o(x,{modal:!1,open:!0,onOpenChange:()=>{},children:i(C,{showCloseButton:!1,onInteractOutside:d=>d.preventDefault(),onOpenAutoFocus:d=>d.preventDefault(),className:"!p-0 !min-[480px]:p-0",style:{borderRadius:r==null?void 0:r.borderRadius,backgroundColor:(u=r==null?void 0:r.colors)==null?void 0:u.background},children:[o(P,{asChild:!0,children:o(b,{children:e})}),i("div",{className:"relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",children:[o("div",{className:"flex justify-center left-1.5 relative",children:o(g,{appearance:r})}),o("div",{className:"flex justify-center",children:o("p",{style:{fontSize:"1.125rem",lineHeight:"1.75rem",fontWeight:"bold",color:((a=r==null?void 0:r.colors)==null?void 0:a.textPrimary)||"#20343E"},children:e})}),o("div",{className:"mb-6",children:o("div",{style:{fontWeight:"normal",color:((y=r==null?void 0:r.colors)==null?void 0:y.textSecondary)||"#67797F"},children:t})}),i("div",{className:"flex flex-col gap-4 justify-center",children:[s,l]}),o("div",{className:"flex justify-center pt-4",children:o(h,{color:(f=r==null?void 0:r.colors)==null?void 0:f.textSecondary})})]})]})})}function F({state:e,appearance:t}){var s,l;switch(e.type){case"create-wallet":return o(n,{title:"Create Your Wallet",appearance:t,content:i(N,{children:[o("div",{className:"mb-3",children:"You're about to create a wallet."}),i("div",{className:"flex flex-col gap-2",children:[i("div",{className:"flex gap-2",children:[o("div",{children:o(v,{})}),"Your wallet will be secured with a passkey"]}),i("div",{className:"flex gap-2",children:[o("div",{children:o(m,{})}),"Your device will ask you for your fingerprint, face, or screen lock to set it up"]})]})]}),primaryButton:o(c,{appearance:t,onClick:e.primaryActionOnClick,children:"Create Wallet"})});case"create-wallet-error":return o(n,{title:"Wallet Creation Failed",appearance:t,content:o("div",{children:"We couldn't create your wallet. This could be due to rejecting the request, a timeout, or not having access to your passkey on this device."}),primaryButton:o(c,{appearance:t,onClick:e.primaryActionOnClick,children:"Try again"})});case"transaction":return o(n,{title:"
|
|
1
|
+
import{a as x,e as C,h as b}from"./chunk-UDQUVZUQ.js";import{a as h}from"./chunk-2VBA64WU.js";import{a as k}from"./chunk-NBJIJZGO.js";import{a as v}from"./chunk-77PBG2JJ.js";import{a as g}from"./chunk-HVZ5M3FY.js";import{a as m}from"./chunk-OOLXYAO7.js";import{VisuallyHidden as P}from"@radix-ui/react-visually-hidden";import{Fragment as N,jsx as o,jsxs as i}from"react/jsx-runtime";function n({title:e,content:t,primaryButton:s,secondaryAction:l,appearance:r}){var u,a,y,f;return o(x,{modal:!1,open:!0,onOpenChange:()=>{},children:i(C,{showCloseButton:!1,onInteractOutside:d=>d.preventDefault(),onOpenAutoFocus:d=>d.preventDefault(),className:"!p-0 !min-[480px]:p-0",style:{borderRadius:r==null?void 0:r.borderRadius,backgroundColor:(u=r==null?void 0:r.colors)==null?void 0:u.background},children:[o(P,{asChild:!0,children:o(b,{children:e})}),i("div",{className:"relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",children:[o("div",{className:"flex justify-center left-1.5 relative",children:o(g,{appearance:r})}),o("div",{className:"flex justify-center",children:o("p",{style:{fontSize:"1.125rem",lineHeight:"1.75rem",fontWeight:"bold",color:((a=r==null?void 0:r.colors)==null?void 0:a.textPrimary)||"#20343E"},children:e})}),o("div",{className:"mb-6",children:o("div",{style:{fontWeight:"normal",color:((y=r==null?void 0:r.colors)==null?void 0:y.textSecondary)||"#67797F"},children:t})}),i("div",{className:"flex flex-col gap-4 justify-center",children:[s,l]}),o("div",{className:"flex justify-center pt-4",children:o(h,{color:(f=r==null?void 0:r.colors)==null?void 0:f.textSecondary})})]})]})})}function F({state:e,appearance:t}){var s,l;switch(e.type){case"create-wallet":return o(n,{title:"Create Your Wallet",appearance:t,content:i(N,{children:[o("div",{className:"mb-3",children:"You're about to create a wallet."}),i("div",{className:"flex flex-col gap-2",children:[i("div",{className:"flex gap-2",children:[o("div",{children:o(v,{})}),"Your wallet will be secured with a passkey"]}),i("div",{className:"flex gap-2",children:[o("div",{children:o(m,{})}),"Your device will ask you for your fingerprint, face, or screen lock to set it up"]})]})]}),primaryButton:o(c,{appearance:t,onClick:e.primaryActionOnClick,children:"Create Wallet"})});case"create-wallet-error":return o(n,{title:"Wallet Creation Failed",appearance:t,content:o("div",{children:"We couldn't create your wallet. This could be due to rejecting the request, a timeout, or not having access to your passkey on this device."}),primaryButton:o(c,{appearance:t,onClick:e.primaryActionOnClick,children:"Try again"})});case"transaction":return o(n,{title:"Use Your Wallet",appearance:t,content:o("div",{className:"flex flex-col gap-2",children:i("div",{className:"flex gap-2",children:[o("div",{children:o(m,{})}),o("span",{children:"Your device will ask you for your fingerprint, face, or screen lock to authorize this action."})]})}),primaryButton:o(c,{appearance:t,onClick:e.primaryActionOnClick,children:"Use Wallet"})});case"transaction-error":return o(n,{title:"Wallet Access Failed",appearance:t,content:o("div",{children:"We couldn't access your wallet. This could be due to rejecting the request, a timeout, or not having access to your passkey on this device."}),primaryButton:o(c,{appearance:t,onClick:e.primaryActionOnClick,children:"Try again"}),secondaryAction:o("a",{href:"https://docs.crossmint.com/wallets/smart-wallets/users/troubleshoot",rel:"noopener noreferrer",target:"_blank",style:{padding:"0.875rem",width:"100%",textAlign:"center",textDecoration:"none",borderRadius:"0.5rem",fontWeight:"bold",backgroundColor:((s=t==null?void 0:t.colors)==null?void 0:s.inputBackground)||"#F0F2F4",color:((l=t==null?void 0:t.colors)==null?void 0:l.textSecondary)||"#00150D"},children:"Troubleshoot"})});case"not-supported":return o(n,{title:"Passkeys Not Supported on This Device",appearance:t,content:o("div",{children:"To access your wallet with a passkey, switch to a device or browser that supports passkeys, such as Chrome or Safari on a smartphone, tablet, or modern computer"}),primaryButton:o(c,{appearance:t,onClick:e.primaryActionOnClick,children:"Understood"})});default:return null}}var c=({appearance:e,onClick:t,children:s})=>{var l,r;return i("button",{className:k("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:e==null?void 0:e.borderRadius,backgroundColor:(l=e==null?void 0:e.colors)==null?void 0:l.buttonBackground},onClick:t,children:[o("span",{className:"font-medium",style:{margin:"0px 32px",color:(r=e==null?void 0:e.colors)==null?void 0:r.textPrimary},children:s}),o("span",{className:"sr-only",children:s})]})};export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk56YL3XJWcjs = require('./chunk-56YL3XJW.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk56YL3XJWcjs = require('./chunk-56YL3XJW.cjs');var _chunkZ3RU4H6Kcjs = require('./chunk-Z3RU4H6K.cjs');var _chunkKARK5Z2Dcjs = require('./chunk-KARK5Z2D.cjs');var _chunk2WSEHVNPcjs = require('./chunk-2WSEHVNP.cjs');var _clientsdkbase = require('@crossmint/client-sdk-base');var _clsx = require('clsx'); var _clsx2 = _interopRequireDefault(_clsx);var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function q(f){let[h,k]=_react.useState.call(void 0, !1),{crossmint:y}=_chunkKARK5Z2Dcjs.b.call(void 0, ),P=_chunkZ3RU4H6Kcjs.a.call(void 0, y),c=f,{recipient:g,locale:H,lineItems:S,payment:V,appearance:v}=c,b=_chunk2WSEHVNPcjs.c.call(void 0, c,["recipient","locale","lineItems","payment","appearance"]),n={recipient:g,locale:H,lineItems:S,payment:V,appearance:v},x=_clientsdkbase.crossmintHostedCheckoutV3Service.call(void 0, {apiClient:P,hostedCheckoutProps:n}),t=_clientsdkbase.crossmintHostedCheckoutV3StylesService.call(void 0, n),p=b,{onClick:r,className:E,children:e}=p,I=_chunk2WSEHVNPcjs.c.call(void 0, p,["onClick","className","children"]);function B(o){o.preventDefault(),o.stopPropagation(),x.createWindow(),r&&r(o)}let i=t.generateCss();return _react.useEffect.call(void 0, ()=>{let{cleanup:o}=t.injectCss(i);return k(!0),o},[i]),h?_jsxruntime.jsxs.call(void 0, "button",_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {onClick:B,className:_clsx2.default.call(void 0, t.identifiers.buttonClassNames,E)},I),{children:[_jsxruntime.jsx.call(void 0, _chunk56YL3XJWcjs.a,{style:{marginRight:"12px",flex:"none"},displayType:"icon-only",id:t.identifiers.logoId,height:16,width:16}),e!=null?e:_jsxruntime.jsx.call(void 0, "p",{style:{margin:0},children:t.getButtonText()})]})):null}exports.a = q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkO5J2ZIJ6cjs = require('./chunk-O5J2ZIJ6.cjs');var _chunkX5BBXO27cjs = require('./chunk-X5BBXO27.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkO5J2ZIJ6cjs = require('./chunk-O5J2ZIJ6.cjs');var _chunkX5BBXO27cjs = require('./chunk-X5BBXO27.cjs');var _chunkBJXEVV7Ucjs = require('./chunk-BJXEVV7U.cjs');var _chunk2WSEHVNPcjs = require('./chunk-2WSEHVNP.cjs');var _react = require('react');var _clientsdkbase = require('@crossmint/client-sdk-base');var _jsxruntime = require('react/jsx-runtime');function at(C){let c=C,{className:g,disabled:P,onClick:h,style:f,tabIndex:I,theme:S="dark",mintTo:B,emailTo:k,listingId:v,auctionId:Z,showOverlay:E=!0,mintConfig:b,whPassThroughArgs:M,environment:T,paymentMethod:t,preferredSigninMethod:x,dismissOverlayOnClick:N,prepay:R,locale:i="en-US",currency:L="usd",successCallbackURL:w="",failureCallbackURL:O="",loginEmail:U="",projectId:H,getButtonText:o,checkoutProps:a={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=c,s=_chunk2WSEHVNPcjs.c.call(void 0, c,["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"]),_="clientId"in s?s.clientId:s.collectionId,[e,A]=_react.useState.call(void 0, !1),{isServerSideRendering:D}=_chunkX5BBXO27cjs.a.call(void 0, ),{connect:V}=_clientsdkbase.crossmintModalService.call(void 0, {clientId:_,projectId:H,showOverlay:E,dismissOverlayOnClick:N,setConnecting:A,libVersion:_chunkBJXEVV7Ucjs.a,environment:T,clientName:_clientsdkbase.clientNames.reactUi,locale:i,currency:L,successCallbackURL:w,failureCallbackURL:O,loginEmail:U}),{getButtonText:$,handleClick:j}=_clientsdkbase.crossmintPayButtonService.call(void 0, {onClick:h,connecting:e,paymentMethod:t,locale:i,checkoutProps:a}),q=F=>j(F,()=>{V(b,B,k,v,M,t,x,R,a)}),n=_chunkO5J2ZIJ6cjs.b.call(void 0, _chunkO5J2ZIJ6cjs.a.call(void 0, S)),z=_react.useMemo.call(void 0, ()=>_jsxruntime.jsx.call(void 0, "span",{className:n.crossmintParagraph,role:"button-paragraph",children:o!=null?o(e,t||"fiat"):$(e)}),[e,o,t]);return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:!D&&_jsxruntime.jsxs.call(void 0, "button",{className:`${n.crossmintButton} ${g||""}`,disabled:P,onClick:q,style:_chunk2WSEHVNPcjs.a.call(void 0, {},f),tabIndex:I,children:[_jsxruntime.jsx.call(void 0, "img",{className:n.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),z]})})}exports.a = at;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-DXAJE3HC.js";import{a as e}from"./chunk-PXDN3KFO.js";import{jsx as t}from"react/jsx-runtime";function i(d){return t(o,e({},d))}export{i as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEM7VCISScjs = require('./chunk-EM7VCISS.cjs');var _chunk2WSEHVNPcjs = require('./chunk-2WSEHVNP.cjs');var _jsxruntime = require('react/jsx-runtime');function s(d){return _jsxruntime.jsx.call(void 0, _chunkEM7VCISScjs.a,_chunk2WSEHVNPcjs.a.call(void 0, {},d))}exports.a = s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
1
|
+
import{a as t}from"./chunk-X5EEGZ3H.js";import{assertValidValidateNFTDetailProps as e,getNFTDetailSrc as i}from"@crossmint/client-sdk-base";import{jsx as s}from"react/jsx-runtime";function d(r){e(r);let o=i(r,t);return s("iframe",{src:o,width:"100%",height:"100%",style:{flexGrow:"1",border:"none",margin:"0",padding:"0"},role:"nft-details"})}export{d as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZ3RU4H6Kcjs = require('./chunk-Z3RU4H6K.cjs');var _chunkKARK5Z2Dcjs = require('./chunk-KARK5Z2D.cjs');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var d=_react.createContext.call(void 0, void 0);function O({children:e}){let[r,c]=_react.useState.call(void 0, void 0),[u,C]=_react.useState.call(void 0, void 0),{crossmint:m}=_chunkKARK5Z2Dcjs.b.call(void 0, ),a=_chunkZ3RU4H6Kcjs.a.call(void 0, m,{usageOrigin:"client"});return _react.useEffect.call(void 0, ()=>{let n=t=>{if(t.origin!==new URL(a.baseUrl).origin||t.data.event!=="order:updated")return;let{order:f,orderClientSecret:p}=t.data.data;c(f),C(p)};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[r]),_jsxruntime.jsx.call(void 0, d.Provider,{value:{order:r,orderClientSecret:u},children:e})}function b(){let e=_react.useContext.call(void 0, d);if(!e)throw new Error("useCrossmintCheckout must be used within a CrossmintCheckoutProvider");return e}exports.a = O; exports.b = b;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="2.0.4";var r=s;export{r as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-X5EEGZ3H.js";import{CrossmintApiClient as e}from"@crossmint/common-sdk-base";function m(t,i){return new e(t,{internalConfig:{sdkMetadata:{name:"@crossmint/client-sdk-react-ui",version:n},apiKeyExpectations:i}})}export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as y}from"./chunk-72P3JMXX.js";import{a as u}from"./chunk-2POV64LQ.js";import{a as p}from"./chunk-
|
|
1
|
+
import{a as d,b as y}from"./chunk-72P3JMXX.js";import{a as u}from"./chunk-2POV64LQ.js";import{a as p}from"./chunk-X5EEGZ3H.js";import{a as l,c as m}from"./chunk-PXDN3KFO.js";import{useMemo as G}from"react";import{useState as J}from"react";import{clientNames as K,crossmintModalService as Q,crossmintPayButtonService as W}from"@crossmint/client-sdk-base";import{Fragment as Y,jsx as r,jsxs as X}from"react/jsx-runtime";function ct(C){let c=C,{className:g,disabled:P,onClick:h,style:f,tabIndex:I,theme:S="dark",mintTo:B,emailTo:k,listingId:v,auctionId:Z,showOverlay:E=!0,mintConfig:b,whPassThroughArgs:M,environment:T,paymentMethod:t,preferredSigninMethod:x,dismissOverlayOnClick:N,prepay:R,locale:i="en-US",currency:L="usd",successCallbackURL:w="",failureCallbackURL:O="",loginEmail:U="",projectId:H,getButtonText:o,checkoutProps:a={experimental:!1,display:"same-tab",paymentMethods:["fiat","ETH","SOL"]}}=c,s=m(c,["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"]),_="clientId"in s?s.clientId:s.collectionId,[e,A]=J(!1),{isServerSideRendering:D}=u(),{connect:V}=Q({clientId:_,projectId:H,showOverlay:E,dismissOverlayOnClick:N,setConnecting:A,libVersion:p,environment:T,clientName:K.reactUi,locale:i,currency:L,successCallbackURL:w,failureCallbackURL:O,loginEmail:U}),{getButtonText:$,handleClick:j}=W({onClick:h,connecting:e,paymentMethod:t,locale:i,checkoutProps:a}),q=F=>j(F,()=>{V(b,B,k,v,M,t,x,R,a)}),n=y(d(S)),z=G(()=>r("span",{className:n.crossmintParagraph,role:"button-paragraph",children:o!=null?o(e,t||"fiat"):$(e)}),[e,o,t]);return r(Y,{children:!D&&X("button",{className:`${n.crossmintButton} ${g||""}`,disabled:P,onClick:q,style:l({},f),tabIndex:I,children:[r("img",{className:n.crossmintImg,src:"https://www.crossmint.io/assets/crossmint/logo.svg",alt:"Crossmint logo"}),z]})})}export{ct as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBJXEVV7Ucjs = require('./chunk-BJXEVV7U.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');function C(t,i){return new (0, _commonsdkbase.CrossmintApiClient)(t,{internalConfig:{sdkMetadata:{name:"@crossmint/client-sdk-react-ui",version:_chunkBJXEVV7Ucjs.a},apiKeyExpectations:i}})}exports.a = C;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkPZ3KXKJDcjs = require('./chunk-PZ3KXKJD.cjs');var _chunkHUFKDHMJcjs = require('./chunk-HUFKDHMJ.cjs');var _chunkBR77Q3PKcjs = require('./chunk-BR77Q3PK.cjs');var _chunkHG5ML6KXcjs = require('./chunk-HG5ML6KX.cjs');var _chunkZ2FGFHRQcjs = require('./chunk-Z2FGFHRQ.cjs');var _chunkAHD64NAJcjs = require('./chunk-AHD64NAJ.cjs');var _chunkFASRTACDcjs = require('./chunk-FASRTACD.cjs');var
|
|
2
|
-
`,"Some emails may take several minutes to arrive."]})}),_jsxruntime.jsx.call(void 0, _chunkHLGNSXEQcjs.a,{initialSeconds:60,appearance:t,countdownText:B=>`Re-send code in ${B}s`,countdownCompleteText:"Re-send code",handleOnClick:f})]})]})}var _clientsdkwindow = require('@crossmint/client-sdk-window');var _zod = require('zod');var Q=r=>{let{crossmintAuth:o}=L(),{oauthUrlMap:e,setError:t}=b(),[n,s]=_react.useState.call(void 0, !1),i=_react.useRef.call(void 0, null);return _react.useEffect.call(void 0, ()=>(i.current==null&&(i.current=new (0, _clientsdkwindow.ChildWindow)(window.opener||window.parent,"*",{incomingEvents:Go})),()=>{i.current!=null&&i.current.off("authMaterialFromPopupCallback")}),[]),{createPopupAndSetupListeners:m=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){if(i.current==null)throw new Error("Child window not initialized");s(!0),t(null);let a=new URL(e[r]);if(m!=null){let f=Array.from(a.searchParams.entries());a.search="",m&&a.searchParams.append("provider_login_hint",m),f.forEach(([d,x])=>{a.searchParams.append(d,x)})}let y=yield _clientsdkwindow.PopupWindow.init(a.toString(),{awaitToLoad:!1,crossOrigin:!0,width:400,height:700}),l=f=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){var d;yield o==null?void 0:o.handleRefreshAuthMaterial(f.oneTimeSecret),(d=i.current)==null||d.off("authMaterialFromPopupCallback"),y.window.close(),s(!1)}),c=f=>{var d;t(f.error),(d=i.current)==null||d.off("errorFromPopupCallback"),y.window.close(),s(!1)};i.current.on("authMaterialFromPopupCallback",l),i.current.on("errorFromPopupCallback",c);let w=setInterval(()=>{var f,d;(f=y.window)!=null&&f.closed&&(clearInterval(w),s(!1),(d=i.current)==null||d.off("authMaterialFromPopupCallback"))},2500)}),isLoading:n}},Go={authMaterialFromPopupCallback:_zod.z.object({oneTimeSecret:_zod.z.string()}),errorFromPopupCallback:_zod.z.object({error:_zod.z.string()})};function lo({emailInput:r,appearance:o}){var n,s,i,u;let{createPopupAndSetupListeners:e,isLoading:t}=Q("google");return _jsxruntime.jsxs.call(void 0, "button",{type:"button",className:_chunkWABJHG6Bcjs.a.call(void 0, "flex items-center gap-2 justify-center h-[32px] px-2.5 border border-cm-border rounded-xl bg-cm-background-primary","hover:bg-cm-hover focus:bg-cm-hover outline-none",t?"cursor-not-allowed hover:bg-cm-muted-primary":""),onClick:t?void 0:()=>e(r.trim().toLowerCase()),style:{backgroundColor:(n=o==null?void 0:o.colors)==null?void 0:n.buttonBackground,borderRadius:o==null?void 0:o.borderRadius},children:[_jsxruntime.jsx.call(void 0, _chunkE65EGG73cjs.a,{className:"max-h-[18px] max-w-[18px] h-[18px] w-[18px]"}),t?_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(s=o==null?void 0:o.colors)==null?void 0:s.textSecondary,fill:(i=o==null?void 0:o.colors)==null?void 0:i.textPrimary,width:"18px",height:"18px"}}):_jsxruntime.jsx.call(void 0, "span",{className:"text-cm-accent",style:{color:(u=o==null?void 0:o.colors)==null?void 0:u.accent},children:"Continue"})]})}function so({setOtpEmailData:r}){var f,d,x,p,C,h,P,k,W,S,N,I,T,j;let{crossmintAuth:o}=L(),{appearance:e,defaultEmail:t,setStep:n,setError:s}=b(),[i,u]=_react.useState.call(void 0, t!=null?t:""),[m,a]=_react.useState.call(void 0, ""),[y,l]=_react.useState.call(void 0, !1),c=i.toLowerCase().includes("@gmail.com")&&!i.toLowerCase().includes("+")&&_commonsdkauth.isEmailValid.call(void 0, i)&&!y;function w(E){return _chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){E.preventDefault(),l(!0);try{let M=i.trim().toLowerCase(),G=yield o==null?void 0:o.sendEmailOtp(M);r({email:M,emailId:G.emailId}),n("otp")}catch(M){l(!1),s("Failed to send email. Please try again or contact support.")}})}return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-start justify-start w-full rounded-lg",children:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full",children:[_jsxruntime.jsx.call(void 0, "label",{className:"text-cm-text-primary block mb-[5px]",style:{color:(f=e==null?void 0:e.colors)==null?void 0:f.textPrimary},children:"Email"}),_jsxruntime.jsxs.call(void 0, "form",{role:"form",className:"relative",onSubmit:E=>{if(c){E.preventDefault();return}_commonsdkauth.isEmailValid.call(void 0, i)?w(E):E.preventDefault()},noValidate:!0,children:[_jsxruntime.jsx.call(void 0, "label",{htmlFor:"emailInput",className:"sr-only",children:"Email"}),_jsxruntime.jsx.call(void 0, "input",{className:_chunkWABJHG6Bcjs.a.call(void 0, "flex-grow text-cm-text-primary text-left pl-[16px] h-[58px] w-full border border-cm-border rounded-xl bg-cm-background-primary placeholder:text-md","transition-none duration-200 ease-in-out","focus:outline-none focus-ring-custom","placeholder:[color:var(--placeholder-color)]",m?"border-red-500":"",c?"pr-[132px]":"pr-[80px]"),style:{color:(d=e==null?void 0:e.colors)==null?void 0:d.textPrimary,borderRadius:e==null?void 0:e.borderRadius,borderColor:m?(x=e==null?void 0:e.colors)==null?void 0:x.danger:(p=e==null?void 0:e.colors)==null?void 0:p.border,backgroundColor:(C=e==null?void 0:e.colors)==null?void 0:C.inputBackground,"--placeholder-color":(P=(h=e==null?void 0:e.colors)==null?void 0:h.textSecondary)!=null?P:"#67797F","--focus-ring-color":new (0, _color2.default)((W=(k=e==null?void 0:e.colors)==null?void 0:k.accent)!=null?W:"#04AA6D").alpha(.18).toString()},type:"email",placeholder:"your@email.com",value:i,onChange:E=>{u(E.target.value),a(""),s(null)},readOnly:y,"aria-describedby":"emailError"}),_jsxruntime.jsxs.call(void 0, "div",{className:"absolute inset-y-0 right-0 flex items-center pr-4",children:[m&&_jsxruntime.jsx.call(void 0, _chunkNRN4WNQLcjs.a,{customColor:(S=e==null?void 0:e.colors)==null?void 0:S.danger}),y&&_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(N=e==null?void 0:e.colors)==null?void 0:N.textSecondary,fill:(I=e==null?void 0:e.colors)==null?void 0:I.textPrimary}}),c?_jsxruntime.jsx.call(void 0, lo,{emailInput:i,appearance:e}):!m&&!y?_jsxruntime.jsx.call(void 0, "button",{type:"submit",className:_chunkWABJHG6Bcjs.a.call(void 0, "font-medium text-cm-accent text-nowrap bg-cm-background-primary",_commonsdkauth.isEmailValid.call(void 0, i)?"cursor-pointer":"!cursor-not-allowed opacity-60"),style:{color:(T=e==null?void 0:e.colors)==null?void 0:T.accent,backgroundColor:(j=e==null?void 0:e.colors)==null?void 0:j.inputBackground},disabled:!_commonsdkauth.isEmailValid.call(void 0, i)||y,children:"Submit"}):null]})]}),m&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-red-500 mb-2 pt-2",children:m})]})})})}function mo(){let{step:r}=b(),[o,e]=_react.useState.call(void 0, null);return r==="otp"?_jsxruntime.jsx.call(void 0, io,{otpEmailData:o,setOtpEmailData:e}):r==="initial"?_jsxruntime.jsx.call(void 0, so,{setOtpEmailData:e}):null}function uo({appearance:r,text:o}){var t,n,s;let{step:e}=b();return e!=="initial"?null:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-center w-full pt-2 pb-3",children:[_jsxruntime.jsx.call(void 0, "span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(t=r==null?void 0:r.colors)==null?void 0:t.border}}),o!=null?_jsxruntime.jsx.call(void 0, "p",{className:"flex-none px-2 text-sm text-cm-text-primary",style:{color:(n=r==null?void 0:r.colors)==null?void 0:n.textSecondary},children:o}):null,_jsxruntime.jsx.call(void 0, "span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(s=r==null?void 0:r.colors)==null?void 0:s.border}})]})}function fo(o){var r=_chunk2WSEHVNPcjs.c.call(void 0, o,[]);var m,a,y,l;let{step:e,appearance:t,isLoadingOauthUrlMap:n}=b(),{createPopupAndSetupListeners:s,isLoading:i}=Q("google"),u=n||i;return e!=="initial"?null:_jsxruntime.jsxs.call(void 0, "button",_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",u?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(m=t==null?void 0:t.colors)==null?void 0:m.buttonBackground},onClick:u?void 0:()=>s()},r),{children:[_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkE65EGG73cjs.a,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),u?_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(a=t==null?void 0:t.colors)==null?void 0:a.textSecondary,fill:(y=t==null?void 0:t.colors)==null?void 0:y.textPrimary}}):_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(l=t==null?void 0:t.colors)==null?void 0:l.textPrimary},children:"Sign in with Google"})]}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Sign in with Google"})]}))}var _authkit = require('@farcaster/auth-kit');function go(){var n,s;let{step:r,appearance:o,setStep:e,setError:t}=b();return r==="initial"?_jsxruntime.jsx.call(void 0, "div",{children:_jsxruntime.jsxs.call(void 0, "button",{className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:o==null?void 0:o.borderRadius,backgroundColor:(n=o==null?void 0:o.colors)==null?void 0:n.buttonBackground},onClick:()=>{e("qrCode"),t(null)},children:[_jsxruntime.jsx.call(void 0, _chunkSRQAQHYKcjs.a,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(s=o==null?void 0:o.colors)==null?void 0:s.textPrimary},children:"Sign in with Farcaster"}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Sign in with Farcaster"})]})}):r==="qrCode"?_jsxruntime.jsx.call(void 0, te,{}):null}function te(){var f,d,x,p,C,h,P,k,W;let{crossmintAuth:r}=L(),{appearance:o,setStep:e,setDialogOpen:t,setError:n}=b(),[s,i]=_react.useState.call(void 0, null),u=_react.useMemo.call(void 0, ()=>({onSuccess:S=>{i(S)}}),[]),{signIn:m,url:a,connect:y,signOut:l,isConnected:c}=_authkit.useSignIn.call(void 0, u),w=S=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){n(null);try{let N=yield r==null?void 0:r.signInWithFarcaster(S);yield r==null?void 0:r.handleRefreshAuthMaterial(N),t(!1),e("initial")}catch(N){console.error("Error during Farcaster sign-in:",N),n("Failed to sign in with Farcaster")}});return _react.useEffect.call(void 0, ()=>{s!=null&&w(s)},[s]),_react.useEffect.call(void 0, ()=>{c&&m()},[c]),_react.useEffect.call(void 0, ()=>{y()},[]),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, X,{onClick:()=>{l(),e("initial")},iconColor:(f=o==null?void 0:o.colors)==null?void 0:f.textPrimary,ringColor:(d=o==null?void 0:o.colors)==null?void 0:d.accent}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-center gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"text-center",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-lg font-semibold text-cm-text-primary mb-2",style:{color:(x=o==null?void 0:o.colors)==null?void 0:x.textPrimary},children:"Sign in with Farcaster"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-base font-normal text-cm-text-secondary",style:{color:(p=o==null?void 0:o.colors)==null?void 0:p.textSecondary},children:"Scan with your phone's camera to continue."})]}),_jsxruntime.jsx.call(void 0, "div",{className:"bg-white aspect-square rounded-lg p-4",style:{backgroundColor:(C=o==null?void 0:o.colors)==null?void 0:C.inputBackground,borderRadius:o==null?void 0:o.borderRadius},children:a!=null?_jsxruntime.jsx.call(void 0, _authkit.QRCode,{uri:a,size:280}):_jsxruntime.jsx.call(void 0, "div",{className:"min-h-[246px] flex items-center justify-center",children:_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(h=o==null?void 0:o.colors)==null?void 0:h.textSecondary,fill:(P=o==null?void 0:o.colors)==null?void 0:P.textPrimary}})})}),a?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-base text-center font-normal text-cm-text-secondary",style:{color:(k=o==null?void 0:o.colors)==null?void 0:k.textSecondary},children:"Alternatively, click on this link to open Warpcast."}),_jsxruntime.jsx.call(void 0, "a",{href:a,rel:"noopener noreferrer",target:"_blank",className:"text-base font-normal text-cm-link",style:{color:(W=o==null?void 0:o.colors)==null?void 0:W.textLink},children:"Open Warpcast"})]}):null]})]})}function ho(o){var r=_chunk2WSEHVNPcjs.c.call(void 0, o,[]);var m,a,y,l;let{step:e,appearance:t,isLoadingOauthUrlMap:n}=b(),{createPopupAndSetupListeners:s,isLoading:i}=Q("twitter"),u=n||i;return e!=="initial"?null:_jsxruntime.jsxs.call(void 0, "button",_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",u?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(m=t==null?void 0:t.colors)==null?void 0:m.buttonBackground},onClick:u?void 0:()=>s()},r),{children:[_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkZBQCXWMDcjs.a,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),u?_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(a=t==null?void 0:t.colors)==null?void 0:a.textSecondary,fill:(y=t==null?void 0:t.colors)==null?void 0:y.textPrimary}}):_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(l=t==null?void 0:t.colors)==null?void 0:l.textPrimary},children:"Sign in with X"})]}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Sign in with X"})]}))}function xo(){var n,s,i,u,m;let{step:r,appearance:o,setStep:e,setError:t}=b();return r!=="initial"?null:_jsxruntime.jsxs.call(void 0, "button",{className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:o==null?void 0:o.borderRadius,borderColor:(n=o==null?void 0:o.colors)==null?void 0:n.border,backgroundColor:(s=o==null?void 0:o.colors)==null?void 0:s.buttonBackground},onClick:()=>{e("web3"),t(null)},children:[_jsxruntime.jsx.call(void 0, _chunkTXOVDTYKcjs.a,{className:"h-[21px] w-[21px] absolute left-[20px]",style:{color:(i=o==null?void 0:o.colors)==null?void 0:i.textPrimary}}),_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(u=o==null?void 0:o.colors)==null?void 0:u.textPrimary},children:"Continue with a wallet"}),_jsxruntime.jsx.call(void 0, _chunkYXF74MVIcjs.a,{className:"h-[21px] w-[21px] absolute right-[20px]",style:{color:(m=o==null?void 0:o.colors)==null?void 0:m.textSecondary}}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Continue with a wallet"})]})}var _sdkreactcore = require('@dynamic-labs/sdk-react-core');function po(){var t,n;let{appearance:r,step:o,setStep:e}=b();return o==="web3"?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, X,{onClick:()=>e("initial"),iconColor:(t=r==null?void 0:r.colors)==null?void 0:t.textPrimary,ringColor:(n=r==null?void 0:r.colors)==null?void 0:n.accent}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-[10px] w-full",children:_jsxruntime.jsx.call(void 0, "div",{className:"widget-container",children:_jsxruntime.jsx.call(void 0, _sdkreactcore.DynamicEmbeddedWidget,{background:"none"})})})})]}):null}function wo(){let{step:r}=b();return r.startsWith("web3")?_jsxruntime.jsx.call(void 0, po,{}):r==="initial"?_jsxruntime.jsx.call(void 0, xo,{}):null}function vo({className:r}){var m,a,y,l,c,w,f,d,x,p,C,h,P;let{step:o,appearance:e,loginMethods:t,baseUrl:n,error:s,termsOfServiceText:i,authModalTitle:u}=b();return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkWABJHG6Bcjs.a.call(void 0, "relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",r),children:[s!=null?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start justify-start w-full rounded-lg p-2 mt-4 bg-cm-danger-muted",style:{backgroundColor:new (0, _color2.default)((a=(m=e==null?void 0:e.colors)==null?void 0:m.danger)!=null?a:"#f44336").alpha(.12).toString()},children:[_jsxruntime.jsx.call(void 0, "div",{className:"min-w-[20px]",children:_jsxruntime.jsx.call(void 0, _chunkNRN4WNQLcjs.a,{customColor:(l=(y=e==null?void 0:e.colors)==null?void 0:y.danger)!=null?l:"#f44336"})}),_jsxruntime.jsx.call(void 0, "p",{className:"ml-2 text-sm",style:{color:(w=(c=e==null?void 0:e.colors)==null?void 0:c.danger)!=null?w:"#f44336"},children:s})]}):null,o==="initial"?_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h1",{className:"text-2xl font-bold text-cm-text-primary",style:{color:(f=e==null?void 0:e.colors)==null?void 0:f.textPrimary},children:u!=null?u:"Sign in to Crossmint"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-base font-normal mb-3 text-cm-text-secondary",style:{color:(d=e==null?void 0:e.colors)==null?void 0:d.textSecondary},children:"Access using one of the options below."})]}):null,t.includes("google")?_jsxruntime.jsx.call(void 0, fo,{}):null,t.includes("farcaster")?_jsxruntime.jsx.call(void 0, _chunkBR77Q3PKcjs.a,{baseUrl:n,children:_jsxruntime.jsx.call(void 0, go,{})}):null,t.includes("twitter")?_jsxruntime.jsx.call(void 0, ho,{}):null,t.some(k=>k.startsWith("web3"))?_jsxruntime.jsx.call(void 0, wo,{}):null,t.includes("email")?_jsxruntime.jsxs.call(void 0, "div",{children:[t.length>1?_jsxruntime.jsx.call(void 0, uo,{appearance:e,text:"OR"}):null,_jsxruntime.jsx.call(void 0, mo,{})]}):null,o==="initial"&&i!=null?_jsxruntime.jsxs.call(void 0, "div",{className:"text-sm text-center text-cm-text-secondary mt-2",style:{color:(x=e==null?void 0:e.colors)==null?void 0:x.textSecondary},children:[_jsxruntime.jsx.call(void 0, "style",{children:`
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkPZ3KXKJDcjs = require('./chunk-PZ3KXKJD.cjs');var _chunkHUFKDHMJcjs = require('./chunk-HUFKDHMJ.cjs');var _chunkBR77Q3PKcjs = require('./chunk-BR77Q3PK.cjs');var _chunkHG5ML6KXcjs = require('./chunk-HG5ML6KX.cjs');var _chunkZ2FGFHRQcjs = require('./chunk-Z2FGFHRQ.cjs');var _chunkAHD64NAJcjs = require('./chunk-AHD64NAJ.cjs');var _chunkFASRTACDcjs = require('./chunk-FASRTACD.cjs');var _chunkMB4Z6LUXcjs = require('./chunk-MB4Z6LUX.cjs');var _chunkWMBBIP2Ccjs = require('./chunk-WMBBIP2C.cjs');var _chunk2BOQSASOcjs = require('./chunk-2BOQSASO.cjs');var _chunkHLGNSXEQcjs = require('./chunk-HLGNSXEQ.cjs');var _chunkJNLQRLICcjs = require('./chunk-JNLQRLIC.cjs');var _chunkWABJHG6Bcjs = require('./chunk-WABJHG6B.cjs');var _chunkTM7WDKYRcjs = require('./chunk-TM7WDKYR.cjs');var _chunkZBQCXWMDcjs = require('./chunk-ZBQCXWMD.cjs');var _chunkTXOVDTYKcjs = require('./chunk-TXOVDTYK.cjs');var _chunkNRN4WNQLcjs = require('./chunk-NRN4WNQL.cjs');var _chunkYXF74MVIcjs = require('./chunk-YXF74MVI.cjs');var _chunkI4GMMHQRcjs = require('./chunk-I4GMMHQR.cjs');var _chunkSRQAQHYKcjs = require('./chunk-SRQAQHYK.cjs');var _chunkE65EGG73cjs = require('./chunk-E65EGG73.cjs');var _chunkKARK5Z2Dcjs = require('./chunk-KARK5Z2D.cjs');var _chunk2WSEHVNPcjs = require('./chunk-2WSEHVNP.cjs');var _react = require('react');var _commonsdkauth = require('@crossmint/common-sdk-auth');var _clientsdkauth = require('@crossmint/client-sdk-auth');var _commonsdkbase = require('@crossmint/common-sdk-base');var _reactvisuallyhidden = require('@radix-ui/react-visually-hidden');var _color = require('color'); var _color2 = _interopRequireDefault(_color);var _jsxruntime = require('react/jsx-runtime');var Q=s=>{var i=s,{className:r,iconColor:o,ringColor:e,onClick:t}=i,n=_chunk2WSEHVNPcjs.c.call(void 0, i,["className","iconColor","ringColor","onClick"]);let{setError:u}=b();return _jsxruntime.jsx.call(void 0, "button",_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {className:_chunkWABJHG6Bcjs.a.call(void 0, "absolute left-4 top-4 min-[480px]:!left-6 min-[480px]:!top-6 rounded-full opacity-70 ring-offset-background text-cm-text-primary transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-cm-accent focus:ring-offset-2 disabled:pointer-events-none",r),onClick:m=>{u(null),t==null||t(m)}},n),{children:_jsxruntime.jsx.call(void 0, _chunkTM7WDKYRcjs.a,{className:"w-6 h-6",style:{color:o}})}))};var Bo=6;function io({otpEmailData:r,setOtpEmailData:o}){var x,p,C,h,P,E,W,S,N,I,T,j,k,M,V,$,f,F,H,St;let{crossmintAuth:e}=L(),{appearance:t,setDialogOpen:n,setStep:s,setError:i}=b(),[u,m]=_react.useState.call(void 0, ""),[a,y]=_react.useState.call(void 0, !1),[l,c]=_react.useState.call(void 0, !1),w=()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){var _,J;c(!0);try{let tt=yield e==null?void 0:e.confirmEmailOtp((_=r==null?void 0:r.email)!=null?_:"",(J=r==null?void 0:r.emailId)!=null?J:"",u);yield e==null?void 0:e.handleRefreshAuthMaterial(tt),n(!1,!0),s("initial")}catch(tt){console.error("Error confirming email OTP",tt),i("Invalid code. Please try again."),y(!0)}finally{c(!1)}}),g=()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){var _;try{yield e==null?void 0:e.sendEmailOtp((_=r==null?void 0:r.email)!=null?_:"")}catch(J){i("Failed to resend code. Please try again.")}});return _jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, Q,{onClick:()=>{s("initial"),o(null)},iconColor:(x=t==null?void 0:t.colors)==null?void 0:x.textPrimary,ringColor:(p=t==null?void 0:t.colors)==null?void 0:p.accent}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-center justify-start w-full",children:[_jsxruntime.jsx.call(void 0, "div",{className:"relative left-3",children:_jsxruntime.jsx.call(void 0, _chunkI4GMMHQRcjs.a,{customAccentColor:(C=t==null?void 0:t.colors)==null?void 0:C.accent,customButtonBackgroundColor:(h=t==null?void 0:t.colors)==null?void 0:h.buttonBackground,customBackgroundColor:(P=t==null?void 0:t.colors)==null?void 0:P.background})}),_jsxruntime.jsx.call(void 0, "p",{className:"text-base font-normal mt-4 mb-1 text-center text-cm-text-primary",style:{color:(E=t==null?void 0:t.colors)==null?void 0:E.textPrimary},children:"Check your email"}),_jsxruntime.jsxs.call(void 0, "p",{className:"text-center text-cm-text-secondary px-4",style:{color:(W=t==null?void 0:t.colors)==null?void 0:W.textSecondary},children:["A temporary login code has been sent to"," ",r!=null&&r.email?r.email:"your email address"]}),_jsxruntime.jsx.call(void 0, "div",{className:"py-8",children:_jsxruntime.jsx.call(void 0, _chunkHG5ML6KXcjs.a,{maxLength:Bo,value:u,onChange:_=>{m(_),y(!1),i(null)},onComplete:w,disabled:l,customStyles:{accent:(N=(S=t==null?void 0:t.colors)==null?void 0:S.accent)!=null?N:"#04AA6D",danger:(T=(I=t==null?void 0:t.colors)==null?void 0:I.danger)!=null?T:"#f44336",border:(k=(j=t==null?void 0:t.colors)==null?void 0:j.border)!=null?k:"#E5E7EB",textPrimary:(V=(M=t==null?void 0:t.colors)==null?void 0:M.textPrimary)!=null?V:"#909ca3",buttonBackground:(f=($=t==null?void 0:t.colors)==null?void 0:$.buttonBackground)!=null?f:"#eff6ff",inputBackground:(H=(F=t==null?void 0:t.colors)==null?void 0:F.inputBackground)!=null?H:"#FFFFFF",borderRadius:t==null?void 0:t.borderRadius},children:_jsxruntime.jsxs.call(void 0, _chunkHG5ML6KXcjs.b,{children:[_jsxruntime.jsx.call(void 0, _chunkHG5ML6KXcjs.c,{index:0,hasError:a}),_jsxruntime.jsx.call(void 0, _chunkHG5ML6KXcjs.c,{index:1,hasError:a}),_jsxruntime.jsx.call(void 0, _chunkHG5ML6KXcjs.c,{index:2,hasError:a}),_jsxruntime.jsx.call(void 0, _chunkHG5ML6KXcjs.c,{index:3,hasError:a}),_jsxruntime.jsx.call(void 0, _chunkHG5ML6KXcjs.c,{index:4,hasError:a}),_jsxruntime.jsx.call(void 0, _chunkHG5ML6KXcjs.c,{index:5,hasError:a})]})})}),_jsxruntime.jsx.call(void 0, "div",{className:"text-xs leading-tight text-cm-text-secondary text-center",children:_jsxruntime.jsxs.call(void 0, "span",{style:{color:(St=t==null?void 0:t.colors)==null?void 0:St.textSecondary},children:["Can't find the email? Check spam folder.",`
|
|
2
|
+
`,"Some emails may take several minutes to arrive."]})}),_jsxruntime.jsx.call(void 0, _chunkHLGNSXEQcjs.a,{initialSeconds:60,appearance:t,countdownText:_=>`Re-send code in ${_}s`,countdownCompleteText:"Re-send code",handleOnClick:g})]})]})}var _clientsdkwindow = require('@crossmint/client-sdk-window');var _zod = require('zod');var Y=r=>{let{crossmintAuth:o}=L(),{oauthUrlMap:e,setError:t}=b(),[n,s]=_react.useState.call(void 0, !1),i=_react.useRef.call(void 0, null);return _react.useEffect.call(void 0, ()=>(i.current==null&&(i.current=new (0, _clientsdkwindow.ChildWindow)(window.opener||window.parent,"*",{incomingEvents:zo})),()=>{i.current!=null&&i.current.off("authMaterialFromPopupCallback")}),[]),{createPopupAndSetupListeners:m=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){if(i.current==null)throw new Error("Child window not initialized");s(!0),t(null);let a=new URL(e[r]);if(m!=null){let g=Array.from(a.searchParams.entries());a.search="",m&&a.searchParams.append("provider_login_hint",m),g.forEach(([d,x])=>{a.searchParams.append(d,x)})}let y=yield _clientsdkwindow.PopupWindow.init(a.toString(),{awaitToLoad:!1,crossOrigin:!0,width:400,height:700}),l=g=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){var d;yield o==null?void 0:o.handleRefreshAuthMaterial(g.oneTimeSecret),(d=i.current)==null||d.off("authMaterialFromPopupCallback"),y.window.close(),s(!1)}),c=g=>{var d;t(g.error),(d=i.current)==null||d.off("errorFromPopupCallback"),y.window.close(),s(!1)};i.current.on("authMaterialFromPopupCallback",l),i.current.on("errorFromPopupCallback",c);let w=setInterval(()=>{var g,d;(g=y.window)!=null&&g.closed&&(clearInterval(w),s(!1),(d=i.current)==null||d.off("authMaterialFromPopupCallback"))},2500)}),isLoading:n}},zo={authMaterialFromPopupCallback:_zod.z.object({oneTimeSecret:_zod.z.string()}),errorFromPopupCallback:_zod.z.object({error:_zod.z.string()})};function lo({emailInput:r,appearance:o}){var n,s,i,u;let{createPopupAndSetupListeners:e,isLoading:t}=Y("google");return _jsxruntime.jsxs.call(void 0, "button",{type:"button",className:_chunkWABJHG6Bcjs.a.call(void 0, "flex items-center gap-2 justify-center h-[32px] px-2.5 border border-cm-border rounded-xl bg-cm-background-primary","hover:bg-cm-hover focus:bg-cm-hover outline-none",t?"cursor-not-allowed hover:bg-cm-muted-primary":""),onClick:t?void 0:()=>e(r.trim().toLowerCase()),style:{backgroundColor:(n=o==null?void 0:o.colors)==null?void 0:n.buttonBackground,borderRadius:o==null?void 0:o.borderRadius},children:[_jsxruntime.jsx.call(void 0, _chunkE65EGG73cjs.a,{className:"max-h-[18px] max-w-[18px] h-[18px] w-[18px]"}),t?_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(s=o==null?void 0:o.colors)==null?void 0:s.textSecondary,fill:(i=o==null?void 0:o.colors)==null?void 0:i.textPrimary,width:"18px",height:"18px"}}):_jsxruntime.jsx.call(void 0, "span",{className:"text-cm-accent",style:{color:(u=o==null?void 0:o.colors)==null?void 0:u.accent},children:"Continue"})]})}function so({setOtpEmailData:r}){var g,d,x,p,C,h,P,E,W,S,N,I,T,j;let{crossmintAuth:o}=L(),{appearance:e,defaultEmail:t,setStep:n,setError:s}=b(),[i,u]=_react.useState.call(void 0, t!=null?t:""),[m,a]=_react.useState.call(void 0, ""),[y,l]=_react.useState.call(void 0, !1),c=i.toLowerCase().includes("@gmail.com")&&!i.toLowerCase().includes("+")&&_commonsdkauth.isEmailValid.call(void 0, i)&&!y;function w(k){return _chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){k.preventDefault(),l(!0);try{let M=i.trim().toLowerCase(),V=yield o==null?void 0:o.sendEmailOtp(M);r({email:M,emailId:V.emailId}),n("otp")}catch(M){l(!1),s("Failed to send email. Please try again or contact support.")}})}return _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-start justify-start w-full rounded-lg",children:_jsxruntime.jsxs.call(void 0, "div",{className:"w-full",children:[_jsxruntime.jsx.call(void 0, "label",{className:"text-cm-text-primary block mb-[5px]",style:{color:(g=e==null?void 0:e.colors)==null?void 0:g.textPrimary},children:"Email"}),_jsxruntime.jsxs.call(void 0, "form",{role:"form",className:"relative",onSubmit:k=>{if(c){k.preventDefault();return}_commonsdkauth.isEmailValid.call(void 0, i)?w(k):k.preventDefault()},noValidate:!0,children:[_jsxruntime.jsx.call(void 0, "label",{htmlFor:"emailInput",className:"sr-only",children:"Email"}),_jsxruntime.jsx.call(void 0, "input",{className:_chunkWABJHG6Bcjs.a.call(void 0, "flex-grow text-cm-text-primary text-left pl-[16px] h-[58px] w-full border border-cm-border rounded-xl bg-cm-background-primary placeholder:text-md","transition-none duration-200 ease-in-out","focus:outline-none focus-ring-custom","placeholder:[color:var(--placeholder-color)]",m?"border-red-500":"",c?"pr-[132px]":"pr-[80px]"),style:{color:(d=e==null?void 0:e.colors)==null?void 0:d.textPrimary,borderRadius:e==null?void 0:e.borderRadius,borderColor:m?(x=e==null?void 0:e.colors)==null?void 0:x.danger:(p=e==null?void 0:e.colors)==null?void 0:p.border,backgroundColor:(C=e==null?void 0:e.colors)==null?void 0:C.inputBackground,"--placeholder-color":(P=(h=e==null?void 0:e.colors)==null?void 0:h.textSecondary)!=null?P:"#67797F","--focus-ring-color":new (0, _color2.default)((W=(E=e==null?void 0:e.colors)==null?void 0:E.accent)!=null?W:"#04AA6D").alpha(.18).toString()},type:"email",placeholder:"your@email.com",value:i,onChange:k=>{u(k.target.value),a(""),s(null)},readOnly:y,"aria-describedby":"emailError"}),_jsxruntime.jsxs.call(void 0, "div",{className:"absolute inset-y-0 right-0 flex items-center pr-4",children:[m&&_jsxruntime.jsx.call(void 0, _chunkNRN4WNQLcjs.a,{customColor:(S=e==null?void 0:e.colors)==null?void 0:S.danger}),y&&_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(N=e==null?void 0:e.colors)==null?void 0:N.textSecondary,fill:(I=e==null?void 0:e.colors)==null?void 0:I.textPrimary}}),c?_jsxruntime.jsx.call(void 0, lo,{emailInput:i,appearance:e}):!m&&!y?_jsxruntime.jsx.call(void 0, "button",{type:"submit",className:_chunkWABJHG6Bcjs.a.call(void 0, "font-medium text-cm-accent text-nowrap bg-cm-background-primary",_commonsdkauth.isEmailValid.call(void 0, i)?"cursor-pointer":"!cursor-not-allowed opacity-60"),style:{color:(T=e==null?void 0:e.colors)==null?void 0:T.accent,backgroundColor:(j=e==null?void 0:e.colors)==null?void 0:j.inputBackground},disabled:!_commonsdkauth.isEmailValid.call(void 0, i)||y,children:"Submit"}):null]})]}),m&&_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-red-500 mb-2 pt-2",children:m})]})})})}function mo(){let{step:r}=b(),[o,e]=_react.useState.call(void 0, null);return r==="otp"?_jsxruntime.jsx.call(void 0, io,{otpEmailData:o,setOtpEmailData:e}):r==="initial"?_jsxruntime.jsx.call(void 0, so,{setOtpEmailData:e}):null}function uo({appearance:r,text:o}){var t,n,s;let{step:e}=b();return e!=="initial"?null:_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-center justify-center w-full pt-2 pb-3",children:[_jsxruntime.jsx.call(void 0, "span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(t=r==null?void 0:r.colors)==null?void 0:t.border}}),o!=null?_jsxruntime.jsx.call(void 0, "p",{className:"flex-none px-2 text-sm text-cm-text-primary",style:{color:(n=r==null?void 0:r.colors)==null?void 0:n.textSecondary},children:o}):null,_jsxruntime.jsx.call(void 0, "span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(s=r==null?void 0:r.colors)==null?void 0:s.border}})]})}function fo(o){var r=_chunk2WSEHVNPcjs.c.call(void 0, o,[]);var m,a,y,l;let{step:e,appearance:t,isLoadingOauthUrlMap:n}=b(),{createPopupAndSetupListeners:s,isLoading:i}=Y("google"),u=n||i;return e!=="initial"?null:_jsxruntime.jsxs.call(void 0, "button",_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",u?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(m=t==null?void 0:t.colors)==null?void 0:m.buttonBackground},onClick:u?void 0:()=>s()},r),{children:[_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkE65EGG73cjs.a,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),u?_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(a=t==null?void 0:t.colors)==null?void 0:a.textSecondary,fill:(y=t==null?void 0:t.colors)==null?void 0:y.textPrimary}}):_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(l=t==null?void 0:t.colors)==null?void 0:l.textPrimary},children:"Sign in with Google"})]}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Sign in with Google"})]}))}var _authkit = require('@farcaster/auth-kit');function go(){var n,s;let{step:r,appearance:o,setStep:e,setError:t}=b();return r==="initial"?_jsxruntime.jsx.call(void 0, "div",{children:_jsxruntime.jsxs.call(void 0, "button",{className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:o==null?void 0:o.borderRadius,backgroundColor:(n=o==null?void 0:o.colors)==null?void 0:n.buttonBackground},onClick:()=>{e("qrCode"),t(null)},children:[_jsxruntime.jsx.call(void 0, _chunkSRQAQHYKcjs.a,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(s=o==null?void 0:o.colors)==null?void 0:s.textPrimary},children:"Sign in with Farcaster"}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Sign in with Farcaster"})]})}):r==="qrCode"?_jsxruntime.jsx.call(void 0, oe,{}):null}function oe(){var g,d,x,p,C,h,P,E,W;let{crossmintAuth:r}=L(),{appearance:o,setStep:e,setDialogOpen:t,setError:n}=b(),[s,i]=_react.useState.call(void 0, null),u=_react.useMemo.call(void 0, ()=>({onSuccess:S=>{i(S)}}),[]),{signIn:m,url:a,connect:y,signOut:l,isConnected:c}=_authkit.useSignIn.call(void 0, u),w=S=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){n(null);try{let N=yield r==null?void 0:r.signInWithFarcaster(S);yield r==null?void 0:r.handleRefreshAuthMaterial(N),t(!1),e("initial")}catch(N){console.error("Error during Farcaster sign-in:",N),n("Failed to sign in with Farcaster")}});return _react.useEffect.call(void 0, ()=>{s!=null&&w(s)},[s]),_react.useEffect.call(void 0, ()=>{c&&m()},[c]),_react.useEffect.call(void 0, ()=>{y()},[]),_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, Q,{onClick:()=>{l(),e("initial")},iconColor:(g=o==null?void 0:o.colors)==null?void 0:g.textPrimary,ringColor:(d=o==null?void 0:o.colors)==null?void 0:d.accent}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-center gap-4",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"text-center",children:[_jsxruntime.jsx.call(void 0, "h3",{className:"text-lg font-semibold text-cm-text-primary mb-2",style:{color:(x=o==null?void 0:o.colors)==null?void 0:x.textPrimary},children:"Sign in with Farcaster"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-base font-normal text-cm-text-secondary",style:{color:(p=o==null?void 0:o.colors)==null?void 0:p.textSecondary},children:"Scan with your phone's camera to continue."})]}),_jsxruntime.jsx.call(void 0, "div",{className:"bg-white aspect-square rounded-lg p-4",style:{backgroundColor:(C=o==null?void 0:o.colors)==null?void 0:C.inputBackground,borderRadius:o==null?void 0:o.borderRadius},children:a!=null?_jsxruntime.jsx.call(void 0, _authkit.QRCode,{uri:a,size:280}):_jsxruntime.jsx.call(void 0, "div",{className:"min-h-[246px] flex items-center justify-center",children:_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(h=o==null?void 0:o.colors)==null?void 0:h.textSecondary,fill:(P=o==null?void 0:o.colors)==null?void 0:P.textPrimary}})})}),a?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "p",{className:"text-base text-center font-normal text-cm-text-secondary",style:{color:(E=o==null?void 0:o.colors)==null?void 0:E.textSecondary},children:"Alternatively, click on this link to open Warpcast."}),_jsxruntime.jsx.call(void 0, "a",{href:a,rel:"noopener noreferrer",target:"_blank",className:"text-base font-normal text-cm-link",style:{color:(W=o==null?void 0:o.colors)==null?void 0:W.textLink},children:"Open Warpcast"})]}):null]})]})}function ho(o){var r=_chunk2WSEHVNPcjs.c.call(void 0, o,[]);var m,a,y,l;let{step:e,appearance:t,isLoadingOauthUrlMap:n}=b(),{createPopupAndSetupListeners:s,isLoading:i}=Y("twitter"),u=n||i;return e!=="initial"?null:_jsxruntime.jsxs.call(void 0, "button",_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",u?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(m=t==null?void 0:t.colors)==null?void 0:m.buttonBackground},onClick:u?void 0:()=>s()},r),{children:[_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunkZBQCXWMDcjs.a,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),u?_jsxruntime.jsx.call(void 0, _chunkZ2FGFHRQcjs.a,{style:{color:(a=t==null?void 0:t.colors)==null?void 0:a.textSecondary,fill:(y=t==null?void 0:t.colors)==null?void 0:y.textPrimary}}):_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(l=t==null?void 0:t.colors)==null?void 0:l.textPrimary},children:"Sign in with X"})]}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Sign in with X"})]}))}function xo(){var n,s,i,u,m;let{step:r,appearance:o,setStep:e,setError:t}=b();return r!=="initial"?null:_jsxruntime.jsxs.call(void 0, "button",{className:_chunkWABJHG6Bcjs.a.call(void 0, "relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:o==null?void 0:o.borderRadius,borderColor:(n=o==null?void 0:o.colors)==null?void 0:n.border,backgroundColor:(s=o==null?void 0:o.colors)==null?void 0:s.buttonBackground},onClick:()=>{e("web3"),t(null)},children:[_jsxruntime.jsx.call(void 0, _chunkTXOVDTYKcjs.a,{className:"h-[21px] w-[21px] absolute left-[20px]",style:{color:(i=o==null?void 0:o.colors)==null?void 0:i.textPrimary}}),_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",style:{margin:"0px 32px",color:(u=o==null?void 0:o.colors)==null?void 0:u.textPrimary},children:"Continue with a wallet"}),_jsxruntime.jsx.call(void 0, _chunkYXF74MVIcjs.a,{className:"h-[21px] w-[21px] absolute right-[20px]",style:{color:(m=o==null?void 0:o.colors)==null?void 0:m.textSecondary}}),_jsxruntime.jsx.call(void 0, "span",{className:"sr-only",children:"Continue with a wallet"})]})}var _sdkreactcore = require('@dynamic-labs/sdk-react-core');function po(){var t,n;let{appearance:r,step:o,setStep:e}=b();return o==="web3"?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, Q,{onClick:()=>e("initial"),iconColor:(t=r==null?void 0:r.colors)==null?void 0:t.textPrimary,ringColor:(n=r==null?void 0:r.colors)==null?void 0:n.accent}),_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col items-center",children:_jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-[10px] w-full",children:_jsxruntime.jsx.call(void 0, "div",{className:"widget-container",children:_jsxruntime.jsx.call(void 0, _sdkreactcore.DynamicEmbeddedWidget,{background:"none"})})})})]}):null}function wo(){let{step:r}=b();return r.startsWith("web3")?_jsxruntime.jsx.call(void 0, po,{}):r==="initial"?_jsxruntime.jsx.call(void 0, xo,{}):null}function vo({className:r}){var m,a,y,l,c,w,g,d,x,p,C,h,P;let{step:o,appearance:e,loginMethods:t,baseUrl:n,error:s,termsOfServiceText:i,authModalTitle:u}=b();return _jsxruntime.jsxs.call(void 0, "div",{className:_chunkWABJHG6Bcjs.a.call(void 0, "relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",r),children:[s!=null?_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start justify-start w-full rounded-lg p-2 mt-4 bg-cm-danger-muted",style:{backgroundColor:new (0, _color2.default)((a=(m=e==null?void 0:e.colors)==null?void 0:m.danger)!=null?a:"#f44336").alpha(.12).toString()},children:[_jsxruntime.jsx.call(void 0, "div",{className:"min-w-[20px]",children:_jsxruntime.jsx.call(void 0, _chunkNRN4WNQLcjs.a,{customColor:(l=(y=e==null?void 0:e.colors)==null?void 0:y.danger)!=null?l:"#f44336"})}),_jsxruntime.jsx.call(void 0, "p",{className:"ml-2 text-sm",style:{color:(w=(c=e==null?void 0:e.colors)==null?void 0:c.danger)!=null?w:"#f44336"},children:s})]}):null,o==="initial"?_jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, "h1",{className:"text-2xl font-bold text-cm-text-primary",style:{color:(g=e==null?void 0:e.colors)==null?void 0:g.textPrimary},children:u!=null?u:"Sign in to Crossmint"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-base font-normal mb-3 text-cm-text-secondary",style:{color:(d=e==null?void 0:e.colors)==null?void 0:d.textSecondary},children:"Access using one of the options below."})]}):null,t.includes("google")?_jsxruntime.jsx.call(void 0, fo,{}):null,t.includes("farcaster")?_jsxruntime.jsx.call(void 0, _chunkBR77Q3PKcjs.a,{baseUrl:n,children:_jsxruntime.jsx.call(void 0, go,{})}):null,t.includes("twitter")?_jsxruntime.jsx.call(void 0, ho,{}):null,t.some(E=>E.startsWith("web3"))?_jsxruntime.jsx.call(void 0, wo,{}):null,t.includes("email")?_jsxruntime.jsxs.call(void 0, "div",{children:[t.length>1?_jsxruntime.jsx.call(void 0, uo,{appearance:e,text:"OR"}):null,_jsxruntime.jsx.call(void 0, mo,{})]}):null,o==="initial"&&i!=null?_jsxruntime.jsxs.call(void 0, "div",{className:"text-sm text-center text-cm-text-secondary mt-2",style:{color:(x=e==null?void 0:e.colors)==null?void 0:x.textSecondary},children:[_jsxruntime.jsx.call(void 0, "style",{children:`
|
|
3
3
|
p a {
|
|
4
4
|
color: ${(C=(p=e==null?void 0:e.colors)==null?void 0:p.textLink)!=null?C:"#1A74E9"};
|
|
5
5
|
}
|
|
6
|
-
`}),i]}):null,o==="initial"||o==="otp"?_jsxruntime.jsx.call(void 0, _chunk2BOQSASOcjs.a,{className:"mt-1.5 md:mt-4 justify-center",color:(P=(h=e==null?void 0:e.colors)==null?void 0:h.textSecondary)!=null?P:"#67797F"}):null]})}function
|
|
6
|
+
`}),i]}):null,o==="initial"||o==="otp"?_jsxruntime.jsx.call(void 0, _chunk2BOQSASOcjs.a,{className:"mt-1.5 md:mt-4 justify-center",color:(P=(h=e==null?void 0:e.colors)==null?void 0:h.textSecondary)!=null?P:"#67797F"}):null]})}function pt({open:r}){var t,n,s;let{appearance:o,setDialogOpen:e}=b();return _react.useEffect.call(void 0, ()=>{document.body.style.overflow=r?"hidden":""},[r]),_jsxruntime.jsx.call(void 0, _chunkWMBBIP2Ccjs.a,{modal:!1,open:r,onOpenChange:e,children:_jsxruntime.jsxs.call(void 0, _chunkWMBBIP2Ccjs.e,{onInteractOutside:i=>i.preventDefault(),onOpenAutoFocus:i=>i.preventDefault(),closeButtonColor:(t=o==null?void 0:o.colors)==null?void 0:t.textPrimary,closeButtonRingColor:(n=o==null?void 0:o.colors)==null?void 0:n.accent,className:"!p-0 !min-[480px]:p-0",style:{borderRadius:o==null?void 0:o.borderRadius,backgroundColor:(s=o==null?void 0:o.colors)==null?void 0:s.background},children:[_jsxruntime.jsx.call(void 0, _reactvisuallyhidden.VisuallyHidden,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _chunkWMBBIP2Ccjs.h,{children:"Crossmint Auth"})}),_jsxruntime.jsx.call(void 0, _reactvisuallyhidden.VisuallyHidden,{asChild:!0,children:_jsxruntime.jsx.call(void 0, _chunkWMBBIP2Ccjs.i,{children:"Sign in via Crossmint"})}),_jsxruntime.jsx.call(void 0, vo,{className:"max-w-[448px]"})]})})}var _walletssdk = require('@crossmint/wallets-sdk');var _clientsdkreactbase = require('@crossmint/client-sdk-react-base');var _ethereum = require('@dynamic-labs/ethereum');var _solana = require('@dynamic-labs/solana');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var Wo=_react.createContext.call(void 0, null);function ko(){let r=_react.useContext.call(void 0, Wo);return r||{isDynamicWalletConnected:!1,isDynamicProviderAvailable:!1,hasDynamicSdkLoaded:!0,getAdminSigner:()=>{throw new Error("useDynamicWallet must be used within DynamicWalletProvider")},initialize:()=>{},cleanup:()=>{}}}function xe({children:r,enabled:o,onSdkLoaded:e}){let[t,n]=_react.useState.call(void 0, ),[s,i]=_react.useState.call(void 0, ),[u,m]=_react.useState.call(void 0, !1),{primaryWallet:a,sdkHasLoaded:y,removeWallet:l,handleUnlinkWallet:c}=_sdkreactcore.useDynamicContext.call(void 0, ),w=!!a,g=!o||y,d=_react.useCallback.call(void 0, (h,P)=>{n(h),i(()=>P),m(!0)},[]),x=_react.useCallback.call(void 0, ()=>{t==null&&a&&(l(a.id),c(a.id))},[t,a,l,c]);_react.useEffect.call(void 0, ()=>{o&&(s==null||s(g),e==null||e(g))},[g,o,s,e]),_react.useEffect.call(void 0, ()=>{t==null&&u&&x()},[t,x,u]);let p=_react.useCallback.call(void 0, ()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){if(a==null)throw new Error("No connected wallet");try{if(_ethereum.isEthereumWallet.call(void 0, a)){let h=yield a.getWalletClient();return{type:"external-wallet",address:h.account.address,viemAccount:_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {},h.account),{signMessage:P=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){return yield h.signMessage({message:P.message})})})}}if(_solana.isSolanaWallet.call(void 0, a)){let h=yield a.getSigner();return{type:"external-wallet",address:a.address,onSignTransaction:P=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){return yield h.signTransaction(P)})}}throw new Error("Unsupported wallet type")}catch(h){throw console.error("Failed to get admin signer",h),new Error("Failed to get admin signer")}}),[a]),C=_react.useMemo.call(void 0, ()=>({isDynamicWalletConnected:w,isDynamicProviderAvailable:!0,hasDynamicSdkLoaded:g,getAdminSigner:p,initialize:d,cleanup:x}),[w,g,p,d,x]);return _jsxruntime.jsx.call(void 0, Wo.Provider,{value:C,children:r})}function Eo({children:r,enabled:o=!0,apiKeyEnvironment:e,loginMethods:t=["web3"],appearance:n,onSdkLoaded:s}){var a,y;let{crossmintAuth:i}=L(),u=_react.useMemo.call(void 0, ()=>{var l,c;return`.powered-by-dynamic { display: none !important; }
|
|
7
7
|
.wallet-list__scroll-container { padding: 0px !important; }
|
|
8
8
|
.wallet-list__search-container { padding-left: 0px !important; padding-right: 0px !important; }
|
|
9
9
|
.dynamic-footer { display: none !important; }
|
|
10
10
|
h1 { color: ${(l=n==null?void 0:n.colors)==null?void 0:l.textPrimary} !important; }
|
|
11
|
-
* { color: ${(c=n==null?void 0:n.colors)==null?void 0:c.textSecondary} !important; }`},[(a=n==null?void 0:n.colors)==null?void 0:a.textPrimary,(y=n==null?void 0:n.colors)==null?void 0:y.textSecondary]),m=_react.useMemo.call(void 0, ()=>{if(o)return t.includes("web3:evm-only")?[_ethereum.EthereumWalletConnectors]:t.includes("web3:solana-only")?[_solana.SolanaWalletConnectors]:[_ethereum.EthereumWalletConnectors,_solana.SolanaWalletConnectors]},[o,t]);return _jsxruntime.jsx.call(void 0, _chunkAHD64NAJcjs.a,{apiKeyEnvironment:e,settings:{walletConnectors:m,cssOverrides:u,events:{onWalletRemoved(){console.log("[DynamicWalletProvider] onWalletRemoved")},onAuthFlowCancel(){console.log("[DynamicWalletProvider] onAuthFlowCancel")},onAuthFlowClose(){console.log("[DynamicWalletProvider] onAuthFlowClose")},onAuthFailure(l,c){console.error("[DynamicWalletProvider] onAuthFailure",l,c)},onAuthSuccess(l){console.log("[DynamicWalletProvider] onAuthSuccess",l)}},handlers:{handleConnectedWallet:l=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){var w;if(!i)return console.error("[DynamicWalletProvider] crossmintAuth is not available"),!1;console.log("[DynamicWalletProvider] handleConnectedWallet",l);let c=l.address;if(c==null)return console.error("[DynamicWalletProvider] handleConnectedWallet: address is missing"),!1;try{let d=(yield _chunkPZ3KXKJDcjs.b.call(void 0, l))==="solana"?"solana":"evm",x=yield i.signInWithSmartWallet(c,d);if((x==null?void 0:x.challenge)==null)throw new Error("No challenge received from signInWithSmartWallet");let p=yield(w=l.connector)==null?void 0:w.proveOwnership(c,x.challenge);if(p==null)throw new Error("Failed to get signature from wallet");let C=p;if(d==="solana"){let P=Buffer.from(p,"base64");C=_bs582.default.encode(P)}let h=yield i.authenticateSmartWallet(c,d,C);if((h==null?void 0:h.oneTimeSecret)==null)throw new Error("No oneTimeSecret received from authenticateSmartWallet");return yield i.handleRefreshAuthMaterial(h.oneTimeSecret),!0}catch(f){return console.error("[DynamicWalletProvider] Error handling wallet connection:",f),!1}})}},children:_jsxruntime.jsx.call(void 0, he,{enabled:o,onSdkLoaded:s,children:r})},`${e}-${t.join(",")}`)}var _reactdom = require('react-dom');var Pt=_react.createContext.call(void 0, null);function Ni(r){let o=_react.useContext.call(void 0, Pt);if(!o)throw new Error(`useWallet must be used within WalletProvider${r?` (${r})`:""}`);return o}function Ii({children:r,showPasskeyHelpers:o=!0,appearance:e,createOnLogin:t}){var G,$;let{crossmint:n,experimental_setAuth:s}=_chunk2F4SKIIMcjs.b.call(void 0, "CrossmintWalletProvider must be used within CrossmintProvider"),i=(G=n.user)==null?void 0:G.email,{isDynamicWalletConnected:u,isDynamicProviderAvailable:m,getAdminSigner:a,hasDynamicSdkLoaded:y}=Eo(),[l,c]=_react.useState.call(void 0, {status:"not-loaded"}),[w,f]=_react.useState.call(void 0, {open:!1}),[d,x]=_react.useState.call(void 0, !1),[p,C]=_react.useState.call(void 0, "initial"),h=_react.useRef.call(void 0, !1),P=_react.useRef.call(void 0, _clientsdkreactbase.throwNotAvailable.call(void 0, "sendEmailWithOtp")),k=_react.useRef.call(void 0, _clientsdkreactbase.throwNotAvailable.call(void 0, "verifyOtp")),W=_react.useRef.call(void 0, _clientsdkreactbase.throwNotAvailable.call(void 0, "reject")),S=_react.useCallback.call(void 0, g=>()=>new Promise(F=>{if(!o){F();return}f({type:g,open:!0,primaryActionOnClick:()=>{f({open:!1}),F()},secondaryActionOnClick:()=>{f({open:!1}),F()}})}),[o]),N=()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){try{yield P.current(),C("otp")}catch(g){console.error("Failed to send email OTP",g),W.current(new Error("Failed to send email OTP"))}}),I=g=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){try{yield k.current(g),x(!1),C("initial")}catch(F){console.error("Failed to verify OTP",F),W.current(new Error("Failed to verify OTP"))}}),T=_react.useCallback.call(void 0, g=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){var F;if(l.status==="in-progress")return{startedCreation:!1};if(!n.jwt)return{startedCreation:!1};try{c({status:"in-progress"}),((F=g==null?void 0:g.signer)==null?void 0:F.type)==="email"&&(g.signer.onAuthRequired=(B,Z,tt,Uo)=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){h.current=B,P.current=Z,k.current=tt,W.current=Uo,B&&(x(!0),C("initial"))}));let mt=yield _walletssdk.CrossmintWallets.from(n).getOrCreateWallet(_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {},g),{options:_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {},g.options),{experimental_callbacks:{onWalletCreationStart:S("create-wallet"),onTransactionStart:S("transaction")}})}));return c({status:"loaded",wallet:mt}),{startedCreation:!0}}catch(K){return console.error("Failed to create wallet:",K),c({status:"error",error:K instanceof Error?K:new Error(String(K))}),{startedCreation:!1}}}),[n,l.status,S]),j=_react.useCallback.call(void 0, ()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){return yield _chunkFASRTACDcjs.a.call(void 0, n.apiKey)}),[n.apiKey]),E=_react.useCallback.call(void 0, ()=>{c({status:"not-loaded"})},[]);_react.useEffect.call(void 0, ()=>{var g;(((g=n.user)==null?void 0:g.jwt)!=null||n.jwt!=null)&&E()},[($=n.user)==null?void 0:$.jwt,n.jwt,E]),_react.useEffect.call(void 0, ()=>{function g(){return _chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){if(!(l.status!=="not-loaded"||n.jwt==null||m&&!y||(t==null?void 0:t.chain)==null))try{let F=m&&u?yield a():t.signer;yield T({chain:t.chain,signer:F,owner:t.owner,options:{experimental_callbacks:{onWalletCreationStart:S("create-wallet"),onTransactionStart:S("transaction")}}})}catch(F){console.error("Failed to create wallet:",F),s(void 0)}})}t!=null&&g()},[l.status,n.jwt,y,u,a,T,S,t==null?void 0:t.chain,t==null?void 0:t.signer,t==null?void 0:t.owner]),_react.useEffect.call(void 0, ()=>{n.jwt==null&&l.status!=="not-loaded"&&E()},[n.jwt,l.status,E]);let M=_react.useMemo.call(void 0, ()=>({walletState:l,setWalletState:c,showPasskeyHelpers:o,appearance:e,createPasskeyPrompt:S,getOrCreateWallet:T,createPasskeySigner:j,clearWallet:E}),[l,o,e,S,T,j,E]);return _jsxruntime.jsx.call(void 0, _chunkJNLQRLICcjs.a,{children:_jsxruntime.jsxs.call(void 0, Pt.Provider,{value:M,children:[r,d&&i!=null?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, _chunkHUFKDHMJcjs.a,{rejectRef:W,email:i,open:d,setOpen:x,step:p,onSubmitOTP:I,onResendOTPCode:N,onSubmitEmail:N,appearance:e}),document.body):null,w.open?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, _chunk6WZW6KZ3cjs.a,{state:w,appearance:e}),document.body):null]})})}function Li(){let r=_react.useContext.call(void 0, Pt);if(!r)throw new Error("useWallet must be used within CrossmintAuthProvider or CrossmintWalletProvider");let{walletState:o,getOrCreateWallet:e,createPasskeySigner:t,clearWallet:n}=r;return{wallet:o.status==="loaded"?o.wallet:void 0,status:o.status,getOrCreateWallet:e,createPasskeySigner:t,clearWallet:n}}function qi(){let r=_react.useContext.call(void 0, it);if(r===void 0)throw new Error("useAuth must be used within an AuthProvider");return r}var Oe={crossmintAuth:void 0,login:()=>{},logout:()=>{},jwt:void 0,user:void 0,status:"initializing",getUser:()=>{}},it= exports.s =_react.createContext.call(void 0, Oe);function dl({children:r,appearance:o,termsOfServiceText:e,prefetchOAuthUrls:t=!0,authModalTitle:n,onLoginSuccess:s,loginMethods:i=["email","google"],refreshRoute:u,logoutRoute:m}){let[a,y]=_react.useState.call(void 0, void 0),{crossmint:l,setJwt:c,experimental_setAuth:w}=_chunk2F4SKIIMcjs.b.call(void 0, "CrossmintAuthProvider must be used within CrossmintProvider"),f=_react.useRef.call(void 0, null),d=_react.useMemo.call(void 0, ()=>(f.current||(f.current=_clientsdkauth.CrossmintAuth.from(l,{callbacks:{onLogout:()=>{y(void 0),w(void 0)},onTokenRefresh:g=>{y(g.user),w({email:g.user.email,jwt:g.jwt})}},refreshRoute:u,logoutRoute:m})),f.current),[]),x=_commonsdkbase.validateApiKeyAndGetCrossmintBaseUrl.call(void 0, l.apiKey),[p,C]=_react.useState.call(void 0, !1),[h,P]=_react.useState.call(void 0, !1),[k,W]=_react.useState.call(void 0, void 0),[S,N]=_react.useState.call(void 0, !0),I=i.some(g=>g.startsWith("web3")),T=_react.useCallback.call(void 0, ()=>{s==null||s()},[s]);_react.useEffect.call(void 0, ()=>{if(l.jwt==null){let g=_clientsdkauth.getCookie.call(void 0, _commonsdkauth.SESSION_PREFIX);c(g)}P(!0)},[l.jwt,c]),_react.useEffect.call(void 0, ()=>{l.jwt!=null&&p&&(C(!1),T())},[l.jwt,p,T]);let j=_react.useCallback.call(void 0, g=>{if(l.jwt!=null){console.log("User already logged in");return}g!=null&&typeof g=="string"&&W(g),C(!0)},[l.jwt]),E=_react.useCallback.call(void 0, ()=>{console.log("Logging out"),d.logout()},[d]),M=_react.useCallback.call(void 0, ()=>!h||I&&!S?"initializing":l.jwt!=null?"logged-in":p?"in-progress":"logged-out",[h,I,S,l.jwt,p]),G=_react.useCallback.call(void 0, ()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){if(l.jwt==null){console.log("User not logged in");return}let g=yield d.getUser();return y(g),w(g),g}),[l.jwt,d,w]),$=_react.useMemo.call(void 0, ()=>({crossmintAuth:d,login:j,logout:E,jwt:l.jwt,user:a,status:M(),getUser:G}),[d,j,E,l.jwt,a,M,G]);return _jsxruntime.jsx.call(void 0, _chunkJNLQRLICcjs.a,{children:_jsxruntime.jsx.call(void 0, it.Provider,{value:$,children:_jsxruntime.jsx.call(void 0, To,{setDialogOpen:(g,F)=>{C(g),F&&T()},preFetchOAuthUrls:M()==="logged-out"&&t,initialState:{appearance:o,loginMethods:i,termsOfServiceText:e,authModalTitle:n,baseUrl:x,defaultEmail:k},children:I?_jsxruntime.jsxs.call(void 0, ko,{apiKeyEnvironment:l.apiKey.includes("production")?"production":"staging",loginMethods:i,appearance:o,onSdkLoaded:N,children:[r,_jsxruntime.jsx.call(void 0, bt,{open:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r,_jsxruntime.jsx.call(void 0, bt,{open:p})]})})})})}function L(){let r=_react.useContext.call(void 0, it);if(!r)throw new Error("useCrossmintAuth must be used within a CrossmintAuthProvider");return r}var Do={google:"",twitter:""},Ro=_react.createContext.call(void 0, void 0),b= exports.a =()=>{let r=_react.useContext.call(void 0, Ro);if(!r)throw new Error("useAuthForm must be used within an AuthFormProvider");return r},To= exports.b =({setDialogOpen:r,preFetchOAuthUrls:o,initialState:e,children:t})=>{let{crossmintAuth:n}=L(),[s,i]=_react.useState.call(void 0, "initial"),[u,m]=_react.useState.call(void 0, null),[a,y]=_react.useState.call(void 0, Do),[l,c]=_react.useState.call(void 0, !0),{loginMethods:w,baseUrl:f,appearance:d,termsOfServiceText:x,authModalTitle:p,defaultEmail:C}=e,h=_react.useCallback.call(void 0, ()=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){c(!0);try{let S=w.filter(I=>I in Do).map(I=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){let T=yield n==null?void 0:n.getOAuthUrl(I);return{[I]:T}})),N=Object.assign({},...yield Promise.all(S));y(N)}catch(W){m(W instanceof _commonsdkauth.CrossmintAuthenticationError?W.message:"Unable to load oauth providers. Please try again later.")}finally{c(!1)}}),[w,n]);_react.useEffect.call(void 0, ()=>{o&&h()},[h,o]);let k={step:s,error:u,baseUrl:f,appearance:d,termsOfServiceText:x,authModalTitle:p,loginMethods:w,defaultEmail:C,oauthUrlMap:a,isLoadingOauthUrlMap:l,setDialogOpen:(W,S)=>{r==null||r(W,S),W||setTimeout(()=>i("initial"),250)},setError:m,setStep:i};return _jsxruntime.jsx.call(void 0, Ro.Provider,{value:k,children:t})};exports.a = b; exports.b = To; exports.c = X; exports.d = Mo; exports.e = io; exports.f = Q; exports.g = lo; exports.h = so; exports.i = mo; exports.j = uo; exports.k = fo; exports.l = go; exports.m = ho; exports.n = xo; exports.o = po; exports.p = wo; exports.q = vo; exports.r = bt; exports.s = it; exports.t = dl; exports.u = L; exports.v = Eo; exports.w = ko; exports.x = Pt; exports.y = Ni; exports.z = Ii; exports.A = Li; exports.B = qi;
|
|
11
|
+
* { color: ${(c=n==null?void 0:n.colors)==null?void 0:c.textSecondary} !important; }`},[(a=n==null?void 0:n.colors)==null?void 0:a.textPrimary,(y=n==null?void 0:n.colors)==null?void 0:y.textSecondary]),m=_react.useMemo.call(void 0, ()=>{if(o)return t.includes("web3:evm-only")?[_ethereum.EthereumWalletConnectors]:t.includes("web3:solana-only")?[_solana.SolanaWalletConnectors]:[_ethereum.EthereumWalletConnectors,_solana.SolanaWalletConnectors]},[o,t]);return _jsxruntime.jsx.call(void 0, _chunkAHD64NAJcjs.a,{apiKeyEnvironment:e,settings:{walletConnectors:m,cssOverrides:u,events:{onWalletRemoved(){console.log("[DynamicWalletProvider] onWalletRemoved")},onAuthFlowCancel(){console.log("[DynamicWalletProvider] onAuthFlowCancel")},onAuthFlowClose(){console.log("[DynamicWalletProvider] onAuthFlowClose")},onAuthFailure(l,c){console.error("[DynamicWalletProvider] onAuthFailure",l,c)},onAuthSuccess(l){console.log("[DynamicWalletProvider] onAuthSuccess",l)}},handlers:{handleConnectedWallet:l=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){var w;if(!i)return console.error("[DynamicWalletProvider] crossmintAuth is not available"),!1;console.log("[DynamicWalletProvider] handleConnectedWallet",l);let c=l.address;if(c==null)return console.error("[DynamicWalletProvider] handleConnectedWallet: address is missing"),!1;try{let d=(yield _chunkPZ3KXKJDcjs.b.call(void 0, l))==="solana"?"solana":"evm",x=yield i.signInWithSmartWallet(c,d);if((x==null?void 0:x.challenge)==null)throw new Error("No challenge received from signInWithSmartWallet");let p=yield(w=l.connector)==null?void 0:w.proveOwnership(c,x.challenge);if(p==null)throw new Error("Failed to get signature from wallet");let C=p;if(d==="solana"){let P=Buffer.from(p,"base64");C=_bs582.default.encode(P)}let h=yield i.authenticateSmartWallet(c,d,C);if((h==null?void 0:h.oneTimeSecret)==null)throw new Error("No oneTimeSecret received from authenticateSmartWallet");return yield i.handleRefreshAuthMaterial(h.oneTimeSecret),!0}catch(g){return console.error("[DynamicWalletProvider] Error handling wallet connection:",g),!1}})}},children:_jsxruntime.jsx.call(void 0, xe,{enabled:o,onSdkLoaded:s,children:r})},`${e}-${t.join(",")}`)}var _reactdom = require('react-dom');var Ct=_react.createContext.call(void 0, null);function Ii(r){let o=_react.useContext.call(void 0, Ct);if(!o)throw new Error(`useWallet must be used within WalletProvider${r?` (${r})`:""}`);return o}function Ti({children:r,showPasskeyHelpers:o=!0,appearance:e,createOnLogin:t}){var V,$;let{crossmint:n,experimental_setCustomAuth:s}=_chunkKARK5Z2Dcjs.b.call(void 0, "CrossmintWalletProvider must be used within CrossmintProvider"),i=(V=n.experimental_customAuth)==null?void 0:V.email,{isDynamicWalletConnected:u,isDynamicProviderAvailable:m,getAdminSigner:a,hasDynamicSdkLoaded:y}=ko(),[l,c]=_react.useState.call(void 0, {status:"not-loaded"}),[w,g]=_react.useState.call(void 0, {open:!1}),[d,x]=_react.useState.call(void 0, !1),[p,C]=_react.useState.call(void 0, "initial"),h=_react.useRef.call(void 0, !1),P=_react.useRef.call(void 0, _clientsdkreactbase.throwNotAvailable.call(void 0, "sendEmailWithOtp")),E=_react.useRef.call(void 0, _clientsdkreactbase.throwNotAvailable.call(void 0, "verifyOtp")),W=_react.useRef.call(void 0, _clientsdkreactbase.throwNotAvailable.call(void 0, "reject")),S=_react.useCallback.call(void 0, f=>()=>new Promise(F=>{if(!o){F();return}g({type:f,open:!0,primaryActionOnClick:()=>{g({open:!1}),F()},secondaryActionOnClick:()=>{g({open:!1}),F()}})}),[o]),N=()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){try{yield P.current(),C("otp")}catch(f){console.error("Failed to send email OTP",f),W.current(new Error("Failed to send email OTP"))}}),I=f=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){try{yield E.current(f),x(!1),C("initial")}catch(F){console.error("Failed to verify OTP",F),W.current(new Error("Failed to verify OTP"))}}),T=_react.useCallback.call(void 0, f=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){var F;if(l.status==="in-progress")return{startedCreation:!1};if(n.jwt==null)return{startedCreation:!1};try{c({status:"in-progress"}),((F=f==null?void 0:f.signer)==null?void 0:F.type)==="email"&&(f.signer.onAuthRequired=(J,tt,Uo,Mo)=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){h.current=J,P.current=tt,E.current=Uo,W.current=Mo,J&&(x(!0),C("initial"))}));let H=f.signer.type==="passkey"&&o,_=yield _walletssdk.CrossmintWallets.from(n).getOrCreateWallet(_chunk2WSEHVNPcjs.b.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {},f),{options:_chunk2WSEHVNPcjs.a.call(void 0, _chunk2WSEHVNPcjs.a.call(void 0, {},f.options),H&&{experimental_callbacks:{onWalletCreationStart:S("create-wallet"),onTransactionStart:S("transaction")}})}));return c({status:"loaded",wallet:_}),{startedCreation:!0}}catch(H){return console.error("Failed to create wallet:",H),c({status:"error",error:H instanceof Error?H:new Error(String(H))}),{startedCreation:!1}}}),[n,l.status,S]),j=_react.useCallback.call(void 0, ()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){return yield _chunkFASRTACDcjs.a.call(void 0, n.apiKey)}),[n.apiKey]),k=_react.useCallback.call(void 0, ()=>{c({status:"not-loaded"})},[]);_react.useEffect.call(void 0, ()=>{var f;(((f=n.experimental_customAuth)==null?void 0:f.jwt)!=null||n.jwt!=null)&&k()},[($=n.experimental_customAuth)==null?void 0:$.jwt,n.jwt,k]),_react.useEffect.call(void 0, ()=>{function f(){return _chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){if(!(l.status!=="not-loaded"||n.jwt==null||m&&!y||(t==null?void 0:t.chain)==null))try{let F=m&&u?yield a():t.signer;yield T({chain:t.chain,signer:F,owner:t.owner})}catch(F){console.error("Failed to create wallet:",F),s(void 0)}})}t!=null&&f()},[l.status,n.jwt,y,u,a,T,S,t==null?void 0:t.chain,t==null?void 0:t.signer,t==null?void 0:t.owner]),_react.useEffect.call(void 0, ()=>{n.jwt==null&&l.status!=="not-loaded"&&k()},[n.jwt,l.status,k]);let M=_react.useMemo.call(void 0, ()=>({walletState:l,setWalletState:c,showPasskeyHelpers:o,appearance:e,createPasskeyPrompt:S,getOrCreateWallet:T,createPasskeySigner:j,clearWallet:k}),[l,o,e,S,T,j,k]);return _jsxruntime.jsx.call(void 0, _chunkJNLQRLICcjs.a,{children:_jsxruntime.jsxs.call(void 0, Ct.Provider,{value:M,children:[r,d&&i!=null?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, _chunkHUFKDHMJcjs.a,{rejectRef:W,email:i,open:d,setOpen:x,step:p,onSubmitOTP:I,onResendOTPCode:N,onSubmitEmail:N,appearance:e}),document.body):null,w.open?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, _chunkMB4Z6LUXcjs.a,{state:w,appearance:e}),document.body):null]})})}function ji(){let r=_react.useContext.call(void 0, Ct);if(!r)throw new Error("useWallet must be used within CrossmintAuthProvider or CrossmintWalletProvider");let{walletState:o,getOrCreateWallet:e,createPasskeySigner:t,clearWallet:n}=r;return{wallet:o.status==="loaded"?o.wallet:void 0,status:o.status,getOrCreateWallet:e,createPasskeySigner:t,clearWallet:n}}function Ji(){let r=_react.useContext.call(void 0, it);if(r===void 0)throw new Error("useAuth must be used within an AuthProvider");return r}var Ne={crossmintAuth:void 0,login:()=>{},logout:()=>{},jwt:void 0,user:void 0,status:"initializing",getUser:()=>{}},it= exports.s =_react.createContext.call(void 0, Ne);function fl({children:r,appearance:o,termsOfServiceText:e,prefetchOAuthUrls:t=!0,authModalTitle:n,onLoginSuccess:s,loginMethods:i=["email","google"],refreshRoute:u,logoutRoute:m}){let[a,y]=_react.useState.call(void 0, void 0),{crossmint:l,setJwt:c,experimental_setCustomAuth:w}=_chunkKARK5Z2Dcjs.b.call(void 0, "CrossmintAuthProvider must be used within CrossmintProvider"),g=_react.useRef.call(void 0, null),d=_react.useMemo.call(void 0, ()=>(g.current||(g.current=_clientsdkauth.CrossmintAuth.from(l,{callbacks:{onLogout:()=>{y(void 0),w(void 0)},onTokenRefresh:f=>{y(f.user),w({email:f.user.email,jwt:f.jwt})}},refreshRoute:u,logoutRoute:m})),g.current),[]),x=_commonsdkbase.validateApiKeyAndGetCrossmintBaseUrl.call(void 0, l.apiKey),[p,C]=_react.useState.call(void 0, !1),[h,P]=_react.useState.call(void 0, !1),[E,W]=_react.useState.call(void 0, void 0),[S,N]=_react.useState.call(void 0, !0),I=i.some(f=>f.startsWith("web3")),T=_react.useCallback.call(void 0, ()=>{s==null||s()},[s]);_react.useEffect.call(void 0, ()=>{if(l.jwt==null){let f=_clientsdkauth.getCookie.call(void 0, _commonsdkauth.SESSION_PREFIX);c(f)}P(!0)},[l.jwt,c]),_react.useEffect.call(void 0, ()=>{l.jwt!=null&&p&&(C(!1),T())},[l.jwt,p,T]);let j=_react.useCallback.call(void 0, f=>{if(l.jwt!=null){console.log("User already logged in");return}f!=null&&typeof f=="string"&&W(f),C(!0)},[l.jwt]),k=_react.useCallback.call(void 0, ()=>{console.log("Logging out"),d.logout()},[d]),M=_react.useCallback.call(void 0, ()=>!h||I&&!S?"initializing":l.jwt!=null?"logged-in":p?"in-progress":"logged-out",[h,I,S,l.jwt,p]),V=_react.useCallback.call(void 0, ()=>_chunk2WSEHVNPcjs.d.call(void 0, this,null,function*(){if(l.jwt==null){console.log("User not logged in");return}let f=yield d.getUser();return y(f),w(f),f}),[l.jwt,d,w]),$=_react.useMemo.call(void 0, ()=>({crossmintAuth:d,login:j,logout:k,jwt:l.jwt,user:a,status:M(),getUser:V}),[d,j,k,l.jwt,a,M,V]);return _jsxruntime.jsx.call(void 0, _chunkJNLQRLICcjs.a,{children:_jsxruntime.jsx.call(void 0, it.Provider,{value:$,children:_jsxruntime.jsx.call(void 0, To,{setDialogOpen:(f,F)=>{C(f),F&&T()},preFetchOAuthUrls:M()==="logged-out"&&t,initialState:{appearance:o,loginMethods:i,termsOfServiceText:e,authModalTitle:n,baseUrl:x,defaultEmail:E},children:I?_jsxruntime.jsxs.call(void 0, Eo,{apiKeyEnvironment:l.apiKey.includes("production")?"production":"staging",loginMethods:i,appearance:o,onSdkLoaded:N,children:[r,_jsxruntime.jsx.call(void 0, pt,{open:p})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r,_jsxruntime.jsx.call(void 0, pt,{open:p})]})})})})}function L(){let r=_react.useContext.call(void 0, it);if(!r)throw new Error("useCrossmintAuth must be used within a CrossmintAuthProvider");return r}var Do={google:"",twitter:""},Ro=_react.createContext.call(void 0, void 0),b= exports.a =()=>{let r=_react.useContext.call(void 0, Ro);if(!r)throw new Error("useAuthForm must be used within an AuthFormProvider");return r},To= exports.b =({setDialogOpen:r,preFetchOAuthUrls:o,initialState:e,children:t})=>{let{crossmintAuth:n}=L(),[s,i]=_react.useState.call(void 0, "initial"),[u,m]=_react.useState.call(void 0, null),[a,y]=_react.useState.call(void 0, Do),[l,c]=_react.useState.call(void 0, !0),{loginMethods:w,baseUrl:g,appearance:d,termsOfServiceText:x,authModalTitle:p,defaultEmail:C}=e,h=_react.useCallback.call(void 0, ()=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){c(!0);try{let S=w.filter(I=>I in Do).map(I=>_chunk2WSEHVNPcjs.d.call(void 0, void 0,null,function*(){let T=yield n==null?void 0:n.getOAuthUrl(I);return{[I]:T}})),N=Object.assign({},...yield Promise.all(S));y(N)}catch(W){m(W instanceof _commonsdkauth.CrossmintAuthenticationError?W.message:"Unable to load oauth providers. Please try again later.")}finally{c(!1)}}),[w,n]);_react.useEffect.call(void 0, ()=>{o&&h()},[h,o]);let E={step:s,error:u,baseUrl:g,appearance:d,termsOfServiceText:x,authModalTitle:p,loginMethods:w,defaultEmail:C,oauthUrlMap:a,isLoadingOauthUrlMap:l,setDialogOpen:(W,S)=>{r==null||r(W,S),W||setTimeout(()=>i("initial"),250)},setError:m,setStep:i};return _jsxruntime.jsx.call(void 0, Ro.Provider,{value:E,children:t})};exports.a = b; exports.b = To; exports.c = Q; exports.d = Bo; exports.e = io; exports.f = Y; exports.g = lo; exports.h = so; exports.i = mo; exports.j = uo; exports.k = fo; exports.l = go; exports.m = ho; exports.n = xo; exports.o = po; exports.p = wo; exports.q = vo; exports.r = pt; exports.s = it; exports.t = fl; exports.u = L; exports.v = ko; exports.w = Eo; exports.x = Ct; exports.y = Ii; exports.z = Ti; exports.A = ji; exports.B = Ji;
|