1
1
/**
2
2
* Smart Lock API externs.
3
+ * Note that this SDK is not dedicated to One-tap API. It seems to cover other
4
+ * Google sign-in related functionality. We may want to consider renaming
5
+ * these APIs to not be One-tap specific.
6
+ * https://developers.google.com/identity/one-tap/web/reference/js-reference
3
7
*
4
8
* @externs
5
9
*/
8
12
* @record
9
13
* @struct
10
14
*/
11
- function SmartLockHintOptions ( ) { }
15
+ function SmartLockOptions ( ) { }
12
16
13
- /** @type {!Array<string> } */
14
- SmartLockHintOptions . prototype . supportedAuthMethods ;
15
-
16
- /** @type {!Array<!Object<string,string>> } */
17
- SmartLockHintOptions . prototype . supportedIdTokenProviders ;
18
-
19
- /** @type {?string|undefined } */
20
- SmartLockHintOptions . prototype . context ;
21
-
22
- /**
23
- * @record
24
- * @struct
25
- */
26
- function SmartLockRequestOptions ( ) { }
17
+ /** @type {string } */
18
+ SmartLockOptions . prototype . client_id ;
27
19
28
- /** @type {!Array<string> } */
29
- SmartLockRequestOptions . prototype . supportedAuthMethods ;
20
+ /** @type {?boolean|undefined } */
21
+ SmartLockOptions . prototype . auto_select ;
30
22
31
- /** @type {!Array<!Object<string,string>> } */
32
- SmartLockRequestOptions . prototype . supportedIdTokenProviders ;
23
+ /** @type {function(SmartLockCredential) } */
24
+ SmartLockOptions . prototype . callback ;
33
25
34
- /** @type {?string|undefined } */
35
- SmartLockRequestOptions . prototype . context ;
36
26
37
27
/**
38
28
* @record
39
29
* @struct
40
30
*/
41
31
function SmartLockCredential ( ) { }
42
32
43
- /** @type {string } */
44
- SmartLockCredential . prototype . id ;
45
-
46
- /** @type {string } */
47
- SmartLockCredential . prototype . authMethod ;
48
-
49
33
/** @type {string|undefined } */
50
- SmartLockCredential . prototype . authDomain ;
34
+ SmartLockCredential . prototype . credential ;
51
35
52
36
/** @type {string|undefined } */
53
- SmartLockCredential . prototype . displayName ;
37
+ SmartLockCredential . prototype . clientId ;
54
38
55
39
/** @type {string|undefined } */
56
- SmartLockCredential . prototype . profilePicture ;
57
-
58
- /** @type {string|undefined } */
59
- SmartLockCredential . prototype . idToken ;
40
+ SmartLockCredential . prototype . select_by ;
60
41
61
42
/**
62
43
* @record
@@ -65,80 +46,21 @@ SmartLockCredential.prototype.idToken;
65
46
function SmartLockApi ( ) { }
66
47
67
48
/**
68
- * Requests the credential provider whether hints are available or not for
69
- * the current user.
70
- *
71
- * @param {!SmartLockHintOptions } options
72
- * Describes the types of credentials that are supported by the origin.
73
- * @return {!Promise<boolean> }
74
- * A promise that resolves with true if at least one hint is available,
75
- * and resolves with false if none are available. The promise will not
76
- * reject: if an error happen, it should resolve with false.
77
- */
78
- SmartLockApi . prototype . hintsAvailable = function ( options ) { } ;
79
-
80
- /**
81
- * Attempts to retrieve a sign-up hint that can be used to create a new
82
- * user account.
49
+ * Initializes GSI sign in process.
83
50
*
84
- * @param {!SmartLockHintOptions } options
51
+ * @param {!SmartLockOptions } options
85
52
* Describes the types of credentials that are supported by the origin,
86
53
* and customization properties for the display of any UI pertaining to
87
54
* releasing this credential.
88
- * @return {!Promise<!SmartLockCredential> }
89
- * A promise for a credential hint. The promise will be rejected if the
90
- * user cancels the hint selection process, if there are no hints available,
91
- * or if an error happens.
92
- */
93
- SmartLockApi . prototype . hint = function ( options ) { } ;
94
-
95
- /**
96
- * Attempts to retrieve a credential for the current origin.
97
- *
98
- * @param {!SmartLockRequestOptions } options
99
- * Describes the types of credentials that are supported by the origin.
100
- * @return {!Promise<!SmartLockCredential> }
101
- * A promise for the credential, which will be rejected if there are no
102
- * credentials available or the user refuses to release the credential.
103
- * Otherwise, the promise will resolve with a credential that the app
104
- * can use.
105
55
*/
106
- SmartLockApi . prototype . retrieve = function ( options ) { } ;
56
+ SmartLockApi . prototype . initialize = function ( options ) { } ;
107
57
108
58
/**
109
- * Prevents the automatic release of a credential from the retrieve operation.
110
- * This should be invoked when the user signs out, in order to prevent an
111
- * automatic sign-in loop. This cannot be called while another operation is
112
- * pending so should be called before retrieve.
113
- * @return {!Promise<void> }
114
- * A promise for the completion of notifying the provider to disable
115
- * automatic sign-in.
59
+ * Triggers the prompt to display.
116
60
*/
117
- SmartLockApi . prototype . disableAutoSignIn = function ( ) { } ;
61
+ SmartLockApi . prototype . prompt = function ( ) { } ;
118
62
119
63
/**
120
64
* Cancels the last operation triggered.
121
- * @return {!Promise<void> }
122
- * A promise for the completion of the cancellation.
123
65
*/
124
- SmartLockApi . prototype . cancelLastOperation = function ( ) { } ;
125
-
126
- /**
127
- * Sets a custom timeouts, in milliseconds, after which a request is
128
- * considered failed.
129
- * @param {number|null } timeoutMs The timeout in milliseconds.
130
- */
131
- SmartLockApi . prototype . setTimeouts = function ( timeoutMs ) { } ;
132
-
133
- /**
134
- * Sets the render mode of the credentials selector, or null if the default
135
- * should be used. Available render modes are: 'bottomSheet' and 'navPopout'.
136
- * @param {string|null } renderMode
137
- */
138
- SmartLockApi . prototype . setRenderMode = function ( renderMode ) { } ;
139
-
140
- /** @type {!SmartLockApi } */
141
- var googleyolo ;
142
-
143
- /** @type {function(!SmartLockApi)|undefined } */
144
- var onGoogleYoloLoad ;
66
+ SmartLockApi . prototype . cancel = function ( ) { } ;
0 commit comments