@casual-simulation/aux-vm-browser 3.4.6-alpha.14601027727 → 3.5.0-alpha.15117651144

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.
Files changed (38) hide show
  1. package/html/IFrameHelpers.js +28 -39
  2. package/html/IFrameHelpers.js.map +1 -1
  3. package/managers/AuthCoordinator.d.ts +9 -0
  4. package/managers/AuthCoordinator.js +369 -383
  5. package/managers/AuthCoordinator.js.map +1 -1
  6. package/managers/AuthEndpointHelper.d.ts +3 -2
  7. package/managers/AuthEndpointHelper.js +399 -462
  8. package/managers/AuthEndpointHelper.js.map +1 -1
  9. package/managers/AuthHelper.js +2 -2
  10. package/managers/AuthHelper.js.map +1 -1
  11. package/managers/BotManager.js +54 -58
  12. package/managers/BotManager.js.map +1 -1
  13. package/managers/BotPanelManager.js +2 -11
  14. package/managers/BotPanelManager.js.map +1 -1
  15. package/managers/BrowserSimulationCalculations.js +1 -1
  16. package/managers/BrowserSimulationCalculations.js.map +1 -1
  17. package/managers/IdePortalManager.js +2 -11
  18. package/managers/IdePortalManager.js.map +1 -1
  19. package/managers/LivekitManager.js +320 -324
  20. package/managers/LivekitManager.js.map +1 -1
  21. package/managers/SystemPortalCoordinator.js +74 -66
  22. package/managers/SystemPortalCoordinator.js.map +1 -1
  23. package/package.json +15 -12
  24. package/partitions/LocalStoragePartition.d.ts +6 -0
  25. package/partitions/LocalStoragePartition.js +45 -47
  26. package/partitions/LocalStoragePartition.js.map +1 -1
  27. package/partitions/ProxyClientPartition.js +28 -40
  28. package/partitions/ProxyClientPartition.js.map +1 -1
  29. package/vm/AuxVMImpl.js +120 -153
  30. package/vm/AuxVMImpl.js.map +1 -1
  31. package/vm/BrowserAuxChannel.js +9 -22
  32. package/vm/BrowserAuxChannel.js.map +1 -1
  33. package/vm/ConnectableAuxVM.js +54 -85
  34. package/vm/ConnectableAuxVM.js.map +1 -1
  35. package/vm/StaticAuxVMImpl.d.ts +91 -3
  36. package/vm/StaticAuxVMImpl.js +198 -108
  37. package/vm/StaticAuxVMImpl.js.map +1 -1
  38. package/vm/WorkerEntryHelpers.js.map +1 -1
@@ -1,17 +1,7 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { wrap, proxy } from 'comlink';
11
2
  import { setupChannel, waitForLoad } from '../html/IFrameHelpers';
12
3
  import { BehaviorSubject, Subscription } from 'rxjs';
13
- import { hasValue } from '@casual-simulation/aux-common';
14
- import { parseRecordKey } from '@casual-simulation/aux-records';
4
+ import { hasValue, parseRecordKey } from '@casual-simulation/aux-common';
15
5
  // Save the query string that was used when the site loaded
16
6
  const query = typeof location !== 'undefined' ? location.search : null;
17
7
  /**
@@ -82,77 +72,73 @@ export class AuthEndpointHelper {
82
72
  this._sub = null;
83
73
  }
84
74
  }
85
- _init() {
86
- return __awaiter(this, void 0, void 0, function* () {
87
- if (!this._initPromise) {
88
- this._initPromise = this._initCore();
89
- }
90
- return this._initPromise;
91
- });
75
+ async _init() {
76
+ if (!this._initPromise) {
77
+ this._initPromise = this._initCore();
78
+ }
79
+ return this._initPromise;
92
80
  }
93
- _initCore() {
94
- return __awaiter(this, void 0, void 0, function* () {
95
- if (!hasValue(this._origin)) {
96
- throw new Error('Cannot initialize AuthHelper because no iframe origin is set.');
97
- }
98
- this._loginStatus.next({
99
- isLoading: true,
100
- });
101
- const iframeUrl = new URL(`/iframe.html${query}`, this._origin).href;
102
- const iframe = (this._iframe = document.createElement('iframe'));
103
- this._sub.add(() => {
104
- iframe.remove();
105
- });
106
- this._iframe.src = iframeUrl;
107
- this._iframe.style.display = 'none';
108
- this._iframe.allow = 'publickey-credentials-get *';
109
- this._iframe.className = 'auth-helper-iframe';
110
- let promise = waitForLoad(this._iframe);
111
- document.body.insertBefore(this._iframe, document.body.firstChild);
112
- yield promise;
113
- this._channel = setupChannel(this._iframe.contentWindow);
114
- const wrapper = wrap(this._channel.port1);
115
- this._proxy = yield new wrapper(this._initialSessionKey, this._initialConnectionKey);
116
- try {
117
- this._protocolVersion = yield this._proxy.getProtocolVersion();
118
- }
119
- catch (err) {
120
- console.log('[AuthHelper] Could not get protocol version. Defaulting to version 1.');
121
- this._protocolVersion = 1;
122
- }
123
- if (this._protocolVersion >= 2) {
124
- yield this._proxy.addLoginUICallback(proxy((status) => {
125
- this._loginUIStatus.next(status);
126
- }));
127
- yield this._proxy.addLoginStatusCallback(proxy((status) => {
128
- this._loginStatus.next(status);
129
- }));
130
- }
131
- if (this._protocolVersion >= 9) {
132
- yield this._proxy.addOAuthRedirectCallback(proxy((request) => {
133
- this._handleOAuthRedirectCallback(request);
134
- }));
81
+ async _initCore() {
82
+ if (!hasValue(this._origin)) {
83
+ throw new Error('Cannot initialize AuthHelper because no iframe origin is set.');
84
+ }
85
+ this._loginStatus.next({
86
+ isLoading: true,
87
+ });
88
+ const iframeUrl = new URL(`/iframe.html${query}`, this._origin).href;
89
+ const iframe = (this._iframe = document.createElement('iframe'));
90
+ this._sub.add(() => {
91
+ iframe.remove();
92
+ });
93
+ this._iframe.src = iframeUrl;
94
+ this._iframe.style.display = 'none';
95
+ this._iframe.allow = 'publickey-credentials-get *';
96
+ this._iframe.className = 'auth-helper-iframe';
97
+ let promise = waitForLoad(this._iframe);
98
+ document.body.insertBefore(this._iframe, document.body.firstChild);
99
+ await promise;
100
+ this._channel = setupChannel(this._iframe.contentWindow);
101
+ const wrapper = wrap(this._channel.port1);
102
+ this._proxy = await new wrapper(this._initialSessionKey, this._initialConnectionKey);
103
+ try {
104
+ this._protocolVersion = await this._proxy.getProtocolVersion();
105
+ }
106
+ catch (err) {
107
+ console.log('[AuthHelper] Could not get protocol version. Defaulting to version 1.');
108
+ this._protocolVersion = 1;
109
+ }
110
+ if (this._protocolVersion >= 2) {
111
+ await this._proxy.addLoginUICallback(proxy((status) => {
112
+ this._loginUIStatus.next(status);
113
+ }));
114
+ await this._proxy.addLoginStatusCallback(proxy((status) => {
115
+ this._loginStatus.next(status);
116
+ }));
117
+ }
118
+ if (this._protocolVersion >= 9) {
119
+ await this._proxy.addOAuthRedirectCallback(proxy((request) => {
120
+ this._handleOAuthRedirectCallback(request);
121
+ }));
122
+ }
123
+ if (this._protocolVersion >= 4) {
124
+ this._recordsOrigin = await this._proxy.getRecordsOrigin();
125
+ }
126
+ if (this._protocolVersion >= 9) {
127
+ this._websocketOrigin = await this._proxy.getWebsocketOrigin();
128
+ this._websocketProtocol = await this._proxy.getWebsocketProtocol();
129
+ }
130
+ this._loginUIStatus.subscribe((status) => {
131
+ if (!this._iframe) {
132
+ return;
135
133
  }
136
- if (this._protocolVersion >= 4) {
137
- this._recordsOrigin = yield this._proxy.getRecordsOrigin();
134
+ if (status.page === 'show_iframe') {
135
+ this._iframe.style.display = null;
138
136
  }
139
- if (this._protocolVersion >= 9) {
140
- this._websocketOrigin = yield this._proxy.getWebsocketOrigin();
141
- this._websocketProtocol = yield this._proxy.getWebsocketProtocol();
137
+ else {
138
+ this._iframe.style.display = 'none';
142
139
  }
143
- this._loginUIStatus.subscribe((status) => {
144
- if (!this._iframe) {
145
- return;
146
- }
147
- if (status.page === 'show_iframe') {
148
- this._iframe.style.display = null;
149
- }
150
- else {
151
- this._iframe.style.display = 'none';
152
- }
153
- });
154
- this._initialized = true;
155
140
  });
141
+ this._initialized = true;
156
142
  }
157
143
  _handleOAuthRedirectCallback(request) {
158
144
  if (this._newTab && !this._newTab.closed) {
@@ -165,429 +151,380 @@ export class AuthEndpointHelper {
165
151
  /**
166
152
  * Determines if the user is authenticated.
167
153
  */
168
- isAuthenticated() {
169
- return __awaiter(this, void 0, void 0, function* () {
170
- if (!hasValue(this._origin)) {
171
- return false;
172
- }
173
- if (!this._initialized) {
174
- yield this._init();
175
- }
176
- return yield this._isAuthenticatedCore();
177
- });
154
+ async isAuthenticated() {
155
+ if (!hasValue(this._origin)) {
156
+ return false;
157
+ }
158
+ if (!this._initialized) {
159
+ await this._init();
160
+ }
161
+ return await this._isAuthenticatedCore();
178
162
  }
179
- _isAuthenticatedCore() {
180
- return __awaiter(this, void 0, void 0, function* () {
181
- return yield this._proxy.isLoggedIn();
182
- });
163
+ async _isAuthenticatedCore() {
164
+ return await this._proxy.isLoggedIn();
165
+ }
166
+ async relogin() {
167
+ if (!hasValue(this._origin)) {
168
+ return;
169
+ }
170
+ if (!this._initialized) {
171
+ await this._init();
172
+ }
173
+ if (this._protocolVersion < 12) {
174
+ await this._proxy.logout();
175
+ await this._proxy.login(true);
176
+ }
177
+ else {
178
+ await this._proxy.relogin();
179
+ }
183
180
  }
184
181
  /**
185
182
  * Requests that the user become authenticated if they are not already.
186
183
  */
187
- authenticate(hint) {
188
- return __awaiter(this, void 0, void 0, function* () {
189
- if (!hasValue(this._origin)) {
190
- return null;
191
- }
192
- if (!this._initialized) {
193
- yield this._init();
194
- }
195
- if (this._authenticating) {
196
- return yield this._authenticationPromise;
197
- }
198
- try {
199
- this._authenticating = true;
200
- this._authenticationPromise = this._authenticateCore(hint);
201
- return yield this._authenticationPromise;
202
- }
203
- finally {
204
- this._authenticating = false;
205
- }
206
- });
184
+ async authenticate(hint) {
185
+ if (!hasValue(this._origin)) {
186
+ return null;
187
+ }
188
+ if (!this._initialized) {
189
+ await this._init();
190
+ }
191
+ if (this._authenticating) {
192
+ return await this._authenticationPromise;
193
+ }
194
+ try {
195
+ this._authenticating = true;
196
+ this._authenticationPromise = this._authenticateCore(hint);
197
+ return await this._authenticationPromise;
198
+ }
199
+ finally {
200
+ this._authenticating = false;
201
+ }
207
202
  }
208
- _authenticateCore(hint) {
209
- return __awaiter(this, void 0, void 0, function* () {
210
- if (hint === 'sign in') {
211
- this._createNewTab();
212
- }
213
- const result = yield this._proxy.login(undefined, hint);
214
- if (this._protocolVersion < 2) {
215
- this._loginStatus.next({
216
- authData: result,
217
- });
218
- }
219
- return result;
220
- });
203
+ async _authenticateCore(hint) {
204
+ if (hint === 'sign in') {
205
+ this._createNewTab();
206
+ }
207
+ const result = await this._proxy.login(undefined, hint);
208
+ if (this._protocolVersion < 2) {
209
+ this._loginStatus.next({
210
+ authData: result,
211
+ });
212
+ }
213
+ return result;
221
214
  }
222
215
  /**
223
216
  * Requests that the user become authenticated entirely in the background.
224
217
  * This will not show any UI to the user but may also mean that the user will not be able to be authenticated.
225
218
  */
226
- authenticateInBackground() {
227
- return __awaiter(this, void 0, void 0, function* () {
228
- if (!hasValue(this._origin)) {
229
- return null;
230
- }
231
- if (!this._initialized) {
232
- yield this._init();
233
- }
234
- return yield this._authenticateInBackgroundCore();
235
- });
236
- }
237
- _authenticateInBackgroundCore() {
238
- return __awaiter(this, void 0, void 0, function* () {
239
- const result = yield this._proxy.login(true);
240
- if (this._protocolVersion < 2) {
241
- this._loginStatus.next({
242
- authData: result,
243
- });
244
- }
245
- return result;
246
- });
219
+ async authenticateInBackground() {
220
+ if (!hasValue(this._origin)) {
221
+ return null;
222
+ }
223
+ if (!this._initialized) {
224
+ await this._init();
225
+ }
226
+ return await this._authenticateInBackgroundCore();
247
227
  }
248
- createPublicRecordKey(recordName, policy) {
249
- return __awaiter(this, void 0, void 0, function* () {
250
- if (!hasValue(this._origin)) {
251
- return {
252
- success: false,
253
- errorCode: 'not_supported',
254
- errorMessage: 'Records are not supported on this inst.',
255
- errorReason: 'not_supported',
256
- };
257
- }
258
- if (!this._initialized) {
259
- yield this._init();
260
- }
261
- return yield this._createPublicRecordKeyCore(recordName, policy);
262
- });
228
+ async _authenticateInBackgroundCore() {
229
+ const result = await this._proxy.login(true);
230
+ if (this._protocolVersion < 2) {
231
+ this._loginStatus.next({
232
+ authData: result,
233
+ });
234
+ }
235
+ return result;
236
+ }
237
+ async createPublicRecordKey(recordName, policy) {
238
+ if (!hasValue(this._origin)) {
239
+ return {
240
+ success: false,
241
+ errorCode: 'not_supported',
242
+ errorMessage: 'Records are not supported on this inst.',
243
+ errorReason: 'not_supported',
244
+ };
245
+ }
246
+ if (!this._initialized) {
247
+ await this._init();
248
+ }
249
+ return await this._createPublicRecordKeyCore(recordName, policy);
263
250
  }
264
- _createPublicRecordKeyCore(recordName, policy) {
265
- return __awaiter(this, void 0, void 0, function* () {
266
- return yield this._proxy.createPublicRecordKey(recordName, policy);
267
- });
251
+ async _createPublicRecordKeyCore(recordName, policy) {
252
+ return await this._proxy.createPublicRecordKey(recordName, policy);
268
253
  }
269
- getRecordsOrigin() {
254
+ async getRecordsOrigin() {
270
255
  var _a, _b;
271
- return __awaiter(this, void 0, void 0, function* () {
272
- if (!hasValue(this._origin)) {
273
- return null;
274
- }
275
- if (!this._initialized) {
276
- yield this._init();
277
- }
278
- return ((_b = (_a = this._recordsOrigin) !== null && _a !== void 0 ? _a : this._defaultRecordsOrigin) !== null && _b !== void 0 ? _b : this._origin);
279
- });
256
+ if (!hasValue(this._origin)) {
257
+ return null;
258
+ }
259
+ if (!this._initialized) {
260
+ await this._init();
261
+ }
262
+ return ((_b = (_a = this._recordsOrigin) !== null && _a !== void 0 ? _a : this._defaultRecordsOrigin) !== null && _b !== void 0 ? _b : this._origin);
280
263
  }
281
- getWebsocketOrigin() {
282
- return __awaiter(this, void 0, void 0, function* () {
283
- if (!hasValue(this._origin)) {
284
- return null;
285
- }
286
- if (!this._initialized) {
287
- yield this._init();
288
- }
289
- if (this._protocolVersion < 9) {
290
- return null;
291
- }
292
- return this._websocketOrigin;
293
- });
264
+ async getWebsocketOrigin() {
265
+ if (!hasValue(this._origin)) {
266
+ return null;
267
+ }
268
+ if (!this._initialized) {
269
+ await this._init();
270
+ }
271
+ if (this._protocolVersion < 9) {
272
+ return null;
273
+ }
274
+ return this._websocketOrigin;
294
275
  }
295
- getWebsocketProtocol() {
276
+ async getWebsocketProtocol() {
296
277
  var _a;
297
- return __awaiter(this, void 0, void 0, function* () {
298
- if (!hasValue(this._origin)) {
299
- return null;
300
- }
301
- if (!this._initialized) {
302
- yield this._init();
303
- }
304
- if (this._protocolVersion < 9) {
305
- return null;
306
- }
307
- return (_a = this._websocketProtocol) !== null && _a !== void 0 ? _a : null;
308
- });
309
- }
310
- getRecordKeyPolicy(recordKey) {
311
- return __awaiter(this, void 0, void 0, function* () {
312
- const keyInfo = parseRecordKey(recordKey);
313
- if (!keyInfo) {
314
- return null;
315
- }
316
- const [name, secret, policy] = keyInfo;
317
- return policy;
318
- });
319
- }
320
- getAuthToken() {
321
- return __awaiter(this, void 0, void 0, function* () {
322
- if (!hasValue(this._origin)) {
323
- return null;
324
- }
325
- if (!this._initialized) {
326
- yield this._init();
327
- }
328
- return yield this._getAuthTokenCore();
329
- });
278
+ if (!hasValue(this._origin)) {
279
+ return null;
280
+ }
281
+ if (!this._initialized) {
282
+ await this._init();
283
+ }
284
+ if (this._protocolVersion < 9) {
285
+ return null;
286
+ }
287
+ return (_a = this._websocketProtocol) !== null && _a !== void 0 ? _a : null;
330
288
  }
331
- _getAuthTokenCore() {
332
- return __awaiter(this, void 0, void 0, function* () {
333
- return yield this._proxy.getAuthToken();
334
- });
289
+ async getRecordKeyPolicy(recordKey) {
290
+ const keyInfo = parseRecordKey(recordKey);
291
+ if (!keyInfo) {
292
+ return null;
293
+ }
294
+ const [name, secret, policy] = keyInfo;
295
+ return policy;
335
296
  }
336
- getConnectionKey() {
337
- return __awaiter(this, void 0, void 0, function* () {
338
- if (!hasValue(this._origin)) {
339
- return null;
340
- }
341
- if (!this._initialized) {
342
- yield this._init();
343
- }
344
- if (this._protocolVersion < 6) {
345
- return null;
346
- }
347
- return yield this._getConnectionKeyCore();
348
- });
297
+ async getAuthToken() {
298
+ if (!hasValue(this._origin)) {
299
+ return null;
300
+ }
301
+ if (!this._initialized) {
302
+ await this._init();
303
+ }
304
+ return await this._getAuthTokenCore();
349
305
  }
350
- _getConnectionKeyCore() {
351
- return __awaiter(this, void 0, void 0, function* () {
352
- return yield this._proxy.getConnectionKey();
353
- });
306
+ async _getAuthTokenCore() {
307
+ return await this._proxy.getAuthToken();
354
308
  }
355
- openAccountPage() {
356
- return __awaiter(this, void 0, void 0, function* () {
357
- if (!hasValue(this._origin)) {
358
- return;
359
- }
360
- if (!this._initialized) {
361
- yield this._init();
362
- }
363
- if (this._protocolVersion < 2) {
364
- return;
365
- }
366
- if (this._protocolVersion >= 11) {
367
- const newTab = window.open('/loading-oauth.html', '_blank');
368
- const url = yield this._proxy.getAccountPage();
369
- if (newTab && !newTab.closed) {
370
- newTab.location = url;
371
- }
372
- }
373
- else {
374
- return yield this._proxy.openAccountPage();
375
- }
376
- });
309
+ async getConnectionKey() {
310
+ if (!hasValue(this._origin)) {
311
+ return null;
312
+ }
313
+ if (!this._initialized) {
314
+ await this._init();
315
+ }
316
+ if (this._protocolVersion < 6) {
317
+ return null;
318
+ }
319
+ return await this._getConnectionKeyCore();
377
320
  }
378
- setUseCustomUI(useCustomUI) {
379
- return __awaiter(this, void 0, void 0, function* () {
380
- if (!hasValue(this._origin)) {
381
- return;
382
- }
383
- if (!this._initialized) {
384
- yield this._init();
385
- }
386
- if (this._protocolVersion < 2) {
387
- return;
388
- }
389
- return yield this._proxy.setUseCustomUI(useCustomUI);
390
- });
321
+ async _getConnectionKeyCore() {
322
+ return await this._proxy.getConnectionKey();
391
323
  }
392
- provideEmailAddress(email, acceptedTermsOfService) {
393
- return __awaiter(this, void 0, void 0, function* () {
394
- if (!hasValue(this._origin)) {
395
- return;
396
- }
397
- if (!this._initialized) {
398
- yield this._init();
399
- }
400
- if (this._protocolVersion < 2) {
401
- return;
324
+ async openAccountPage() {
325
+ if (!hasValue(this._origin)) {
326
+ return;
327
+ }
328
+ if (!this._initialized) {
329
+ await this._init();
330
+ }
331
+ if (this._protocolVersion < 2) {
332
+ return;
333
+ }
334
+ if (this._protocolVersion >= 11) {
335
+ const newTab = window.open('/loading-oauth.html', '_blank');
336
+ const url = await this._proxy.getAccountPage();
337
+ if (newTab && !newTab.closed) {
338
+ newTab.location = url;
402
339
  }
403
- return yield this._proxy.provideEmailAddress(email, acceptedTermsOfService);
404
- });
340
+ }
341
+ else {
342
+ return await this._proxy.openAccountPage();
343
+ }
405
344
  }
406
- isValidEmailAddress(email) {
407
- return __awaiter(this, void 0, void 0, function* () {
408
- if (!hasValue(this._origin)) {
409
- return;
410
- }
411
- if (!this._initialized) {
412
- yield this._init();
413
- }
414
- if (this._protocolVersion < 9) {
415
- return {
416
- success: true,
417
- allowed: true,
418
- };
419
- }
420
- return yield this._proxy.isValidEmailAddress(email);
421
- });
345
+ async setUseCustomUI(useCustomUI) {
346
+ if (!hasValue(this._origin)) {
347
+ return;
348
+ }
349
+ if (!this._initialized) {
350
+ await this._init();
351
+ }
352
+ if (this._protocolVersion < 2) {
353
+ return;
354
+ }
355
+ return await this._proxy.setUseCustomUI(useCustomUI);
422
356
  }
423
- isValidDisplayName(displayName, name) {
424
- return __awaiter(this, void 0, void 0, function* () {
425
- if (!hasValue(this._origin)) {
426
- return;
427
- }
428
- if (!this._initialized) {
429
- yield this._init();
430
- }
431
- if (this._protocolVersion < 9) {
432
- return {
433
- success: true,
434
- allowed: true,
435
- };
436
- }
437
- return yield this._proxy.isValidDisplayName(displayName, name);
438
- });
357
+ async provideEmailAddress(email, acceptedTermsOfService) {
358
+ if (!hasValue(this._origin)) {
359
+ return;
360
+ }
361
+ if (!this._initialized) {
362
+ await this._init();
363
+ }
364
+ if (this._protocolVersion < 2) {
365
+ return;
366
+ }
367
+ return await this._proxy.provideEmailAddress(email, acceptedTermsOfService);
439
368
  }
440
- provideSmsNumber(sms, acceptedTermsOfService) {
441
- return __awaiter(this, void 0, void 0, function* () {
442
- if (!hasValue(this._origin)) {
443
- return;
444
- }
445
- if (!this._initialized) {
446
- yield this._init();
447
- }
448
- if (this._protocolVersion < 3) {
449
- return;
450
- }
451
- return yield this._proxy.provideSmsNumber(sms, acceptedTermsOfService);
452
- });
369
+ async isValidEmailAddress(email) {
370
+ if (!hasValue(this._origin)) {
371
+ return;
372
+ }
373
+ if (!this._initialized) {
374
+ await this._init();
375
+ }
376
+ if (this._protocolVersion < 9) {
377
+ return {
378
+ success: true,
379
+ allowed: true,
380
+ };
381
+ }
382
+ return await this._proxy.isValidEmailAddress(email);
453
383
  }
454
- provideCode(code) {
455
- return __awaiter(this, void 0, void 0, function* () {
456
- if (!hasValue(this._origin)) {
457
- return;
458
- }
459
- if (!this._initialized) {
460
- yield this._init();
461
- }
462
- if (this._protocolVersion < 5) {
463
- return;
464
- }
465
- return yield this._proxy.provideCode(code);
466
- });
384
+ async isValidDisplayName(displayName, name) {
385
+ if (!hasValue(this._origin)) {
386
+ return;
387
+ }
388
+ if (!this._initialized) {
389
+ await this._init();
390
+ }
391
+ if (this._protocolVersion < 9) {
392
+ return {
393
+ success: true,
394
+ allowed: true,
395
+ };
396
+ }
397
+ return await this._proxy.isValidDisplayName(displayName, name);
467
398
  }
468
- provideLoginResult(result) {
469
- return __awaiter(this, void 0, void 0, function* () {
470
- if (!hasValue(this._origin)) {
471
- return;
472
- }
473
- if (!this._initialized) {
474
- yield this._init();
475
- }
476
- if (this._protocolVersion < 10) {
477
- return;
478
- }
479
- return yield this._proxy.provideLoginResult(result);
480
- });
399
+ async provideSmsNumber(sms, acceptedTermsOfService) {
400
+ if (!hasValue(this._origin)) {
401
+ return;
402
+ }
403
+ if (!this._initialized) {
404
+ await this._init();
405
+ }
406
+ if (this._protocolVersion < 3) {
407
+ return;
408
+ }
409
+ return await this._proxy.provideSmsNumber(sms, acceptedTermsOfService);
481
410
  }
482
- providePrivoSignUpInfo(info) {
483
- return __awaiter(this, void 0, void 0, function* () {
484
- if (!hasValue(this._origin)) {
485
- return;
486
- }
487
- if (!this._initialized) {
488
- yield this._init();
489
- }
490
- if (this._protocolVersion < 9) {
491
- return;
492
- }
493
- return yield this._proxy.providePrivoSignUpInfo(info);
494
- });
411
+ async provideCode(code) {
412
+ if (!hasValue(this._origin)) {
413
+ return;
414
+ }
415
+ if (!this._initialized) {
416
+ await this._init();
417
+ }
418
+ if (this._protocolVersion < 5) {
419
+ return;
420
+ }
421
+ return await this._proxy.provideCode(code);
495
422
  }
496
- provideHasAccount(hasAccount) {
497
- return __awaiter(this, void 0, void 0, function* () {
498
- if (!hasValue(this._origin)) {
499
- return;
500
- }
501
- if (hasAccount) {
502
- this._createNewTab();
503
- }
504
- if (!this._initialized) {
505
- yield this._init();
506
- }
507
- if (this._protocolVersion < 9) {
508
- return;
509
- }
510
- return yield this._proxy.provideHasAccount(hasAccount);
511
- });
423
+ async provideLoginResult(result) {
424
+ if (!hasValue(this._origin)) {
425
+ return;
426
+ }
427
+ if (!this._initialized) {
428
+ await this._init();
429
+ }
430
+ if (this._protocolVersion < 10) {
431
+ return;
432
+ }
433
+ return await this._proxy.provideLoginResult(result);
512
434
  }
513
- cancelLogin() {
514
- return __awaiter(this, void 0, void 0, function* () {
515
- if (!hasValue(this._origin)) {
516
- return;
517
- }
518
- if (!this._initialized) {
519
- yield this._init();
520
- }
521
- if (this._protocolVersion < 2) {
522
- return;
523
- }
524
- return yield this._proxy.cancelLogin();
525
- });
435
+ async providePrivoSignUpInfo(info) {
436
+ if (!hasValue(this._origin)) {
437
+ return;
438
+ }
439
+ if (!this._initialized) {
440
+ await this._init();
441
+ }
442
+ if (this._protocolVersion < 9) {
443
+ return;
444
+ }
445
+ return await this._proxy.providePrivoSignUpInfo(info);
526
446
  }
527
- logout() {
528
- return __awaiter(this, void 0, void 0, function* () {
529
- if (!hasValue(this._origin)) {
530
- return;
531
- }
532
- if (!this._initialized) {
533
- yield this._init();
534
- }
535
- if (this._protocolVersion < 8) {
536
- return;
537
- }
538
- return yield this._logoutCore();
539
- });
447
+ async provideHasAccount(hasAccount) {
448
+ if (!hasValue(this._origin)) {
449
+ return;
450
+ }
451
+ if (hasAccount) {
452
+ this._createNewTab();
453
+ }
454
+ if (!this._initialized) {
455
+ await this._init();
456
+ }
457
+ if (this._protocolVersion < 9) {
458
+ return;
459
+ }
460
+ return await this._proxy.provideHasAccount(hasAccount);
540
461
  }
541
- _logoutCore() {
542
- return __awaiter(this, void 0, void 0, function* () {
543
- return yield this._proxy.logout();
544
- });
462
+ async cancelLogin() {
463
+ if (!hasValue(this._origin)) {
464
+ return;
465
+ }
466
+ if (!this._initialized) {
467
+ await this._init();
468
+ }
469
+ if (this._protocolVersion < 2) {
470
+ return;
471
+ }
472
+ return await this._proxy.cancelLogin();
545
473
  }
546
- getPolicyUrls() {
547
- return __awaiter(this, void 0, void 0, function* () {
548
- if (!hasValue(this._origin)) {
549
- return {
550
- privacyPolicyUrl: null,
551
- termsOfServiceUrl: null,
552
- codeOfConductUrl: null,
553
- supportUrl: null,
554
- };
555
- }
556
- if (!this._initialized) {
557
- yield this._init();
558
- }
559
- if (this._protocolVersion < 9) {
560
- return {
561
- privacyPolicyUrl: null,
562
- termsOfServiceUrl: null,
563
- codeOfConductUrl: null,
564
- supportUrl: null,
565
- };
566
- }
567
- return yield this._proxy.getPolicyUrls();
568
- });
474
+ async logout() {
475
+ if (!hasValue(this._origin)) {
476
+ return;
477
+ }
478
+ if (!this._initialized) {
479
+ await this._init();
480
+ }
481
+ if (this._protocolVersion < 8) {
482
+ return;
483
+ }
484
+ return await this._logoutCore();
485
+ }
486
+ async _logoutCore() {
487
+ return await this._proxy.logout();
488
+ }
489
+ async getPolicyUrls() {
490
+ if (!hasValue(this._origin)) {
491
+ return {
492
+ privacyPolicyUrl: null,
493
+ termsOfServiceUrl: null,
494
+ codeOfConductUrl: null,
495
+ supportUrl: null,
496
+ };
497
+ }
498
+ if (!this._initialized) {
499
+ await this._init();
500
+ }
501
+ if (this._protocolVersion < 9) {
502
+ return {
503
+ privacyPolicyUrl: null,
504
+ termsOfServiceUrl: null,
505
+ codeOfConductUrl: null,
506
+ supportUrl: null,
507
+ };
508
+ }
509
+ return await this._proxy.getPolicyUrls();
569
510
  }
570
- getComIdWebConfig(comId) {
571
- return __awaiter(this, void 0, void 0, function* () {
572
- if (!hasValue(this._origin)) {
573
- return null;
574
- }
575
- if (!this._initialized) {
576
- yield this._init();
577
- }
578
- return yield this._proxy.getComIdWebConfig(comId);
579
- });
511
+ async getComIdWebConfig(comId) {
512
+ if (!hasValue(this._origin)) {
513
+ return null;
514
+ }
515
+ if (!this._initialized) {
516
+ await this._init();
517
+ }
518
+ return await this._proxy.getComIdWebConfig(comId);
580
519
  }
581
- grantPermission(recordName, permission) {
582
- return __awaiter(this, void 0, void 0, function* () {
583
- if (!hasValue(this._origin)) {
584
- return null;
585
- }
586
- if (!this._initialized) {
587
- yield this._init();
588
- }
589
- return yield this._proxy.grantPermission(recordName, permission);
590
- });
520
+ async grantPermission(recordName, permission) {
521
+ if (!hasValue(this._origin)) {
522
+ return null;
523
+ }
524
+ if (!this._initialized) {
525
+ await this._init();
526
+ }
527
+ return await this._proxy.grantPermission(recordName, permission);
591
528
  }
592
529
  _createNewTab() {
593
530
  if (!this._requirePrivoLogin) {