@crossmint/client-sdk-react-ui 1.3.7 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckout.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts","../src/hooks/useCrossmint.tsx","../src/providers/CrossmintAuthProvider.tsx","../src/hooks/useAuth.ts","../src/index.ts"],"sourcesContent":["import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.3.7\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatEmbeddedCheckout } from \"./fiat/FiatEmbeddedCheckout\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout on v2 major publish, prior announcement since its a breaking change\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatEmbeddedCheckout {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\nimport bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import { useEffect, useState } from \"react\";\n\nimport { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from \"@crossmint/client-sdk-base\";\nimport { CrossmintEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none\",\n border: \"none\",\n padding: \"0px\",\n width: \"100%\",\n minWidth: \"100%\",\n overflow: \"hidden\",\n display: \"block\",\n userSelect: \"none\",\n transform: \"translate(0px)\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import useDeepEffect from \"@/hooks/useDeepEffect\";\n\nimport {\n FiatEmbeddedCheckoutProps,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\n\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return <CrossmintEmbeddedCheckoutIFrame {...props} />;\n}\n","import FiatEmbeddedCheckoutIFrame from \"@/components/embed/fiat/FiatEmbeddedCheckoutIFrame\";\n\nimport { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nexport function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {\n return <FiatEmbeddedCheckoutIFrame {...props} />;\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\n\nexport default function useEnvironment() {\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\n useEffect(() => {\n setIsServerSideRendering(false);\n }, []);\n\n return { isServerSideRendering };\n}\n","import { Styles, createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport type Classes<Name extends string | number | symbol = string> = Record<Name, string>;\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst styles: Styles<\"crossmintButton\" | \"crossmintImg\" | \"crossmintParagraph\" | \"@global\", CustomStylingProps> = {\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n};\n\nexport const useStyles: (\n data?:\n | CustomStylingProps & {\n theme?: any;\n }\n) => Classes<\"crossmintButton\" | \"crossmintImg\" | \"crossmintParagraph\" | \"@global\"> = createUseStyles(styles);\n","import { ReactNode, createContext, useCallback, useContext, useMemo, useRef, useState } from \"react\";\n\nimport { Crossmint, createCrossmint } from \"@crossmint/common-sdk-base\";\n\nexport interface CrossmintContext {\n crossmint: Crossmint;\n setJwt: (jwt: string | undefined) => void;\n}\n\nconst CrossmintContext = createContext<CrossmintContext | null>(null);\n\nexport function CrossmintProvider({\n children,\n ...createCrossmintParams\n}: { children: ReactNode } & Parameters<typeof createCrossmint>[0]) {\n const [version, setVersion] = useState(0);\n\n const crossmintRef = useRef<Crossmint>(\n new Proxy<Crossmint>(createCrossmint(createCrossmintParams), {\n set(target, prop, value) {\n if (prop === \"jwt\" && target.jwt !== value) {\n setVersion((v) => v + 1);\n }\n return Reflect.set(target, prop, value);\n },\n })\n );\n\n const setJwt = useCallback((jwt: string | undefined) => {\n if (jwt !== crossmintRef.current.jwt) {\n crossmintRef.current.jwt = jwt;\n }\n }, []);\n\n const value = useMemo(\n () => ({\n get crossmint() {\n return crossmintRef.current;\n },\n setJwt,\n }),\n [setJwt, version]\n );\n\n return <CrossmintContext.Provider value={value}>{children}</CrossmintContext.Provider>;\n}\n\nexport function useCrossmint() {\n const context = useContext(CrossmintContext);\n if (context == null) {\n throw new Error(\"useCrossmint must be used within a CrossmintProvider\");\n }\n return context;\n}\n","import { createContext, useEffect, useMemo, useState } from \"react\";\n\nimport { AuthProvider, type AuthProviderParams, useAuth as useAuthCore } from \"@crossmint/client-sdk-auth-core/client\";\nimport { EVMSmartWallet, SmartWalletSDK } from \"@crossmint/client-sdk-smart-wallet\";\n\ntype AuthWalletProviderParams = AuthProviderParams & {\n embeddedWallets: {\n type: \"evm-smart-wallet\";\n defaultChain: \"polygon-amoy\" | \"base-sepolia\";\n createOnLogin: \"all-users\" | \"off\";\n };\n};\n\nexport const WalletContext = createContext<{ wallet: EVMSmartWallet | null }>({\n wallet: null,\n});\n\nexport function CrossmintAuthProvider(props: AuthWalletProviderParams) {\n return (\n <AuthProvider {...props}>\n <AuthWalletProvider {...props}></AuthWalletProvider>\n </AuthProvider>\n );\n}\n\nfunction AuthWalletProvider(props: AuthWalletProviderParams) {\n const { jwt } = useAuthCore();\n\n const [wallet, setWallet] = useState<EVMSmartWallet | null>(null);\n\n const smartWalletSDK = useMemo(() => SmartWalletSDK.init({ clientApiKey: props.apiKey }), [props.apiKey]);\n\n const getOrCreateWallet = async (jwt: string) => {\n try {\n const wallet = await smartWalletSDK.getOrCreateWallet({ jwt }, props.embeddedWallets.defaultChain);\n setWallet(wallet);\n } catch (e: any) {\n console.error(\"There was an error creating a wallet \", e);\n throw e;\n }\n };\n\n useEffect(() => {\n if (props.embeddedWallets.createOnLogin && jwt) {\n console.log(\"Getting or Creating wallet\");\n getOrCreateWallet(jwt);\n }\n\n if (wallet && !jwt) {\n // implies a logout has occurred, clear wallet\n console.log(\"Clearing wallet\");\n setWallet(null);\n }\n }, [jwt, props.embeddedWallets.createOnLogin]);\n\n return <WalletContext.Provider value={{ wallet }}>{props.children}</WalletContext.Provider>;\n}\n","import { WalletContext } from \"@/providers/CrossmintAuthProvider\";\nimport { useContext } from \"react\";\n\nimport { useAuth as useAuthCore } from \"@crossmint/client-sdk-auth-core/client\";\n\nexport function useAuth() {\n const walletContext = useContext(WalletContext);\n\n if (!walletContext) {\n throw new Error(\"useAuth must be used within a CrossmintAuthProvider\");\n }\n\n const authContext = useAuthCore();\n return { ...authContext, ...walletContext };\n}\n","export * from \"./components\";\nexport * from \"./hooks\";\nexport * from \"./providers\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport { type EVMSmartWallet, Chain } from \"@crossmint/client-sdk-smart-wallet\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n"],"mappings":"kyBAAA,OAAS,qCAAAA,GAAmC,2BAAAC,OAA+B,6BCApE,IAAMC,EAAc,QDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,OAAS,qCAAAG,GAAmC,mBAAAC,OAAuB,6BAW3D,cAAAC,OAAA,oBAND,SAASC,GAAmBC,EAAuB,CACtDC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAgBH,EAAOI,CAAW,EAE9C,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,OAEI,iCAAAG,GACA,+BAAAC,OACG,6BCJP,OAAsC,2CAAAC,OAA+C,6BCArF,OAAOC,OAAa,iBACpB,OAAyC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,EAAIC,GAAgC,IAAI,EAE1DC,EAAiBC,GAAQ,IAAMC,GAAe,KAAK,CAAE,aAAcZ,EAAM,MAAO,CAAC,EAAG,CAACA,EAAM,MAAM,CAAC,EAElGa,EAA2BR,GAAgBS,EAAA,sBAC7C,GAAI,CACA,IAAMP,EAAS,MAAMG,EAAe,kBAAkB,CAAE,IAAAL,CAAI,EAAGL,EAAM,gBAAgB,YAAY,EACjGQ,EAAUD,CAAM,CACpB,OAASQ,EAAQ,CACb,cAAQ,MAAM,wCAAyCA,CAAC,EAClDA,CACV,CACJ,GAEA,OAAAC,GAAU,IAAM,CACRhB,EAAM,gBAAgB,eAAiBK,IACvC,QAAQ,IAAI,4BAA4B,EACxCQ,EAAkBR,CAAG,GAGrBE,GAAU,CAACF,IAEX,QAAQ,IAAI,iBAAiB,EAC7BG,EAAU,IAAI,EAEtB,EAAG,CAACH,EAAKL,EAAM,gBAAgB,aAAa,CAAC,EAEtCJ,EAACC,EAAc,SAAd,CAAuB,MAAO,CAAE,OAAAU,CAAO,EAAI,SAAAP,EAAM,SAAS,CACtE,CCvDA,OAAS,cAAAiB,OAAkB,QAE3B,OAAS,WAAWC,OAAmB,yCAEhC,SAASC,IAAU,CACtB,IAAMC,EAAgBC,GAAWC,CAAa,EAE9C,GAAI,CAACF,EACD,MAAM,IAAI,MAAM,qDAAqD,EAGzE,IAAMG,EAAcC,GAAY,EAChC,OAAOC,IAAA,GAAKF,GAAgBH,EAChC,CCVA,OAAS,mBAAAM,GAAiB,sBAAAC,OAA0B,6BACpD,OAA8B,SAAAC,OAAa","names":["assertValidNFTCollectionViewProps","getNFTCollectionViewSrc","LIB_VERSION","jsx","CrossmintNFTCollectionView","props","assertValidNFTCollectionViewProps","src","getNFTCollectionViewSrc","LIB_VERSION","assertValidValidateNFTDetailProps","getNFTDetailSrc","jsx","CrossmintNFTDetail","props","assertValidValidateNFTDetailProps","src","getNFTDetailSrc","LIB_VERSION","isCryptoEmbeddedCheckoutProps","isFiatEmbeddedCheckoutProps","isCryptoEmbeddedCheckoutPropsWithSigner","isEqual","useEffect","useRef","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","bs58","IncomingInternalEvents","OutgoingInternalEvents","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","useEffect","useState","IncomingInternalEvents","crossmintIFrameService","jsx","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","crossmintIFrameService","height","setHeight","useState","url","useEffect","clearListener","event","type","payload","IncomingInternalEvents","jsx","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","signer","paymentMethod","onInternalEvent","event","type","payload","IncomingInternalEvents","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","OutgoingInternalEvents","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintCryptoEmbeddedCheckout","props","isCryptoEmbeddedCheckoutPropsWithSigner","CryptoEmbeddedCheckoutIFrame","__spreadValues","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","jsx","FiatEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintFiatEmbeddedCheckout","props","FiatEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintPaymentElement","props","isFiatEmbeddedCheckoutProps","CrossmintFiatEmbeddedCheckout","__spreadValues","isCryptoEmbeddedCheckoutProps","CrossmintCryptoEmbeddedCheckout","useMemo","useState","clientNames","crossmintModalService","crossmintPayButtonService","useEffect","useState","useEnvironment","isServerSideRendering","setIsServerSideRendering","createUseStyles","DARK_BG","themeIsLight","theme","formatProps","styles","buttonBgColor","paragraphColor","useStyles","Fragment","jsx","jsxs","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","useState","isServerSideRendering","useEnvironment","connect","crossmintModalService","LIB_VERSION","clientNames","getButtonTextInternal","handleClick","crossmintPayButtonService","_handleClick","event","classes","useStyles","formatProps","content","useMemo","__spreadValues","createContext","useCallback","useContext","useMemo","useRef","useState","createCrossmint","jsx","CrossmintContext","createContext","CrossmintProvider","_a","_b","children","createCrossmintParams","__objRest","version","setVersion","useState","crossmintRef","useRef","createCrossmint","target","prop","value","v","setJwt","useCallback","jwt","useMemo","useCrossmint","context","useContext","createContext","useEffect","useMemo","useState","AuthProvider","useAuthCore","SmartWalletSDK","jsx","WalletContext","createContext","CrossmintAuthProvider","props","AuthProvider","__spreadProps","__spreadValues","AuthWalletProvider","jwt","useAuthCore","wallet","setWallet","useState","smartWalletSDK","useMemo","SmartWalletSDK","getOrCreateWallet","__async","e","useEffect","useContext","useAuthCore","useAuth","walletContext","useContext","WalletContext","authContext","useAuthCore","__spreadValues","CrossmintEvents","useCrossmintEvents","Chain"]}
1
+ {"version":3,"sources":["../src/components/CrossmintNFTCollectionView.tsx","../src/consts/version.ts","../src/components/CrossmintNFTDetail.tsx","../src/components/embed/index.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckout.tsx","../src/components/embed/crypto/CryptoEmbeddedCheckoutIFrame.tsx","../src/hooks/useDeepEffect.ts","../src/components/embed/EmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckoutIFrame.tsx","../src/components/embed/fiat/FiatEmbeddedCheckout.tsx","../src/components/hosted/CrossmintPayButton.tsx","../src/hooks/useEnvironment.ts","../src/components/hosted/styles.ts","../src/hooks/useCrossmint.tsx","../src/providers/CrossmintWalletProvider.tsx","../src/hooks/useWallet.ts","../src/hooks/index.ts","../src/providers/CrossmintAuthProvider.tsx","../src/index.ts"],"sourcesContent":["import { assertValidNFTCollectionViewProps, getNFTCollectionViewSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTCollectionViewProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTCollectionView(props: NFTCollectionViewProps) {\n assertValidNFTCollectionViewProps(props);\n\n const src = getNFTCollectionViewSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-collection-view\"\n />\n );\n}\n","export const LIB_VERSION = \"1.3.9\";\n","import { assertValidValidateNFTDetailProps, getNFTDetailSrc } from \"@crossmint/client-sdk-base\";\nimport { NFTDetailProps } from \"@crossmint/common-sdk-base\";\n\nimport { LIB_VERSION } from \"../consts/version\";\n\nexport function CrossmintNFTDetail(props: NFTDetailProps) {\n assertValidValidateNFTDetailProps(props);\n\n const src = getNFTDetailSrc(props, LIB_VERSION);\n\n return (\n <iframe\n src={src}\n width=\"100%\"\n height=\"100%\"\n style={{\n flexGrow: \"1\",\n border: \"none\",\n margin: \"0\",\n padding: \"0\",\n }}\n role=\"nft-details\"\n />\n );\n}\n","import {\n CrossmintEmbeddedCheckoutProps,\n isCryptoEmbeddedCheckoutProps,\n isFiatEmbeddedCheckoutProps,\n} from \"@crossmint/client-sdk-base\";\n\nimport { CrossmintCryptoEmbeddedCheckout } from \"./crypto/CryptoEmbeddedCheckout\";\nimport { CrossmintFiatEmbeddedCheckout } from \"./fiat/FiatEmbeddedCheckout\";\n\n// TODO: Rename to CrossmintEmbeddedCheckout on v2 major publish, prior announcement since its a breaking change\nexport function CrossmintPaymentElement(props: CrossmintEmbeddedCheckoutProps) {\n if (isFiatEmbeddedCheckoutProps(props)) {\n return <CrossmintFiatEmbeddedCheckout {...props} />;\n }\n if (isCryptoEmbeddedCheckoutProps(props)) {\n return <CrossmintCryptoEmbeddedCheckout {...props} />;\n }\n throw new Error(\"Unsupported: Fiat is the only supported payment method.\");\n}\n","import { CryptoEmbeddedCheckoutProps, isCryptoEmbeddedCheckoutPropsWithSigner } from \"@crossmint/client-sdk-base\";\n\nimport CryptoEmbeddedCheckoutIFrame from \"./CryptoEmbeddedCheckoutIFrame\";\n\nexport function CrossmintCryptoEmbeddedCheckout(props: CryptoEmbeddedCheckoutProps) {\n if (!isCryptoEmbeddedCheckoutPropsWithSigner(props)) {\n throw new Error(\"Invalid parameters: signer is required in versions < 2.0.0\");\n }\n\n return <CryptoEmbeddedCheckoutIFrame {...props} />;\n}\n","import bs58 from \"bs58\";\n\nimport {\n CryptoEmbeddedCheckoutPropsWithSigner,\n ETHEmbeddedCheckoutSigner,\n IncomingInternalEvent,\n IncomingInternalEvents,\n OutgoingInternalEvents,\n SOLEmbeddedCheckoutSigner,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\nimport { EVMBlockchainIncludingTestnet } from \"@crossmint/common-sdk-base\";\n\nimport useDeepEffect from \"../../../hooks/useDeepEffect\";\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n const { signer, paymentMethod } = props;\n\n function onInternalEvent(event: IncomingInternalEvent) {\n const { type, payload } = event;\n\n if (type === IncomingInternalEvents.CRYPTO_PAYMENT_INCOMING_TRANSACTION) {\n const { serializedTransaction } = payload;\n console.log(\"[Crossmint] Received incoming transaction\", serializedTransaction);\n handleIncomingTransaction(serializedTransaction);\n }\n\n if (type === IncomingInternalEvents.CRYPTO_CHAIN_SWITCH) {\n const { chain } = payload;\n console.log(\"[Crossmint] Received change of chain\", chain);\n\n const handleChainSwitch = (signer as ETHEmbeddedCheckoutSigner).handleChainSwitch;\n if (handleChainSwitch == null) {\n throw new Error(\"switchNetwork function should have been defined\");\n }\n handleChainSwitch(chain as EVMBlockchainIncludingTestnet);\n }\n }\n\n async function handleIncomingTransaction(serializedTransaction: string) {\n try {\n let txId: string;\n switch (paymentMethod) {\n case \"SOL\":\n txId = await handleSOLTransaction(signer, serializedTransaction);\n break;\n case \"ETH\":\n txId = await handleETHTransaction(signer, serializedTransaction);\n break;\n default:\n throw new Error(`Unsupported payment method ${paymentMethod}`);\n }\n\n console.log(\"[Crossmint] Signed and sent transaction\", txId);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_ACCEPTED,\n payload: {\n txId,\n },\n });\n } catch (e) {\n console.error(\"[Crossmint] Failed to sign and send transaction\", e);\n emitInternalEvent({\n type: OutgoingInternalEvents.CRYPTO_PAYMENT_USER_REJECTED,\n payload: {},\n });\n }\n }\n\n async function handleSOLTransaction(signer: SOLEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { Transaction } = await import(\"@solana/web3.js\");\n const transaction = Transaction.from(bs58.decode(serializedTransaction));\n console.log(\"[Crossmint] Deserialized SOL transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n async function handleETHTransaction(signer: ETHEmbeddedCheckoutSigner, serializedTransaction: string) {\n // @ts-ignore - Error becasue we dont use 'module' field in tsconfig, which is expected because we use tsup to compile\n const { parse: parseTransaction } = await import(\"@ethersproject/transactions\");\n const transaction = parseTransaction(serializedTransaction);\n console.log(\"[Crossmint] Deserialized ETH transaction\", transaction);\n\n return await signer.signAndSendTransaction(transaction);\n }\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [\n props.signer.address,\n props.recipient,\n props.mintConfig,\n props.locale,\n props.currency,\n props.whPassThroughArgs,\n ...(\"chain\" in props.signer ? [props.signer.chain] : []),\n ]);\n\n return <CrossmintEmbeddedCheckoutIFrame onInternalEvent={onInternalEvent} {...props} />;\n}\n","import isEqual from \"lodash.isequal\";\nimport { DependencyList, EffectCallback, useEffect, useRef } from \"react\";\n\nexport default function useDeepEffect(callback: EffectCallback, dependencies: DependencyList): void {\n const dependenciesRef = useRef(dependencies);\n\n useEffect(() => {\n const hasChanged = dependencies.some((dep, i) => !isEqual(dep, dependenciesRef.current[i]));\n\n if (hasChanged) {\n dependenciesRef.current = dependencies;\n return callback();\n }\n }, [dependencies]);\n}\n","import { useEffect, useState } from \"react\";\n\nimport {\n CrossmintEmbeddedCheckoutProps,\n IncomingInternalEvent,\n IncomingInternalEvents,\n crossmintIFrameService,\n} from \"@crossmint/client-sdk-base\";\n\ntype CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {\n onInternalEvent?: (event: IncomingInternalEvent) => void;\n};\n\nexport default function CrossmintEmbeddedCheckoutIFrame({\n onInternalEvent,\n ...props\n}: CrossmintEmbeddedCheckoutIFrameProps) {\n const { getUrl, listenToEvents, listenToInternalEvents } = crossmintIFrameService(props);\n\n const [height, setHeight] = useState(0);\n const [url] = useState(getUrl(props));\n\n // Public events\n useEffect(() => {\n const clearListener = listenToEvents((event) => props.onEvent?.(event.data));\n\n return () => {\n clearListener();\n };\n }, []);\n\n // Internal events\n useEffect(() => {\n const clearListener = listenToInternalEvents((event) => {\n const { type, payload } = event.data;\n\n if (type === IncomingInternalEvents.UI_HEIGHT_CHANGED) {\n setHeight(payload.height);\n }\n\n onInternalEvent?.(event.data);\n });\n\n return () => {\n clearListener();\n };\n }, []);\n\n return (\n <iframe\n src={url}\n id=\"crossmint-embedded-checkout.iframe\"\n role=\"crossmint-embedded-checkout.iframe\"\n allow=\"payment *\"\n style={{\n boxShadow: \"none\",\n border: \"none\",\n padding: \"0px\",\n width: \"100%\",\n minWidth: \"100%\",\n overflow: \"hidden\",\n display: \"block\",\n userSelect: \"none\",\n transform: \"translate(0px)\",\n opacity: \"1\",\n transition: \"ease 0s, opacity 0.4s ease 0.1s\",\n height: `${height}px`,\n }}\n />\n );\n}\n","import {\n FiatEmbeddedCheckoutProps,\n crossmintIFrameService,\n embeddedCheckoutPropsToUpdatableParamsPayload,\n} from \"@crossmint/client-sdk-base\";\n\nimport useDeepEffect from \"../../../hooks/useDeepEffect\";\nimport CrossmintEmbeddedCheckoutIFrame from \"../EmbeddedCheckoutIFrame\";\n\nexport default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {\n const { emitInternalEvent } = crossmintIFrameService(props);\n\n useDeepEffect(() => {\n emitInternalEvent({\n type: \"params-update\",\n payload: embeddedCheckoutPropsToUpdatableParamsPayload(props),\n });\n }, [props.recipient, props.mintConfig, props.locale, props.currency, props.whPassThroughArgs]);\n\n return <CrossmintEmbeddedCheckoutIFrame {...props} />;\n}\n","import { FiatEmbeddedCheckoutProps } from \"@crossmint/client-sdk-base\";\n\nimport FiatEmbeddedCheckoutIFrame from \"../../../components/embed/fiat/FiatEmbeddedCheckoutIFrame\";\n\nexport function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {\n return <FiatEmbeddedCheckoutIFrame {...props} />;\n}\n","import { CSSProperties, MouseEvent, useMemo } from \"react\";\nimport { useState } from \"react\";\n\nimport {\n CheckoutProps,\n CrossmintPayButtonProps,\n clientNames,\n crossmintModalService,\n crossmintPayButtonService,\n} from \"@crossmint/client-sdk-base\";\n\nimport { LIB_VERSION } from \"../../consts/version\";\nimport useEnvironment from \"../../hooks/useEnvironment\";\nimport { formatProps, useStyles } from \"./styles\";\n\nexport type CrossmintPayButtonReactProps = CrossmintPayButtonProps & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n style?: CSSProperties;\n};\n\nexport function CrossmintPayButton(buttonProps: CrossmintPayButtonReactProps) {\n const {\n className,\n disabled,\n onClick,\n style,\n tabIndex,\n theme = \"dark\",\n mintTo,\n emailTo,\n listingId,\n auctionId,\n showOverlay = true,\n mintConfig,\n whPassThroughArgs,\n environment,\n paymentMethod,\n preferredSigninMethod,\n dismissOverlayOnClick,\n prepay,\n locale = \"en-US\",\n currency = \"usd\",\n successCallbackURL = \"\",\n failureCallbackURL = \"\",\n loginEmail = \"\",\n projectId,\n getButtonText,\n checkoutProps = {\n experimental: false,\n display: \"same-tab\",\n paymentMethods: [\"fiat\", \"ETH\", \"SOL\"],\n } as CheckoutProps,\n ...props\n } = buttonProps;\n\n const collectionId = \"clientId\" in props ? props.clientId : props.collectionId;\n\n const [connecting, setConnecting] = useState(false);\n const { isServerSideRendering } = useEnvironment();\n\n const { connect } = crossmintModalService({\n clientId: collectionId,\n projectId,\n showOverlay,\n dismissOverlayOnClick,\n setConnecting,\n libVersion: LIB_VERSION,\n environment,\n clientName: clientNames.reactUi,\n locale,\n currency,\n successCallbackURL,\n failureCallbackURL,\n loginEmail,\n });\n\n const { getButtonText: getButtonTextInternal, handleClick } = crossmintPayButtonService({\n onClick,\n connecting,\n paymentMethod,\n locale,\n checkoutProps,\n });\n\n const _handleClick = (event: MouseEvent<HTMLButtonElement>) =>\n handleClick(event, () => {\n connect(\n mintConfig,\n mintTo,\n emailTo,\n listingId,\n whPassThroughArgs,\n paymentMethod,\n preferredSigninMethod,\n prepay,\n checkoutProps\n );\n });\n\n const classes = useStyles(formatProps(theme));\n\n const content = useMemo(() => {\n return (\n <span className={classes.crossmintParagraph} role=\"button-paragraph\">\n {getButtonText != null\n ? getButtonText(connecting, paymentMethod || \"fiat\")\n : getButtonTextInternal(connecting)}\n </span>\n );\n }, [connecting, getButtonText, paymentMethod]);\n\n return (\n <>\n {!isServerSideRendering && (\n <button\n className={`${classes.crossmintButton} ${className || \"\"}`}\n disabled={disabled}\n onClick={_handleClick}\n style={{ ...style }}\n tabIndex={tabIndex}\n >\n <img\n className={classes.crossmintImg}\n src=\"https://www.crossmint.io/assets/crossmint/logo.svg\"\n alt=\"Crossmint logo\"\n />\n {content}\n </button>\n )}\n </>\n );\n}\n","import { useEffect, useState } from \"react\";\n\nexport default function useEnvironment() {\n const [isServerSideRendering, setIsServerSideRendering] = useState(true);\n useEffect(() => {\n setIsServerSideRendering(false);\n }, []);\n\n return { isServerSideRendering };\n}\n","import { Styles, createUseStyles } from \"react-jss\";\n\nconst DARK_BG = \"#1e1e1e\";\n\nconst themeIsLight = (theme: string) => theme === \"light\";\n\nexport const formatProps = (theme: string): CustomStylingProps => ({\n buttonBgColor: themeIsLight(theme) ? \"white\" : DARK_BG,\n paragraphColor: themeIsLight(theme) ? \"black\" : \"white\",\n});\n\nexport type Classes<Name extends string | number | symbol = string> = Record<Name, string>;\ninterface CustomStylingProps {\n buttonBgColor?: string;\n paragraphColor?: string;\n}\n\nconst styles: Styles<\"crossmintButton\" | \"crossmintImg\" | \"crossmintParagraph\" | \"@global\", CustomStylingProps> = {\n \"@global\": {\n \"@import\":\n \"url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap')\",\n },\n crossmintButton: {\n display: \"flex\",\n \"flex-direction\": \"row\",\n \"align-items\": \"center\",\n padding: \"0.875rem 0.875rem\",\n \"font-weight\": \"900\",\n transition: \"opacity ease-in-out 0.25s\",\n \"border-radius\": \"0.5rem\",\n \"font-family\": `\"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif`,\n outline: \"none\",\n border: \"none\",\n \"box-shadow\": \"0px 8px 15px rgba(0, 0, 0, 0.1)\",\n \"justify-content\": \"center\",\n background: ({ buttonBgColor }: CustomStylingProps) => buttonBgColor,\n\n \"&:hover:enabled\": {\n opacity: \"0.6\",\n cursor: \"pointer\",\n },\n },\n crossmintImg: {\n width: \"21px\",\n height: \"21px\",\n \"margin-right\": \"0.875rem\",\n },\n crossmintParagraph: {\n color: ({ paragraphColor }: CustomStylingProps) => paragraphColor,\n margin: \"0\",\n },\n};\n\nexport const useStyles: (\n data?:\n | CustomStylingProps & {\n theme?: any;\n }\n) => Classes<\"crossmintButton\" | \"crossmintImg\" | \"crossmintParagraph\" | \"@global\"> = createUseStyles(styles);\n","import { ReactNode, createContext, useCallback, useContext, useMemo, useRef, useState } from \"react\";\n\nimport { getCachedJwt } from \"@crossmint/client-sdk-auth-core/client\";\nimport { Crossmint, createCrossmint } from \"@crossmint/common-sdk-base\";\n\nexport interface CrossmintContext {\n crossmint: Crossmint;\n setJwt: (jwt: string | undefined) => void;\n}\n\nconst CrossmintContext = createContext<CrossmintContext | null>(null);\n\nexport function CrossmintProvider({\n children,\n ...createCrossmintParams\n}: { children: ReactNode } & Parameters<typeof createCrossmint>[0]) {\n const [version, setVersion] = useState(0);\n\n const crossmintRef = useRef<Crossmint>(\n new Proxy<Crossmint>(\n createCrossmint({ ...createCrossmintParams, jwt: createCrossmintParams.jwt ?? getCachedJwt() }),\n {\n set(target, prop, value) {\n if (prop === \"jwt\" && target.jwt !== value) {\n setVersion((v) => v + 1);\n }\n return Reflect.set(target, prop, value);\n },\n }\n )\n );\n\n const setJwt = useCallback((jwt: string | undefined) => {\n if (jwt !== crossmintRef.current.jwt) {\n crossmintRef.current.jwt = jwt;\n }\n }, []);\n\n const value = useMemo(\n () => ({\n get crossmint() {\n return crossmintRef.current;\n },\n setJwt,\n }),\n [setJwt, version]\n );\n\n return <CrossmintContext.Provider value={value}>{children}</CrossmintContext.Provider>;\n}\n\nexport function useCrossmint(missingContextMessage?: string) {\n const context = useContext(CrossmintContext);\n if (context == null) {\n throw new Error(missingContextMessage ?? \"useCrossmint must be used within a CrossmintProvider\");\n }\n return context;\n}\n","import { useCrossmint } from \"@/hooks\";\nimport { ReactNode, createContext, useEffect, useMemo, useState } from \"react\";\n\nimport { EVMSmartWallet, SmartWalletError, SmartWalletSDK } from \"@crossmint/client-sdk-smart-wallet\";\n\nexport type CrossmintWalletConfig = {\n type: \"evm-smart-wallet\";\n defaultChain: \"polygon-amoy\" | \"base-sepolia\" | \"optimism-sepolia\" | \"arbitrum-sepolia\";\n createOnLogin: \"all-users\" | \"off\";\n};\n\ntype WalletStatus = \"not-loaded\" | \"in-progress\" | \"loaded\" | \"loading-error\";\n\ntype ValidWalletState =\n | { status: \"not-loaded\" | \"in-progress\" }\n | { status: \"loaded\"; wallet: EVMSmartWallet }\n | { status: \"loading-error\"; error: SmartWalletError };\n\nfunction deriveErrorState(error: unknown): { status: \"loading-error\"; error: SmartWalletError } {\n if (error instanceof SmartWalletError) {\n return { status: \"loading-error\", error };\n }\n\n const message = error instanceof Error ? error.message : String(error);\n const stack = error instanceof Error ? error.stack : undefined;\n return { status: \"loading-error\", error: new SmartWalletError(`Unknown Wallet Error: ${message}`, stack) };\n}\n\nfunction shouldGetOrCreateWallet(status: WalletStatus, jwt: string | undefined): jwt is string {\n return jwt != null && !(status === \"in-progress\" || status === \"loaded\");\n}\n\ntype WalletContext = {\n status: WalletStatus;\n wallet?: EVMSmartWallet;\n error?: SmartWalletError;\n getOrCreateWallet: () => Promise<void>;\n};\n\nexport const WalletContext = createContext<WalletContext>({\n status: \"not-loaded\",\n getOrCreateWallet: async () => {},\n});\n\nexport function CrossmintWalletProvider({ children, config }: { config: CrossmintWalletConfig; children: ReactNode }) {\n const { crossmint } = useCrossmint(\"CrossmintWalletProvider must be used within CrossmintProvider\");\n const [state, setState] = useState<ValidWalletState>({ status: \"not-loaded\" });\n const smartWalletSDK = useMemo(() => SmartWalletSDK.init({ clientApiKey: crossmint.apiKey }), [crossmint.apiKey]);\n\n const getOrCreateWallet = async () => {\n if (!shouldGetOrCreateWallet(state.status, crossmint.jwt)) {\n return;\n }\n\n try {\n setState({ status: \"in-progress\" });\n const wallet = await smartWalletSDK.getOrCreateWallet({ jwt: crossmint.jwt }, config.defaultChain);\n setState({ status: \"loaded\", wallet });\n } catch (error: unknown) {\n console.error(\"There was an error creating a wallet \", error);\n setState(deriveErrorState(error));\n }\n };\n\n useEffect(() => {\n if (config.createOnLogin === \"all-users\" && shouldGetOrCreateWallet(state.status, crossmint.jwt)) {\n console.log(\"Getting or Creating wallet\");\n getOrCreateWallet();\n return;\n }\n\n if (state.status === \"loaded\" && crossmint.jwt == null) {\n console.log(\"Clearing wallet\");\n setState({ status: \"not-loaded\" });\n return;\n }\n }, [crossmint.jwt, config.createOnLogin, state.status]);\n\n return <WalletContext.Provider value={{ ...state, getOrCreateWallet }}>{children}</WalletContext.Provider>;\n}\n","import { WalletContext } from \"@/providers/CrossmintWalletProvider\";\nimport { useContext } from \"react\";\n\nexport function useWallet() {\n const walletContext = useContext(WalletContext);\n\n if (!walletContext) {\n throw new Error(\"useWallet must be used within CrossmintAuthProvider or CrossmintWalletProvider\");\n }\n\n return walletContext;\n}\n","export * from \"./useCrossmint\";\nexport * from \"./useWallet\";\nexport { useAuth } from \"@crossmint/client-sdk-auth-core/client\";\n","import { useCrossmint } from \"@/hooks\";\nimport { ReactNode } from \"react\";\n\nimport { AuthProvider as AuthCoreProvider } from \"@crossmint/client-sdk-auth-core/client\";\n\nimport { CrossmintWalletConfig, CrossmintWalletProvider } from \"./CrossmintWalletProvider\";\n\nexport function CrossmintAuthProvider({\n embeddedWallets,\n children,\n}: {\n embeddedWallets: CrossmintWalletConfig;\n children: ReactNode;\n}) {\n const { crossmint, setJwt } = useCrossmint(\"CrossmintAuthProvider must be used within CrossmintProvider\");\n\n return (\n <AuthCoreProvider setJwtToken={setJwt} crossmint={crossmint}>\n <CrossmintWalletProvider config={embeddedWallets}>{children}</CrossmintWalletProvider>\n </AuthCoreProvider>\n );\n}\n","export * from \"./components\";\nexport * from \"./hooks\";\nexport * from \"./providers\";\n\nexport { CrossmintEvents, useCrossmintEvents } from \"@crossmint/client-sdk-base\";\nexport { type EVMSmartWallet, Chain } from \"@crossmint/client-sdk-smart-wallet\";\nexport type { CrossmintEvent, CrossmintEventMap } from \"@crossmint/client-sdk-base\";\n"],"mappings":"kyBAAA,OAAS,qCAAAA,GAAmC,2BAAAC,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OACIN,EAACO,GAAA,CAAiB,YAAaF,EAAQ,UAAWD,EAC9C,SAAAJ,EAACQ,EAAA,CAAwB,OAAQN,EAAkB,SAAAC,EAAS,EAChE,CAER,CCjBA,OAAS,mBAAAM,GAAiB,sBAAAC,OAA0B,6BACpD,OAA8B,SAAAC,OAAa","names":["assertValidNFTCollectionViewProps","getNFTCollectionViewSrc","LIB_VERSION","jsx","CrossmintNFTCollectionView","props","assertValidNFTCollectionViewProps","src","getNFTCollectionViewSrc","LIB_VERSION","assertValidValidateNFTDetailProps","getNFTDetailSrc","jsx","CrossmintNFTDetail","props","assertValidValidateNFTDetailProps","src","getNFTDetailSrc","LIB_VERSION","isCryptoEmbeddedCheckoutProps","isFiatEmbeddedCheckoutProps","isCryptoEmbeddedCheckoutPropsWithSigner","bs58","IncomingInternalEvents","OutgoingInternalEvents","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","isEqual","useEffect","useRef","useDeepEffect","callback","dependencies","dependenciesRef","dep","i","useEffect","useState","IncomingInternalEvents","crossmintIFrameService","jsx","CrossmintEmbeddedCheckoutIFrame","_a","_b","onInternalEvent","props","__objRest","getUrl","listenToEvents","listenToInternalEvents","crossmintIFrameService","height","setHeight","useState","url","useEffect","clearListener","event","type","payload","IncomingInternalEvents","jsx","CryptoEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","signer","paymentMethod","onInternalEvent","event","type","payload","IncomingInternalEvents","serializedTransaction","handleIncomingTransaction","chain","handleChainSwitch","__async","txId","handleSOLTransaction","handleETHTransaction","OutgoingInternalEvents","e","Transaction","transaction","bs58","parseTransaction","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintCryptoEmbeddedCheckout","props","isCryptoEmbeddedCheckoutPropsWithSigner","CryptoEmbeddedCheckoutIFrame","__spreadValues","crossmintIFrameService","embeddedCheckoutPropsToUpdatableParamsPayload","jsx","FiatEmbeddedCheckoutIFrame","props","emitInternalEvent","crossmintIFrameService","useDeepEffect","embeddedCheckoutPropsToUpdatableParamsPayload","CrossmintEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintFiatEmbeddedCheckout","props","FiatEmbeddedCheckoutIFrame","__spreadValues","jsx","CrossmintPaymentElement","props","isFiatEmbeddedCheckoutProps","CrossmintFiatEmbeddedCheckout","__spreadValues","isCryptoEmbeddedCheckoutProps","CrossmintCryptoEmbeddedCheckout","useMemo","useState","clientNames","crossmintModalService","crossmintPayButtonService","useEffect","useState","useEnvironment","isServerSideRendering","setIsServerSideRendering","createUseStyles","DARK_BG","themeIsLight","theme","formatProps","styles","buttonBgColor","paragraphColor","useStyles","Fragment","jsx","jsxs","CrossmintPayButton","buttonProps","_a","className","disabled","onClick","style","tabIndex","theme","mintTo","emailTo","listingId","auctionId","showOverlay","mintConfig","whPassThroughArgs","environment","paymentMethod","preferredSigninMethod","dismissOverlayOnClick","prepay","locale","currency","successCallbackURL","failureCallbackURL","loginEmail","projectId","getButtonText","checkoutProps","props","__objRest","collectionId","connecting","setConnecting","useState","isServerSideRendering","useEnvironment","connect","crossmintModalService","LIB_VERSION","clientNames","getButtonTextInternal","handleClick","crossmintPayButtonService","_handleClick","event","classes","useStyles","formatProps","content","useMemo","__spreadValues","createContext","useCallback","useContext","useMemo","useRef","useState","getCachedJwt","createCrossmint","jsx","CrossmintContext","createContext","CrossmintProvider","_a","_b","children","createCrossmintParams","__objRest","version","setVersion","useState","crossmintRef","useRef","createCrossmint","__spreadProps","__spreadValues","getCachedJwt","target","prop","value","v","setJwt","useCallback","jwt","useMemo","useCrossmint","missingContextMessage","context","useContext","createContext","useEffect","useMemo","useState","SmartWalletError","SmartWalletSDK","jsx","deriveErrorState","error","SmartWalletError","message","stack","shouldGetOrCreateWallet","status","jwt","WalletContext","createContext","__async","CrossmintWalletProvider","children","config","crossmint","useCrossmint","state","setState","useState","smartWalletSDK","useMemo","SmartWalletSDK","getOrCreateWallet","wallet","useEffect","__spreadProps","__spreadValues","useContext","useWallet","walletContext","WalletContext","useAuth","AuthCoreProvider","jsx","CrossmintAuthProvider","embeddedWallets","children","crossmint","setJwt","useCrossmint","AuthCoreProvider","CrossmintWalletProvider","CrossmintEvents","useCrossmintEvents","Chain"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/client-sdk-react-ui",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "repository": "https://github.com/Crossmint/crossmint-sdk",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Paella Labs Inc",
@@ -24,10 +24,10 @@
24
24
  "bs58": "5.0.0",
25
25
  "lodash.isequal": "4.5.0",
26
26
  "react-jss": "10.10.0",
27
- "@crossmint/client-sdk-auth-core": "1.1.2",
28
27
  "@crossmint/client-sdk-base": "1.2.3",
29
- "@crossmint/common-sdk-base": "0.1.2",
30
- "@crossmint/client-sdk-smart-wallet": "0.1.8"
28
+ "@crossmint/client-sdk-smart-wallet": "0.1.9",
29
+ "@crossmint/client-sdk-auth-core": "1.1.3",
30
+ "@crossmint/common-sdk-base": "0.1.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash.isequal": "4.5.6",
@@ -45,7 +45,7 @@
45
45
  "build": "tsup src/index.ts --clean --external react,react-dom --format esm,cjs --outDir ./dist --minify --dts --sourcemap",
46
46
  "create-version-file": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/consts/version.ts",
47
47
  "dev": "tsup src/index.ts --clean --external react,react-dom --format esm,cjs --outDir ./dist --dts --sourcemap --watch",
48
- "test": "jest",
48
+ "test": "vitest run",
49
49
  "version": "pnpm run create-version-file && git add ."
50
50
  }
51
51
  }
@@ -1,34 +1,36 @@
1
- import "@testing-library/jest-dom";
2
1
  import { render, screen } from "@testing-library/react";
2
+ import { describe, expect, test } from "vitest";
3
3
 
4
4
  import { CrossmintNFTCollectionView } from "./CrossmintNFTCollectionView";
5
5
 
6
6
  const wallets = [{ chain: "solana", publicKey: "12345" }];
7
7
 
8
- describe("when only passing mandatory fields", () => {
9
- test("should add them to the iframe query params", () => {
10
- render(<CrossmintNFTCollectionView wallets={wallets} />);
11
- const iframe = screen.getByRole("nft-collection-view");
12
- const src = iframe.getAttribute("src");
13
- expect(src).toContain("wallets=%5B%7B%22chain%22%3A%22solana%22%2C%22publicKey%22%3A%2212345%22%7D%5D");
14
- expect(src).toContain("clientVersion=");
8
+ describe("CrossmintNFTCollectionView", () => {
9
+ describe("when only passing mandatory fields", () => {
10
+ test("should add them to the iframe query params", () => {
11
+ render(<CrossmintNFTCollectionView wallets={wallets} />);
12
+ const iframe = screen.getByRole("nft-collection-view");
13
+ const src = iframe.getAttribute("src");
14
+ expect(src).toContain("wallets=%5B%7B%22chain%22%3A%22solana%22%2C%22publicKey%22%3A%2212345%22%7D%5D");
15
+ expect(src).toContain("clientVersion=");
16
+ });
15
17
  });
16
- });
17
18
 
18
- describe("when not setting any environment", () => {
19
- test("should default to production", () => {
20
- render(<CrossmintNFTCollectionView wallets={wallets} />);
21
- const iframe = screen.getByRole("nft-collection-view");
22
- const src = iframe.getAttribute("src");
23
- expect(src).toContain("https://www.crossmint.com/");
19
+ describe("when not setting any environment", () => {
20
+ test("should default to production", () => {
21
+ render(<CrossmintNFTCollectionView wallets={wallets} />);
22
+ const iframe = screen.getByRole("nft-collection-view");
23
+ const src = iframe.getAttribute("src");
24
+ expect(src).toContain("https://www.crossmint.com/");
25
+ });
24
26
  });
25
- });
26
27
 
27
- describe("when setting the environment to staging", () => {
28
- test("should use the staging url", () => {
29
- render(<CrossmintNFTCollectionView wallets={wallets} environment="staging" />);
30
- const iframe = screen.getByRole("nft-collection-view");
31
- const src = iframe.getAttribute("src");
32
- expect(src).toContain("https://staging.crossmint.com/");
28
+ describe("when setting the environment to staging", () => {
29
+ test("should use the staging url", () => {
30
+ render(<CrossmintNFTCollectionView wallets={wallets} environment="staging" />);
31
+ const iframe = screen.getByRole("nft-collection-view");
32
+ const src = iframe.getAttribute("src");
33
+ expect(src).toContain("https://staging.crossmint.com/");
34
+ });
33
35
  });
34
36
  });
@@ -1,5 +1,5 @@
1
- import "@testing-library/jest-dom";
2
1
  import { render, screen } from "@testing-library/react";
2
+ import { describe, expect, it } from "vitest";
3
3
 
4
4
  import { NFT } from "@crossmint/common-sdk-base";
5
5
 
@@ -7,30 +7,32 @@ import { CrossmintNFTDetail } from "./CrossmintNFTDetail";
7
7
 
8
8
  const nft: NFT = { chain: "ethereum", contractAddress: "0x12345", tokenId: "12" };
9
9
 
10
- describe("when only passing mandatory fields", () => {
11
- test("should add them to the iframe query params", () => {
12
- render(<CrossmintNFTDetail nft={nft} />);
13
- const iframe = screen.getByRole("nft-details");
14
- const src = iframe.getAttribute("src");
15
- expect(src).toContain("/sdk/wallets/tokens/ethereum:0x12345:12");
16
- expect(src).toContain("clientVersion=");
10
+ describe("CrossmintNFTDetail", () => {
11
+ describe("when only passing mandatory fields", () => {
12
+ it("should add them to the iframe query params", () => {
13
+ render(<CrossmintNFTDetail nft={nft} />);
14
+ const iframe = screen.getByRole("nft-details");
15
+ const src = iframe.getAttribute("src");
16
+ expect(src).toContain("/sdk/wallets/tokens/ethereum:0x12345:12");
17
+ expect(src).toContain("clientVersion=");
18
+ });
17
19
  });
18
- });
19
20
 
20
- describe("when not setting any environment", () => {
21
- test("should default to production", () => {
22
- render(<CrossmintNFTDetail nft={nft} />);
23
- const iframe = screen.getByRole("nft-details");
24
- const src = iframe.getAttribute("src");
25
- expect(src).toContain("https://www.crossmint.com/");
21
+ describe("when not setting any environment", () => {
22
+ it("should default to production", () => {
23
+ render(<CrossmintNFTDetail nft={nft} />);
24
+ const iframe = screen.getByRole("nft-details");
25
+ const src = iframe.getAttribute("src");
26
+ expect(src).toContain("https://www.crossmint.com/");
27
+ });
26
28
  });
27
- });
28
29
 
29
- describe("when setting the environment to staging", () => {
30
- test("should use the staging url", () => {
31
- render(<CrossmintNFTDetail nft={nft} environment="staging" />);
32
- const iframe = screen.getByRole("nft-details");
33
- const src = iframe.getAttribute("src");
34
- expect(src).toContain("https://staging.crossmint.com/");
30
+ describe("when setting the environment to staging", () => {
31
+ it("should use the staging url", () => {
32
+ render(<CrossmintNFTDetail nft={nft} environment="staging" />);
33
+ const iframe = screen.getByRole("nft-details");
34
+ const src = iframe.getAttribute("src");
35
+ expect(src).toContain("https://staging.crossmint.com/");
36
+ });
35
37
  });
36
38
  });
@@ -1,5 +1,6 @@
1
- import "@testing-library/jest-dom";
1
+ import "@testing-library/jest-dom/vitest";
2
2
  import { render, screen } from "@testing-library/react";
3
+ import { describe, expect, it, vi } from "vitest";
3
4
 
4
5
  import { CrossmintEvents } from "@crossmint/client-sdk-base";
5
6
 
@@ -30,7 +31,7 @@ describe("CrossmintPaymentElement", () => {
30
31
  });
31
32
 
32
33
  it("calls the onEvent prop when a CrossmintEvents is received", () => {
33
- const onEvent = jest.fn();
34
+ const onEvent = vi.fn();
34
35
  render(<CrossmintPaymentElement {...embeddedCheckoutProps} onEvent={onEvent} environment="" />);
35
36
  screen.getByRole("crossmint-embedded-checkout.iframe");
36
37
 
@@ -43,7 +44,7 @@ describe("CrossmintPaymentElement", () => {
43
44
  });
44
45
 
45
46
  it("does not call the onEvent prop when a different origin than the environment is received in the event", () => {
46
- const onEvent = jest.fn();
47
+ const onEvent = vi.fn();
47
48
  render(<CrossmintPaymentElement {...embeddedCheckoutProps} onEvent={onEvent} environment="" />);
48
49
  screen.getByRole("crossmint-embedded-checkout.iframe");
49
50
 
@@ -1,7 +1,11 @@
1
1
  import { useEffect, useState } from "react";
2
2
 
3
- import { IncomingInternalEvent, IncomingInternalEvents, crossmintIFrameService } from "@crossmint/client-sdk-base";
4
- import { CrossmintEmbeddedCheckoutProps } from "@crossmint/client-sdk-base";
3
+ import {
4
+ CrossmintEmbeddedCheckoutProps,
5
+ IncomingInternalEvent,
6
+ IncomingInternalEvents,
7
+ crossmintIFrameService,
8
+ } from "@crossmint/client-sdk-base";
5
9
 
6
10
  type CrossmintEmbeddedCheckoutIFrameProps = CrossmintEmbeddedCheckoutProps & {
7
11
  onInternalEvent?: (event: IncomingInternalEvent) => void;
@@ -1,4 +1,3 @@
1
- import useDeepEffect from "@/hooks/useDeepEffect";
2
1
  import bs58 from "bs58";
3
2
 
4
3
  import {
@@ -13,6 +12,7 @@ import {
13
12
  } from "@crossmint/client-sdk-base";
14
13
  import { EVMBlockchainIncludingTestnet } from "@crossmint/common-sdk-base";
15
14
 
15
+ import useDeepEffect from "../../../hooks/useDeepEffect";
16
16
  import CrossmintEmbeddedCheckoutIFrame from "../EmbeddedCheckoutIFrame";
17
17
 
18
18
  export default function CryptoEmbeddedCheckoutIFrame(props: CryptoEmbeddedCheckoutPropsWithSigner) {
@@ -1,7 +1,7 @@
1
- import FiatEmbeddedCheckoutIFrame from "@/components/embed/fiat/FiatEmbeddedCheckoutIFrame";
2
-
3
1
  import { FiatEmbeddedCheckoutProps } from "@crossmint/client-sdk-base";
4
2
 
3
+ import FiatEmbeddedCheckoutIFrame from "../../../components/embed/fiat/FiatEmbeddedCheckoutIFrame";
4
+
5
5
  export function CrossmintFiatEmbeddedCheckout(props: FiatEmbeddedCheckoutProps) {
6
6
  return <FiatEmbeddedCheckoutIFrame {...props} />;
7
7
  }
@@ -1,11 +1,10 @@
1
- import useDeepEffect from "@/hooks/useDeepEffect";
2
-
3
1
  import {
4
2
  FiatEmbeddedCheckoutProps,
5
3
  crossmintIFrameService,
6
4
  embeddedCheckoutPropsToUpdatableParamsPayload,
7
5
  } from "@crossmint/client-sdk-base";
8
6
 
7
+ import useDeepEffect from "../../../hooks/useDeepEffect";
9
8
  import CrossmintEmbeddedCheckoutIFrame from "../EmbeddedCheckoutIFrame";
10
9
 
11
10
  export default function FiatEmbeddedCheckoutIFrame(props: FiatEmbeddedCheckoutProps) {
@@ -1,5 +1,6 @@
1
- import "@testing-library/jest-dom";
1
+ import "@testing-library/jest-dom/vitest";
2
2
  import { act, fireEvent, render, screen } from "@testing-library/react";
3
+ import { afterEach, describe, expect, it, vi } from "vitest";
3
4
 
4
5
  import { CrossmintPayButton } from ".";
5
6
  import { LIB_VERSION } from "../../consts/version";
@@ -8,27 +9,27 @@ import { LIB_VERSION } from "../../consts/version";
8
9
  const fetchReturns = Promise.resolve({
9
10
  json: () => Promise.resolve({}),
10
11
  }) as any;
11
- global.fetch = jest.fn(() => fetchReturns);
12
+ global.fetch = vi.fn(() => fetchReturns);
12
13
 
13
14
  // TODO(#61): make this automatically mocked in every test suite
14
15
  const openReturns = {} as Window;
15
- global.open = jest.fn(() => openReturns);
16
+ global.open = vi.fn(() => openReturns);
16
17
  global.console = {
17
- log: jest.fn(),
18
- error: jest.fn(),
19
- warn: jest.fn(),
18
+ log: vi.fn(),
19
+ error: vi.fn(),
20
+ warn: vi.fn(),
20
21
  } as any;
21
22
 
22
23
  const defaultProps = {
23
24
  clientId: "a4e1bfcc-9884-11ec-b909-0242ac120002",
24
25
  };
25
26
 
26
- afterEach(() => {
27
- jest.clearAllMocks();
28
- });
29
-
30
27
  describe("CrossmintPayButton", () => {
31
- test("should open window with correct url", async () => {
28
+ afterEach(() => {
29
+ vi.clearAllMocks();
30
+ });
31
+
32
+ it("should open window with correct url", async () => {
32
33
  render(<CrossmintPayButton {...defaultProps} />);
33
34
 
34
35
  await act(async () => {
@@ -61,7 +62,7 @@ describe("CrossmintPayButton", () => {
61
62
  );
62
63
  });
63
64
 
64
- test("should add the `whPassThroughArgs` prop on the window url", async () => {
65
+ it("should add the `whPassThroughArgs` prop on the window url", async () => {
65
66
  const whPassThroughArgs = { hello: "hi" };
66
67
  render(<CrossmintPayButton {...defaultProps} whPassThroughArgs={whPassThroughArgs} />);
67
68
 
@@ -76,7 +77,7 @@ describe("CrossmintPayButton", () => {
76
77
  });
77
78
 
78
79
  describe("when passing the prepay prop", () => {
79
- test("should pass the prepay query param", async () => {
80
+ it("should pass the prepay query param", async () => {
80
81
  render(<CrossmintPayButton {...defaultProps} prepay />);
81
82
 
82
83
  await act(async () => {
@@ -91,7 +92,7 @@ describe("CrossmintPayButton", () => {
91
92
  });
92
93
 
93
94
  describe("when passing the prepay prop as false", () => {
94
- test("should not pass the prepay query param", async () => {
95
+ it("should not pass the prepay query param", async () => {
95
96
  render(<CrossmintPayButton {...defaultProps} prepay={false} />);
96
97
 
97
98
  await act(async () => {
@@ -106,7 +107,7 @@ describe("CrossmintPayButton", () => {
106
107
  });
107
108
 
108
109
  describe("when passing the loginEmail prop", () => {
109
- test("should pass an email in the email query param", async () => {
110
+ it("should pass an email in the email query param", async () => {
110
111
  render(<CrossmintPayButton {...defaultProps} loginEmail="user@gmail.com" />);
111
112
 
112
113
  await act(async () => {
@@ -119,7 +120,7 @@ describe("CrossmintPayButton", () => {
119
120
  );
120
121
  });
121
122
 
122
- test("should pass the email query param empty if loginEmail is empty", async () => {
123
+ it("should pass the email query param empty if loginEmail is empty", async () => {
123
124
  render(<CrossmintPayButton {...defaultProps} loginEmail="" />);
124
125
 
125
126
  await act(async () => {
@@ -132,7 +133,7 @@ describe("CrossmintPayButton", () => {
132
133
  );
133
134
  });
134
135
 
135
- test("should pass the email query param empty if loginEmail is not present as a param", async () => {
136
+ it("should pass the email query param empty if loginEmail is not present as a param", async () => {
136
137
  render(<CrossmintPayButton {...defaultProps} />);
137
138
 
138
139
  await act(async () => {
@@ -147,7 +148,7 @@ describe("CrossmintPayButton", () => {
147
148
  });
148
149
 
149
150
  describe("when passing collectionId instead of clientId", () => {
150
- test("should open window with correct url", async () => {
151
+ it("should open window with correct url", async () => {
151
152
  render(<CrossmintPayButton collectionId={defaultProps.clientId} />);
152
153
 
153
154
  await act(async () => {
@@ -163,7 +164,7 @@ describe("CrossmintPayButton", () => {
163
164
  });
164
165
 
165
166
  describe("when passing projectId", () => {
166
- test("should open window with projectId included in query params", async () => {
167
+ it("should open window with projectId included in query params", async () => {
167
168
  render(<CrossmintPayButton {...defaultProps} projectId="123" />);
168
169
 
169
170
  await act(async () => {
@@ -179,7 +180,7 @@ describe("CrossmintPayButton", () => {
179
180
  });
180
181
 
181
182
  describe("when passing getButtonText prop", () => {
182
- test("should show custom text", async () => {
183
+ it("should show custom text", async () => {
183
184
  render(<CrossmintPayButton {...defaultProps} getButtonText={() => "Custom text"} />);
184
185
  expect(screen.getByText("Custom text")).toBeInTheDocument();
185
186
  });
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.3.7";
1
+ export const LIB_VERSION = "1.3.9";
@@ -1,2 +1,3 @@
1
1
  export * from "./useCrossmint";
2
- export * from "./useAuth";
2
+ export * from "./useWallet";
3
+ export { useAuth } from "@crossmint/client-sdk-auth-core/client";