diff --git a/example-dimo-auth/dimo-network-login-with-dimo-0.0.11.tgz b/example-dimo-auth/dimo-network-login-with-dimo-0.0.11.tgz index 1a09f53..39b8cb7 100644 Binary files a/example-dimo-auth/dimo-network-login-with-dimo-0.0.11.tgz and b/example-dimo-auth/dimo-network-login-with-dimo-0.0.11.tgz differ diff --git a/example-dimo-auth/dimo-network-login-with-dimo-0.0.12.tgz b/example-dimo-auth/dimo-network-login-with-dimo-0.0.12.tgz new file mode 100644 index 0000000..d594ed8 Binary files /dev/null and b/example-dimo-auth/dimo-network-login-with-dimo-0.0.12.tgz differ diff --git a/example-dimo-auth/package-lock.json b/example-dimo-auth/package-lock.json index 7bb4f65..35d9805 100644 --- a/example-dimo-auth/package-lock.json +++ b/example-dimo-auth/package-lock.json @@ -8,7 +8,7 @@ "name": "example-dimo-auth", "version": "0.1.0", "dependencies": { - "@dimo-network/login-with-dimo": "file:./dimo-network-login-with-dimo-0.0.11.tgz", + "@dimo-network/login-with-dimo": "file:./dimo-network-login-with-dimo-0.0.12.tgz", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -2209,9 +2209,9 @@ } }, "node_modules/@dimo-network/login-with-dimo": { - "version": "0.0.11", - "resolved": "file:dimo-network-login-with-dimo-0.0.11.tgz", - "integrity": "sha512-65x/wpB4Jant4iopjNp9BF4tr75+whpTsMiJbU9OoKDgwtKOFTWH+NHIcnwjhLwvNSXFUAEH8mh2fE8lGh2nsw==", + "version": "0.0.12", + "resolved": "file:dimo-network-login-with-dimo-0.0.12.tgz", + "integrity": "sha512-NeR5DInRqwOGhsy7aI6rbuN6fsXmc9di7PXYGGojPvQB/JAngFB7s8JdXewU3/lIenEWhYGI4fPkVl4pcYkt5A==", "license": "ISC", "peerDependencies": { "react": "^18.0.0", @@ -5017,15 +5017,14 @@ } }, "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "dependencies": { + "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "set-function-length": "^1.2.2" }, "engines": { "node": ">= 0.4" @@ -5034,6 +5033,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.0.tgz", + "integrity": "sha512-CCKAP2tkPau7D3GE8+V8R6sQubA9R5foIzGp+85EXCVSCivuxBNAWqcpn72PKYiIcqoViv/kcUDpaEIMBVi1lQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -5082,9 +5093,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001686", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001686.tgz", - "integrity": "sha512-Y7deg0Aergpa24M3qLC5xjNklnKnhsmSyR/V89dLZ1n0ucJIFNs7PgR2Yfa/Zf6W79SbBicgtGxZr2juHkEUIA==", + "version": "1.0.30001687", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", + "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", "funding": [ { "type": "opencollective", @@ -5966,9 +5977,9 @@ } }, "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dependencies": { "ms": "^2.1.3" }, @@ -6318,6 +6329,19 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz", "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==" }, + "node_modules/dunder-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz", + "integrity": "sha512-9+Sj30DIu+4KvHqMfLUGLFYL2PkURSYMVXJyXe92nFRvlYq5hBjLEhblKB+vkd/WVlUYMWigiY07T91Fkk0+4A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/duplexer": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", @@ -6485,12 +6509,9 @@ "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==" }, "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "engines": { "node": ">= 0.4" } @@ -7886,15 +7907,18 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.5.tgz", + "integrity": "sha512-Y4+pKa7XeRUPWFNvOOYHkRYrfzW07oraURSvjDmRVOJ748OrVmeXtpE4+GCEHncjCjkTxPNRt8kEbxDhsn6VTg==", "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "dunder-proto": "^1.0.0", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -8129,11 +8153,11 @@ } }, "node_modules/has-proto": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.1.0.tgz", - "integrity": "sha512-QLdzI9IIO1Jg7f9GT1gXpPpXArAn6cS31R1eEZqz08Gc+uQ8/XiqHWt17Fiw+2p6oTTIq5GXEpQkAlA88YRl/Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", "dependencies": { - "call-bind": "^1.0.7" + "dunder-proto": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -13012,17 +13036,18 @@ } }, "node_modules/reflect.getprototypeof": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.7.tgz", - "integrity": "sha512-bMvFGIUKlc/eSfXNX+aZ+EL95/EgZzuwA0OBPTbZZDEJw/0AkentjMuM1oiRfwHrshqk4RzdgiTg5CcDalXN5g==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.8.tgz", + "integrity": "sha512-B5dj6usc5dkk8uFliwjwDHM8To5/QwdKz9JcBZ8Ic4G1f0YmeeJTtE/ZTdgRFPAfxZFiUaPhZ1Jcs4qeagItGQ==", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "define-properties": "^1.2.1", + "dunder-proto": "^1.0.0", "es-abstract": "^1.23.5", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "which-builtin-type": "^1.1.4" + "gopd": "^1.2.0", + "which-builtin-type": "^1.2.0" }, "engines": { "node": ">= 0.4" diff --git a/example-dimo-auth/package.json b/example-dimo-auth/package.json index 8cef434..b9b0300 100644 --- a/example-dimo-auth/package.json +++ b/example-dimo-auth/package.json @@ -10,7 +10,7 @@ "@types/node": "^16.18.114", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", - "@dimo-network/login-with-dimo": "file:./dimo-network-login-with-dimo-0.0.11.tgz", + "@dimo-network/login-with-dimo": "file:./dimo-network-login-with-dimo-0.0.12.tgz", "react": "^18.3.1", "react-dom": "^18.3.1", "react-scripts": "5.0.1", diff --git a/example-dimo-auth/src/App.tsx b/example-dimo-auth/src/App.tsx index fea9ef4..382c701 100644 --- a/example-dimo-auth/src/App.tsx +++ b/example-dimo-auth/src/App.tsx @@ -1136,7 +1136,7 @@ function App() { mode="popup" onSuccess={(authData: any) => console.log("Success:", authData)} onError={(error: any) => console.error("Error:", error)} - permissionTemplateId={permissionsEnabled ? "1" : undefined} + permissionTemplateId={permissionsEnabled ? "2" : undefined} // vehicles={["585","586"]} /> @@ -1146,17 +1146,19 @@ function App() { mode="popup" onSuccess={(authData: any) => console.log("Success:", authData)} onError={(error: any) => console.error("Error:", error)} - permissionTemplateId={"1"} + permissionTemplateId={"2"} /> + onSuccess={(transactionData: any) => { + console.log(transactionData); console.log( "Transaction Hash:", transactionData.transactionHash ) } + } onError={(error: any) => console.error("Error:", error)} address="0x21cFE003997fB7c2B3cfe5cf71e7833B7B2eCe10" value="0" @@ -1193,7 +1195,7 @@ function App() { mode="redirect" onSuccess={(authData: any) => console.log("Success:", authData)} onError={(error: any) => console.error("Error:", error)} - permissionTemplateId={"1"} + permissionTemplateId={"2"} /> = ({ return ( diff --git a/sdk/src/utils/eventHandler.ts b/sdk/src/utils/eventHandler.ts index 4f6fa1a..ef5d322 100644 --- a/sdk/src/utils/eventHandler.ts +++ b/sdk/src/utils/eventHandler.ts @@ -95,11 +95,10 @@ export const handleMessageForPopup = ( setAuthenticated, onSuccess ); - if (popup && !popup.closed) popup.close(); } if (eventType === MessageEventType.TRANSACTION_RESPONSE && transactionHash) { - onSuccess({ token: "", transactionHash }); + onSuccess({ token, transactionHash }); } if (eventType === MessageEventType.LOGOUT) { @@ -172,7 +171,7 @@ export const handleMessageForEmbed = (basePayload: BasePayload, data: any) => { if (eventType === MessageEventType.TRANSACTION_RESPONSE) { if (transactionHash || transactionReceipt) { - onSuccess({ token: "", transactionHash, transactionReceipt }); + onSuccess({ token, transactionHash, transactionReceipt }); } else { onError(new Error("Could not execute transaction")); }