From 0b3899975474941568e48da39413f4e3b85f715a Mon Sep 17 00:00:00 2001 From: Kasun Date: Fri, 27 Jan 2023 10:59:21 +0530 Subject: [PATCH 1/5] feat: export global types for window namespace --- src/@types/{globals.d.ts => globals.ts} | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) rename src/@types/{globals.d.ts => globals.ts} (87%) diff --git a/src/@types/globals.d.ts b/src/@types/globals.ts similarity index 87% rename from src/@types/globals.d.ts rename to src/@types/globals.ts index 988e32f..cc98a28 100644 --- a/src/@types/globals.d.ts +++ b/src/@types/globals.ts @@ -1,11 +1,17 @@ -import { CodeClient } from "../interfaces/oauth2"; +import type { + CodeClient, + CodeClientConfig, + OverridableTokenClientConfig, + TokenClientConfig, + TokenResponse, +} from "../interfaces/oauth2"; -import { +import type { IdConfiguration, MomentListener, GsiButtonConfiguration, RevocationCallback, -} from "@/interfaces/accounts"; +} from "../interfaces/accounts"; declare global { interface Window { @@ -51,3 +57,5 @@ declare global { }; } } + +export default {}; From 30b2c07882a459de46ad72d4b217441af4a42cd6 Mon Sep 17 00:00:00 2001 From: Kasun Date: Fri, 27 Jan 2023 10:59:40 +0530 Subject: [PATCH 2/5] chore: config type root --- tsconfig.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tsconfig.json b/tsconfig.json index 0550a5d..e56bb23 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,9 @@ "DOM.Iterable", "ESNext" ], + "typeRoots": [ + "./src/@types" + ], "strict": true, "removeComments": false }, From a8b5f73b2617691a972c94c0c4b71aa98ff7d365 Mon Sep 17 00:00:00 2001 From: Kasun Date: Fri, 27 Jan 2023 10:59:55 +0530 Subject: [PATCH 3/5] feat: export global types --- src/plugin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugin.ts b/src/plugin.ts index a26f3e7..11a81e5 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -82,5 +82,6 @@ export type { AuthCodeFlowErrorResponse, AuthCodeFlowSuccessResponse, }; +export * from "./@types/globals"; export default plugin; From 3fbe765e069f638be41041b31c6f9b2666f42c66 Mon Sep 17 00:00:00 2001 From: Kasun Date: Fri, 27 Jan 2023 11:00:08 +0530 Subject: [PATCH 4/5] fix: non null assertion --- src/composables/useCodeClient.ts | 3 ++- src/composables/useTokenClient.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/composables/useCodeClient.ts b/src/composables/useCodeClient.ts index b9bcc67..c6faa2e 100644 --- a/src/composables/useCodeClient.ts +++ b/src/composables/useCodeClient.ts @@ -129,7 +129,8 @@ export default function useCodeClient( }); client = window.google?.accounts.oauth2.initCodeClient({ - client_id: clientId, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + client_id: clientId!, scope: computedScopes, callback: (response: CodeResponse) => { if (response.error) return onError?.(response); diff --git a/src/composables/useTokenClient.ts b/src/composables/useTokenClient.ts index 0207dc2..12024cb 100644 --- a/src/composables/useTokenClient.ts +++ b/src/composables/useTokenClient.ts @@ -111,7 +111,8 @@ export default function useTokenClient( : scopeValue; client = window.google?.accounts.oauth2.initTokenClient({ - client_id: clientId, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + client_id: clientId!, scope: `openid email profile ${scopes}`, callback: (response: TokenResponse) => { if (response.error) return onError?.(response); From 6a5bab52be82640bf33a6896fb6e5529b91b4556 Mon Sep 17 00:00:00 2001 From: Kasun Date: Fri, 27 Jan 2023 11:00:21 +0530 Subject: [PATCH 5/5] chore: npm package update --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5093310..2632acc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vue3-google-signin", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vue3-google-signin", - "version": "1.2.0", + "version": "1.2.1", "license": "MIT", "devDependencies": { "@rushstack/eslint-patch": "^1.1.0",