11/**
22 * 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
37 *
48 * @externs
59 */
812 * @record
913 * @struct
1014 */
11- function SmartLockHintOptions ( ) { }
15+ function SmartLockOptions ( ) { }
1216
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 ;
2719
28- /** @type {!Array<string> } */
29- SmartLockRequestOptions . prototype . supportedAuthMethods ;
20+ /** @type {?boolean|undefined } */
21+ SmartLockOptions . prototype . auto_select ;
3022
31- /** @type {!Array<!Object<string,string>> } */
32- SmartLockRequestOptions . prototype . supportedIdTokenProviders ;
23+ /** @type {function(SmartLockCredential) } */
24+ SmartLockOptions . prototype . callback ;
3325
34- /** @type {?string|undefined } */
35- SmartLockRequestOptions . prototype . context ;
3626
3727/**
3828 * @record
3929 * @struct
4030 */
4131function SmartLockCredential ( ) { }
4232
43- /** @type {string } */
44- SmartLockCredential . prototype . id ;
45-
46- /** @type {string } */
47- SmartLockCredential . prototype . authMethod ;
48-
4933/** @type {string|undefined } */
50- SmartLockCredential . prototype . authDomain ;
34+ SmartLockCredential . prototype . credential ;
5135
5236/** @type {string|undefined } */
53- SmartLockCredential . prototype . displayName ;
37+ SmartLockCredential . prototype . clientId ;
5438
5539/** @type {string|undefined } */
56- SmartLockCredential . prototype . profilePicture ;
57-
58- /** @type {string|undefined } */
59- SmartLockCredential . prototype . idToken ;
40+ SmartLockCredential . prototype . select_by ;
6041
6142/**
6243 * @record
@@ -65,80 +46,21 @@ SmartLockCredential.prototype.idToken;
6546function SmartLockApi ( ) { }
6647
6748/**
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.
8350 *
84- * @param {!SmartLockHintOptions } options
51+ * @param {!SmartLockOptions } options
8552 * Describes the types of credentials that are supported by the origin,
8653 * and customization properties for the display of any UI pertaining to
8754 * 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.
10555 */
106- SmartLockApi . prototype . retrieve = function ( options ) { } ;
56+ SmartLockApi . prototype . initialize = function ( options ) { } ;
10757
10858/**
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.
11660 */
117- SmartLockApi . prototype . disableAutoSignIn = function ( ) { } ;
61+ SmartLockApi . prototype . prompt = function ( ) { } ;
11862
11963/**
12064 * Cancels the last operation triggered.
121- * @return {!Promise<void> }
122- * A promise for the completion of the cancellation.
12365 */
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