@turnkey/sdk-react 4.2.1 → 4.2.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/CHANGELOG.md +12 -0
- package/dist/components/auth/Auth.d.ts.map +1 -1
- package/dist/components/auth/Auth.js +19 -6
- package/dist/components/auth/Auth.js.map +1 -1
- package/dist/components/auth/Auth.mjs +167 -125
- package/dist/components/auth/Auth.mjs.map +1 -1
- package/dist/components/auth/OtpVerification.d.ts.map +1 -1
- package/dist/components/auth/OtpVerification.js +2 -1
- package/dist/components/auth/OtpVerification.js.map +1 -1
- package/dist/components/auth/OtpVerification.mjs +21 -17
- package/dist/components/auth/OtpVerification.mjs.map +1 -1
- package/dist/components/auth/PhoneInput.d.ts.map +1 -1
- package/dist/components/auth/PhoneInput.js +1 -2
- package/dist/components/auth/PhoneInput.js.map +1 -1
- package/dist/components/auth/PhoneInput.mjs +1 -2
- package/dist/components/auth/PhoneInput.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -156,6 +156,24 @@ var Auth = function Auth(_ref) {
|
|
|
156
156
|
useEffect(function () {
|
|
157
157
|
if (authIframeClient) {
|
|
158
158
|
setComponentReady(true);
|
|
159
|
+
var updateIframeKey = /*#__PURE__*/function () {
|
|
160
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
161
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
162
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
163
|
+
case 0:
|
|
164
|
+
_context2.next = 2;
|
|
165
|
+
return authIframeClient.initEmbeddedKey();
|
|
166
|
+
case 2:
|
|
167
|
+
case "end":
|
|
168
|
+
return _context2.stop();
|
|
169
|
+
}
|
|
170
|
+
}, _callee2);
|
|
171
|
+
}));
|
|
172
|
+
return function updateIframeKey() {
|
|
173
|
+
return _ref3.apply(this, arguments);
|
|
174
|
+
};
|
|
175
|
+
}();
|
|
176
|
+
updateIframeKey();
|
|
159
177
|
}
|
|
160
178
|
}, [authIframeClient]);
|
|
161
179
|
if (!componentReady) {
|
|
@@ -177,10 +195,10 @@ var Auth = function Auth(_ref) {
|
|
|
177
195
|
return (_phoneNumber$isValid = phoneNumber === null || phoneNumber === void 0 ? void 0 : phoneNumber.isValid()) !== null && _phoneNumber$isValid !== void 0 ? _phoneNumber$isValid : false;
|
|
178
196
|
};
|
|
179
197
|
var handleSignupWithPasskey = /*#__PURE__*/function () {
|
|
180
|
-
var
|
|
181
|
-
var siteInfo, _authConfig$sessionLe, _passkeyConfig$name, _passkeyConfig$displa,
|
|
182
|
-
return _regeneratorRuntime().wrap(function
|
|
183
|
-
while (1) switch (
|
|
198
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
199
|
+
var siteInfo, _authConfig$sessionLe, _passkeyConfig$name, _passkeyConfig$displa, _ref5, encodedChallenge, attestation, response, iframePublicKey;
|
|
200
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
201
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
184
202
|
case 0:
|
|
185
203
|
setPasskeySignupError("");
|
|
186
204
|
siteInfo = "".concat(new URL(window.location.href).hostname, " - ").concat(new Date().toLocaleString(undefined, {
|
|
@@ -193,12 +211,12 @@ var Auth = function Auth(_ref) {
|
|
|
193
211
|
}));
|
|
194
212
|
setPasskeySignupScreen(false);
|
|
195
213
|
setPasskeyCreationScreen(true);
|
|
196
|
-
|
|
214
|
+
_context3.prev = 4;
|
|
197
215
|
if (passkeyCreated) {
|
|
198
|
-
|
|
216
|
+
_context3.next = 22;
|
|
199
217
|
break;
|
|
200
218
|
}
|
|
201
|
-
|
|
219
|
+
_context3.next = 8;
|
|
202
220
|
return passkeyClient === null || passkeyClient === void 0 ? void 0 : passkeyClient.createUserPasskey({
|
|
203
221
|
publicKey: {
|
|
204
222
|
user: {
|
|
@@ -208,21 +226,21 @@ var Auth = function Auth(_ref) {
|
|
|
208
226
|
}
|
|
209
227
|
});
|
|
210
228
|
case 8:
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
|
|
229
|
+
_context3.t0 = _context3.sent;
|
|
230
|
+
if (_context3.t0) {
|
|
231
|
+
_context3.next = 11;
|
|
214
232
|
break;
|
|
215
233
|
}
|
|
216
|
-
|
|
234
|
+
_context3.t0 = {};
|
|
217
235
|
case 11:
|
|
218
|
-
|
|
219
|
-
encodedChallenge =
|
|
220
|
-
attestation =
|
|
236
|
+
_ref5 = _context3.t0;
|
|
237
|
+
encodedChallenge = _ref5.encodedChallenge;
|
|
238
|
+
attestation = _ref5.attestation;
|
|
221
239
|
if (!(encodedChallenge && attestation)) {
|
|
222
|
-
|
|
240
|
+
_context3.next = 21;
|
|
223
241
|
break;
|
|
224
242
|
}
|
|
225
|
-
|
|
243
|
+
_context3.next = 17;
|
|
226
244
|
return server.createSuborg(_objectSpread2({
|
|
227
245
|
email: email,
|
|
228
246
|
passkey: {
|
|
@@ -234,113 +252,129 @@ var Auth = function Auth(_ref) {
|
|
|
234
252
|
customAccounts: customAccounts
|
|
235
253
|
}));
|
|
236
254
|
case 17:
|
|
237
|
-
response =
|
|
255
|
+
response = _context3.sent;
|
|
238
256
|
if (response !== null && response !== void 0 && response.subOrganizationId) {
|
|
239
257
|
setPasskeyCreated(true);
|
|
240
258
|
}
|
|
241
|
-
|
|
259
|
+
_context3.next = 22;
|
|
242
260
|
break;
|
|
243
261
|
case 21:
|
|
244
262
|
case 22:
|
|
245
|
-
|
|
263
|
+
_context3.next = 24;
|
|
264
|
+
return authIframeClient.initEmbeddedKey();
|
|
265
|
+
case 24:
|
|
266
|
+
iframePublicKey = _context3.sent;
|
|
267
|
+
_context3.next = 27;
|
|
246
268
|
return passkeyClient === null || passkeyClient === void 0 ? void 0 : passkeyClient.loginWithPasskey({
|
|
247
269
|
sessionType: SessionType.READ_WRITE,
|
|
248
270
|
iframeClient: authIframeClient,
|
|
249
|
-
targetPublicKey:
|
|
271
|
+
targetPublicKey: iframePublicKey,
|
|
250
272
|
expirationSeconds: (_authConfig$sessionLe = authConfig.sessionLengthSeconds) === null || _authConfig$sessionLe === void 0 ? void 0 : _authConfig$sessionLe.toString()
|
|
251
273
|
});
|
|
252
|
-
case
|
|
253
|
-
|
|
274
|
+
case 27:
|
|
275
|
+
_context3.next = 29;
|
|
254
276
|
return onAuthSuccess();
|
|
255
|
-
case
|
|
256
|
-
|
|
277
|
+
case 29:
|
|
278
|
+
_context3.next = 35;
|
|
257
279
|
break;
|
|
258
|
-
case
|
|
259
|
-
|
|
260
|
-
|
|
280
|
+
case 31:
|
|
281
|
+
_context3.prev = 31;
|
|
282
|
+
_context3.t1 = _context3["catch"](4);
|
|
261
283
|
setPasskeySignupError(authErrors.passkey.timeoutOrNotAllowed);
|
|
262
|
-
console.error("Error during passkey signup: ",
|
|
263
|
-
case
|
|
284
|
+
console.error("Error during passkey signup: ", _context3.t1);
|
|
285
|
+
case 35:
|
|
264
286
|
case "end":
|
|
265
|
-
return
|
|
287
|
+
return _context3.stop();
|
|
266
288
|
}
|
|
267
|
-
},
|
|
289
|
+
}, _callee3, null, [[4, 31]]);
|
|
268
290
|
}));
|
|
269
291
|
return function handleSignupWithPasskey() {
|
|
270
|
-
return
|
|
292
|
+
return _ref4.apply(this, arguments);
|
|
271
293
|
};
|
|
272
294
|
}();
|
|
273
295
|
var handleLoginWithPasskey = /*#__PURE__*/function () {
|
|
274
|
-
var
|
|
275
|
-
var _authConfig$sessionLe2;
|
|
276
|
-
return _regeneratorRuntime().wrap(function
|
|
277
|
-
while (1) switch (
|
|
296
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
297
|
+
var _authConfig$sessionLe2, iframePublicKey;
|
|
298
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
299
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
278
300
|
case 0:
|
|
279
|
-
|
|
301
|
+
_context4.prev = 0;
|
|
280
302
|
setLoading("passkey");
|
|
281
|
-
|
|
303
|
+
_context4.next = 4;
|
|
304
|
+
return authIframeClient.initEmbeddedKey();
|
|
305
|
+
case 4:
|
|
306
|
+
iframePublicKey = _context4.sent;
|
|
307
|
+
_context4.next = 7;
|
|
282
308
|
return passkeyClient === null || passkeyClient === void 0 ? void 0 : passkeyClient.loginWithPasskey({
|
|
283
309
|
sessionType: SessionType.READ_WRITE,
|
|
284
310
|
iframeClient: authIframeClient,
|
|
285
|
-
targetPublicKey:
|
|
311
|
+
targetPublicKey: iframePublicKey,
|
|
286
312
|
expirationSeconds: (_authConfig$sessionLe2 = authConfig.sessionLengthSeconds) === null || _authConfig$sessionLe2 === void 0 ? void 0 : _authConfig$sessionLe2.toString()
|
|
287
313
|
});
|
|
288
|
-
case
|
|
289
|
-
|
|
314
|
+
case 7:
|
|
315
|
+
_context4.next = 9;
|
|
290
316
|
return onAuthSuccess();
|
|
291
|
-
case
|
|
292
|
-
|
|
317
|
+
case 9:
|
|
318
|
+
_context4.next = 15;
|
|
293
319
|
break;
|
|
294
|
-
case
|
|
295
|
-
|
|
296
|
-
|
|
320
|
+
case 11:
|
|
321
|
+
_context4.prev = 11;
|
|
322
|
+
_context4.t0 = _context4["catch"](0);
|
|
297
323
|
onError(authErrors.passkey.loginFailed);
|
|
298
|
-
console.error("Error during passkey login: ",
|
|
299
|
-
case 12:
|
|
300
|
-
_context3.prev = 12;
|
|
301
|
-
setLoading(undefined);
|
|
302
|
-
return _context3.finish(12);
|
|
324
|
+
console.error("Error during passkey login: ", _context4.t0);
|
|
303
325
|
case 15:
|
|
326
|
+
_context4.prev = 15;
|
|
327
|
+
setLoading(undefined);
|
|
328
|
+
return _context4.finish(15);
|
|
329
|
+
case 18:
|
|
304
330
|
case "end":
|
|
305
|
-
return
|
|
331
|
+
return _context4.stop();
|
|
306
332
|
}
|
|
307
|
-
},
|
|
333
|
+
}, _callee4, null, [[0, 11, 15, 18]]);
|
|
308
334
|
}));
|
|
309
335
|
return function handleLoginWithPasskey() {
|
|
310
|
-
return
|
|
336
|
+
return _ref6.apply(this, arguments);
|
|
311
337
|
};
|
|
312
338
|
}();
|
|
313
339
|
var handleOtpLogin = /*#__PURE__*/function () {
|
|
314
|
-
var
|
|
340
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(type, value, otpType) {
|
|
315
341
|
var _otpConfig$otpLength, _otpConfig$alphanumer;
|
|
316
|
-
var createSuborgData, resp, suborgIds, suborgId, initAuthResponse;
|
|
317
|
-
return _regeneratorRuntime().wrap(function
|
|
318
|
-
while (1) switch (
|
|
342
|
+
var createSuborgData, resp, suborgIds, suborgId, iframePublicKey, initAuthResponse;
|
|
343
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
344
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
319
345
|
case 0:
|
|
320
346
|
setLoading(otpType);
|
|
321
347
|
createSuborgData = {};
|
|
322
|
-
if (type === FilterType.Email)
|
|
348
|
+
if (type === FilterType.Email) {
|
|
349
|
+
createSuborgData.email = value;
|
|
350
|
+
} else if (type === FilterType.PhoneNumber) {
|
|
351
|
+
createSuborgData.phoneNumber = value;
|
|
352
|
+
}
|
|
323
353
|
if (customAccounts) {
|
|
324
354
|
createSuborgData.customAccounts = customAccounts;
|
|
325
355
|
}
|
|
326
|
-
|
|
356
|
+
_context5.next = 6;
|
|
327
357
|
return server.getOrCreateSuborg({
|
|
328
358
|
filterType: type,
|
|
329
359
|
filterValue: value,
|
|
330
360
|
additionalData: createSuborgData
|
|
331
361
|
});
|
|
332
362
|
case 6:
|
|
333
|
-
resp =
|
|
363
|
+
resp = _context5.sent;
|
|
334
364
|
suborgIds = resp === null || resp === void 0 ? void 0 : resp.subOrganizationIds;
|
|
335
365
|
if (!(!suborgIds || suborgIds.length === 0)) {
|
|
336
|
-
|
|
366
|
+
_context5.next = 11;
|
|
337
367
|
break;
|
|
338
368
|
}
|
|
339
369
|
onError(authErrors.otp.sendFailed);
|
|
340
|
-
return
|
|
370
|
+
return _context5.abrupt("return");
|
|
341
371
|
case 11:
|
|
342
372
|
suborgId = suborgIds[0];
|
|
343
|
-
|
|
373
|
+
_context5.next = 14;
|
|
374
|
+
return authIframeClient.initEmbeddedKey();
|
|
375
|
+
case 14:
|
|
376
|
+
iframePublicKey = _context5.sent;
|
|
377
|
+
_context5.next = 17;
|
|
344
378
|
return server.sendOtp(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
345
379
|
suborgID: suborgId,
|
|
346
380
|
otpType: otpType,
|
|
@@ -354,10 +388,10 @@ var Auth = function Auth(_ref) {
|
|
|
354
388
|
}), {}, {
|
|
355
389
|
otpLength: (_otpConfig$otpLength = otpConfig === null || otpConfig === void 0 ? void 0 : otpConfig.otpLength) !== null && _otpConfig$otpLength !== void 0 ? _otpConfig$otpLength : 6,
|
|
356
390
|
alphanumeric: (_otpConfig$alphanumer = otpConfig === null || otpConfig === void 0 ? void 0 : otpConfig.alphanumeric) !== null && _otpConfig$alphanumer !== void 0 ? _otpConfig$alphanumer : false,
|
|
357
|
-
userIdentifier:
|
|
391
|
+
userIdentifier: iframePublicKey
|
|
358
392
|
}));
|
|
359
|
-
case
|
|
360
|
-
initAuthResponse =
|
|
393
|
+
case 17:
|
|
394
|
+
initAuthResponse = _context5.sent;
|
|
361
395
|
if (initAuthResponse && initAuthResponse.otpId) {
|
|
362
396
|
setSuborgId(suborgId);
|
|
363
397
|
setOtpId(initAuthResponse === null || initAuthResponse === void 0 ? void 0 : initAuthResponse.otpId);
|
|
@@ -366,21 +400,21 @@ var Auth = function Auth(_ref) {
|
|
|
366
400
|
onError(authErrors.otp.sendFailed);
|
|
367
401
|
}
|
|
368
402
|
setLoading(undefined);
|
|
369
|
-
case
|
|
403
|
+
case 20:
|
|
370
404
|
case "end":
|
|
371
|
-
return
|
|
405
|
+
return _context5.stop();
|
|
372
406
|
}
|
|
373
|
-
},
|
|
407
|
+
}, _callee5);
|
|
374
408
|
}));
|
|
375
409
|
return function handleOtpLogin(_x, _x2, _x3) {
|
|
376
|
-
return
|
|
410
|
+
return _ref7.apply(this, arguments);
|
|
377
411
|
};
|
|
378
412
|
}();
|
|
379
413
|
var handleOAuthLogin = /*#__PURE__*/function () {
|
|
380
|
-
var
|
|
381
|
-
var createSuborgData, resp, suborgIds, suborgId, oauthSession;
|
|
382
|
-
return _regeneratorRuntime().wrap(function
|
|
383
|
-
while (1) switch (
|
|
414
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(credential, providerName) {
|
|
415
|
+
var createSuborgData, resp, suborgIds, suborgId, iframePublicKey, oauthSession;
|
|
416
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
417
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
384
418
|
case 0:
|
|
385
419
|
setOauthLoading(providerName);
|
|
386
420
|
createSuborgData = {
|
|
@@ -392,82 +426,86 @@ var Auth = function Auth(_ref) {
|
|
|
392
426
|
if (customAccounts) {
|
|
393
427
|
createSuborgData.customAccounts = customAccounts;
|
|
394
428
|
}
|
|
395
|
-
|
|
429
|
+
_context6.next = 5;
|
|
396
430
|
return server.getOrCreateSuborg({
|
|
397
431
|
filterType: FilterType.OidcToken,
|
|
398
432
|
filterValue: credential,
|
|
399
433
|
additionalData: createSuborgData
|
|
400
434
|
});
|
|
401
435
|
case 5:
|
|
402
|
-
resp =
|
|
436
|
+
resp = _context6.sent;
|
|
403
437
|
suborgIds = resp === null || resp === void 0 ? void 0 : resp.subOrganizationIds;
|
|
404
438
|
if (!(!suborgIds || suborgIds.length === 0)) {
|
|
405
|
-
|
|
439
|
+
_context6.next = 10;
|
|
406
440
|
break;
|
|
407
441
|
}
|
|
408
442
|
onError(authErrors.oauth.loginFailed);
|
|
409
|
-
return
|
|
443
|
+
return _context6.abrupt("return");
|
|
410
444
|
case 10:
|
|
411
445
|
suborgId = suborgIds[0];
|
|
412
|
-
|
|
446
|
+
_context6.next = 13;
|
|
447
|
+
return authIframeClient.initEmbeddedKey();
|
|
448
|
+
case 13:
|
|
449
|
+
iframePublicKey = _context6.sent;
|
|
450
|
+
_context6.next = 16;
|
|
413
451
|
return server.oauth({
|
|
414
452
|
suborgID: suborgId,
|
|
415
453
|
oidcToken: credential,
|
|
416
|
-
targetPublicKey:
|
|
454
|
+
targetPublicKey: iframePublicKey,
|
|
417
455
|
sessionLengthSeconds: authConfig.sessionLengthSeconds
|
|
418
456
|
});
|
|
419
|
-
case
|
|
420
|
-
oauthSession =
|
|
457
|
+
case 16:
|
|
458
|
+
oauthSession = _context6.sent;
|
|
421
459
|
if (!(oauthSession && oauthSession.token)) {
|
|
422
|
-
|
|
460
|
+
_context6.next = 24;
|
|
423
461
|
break;
|
|
424
462
|
}
|
|
425
|
-
|
|
463
|
+
_context6.next = 20;
|
|
426
464
|
return authIframeClient.loginWithSession(oauthSession);
|
|
427
|
-
case
|
|
428
|
-
|
|
465
|
+
case 20:
|
|
466
|
+
_context6.next = 22;
|
|
429
467
|
return onAuthSuccess();
|
|
430
|
-
case
|
|
431
|
-
|
|
468
|
+
case 22:
|
|
469
|
+
_context6.next = 25;
|
|
432
470
|
break;
|
|
433
|
-
case
|
|
471
|
+
case 24:
|
|
434
472
|
onError(authErrors.oauth.loginFailed);
|
|
435
|
-
case
|
|
473
|
+
case 25:
|
|
436
474
|
case "end":
|
|
437
|
-
return
|
|
475
|
+
return _context6.stop();
|
|
438
476
|
}
|
|
439
|
-
},
|
|
477
|
+
}, _callee6);
|
|
440
478
|
}));
|
|
441
479
|
return function handleOAuthLogin(_x4, _x5) {
|
|
442
|
-
return
|
|
480
|
+
return _ref8.apply(this, arguments);
|
|
443
481
|
};
|
|
444
482
|
}();
|
|
445
483
|
var handleLoginWithWallet = /*#__PURE__*/function () {
|
|
446
|
-
var
|
|
447
|
-
var _authConfig$sessionLe3, publicKey, _walletClient$getWall, type, resp, suborgIds;
|
|
448
|
-
return _regeneratorRuntime().wrap(function
|
|
449
|
-
while (1) switch (
|
|
484
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
485
|
+
var _authConfig$sessionLe3, publicKey, _walletClient$getWall, type, resp, suborgIds, iframePublicKey;
|
|
486
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
487
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
450
488
|
case 0:
|
|
451
489
|
setLoading("wallet");
|
|
452
|
-
|
|
490
|
+
_context7.prev = 1;
|
|
453
491
|
if (walletClient) {
|
|
454
|
-
|
|
492
|
+
_context7.next = 4;
|
|
455
493
|
break;
|
|
456
494
|
}
|
|
457
495
|
throw new Error("Wallet client not initialized");
|
|
458
496
|
case 4:
|
|
459
|
-
|
|
497
|
+
_context7.next = 6;
|
|
460
498
|
return walletClient.getPublicKey();
|
|
461
499
|
case 6:
|
|
462
|
-
publicKey =
|
|
500
|
+
publicKey = _context7.sent;
|
|
463
501
|
if (publicKey) {
|
|
464
|
-
|
|
502
|
+
_context7.next = 9;
|
|
465
503
|
break;
|
|
466
504
|
}
|
|
467
505
|
throw new Error(authErrors.wallet.noPublicKey);
|
|
468
506
|
case 9:
|
|
469
507
|
_walletClient$getWall = walletClient.getWalletInterface(), type = _walletClient$getWall.type;
|
|
470
|
-
|
|
508
|
+
_context7.next = 12;
|
|
471
509
|
return server.getOrCreateSuborg({
|
|
472
510
|
filterType: FilterType.PublicKey,
|
|
473
511
|
filterValue: publicKey,
|
|
@@ -479,45 +517,49 @@ var Auth = function Auth(_ref) {
|
|
|
479
517
|
}
|
|
480
518
|
});
|
|
481
519
|
case 12:
|
|
482
|
-
resp =
|
|
520
|
+
resp = _context7.sent;
|
|
483
521
|
suborgIds = resp === null || resp === void 0 ? void 0 : resp.subOrganizationIds;
|
|
484
522
|
if (!(!suborgIds || suborgIds.length === 0)) {
|
|
485
|
-
|
|
523
|
+
_context7.next = 17;
|
|
486
524
|
break;
|
|
487
525
|
}
|
|
488
526
|
onError(authErrors.wallet.loginFailed);
|
|
489
|
-
return
|
|
527
|
+
return _context7.abrupt("return");
|
|
490
528
|
case 17:
|
|
491
|
-
|
|
529
|
+
_context7.next = 19;
|
|
530
|
+
return authIframeClient.initEmbeddedKey();
|
|
531
|
+
case 19:
|
|
532
|
+
iframePublicKey = _context7.sent;
|
|
533
|
+
_context7.next = 22;
|
|
492
534
|
return walletClient.loginWithWallet({
|
|
493
535
|
sessionType: SessionType.READ_WRITE,
|
|
494
536
|
iframeClient: authIframeClient,
|
|
495
|
-
targetPublicKey:
|
|
537
|
+
targetPublicKey: iframePublicKey,
|
|
496
538
|
expirationSeconds: (_authConfig$sessionLe3 = authConfig.sessionLengthSeconds) === null || _authConfig$sessionLe3 === void 0 ? void 0 : _authConfig$sessionLe3.toString()
|
|
497
539
|
});
|
|
498
|
-
case
|
|
499
|
-
|
|
540
|
+
case 22:
|
|
541
|
+
_context7.next = 24;
|
|
500
542
|
return onAuthSuccess();
|
|
501
|
-
case
|
|
502
|
-
|
|
543
|
+
case 24:
|
|
544
|
+
_context7.next = 30;
|
|
503
545
|
break;
|
|
504
|
-
case
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
onError(
|
|
508
|
-
console.error("Error during wallet login: ",
|
|
509
|
-
case 27:
|
|
510
|
-
_context6.prev = 27;
|
|
511
|
-
setLoading(undefined);
|
|
512
|
-
return _context6.finish(27);
|
|
546
|
+
case 26:
|
|
547
|
+
_context7.prev = 26;
|
|
548
|
+
_context7.t0 = _context7["catch"](1);
|
|
549
|
+
onError(_context7.t0.message || authErrors.wallet.loginFailed);
|
|
550
|
+
console.error("Error during wallet login: ", _context7.t0);
|
|
513
551
|
case 30:
|
|
552
|
+
_context7.prev = 30;
|
|
553
|
+
setLoading(undefined);
|
|
554
|
+
return _context7.finish(30);
|
|
555
|
+
case 33:
|
|
514
556
|
case "end":
|
|
515
|
-
return
|
|
557
|
+
return _context7.stop();
|
|
516
558
|
}
|
|
517
|
-
},
|
|
559
|
+
}, _callee7, null, [[1, 26, 30, 33]]);
|
|
518
560
|
}));
|
|
519
561
|
return function handleLoginWithWallet() {
|
|
520
|
-
return
|
|
562
|
+
return _ref9.apply(this, arguments);
|
|
521
563
|
};
|
|
522
564
|
}();
|
|
523
565
|
var renderBackButton = function renderBackButton() {
|