From 190eb87c93cbb051a07ac949775c9704f6de4511 Mon Sep 17 00:00:00 2001 From: corbanbrook Date: Tue, 23 Jul 2024 18:10:33 +0000 Subject: [PATCH] Build: (c704334) v2.10.1 (#109) * Adding getSequenceWaas function * Fix email auth * v2.10.1 --- ...owser-external_commonjs-proxy-B6QDVg13.js} | 2 +- assets/{ccip-Boe4tIR1.js => ccip-BwdTI8P7.js} | 2 +- ...e-CinlGc11.js => hooks.module-CR94OmzB.js} | 4 +- .../{index-1olVbLga.js => index-BlcKxWdd.js} | 212 +++++++++--------- .../{index-DjOIhZ-E.js => index-BzogsZNB.js} | 4 +- .../{index-dICBphlT.js => index-CRaiCr6n.js} | 6 +- .../{index-B4jQx5nQ.js => index-CYhkjJXl.js} | 6 +- .../{index-6EC68s6N.js => index-DioC5A7I.js} | 4 +- ...ex.es-DUc2iOhs.js => index.es-C5wqqseb.js} | 8 +- index.html | 2 +- 10 files changed, 121 insertions(+), 129 deletions(-) rename assets/{___vite-browser-external_commonjs-proxy-oQVq30mu.js => ___vite-browser-external_commonjs-proxy-B6QDVg13.js} (99%) rename assets/{ccip-Boe4tIR1.js => ccip-BwdTI8P7.js} (99%) rename assets/{hooks.module-CinlGc11.js => hooks.module-CR94OmzB.js} (99%) rename assets/{index-1olVbLga.js => index-BlcKxWdd.js} (99%) rename assets/{index-DjOIhZ-E.js => index-BzogsZNB.js} (99%) rename assets/{index-dICBphlT.js => index-CRaiCr6n.js} (99%) rename assets/{index-B4jQx5nQ.js => index-CYhkjJXl.js} (99%) rename assets/{index-6EC68s6N.js => index-DioC5A7I.js} (99%) rename assets/{index.es-DUc2iOhs.js => index.es-C5wqqseb.js} (99%) diff --git a/assets/___vite-browser-external_commonjs-proxy-oQVq30mu.js b/assets/___vite-browser-external_commonjs-proxy-B6QDVg13.js similarity index 99% rename from assets/___vite-browser-external_commonjs-proxy-oQVq30mu.js rename to assets/___vite-browser-external_commonjs-proxy-B6QDVg13.js index 9b00742a..209a9352 100644 --- a/assets/___vite-browser-external_commonjs-proxy-oQVq30mu.js +++ b/assets/___vite-browser-external_commonjs-proxy-B6QDVg13.js @@ -1,4 +1,4 @@ -import { g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./index-1olVbLga.js"; +import { g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./index-BlcKxWdd.js"; var events = { exports: {} }; var R = typeof Reflect === "object" ? Reflect : null; var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { diff --git a/assets/ccip-Boe4tIR1.js b/assets/ccip-BwdTI8P7.js similarity index 99% rename from assets/ccip-Boe4tIR1.js rename to assets/ccip-BwdTI8P7.js index e5ba244e..e8d212bf 100644 --- a/assets/ccip-Boe4tIR1.js +++ b/assets/ccip-BwdTI8P7.js @@ -1,4 +1,4 @@ -import { h as BaseError, j as getUrl, s as stringify, k as decodeErrorResult, l as isAddressEqual, m as call, n as concat, o as encodeAbiParameters, H as HttpRequestError, q as isHex } from "./index-1olVbLga.js"; +import { h as BaseError, j as getUrl, s as stringify, k as decodeErrorResult, l as isAddressEqual, m as call, n as concat, o as encodeAbiParameters, H as HttpRequestError, q as isHex } from "./index-BlcKxWdd.js"; class OffchainLookupError extends BaseError { constructor({ callbackSelector, cause, data, extraData, sender, urls }) { var _a; diff --git a/assets/hooks.module-CinlGc11.js b/assets/hooks.module-CR94OmzB.js similarity index 99% rename from assets/hooks.module-CinlGc11.js rename to assets/hooks.module-CR94OmzB.js index b1a1b83e..daf9045b 100644 --- a/assets/hooks.module-CinlGc11.js +++ b/assets/hooks.module-CR94OmzB.js @@ -1,5 +1,5 @@ -import { r as require$$2$1, p as process$1, c as commonjsGlobal, i as inherits_browserExports, B as Buffer$7, a as getAugmentedNamespace } from "./index-1olVbLga.js"; -import { e as eventsExports, r as require$$3 } from "./___vite-browser-external_commonjs-proxy-oQVq30mu.js"; +import { r as require$$2$1, p as process$1, c as commonjsGlobal, i as inherits_browserExports, B as Buffer$7, a as getAugmentedNamespace } from "./index-BlcKxWdd.js"; +import { e as eventsExports, r as require$$3 } from "./___vite-browser-external_commonjs-proxy-B6QDVg13.js"; var readableBrowser = { exports: {} }; var streamBrowser = eventsExports.EventEmitter; var buffer_list; diff --git a/assets/index-1olVbLga.js b/assets/index-BlcKxWdd.js similarity index 99% rename from assets/index-1olVbLga.js rename to assets/index-BlcKxWdd.js index 33f2836f..1aa36cd8 100644 --- a/assets/index-1olVbLga.js +++ b/assets/index-BlcKxWdd.js @@ -1,4 +1,4 @@ -const __vite__fileDeps=["./index-6EC68s6N.js","./hooks.module-CinlGc11.js","./___vite-browser-external_commonjs-proxy-oQVq30mu.js","./index-dICBphlT.js","./index.es-DUc2iOhs.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); +const __vite__fileDeps=["./index-DioC5A7I.js","./hooks.module-CR94OmzB.js","./___vite-browser-external_commonjs-proxy-B6QDVg13.js","./index-CRaiCr6n.js","./index.es-C5wqqseb.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); var __defProp = Object.defineProperty; var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; var __publicField = (obj, key2, value) => { @@ -74003,7 +74003,7 @@ async function call(client2, args) { return { data: response }; } catch (err) { const data2 = getRevertErrorData(err); - const { offchainLookup, offchainLookupSignature } = await __vitePreload(() => import("./ccip-Boe4tIR1.js"), true ? [] : void 0, import.meta.url); + const { offchainLookup, offchainLookupSignature } = await __vitePreload(() => import("./ccip-BwdTI8P7.js"), true ? [] : void 0, import.meta.url); if (client2.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature && to) return { data: await offchainLookup(client2, { data: data2, to }) }; throw getCallError(err, { @@ -84356,12 +84356,21 @@ function useEmailAuth({ connector, onSuccess }) { const [error, setError] = reactExports.useState(); const [loading, setLoading] = reactExports.useState(false); const [instance, setInstance] = reactExports.useState(""); + const getSequenceWaas = () => { + if (!connector) { + throw new Error("Connector is not defined"); + } + const sequenceWaas = connector.sequenceWaas; + if (!sequenceWaas) { + throw new Error("Connector does not support SequenceWaaS"); + } + return sequenceWaas; + }; const initiateAuth = async (email3) => { - var _a2; + const waas = getSequenceWaas(); setLoading(true); try { - const connectorAny = connector; - const { instance: instance2 } = await ((_a2 = connectorAny.sequenceWaas) == null ? void 0 : _a2.email.initiateAuth({ email: email3 })); + const { instance: instance2 } = await waas.email.initiateAuth({ email: email3 }); setInstance(instance2); setEmail(email3); } catch (e2) { @@ -84371,12 +84380,11 @@ function useEmailAuth({ connector, onSuccess }) { } }; const sendChallengeAnswer = async (answer) => { - var _a2, _b2; + const waas = getSequenceWaas(); setLoading(true); try { - const connectorAny = connector; - const sessionHash = await ((_a2 = connectorAny.sequenceWaas) == null ? void 0 : _a2.getSessionHash()); - const { idToken } = await ((_b2 = connectorAny.sequenceWaas) == null ? void 0 : _b2.email.finalizeAuth({ instance, answer, email: email2, sessionHash })); + const sessionHash = await waas.getSessionHash(); + const { idToken } = await waas.email.finalizeAuth({ instance, answer, email: email2, sessionHash }); onSuccess(idToken); } catch (e2) { setError(e2.message || "Unknown error"); @@ -84407,6 +84415,70 @@ var ValueType$2; const capitalize$1 = (word) => { return word.charAt(0).toUpperCase() + word.slice(1); }; +const BUTTON_SIZE = "14"; +const ICON_SIZE = "10"; +const getLogo = (theme, walletProps) => theme === "dark" ? walletProps.logoDark || walletProps.monochromeLogoDark : walletProps.logoLight || walletProps.monochromeLogoLight; +const ConnectButton = (props) => { + const { connector, label, onConnect } = props; + const { theme } = useTheme$1(); + const walletProps = connector._wallet; + const Logo = getLogo(theme, walletProps); + return jsxRuntimeExports$1.jsx(Tooltip, { message: label || walletProps.name, children: jsxRuntimeExports$1.jsx(Card, { clickable: true, width: BUTTON_SIZE, height: BUTTON_SIZE, padding: "2", borderRadius: "xs", justifyContent: "center", alignItems: "center", onClick: () => onConnect(connector), children: jsxRuntimeExports$1.jsx(Box, { as: Logo, width: ICON_SIZE, height: ICON_SIZE }) }) }); +}; +const GoogleWaasConnectButton = (props) => { + const { connector, onConnect } = props; + const storage = useStorage(); + const { data: sessionHash, isPending: isPendingNonce } = useStorageItem(LocalStorageKey.WaasSessionHash); + const [enableGoogleTooltip, setEnableGoogleTooltip] = reactExports.useState(false); + const { theme } = useTheme$1(); + const walletProps = connector._wallet; + const Logo = getLogo(theme, walletProps); + reactExports.useEffect(() => { + setTimeout(() => { + setEnableGoogleTooltip(true); + }, 300); + }); + return !isPendingNonce ? jsxRuntimeExports$1.jsx(Tooltip, { message: "Google", disabled: !enableGoogleTooltip, children: jsxRuntimeExports$1.jsxs(Card, { clickable: true, background: "transparent", borderRadius: "xs", padding: "0", width: BUTTON_SIZE, height: BUTTON_SIZE, position: "relative", children: [jsxRuntimeExports$1.jsx(Box, { width: "full", height: "full", overflow: "hidden", borderRadius: "sm", alignItems: "center", justifyContent: "center", style: { opacity: 1e-7, transform: "scale(1.4)" }, children: jsxRuntimeExports$1.jsx(GoogleLogin, { type: "icon", size: "large", width: "56", nonce: sessionHash, onSuccess: (credentialResponse) => { + if (credentialResponse.credential) { + storage == null ? void 0 : storage.setItem(LocalStorageKey.WaasGoogleIdToken, credentialResponse.credential); + onConnect(connector); + } + }, onError: () => { + console.log("Login Failed"); + } }) }), jsxRuntimeExports$1.jsx(Box, { background: "backgroundSecondary", borderRadius: "xs", display: "flex", justifyContent: "center", alignItems: "center", position: "absolute", pointerEvents: "none", width: "full", height: "full", top: "0", right: "0", children: jsxRuntimeExports$1.jsx(Box, { as: Logo, width: ICON_SIZE, height: ICON_SIZE }) })] }) }) : null; +}; +const AppleWaasConnectButton = (props) => { + const { connector, onConnect } = props; + const storage = useStorage(); + const { data: sessionHash, isPending: isPendingNonce } = useStorageItem(LocalStorageKey.WaasSessionHash); + const { data: appleClientId2 } = useStorageItem(LocalStorageKey.WaasAppleClientID); + const { data: appleRedirectUri } = useStorageItem(LocalStorageKey.WaasAppleRedirectURI); + return !isPendingNonce && appleClientId2 && appleRedirectUri ? jsxRuntimeExports$1.jsx(ConnectButton, { connector, onConnect: () => { + dist.appleAuthHelpers.signIn({ + authOptions: { + clientId: appleClientId2, + redirectURI: appleRedirectUri, + nonce: sessionHash, + scope: "openid email", + usePopup: true + }, + onSuccess: (response) => { + var _a2; + if ((_a2 = response.authorization) == null ? void 0 : _a2.id_token) { + storage == null ? void 0 : storage.setItem(LocalStorageKey.WaasAppleIdToken, response.authorization.id_token); + onConnect(connector); + } else { + console.log("Apple login error: No id_token found"); + } + }, + onError: (error) => console.error(error) + }); + } }) : null; +}; +const EmailConnectButton = (props) => { + const { onClick } = props; + return jsxRuntimeExports$1.jsx(Tooltip, { message: "Email", children: jsxRuntimeExports$1.jsx(Card, { clickable: true, width: BUTTON_SIZE, height: BUTTON_SIZE, padding: "2", borderRadius: "xs", justifyContent: "center", alignItems: "center", onClick, children: jsxRuntimeExports$1.jsx(SvgEmailIcon, { size: "xl", color: "text100" }) }) }); +}; const Banner = ({ config: config2 = {} }) => { const { signIn: signIn3 = {} } = config2; const { logoUrl } = signIn3; @@ -84432,33 +84504,25 @@ const ConnectWalletContent = (props) => { const [email2, setEmail] = reactExports.useState(""); const [showEmailInput, setShowEmailInput] = reactExports.useState(false); const [showEmailWaasPinInput, setShowEmailWaasPinInput] = reactExports.useState(false); + const [showExtendedList, setShowExtendedList] = reactExports.useState(false); const [waasEmailPinCode, setWaasEmailPinCode] = reactExports.useState([]); - const { connectors: baseConnectors, connect: connect2 } = useConnect(); - const injectedSequenceConnector = baseConnectors.find((c2) => c2.id === "app.sequence"); - const baseWalletConnectors = baseConnectors.filter((c2) => { - var _a2, _b2; - const isWalletProperties = !!(c2 == null ? void 0 : c2._wallet); - const isWallet = (((_a2 = c2 == null ? void 0 : c2._wallet) == null ? void 0 : _a2.type) || "wallet") === "wallet"; - const displayEmailConnector = ((_b2 = c2 == null ? void 0 : c2._wallet) == null ? void 0 : _b2.id) === "email"; - return isWalletProperties && (isWallet || displayEmailConnector); + const { connectors, connect: connect2 } = useConnect(); + const hasInjectedSequenceConnector = connectors.some((c2) => c2.id === "app.sequence"); + const baseWalletConnectors = connectors.filter((c2) => { + return c2._wallet && (c2._wallet.type === "wallet" || c2._wallet.type === void 0); }).filter((c2) => { var _a2; - if (((_a2 = c2 == null ? void 0 : c2._wallet) == null ? void 0 : _a2.id) === "sequence" && injectedSequenceConnector) { + if (((_a2 = c2._wallet) == null ? void 0 : _a2.id) === "sequence" && hasInjectedSequenceConnector) { return false; } return true; }); - const [showExtendedList, setShowExtendedList] = reactExports.useState(false); const mockConnector = baseWalletConnectors.find((connector) => { return connector._wallet.id === "mock"; }); - const emailConnector = baseConnectors.find((c2) => { - var _a2; - return (_a2 = c2 == null ? void 0 : c2._wallet) == null ? void 0 : _a2.id.includes("email"); - }); - const injectedConnectors = baseConnectors.filter((c2) => c2.type === "injected").filter((connector) => { + const injectedConnectors = connectors.filter((c2) => c2.type === "injected").filter((connector) => { if (connector.id === "com.coinbase.wallet") { - return !baseConnectors.find((connector2) => { + return !connectors.find((connector2) => { var _a2; return ((_a2 = connector2 == null ? void 0 : connector2._wallet) == null ? void 0 : _a2.id) === "coinbase-wallet"; }); @@ -84479,24 +84543,19 @@ const ConnectWalletContent = (props) => { } }; }); - const walletConnectors = [ - ...baseWalletConnectors, - ...injectedConnectors - ]; - const socialAuthConnectors = baseConnectors.filter((c2) => { + const socialAuthConnectors = connectors.filter((c2) => { var _a2; - return ((_a2 = c2 == null ? void 0 : c2._wallet) == null ? void 0 : _a2.type) === "social"; - }).filter((c2) => { - var _a2, _b2; - return !((_b2 = (_a2 = c2 == null ? void 0 : c2._wallet) == null ? void 0 : _a2.id) == null ? void 0 : _b2.includes("email")); + return ((_a2 = c2._wallet) == null ? void 0 : _a2.type) === "social"; }); - const isEmailOnly = emailConnector && socialAuthConnectors.length === 0 && walletConnectors.length === 0; + const walletConnectors = [...baseWalletConnectors, ...injectedConnectors]; + const emailConnector = socialAuthConnectors.find((c2) => c2._wallet.id.includes("email")); + const isEmailOnly = emailConnector && socialAuthConnectors.length === 1 && walletConnectors.length === 0; const displayExtendedListButton = walletConnectors.length > 7; const onChangeEmail = (ev) => { setEmail(ev.target.value); }; const { inProgress: emailAuthInProgress, loading: emailAuthLoading, initiateAuth: initiateEmailAuth, sendChallengeAnswer } = useEmailAuth({ - connector: baseWalletConnectors.find((c2) => c2._wallet.id === "email-waas"), + connector: socialAuthConnectors.find((c2) => c2._wallet.id === "email-waas"), onSuccess: async (idToken) => { storage == null ? void 0 : storage.setItem(LocalStorageKey.WaasEmailIdToken, idToken); if (emailConnector) { @@ -84550,79 +84609,12 @@ const ConnectWalletContent = (props) => { if (showExtendedList) { return jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsx(Box, { position: "absolute", top: "4", children: jsxRuntimeExports$1.jsx(IconButton, { icon: SvgChevronLeftIcon, onClick: () => setShowExtendedList(false), size: "xs" }) }), jsxRuntimeExports$1.jsx(ExtendedWalletList, { connectors: walletConnectors, onConnect })] }); } - return jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsx(Banner, { config: config2 }), jsxRuntimeExports$1.jsx(Box, { marginTop: "6", children: emailConnector && (showEmailInput || isEmailOnly) ? jsxRuntimeExports$1.jsxs("form", { onSubmit: onConnectInlineEmail, children: [jsxRuntimeExports$1.jsx(TextInput, { onChange: onChangeEmail, value: email2, name: "email", placeholder: "Enter email", "data-1p-ignore": true }), jsxRuntimeExports$1.jsxs(Box, { alignItems: "center", justifyContent: "center", marginTop: "4", children: [!emailAuthInProgress && jsxRuntimeExports$1.jsxs(Box, { gap: "2", width: "full", children: [!isEmailOnly && jsxRuntimeExports$1.jsx(Button, { label: "Back", width: "full", onClick: () => setShowEmailInput(false) }), jsxRuntimeExports$1.jsx(Button, { type: "submit", variant: "primary", disabled: !isEmailValid(email2), width: "full", label: "Continue", rightIcon: SvgChevronRightIcon })] }), emailAuthInProgress && jsxRuntimeExports$1.jsx(Spinner, {})] })] }) : jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [(emailConnector || socialAuthConnectors.length > 0) && jsxRuntimeExports$1.jsxs(Box, { marginTop: "2", gap: "2", flexDirection: "row", justifyContent: "center", alignItems: "center", flexWrap: "wrap", children: [socialAuthConnectors.map((connector) => { - return jsxRuntimeExports$1.jsxs(Box, { aspectRatio: "1/1", alignItems: "center", justifyContent: "center", children: [connector._wallet.id === "google-waas" && jsxRuntimeExports$1.jsx(GoogleWaasConnectButton, { connector, onConnect }), connector._wallet.id === "apple-waas" && jsxRuntimeExports$1.jsx(AppleWaasConnectButton, { connector, onConnect }), !connector._wallet.id.includes("waas") && jsxRuntimeExports$1.jsx(ConnectButton, { connector, onConnect })] }, connector.uid); - }), emailConnector && jsxRuntimeExports$1.jsx(Box, { aspectRatio: "1/1", alignItems: "center", justifyContent: "center", children: jsxRuntimeExports$1.jsx(EmailConnectButton, { onClick: () => setShowEmailInput(true) }) })] }), walletConnectors.length > 0 && jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [(emailConnector || socialAuthConnectors.length > 0) && jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsx(Divider, { color: "backgroundSecondary" }), jsxRuntimeExports$1.jsx(Box, { justifyContent: "center", alignItems: "center", children: jsxRuntimeExports$1.jsx(Text, { variant: "small", color: "text50", children: "or select a wallet" }) })] }), jsxRuntimeExports$1.jsx(Box, { marginTop: "2", gap: "2", flexDirection: "row", justifyContent: "center", alignItems: "center", children: walletConnectors.slice(0, 7).map((connector) => { - if (connector._wallet.id === "email" || connector._wallet.id === "email-waas") { - return null; - } + return jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsx(Banner, { config: config2 }), jsxRuntimeExports$1.jsx(Box, { marginTop: "6", children: emailConnector && (showEmailInput || isEmailOnly) ? jsxRuntimeExports$1.jsxs("form", { onSubmit: onConnectInlineEmail, children: [jsxRuntimeExports$1.jsx(TextInput, { onChange: onChangeEmail, value: email2, name: "email", placeholder: "Enter email", "data-1p-ignore": true }), jsxRuntimeExports$1.jsxs(Box, { alignItems: "center", justifyContent: "center", marginTop: "4", children: [!emailAuthInProgress && jsxRuntimeExports$1.jsxs(Box, { gap: "2", width: "full", children: [!isEmailOnly && jsxRuntimeExports$1.jsx(Button, { label: "Back", width: "full", onClick: () => setShowEmailInput(false) }), jsxRuntimeExports$1.jsx(Button, { type: "submit", variant: "primary", disabled: !isEmailValid(email2), width: "full", label: "Continue", rightIcon: SvgChevronRightIcon })] }), emailAuthInProgress && jsxRuntimeExports$1.jsx(Spinner, {})] })] }) : jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [socialAuthConnectors.length > 0 && jsxRuntimeExports$1.jsx(Box, { marginTop: "2", gap: "2", flexDirection: "row", justifyContent: "center", alignItems: "center", flexWrap: "wrap", children: socialAuthConnectors.map((connector) => { + return jsxRuntimeExports$1.jsx(Box, { aspectRatio: "1/1", alignItems: "center", justifyContent: "center", children: connector._wallet.id === "google-waas" ? jsxRuntimeExports$1.jsx(GoogleWaasConnectButton, { connector, onConnect }) : connector._wallet.id === "apple-waas" ? jsxRuntimeExports$1.jsx(AppleWaasConnectButton, { connector, onConnect }) : connector._wallet.id.includes("email") ? jsxRuntimeExports$1.jsx(EmailConnectButton, { onClick: () => setShowEmailInput(true) }) : jsxRuntimeExports$1.jsx(ConnectButton, { connector, onConnect }) }, connector.uid); + }) }), walletConnectors.length > 0 && jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [socialAuthConnectors.length > 0 && jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsx(Divider, { color: "backgroundSecondary" }), jsxRuntimeExports$1.jsx(Box, { justifyContent: "center", alignItems: "center", children: jsxRuntimeExports$1.jsx(Text, { variant: "small", color: "text50", children: "or select a wallet" }) })] }), jsxRuntimeExports$1.jsx(Box, { marginTop: "2", gap: "2", flexDirection: "row", justifyContent: "center", alignItems: "center", children: walletConnectors.slice(0, 7).map((connector) => { return jsxRuntimeExports$1.jsx(ConnectButton, { connector, onConnect }, connector.uid); }) }), displayExtendedListButton && jsxRuntimeExports$1.jsx(Box, { marginTop: "4", justifyContent: "center", children: jsxRuntimeExports$1.jsx(Button, { shape: "square", size: "xs", onClick: () => setShowExtendedList(true), label: "More options", rightIcon: SvgChevronRightIcon }) })] })] }) })] }); }; -const BUTTON_SIZE = "14"; -const ICON_SIZE = "10"; -const ConnectButton = (props) => { - const { connector, label, onConnect } = props; - const { theme } = useTheme$1(); - const walletProps = connector._wallet; - const Logo = getLogo(theme, walletProps); - return jsxRuntimeExports$1.jsx(Tooltip, { message: label || walletProps.name, children: jsxRuntimeExports$1.jsx(Card, { clickable: true, width: BUTTON_SIZE, height: BUTTON_SIZE, padding: "2", borderRadius: "xs", justifyContent: "center", alignItems: "center", onClick: () => onConnect(connector), children: jsxRuntimeExports$1.jsx(Box, { as: Logo, width: ICON_SIZE, height: ICON_SIZE }) }) }); -}; -const GoogleWaasConnectButton = (props) => { - const { connector, onConnect } = props; - const storage = useStorage(); - const { data: sessionHash, isPending: isPendingNonce } = useStorageItem(LocalStorageKey.WaasSessionHash); - const [enableGoogleTooltip, setEnableGoogleTooltip] = reactExports.useState(false); - const { theme } = useTheme$1(); - const walletProps = connector._wallet; - const Logo = getLogo(theme, walletProps); - reactExports.useEffect(() => { - setTimeout(() => { - setEnableGoogleTooltip(true); - }, 300); - }); - return !isPendingNonce ? jsxRuntimeExports$1.jsx(Tooltip, { message: "Google", disabled: !enableGoogleTooltip, children: jsxRuntimeExports$1.jsxs(Card, { clickable: true, background: "transparent", borderRadius: "xs", padding: "0", width: BUTTON_SIZE, height: BUTTON_SIZE, position: "relative", children: [jsxRuntimeExports$1.jsx(Box, { width: "full", height: "full", overflow: "hidden", borderRadius: "sm", alignItems: "center", justifyContent: "center", style: { opacity: 1e-7, transform: "scale(1.4)" }, children: jsxRuntimeExports$1.jsx(GoogleLogin, { type: "icon", size: "large", width: "56", nonce: sessionHash, onSuccess: (credentialResponse) => { - if (credentialResponse.credential) { - storage == null ? void 0 : storage.setItem(LocalStorageKey.WaasGoogleIdToken, credentialResponse.credential); - onConnect(connector); - } - }, onError: () => { - console.log("Login Failed"); - } }) }), jsxRuntimeExports$1.jsx(Box, { background: "backgroundSecondary", borderRadius: "xs", display: "flex", justifyContent: "center", alignItems: "center", position: "absolute", pointerEvents: "none", width: "full", height: "full", top: "0", right: "0", children: jsxRuntimeExports$1.jsx(Box, { as: Logo, width: ICON_SIZE, height: ICON_SIZE }) })] }) }) : null; -}; -const AppleWaasConnectButton = (props) => { - const { connector, onConnect } = props; - const storage = useStorage(); - const { data: sessionHash, isPending: isPendingNonce } = useStorageItem(LocalStorageKey.WaasSessionHash); - const { data: appleClientId2 } = useStorageItem(LocalStorageKey.WaasAppleClientID); - const { data: appleRedirectUri } = useStorageItem(LocalStorageKey.WaasAppleRedirectURI); - return !isPendingNonce && appleClientId2 && appleRedirectUri ? jsxRuntimeExports$1.jsx(ConnectButton, { connector, onConnect: () => { - dist.appleAuthHelpers.signIn({ - authOptions: { - clientId: appleClientId2, - redirectURI: appleRedirectUri, - nonce: sessionHash, - scope: "openid email", - usePopup: true - }, - onSuccess: (response) => { - var _a2; - if ((_a2 = response.authorization) == null ? void 0 : _a2.id_token) { - storage == null ? void 0 : storage.setItem(LocalStorageKey.WaasAppleIdToken, response.authorization.id_token); - onConnect(connector); - } else { - console.log("Apple login error: No id_token found"); - } - }, - onError: (error) => console.error(error) - }); - } }) : null; -}; -const EmailConnectButton = (props) => { - const { onClick } = props; - return jsxRuntimeExports$1.jsx(Tooltip, { message: "Email", children: jsxRuntimeExports$1.jsx(Card, { clickable: true, width: BUTTON_SIZE, height: BUTTON_SIZE, padding: "2", borderRadius: "xs", justifyContent: "center", alignItems: "center", onClick, children: jsxRuntimeExports$1.jsx(SvgEmailIcon, { size: "xl", color: "text100" }) }) }); -}; -const getLogo = (theme, walletProps) => theme === "dark" ? walletProps.logoDark || walletProps.monochromeLogoDark : walletProps.logoLight || walletProps.monochromeLogoLight; const getNetworkColor = (chainId, mode = "light") => { switch (chainId) { case ChainId.MAINNET: @@ -96920,7 +96912,7 @@ function version4(parameters) { }, async getProvider() { if (!walletProvider) { - const { default: CoinbaseSDK_ } = await __vitePreload(() => import("./index-6EC68s6N.js").then((n2) => n2.i), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); + const { default: CoinbaseSDK_ } = await __vitePreload(() => import("./index-DioC5A7I.js").then((n2) => n2.i), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); const CoinbaseSDK = (() => { if (typeof CoinbaseSDK_ !== "function" && typeof CoinbaseSDK_.default === "function") return CoinbaseSDK_.default; @@ -97097,7 +97089,7 @@ function version3(parameters) { async getProvider() { var _a2; if (!walletProvider) { - const { default: SDK_ } = await __vitePreload(() => import("./index-dICBphlT.js").then((n2) => n2.i), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url); + const { default: SDK_ } = await __vitePreload(() => import("./index-CRaiCr6n.js").then((n2) => n2.i), true ? __vite__mapDeps([3,1,2]) : void 0, import.meta.url); let SDK; if (typeof SDK_ !== "function" && typeof SDK_.default === "function") SDK = SDK_.default; @@ -97331,7 +97323,7 @@ function walletConnect$1(parameters) { const optionalChains = config2.chains.map((x) => x.id); if (!optionalChains.length) return; - const { EthereumProvider } = await __vitePreload(() => import("./index.es-DUc2iOhs.js"), true ? __vite__mapDeps([4,2]) : void 0, import.meta.url); + const { EthereumProvider } = await __vitePreload(() => import("./index.es-C5wqqseb.js"), true ? __vite__mapDeps([4,2]) : void 0, import.meta.url); return await EthereumProvider.init({ ...parameters, disableProviderPing: true, @@ -108605,7 +108597,7 @@ const queryClient = new QueryClient(); const App = () => { return /* @__PURE__ */ jsxRuntimeExports$1.jsx(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(KitProvider, { config: kitConfig, children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(KitWalletProvider, { children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(KitCheckoutProvider, { children: /* @__PURE__ */ jsxRuntimeExports$1.jsx("div", { id: "app", children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(ThemeProvider, { root: "#app", scope: "app", theme: "dark", children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(Homepage, {}) }) }) }) }) }) }) }); }; -console.log("VERSION:", "0.7.13"); +console.log("VERSION:", "0.7.14"); const root = client.createRoot(document.getElementById("root")); root.render( /* @__PURE__ */ jsxRuntimeExports$1.jsx(React.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports$1.jsx(App, {}) }) diff --git a/assets/index-DjOIhZ-E.js b/assets/index-BzogsZNB.js similarity index 99% rename from assets/index-DjOIhZ-E.js rename to assets/index-BzogsZNB.js index c8ee1e18..0df15b44 100644 --- a/assets/index-DjOIhZ-E.js +++ b/assets/index-BzogsZNB.js @@ -1,5 +1,5 @@ -import { n as ne$1, s as se$1, T as T$2, t as te$1, a as a$2, o as oe$1, R as R$1, p as p$1, y as y$1 } from "./index-B4jQx5nQ.js"; -import "./index-1olVbLga.js"; +import { n as ne$1, s as se$1, T as T$2, t as te$1, a as a$2, o as oe$1, R as R$1, p as p$1, y as y$1 } from "./index-CYhkjJXl.js"; +import "./index-BlcKxWdd.js"; function addUniqueItem(array, item) { array.indexOf(item) === -1 && array.push(item); } diff --git a/assets/index-dICBphlT.js b/assets/index-CRaiCr6n.js similarity index 99% rename from assets/index-dICBphlT.js rename to assets/index-CRaiCr6n.js index a50ef2f4..26ade632 100644 --- a/assets/index-dICBphlT.js +++ b/assets/index-CRaiCr6n.js @@ -1,6 +1,6 @@ -import { c as commonjsGlobal, b as bnExports, B as Buffer, a as getAugmentedNamespace, p as process$1, t as tslib_es6, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-1olVbLga.js"; -import { s as sha_jsExports, a as require$$1$1, b as require$$2, r as require$$0$1, j as js } from "./hooks.module-CinlGc11.js"; -import { e as eventsExports } from "./___vite-browser-external_commonjs-proxy-oQVq30mu.js"; +import { c as commonjsGlobal, b as bnExports, B as Buffer, a as getAugmentedNamespace, p as process$1, t as tslib_es6, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-BlcKxWdd.js"; +import { s as sha_jsExports, a as require$$1$1, b as require$$2, r as require$$0$1, j as js } from "./hooks.module-CR94OmzB.js"; +import { e as eventsExports } from "./___vite-browser-external_commonjs-proxy-B6QDVg13.js"; function _mergeNamespaces(n, m) { for (var i = 0; i < m.length; i++) { const e = m[i]; diff --git a/assets/index-B4jQx5nQ.js b/assets/index-CYhkjJXl.js similarity index 99% rename from assets/index-B4jQx5nQ.js rename to assets/index-CYhkjJXl.js index 18225a40..a05c82d8 100644 --- a/assets/index-B4jQx5nQ.js +++ b/assets/index-CYhkjJXl.js @@ -1,5 +1,5 @@ -const __vite__fileDeps=["./index-DjOIhZ-E.js","./index-1olVbLga.js","./index-KxIcnz1U.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); -import { _ as __vitePreload } from "./index-1olVbLga.js"; +const __vite__fileDeps=["./index-BzogsZNB.js","./index-BlcKxWdd.js","./index-KxIcnz1U.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); +import { _ as __vitePreload } from "./index-BlcKxWdd.js"; const t = Symbol(); const s = Object.getPrototypeOf, c$1 = /* @__PURE__ */ new WeakMap(), l = (e) => e && (c$1.has(e) ? c$1.get(e) : s(e) === Object.prototype || s(e) === Array.prototype), y$1 = (e) => l(e) && e[t] || null, h = (e, t2 = true) => { c$1.set(e, t2); @@ -487,7 +487,7 @@ class d { } async initUi() { if (typeof window < "u") { - await __vitePreload(() => import("./index-DjOIhZ-E.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-BzogsZNB.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); const e = document.createElement("wcm-modal"); document.body.insertAdjacentElement("beforeend", e), p.setIsUiLoaded(true); } diff --git a/assets/index-6EC68s6N.js b/assets/index-DioC5A7I.js similarity index 99% rename from assets/index-6EC68s6N.js rename to assets/index-DioC5A7I.js index df792475..d2bd5ee8 100644 --- a/assets/index-6EC68s6N.js +++ b/assets/index-DioC5A7I.js @@ -1,5 +1,5 @@ -import { B as Buffer, c as commonjsGlobal, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-1olVbLga.js"; -import { j as js, s as sha_jsExports, r as require$$0, a as require$$1, b as require$$2 } from "./hooks.module-CinlGc11.js"; +import { B as Buffer, c as commonjsGlobal, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-BlcKxWdd.js"; +import { j as js, s as sha_jsExports, r as require$$0, a as require$$1, b as require$$2 } from "./hooks.module-CR94OmzB.js"; function _mergeNamespaces(n, m) { for (var i = 0; i < m.length; i++) { const e = m[i]; diff --git a/assets/index.es-DUc2iOhs.js b/assets/index.es-C5wqqseb.js similarity index 99% rename from assets/index.es-DUc2iOhs.js rename to assets/index.es-C5wqqseb.js index 2eb5d0ac..e3d45558 100644 --- a/assets/index.es-DUc2iOhs.js +++ b/assets/index.es-C5wqqseb.js @@ -1,6 +1,6 @@ -const __vite__fileDeps=["./index-B4jQx5nQ.js","./index-1olVbLga.js","./index-KxIcnz1U.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); -import { p as process$1, d as require$$0$1, f as global, B as Buffer, g as getDefaultExportFromCjs, c as commonjsGlobal, a as getAugmentedNamespace, _ as __vitePreload } from "./index-1olVbLga.js"; -import { r as require$$3, e as eventsExports, W as Wg } from "./___vite-browser-external_commonjs-proxy-oQVq30mu.js"; +const __vite__fileDeps=["./index-CYhkjJXl.js","./index-BlcKxWdd.js","./index-KxIcnz1U.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); +import { p as process$1, d as require$$0$1, f as global, B as Buffer, g as getDefaultExportFromCjs, c as commonjsGlobal, a as getAugmentedNamespace, _ as __vitePreload } from "./index-BlcKxWdd.js"; +import { r as require$$3, e as eventsExports, W as Wg } from "./___vite-browser-external_commonjs-proxy-B6QDVg13.js"; var __spreadArray = function(to2, from2, pack) { if (pack || arguments.length === 2) for (var i3 = 0, l2 = from2.length, ar2; i3 < l2; i3++) { @@ -19748,7 +19748,7 @@ class C { if (this.rpc = this.getRpcConfig(t), this.chainId = this.rpc.chains.length ? m2(this.rpc.chains) : m2(this.rpc.optionalChains), this.signer = await hv.init({ projectId: this.rpc.projectId, metadata: this.rpc.metadata, disableProviderPing: t.disableProviderPing, relayUrl: t.relayUrl, storageOptions: t.storageOptions }), this.registerEventListeners(), await this.loadPersistedSession(), this.rpc.showQrModal) { let s2; try { - const { WalletConnectModal: i3 } = await __vitePreload(() => import("./index-B4jQx5nQ.js").then((n4) => n4.i), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); + const { WalletConnectModal: i3 } = await __vitePreload(() => import("./index-CYhkjJXl.js").then((n4) => n4.i), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); s2 = i3; } catch { throw new Error("To use QR modal, please install @walletconnect/modal package"); diff --git a/index.html b/index.html index 0012ff86..87b50e6b 100644 --- a/index.html +++ b/index.html @@ -24,7 +24,7 @@ Learn how to configure a non-root public URL by running `npm run build`. --> Sequence Kit Demo - +