@crossmint/client-sdk-react-ui 1.3.13 → 1.3.15

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/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.13\";\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\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 getOrCreateWalletInternal = async (jwt: string) => {\n try {\n setState({ status: \"in-progress\" });\n const wallet = await smartWalletSDK.getOrCreateWallet({ 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\" && crossmint.jwt != null && state.status === \"not-loaded\") {\n console.log(\"Getting or Creating wallet\");\n getOrCreateWalletInternal(crossmint.jwt);\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 const getOrCreateWalletExternal = async () => {\n if (crossmint.jwt == null) {\n console.log(\"No authenticated user, not creating wallet.\");\n return;\n }\n\n if (state.status === \"loaded\" || state.status === \"in-progress\") {\n console.log(\"Wallet is already loaded, or is currently loading.\");\n return;\n }\n\n return getOrCreateWalletInternal(crossmint.jwt);\n };\n\n return (\n <WalletContext.Provider value={{ ...state, getOrCreateWallet: getOrCreateWalletExternal }}>\n {children}\n </WalletContext.Provider>\n );\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\";\nimport { UIConfig } from \"@crossmint/common-sdk-base\";\n\nimport { CrossmintWalletConfig, CrossmintWalletProvider } from \"./CrossmintWalletProvider\";\n\ntype CrossmintAuthProviderProps = {\n embeddedWallets: CrossmintWalletConfig;\n children: ReactNode;\n appearance?: UIConfig;\n};\n\nexport function CrossmintAuthProvider({ embeddedWallets, children, appearance }: CrossmintAuthProviderProps) {\n const { crossmint, setJwt } = useCrossmint(\"CrossmintAuthProvider must be used within CrossmintProvider\");\n\n return (\n <AuthCoreProvider setJwtToken={setJwt} crossmint={crossmint} appearance={appearance}>\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,OAA+B,6BCApE,IAAMC,EAAc,SDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,OAAS,qCAAAG,GAAmC,mBAAAC,OAAuB,6BAW3D,cAAAC,OAAA,oBAND,SAASC,GAAmBC,EAAuB,CACtDC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAgBH,EAAOI,CAAW,EAE9C,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN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IAAI,iBAAiB,EAC7BG,EAAS,CAAE,OAAQ,YAAa,CAAC,EACjC,MACJ,CACJ,EAAG,CAACH,EAAU,IAAKD,EAAO,cAAeG,EAAM,MAAM,CAAC,EAEtD,IAAMU,EAA4B,IAAYhB,EAAA,sBAC1C,GAAII,EAAU,KAAO,KAAM,CACvB,QAAQ,IAAI,6CAA6C,EACzD,MACJ,CAEA,GAAIE,EAAM,SAAW,UAAYA,EAAM,SAAW,cAAe,CAC7D,QAAQ,IAAI,oDAAoD,EAChE,MACJ,CAEA,OAAOM,EAA0BR,EAAU,GAAG,CAClD,GAEA,OACIZ,GAACM,EAAc,SAAd,CAAuB,MAAOmB,EAAAC,EAAA,GAAKZ,GAAL,CAAY,kBAAmBU,CAA0B,GACnF,SAAAd,EACL,CAER,CCxFA,OAAS,cAAAiB,OAAkB,QAEpB,SAASC,IAAY,CACxB,IAAMC,EAAgBF,GAAWG,CAAa,EAE9C,GAAI,CAACD,EACD,MAAM,IAAI,MAAM,gFAAgF,EAGpG,OAAOA,CACX,CCTA,OAAS,WAAAE,OAAe,yCCCxB,OAAS,gBAAgBC,OAAwB,yCAgBrC,cAAAC,MAAA,oBALL,SAASC,GAAsB,CAAE,gBAAAC,EAAiB,SAAAC,EAAU,WAAAC,CAAW,EAA+B,CACzG,GAAM,CAAE,UAAAC,EAAW,OAAAC,CAAO,EAAIC,EAAa,6DAA6D,EAExG,OACIP,EAACQ,GAAA,CAAiB,YAAaF,EAAQ,UAAWD,EAAW,WAAYD,EACrE,SAAAJ,EAACS,EAAA,CAAwB,OAAQP,EAAkB,SAAAC,EAAS,EAChE,CAER,CClBA,OAAS,mBAAAO,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","WalletContext","createContext","__async","CrossmintWalletProvider","children","config","crossmint","useCrossmint","state","setState","useState","smartWalletSDK","useMemo","SmartWalletSDK","getOrCreateWalletInternal","jwt","wallet","useEffect","getOrCreateWalletExternal","__spreadProps","__spreadValues","useContext","useWallet","walletContext","WalletContext","useAuth","AuthCoreProvider","jsx","CrossmintAuthProvider","embeddedWallets","children","appearance","crossmint","setJwt","useCrossmint","AuthCoreProvider","CrossmintWalletProvider","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/utils/constants.ts","../src/utils/jwt.ts","../src/hooks/useWallet.ts","../src/providers/CrossmintWalletProvider.tsx","../src/hooks/useAuth.ts","../src/providers/CrossmintAuthProvider.tsx","../src/components/auth/AuthModal.tsx","../src/icons/x.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.15\";\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 { Crossmint, createCrossmint } from \"@crossmint/common-sdk-base\";\n\nimport { getCachedJwt } from \"../utils\";\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","export const SESSION_PREFIX = \"crossmint-session\";\n","import { SESSION_PREFIX } from \"./constants\";\n\nexport function getCachedJwt(): string | undefined {\n if (typeof document === \"undefined\") {\n return undefined; // Check if we're on the client-side\n }\n const crossmintSession = document.cookie.split(\"; \").find((row) => row.startsWith(SESSION_PREFIX));\n return crossmintSession ? crossmintSession.split(\"=\")[1] : undefined;\n}\n","import { useContext } from \"react\";\n\nimport { WalletContext } from \"../providers/CrossmintWalletProvider\";\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","import { ReactNode, createContext, useMemo, useState } from \"react\";\n\nimport {\n EVMSmartWallet,\n EVMSmartWalletChain,\n SmartWalletError,\n SmartWalletSDK,\n WalletParams,\n} from \"@crossmint/client-sdk-smart-wallet\";\n\nimport { useCrossmint } from \"../hooks\";\n\ntype WalletStatus = \"not-loaded\" | \"in-progress\" | \"loaded\" | \"loading-error\";\ntype ValidWalletState =\n | { status: \"not-loaded\" | \"in-progress\" }\n | { status: \"loaded\"; wallet: EVMSmartWallet }\n | { status: \"loading-error\"; error: SmartWalletError };\n\ntype WalletContext = {\n status: WalletStatus;\n wallet?: EVMSmartWallet;\n error?: SmartWalletError;\n getOrCreateWallet: (config?: WalletConfig) => { startedCreation: boolean; reason?: string };\n clearWallet: () => void;\n};\n\nexport const WalletContext = createContext<WalletContext>({\n status: \"not-loaded\",\n getOrCreateWallet: () => ({ startedCreation: false }),\n clearWallet: () => {},\n});\n\nexport type WalletConfig = WalletParams & { type: \"evm-smart-wallet\" };\n\nexport function CrossmintWalletProvider({\n children,\n defaultChain,\n}: {\n children: ReactNode;\n defaultChain: EVMSmartWalletChain;\n}) {\n const { crossmint } = useCrossmint(\"CrossmintWalletProvider must be used within CrossmintProvider\");\n const smartWalletSDK = useMemo(() => SmartWalletSDK.init({ clientApiKey: crossmint.apiKey }), [crossmint.apiKey]);\n\n const [state, setState] = useState<ValidWalletState>({ status: \"not-loaded\" });\n\n const getOrCreateWallet = (config: WalletConfig = { type: \"evm-smart-wallet\", signer: { type: \"PASSKEY\" } }) => {\n if (state.status == \"in-progress\") {\n console.log(\"Wallet already loading\");\n return { startedCreation: false, reason: \"Wallet is already loading.\" };\n }\n\n if (crossmint.jwt == null) {\n return { startedCreation: false, reason: `Jwt not set in \"CrossmintProvider\".` };\n }\n\n const internalCall = async () => {\n try {\n setState({ status: \"in-progress\" });\n const wallet = await smartWalletSDK.getOrCreateWallet(\n { jwt: crossmint.jwt as string },\n defaultChain,\n config\n );\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 internalCall();\n return { startedCreation: true };\n };\n\n const clearWallet = () => {\n setState({ status: \"not-loaded\" });\n };\n\n return (\n <WalletContext.Provider value={{ ...state, getOrCreateWallet, clearWallet }}>{children}</WalletContext.Provider>\n );\n}\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","import { useContext } from \"react\";\n\nimport { AuthContext } from \"../providers\";\n\nexport function useAuth() {\n const context = useContext(AuthContext);\n if (context === undefined) {\n throw new Error(\"useAuth must be used within an AuthProvider\");\n }\n return context;\n}\n","import { type ReactNode, createContext, useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport type { EVMSmartWalletChain } from \"@crossmint/client-sdk-smart-wallet\";\nimport { type UIConfig, validateApiKeyAndGetCrossmintBaseUrl } from \"@crossmint/common-sdk-base\";\n\nimport AuthModal from \"../components/auth/AuthModal\";\nimport { useCrossmint, useWallet } from \"../hooks\";\nimport { SESSION_PREFIX } from \"../utils\";\nimport { CrossmintWalletProvider } from \"./CrossmintWalletProvider\";\n\nexport type CrossmintAuthWalletConfig = {\n defaultChain: EVMSmartWalletChain;\n createOnLogin: \"all-users\" | \"off\";\n type: \"evm-smart-wallet\";\n};\n\nexport type CrossmintAuthProviderProps = {\n embeddedWallets: CrossmintAuthWalletConfig;\n appearance?: UIConfig;\n children: ReactNode;\n};\n\ntype AuthStatus = \"logged-in\" | \"logged-out\" | \"in-progress\";\n\ntype AuthContextType = {\n login: () => void;\n logout: () => void;\n jwt?: string;\n status: AuthStatus;\n};\n\nexport const AuthContext = createContext<AuthContextType>({\n login: () => {},\n logout: () => {},\n status: \"logged-out\",\n});\n\nexport function CrossmintAuthProvider({ embeddedWallets, children, appearance }: CrossmintAuthProviderProps) {\n const { crossmint, setJwt } = useCrossmint(\"CrossmintAuthProvider must be used within CrossmintProvider\");\n const crossmintBaseUrl = validateApiKeyAndGetCrossmintBaseUrl(crossmint.apiKey);\n const [modalOpen, setModalOpen] = useState(false);\n\n const login = () => {\n if (crossmint.jwt != null) {\n console.log(\"User already logged in\");\n return;\n }\n\n setModalOpen(true);\n };\n\n const logout = () => {\n document.cookie = `${SESSION_PREFIX}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;\n setJwt(undefined);\n };\n\n useEffect(() => {\n if (crossmint.jwt == null) {\n return;\n }\n\n setModalOpen(false);\n }, [crossmint.jwt]);\n\n useEffect(() => {\n if (crossmint.jwt) {\n document.cookie = `${SESSION_PREFIX}=${crossmint.jwt}; path=/;SameSite=Lax;`;\n }\n }, [crossmint.jwt]);\n\n const getAuthStatus = (): AuthStatus => {\n if (crossmint.jwt != null) {\n return \"logged-in\";\n }\n if (modalOpen) {\n return \"in-progress\";\n }\n return \"logged-out\";\n };\n\n return (\n <AuthContext.Provider\n value={{\n login,\n logout,\n jwt: crossmint.jwt,\n status: getAuthStatus(),\n }}\n >\n <CrossmintWalletProvider defaultChain={embeddedWallets.defaultChain}>\n <WalletManager embeddedWallets={embeddedWallets} accessToken={crossmint.jwt}>\n {children}\n </WalletManager>\n {modalOpen\n ? createPortal(\n <AuthModal\n baseUrl={crossmintBaseUrl}\n setModalOpen={setModalOpen}\n setJwtToken={setJwt}\n apiKey={crossmint.apiKey}\n appearance={appearance}\n />,\n\n document.body\n )\n : null}\n </CrossmintWalletProvider>\n </AuthContext.Provider>\n );\n}\n\nfunction WalletManager({\n embeddedWallets,\n children,\n accessToken,\n}: {\n embeddedWallets: CrossmintAuthWalletConfig;\n children: ReactNode;\n accessToken: string | undefined;\n}) {\n const { getOrCreateWallet, clearWallet, status } = useWallet();\n\n useEffect(() => {\n if (embeddedWallets.createOnLogin === \"all-users\" && status === \"not-loaded\" && accessToken != null) {\n getOrCreateWallet({\n type: embeddedWallets.type,\n signer: { type: \"PASSKEY\" },\n });\n }\n\n if (status === \"loaded\" && accessToken == null) {\n clearWallet();\n }\n }, [accessToken, status]);\n\n return <>{children}</>;\n}\n","import { Dialog, Transition } from \"@headlessui/react\";\nimport { CSSProperties, Fragment, useEffect, useRef, useState } from \"react\";\nimport { z } from \"zod\";\n\nimport { IFrameWindow } from \"@crossmint/client-sdk-window\";\nimport { UIConfig } from \"@crossmint/common-sdk-base\";\n\nimport X from \"../../icons/x\";\n\nconst incomingModalIframeEvents = {\n jwtToken: z.object({\n jwtToken: z.string(),\n }),\n};\n\nconst outgoingModalIframeEvents = {\n closeWindow: z.object({\n closeWindow: z.string(),\n }),\n};\n\ntype IncomingModalIframeEventsType = {\n jwtToken: typeof incomingModalIframeEvents.jwtToken;\n};\n\ntype OutgoingModalIframeEventsType = {\n closeWindow: typeof outgoingModalIframeEvents.closeWindow;\n};\n\ntype AuthModalProps = {\n setModalOpen: (open: boolean) => void;\n setJwtToken: (jwtToken: string) => void;\n apiKey: string;\n baseUrl: string;\n appearance?: UIConfig;\n};\n\nexport default function AuthModal({ setModalOpen, setJwtToken, apiKey, baseUrl, appearance }: AuthModalProps) {\n let iframeSrc = `${baseUrl}sdk/auth/frame?apiKey=${apiKey}`;\n if (appearance != null) {\n // The appearance object is serialized into a query parameter\n iframeSrc += `&uiConfig=${encodeURIComponent(JSON.stringify(appearance))}`;\n }\n\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const [iframe, setIframe] = useState<IFrameWindow<\n IncomingModalIframeEventsType,\n OutgoingModalIframeEventsType\n > | null>(null);\n\n useEffect(() => {\n if (iframe == null) {\n return;\n }\n\n iframe.on(\"jwtToken\", (data) => {\n setJwtToken(data.jwtToken);\n iframe.off(\"jwtToken\");\n\n iframe.send(\"closeWindow\", {\n closeWindow: \"closeWindow\",\n });\n\n if (iframe?.iframe.contentWindow != null) {\n iframe.iframe.contentWindow.close();\n }\n setModalOpen(false);\n });\n\n return () => {\n if (iframe) {\n iframe.off(\"jwtToken\");\n\n if (iframe.iframe.contentWindow != null) {\n iframe.iframe.contentWindow.close();\n }\n }\n };\n }, [iframe, setJwtToken, setModalOpen]);\n\n const handleIframeLoaded = async () => {\n if (iframeRef.current == null) {\n // The iframe should be load, here we should log on DD if possible\n console.error(\"Something wrong happened, please try again\");\n return;\n }\n\n const initIframe = await IFrameWindow.init(iframeRef.current, {\n incomingEvents: incomingModalIframeEvents,\n outgoingEvents: outgoingModalIframeEvents,\n });\n setIframe(initIframe);\n };\n\n return (\n <Transition.Root show as={Fragment}>\n <Dialog as=\"div\" style={styles.dialog} onClose={() => setModalOpen(false)}>\n <Transition.Child\n as={Fragment}\n enter=\"ease-out duration-400\"\n enterFrom=\"opacity-0\"\n enterTo=\"opacity-100\"\n leave=\"ease-in duration-400\"\n leaveFrom=\"opacity-100\"\n leaveTo=\"opacity-0\"\n >\n <div style={styles.transitionBegin} />\n </Transition.Child>\n <Transition.Child\n as={Fragment}\n enter=\"ease-out duration-400\"\n enterFrom=\"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95\"\n enterTo=\"opacity-100 translate-y-0 sm:scale-100\"\n leave=\"ease-in duration-400\"\n leaveFrom=\"opacity-100 translate-y-0 sm:scale-100\"\n leaveTo=\"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95\"\n >\n <div style={styles.transitionEnd} onClick={(e) => e.stopPropagation()}>\n <div style={{ position: \"relative\", width: \"100%\" }}>\n <button\n type=\"button\"\n aria-label=\"Close\"\n style={{\n width: \"1.5rem\",\n position: \"absolute\",\n right: \"1.5rem\",\n top: \"1.5rem\",\n cursor: \"pointer\",\n color: appearance?.colors?.border,\n outlineOffset: \"4px\",\n borderRadius: \"100%\",\n }}\n onClick={() => setModalOpen(false)}\n >\n <X />\n </button>\n </div>\n <iframe\n ref={iframeRef}\n src={iframeSrc}\n onLoad={handleIframeLoaded}\n title=\"Authentication Modal\"\n style={{\n width: \"100%\",\n height: \"500px\",\n border: `1px solid ${appearance?.colors?.border ?? \"#D0D5DD\"}`,\n borderRadius: appearance?.borderRadius ?? \"16px\",\n padding: \"48px 40px 32px\",\n backgroundColor: appearance?.colors?.background ?? \"#FFFFFF\",\n animation: \"fadeIn 3s ease-in-out\",\n }}\n />\n </div>\n </Transition.Child>\n </Dialog>\n </Transition.Root>\n );\n}\n\nconst styles: { [key: string]: CSSProperties } = {\n dialog: {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n overflowY: \"auto\",\n position: \"fixed\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 20,\n },\n transitionBegin: {\n background: \"rgba(139, 151, 151, 0.2)\",\n backdropFilter: \"blur(2px)\",\n position: \"fixed\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n transitionProperty: \"opacity\",\n transitionTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n transitionDuration: \"300ms\",\n zIndex: -10,\n },\n transitionEnd: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n width: \"100%\",\n maxWidth: \"448px\",\n borderRadius: \"0.75rem\",\n boxShadow: \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n zIndex: 30,\n },\n};\n","export default function X({ className }: { className?: string }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\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,OAA+B,6BCApE,IAAMC,EAAc,SDWnB,cAAAC,OAAA,oBAND,SAASC,GAA2BC,EAA+B,CACtEC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAwBH,EAAOI,CAAW,EAEtD,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,sBACT,CAER,CExBA,OAAS,qCAAAG,GAAmC,mBAAAC,OAAuB,6BAW3D,cAAAC,OAAA,oBAND,SAASC,GAAmBC,EAAuB,CACtDC,GAAkCD,CAAK,EAEvC,IAAME,EAAMC,GAAgBH,EAAOI,CAAW,EAE9C,OACIN,GAAC,UACG,IAAKI,EACL,MAAM,OACN,OAAO,OACP,MAAO,CACH,SAAU,IACV,OAAQ,OACR,OAAQ,IACR,QAAS,GACb,EACA,KAAK,cACT,CAER,CCxBA,OAEI,iCAAAG,GACA,+BAAAC,OACG,6BCJP,OAAsC,2CAAAC,OA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QY,EAAc,CAC1B,EAEA,SAAAnB,GAACoB,GAAA,CAAwB,aAAchB,EAAgB,aACnD,UAAAL,EAACsB,GAAA,CAAc,gBAAiBjB,EAAiB,YAAaG,EAAU,IACnE,SAAAF,EACL,EACCO,EACKU,GACIvB,EAACwB,EAAA,CACG,QAASb,EACT,aAAcG,EACd,YAAaL,EACb,OAAQD,EAAU,OAClB,WAAYD,EAChB,EAEA,SAAS,IACb,EACA,MACV,EACJ,CAER,CAEA,SAASe,GAAc,CACnB,gBAAAjB,EACA,SAAAC,EACA,YAAAmB,CACJ,EAIG,CACC,GAAM,CAAE,kBAAAC,EAAmB,YAAAC,EAAa,OAAAC,CAAO,EAAIC,GAAU,EAE7D,OAAAV,EAAU,IAAM,CACRd,EAAgB,gBAAkB,aAAeuB,IAAW,cAAgBH,GAAe,MAC3FC,EAAkB,CACd,KAAMrB,EAAgB,KACtB,OAAQ,CAAE,KAAM,SAAU,CAC9B,CAAC,EAGDuB,IAAW,UAAYH,GAAe,MACtCE,EAAY,CAEpB,EAAG,CAACF,EAAaG,CAAM,CAAC,EAEjB5B,EAAAD,GAAA,CAAG,SAAAO,EAAS,CACvB,CDrIO,SAASwB,IAAU,CACtB,IAAMC,EAAUC,GAAWC,CAAW,EACtC,GAAIF,IAAY,OACZ,MAAM,IAAI,MAAM,6CAA6C,EAEjE,OAAOA,CACX,CINA,OAAS,mBAAAG,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","createCrossmint","SESSION_PREFIX","getCachedJwt","crossmintSession","row","SESSION_PREFIX","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","useContext","createContext","useMemo","useState","SmartWalletError","SmartWalletSDK","jsx","WalletContext","createContext","CrossmintWalletProvider","children","defaultChain","crossmint","useCrossmint","smartWalletSDK","useMemo","SmartWalletSDK","state","setState","useState","getOrCreateWallet","config","__async","wallet","error","deriveErrorState","clearWallet","__spreadProps","__spreadValues","SmartWalletError","message","stack","useWallet","walletContext","useContext","WalletContext","useContext","createContext","useEffect","useState","createPortal","validateApiKeyAndGetCrossmintBaseUrl","Dialog","Transition","Fragment","useEffect","useRef","useState","z","IFrameWindow","jsx","jsxs","X","className","jsx","jsxs","incomingModalIframeEvents","z","outgoingModalIframeEvents","AuthModal","setModalOpen","setJwtToken","apiKey","baseUrl","appearance","_a","_b","_c","_d","_e","_f","iframeSrc","iframeRef","useRef","iframe","setIframe","useState","useEffect","data","handleIframeLoaded","__async","initIframe","IFrameWindow","Transition","Fragment","Dialog","styles","e","X","Fragment","jsx","jsxs","AuthContext","createContext","CrossmintAuthProvider","embeddedWallets","children","appearance","crossmint","setJwt","useCrossmint","crossmintBaseUrl","validateApiKeyAndGetCrossmintBaseUrl","modalOpen","setModalOpen","useState","login","logout","SESSION_PREFIX","useEffect","getAuthStatus","CrossmintWalletProvider","WalletManager","createPortal","AuthModal","accessToken","getOrCreateWallet","clearWallet","status","useWallet","useAuth","context","useContext","AuthContext","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.13",
3
+ "version": "1.3.15",
4
4
  "repository": "https://github.com/Crossmint/crossmint-sdk",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Paella Labs Inc",
@@ -20,21 +20,25 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@ethersproject/transactions": "5.7.0",
23
+ "@headlessui/react": "2.1.5",
23
24
  "@solana/web3.js": "1.95.1",
24
25
  "bs58": "5.0.0",
25
26
  "lodash.isequal": "4.5.0",
26
27
  "react-jss": "10.10.0",
27
- "@crossmint/client-sdk-auth-core": "1.1.5",
28
- "@crossmint/client-sdk-base": "1.2.5",
29
- "@crossmint/client-sdk-smart-wallet": "0.1.12",
30
- "@crossmint/common-sdk-base": "0.1.3"
28
+ "tailwindcss": "3.4.10",
29
+ "zod": "3.22.4",
30
+ "@crossmint/client-sdk-auth-core": "1.1.6",
31
+ "@crossmint/client-sdk-base": "1.2.6",
32
+ "@crossmint/client-sdk-smart-wallet": "0.1.13",
33
+ "@crossmint/client-sdk-window": "0.0.10",
34
+ "@crossmint/common-sdk-base": "0.1.4"
31
35
  },
32
36
  "devDependencies": {
33
37
  "@types/lodash.isequal": "4.5.6",
34
- "@types/react": "18.2.21",
35
- "@types/react-dom": "18.2.7",
36
- "react": "18.2.0",
37
- "react-dom": "18.2.0"
38
+ "@types/react": "^18.3.0",
39
+ "@types/react-dom": "^18.3.0",
40
+ "react": "^18.3.0",
41
+ "react-dom": "^18.3.0"
38
42
  },
39
43
  "peerDependencies": {
40
44
  "react": ">=17.0.2",
@@ -0,0 +1,196 @@
1
+ import { Dialog, Transition } from "@headlessui/react";
2
+ import { CSSProperties, Fragment, useEffect, useRef, useState } from "react";
3
+ import { z } from "zod";
4
+
5
+ import { IFrameWindow } from "@crossmint/client-sdk-window";
6
+ import { UIConfig } from "@crossmint/common-sdk-base";
7
+
8
+ import X from "../../icons/x";
9
+
10
+ const incomingModalIframeEvents = {
11
+ jwtToken: z.object({
12
+ jwtToken: z.string(),
13
+ }),
14
+ };
15
+
16
+ const outgoingModalIframeEvents = {
17
+ closeWindow: z.object({
18
+ closeWindow: z.string(),
19
+ }),
20
+ };
21
+
22
+ type IncomingModalIframeEventsType = {
23
+ jwtToken: typeof incomingModalIframeEvents.jwtToken;
24
+ };
25
+
26
+ type OutgoingModalIframeEventsType = {
27
+ closeWindow: typeof outgoingModalIframeEvents.closeWindow;
28
+ };
29
+
30
+ type AuthModalProps = {
31
+ setModalOpen: (open: boolean) => void;
32
+ setJwtToken: (jwtToken: string) => void;
33
+ apiKey: string;
34
+ baseUrl: string;
35
+ appearance?: UIConfig;
36
+ };
37
+
38
+ export default function AuthModal({ setModalOpen, setJwtToken, apiKey, baseUrl, appearance }: AuthModalProps) {
39
+ let iframeSrc = `${baseUrl}sdk/auth/frame?apiKey=${apiKey}`;
40
+ if (appearance != null) {
41
+ // The appearance object is serialized into a query parameter
42
+ iframeSrc += `&uiConfig=${encodeURIComponent(JSON.stringify(appearance))}`;
43
+ }
44
+
45
+ const iframeRef = useRef<HTMLIFrameElement | null>(null);
46
+ const [iframe, setIframe] = useState<IFrameWindow<
47
+ IncomingModalIframeEventsType,
48
+ OutgoingModalIframeEventsType
49
+ > | null>(null);
50
+
51
+ useEffect(() => {
52
+ if (iframe == null) {
53
+ return;
54
+ }
55
+
56
+ iframe.on("jwtToken", (data) => {
57
+ setJwtToken(data.jwtToken);
58
+ iframe.off("jwtToken");
59
+
60
+ iframe.send("closeWindow", {
61
+ closeWindow: "closeWindow",
62
+ });
63
+
64
+ if (iframe?.iframe.contentWindow != null) {
65
+ iframe.iframe.contentWindow.close();
66
+ }
67
+ setModalOpen(false);
68
+ });
69
+
70
+ return () => {
71
+ if (iframe) {
72
+ iframe.off("jwtToken");
73
+
74
+ if (iframe.iframe.contentWindow != null) {
75
+ iframe.iframe.contentWindow.close();
76
+ }
77
+ }
78
+ };
79
+ }, [iframe, setJwtToken, setModalOpen]);
80
+
81
+ const handleIframeLoaded = async () => {
82
+ if (iframeRef.current == null) {
83
+ // The iframe should be load, here we should log on DD if possible
84
+ console.error("Something wrong happened, please try again");
85
+ return;
86
+ }
87
+
88
+ const initIframe = await IFrameWindow.init(iframeRef.current, {
89
+ incomingEvents: incomingModalIframeEvents,
90
+ outgoingEvents: outgoingModalIframeEvents,
91
+ });
92
+ setIframe(initIframe);
93
+ };
94
+
95
+ return (
96
+ <Transition.Root show as={Fragment}>
97
+ <Dialog as="div" style={styles.dialog} onClose={() => setModalOpen(false)}>
98
+ <Transition.Child
99
+ as={Fragment}
100
+ enter="ease-out duration-400"
101
+ enterFrom="opacity-0"
102
+ enterTo="opacity-100"
103
+ leave="ease-in duration-400"
104
+ leaveFrom="opacity-100"
105
+ leaveTo="opacity-0"
106
+ >
107
+ <div style={styles.transitionBegin} />
108
+ </Transition.Child>
109
+ <Transition.Child
110
+ as={Fragment}
111
+ enter="ease-out duration-400"
112
+ enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
113
+ enterTo="opacity-100 translate-y-0 sm:scale-100"
114
+ leave="ease-in duration-400"
115
+ leaveFrom="opacity-100 translate-y-0 sm:scale-100"
116
+ leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
117
+ >
118
+ <div style={styles.transitionEnd} onClick={(e) => e.stopPropagation()}>
119
+ <div style={{ position: "relative", width: "100%" }}>
120
+ <button
121
+ type="button"
122
+ aria-label="Close"
123
+ style={{
124
+ width: "1.5rem",
125
+ position: "absolute",
126
+ right: "1.5rem",
127
+ top: "1.5rem",
128
+ cursor: "pointer",
129
+ color: appearance?.colors?.border,
130
+ outlineOffset: "4px",
131
+ borderRadius: "100%",
132
+ }}
133
+ onClick={() => setModalOpen(false)}
134
+ >
135
+ <X />
136
+ </button>
137
+ </div>
138
+ <iframe
139
+ ref={iframeRef}
140
+ src={iframeSrc}
141
+ onLoad={handleIframeLoaded}
142
+ title="Authentication Modal"
143
+ style={{
144
+ width: "100%",
145
+ height: "500px",
146
+ border: `1px solid ${appearance?.colors?.border ?? "#D0D5DD"}`,
147
+ borderRadius: appearance?.borderRadius ?? "16px",
148
+ padding: "48px 40px 32px",
149
+ backgroundColor: appearance?.colors?.background ?? "#FFFFFF",
150
+ animation: "fadeIn 3s ease-in-out",
151
+ }}
152
+ />
153
+ </div>
154
+ </Transition.Child>
155
+ </Dialog>
156
+ </Transition.Root>
157
+ );
158
+ }
159
+
160
+ const styles: { [key: string]: CSSProperties } = {
161
+ dialog: {
162
+ display: "flex",
163
+ justifyContent: "center",
164
+ alignItems: "center",
165
+ overflowY: "auto",
166
+ position: "fixed",
167
+ top: 0,
168
+ right: 0,
169
+ bottom: 0,
170
+ left: 0,
171
+ zIndex: 20,
172
+ },
173
+ transitionBegin: {
174
+ background: "rgba(139, 151, 151, 0.2)",
175
+ backdropFilter: "blur(2px)",
176
+ position: "fixed",
177
+ top: 0,
178
+ right: 0,
179
+ bottom: 0,
180
+ left: 0,
181
+ transitionProperty: "opacity",
182
+ transitionTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)",
183
+ transitionDuration: "300ms",
184
+ zIndex: -10,
185
+ },
186
+ transitionEnd: {
187
+ display: "flex",
188
+ flexDirection: "column",
189
+ alignItems: "center",
190
+ width: "100%",
191
+ maxWidth: "448px",
192
+ borderRadius: "0.75rem",
193
+ boxShadow: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
194
+ zIndex: 30,
195
+ },
196
+ };
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.3.13";
1
+ export const LIB_VERSION = "1.3.15";
@@ -1,3 +1,3 @@
1
1
  export * from "./useCrossmint";
2
2
  export * from "./useWallet";
3
- export { useAuth } from "@crossmint/client-sdk-auth-core/client";
3
+ export * from "./useAuth";
@@ -0,0 +1,11 @@
1
+ import { useContext } from "react";
2
+
3
+ import { AuthContext } from "../providers";
4
+
5
+ export function useAuth() {
6
+ const context = useContext(AuthContext);
7
+ if (context === undefined) {
8
+ throw new Error("useAuth must be used within an AuthProvider");
9
+ }
10
+ return context;
11
+ }
@@ -1,8 +1,9 @@
1
1
  import { ReactNode, createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
2
2
 
3
- import { getCachedJwt } from "@crossmint/client-sdk-auth-core/client";
4
3
  import { Crossmint, createCrossmint } from "@crossmint/common-sdk-base";
5
4
 
5
+ import { getCachedJwt } from "../utils";
6
+
6
7
  export interface CrossmintContext {
7
8
  crossmint: Crossmint;
8
9
  setJwt: (jwt: string | undefined) => void;
@@ -1,6 +1,7 @@
1
- import { WalletContext } from "@/providers/CrossmintWalletProvider";
2
1
  import { useContext } from "react";
3
2
 
3
+ import { WalletContext } from "../providers/CrossmintWalletProvider";
4
+
4
5
  export function useWallet() {
5
6
  const walletContext = useContext(WalletContext);
6
7
 
@@ -0,0 +1,19 @@
1
+ export default function X({ className }: { className?: string }) {
2
+ return (
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ stroke="currentColor"
10
+ strokeWidth="2"
11
+ strokeLinecap="round"
12
+ strokeLinejoin="round"
13
+ className={className}
14
+ >
15
+ <path d="M18 6 6 18" />
16
+ <path d="m6 6 12 12" />
17
+ </svg>
18
+ );
19
+ }