@shware/http 1.0.2 → 1.0.3
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 +21 -36
- package/dist/google-one-tap/index.cjs.map +1 -1
- package/dist/google-one-tap/index.d.cts +2 -6
- package/dist/google-one-tap/index.d.ts +2 -6
- package/dist/google-one-tap/index.mjs +20 -35
- package/dist/google-one-tap/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -20,47 +20,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/google-one-tap/index.ts
|
|
21
21
|
var google_one_tap_exports = {};
|
|
22
22
|
__export(google_one_tap_exports, {
|
|
23
|
-
|
|
23
|
+
prompt: () => prompt
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(google_one_tap_exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
use_fedcm_for_prompt: true,
|
|
45
|
-
cancel_on_tap_outside: false,
|
|
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()
|
|
26
|
+
function prompt({ clientId, callback }) {
|
|
27
|
+
const scriptId = "google-one-tap";
|
|
28
|
+
const script = document.createElement("script");
|
|
29
|
+
script.id = scriptId;
|
|
30
|
+
script.async = true;
|
|
31
|
+
script.defer = true;
|
|
32
|
+
script.src = "https://accounts.google.com/gsi/client";
|
|
33
|
+
script.onload = () => {
|
|
34
|
+
window.google.accounts.id.initialize({
|
|
35
|
+
ux_mode: "popup",
|
|
36
|
+
context: "signin",
|
|
37
|
+
auto_select: false,
|
|
38
|
+
client_id: clientId,
|
|
39
|
+
use_fedcm_for_prompt: true,
|
|
40
|
+
cancel_on_tap_outside: false,
|
|
41
|
+
callback
|
|
42
|
+
});
|
|
43
|
+
window.google?.accounts?.id?.prompt();
|
|
60
44
|
};
|
|
45
|
+
document.head.appendChild(script);
|
|
61
46
|
}
|
|
62
47
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
48
|
0 && (module.exports = {
|
|
64
|
-
|
|
49
|
+
prompt
|
|
65
50
|
});
|
|
66
51
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-one-tap/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/google-one-tap/index.ts"],"sourcesContent":["import 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 prompt({ clientId, callback }: Props) {\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,\n });\n window.google?.accounts?.id?.prompt();\n };\n\n document.head.appendChild(script);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,OAAO,EAAE,UAAU,SAAS,GAAU;AACpD,QAAM,WAAW;AACjB,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,KAAK;AACZ,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,SAAO,MAAM;AACb,SAAO,SAAS,MAAM;AACpB,WAAO,OAAO,SAAS,GAAG,WAAW;AAAA,MACnC,SAAS;AAAA,MACT,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB;AAAA,IACF,CAAC;AACD,WAAO,QAAQ,UAAU,IAAI,OAAO;AAAA,EACtC;AAEA,WAAS,KAAK,YAAY,MAAM;AAClC;","names":[]}
|
|
@@ -12,10 +12,6 @@ type Props = {
|
|
|
12
12
|
callback: (response: CredentialResponse) => void | Promise<void>;
|
|
13
13
|
};
|
|
14
14
|
/** debug: chrome://settings/content/federatedIdentityApi */
|
|
15
|
-
declare function
|
|
16
|
-
loaded: boolean;
|
|
17
|
-
prompt: () => void;
|
|
18
|
-
cancel: () => void;
|
|
19
|
-
};
|
|
15
|
+
declare function prompt({ clientId, callback }: Props): void;
|
|
20
16
|
|
|
21
|
-
export { type Props,
|
|
17
|
+
export { type Props, prompt };
|
|
@@ -12,10 +12,6 @@ type Props = {
|
|
|
12
12
|
callback: (response: CredentialResponse) => void | Promise<void>;
|
|
13
13
|
};
|
|
14
14
|
/** debug: chrome://settings/content/federatedIdentityApi */
|
|
15
|
-
declare function
|
|
16
|
-
loaded: boolean;
|
|
17
|
-
prompt: () => void;
|
|
18
|
-
cancel: () => void;
|
|
19
|
-
};
|
|
15
|
+
declare function prompt({ clientId, callback }: Props): void;
|
|
20
16
|
|
|
21
|
-
export { type Props,
|
|
17
|
+
export { type Props, prompt };
|
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
// src/google-one-tap/index.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
use_fedcm_for_prompt: true,
|
|
21
|
-
cancel_on_tap_outside: false,
|
|
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()
|
|
2
|
+
function prompt({ clientId, callback }) {
|
|
3
|
+
const scriptId = "google-one-tap";
|
|
4
|
+
const script = document.createElement("script");
|
|
5
|
+
script.id = scriptId;
|
|
6
|
+
script.async = true;
|
|
7
|
+
script.defer = true;
|
|
8
|
+
script.src = "https://accounts.google.com/gsi/client";
|
|
9
|
+
script.onload = () => {
|
|
10
|
+
window.google.accounts.id.initialize({
|
|
11
|
+
ux_mode: "popup",
|
|
12
|
+
context: "signin",
|
|
13
|
+
auto_select: false,
|
|
14
|
+
client_id: clientId,
|
|
15
|
+
use_fedcm_for_prompt: true,
|
|
16
|
+
cancel_on_tap_outside: false,
|
|
17
|
+
callback
|
|
18
|
+
});
|
|
19
|
+
window.google?.accounts?.id?.prompt();
|
|
36
20
|
};
|
|
21
|
+
document.head.appendChild(script);
|
|
37
22
|
}
|
|
38
23
|
export {
|
|
39
|
-
|
|
24
|
+
prompt
|
|
40
25
|
};
|
|
41
26
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/google-one-tap/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/google-one-tap/index.ts"],"sourcesContent":["import 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 prompt({ clientId, callback }: Props) {\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,\n });\n window.google?.accounts?.id?.prompt();\n };\n\n document.head.appendChild(script);\n}\n"],"mappings":";AAgBO,SAAS,OAAO,EAAE,UAAU,SAAS,GAAU;AACpD,QAAM,WAAW;AACjB,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,SAAO,KAAK;AACZ,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,SAAO,MAAM;AACb,SAAO,SAAS,MAAM;AACpB,WAAO,OAAO,SAAS,GAAG,WAAW;AAAA,MACnC,SAAS;AAAA,MACT,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW;AAAA,MACX,sBAAsB;AAAA,MACtB,uBAAuB;AAAA,MACvB;AAAA,IACF,CAAC;AACD,WAAO,QAAQ,UAAU,IAAI,OAAO;AAAA,EACtC;AAEA,WAAS,KAAK,YAAY,MAAM;AAClC;","names":[]}
|