@casual-simulation/aux-vm-browser 3.4.6-alpha.14668890889 → 3.5.0-alpha.15119114602
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/html/IFrameHelpers.js +28 -39
- package/html/IFrameHelpers.js.map +1 -1
- package/managers/AuthCoordinator.d.ts +9 -0
- package/managers/AuthCoordinator.js +369 -383
- package/managers/AuthCoordinator.js.map +1 -1
- package/managers/AuthEndpointHelper.d.ts +3 -2
- package/managers/AuthEndpointHelper.js +399 -462
- package/managers/AuthEndpointHelper.js.map +1 -1
- package/managers/AuthHelper.js +2 -2
- package/managers/AuthHelper.js.map +1 -1
- package/managers/BotManager.js +54 -58
- package/managers/BotManager.js.map +1 -1
- package/managers/BotPanelManager.js +2 -11
- package/managers/BotPanelManager.js.map +1 -1
- package/managers/BrowserSimulationCalculations.js +1 -1
- package/managers/BrowserSimulationCalculations.js.map +1 -1
- package/managers/IdePortalManager.js +2 -11
- package/managers/IdePortalManager.js.map +1 -1
- package/managers/LivekitManager.js +320 -324
- package/managers/LivekitManager.js.map +1 -1
- package/managers/SystemPortalCoordinator.js +74 -66
- package/managers/SystemPortalCoordinator.js.map +1 -1
- package/package.json +15 -12
- package/partitions/LocalStoragePartition.d.ts +6 -0
- package/partitions/LocalStoragePartition.js +44 -46
- package/partitions/LocalStoragePartition.js.map +1 -1
- package/partitions/ProxyClientPartition.js +28 -40
- package/partitions/ProxyClientPartition.js.map +1 -1
- package/vm/AuxVMImpl.js +120 -153
- package/vm/AuxVMImpl.js.map +1 -1
- package/vm/BrowserAuxChannel.js +9 -22
- package/vm/BrowserAuxChannel.js.map +1 -1
- package/vm/ConnectableAuxVM.js +54 -85
- package/vm/ConnectableAuxVM.js.map +1 -1
- package/vm/StaticAuxVMImpl.d.ts +91 -3
- package/vm/StaticAuxVMImpl.js +198 -108
- package/vm/StaticAuxVMImpl.js.map +1 -1
- 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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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 (
|
|
137
|
-
this.
|
|
134
|
+
if (status.page === 'show_iframe') {
|
|
135
|
+
this._iframe.style.display = null;
|
|
138
136
|
}
|
|
139
|
-
|
|
140
|
-
this.
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
|
181
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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
|
-
|
|
351
|
-
return
|
|
352
|
-
return yield this._proxy.getConnectionKey();
|
|
353
|
-
});
|
|
306
|
+
async _getAuthTokenCore() {
|
|
307
|
+
return await this._proxy.getAuthToken();
|
|
354
308
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
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
|
-
|
|
379
|
-
return
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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
|
-
|
|
404
|
-
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
return await this._proxy.openAccountPage();
|
|
343
|
+
}
|
|
405
344
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
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
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
return
|
|
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
|
-
|
|
542
|
-
|
|
543
|
-
return
|
|
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
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
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
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
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) {
|