From 404a765b7ddf7c9b670014657000c419761ce8b7 Mon Sep 17 00:00:00 2001 From: samuelea Date: Fri, 10 May 2024 14:54:39 -0400 Subject: [PATCH 1/4] google button --- ....timestamp-1715364539653-a9974b0d24473.mjs | 45 ++++++++++++ .../ConnectWalletContent/GoogleLogo.tsx | 13 ++++ .../ConnectWalletContent/index.tsx | 70 +++++++++++++++---- 3 files changed, 114 insertions(+), 14 deletions(-) create mode 100644 examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs create mode 100644 packages/kit/src/components/KitProvider/ConnectWalletContent/GoogleLogo.tsx diff --git a/examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs b/examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs new file mode 100644 index 00000000..5effa665 --- /dev/null +++ b/examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs @@ -0,0 +1,45 @@ +// vite.config.js +import { defineConfig } from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite@5.2.11_@types+node@20.12.11_terser@5.31.0/node_modules/vite/dist/node/index.js"; +import dns from "dns"; +import react from "file:///home/samuele/repos/kit/node_modules/.pnpm/@vitejs+plugin-react@4.2.1_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/@vitejs/plugin-react/dist/index.mjs"; +import { nodePolyfills } from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite-plugin-node-polyfills@0.21.0_rollup@4.17.2_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/vite-plugin-node-polyfills/dist/index.js"; +import viteTsconfigPaths from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite-tsconfig-paths@4.3.2_typescript@5.4.5_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/vite-tsconfig-paths/dist/index.mjs"; +import svgrPlugin from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite-plugin-svgr@4.2.0_rollup@4.17.2_typescript@5.4.5_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/vite-plugin-svgr/dist/index.js"; +dns.setDefaultResultOrder("verbatim"); +var vite_config_default = defineConfig(() => { + return { + plugins: [ + react(), + nodePolyfills({ + include: ["buffer"], + globals: { + Buffer: true + } + }), + viteTsconfigPaths(), + svgrPlugin() + ], + define: { + "process.env.PACKAGE_VERSION": JSON.stringify(process.env.npm_package_version) + }, + resolve: { + dedupe: ["wagmi", "viem"] + }, + build: { + minify: false + }, + server: { + minify: false, + port: 4444, + fs: { + // Allow serving files from one level up to the project root + allow: [".."] + } + }, + base: "" + }; +}); +export { + vite_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcuanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvaG9tZS9zYW11ZWxlL3JlcG9zL2tpdC9leGFtcGxlcy9yZWFjdFwiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9maWxlbmFtZSA9IFwiL2hvbWUvc2FtdWVsZS9yZXBvcy9raXQvZXhhbXBsZXMvcmVhY3Qvdml0ZS5jb25maWcuanNcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfaW1wb3J0X21ldGFfdXJsID0gXCJmaWxlOi8vL2hvbWUvc2FtdWVsZS9yZXBvcy9raXQvZXhhbXBsZXMvcmVhY3Qvdml0ZS5jb25maWcuanNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlJ1xuaW1wb3J0IGRucyBmcm9tICdkbnMnXG5pbXBvcnQgcmVhY3QgZnJvbSAnQHZpdGVqcy9wbHVnaW4tcmVhY3QnXG5pbXBvcnQgeyBub2RlUG9seWZpbGxzIH0gZnJvbSAndml0ZS1wbHVnaW4tbm9kZS1wb2x5ZmlsbHMnXG5pbXBvcnQgdml0ZVRzY29uZml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7QUFDalUsT0FBTyxTQUFTO0FBQ2hCLE9BQU8sV0FBVztBQUNsQixTQUFTLHFCQUFxQjtBQUM5QixPQUFPLHVCQUF1QjtBQUM5QixPQUFPLGdCQUFnQjtBQUV2QixJQUFJLHNCQUFzQixVQUFVO0FBRXBDLElBQU8sc0JBQVEsYUFBYSxNQUFNO0FBQ2hDLFNBQU87QUFBQSxJQUNMLFNBQVM7QUFBQSxNQUNQLE1BQU07QUFBQSxNQUNOLGNBQWM7QUFBQSxRQUNaLFNBQVMsQ0FBQyxRQUFRO0FBQUEsUUFDbEIsU0FBUztBQUFBLFVBQ1AsUUFBUTtBQUFBLFFBQ1Y7QUFBQSxNQUNGLENBQUM7QUFBQSxNQUNELGtCQUFrQjtBQUFBLE1BQ2xCLFdBQVc7QUFBQSxJQUNiO0FBQUEsSUFDQSxRQUFRO0FBQUEsTUFDTiwrQkFBK0IsS0FBSyxVQUFVLFFBQVEsSUFBSSxtQkFBbUI7QUFBQSxJQUMvRTtBQUFBLElBQ0EsU0FBUztBQUFBLE1BQ1AsUUFBUSxDQUFDLFNBQVMsTUFBTTtBQUFBLElBQzFCO0FBQUEsSUFDQSxPQUFPO0FBQUEsTUFDTCxRQUFRO0FBQUEsSUFDVjtBQUFBLElBQ0EsUUFBUTtBQUFBLE1BQ04sUUFBUTtBQUFBLE1BQ1IsTUFBTTtBQUFBLE1BQ04sSUFBSTtBQUFBO0FBQUEsUUFFRixPQUFPLENBQUMsSUFBSTtBQUFBLE1BQ2Q7QUFBQSxJQUNGO0FBQUEsSUFDQSxNQUFNO0FBQUEsRUFDUjtBQUNGLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/kit/src/components/KitProvider/ConnectWalletContent/GoogleLogo.tsx b/packages/kit/src/components/KitProvider/ConnectWalletContent/GoogleLogo.tsx new file mode 100644 index 00000000..2089f867 --- /dev/null +++ b/packages/kit/src/components/KitProvider/ConnectWalletContent/GoogleLogo.tsx @@ -0,0 +1,13 @@ +import React from 'react' + +export const GoogleLogo = () => ( + + + + + + + + + +) diff --git a/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx b/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx index 04a8885a..df02c367 100644 --- a/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx +++ b/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx @@ -23,6 +23,7 @@ import { appleAuthHelpers, useScript } from 'react-apple-signin-auth' import { ExtendedWalletList } from './ExtendedWalletList' import { Banner } from './Banner' +import { GoogleLogo } from './GoogleLogo' import { KitConfig } from '../../index' import { LocalStorageKey, defaultSignInOptions } from '../../../constants' @@ -267,21 +268,62 @@ export const ConnectWalletContent = (props: ConnectWalletContentProps) => { return ( {connector._wallet.id === 'google-waas' && ( - - { - if (credentialResponse.credential) { - storage?.setItem(LocalStorageKey.WaasGoogleIdToken, credentialResponse.credential) - onConnect(connector) - } - }} - onError={() => { - console.log('Login Failed') + + + { + if (credentialResponse.credential) { + storage?.setItem(LocalStorageKey.WaasGoogleIdToken, credentialResponse.credential) + onConnect(connector) + } + }} + onError={() => { + console.log('Login Failed') + }} + /> + + + > + + + + )} From 6e096020c6f7df5f5f22f9ebe64d4431b7e5ca14 Mon Sep 17 00:00:00 2001 From: samuelea Date: Fri, 10 May 2024 14:57:06 -0400 Subject: [PATCH 2/4] added tooltip --- .../ConnectWalletContent/index.tsx | 104 +++++++++--------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx b/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx index df02c367..af7044cb 100644 --- a/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx +++ b/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx @@ -268,63 +268,65 @@ export const ConnectWalletContent = (props: ConnectWalletContentProps) => { return ( {connector._wallet.id === 'google-waas' && ( - - - { - if (credentialResponse.credential) { - storage?.setItem(LocalStorageKey.WaasGoogleIdToken, credentialResponse.credential) - onConnect(connector) - } - }} - onError={() => { - console.log('Login Failed') - }} - /> - - + + + + { + if (credentialResponse.credential) { + storage?.setItem(LocalStorageKey.WaasGoogleIdToken, credentialResponse.credential) + onConnect(connector) + } + }} + onError={() => { + console.log('Login Failed') + }} + /> + - + + + - + )} {connector._wallet.id === 'apple-waas' && ( From eb0dabb57656ec9bfb22535204a00bfc5a952a54 Mon Sep 17 00:00:00 2001 From: samuelea Date: Fri, 10 May 2024 15:06:34 -0400 Subject: [PATCH 3/4] google tooltip fix --- .../components/KitProvider/ConnectWalletContent/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx b/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx index af7044cb..78330d5b 100644 --- a/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx +++ b/packages/kit/src/components/KitProvider/ConnectWalletContent/index.tsx @@ -59,6 +59,11 @@ export const ConnectWalletContent = (props: ConnectWalletContentProps) => { const [showEmailWaasPinInput, setShowEmailWaasPinInput] = useState(false) const [waasEmailPinCode, setWaasEmailPinCode] = useState([]) const { connectors: baseConnectors, connect } = useConnect() + const [enableGoogleTooltip, setEnableGoogleTooltip] = useState(false) + + useEffect(() => { + setTimeout(() => { setEnableGoogleTooltip(true) },300) + }) // EIP-6963 connectors will not have the _wallet property const injectedConnectors: ExtendedConnector[] = baseConnectors @@ -268,7 +273,7 @@ export const ConnectWalletContent = (props: ConnectWalletContentProps) => { return ( {connector._wallet.id === 'google-waas' && ( - + Date: Fri, 10 May 2024 15:08:41 -0400 Subject: [PATCH 4/4] cleanup --- ....timestamp-1715364539653-a9974b0d24473.mjs | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs diff --git a/examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs b/examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs deleted file mode 100644 index 5effa665..00000000 --- a/examples/react/vite.config.js.timestamp-1715364539653-a9974b0d24473.mjs +++ /dev/null @@ -1,45 +0,0 @@ -// vite.config.js -import { defineConfig } from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite@5.2.11_@types+node@20.12.11_terser@5.31.0/node_modules/vite/dist/node/index.js"; -import dns from "dns"; -import react from "file:///home/samuele/repos/kit/node_modules/.pnpm/@vitejs+plugin-react@4.2.1_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/@vitejs/plugin-react/dist/index.mjs"; -import { nodePolyfills } from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite-plugin-node-polyfills@0.21.0_rollup@4.17.2_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/vite-plugin-node-polyfills/dist/index.js"; -import viteTsconfigPaths from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite-tsconfig-paths@4.3.2_typescript@5.4.5_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/vite-tsconfig-paths/dist/index.mjs"; -import svgrPlugin from "file:///home/samuele/repos/kit/node_modules/.pnpm/vite-plugin-svgr@4.2.0_rollup@4.17.2_typescript@5.4.5_vite@5.2.11_@types+node@20.12.11_terser@5.31.0_/node_modules/vite-plugin-svgr/dist/index.js"; -dns.setDefaultResultOrder("verbatim"); -var vite_config_default = defineConfig(() => { - return { - plugins: [ - react(), - nodePolyfills({ - include: ["buffer"], - globals: { - Buffer: true - } - }), - viteTsconfigPaths(), - svgrPlugin() - ], - define: { - "process.env.PACKAGE_VERSION": JSON.stringify(process.env.npm_package_version) - }, - resolve: { - dedupe: ["wagmi", "viem"] - }, - build: { - minify: false - }, - server: { - minify: false, - port: 4444, - fs: { - // Allow serving files from one level up to the project root - allow: [".."] - } - }, - base: "" - }; -}); -export { - vite_config_default as default -}; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb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