@shware/http 1.0.0 → 1.0.1
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/google-one-tap/index.cjs +35 -25
- package/dist/google-one-tap/index.cjs.map +1 -1
- package/dist/google-one-tap/index.d.cts +10 -8
- package/dist/google-one-tap/index.d.ts +10 -8
- package/dist/google-one-tap/index.mjs +34 -23
- package/dist/google-one-tap/index.mjs.map +1 -1
- package/dist/google-one-tap/types.cjs.map +1 -1
- package/dist/google-one-tap/types.d.cts +9 -1
- package/dist/google-one-tap/types.d.ts +9 -1
- package/package.json +1 -1
|
@@ -20,37 +20,47 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/google-one-tap/index.tsx
|
|
21
21
|
var google_one_tap_exports = {};
|
|
22
22
|
__export(google_one_tap_exports, {
|
|
23
|
-
|
|
24
|
-
prompt: () => prompt
|
|
23
|
+
useGoogleOneTap: () => useGoogleOneTap
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(google_one_tap_exports);
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
function useGoogleOneTap({ clientId, callback }) {
|
|
28
|
+
const [loaded, setLoaded] = (0, import_react.useState)(false);
|
|
29
|
+
const ref = (0, import_react.useRef)(callback);
|
|
30
|
+
ref.current = callback;
|
|
31
|
+
(0, import_react.useEffect)(() => {
|
|
32
|
+
const scriptId = "google-one-tap";
|
|
33
|
+
const script = document.createElement("script");
|
|
34
|
+
script.id = scriptId;
|
|
35
|
+
script.async = true;
|
|
36
|
+
script.defer = true;
|
|
37
|
+
script.src = "https://accounts.google.com/gsi/client";
|
|
38
|
+
script.onload = () => {
|
|
39
|
+
window.google.accounts.id.initialize({
|
|
40
|
+
ux_mode: "popup",
|
|
41
|
+
context: "signin",
|
|
41
42
|
auto_select: false,
|
|
43
|
+
client_id: clientId,
|
|
44
|
+
use_fedcm_for_prompt: true,
|
|
42
45
|
cancel_on_tap_outside: false,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
callback: ref.current
|
|
47
|
+
});
|
|
48
|
+
setLoaded(true);
|
|
49
|
+
};
|
|
50
|
+
document.head.appendChild(script);
|
|
51
|
+
return () => {
|
|
52
|
+
setLoaded(false);
|
|
53
|
+
script.remove();
|
|
54
|
+
};
|
|
55
|
+
}, [clientId]);
|
|
56
|
+
return {
|
|
57
|
+
loaded,
|
|
58
|
+
prompt: () => window.google?.accounts?.id?.prompt(),
|
|
59
|
+
cancel: () => window.google?.accounts?.id?.cancel()
|
|
60
|
+
};
|
|
50
61
|
}
|
|
51
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
63
|
0 && (module.exports = {
|
|
53
|
-
|
|
54
|
-
prompt
|
|
64
|
+
useGoogleOneTap
|
|
55
65
|
});
|
|
56
66
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-one-tap/index.tsx"],"sourcesContent":["import type { GoogleAccounts, CredentialResponse
|
|
1
|
+
{"version":3,"sources":["../../src/google-one-tap/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport type { GoogleAccounts, CredentialResponse } from './types';\n\ndeclare global {\n interface Window {\n google: {\n accounts: GoogleAccounts;\n };\n }\n}\n\nexport type Props = {\n clientId: string;\n callback: (response: CredentialResponse) => void | Promise<void>;\n};\n\n/** debug: chrome://settings/content/federatedIdentityApi */\nexport function useGoogleOneTap({ clientId, callback }: Props) {\n const [loaded, setLoaded] = useState(false);\n const ref = useRef(callback);\n ref.current = callback;\n\n useEffect(() => {\n const scriptId = 'google-one-tap';\n const script = document.createElement('script');\n script.id = scriptId;\n script.async = true;\n script.defer = true;\n script.src = 'https://accounts.google.com/gsi/client';\n script.onload = () => {\n window.google.accounts.id.initialize({\n ux_mode: 'popup',\n context: 'signin',\n auto_select: false,\n client_id: clientId,\n use_fedcm_for_prompt: true,\n cancel_on_tap_outside: false,\n callback: ref.current,\n });\n setLoaded(true);\n };\n\n document.head.appendChild(script);\n\n return () => {\n setLoaded(false);\n script.remove();\n };\n }, [clientId]);\n\n return {\n loaded,\n prompt: () => window.google?.accounts?.id?.prompt(),\n cancel: () => window.google?.accounts?.id?.cancel(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4C;AAiBrC,SAAS,gBAAgB,EAAE,UAAU,SAAS,GAAU;AAC7D,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,QAAM,UAAM,qBAAO,QAAQ;AAC3B,MAAI,UAAU;AAEd,8BAAU,MAAM;AACd,UAAM,WAAW;AACjB,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,KAAK;AACZ,WAAO,QAAQ;AACf,WAAO,QAAQ;AACf,WAAO,MAAM;AACb,WAAO,SAAS,MAAM;AACpB,aAAO,OAAO,SAAS,GAAG,WAAW;AAAA,QACnC,SAAS;AAAA,QACT,SAAS;AAAA,QACT,aAAa;AAAA,QACb,WAAW;AAAA,QACX,sBAAsB;AAAA,QACtB,uBAAuB;AAAA,QACvB,UAAU,IAAI;AAAA,MAChB,CAAC;AACD,gBAAU,IAAI;AAAA,IAChB;AAEA,aAAS,KAAK,YAAY,MAAM;AAEhC,WAAO,MAAM;AACX,gBAAU,KAAK;AACf,aAAO,OAAO;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,MAAM,OAAO,QAAQ,UAAU,IAAI,OAAO;AAAA,IAClD,QAAQ,MAAM,OAAO,QAAQ,UAAU,IAAI,OAAO;AAAA,EACpD;AACF;","names":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { GoogleAccounts, PromptMomentNotification, CredentialResponse } from './types.cjs';
|
|
1
|
+
import { GoogleAccounts, CredentialResponse } from './types.cjs';
|
|
3
2
|
|
|
4
3
|
declare global {
|
|
5
4
|
interface Window {
|
|
@@ -8,12 +7,15 @@ declare global {
|
|
|
8
7
|
};
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
|
-
declare function prompt(callback?: (res: PromptMomentNotification) => void): void;
|
|
12
10
|
type Props = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
clientId: string;
|
|
12
|
+
callback: (response: CredentialResponse) => void | Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
/** debug: chrome://settings/content/federatedIdentityApi */
|
|
15
|
+
declare function useGoogleOneTap({ clientId, callback }: Props): {
|
|
16
|
+
loaded: boolean;
|
|
17
|
+
prompt: () => void;
|
|
18
|
+
cancel: () => void;
|
|
16
19
|
};
|
|
17
|
-
declare function GoogleOneTap({ client_id, login_uri, callback }: Props): react_jsx_runtime.JSX.Element;
|
|
18
20
|
|
|
19
|
-
export {
|
|
21
|
+
export { type Props, useGoogleOneTap };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { GoogleAccounts, PromptMomentNotification, CredentialResponse } from './types.js';
|
|
1
|
+
import { GoogleAccounts, CredentialResponse } from './types.js';
|
|
3
2
|
|
|
4
3
|
declare global {
|
|
5
4
|
interface Window {
|
|
@@ -8,12 +7,15 @@ declare global {
|
|
|
8
7
|
};
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
|
-
declare function prompt(callback?: (res: PromptMomentNotification) => void): void;
|
|
12
10
|
type Props = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
clientId: string;
|
|
12
|
+
callback: (response: CredentialResponse) => void | Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
/** debug: chrome://settings/content/federatedIdentityApi */
|
|
15
|
+
declare function useGoogleOneTap({ clientId, callback }: Props): {
|
|
16
|
+
loaded: boolean;
|
|
17
|
+
prompt: () => void;
|
|
18
|
+
cancel: () => void;
|
|
16
19
|
};
|
|
17
|
-
declare function GoogleOneTap({ client_id, login_uri, callback }: Props): react_jsx_runtime.JSX.Element;
|
|
18
20
|
|
|
19
|
-
export {
|
|
21
|
+
export { type Props, useGoogleOneTap };
|
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
// src/google-one-tap/index.tsx
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
function useGoogleOneTap({ clientId, callback }) {
|
|
4
|
+
const [loaded, setLoaded] = useState(false);
|
|
5
|
+
const ref = useRef(callback);
|
|
6
|
+
ref.current = callback;
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const scriptId = "google-one-tap";
|
|
9
|
+
const script = document.createElement("script");
|
|
10
|
+
script.id = scriptId;
|
|
11
|
+
script.async = true;
|
|
12
|
+
script.defer = true;
|
|
13
|
+
script.src = "https://accounts.google.com/gsi/client";
|
|
14
|
+
script.onload = () => {
|
|
15
|
+
window.google.accounts.id.initialize({
|
|
16
|
+
ux_mode: "popup",
|
|
17
|
+
context: "signin",
|
|
16
18
|
auto_select: false,
|
|
19
|
+
client_id: clientId,
|
|
20
|
+
use_fedcm_for_prompt: true,
|
|
17
21
|
cancel_on_tap_outside: false,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
callback: ref.current
|
|
23
|
+
});
|
|
24
|
+
setLoaded(true);
|
|
25
|
+
};
|
|
26
|
+
document.head.appendChild(script);
|
|
27
|
+
return () => {
|
|
28
|
+
setLoaded(false);
|
|
29
|
+
script.remove();
|
|
30
|
+
};
|
|
31
|
+
}, [clientId]);
|
|
32
|
+
return {
|
|
33
|
+
loaded,
|
|
34
|
+
prompt: () => window.google?.accounts?.id?.prompt(),
|
|
35
|
+
cancel: () => window.google?.accounts?.id?.cancel()
|
|
36
|
+
};
|
|
25
37
|
}
|
|
26
38
|
export {
|
|
27
|
-
|
|
28
|
-
prompt
|
|
39
|
+
useGoogleOneTap
|
|
29
40
|
};
|
|
30
41
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-one-tap/index.tsx"],"sourcesContent":["import type { GoogleAccounts, CredentialResponse
|
|
1
|
+
{"version":3,"sources":["../../src/google-one-tap/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport type { GoogleAccounts, CredentialResponse } from './types';\n\ndeclare global {\n interface Window {\n google: {\n accounts: GoogleAccounts;\n };\n }\n}\n\nexport type Props = {\n clientId: string;\n callback: (response: CredentialResponse) => void | Promise<void>;\n};\n\n/** debug: chrome://settings/content/federatedIdentityApi */\nexport function useGoogleOneTap({ clientId, callback }: Props) {\n const [loaded, setLoaded] = useState(false);\n const ref = useRef(callback);\n ref.current = callback;\n\n useEffect(() => {\n const scriptId = 'google-one-tap';\n const script = document.createElement('script');\n script.id = scriptId;\n script.async = true;\n script.defer = true;\n script.src = 'https://accounts.google.com/gsi/client';\n script.onload = () => {\n window.google.accounts.id.initialize({\n ux_mode: 'popup',\n context: 'signin',\n auto_select: false,\n client_id: clientId,\n use_fedcm_for_prompt: true,\n cancel_on_tap_outside: false,\n callback: ref.current,\n });\n setLoaded(true);\n };\n\n document.head.appendChild(script);\n\n return () => {\n setLoaded(false);\n script.remove();\n };\n }, [clientId]);\n\n return {\n loaded,\n prompt: () => window.google?.accounts?.id?.prompt(),\n cancel: () => window.google?.accounts?.id?.cancel(),\n };\n}\n"],"mappings":";AAAA,SAAS,WAAW,QAAQ,gBAAgB;AAiBrC,SAAS,gBAAgB,EAAE,UAAU,SAAS,GAAU;AAC7D,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,MAAM,OAAO,QAAQ;AAC3B,MAAI,UAAU;AAEd,YAAU,MAAM;AACd,UAAM,WAAW;AACjB,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,KAAK;AACZ,WAAO,QAAQ;AACf,WAAO,QAAQ;AACf,WAAO,MAAM;AACb,WAAO,SAAS,MAAM;AACpB,aAAO,OAAO,SAAS,GAAG,WAAW;AAAA,QACnC,SAAS;AAAA,QACT,SAAS;AAAA,QACT,aAAa;AAAA,QACb,WAAW;AAAA,QACX,sBAAsB;AAAA,QACtB,uBAAuB;AAAA,QACvB,UAAU,IAAI;AAAA,MAChB,CAAC;AACD,gBAAU,IAAI;AAAA,IAChB;AAEA,aAAS,KAAK,YAAY,MAAM;AAEhC,WAAO,MAAM;AACX,gBAAU,KAAK;AACf,aAAO,OAAO;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,MAAM,OAAO,QAAQ,UAAU,IAAI,OAAO;AAAA,IAClD,QAAQ,MAAM,OAAO,QAAQ,UAAU,IAAI,OAAO;AAAA,EACpD;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-one-tap/types.ts"],"sourcesContent":["interface ClientConfigError extends Error {\n message: string;\n stack?: string;\n type: 'unknown' | 'popup_closed' | 'popup_failed_to_open';\n}\n\ninterface OverridableTokenClientConfig {\n scope?: string;\n include_granted_scopes?: boolean;\n prompt?: string;\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n state?: string;\n}\n\ninterface TokenClient {\n requestAccessToken: (overrideConfig?: OverridableTokenClientConfig) => void;\n}\n\ninterface CodeClient {\n requestCode: () => void;\n}\n\ninterface TokenResponse {\n access_token: string;\n expires_in: string;\n hd: string;\n prompt: string;\n token_type: string;\n scope: string;\n state: string;\n error: string;\n error_description: string;\n error_uri: string;\n}\n\ninterface CodeResponse {\n code: string;\n scope: string;\n state: string;\n error: string;\n error_description: string;\n error_uri: string;\n}\n\ninterface TokenClientConfig {\n client_id: string;\n scope: string;\n include_granted_scopes?: boolean;\n prompt?: '' | 'none' | 'consent' | 'select_account';\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n hd?: string;\n hosted_domain?: string;\n state?: string;\n callback: (tokenResponse: TokenResponse) => void;\n error_callback?: (error: ClientConfigError) => void;\n}\n\ninterface CodeClientConfig {\n client_id: string;\n scope: string;\n include_granted_scopes?: boolean;\n redirect_uri?: string;\n state?: string;\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n hd?: string;\n hosted_domain?: string;\n ux_mode?: 'popup' | 'redirect';\n select_account?: boolean;\n callback?: (response: CodeResponse) => void;\n error_callback?: (error: ClientConfigError) => void;\n}\n\ninterface RevocationResponse {\n successful: boolean;\n error?: string;\n}\n\ninterface Credential {\n id: string;\n password: string;\n}\n\nexport interface CredentialResponse {\n credential: string;\n select_by: string;\n}\n\nexport interface IdConfiguration {\n client_id: string;\n auto_select?: boolean;\n login_uri?: string;\n cancel_on_tap_outside?: boolean;\n prompt_parent_id?: string;\n nonce?: string;\n context?: 'signin' | 'signup' | 'use';\n state_cookie_domain?: string;\n ux_mode?: 'popup' | 'redirect';\n allowed_parent_origin?: string | string[];\n itp_support?: boolean;\n login_hint?: string;\n hd?: string;\n use_fedcm_for_prompt?: boolean;\n callback?: (response: CredentialResponse) => void;\n native_callback?: (response: CredentialResponse) => void;\n intermediate_iframe_close_callback?: () => void;\n}\n\nexport interface PromptMomentNotification {\n isDisplayMoment(): boolean;\n isDisplayed(): boolean;\n isNotDisplayed(): boolean;\n getNotDisplayedReason():\n | 'browser_not_supported'\n | 'invalid_client'\n | 'missing_client_id'\n | 'opt_out_or_no_session'\n | 'secure_http_required'\n | 'suppressed_by_user'\n | 'unregistered_origin'\n | 'unknown_reason';\n\n
|
|
1
|
+
{"version":3,"sources":["../../src/google-one-tap/types.ts"],"sourcesContent":["interface ClientConfigError extends Error {\n message: string;\n stack?: string;\n type: 'unknown' | 'popup_closed' | 'popup_failed_to_open';\n}\n\ninterface OverridableTokenClientConfig {\n scope?: string;\n include_granted_scopes?: boolean;\n prompt?: string;\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n state?: string;\n}\n\ninterface TokenClient {\n requestAccessToken: (overrideConfig?: OverridableTokenClientConfig) => void;\n}\n\ninterface CodeClient {\n requestCode: () => void;\n}\n\ninterface TokenResponse {\n access_token: string;\n expires_in: string;\n hd: string;\n prompt: string;\n token_type: string;\n scope: string;\n state: string;\n error: string;\n error_description: string;\n error_uri: string;\n}\n\ninterface CodeResponse {\n code: string;\n scope: string;\n state: string;\n error: string;\n error_description: string;\n error_uri: string;\n}\n\ninterface TokenClientConfig {\n client_id: string;\n scope: string;\n include_granted_scopes?: boolean;\n prompt?: '' | 'none' | 'consent' | 'select_account';\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n hd?: string;\n hosted_domain?: string;\n state?: string;\n callback: (tokenResponse: TokenResponse) => void;\n error_callback?: (error: ClientConfigError) => void;\n}\n\ninterface CodeClientConfig {\n client_id: string;\n scope: string;\n include_granted_scopes?: boolean;\n redirect_uri?: string;\n state?: string;\n enable_granular_consent?: boolean;\n enable_serial_consent?: boolean;\n login_hint?: string;\n hint?: string;\n hd?: string;\n hosted_domain?: string;\n ux_mode?: 'popup' | 'redirect';\n select_account?: boolean;\n callback?: (response: CodeResponse) => void;\n error_callback?: (error: ClientConfigError) => void;\n}\n\ninterface RevocationResponse {\n successful: boolean;\n error?: string;\n}\n\ninterface Credential {\n id: string;\n password: string;\n}\n\nexport interface CredentialResponse {\n credential: string;\n select_by: string;\n}\n\nexport interface IdConfiguration {\n client_id: string;\n auto_select?: boolean;\n login_uri?: string;\n cancel_on_tap_outside?: boolean;\n prompt_parent_id?: string;\n nonce?: string;\n context?: 'signin' | 'signup' | 'use';\n state_cookie_domain?: string;\n ux_mode?: 'popup' | 'redirect';\n allowed_parent_origin?: string | string[];\n itp_support?: boolean;\n login_hint?: string;\n hd?: string;\n use_fedcm_for_prompt?: boolean;\n callback?: (response: CredentialResponse) => void;\n native_callback?: (response: CredentialResponse) => void;\n intermediate_iframe_close_callback?: () => void;\n}\n/**\n * ref: https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc&utm_source=devtools&utm_campaign=stable#display_moment\n */\nexport interface PromptMomentNotification {\n /** @deprecated */\n isDisplayMoment(): boolean;\n\n /** @deprecated */\n isDisplayed(): boolean;\n\n /** @deprecated */\n isNotDisplayed(): boolean;\n\n /** @deprecated */\n getNotDisplayedReason():\n | 'browser_not_supported'\n | 'invalid_client'\n | 'missing_client_id'\n | 'opt_out_or_no_session'\n | 'secure_http_required'\n | 'suppressed_by_user'\n | 'unregistered_origin'\n | 'unknown_reason';\n\n /** @deprecated */\n getSkippedReason(): 'auto_cancel' | 'user_cancel' | 'tap_outside' | 'issuing_failed';\n\n isSkippedMoment(): boolean;\n isDismissedMoment(): boolean;\n getDismissedReason(): 'credential_returned' | 'cancel_called' | 'flow_restarted';\n getMomentType(): 'display' | 'skipped' | 'dismissed';\n}\n\ninterface GsiButtonConfiguration {\n type: 'standard' | 'icon';\n theme?: 'outline' | 'filled_blue' | 'filled_black';\n size?: 'small' | 'medium' | 'large';\n text?: 'signin_with' | 'signup_with' | 'continue_with' | 'signin';\n shape?: 'rectangular' | 'pill' | 'circle' | 'square';\n logo_alignment?: 'left' | 'center';\n width?: number;\n locale?: string;\n state?: string;\n click_listener?: () => void;\n}\n\nexport interface GoogleAccounts {\n oauth2: {\n initCodeClient(config: CodeClientConfig): CodeClient;\n initTokenClient(config: TokenClientConfig): TokenClient;\n hasGrantedAllScopes(\n tokenResponse: TokenResponse,\n firstScope: string,\n ...restScopes: string[]\n ): boolean;\n hasGrantedAnyScope(\n tokenResponse: TokenResponse,\n firstScope: string,\n ...restScopes: string[]\n ): boolean;\n revoke(accessToken: string, done: () => void): void;\n };\n id: {\n initialize(idConfig: IdConfiguration): void;\n prompt(momentListener?: (promptMomentNotification: PromptMomentNotification) => void): void;\n renderButton(parent: HTMLElement, options: GsiButtonConfiguration): void;\n disableAutoSelect(): void;\n storeCredential(credential: Credential, callback?: () => void): void;\n cancel(): void;\n revoke(hint: string, callback?: (response: RevocationResponse) => void): void;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -102,13 +102,21 @@ interface IdConfiguration {
|
|
|
102
102
|
native_callback?: (response: CredentialResponse) => void;
|
|
103
103
|
intermediate_iframe_close_callback?: () => void;
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* ref: https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc&utm_source=devtools&utm_campaign=stable#display_moment
|
|
107
|
+
*/
|
|
105
108
|
interface PromptMomentNotification {
|
|
109
|
+
/** @deprecated */
|
|
106
110
|
isDisplayMoment(): boolean;
|
|
111
|
+
/** @deprecated */
|
|
107
112
|
isDisplayed(): boolean;
|
|
113
|
+
/** @deprecated */
|
|
108
114
|
isNotDisplayed(): boolean;
|
|
115
|
+
/** @deprecated */
|
|
109
116
|
getNotDisplayedReason(): 'browser_not_supported' | 'invalid_client' | 'missing_client_id' | 'opt_out_or_no_session' | 'secure_http_required' | 'suppressed_by_user' | 'unregistered_origin' | 'unknown_reason';
|
|
110
|
-
|
|
117
|
+
/** @deprecated */
|
|
111
118
|
getSkippedReason(): 'auto_cancel' | 'user_cancel' | 'tap_outside' | 'issuing_failed';
|
|
119
|
+
isSkippedMoment(): boolean;
|
|
112
120
|
isDismissedMoment(): boolean;
|
|
113
121
|
getDismissedReason(): 'credential_returned' | 'cancel_called' | 'flow_restarted';
|
|
114
122
|
getMomentType(): 'display' | 'skipped' | 'dismissed';
|
|
@@ -102,13 +102,21 @@ interface IdConfiguration {
|
|
|
102
102
|
native_callback?: (response: CredentialResponse) => void;
|
|
103
103
|
intermediate_iframe_close_callback?: () => void;
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* ref: https://developers.google.com/identity/gsi/web/guides/fedcm-migration?s=dc&utm_source=devtools&utm_campaign=stable#display_moment
|
|
107
|
+
*/
|
|
105
108
|
interface PromptMomentNotification {
|
|
109
|
+
/** @deprecated */
|
|
106
110
|
isDisplayMoment(): boolean;
|
|
111
|
+
/** @deprecated */
|
|
107
112
|
isDisplayed(): boolean;
|
|
113
|
+
/** @deprecated */
|
|
108
114
|
isNotDisplayed(): boolean;
|
|
115
|
+
/** @deprecated */
|
|
109
116
|
getNotDisplayedReason(): 'browser_not_supported' | 'invalid_client' | 'missing_client_id' | 'opt_out_or_no_session' | 'secure_http_required' | 'suppressed_by_user' | 'unregistered_origin' | 'unknown_reason';
|
|
110
|
-
|
|
117
|
+
/** @deprecated */
|
|
111
118
|
getSkippedReason(): 'auto_cancel' | 'user_cancel' | 'tap_outside' | 'issuing_failed';
|
|
119
|
+
isSkippedMoment(): boolean;
|
|
112
120
|
isDismissedMoment(): boolean;
|
|
113
121
|
getDismissedReason(): 'credential_returned' | 'cancel_called' | 'flow_restarted';
|
|
114
122
|
getMomentType(): 'display' | 'skipped' | 'dismissed';
|