@stytch/vanilla-js 5.24.2 → 5.24.4
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 +14 -0
- package/dist/adminPortal/index.esm.js +1 -1
- package/dist/adminPortal/index.js +1 -1
- package/dist/b2b/index.esm.js +10 -9
- package/dist/b2b/index.headless.esm.js +3 -3
- package/dist/b2b/index.headless.js +2 -2
- package/dist/b2b/index.js +9 -8
- package/dist/{extractErrorMessage-srtVp7Jv.js → extractErrorMessage-CFBC76C1.js} +1 -1
- package/dist/{extractErrorMessage-DiCva4gS.js → extractErrorMessage-DS3D8CPf.js} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +567 -529
- package/dist/index.headless.js +567 -529
- package/dist/index.js +1 -1
- package/dist/{internal-64venB4k.js → internal-B5ow3XSB.js} +1162 -1066
- package/dist/{internal-Bd3Djulx.js → internal-BArKrHsQ.js} +1162 -1066
- package/package.json +2 -2
|
@@ -2405,73 +2405,73 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2405
2405
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
2406
2406
|
this.email = {
|
|
2407
2407
|
invite: function invite(data) {
|
|
2408
|
-
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2409
|
-
return _regeneratorRuntime().wrap(function
|
|
2410
|
-
while (1) switch (
|
|
2408
|
+
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
|
|
2409
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
|
2410
|
+
while (1) switch (_context65.prev = _context65.next) {
|
|
2411
2411
|
case 0:
|
|
2412
2412
|
validate('stytch.magicLinks.email.invite').isString('email_address', data.email_address).isOptionalString('invite_redirect_url', data.invite_redirect_url).isOptionalString('invite_template_id', data.invite_template_id).isOptionalString('name', data.name).isOptionalString('locale', data.locale).isOptionalStringArray('roles', data.roles).isOptionalNumber('invite_expiration_minutes', data.invite_expiration_minutes);
|
|
2413
|
-
return
|
|
2413
|
+
return _context65.abrupt("return", this._networkClient.fetchSDK({
|
|
2414
2414
|
url: '/b2b/magic_links/email/invite',
|
|
2415
2415
|
body: data,
|
|
2416
2416
|
method: 'POST'
|
|
2417
2417
|
}));
|
|
2418
2418
|
case 2:
|
|
2419
2419
|
case "end":
|
|
2420
|
-
return
|
|
2420
|
+
return _context65.stop();
|
|
2421
2421
|
}
|
|
2422
|
-
},
|
|
2422
|
+
}, _callee65, this);
|
|
2423
2423
|
}));
|
|
2424
2424
|
},
|
|
2425
2425
|
loginOrSignup: function loginOrSignup(data) {
|
|
2426
|
-
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2426
|
+
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee66() {
|
|
2427
2427
|
var pkce_code_challenge, requestBody;
|
|
2428
|
-
return _regeneratorRuntime().wrap(function
|
|
2429
|
-
while (1) switch (
|
|
2428
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
|
2429
|
+
while (1) switch (_context66.prev = _context66.next) {
|
|
2430
2430
|
case 0:
|
|
2431
2431
|
validate('stytch.magicLinks.email.loginOrSignup').isString('email_address', data.email_address).isString('organization_id', data.organization_id).isOptionalString('login_redirect_url', data.login_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_redirect_url', data.signup_redirect_url).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale).isOptionalNumber('login_expiration_minutes', data.login_expiration_minutes).isOptionalNumber('signup_expiration_minutes', data.signup_expiration_minutes);
|
|
2432
|
-
|
|
2432
|
+
_context66.next = 3;
|
|
2433
2433
|
return this.getCodeChallenge();
|
|
2434
2434
|
case 3:
|
|
2435
|
-
pkce_code_challenge =
|
|
2435
|
+
pkce_code_challenge = _context66.sent;
|
|
2436
2436
|
requestBody = Object.assign(Object.assign({}, data), {
|
|
2437
2437
|
pkce_code_challenge: pkce_code_challenge
|
|
2438
2438
|
});
|
|
2439
|
-
return
|
|
2439
|
+
return _context66.abrupt("return", this._networkClient.fetchSDK({
|
|
2440
2440
|
url: '/b2b/magic_links/email/login_or_signup',
|
|
2441
2441
|
body: requestBody,
|
|
2442
2442
|
method: 'POST'
|
|
2443
2443
|
}));
|
|
2444
2444
|
case 6:
|
|
2445
2445
|
case "end":
|
|
2446
|
-
return
|
|
2446
|
+
return _context66.stop();
|
|
2447
2447
|
}
|
|
2448
|
-
},
|
|
2448
|
+
}, _callee66, this);
|
|
2449
2449
|
}));
|
|
2450
2450
|
},
|
|
2451
2451
|
discovery: {
|
|
2452
2452
|
send: function send(data) {
|
|
2453
|
-
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2453
|
+
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee67() {
|
|
2454
2454
|
var _yield$this$dfpProtec20, dfp_telemetry_id, captcha_token, pkce_code_challenge, requestBody;
|
|
2455
|
-
return _regeneratorRuntime().wrap(function
|
|
2456
|
-
while (1) switch (
|
|
2455
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
|
2456
|
+
while (1) switch (_context67.prev = _context67.next) {
|
|
2457
2457
|
case 0:
|
|
2458
2458
|
validate('stytch.magicLinks.email.discovery.send').isString('email_address', data.email_address).isOptionalString('discovery_redirect_url', data.discovery_redirect_url).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale).isOptionalNumber('discovery_expiration_minutes', data.discovery_expiration_minutes);
|
|
2459
|
-
|
|
2459
|
+
_context67.next = 3;
|
|
2460
2460
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2461
2461
|
case 3:
|
|
2462
|
-
_yield$this$dfpProtec20 =
|
|
2462
|
+
_yield$this$dfpProtec20 = _context67.sent;
|
|
2463
2463
|
dfp_telemetry_id = _yield$this$dfpProtec20.dfp_telemetry_id;
|
|
2464
2464
|
captcha_token = _yield$this$dfpProtec20.captcha_token;
|
|
2465
|
-
|
|
2465
|
+
_context67.next = 8;
|
|
2466
2466
|
return this.getCodeChallenge();
|
|
2467
2467
|
case 8:
|
|
2468
|
-
pkce_code_challenge =
|
|
2468
|
+
pkce_code_challenge = _context67.sent;
|
|
2469
2469
|
requestBody = Object.assign(Object.assign({}, data), {
|
|
2470
2470
|
pkce_code_challenge: pkce_code_challenge,
|
|
2471
2471
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
2472
2472
|
captcha_token: captcha_token
|
|
2473
2473
|
});
|
|
2474
|
-
return
|
|
2474
|
+
return _context67.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
2475
2475
|
url: '/b2b/magic_links/email/discovery/send',
|
|
2476
2476
|
body: requestBody,
|
|
2477
2477
|
method: 'POST',
|
|
@@ -2479,83 +2479,83 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2479
2479
|
}));
|
|
2480
2480
|
case 11:
|
|
2481
2481
|
case "end":
|
|
2482
|
-
return
|
|
2482
|
+
return _context67.stop();
|
|
2483
2483
|
}
|
|
2484
|
-
},
|
|
2484
|
+
}, _callee67, this);
|
|
2485
2485
|
}));
|
|
2486
2486
|
}
|
|
2487
2487
|
}
|
|
2488
2488
|
};
|
|
2489
2489
|
this.authenticate = function (data) {
|
|
2490
|
-
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2490
|
+
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee68() {
|
|
2491
2491
|
var passwordResetPKPair, resp;
|
|
2492
|
-
return _regeneratorRuntime().wrap(function
|
|
2493
|
-
while (1) switch (
|
|
2492
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
|
2493
|
+
while (1) switch (_context68.prev = _context68.next) {
|
|
2494
2494
|
case 0:
|
|
2495
2495
|
validate('stytch.magicLinks.authenticate').isString('magic_links_token', data.magic_links_token).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
|
|
2496
|
-
|
|
2496
|
+
_context68.next = 3;
|
|
2497
2497
|
return this._passwordResetPKCEManager.getPKPair();
|
|
2498
2498
|
case 3:
|
|
2499
|
-
passwordResetPKPair =
|
|
2499
|
+
passwordResetPKPair = _context68.sent;
|
|
2500
2500
|
resp = null;
|
|
2501
2501
|
if (!(passwordResetPKPair === null || passwordResetPKPair === void 0 ? void 0 : passwordResetPKPair.code_verifier)) {
|
|
2502
|
-
|
|
2502
|
+
_context68.next = 19;
|
|
2503
2503
|
break;
|
|
2504
2504
|
}
|
|
2505
|
-
|
|
2506
|
-
|
|
2505
|
+
_context68.prev = 6;
|
|
2506
|
+
_context68.next = 9;
|
|
2507
2507
|
return this.handlePKCEForAuthenticate(this._passwordResetPKCEManager, data);
|
|
2508
2508
|
case 9:
|
|
2509
|
-
resp =
|
|
2510
|
-
|
|
2509
|
+
resp = _context68.sent;
|
|
2510
|
+
_context68.next = 19;
|
|
2511
2511
|
break;
|
|
2512
2512
|
case 12:
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
if (!
|
|
2516
|
-
|
|
2513
|
+
_context68.prev = 12;
|
|
2514
|
+
_context68.t0 = _context68["catch"](6);
|
|
2515
|
+
if (!_context68.t0.message.includes('pkce')) {
|
|
2516
|
+
_context68.next = 18;
|
|
2517
2517
|
break;
|
|
2518
2518
|
}
|
|
2519
2519
|
console.log('Authenticate with passwords pkce namespace failed. Falling back to authenticate with magic_links namespace.');
|
|
2520
|
-
|
|
2520
|
+
_context68.next = 19;
|
|
2521
2521
|
break;
|
|
2522
2522
|
case 18:
|
|
2523
|
-
throw
|
|
2523
|
+
throw _context68.t0;
|
|
2524
2524
|
case 19:
|
|
2525
2525
|
if (resp) {
|
|
2526
|
-
|
|
2526
|
+
_context68.next = 23;
|
|
2527
2527
|
break;
|
|
2528
2528
|
}
|
|
2529
|
-
|
|
2529
|
+
_context68.next = 22;
|
|
2530
2530
|
return this.handlePKCEForAuthenticate(this._pkceManager, data);
|
|
2531
2531
|
case 22:
|
|
2532
|
-
resp =
|
|
2532
|
+
resp = _context68.sent;
|
|
2533
2533
|
case 23:
|
|
2534
2534
|
this._subscriptionService.updateSession(resp);
|
|
2535
|
-
return
|
|
2535
|
+
return _context68.abrupt("return", resp);
|
|
2536
2536
|
case 25:
|
|
2537
2537
|
case "end":
|
|
2538
|
-
return
|
|
2538
|
+
return _context68.stop();
|
|
2539
2539
|
}
|
|
2540
|
-
},
|
|
2540
|
+
}, _callee68, this, [[6, 12]]);
|
|
2541
2541
|
}));
|
|
2542
2542
|
};
|
|
2543
2543
|
this.discovery = {
|
|
2544
2544
|
authenticate: function authenticate(data) {
|
|
2545
|
-
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2545
|
+
return __awaiter$1(_this10, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee69() {
|
|
2546
2546
|
var pkPair, _yield$this$dfpProtec21, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
2547
|
-
return _regeneratorRuntime().wrap(function
|
|
2548
|
-
while (1) switch (
|
|
2547
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
|
2548
|
+
while (1) switch (_context69.prev = _context69.next) {
|
|
2549
2549
|
case 0:
|
|
2550
2550
|
validate('stytch.magicLinks.discovery.authenticate').isString('discovery_magic_links_token', data.discovery_magic_links_token);
|
|
2551
|
-
|
|
2551
|
+
_context69.next = 3;
|
|
2552
2552
|
return this._pkceManager.getPKPair();
|
|
2553
2553
|
case 3:
|
|
2554
|
-
pkPair =
|
|
2555
|
-
|
|
2554
|
+
pkPair = _context69.sent;
|
|
2555
|
+
_context69.next = 6;
|
|
2556
2556
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2557
2557
|
case 6:
|
|
2558
|
-
_yield$this$dfpProtec21 =
|
|
2558
|
+
_yield$this$dfpProtec21 = _context69.sent;
|
|
2559
2559
|
dfp_telemetry_id = _yield$this$dfpProtec21.dfp_telemetry_id;
|
|
2560
2560
|
captcha_token = _yield$this$dfpProtec21.captcha_token;
|
|
2561
2561
|
requestBody = Object.assign({
|
|
@@ -2563,7 +2563,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2563
2563
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
2564
2564
|
captcha_token: captcha_token
|
|
2565
2565
|
}, data);
|
|
2566
|
-
|
|
2566
|
+
_context69.next = 12;
|
|
2567
2567
|
return this._networkClient.retriableFetchSDK({
|
|
2568
2568
|
url: '/b2b/magic_links/discovery/authenticate',
|
|
2569
2569
|
body: requestBody,
|
|
@@ -2571,15 +2571,15 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2571
2571
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2572
2572
|
});
|
|
2573
2573
|
case 12:
|
|
2574
|
-
resp =
|
|
2574
|
+
resp = _context69.sent;
|
|
2575
2575
|
this._pkceManager.clearPKPair();
|
|
2576
2576
|
this._subscriptionService.updateSession(resp);
|
|
2577
|
-
return
|
|
2577
|
+
return _context69.abrupt("return", resp);
|
|
2578
2578
|
case 16:
|
|
2579
2579
|
case "end":
|
|
2580
|
-
return
|
|
2580
|
+
return _context69.stop();
|
|
2581
2581
|
}
|
|
2582
|
-
},
|
|
2582
|
+
}, _callee69, this);
|
|
2583
2583
|
}));
|
|
2584
2584
|
}
|
|
2585
2585
|
};
|
|
@@ -2587,86 +2587,86 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2587
2587
|
return _createClass(HeadlessB2BMagicLinksClient, [{
|
|
2588
2588
|
key: "getCodeChallenge",
|
|
2589
2589
|
value: function getCodeChallenge() {
|
|
2590
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2590
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee70() {
|
|
2591
2591
|
var _yield$this$_config5, pkceRequiredForEmailMagicLinks, keyPair;
|
|
2592
|
-
return _regeneratorRuntime().wrap(function
|
|
2593
|
-
while (1) switch (
|
|
2592
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
|
2593
|
+
while (1) switch (_context70.prev = _context70.next) {
|
|
2594
2594
|
case 0:
|
|
2595
|
-
|
|
2595
|
+
_context70.next = 2;
|
|
2596
2596
|
return this._config;
|
|
2597
2597
|
case 2:
|
|
2598
|
-
_yield$this$_config5 =
|
|
2598
|
+
_yield$this$_config5 = _context70.sent;
|
|
2599
2599
|
pkceRequiredForEmailMagicLinks = _yield$this$_config5.pkceRequiredForEmailMagicLinks;
|
|
2600
2600
|
if (pkceRequiredForEmailMagicLinks) {
|
|
2601
|
-
|
|
2601
|
+
_context70.next = 6;
|
|
2602
2602
|
break;
|
|
2603
2603
|
}
|
|
2604
|
-
return
|
|
2604
|
+
return _context70.abrupt("return", undefined);
|
|
2605
2605
|
case 6:
|
|
2606
|
-
|
|
2606
|
+
_context70.next = 8;
|
|
2607
2607
|
return this._pkceManager.getPKPair();
|
|
2608
2608
|
case 8:
|
|
2609
|
-
keyPair =
|
|
2609
|
+
keyPair = _context70.sent;
|
|
2610
2610
|
if (!keyPair) {
|
|
2611
|
-
|
|
2611
|
+
_context70.next = 11;
|
|
2612
2612
|
break;
|
|
2613
2613
|
}
|
|
2614
|
-
return
|
|
2614
|
+
return _context70.abrupt("return", keyPair.code_challenge);
|
|
2615
2615
|
case 11:
|
|
2616
|
-
|
|
2616
|
+
_context70.next = 13;
|
|
2617
2617
|
return this._pkceManager.startPKCETransaction();
|
|
2618
2618
|
case 13:
|
|
2619
|
-
keyPair =
|
|
2620
|
-
return
|
|
2619
|
+
keyPair = _context70.sent;
|
|
2620
|
+
return _context70.abrupt("return", keyPair.code_challenge);
|
|
2621
2621
|
case 15:
|
|
2622
2622
|
case "end":
|
|
2623
|
-
return
|
|
2623
|
+
return _context70.stop();
|
|
2624
2624
|
}
|
|
2625
|
-
},
|
|
2625
|
+
}, _callee70, this);
|
|
2626
2626
|
}));
|
|
2627
2627
|
}
|
|
2628
2628
|
}, {
|
|
2629
2629
|
key: "handlePKCEForAuthenticate",
|
|
2630
2630
|
value: function handlePKCEForAuthenticate(pkceManager, data) {
|
|
2631
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2631
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee71() {
|
|
2632
2632
|
var pkPair, _yield$this$dfpProtec22, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
2633
|
-
return _regeneratorRuntime().wrap(function
|
|
2634
|
-
while (1) switch (
|
|
2633
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
|
2634
|
+
while (1) switch (_context71.prev = _context71.next) {
|
|
2635
2635
|
case 0:
|
|
2636
|
-
|
|
2636
|
+
_context71.next = 2;
|
|
2637
2637
|
return pkceManager.getPKPair();
|
|
2638
2638
|
case 2:
|
|
2639
|
-
pkPair =
|
|
2640
|
-
|
|
2639
|
+
pkPair = _context71.sent;
|
|
2640
|
+
_context71.next = 5;
|
|
2641
2641
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2642
2642
|
case 5:
|
|
2643
|
-
_yield$this$dfpProtec22 =
|
|
2643
|
+
_yield$this$dfpProtec22 = _context71.sent;
|
|
2644
2644
|
dfp_telemetry_id = _yield$this$dfpProtec22.dfp_telemetry_id;
|
|
2645
2645
|
captcha_token = _yield$this$dfpProtec22.captcha_token;
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2646
|
+
_context71.t0 = Object;
|
|
2647
|
+
_context71.t1 = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
2648
|
+
_context71.t2 = dfp_telemetry_id;
|
|
2649
|
+
_context71.t3 = captcha_token;
|
|
2650
|
+
_context71.next = 14;
|
|
2651
2651
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
2652
2652
|
case 14:
|
|
2653
|
-
|
|
2654
|
-
if (
|
|
2655
|
-
|
|
2653
|
+
_context71.t4 = _context71.sent;
|
|
2654
|
+
if (_context71.t4) {
|
|
2655
|
+
_context71.next = 17;
|
|
2656
2656
|
break;
|
|
2657
2657
|
}
|
|
2658
|
-
|
|
2658
|
+
_context71.t4 = undefined;
|
|
2659
2659
|
case 17:
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
pkce_code_verifier:
|
|
2663
|
-
dfp_telemetry_id:
|
|
2664
|
-
captcha_token:
|
|
2665
|
-
intermediate_session_token:
|
|
2660
|
+
_context71.t5 = _context71.t4;
|
|
2661
|
+
_context71.t6 = {
|
|
2662
|
+
pkce_code_verifier: _context71.t1,
|
|
2663
|
+
dfp_telemetry_id: _context71.t2,
|
|
2664
|
+
captcha_token: _context71.t3,
|
|
2665
|
+
intermediate_session_token: _context71.t5
|
|
2666
2666
|
};
|
|
2667
|
-
|
|
2668
|
-
requestBody =
|
|
2669
|
-
|
|
2667
|
+
_context71.t7 = data;
|
|
2668
|
+
requestBody = _context71.t0.assign.call(_context71.t0, _context71.t6, _context71.t7);
|
|
2669
|
+
_context71.next = 23;
|
|
2670
2670
|
return this._networkClient.retriableFetchSDK({
|
|
2671
2671
|
url: '/b2b/magic_links/authenticate',
|
|
2672
2672
|
body: requestBody,
|
|
@@ -2674,14 +2674,14 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2674
2674
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
2675
2675
|
});
|
|
2676
2676
|
case 23:
|
|
2677
|
-
resp =
|
|
2677
|
+
resp = _context71.sent;
|
|
2678
2678
|
pkceManager.clearPKPair();
|
|
2679
|
-
return
|
|
2679
|
+
return _context71.abrupt("return", resp);
|
|
2680
2680
|
case 26:
|
|
2681
2681
|
case "end":
|
|
2682
|
-
return
|
|
2682
|
+
return _context71.stop();
|
|
2683
2683
|
}
|
|
2684
|
-
},
|
|
2684
|
+
}, _callee71, this);
|
|
2685
2685
|
}));
|
|
2686
2686
|
}
|
|
2687
2687
|
}]);
|
|
@@ -2693,25 +2693,25 @@ var HeadlessB2BSelfClient = /*#__PURE__*/_createClass(function HeadlessB2BSelfCl
|
|
|
2693
2693
|
this._apiNetworkClient = _apiNetworkClient;
|
|
2694
2694
|
this._subscriptionService = _subscriptionService;
|
|
2695
2695
|
this.get = function () {
|
|
2696
|
-
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2696
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee72() {
|
|
2697
2697
|
var resp;
|
|
2698
|
-
return _regeneratorRuntime().wrap(function
|
|
2699
|
-
while (1) switch (
|
|
2698
|
+
return _regeneratorRuntime().wrap(function _callee72$(_context72) {
|
|
2699
|
+
while (1) switch (_context72.prev = _context72.next) {
|
|
2700
2700
|
case 0:
|
|
2701
|
-
|
|
2701
|
+
_context72.next = 2;
|
|
2702
2702
|
return this._networkClient.fetchSDK({
|
|
2703
2703
|
url: "/b2b/organizations/members/me",
|
|
2704
2704
|
method: 'GET'
|
|
2705
2705
|
});
|
|
2706
2706
|
case 2:
|
|
2707
|
-
resp =
|
|
2707
|
+
resp = _context72.sent;
|
|
2708
2708
|
this._subscriptionService.updateMember(resp.member);
|
|
2709
|
-
return
|
|
2709
|
+
return _context72.abrupt("return", resp.member);
|
|
2710
2710
|
case 5:
|
|
2711
2711
|
case "end":
|
|
2712
|
-
return
|
|
2712
|
+
return _context72.stop();
|
|
2713
2713
|
}
|
|
2714
|
-
},
|
|
2714
|
+
}, _callee72, this);
|
|
2715
2715
|
}));
|
|
2716
2716
|
};
|
|
2717
2717
|
this.getSync = function () {
|
|
@@ -2730,116 +2730,148 @@ var HeadlessB2BSelfClient = /*#__PURE__*/_createClass(function HeadlessB2BSelfCl
|
|
|
2730
2730
|
});
|
|
2731
2731
|
};
|
|
2732
2732
|
this.update = function (data) {
|
|
2733
|
-
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2733
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee73() {
|
|
2734
2734
|
var resp;
|
|
2735
|
-
return _regeneratorRuntime().wrap(function
|
|
2736
|
-
while (1) switch (
|
|
2735
|
+
return _regeneratorRuntime().wrap(function _callee73$(_context73) {
|
|
2736
|
+
while (1) switch (_context73.prev = _context73.next) {
|
|
2737
2737
|
case 0:
|
|
2738
2738
|
validate('stytch.self.update').isOptionalString('name', data.name).isOptionalObject('untrusted_metadata', data.untrusted_metadata).isOptionalBoolean('mfa_enrolled', data.mfa_enrolled).isOptionalString('mfa_phone_number', data.mfa_phone_number).isOptionalString('default_mfa_method', data.default_mfa_method);
|
|
2739
|
-
|
|
2739
|
+
_context73.next = 3;
|
|
2740
2740
|
return this._networkClient.fetchSDK({
|
|
2741
2741
|
url: '/b2b/organizations/members/update',
|
|
2742
2742
|
body: data,
|
|
2743
2743
|
method: 'PUT'
|
|
2744
2744
|
});
|
|
2745
2745
|
case 3:
|
|
2746
|
-
resp =
|
|
2746
|
+
resp = _context73.sent;
|
|
2747
2747
|
this._subscriptionService.updateMember(resp.member);
|
|
2748
|
-
return
|
|
2748
|
+
return _context73.abrupt("return", resp);
|
|
2749
2749
|
case 6:
|
|
2750
2750
|
case "end":
|
|
2751
|
-
return
|
|
2751
|
+
return _context73.stop();
|
|
2752
2752
|
}
|
|
2753
|
-
},
|
|
2753
|
+
}, _callee73, this);
|
|
2754
2754
|
}));
|
|
2755
2755
|
};
|
|
2756
2756
|
this.deleteMFAPhoneNumber = function () {
|
|
2757
|
-
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2757
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee74() {
|
|
2758
2758
|
var resp;
|
|
2759
|
-
return _regeneratorRuntime().wrap(function
|
|
2760
|
-
while (1) switch (
|
|
2759
|
+
return _regeneratorRuntime().wrap(function _callee74$(_context74) {
|
|
2760
|
+
while (1) switch (_context74.prev = _context74.next) {
|
|
2761
2761
|
case 0:
|
|
2762
|
-
|
|
2762
|
+
_context74.next = 2;
|
|
2763
2763
|
return this._networkClient.fetchSDK({
|
|
2764
2764
|
url: '/b2b/organizations/members/deletePhoneNumber',
|
|
2765
2765
|
method: 'DELETE'
|
|
2766
2766
|
});
|
|
2767
2767
|
case 2:
|
|
2768
|
-
resp =
|
|
2768
|
+
resp = _context74.sent;
|
|
2769
2769
|
this._subscriptionService.updateMember(resp.member);
|
|
2770
|
-
return
|
|
2770
|
+
return _context74.abrupt("return", resp);
|
|
2771
2771
|
case 5:
|
|
2772
2772
|
case "end":
|
|
2773
|
-
return
|
|
2773
|
+
return _context74.stop();
|
|
2774
2774
|
}
|
|
2775
|
-
},
|
|
2775
|
+
}, _callee74, this);
|
|
2776
2776
|
}));
|
|
2777
2777
|
};
|
|
2778
2778
|
this.deleteMFATOTP = function () {
|
|
2779
|
-
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2779
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee75() {
|
|
2780
2780
|
var resp;
|
|
2781
|
-
return _regeneratorRuntime().wrap(function
|
|
2782
|
-
while (1) switch (
|
|
2781
|
+
return _regeneratorRuntime().wrap(function _callee75$(_context75) {
|
|
2782
|
+
while (1) switch (_context75.prev = _context75.next) {
|
|
2783
2783
|
case 0:
|
|
2784
|
-
|
|
2784
|
+
_context75.next = 2;
|
|
2785
2785
|
return this._networkClient.fetchSDK({
|
|
2786
2786
|
url: "/b2b/organizations/members/deleteTOTP",
|
|
2787
2787
|
method: 'DELETE'
|
|
2788
2788
|
});
|
|
2789
2789
|
case 2:
|
|
2790
|
-
resp =
|
|
2790
|
+
resp = _context75.sent;
|
|
2791
2791
|
this._subscriptionService.updateMember(resp.member);
|
|
2792
|
-
return
|
|
2792
|
+
return _context75.abrupt("return", resp);
|
|
2793
2793
|
case 5:
|
|
2794
2794
|
case "end":
|
|
2795
|
-
return
|
|
2795
|
+
return _context75.stop();
|
|
2796
2796
|
}
|
|
2797
|
-
},
|
|
2797
|
+
}, _callee75, this);
|
|
2798
2798
|
}));
|
|
2799
2799
|
};
|
|
2800
2800
|
this.deletePassword = function (passwordId) {
|
|
2801
|
-
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2801
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee76() {
|
|
2802
2802
|
var resp;
|
|
2803
|
-
return _regeneratorRuntime().wrap(function
|
|
2804
|
-
while (1) switch (
|
|
2803
|
+
return _regeneratorRuntime().wrap(function _callee76$(_context76) {
|
|
2804
|
+
while (1) switch (_context76.prev = _context76.next) {
|
|
2805
2805
|
case 0:
|
|
2806
|
-
|
|
2806
|
+
_context76.next = 2;
|
|
2807
2807
|
return this._networkClient.fetchSDK({
|
|
2808
2808
|
url: "/b2b/organizations/members/passwords/".concat(passwordId),
|
|
2809
2809
|
method: 'DELETE'
|
|
2810
2810
|
});
|
|
2811
2811
|
case 2:
|
|
2812
|
-
resp =
|
|
2812
|
+
resp = _context76.sent;
|
|
2813
2813
|
this._subscriptionService.updateMember(resp.member);
|
|
2814
|
-
return
|
|
2814
|
+
return _context76.abrupt("return", resp);
|
|
2815
2815
|
case 5:
|
|
2816
2816
|
case "end":
|
|
2817
|
-
return
|
|
2817
|
+
return _context76.stop();
|
|
2818
2818
|
}
|
|
2819
|
-
},
|
|
2819
|
+
}, _callee76, this);
|
|
2820
2820
|
}));
|
|
2821
2821
|
};
|
|
2822
2822
|
this.unlinkRetiredEmail = function (data) {
|
|
2823
|
-
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2823
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee77() {
|
|
2824
2824
|
var resp;
|
|
2825
|
-
return _regeneratorRuntime().wrap(function
|
|
2826
|
-
while (1) switch (
|
|
2825
|
+
return _regeneratorRuntime().wrap(function _callee77$(_context77) {
|
|
2826
|
+
while (1) switch (_context77.prev = _context77.next) {
|
|
2827
2827
|
case 0:
|
|
2828
|
-
|
|
2828
|
+
_context77.next = 2;
|
|
2829
2829
|
return this._apiNetworkClient.fetchSDK({
|
|
2830
2830
|
url: '/b2b/organizations/members/unlink_retired_email',
|
|
2831
2831
|
method: 'POST',
|
|
2832
2832
|
body: data
|
|
2833
2833
|
});
|
|
2834
2834
|
case 2:
|
|
2835
|
-
resp =
|
|
2835
|
+
resp = _context77.sent;
|
|
2836
2836
|
this._subscriptionService.updateMember(resp.member);
|
|
2837
|
-
return
|
|
2837
|
+
return _context77.abrupt("return", resp);
|
|
2838
2838
|
case 5:
|
|
2839
2839
|
case "end":
|
|
2840
|
-
return
|
|
2840
|
+
return _context77.stop();
|
|
2841
2841
|
}
|
|
2842
|
-
},
|
|
2842
|
+
}, _callee77, this);
|
|
2843
|
+
}));
|
|
2844
|
+
};
|
|
2845
|
+
this.getConnectedApps = function () {
|
|
2846
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee78() {
|
|
2847
|
+
return _regeneratorRuntime().wrap(function _callee78$(_context78) {
|
|
2848
|
+
while (1) switch (_context78.prev = _context78.next) {
|
|
2849
|
+
case 0:
|
|
2850
|
+
return _context78.abrupt("return", this._networkClient.fetchSDK({
|
|
2851
|
+
url: '/b2b/organizations/members/connected_apps',
|
|
2852
|
+
method: 'GET'
|
|
2853
|
+
}));
|
|
2854
|
+
case 1:
|
|
2855
|
+
case "end":
|
|
2856
|
+
return _context78.stop();
|
|
2857
|
+
}
|
|
2858
|
+
}, _callee78, this);
|
|
2859
|
+
}));
|
|
2860
|
+
};
|
|
2861
|
+
this.revokeConnectedApp = function (data) {
|
|
2862
|
+
return __awaiter$1(_this11, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee79() {
|
|
2863
|
+
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
|
2864
|
+
while (1) switch (_context79.prev = _context79.next) {
|
|
2865
|
+
case 0:
|
|
2866
|
+
return _context79.abrupt("return", this._networkClient.fetchSDK({
|
|
2867
|
+
url: "/b2b/organizations/members/connected_apps/".concat(data.connected_app_id, "/revoke"),
|
|
2868
|
+
method: 'POST'
|
|
2869
|
+
}));
|
|
2870
|
+
case 1:
|
|
2871
|
+
case "end":
|
|
2872
|
+
return _context79.stop();
|
|
2873
|
+
}
|
|
2874
|
+
}, _callee79, this);
|
|
2843
2875
|
}));
|
|
2844
2876
|
};
|
|
2845
2877
|
});
|
|
@@ -2855,166 +2887,166 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
|
|
|
2855
2887
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
2856
2888
|
this.saml = {
|
|
2857
2889
|
createConnection: function createConnection(data) {
|
|
2858
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2859
|
-
return _regeneratorRuntime().wrap(function
|
|
2860
|
-
while (1) switch (
|
|
2890
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee80() {
|
|
2891
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
|
2892
|
+
while (1) switch (_context80.prev = _context80.next) {
|
|
2861
2893
|
case 0:
|
|
2862
|
-
|
|
2894
|
+
_context80.next = 2;
|
|
2863
2895
|
return this._networkClient.fetchSDK({
|
|
2864
2896
|
url: '/b2b/sso/saml',
|
|
2865
2897
|
method: 'POST',
|
|
2866
2898
|
body: data
|
|
2867
2899
|
});
|
|
2868
2900
|
case 2:
|
|
2869
|
-
return
|
|
2901
|
+
return _context80.abrupt("return", _context80.sent);
|
|
2870
2902
|
case 3:
|
|
2871
2903
|
case "end":
|
|
2872
|
-
return
|
|
2904
|
+
return _context80.stop();
|
|
2873
2905
|
}
|
|
2874
|
-
},
|
|
2906
|
+
}, _callee80, this);
|
|
2875
2907
|
}));
|
|
2876
2908
|
},
|
|
2877
2909
|
updateConnection: function updateConnection(data) {
|
|
2878
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2879
|
-
return _regeneratorRuntime().wrap(function
|
|
2880
|
-
while (1) switch (
|
|
2910
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee81() {
|
|
2911
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
|
2912
|
+
while (1) switch (_context81.prev = _context81.next) {
|
|
2881
2913
|
case 0:
|
|
2882
|
-
|
|
2914
|
+
_context81.next = 2;
|
|
2883
2915
|
return this._networkClient.fetchSDK({
|
|
2884
2916
|
url: "/b2b/sso/saml/".concat(data.connection_id),
|
|
2885
2917
|
method: 'PUT',
|
|
2886
2918
|
body: data
|
|
2887
2919
|
});
|
|
2888
2920
|
case 2:
|
|
2889
|
-
return
|
|
2921
|
+
return _context81.abrupt("return", _context81.sent);
|
|
2890
2922
|
case 3:
|
|
2891
2923
|
case "end":
|
|
2892
|
-
return
|
|
2924
|
+
return _context81.stop();
|
|
2893
2925
|
}
|
|
2894
|
-
},
|
|
2926
|
+
}, _callee81, this);
|
|
2895
2927
|
}));
|
|
2896
2928
|
},
|
|
2897
2929
|
updateConnectionByURL: function updateConnectionByURL(data) {
|
|
2898
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2899
|
-
return _regeneratorRuntime().wrap(function
|
|
2900
|
-
while (1) switch (
|
|
2930
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee82() {
|
|
2931
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
|
2932
|
+
while (1) switch (_context82.prev = _context82.next) {
|
|
2901
2933
|
case 0:
|
|
2902
|
-
|
|
2934
|
+
_context82.next = 2;
|
|
2903
2935
|
return this._networkClient.fetchSDK({
|
|
2904
2936
|
url: "/b2b/sso/saml/".concat(data.connection_id, "/url"),
|
|
2905
2937
|
method: 'PUT',
|
|
2906
2938
|
body: data
|
|
2907
2939
|
});
|
|
2908
2940
|
case 2:
|
|
2909
|
-
return
|
|
2941
|
+
return _context82.abrupt("return", _context82.sent);
|
|
2910
2942
|
case 3:
|
|
2911
2943
|
case "end":
|
|
2912
|
-
return
|
|
2944
|
+
return _context82.stop();
|
|
2913
2945
|
}
|
|
2914
|
-
},
|
|
2946
|
+
}, _callee82, this);
|
|
2915
2947
|
}));
|
|
2916
2948
|
},
|
|
2917
2949
|
deleteVerificationCertificate: function deleteVerificationCertificate(data) {
|
|
2918
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2919
|
-
return _regeneratorRuntime().wrap(function
|
|
2920
|
-
while (1) switch (
|
|
2950
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee83() {
|
|
2951
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
|
2952
|
+
while (1) switch (_context83.prev = _context83.next) {
|
|
2921
2953
|
case 0:
|
|
2922
|
-
|
|
2954
|
+
_context83.next = 2;
|
|
2923
2955
|
return this._networkClient.fetchSDK({
|
|
2924
2956
|
url: "/b2b/sso/saml/".concat(data.connection_id, "/verification_certificates/").concat(data.certificate_id),
|
|
2925
2957
|
method: 'DELETE'
|
|
2926
2958
|
});
|
|
2927
2959
|
case 2:
|
|
2928
|
-
return
|
|
2960
|
+
return _context83.abrupt("return", _context83.sent);
|
|
2929
2961
|
case 3:
|
|
2930
2962
|
case "end":
|
|
2931
|
-
return
|
|
2963
|
+
return _context83.stop();
|
|
2932
2964
|
}
|
|
2933
|
-
},
|
|
2965
|
+
}, _callee83, this);
|
|
2934
2966
|
}));
|
|
2935
2967
|
}
|
|
2936
2968
|
};
|
|
2937
2969
|
this.oidc = {
|
|
2938
2970
|
createConnection: function createConnection(data) {
|
|
2939
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2940
|
-
return _regeneratorRuntime().wrap(function
|
|
2941
|
-
while (1) switch (
|
|
2971
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
|
|
2972
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
|
2973
|
+
while (1) switch (_context84.prev = _context84.next) {
|
|
2942
2974
|
case 0:
|
|
2943
|
-
|
|
2975
|
+
_context84.next = 2;
|
|
2944
2976
|
return this._networkClient.fetchSDK({
|
|
2945
2977
|
url: '/b2b/sso/oidc',
|
|
2946
2978
|
method: 'POST',
|
|
2947
2979
|
body: data
|
|
2948
2980
|
});
|
|
2949
2981
|
case 2:
|
|
2950
|
-
return
|
|
2982
|
+
return _context84.abrupt("return", _context84.sent);
|
|
2951
2983
|
case 3:
|
|
2952
2984
|
case "end":
|
|
2953
|
-
return
|
|
2985
|
+
return _context84.stop();
|
|
2954
2986
|
}
|
|
2955
|
-
},
|
|
2987
|
+
}, _callee84, this);
|
|
2956
2988
|
}));
|
|
2957
2989
|
},
|
|
2958
2990
|
updateConnection: function updateConnection(data) {
|
|
2959
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2960
|
-
return _regeneratorRuntime().wrap(function
|
|
2961
|
-
while (1) switch (
|
|
2991
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
|
|
2992
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
|
2993
|
+
while (1) switch (_context85.prev = _context85.next) {
|
|
2962
2994
|
case 0:
|
|
2963
|
-
|
|
2995
|
+
_context85.next = 2;
|
|
2964
2996
|
return this._networkClient.fetchSDK({
|
|
2965
2997
|
url: "/b2b/sso/oidc/".concat(data.connection_id),
|
|
2966
2998
|
method: 'PUT',
|
|
2967
2999
|
body: data
|
|
2968
3000
|
});
|
|
2969
3001
|
case 2:
|
|
2970
|
-
return
|
|
3002
|
+
return _context85.abrupt("return", _context85.sent);
|
|
2971
3003
|
case 3:
|
|
2972
3004
|
case "end":
|
|
2973
|
-
return
|
|
3005
|
+
return _context85.stop();
|
|
2974
3006
|
}
|
|
2975
|
-
},
|
|
3007
|
+
}, _callee85, this);
|
|
2976
3008
|
}));
|
|
2977
3009
|
}
|
|
2978
3010
|
};
|
|
2979
3011
|
this.external = {
|
|
2980
3012
|
createConnection: function createConnection(data) {
|
|
2981
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2982
|
-
return _regeneratorRuntime().wrap(function
|
|
2983
|
-
while (1) switch (
|
|
3013
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
|
|
3014
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
|
3015
|
+
while (1) switch (_context86.prev = _context86.next) {
|
|
2984
3016
|
case 0:
|
|
2985
|
-
|
|
3017
|
+
_context86.next = 2;
|
|
2986
3018
|
return this._networkClient.fetchSDK({
|
|
2987
3019
|
url: '/b2b/sso/external',
|
|
2988
3020
|
method: 'POST',
|
|
2989
3021
|
body: data
|
|
2990
3022
|
});
|
|
2991
3023
|
case 2:
|
|
2992
|
-
return
|
|
3024
|
+
return _context86.abrupt("return", _context86.sent);
|
|
2993
3025
|
case 3:
|
|
2994
3026
|
case "end":
|
|
2995
|
-
return
|
|
3027
|
+
return _context86.stop();
|
|
2996
3028
|
}
|
|
2997
|
-
},
|
|
3029
|
+
}, _callee86, this);
|
|
2998
3030
|
}));
|
|
2999
3031
|
},
|
|
3000
3032
|
updateConnection: function updateConnection(data) {
|
|
3001
|
-
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3002
|
-
return _regeneratorRuntime().wrap(function
|
|
3003
|
-
while (1) switch (
|
|
3033
|
+
return __awaiter$1(_this12, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee87() {
|
|
3034
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
|
3035
|
+
while (1) switch (_context87.prev = _context87.next) {
|
|
3004
3036
|
case 0:
|
|
3005
|
-
|
|
3037
|
+
_context87.next = 2;
|
|
3006
3038
|
return this._networkClient.fetchSDK({
|
|
3007
3039
|
url: "/b2b/sso/external/".concat(data.connection_id),
|
|
3008
3040
|
method: 'PUT',
|
|
3009
3041
|
body: data
|
|
3010
3042
|
});
|
|
3011
3043
|
case 2:
|
|
3012
|
-
return
|
|
3044
|
+
return _context87.abrupt("return", _context87.sent);
|
|
3013
3045
|
case 3:
|
|
3014
3046
|
case "end":
|
|
3015
|
-
return
|
|
3047
|
+
return _context87.stop();
|
|
3016
3048
|
}
|
|
3017
|
-
},
|
|
3049
|
+
}, _callee87, this);
|
|
3018
3050
|
}));
|
|
3019
3051
|
}
|
|
3020
3052
|
};
|
|
@@ -3022,89 +3054,89 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
|
|
|
3022
3054
|
return _createClass(HeadlessB2BSSOClient, [{
|
|
3023
3055
|
key: "authenticate",
|
|
3024
3056
|
value: function authenticate(options) {
|
|
3025
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3057
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee88() {
|
|
3026
3058
|
var keyPair, _yield$this$dfpProtec23, dfp_telemetry_id, captcha_token, resp;
|
|
3027
|
-
return _regeneratorRuntime().wrap(function
|
|
3028
|
-
while (1) switch (
|
|
3059
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
|
3060
|
+
while (1) switch (_context88.prev = _context88.next) {
|
|
3029
3061
|
case 0:
|
|
3030
3062
|
validate('stytch.sso.authenticate').isString('sso_token', options.sso_token).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
|
|
3031
|
-
|
|
3063
|
+
_context88.next = 3;
|
|
3032
3064
|
return this._pkceManager.getPKPair();
|
|
3033
3065
|
case 3:
|
|
3034
|
-
keyPair =
|
|
3066
|
+
keyPair = _context88.sent;
|
|
3035
3067
|
if (!keyPair) {
|
|
3036
3068
|
logger.warn('No code verifier found in local storage for SSO flow.\n' + 'Consider using stytch.sso.start() to add PKCE to your SSO flows for added security.\n' + 'See https://stytch.com/docs/oauth#guides_pkce for more information.');
|
|
3037
3069
|
}
|
|
3038
|
-
|
|
3070
|
+
_context88.next = 7;
|
|
3039
3071
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3040
3072
|
case 7:
|
|
3041
|
-
_yield$this$dfpProtec23 =
|
|
3073
|
+
_yield$this$dfpProtec23 = _context88.sent;
|
|
3042
3074
|
dfp_telemetry_id = _yield$this$dfpProtec23.dfp_telemetry_id;
|
|
3043
3075
|
captcha_token = _yield$this$dfpProtec23.captcha_token;
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3076
|
+
_context88.t0 = this._networkClient;
|
|
3077
|
+
_context88.t1 = Object;
|
|
3078
|
+
_context88.t2 = Object.assign({
|
|
3047
3079
|
pkce_code_verifier: keyPair === null || keyPair === void 0 ? void 0 : keyPair.code_verifier
|
|
3048
3080
|
}, options);
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3081
|
+
_context88.t3 = dfp_telemetry_id;
|
|
3082
|
+
_context88.t4 = captcha_token;
|
|
3083
|
+
_context88.next = 17;
|
|
3052
3084
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
3053
3085
|
case 17:
|
|
3054
|
-
|
|
3055
|
-
if (
|
|
3056
|
-
|
|
3086
|
+
_context88.t5 = _context88.sent;
|
|
3087
|
+
if (_context88.t5) {
|
|
3088
|
+
_context88.next = 20;
|
|
3057
3089
|
break;
|
|
3058
3090
|
}
|
|
3059
|
-
|
|
3091
|
+
_context88.t5 = undefined;
|
|
3060
3092
|
case 20:
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
dfp_telemetry_id:
|
|
3064
|
-
captcha_token:
|
|
3065
|
-
intermediate_session_token:
|
|
3093
|
+
_context88.t6 = _context88.t5;
|
|
3094
|
+
_context88.t7 = {
|
|
3095
|
+
dfp_telemetry_id: _context88.t3,
|
|
3096
|
+
captcha_token: _context88.t4,
|
|
3097
|
+
intermediate_session_token: _context88.t6
|
|
3066
3098
|
};
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3099
|
+
_context88.t8 = _context88.t1.assign.call(_context88.t1, _context88.t2, _context88.t7);
|
|
3100
|
+
_context88.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
3101
|
+
_context88.t10 = {
|
|
3070
3102
|
url: '/b2b/sso/authenticate',
|
|
3071
3103
|
method: 'POST',
|
|
3072
|
-
body:
|
|
3073
|
-
retryCallback:
|
|
3104
|
+
body: _context88.t8,
|
|
3105
|
+
retryCallback: _context88.t9
|
|
3074
3106
|
};
|
|
3075
|
-
|
|
3076
|
-
return
|
|
3107
|
+
_context88.next = 27;
|
|
3108
|
+
return _context88.t0.retriableFetchSDK.call(_context88.t0, _context88.t10);
|
|
3077
3109
|
case 27:
|
|
3078
|
-
resp =
|
|
3110
|
+
resp = _context88.sent;
|
|
3079
3111
|
this._pkceManager.clearPKPair();
|
|
3080
3112
|
this._subscriptionService.updateSession(resp);
|
|
3081
|
-
return
|
|
3113
|
+
return _context88.abrupt("return", resp);
|
|
3082
3114
|
case 31:
|
|
3083
3115
|
case "end":
|
|
3084
|
-
return
|
|
3116
|
+
return _context88.stop();
|
|
3085
3117
|
}
|
|
3086
|
-
},
|
|
3118
|
+
}, _callee88, this);
|
|
3087
3119
|
}));
|
|
3088
3120
|
}
|
|
3089
3121
|
}, {
|
|
3090
3122
|
key: "getBaseApiUrl",
|
|
3091
3123
|
value: function getBaseApiUrl() {
|
|
3092
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3093
|
-
return _regeneratorRuntime().wrap(function
|
|
3094
|
-
while (1) switch (
|
|
3124
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee89() {
|
|
3125
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
|
3126
|
+
while (1) switch (_context89.prev = _context89.next) {
|
|
3095
3127
|
case 0:
|
|
3096
3128
|
if (!isTestPublicToken(this._config.publicToken)) {
|
|
3097
|
-
|
|
3129
|
+
_context89.next = 2;
|
|
3098
3130
|
break;
|
|
3099
3131
|
}
|
|
3100
|
-
return
|
|
3132
|
+
return _context89.abrupt("return", this._config.testAPIURL);
|
|
3101
3133
|
case 2:
|
|
3102
|
-
return
|
|
3134
|
+
return _context89.abrupt("return", this._config.liveAPIURL);
|
|
3103
3135
|
case 3:
|
|
3104
3136
|
case "end":
|
|
3105
|
-
return
|
|
3137
|
+
return _context89.stop();
|
|
3106
3138
|
}
|
|
3107
|
-
},
|
|
3139
|
+
}, _callee89, this);
|
|
3108
3140
|
}));
|
|
3109
3141
|
}
|
|
3110
3142
|
}, {
|
|
@@ -3113,33 +3145,33 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
|
|
|
3113
3145
|
var connection_id = _ref7.connection_id,
|
|
3114
3146
|
login_redirect_url = _ref7.login_redirect_url,
|
|
3115
3147
|
signup_redirect_url = _ref7.signup_redirect_url;
|
|
3116
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3148
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee90() {
|
|
3117
3149
|
var _yield$this$_dynamicC3, pkceRequiredForSso, baseURL, startUrl, keyPair;
|
|
3118
|
-
return _regeneratorRuntime().wrap(function
|
|
3119
|
-
while (1) switch (
|
|
3150
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
|
3151
|
+
while (1) switch (_context90.prev = _context90.next) {
|
|
3120
3152
|
case 0:
|
|
3121
|
-
|
|
3153
|
+
_context90.next = 2;
|
|
3122
3154
|
return this._dynamicConfig;
|
|
3123
3155
|
case 2:
|
|
3124
|
-
_yield$this$_dynamicC3 =
|
|
3156
|
+
_yield$this$_dynamicC3 = _context90.sent;
|
|
3125
3157
|
pkceRequiredForSso = _yield$this$_dynamicC3.pkceRequiredForSso;
|
|
3126
|
-
|
|
3158
|
+
_context90.next = 6;
|
|
3127
3159
|
return this.getBaseApiUrl();
|
|
3128
3160
|
case 6:
|
|
3129
|
-
baseURL =
|
|
3161
|
+
baseURL = _context90.sent;
|
|
3130
3162
|
startUrl = new URL("".concat(baseURL, "/v1/public/sso/start"));
|
|
3131
3163
|
startUrl.searchParams.set('public_token', this._config.publicToken);
|
|
3132
3164
|
startUrl.searchParams.set('connection_id', connection_id);
|
|
3133
3165
|
if (!pkceRequiredForSso) {
|
|
3134
|
-
|
|
3166
|
+
_context90.next = 17;
|
|
3135
3167
|
break;
|
|
3136
3168
|
}
|
|
3137
|
-
|
|
3169
|
+
_context90.next = 13;
|
|
3138
3170
|
return this._pkceManager.startPKCETransaction();
|
|
3139
3171
|
case 13:
|
|
3140
|
-
keyPair =
|
|
3172
|
+
keyPair = _context90.sent;
|
|
3141
3173
|
startUrl.searchParams.set('pkce_code_challenge', keyPair.code_challenge);
|
|
3142
|
-
|
|
3174
|
+
_context90.next = 18;
|
|
3143
3175
|
break;
|
|
3144
3176
|
case 17:
|
|
3145
3177
|
this._pkceManager.clearPKPair();
|
|
@@ -3149,69 +3181,69 @@ var HeadlessB2BSSOClient = /*#__PURE__*/function () {
|
|
|
3149
3181
|
window.location.href = startUrl.toString();
|
|
3150
3182
|
case 21:
|
|
3151
3183
|
case "end":
|
|
3152
|
-
return
|
|
3184
|
+
return _context90.stop();
|
|
3153
3185
|
}
|
|
3154
|
-
},
|
|
3186
|
+
}, _callee90, this);
|
|
3155
3187
|
}));
|
|
3156
3188
|
}
|
|
3157
3189
|
}, {
|
|
3158
3190
|
key: "getConnections",
|
|
3159
3191
|
value: function getConnections() {
|
|
3160
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3161
|
-
return _regeneratorRuntime().wrap(function
|
|
3162
|
-
while (1) switch (
|
|
3192
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee91() {
|
|
3193
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
|
3194
|
+
while (1) switch (_context91.prev = _context91.next) {
|
|
3163
3195
|
case 0:
|
|
3164
|
-
|
|
3196
|
+
_context91.next = 2;
|
|
3165
3197
|
return this._networkClient.fetchSDK({
|
|
3166
3198
|
url: '/b2b/sso',
|
|
3167
3199
|
method: 'GET'
|
|
3168
3200
|
});
|
|
3169
3201
|
case 2:
|
|
3170
|
-
return
|
|
3202
|
+
return _context91.abrupt("return", _context91.sent);
|
|
3171
3203
|
case 3:
|
|
3172
3204
|
case "end":
|
|
3173
|
-
return
|
|
3205
|
+
return _context91.stop();
|
|
3174
3206
|
}
|
|
3175
|
-
},
|
|
3207
|
+
}, _callee91, this);
|
|
3176
3208
|
}));
|
|
3177
3209
|
}
|
|
3178
3210
|
}, {
|
|
3179
3211
|
key: "discoverConnections",
|
|
3180
3212
|
value: function discoverConnections(emailAddress) {
|
|
3181
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3182
|
-
return _regeneratorRuntime().wrap(function
|
|
3183
|
-
while (1) switch (
|
|
3213
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee92() {
|
|
3214
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
|
3215
|
+
while (1) switch (_context92.prev = _context92.next) {
|
|
3184
3216
|
case 0:
|
|
3185
|
-
|
|
3217
|
+
_context92.next = 2;
|
|
3186
3218
|
return this._networkClient.fetchSDK({
|
|
3187
3219
|
url: "/b2b/sso/discovery/connections?email_address=".concat(encodeURIComponent(emailAddress)),
|
|
3188
3220
|
method: 'GET'
|
|
3189
3221
|
});
|
|
3190
3222
|
case 2:
|
|
3191
|
-
return
|
|
3223
|
+
return _context92.abrupt("return", _context92.sent);
|
|
3192
3224
|
case 3:
|
|
3193
3225
|
case "end":
|
|
3194
|
-
return
|
|
3226
|
+
return _context92.stop();
|
|
3195
3227
|
}
|
|
3196
|
-
},
|
|
3228
|
+
}, _callee92, this);
|
|
3197
3229
|
}));
|
|
3198
3230
|
}
|
|
3199
3231
|
}, {
|
|
3200
3232
|
key: "deleteConnection",
|
|
3201
3233
|
value: function deleteConnection(connectionId) {
|
|
3202
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3203
|
-
return _regeneratorRuntime().wrap(function
|
|
3204
|
-
while (1) switch (
|
|
3234
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee93() {
|
|
3235
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
|
3236
|
+
while (1) switch (_context93.prev = _context93.next) {
|
|
3205
3237
|
case 0:
|
|
3206
|
-
return
|
|
3238
|
+
return _context93.abrupt("return", this._networkClient.fetchSDK({
|
|
3207
3239
|
url: "/b2b/sso/".concat(connectionId),
|
|
3208
3240
|
method: 'DELETE'
|
|
3209
3241
|
}));
|
|
3210
3242
|
case 1:
|
|
3211
3243
|
case "end":
|
|
3212
|
-
return
|
|
3244
|
+
return _context93.stop();
|
|
3213
3245
|
}
|
|
3214
|
-
},
|
|
3246
|
+
}, _callee93, this);
|
|
3215
3247
|
}));
|
|
3216
3248
|
}
|
|
3217
3249
|
}]);
|
|
@@ -3225,124 +3257,124 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
|
|
|
3225
3257
|
return _createClass(HeadlessB2BSCIMClient, [{
|
|
3226
3258
|
key: "createConnection",
|
|
3227
3259
|
value: function createConnection(data) {
|
|
3228
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3229
|
-
return _regeneratorRuntime().wrap(function
|
|
3230
|
-
while (1) switch (
|
|
3260
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee94() {
|
|
3261
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
|
3262
|
+
while (1) switch (_context94.prev = _context94.next) {
|
|
3231
3263
|
case 0:
|
|
3232
3264
|
validate('stytch.scim.createConnection').isOptionalString('display_name', data.display_name).isOptionalString('identity_provider', data.identity_provider);
|
|
3233
|
-
|
|
3265
|
+
_context94.next = 3;
|
|
3234
3266
|
return this._networkClient.fetchSDK({
|
|
3235
3267
|
url: '/b2b/scim',
|
|
3236
3268
|
method: 'POST',
|
|
3237
3269
|
body: data
|
|
3238
3270
|
});
|
|
3239
3271
|
case 3:
|
|
3240
|
-
return
|
|
3272
|
+
return _context94.abrupt("return", _context94.sent);
|
|
3241
3273
|
case 4:
|
|
3242
3274
|
case "end":
|
|
3243
|
-
return
|
|
3275
|
+
return _context94.stop();
|
|
3244
3276
|
}
|
|
3245
|
-
},
|
|
3277
|
+
}, _callee94, this);
|
|
3246
3278
|
}));
|
|
3247
3279
|
}
|
|
3248
3280
|
}, {
|
|
3249
3281
|
key: "updateConnection",
|
|
3250
3282
|
value: function updateConnection(data) {
|
|
3251
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3252
|
-
return _regeneratorRuntime().wrap(function
|
|
3253
|
-
while (1) switch (
|
|
3283
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee95() {
|
|
3284
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
|
3285
|
+
while (1) switch (_context95.prev = _context95.next) {
|
|
3254
3286
|
case 0:
|
|
3255
3287
|
validate('stytch.scim.updateConnection').isString('connection_id', data.connection_id).isOptionalString('display_name', data.display_name).isOptionalString('identity_provider', data.identity_provider);
|
|
3256
|
-
|
|
3288
|
+
_context95.next = 3;
|
|
3257
3289
|
return this._networkClient.fetchSDK({
|
|
3258
3290
|
url: "/b2b/scim/".concat(data.connection_id),
|
|
3259
3291
|
method: 'PUT',
|
|
3260
3292
|
body: data
|
|
3261
3293
|
});
|
|
3262
3294
|
case 3:
|
|
3263
|
-
return
|
|
3295
|
+
return _context95.abrupt("return", _context95.sent);
|
|
3264
3296
|
case 4:
|
|
3265
3297
|
case "end":
|
|
3266
|
-
return
|
|
3298
|
+
return _context95.stop();
|
|
3267
3299
|
}
|
|
3268
|
-
},
|
|
3300
|
+
}, _callee95, this);
|
|
3269
3301
|
}));
|
|
3270
3302
|
}
|
|
3271
3303
|
}, {
|
|
3272
3304
|
key: "deleteConnection",
|
|
3273
3305
|
value: function deleteConnection(connectionId) {
|
|
3274
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3275
|
-
return _regeneratorRuntime().wrap(function
|
|
3276
|
-
while (1) switch (
|
|
3306
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee96() {
|
|
3307
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
|
3308
|
+
while (1) switch (_context96.prev = _context96.next) {
|
|
3277
3309
|
case 0:
|
|
3278
3310
|
validate('stytch.scim.deleteConnection').isString('connection_id', connectionId);
|
|
3279
|
-
|
|
3311
|
+
_context96.next = 3;
|
|
3280
3312
|
return this._networkClient.fetchSDK({
|
|
3281
3313
|
url: "/b2b/scim/".concat(connectionId),
|
|
3282
3314
|
method: 'DELETE'
|
|
3283
3315
|
});
|
|
3284
3316
|
case 3:
|
|
3285
|
-
return
|
|
3317
|
+
return _context96.abrupt("return", _context96.sent);
|
|
3286
3318
|
case 4:
|
|
3287
3319
|
case "end":
|
|
3288
|
-
return
|
|
3320
|
+
return _context96.stop();
|
|
3289
3321
|
}
|
|
3290
|
-
},
|
|
3322
|
+
}, _callee96, this);
|
|
3291
3323
|
}));
|
|
3292
3324
|
}
|
|
3293
3325
|
}, {
|
|
3294
3326
|
key: "getConnection",
|
|
3295
3327
|
value: function getConnection() {
|
|
3296
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3297
|
-
return _regeneratorRuntime().wrap(function
|
|
3298
|
-
while (1) switch (
|
|
3328
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee97() {
|
|
3329
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
|
3330
|
+
while (1) switch (_context97.prev = _context97.next) {
|
|
3299
3331
|
case 0:
|
|
3300
|
-
|
|
3332
|
+
_context97.next = 2;
|
|
3301
3333
|
return this._networkClient.fetchSDK({
|
|
3302
3334
|
url: '/b2b/scim',
|
|
3303
3335
|
method: 'GET'
|
|
3304
3336
|
});
|
|
3305
3337
|
case 2:
|
|
3306
|
-
return
|
|
3338
|
+
return _context97.abrupt("return", _context97.sent);
|
|
3307
3339
|
case 3:
|
|
3308
3340
|
case "end":
|
|
3309
|
-
return
|
|
3341
|
+
return _context97.stop();
|
|
3310
3342
|
}
|
|
3311
|
-
},
|
|
3343
|
+
}, _callee97, this);
|
|
3312
3344
|
}));
|
|
3313
3345
|
}
|
|
3314
3346
|
}, {
|
|
3315
3347
|
key: "getConnectionGroups",
|
|
3316
3348
|
value: function getConnectionGroups(data) {
|
|
3317
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3318
|
-
return _regeneratorRuntime().wrap(function
|
|
3319
|
-
while (1) switch (
|
|
3349
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee98() {
|
|
3350
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
|
3351
|
+
while (1) switch (_context98.prev = _context98.next) {
|
|
3320
3352
|
case 0:
|
|
3321
3353
|
validate('stytch.scim.getConnectionGroups').isOptionalNumber('limit', data.limit).isOptionalString('cursor', data.cursor);
|
|
3322
|
-
|
|
3354
|
+
_context98.next = 3;
|
|
3323
3355
|
return this._networkClient.fetchSDK({
|
|
3324
3356
|
url: '/b2b/scim/groups',
|
|
3325
3357
|
method: 'POST',
|
|
3326
3358
|
body: data
|
|
3327
3359
|
});
|
|
3328
3360
|
case 3:
|
|
3329
|
-
return
|
|
3361
|
+
return _context98.abrupt("return", _context98.sent);
|
|
3330
3362
|
case 4:
|
|
3331
3363
|
case "end":
|
|
3332
|
-
return
|
|
3364
|
+
return _context98.stop();
|
|
3333
3365
|
}
|
|
3334
|
-
},
|
|
3366
|
+
}, _callee98, this);
|
|
3335
3367
|
}));
|
|
3336
3368
|
}
|
|
3337
3369
|
}, {
|
|
3338
3370
|
key: "rotateStart",
|
|
3339
3371
|
value: function rotateStart(connectionId) {
|
|
3340
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3341
|
-
return _regeneratorRuntime().wrap(function
|
|
3342
|
-
while (1) switch (
|
|
3372
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee99() {
|
|
3373
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
|
3374
|
+
while (1) switch (_context99.prev = _context99.next) {
|
|
3343
3375
|
case 0:
|
|
3344
3376
|
validate('stytch.scim.rotateStart').isString('connectionId', connectionId);
|
|
3345
|
-
|
|
3377
|
+
_context99.next = 3;
|
|
3346
3378
|
return this._networkClient.fetchSDK({
|
|
3347
3379
|
url: "/b2b/scim/rotate/start",
|
|
3348
3380
|
method: 'POST',
|
|
@@ -3351,23 +3383,23 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
|
|
|
3351
3383
|
}
|
|
3352
3384
|
});
|
|
3353
3385
|
case 3:
|
|
3354
|
-
return
|
|
3386
|
+
return _context99.abrupt("return", _context99.sent);
|
|
3355
3387
|
case 4:
|
|
3356
3388
|
case "end":
|
|
3357
|
-
return
|
|
3389
|
+
return _context99.stop();
|
|
3358
3390
|
}
|
|
3359
|
-
},
|
|
3391
|
+
}, _callee99, this);
|
|
3360
3392
|
}));
|
|
3361
3393
|
}
|
|
3362
3394
|
}, {
|
|
3363
3395
|
key: "rotateComplete",
|
|
3364
3396
|
value: function rotateComplete(connectionId) {
|
|
3365
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3366
|
-
return _regeneratorRuntime().wrap(function
|
|
3367
|
-
while (1) switch (
|
|
3397
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee100() {
|
|
3398
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
|
3399
|
+
while (1) switch (_context100.prev = _context100.next) {
|
|
3368
3400
|
case 0:
|
|
3369
3401
|
validate('stytch.scim.rotateComplete').isString('connectionId', connectionId);
|
|
3370
|
-
|
|
3402
|
+
_context100.next = 3;
|
|
3371
3403
|
return this._networkClient.fetchSDK({
|
|
3372
3404
|
url: "/b2b/scim/rotate/complete",
|
|
3373
3405
|
method: 'POST',
|
|
@@ -3376,23 +3408,23 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
|
|
|
3376
3408
|
}
|
|
3377
3409
|
});
|
|
3378
3410
|
case 3:
|
|
3379
|
-
return
|
|
3411
|
+
return _context100.abrupt("return", _context100.sent);
|
|
3380
3412
|
case 4:
|
|
3381
3413
|
case "end":
|
|
3382
|
-
return
|
|
3414
|
+
return _context100.stop();
|
|
3383
3415
|
}
|
|
3384
|
-
},
|
|
3416
|
+
}, _callee100, this);
|
|
3385
3417
|
}));
|
|
3386
3418
|
}
|
|
3387
3419
|
}, {
|
|
3388
3420
|
key: "rotateCancel",
|
|
3389
3421
|
value: function rotateCancel(connectionId) {
|
|
3390
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3391
|
-
return _regeneratorRuntime().wrap(function
|
|
3392
|
-
while (1) switch (
|
|
3422
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee101() {
|
|
3423
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
|
3424
|
+
while (1) switch (_context101.prev = _context101.next) {
|
|
3393
3425
|
case 0:
|
|
3394
3426
|
validate('stytch.scim.rotateCancel').isString('connectionId', connectionId);
|
|
3395
|
-
|
|
3427
|
+
_context101.next = 3;
|
|
3396
3428
|
return this._networkClient.fetchSDK({
|
|
3397
3429
|
url: "/b2b/scim/rotate/cancel",
|
|
3398
3430
|
method: 'POST',
|
|
@@ -3401,12 +3433,12 @@ var HeadlessB2BSCIMClient = /*#__PURE__*/function () {
|
|
|
3401
3433
|
}
|
|
3402
3434
|
});
|
|
3403
3435
|
case 3:
|
|
3404
|
-
return
|
|
3436
|
+
return _context101.abrupt("return", _context101.sent);
|
|
3405
3437
|
case 4:
|
|
3406
3438
|
case "end":
|
|
3407
|
-
return
|
|
3439
|
+
return _context101.stop();
|
|
3408
3440
|
}
|
|
3409
|
-
},
|
|
3441
|
+
}, _callee101, this);
|
|
3410
3442
|
}));
|
|
3411
3443
|
}
|
|
3412
3444
|
}]);
|
|
@@ -3418,25 +3450,25 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
|
|
|
3418
3450
|
this._apiNetworkClient = _apiNetworkClient;
|
|
3419
3451
|
this._subscriptionService = _subscriptionService;
|
|
3420
3452
|
this.get = function () {
|
|
3421
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3453
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee102() {
|
|
3422
3454
|
var resp;
|
|
3423
|
-
return _regeneratorRuntime().wrap(function
|
|
3424
|
-
while (1) switch (
|
|
3455
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
|
3456
|
+
while (1) switch (_context102.prev = _context102.next) {
|
|
3425
3457
|
case 0:
|
|
3426
|
-
|
|
3458
|
+
_context102.next = 2;
|
|
3427
3459
|
return this._networkClient.fetchSDK({
|
|
3428
3460
|
url: "/b2b/organizations/me",
|
|
3429
3461
|
method: 'GET'
|
|
3430
3462
|
});
|
|
3431
3463
|
case 2:
|
|
3432
|
-
resp =
|
|
3464
|
+
resp = _context102.sent;
|
|
3433
3465
|
this._subscriptionService.updateOrganization(resp.organization);
|
|
3434
|
-
return
|
|
3466
|
+
return _context102.abrupt("return", resp.organization);
|
|
3435
3467
|
case 5:
|
|
3436
3468
|
case "end":
|
|
3437
|
-
return
|
|
3469
|
+
return _context102.stop();
|
|
3438
3470
|
}
|
|
3439
|
-
},
|
|
3471
|
+
}, _callee102, this);
|
|
3440
3472
|
}));
|
|
3441
3473
|
};
|
|
3442
3474
|
this.getSync = function () {
|
|
@@ -3455,254 +3487,318 @@ var HeadlessB2BOrganizationClient = /*#__PURE__*/_createClass(function HeadlessB
|
|
|
3455
3487
|
});
|
|
3456
3488
|
};
|
|
3457
3489
|
this.update = function (data) {
|
|
3458
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3490
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee103() {
|
|
3459
3491
|
var resp;
|
|
3460
|
-
return _regeneratorRuntime().wrap(function
|
|
3461
|
-
while (1) switch (
|
|
3492
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
|
3493
|
+
while (1) switch (_context103.prev = _context103.next) {
|
|
3462
3494
|
case 0:
|
|
3463
|
-
|
|
3495
|
+
_context103.next = 2;
|
|
3464
3496
|
return this._networkClient.fetchSDK({
|
|
3465
3497
|
url: "/b2b/organizations/me",
|
|
3466
3498
|
method: 'PUT',
|
|
3467
3499
|
body: data
|
|
3468
3500
|
});
|
|
3469
3501
|
case 2:
|
|
3470
|
-
resp =
|
|
3502
|
+
resp = _context103.sent;
|
|
3471
3503
|
this._subscriptionService.updateOrganization(resp.organization);
|
|
3472
|
-
return
|
|
3504
|
+
return _context103.abrupt("return", resp);
|
|
3473
3505
|
case 5:
|
|
3474
3506
|
case "end":
|
|
3475
|
-
return
|
|
3507
|
+
return _context103.stop();
|
|
3476
3508
|
}
|
|
3477
|
-
},
|
|
3509
|
+
}, _callee103, this);
|
|
3478
3510
|
}));
|
|
3479
3511
|
};
|
|
3480
3512
|
this["delete"] = function () {
|
|
3481
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3513
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee104() {
|
|
3482
3514
|
var resp;
|
|
3483
|
-
return _regeneratorRuntime().wrap(function
|
|
3484
|
-
while (1) switch (
|
|
3515
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
|
3516
|
+
while (1) switch (_context104.prev = _context104.next) {
|
|
3485
3517
|
case 0:
|
|
3486
|
-
|
|
3518
|
+
_context104.next = 2;
|
|
3487
3519
|
return this._networkClient.fetchSDK({
|
|
3488
3520
|
url: "/b2b/organizations/me",
|
|
3489
3521
|
method: 'DELETE'
|
|
3490
3522
|
});
|
|
3491
3523
|
case 2:
|
|
3492
|
-
resp =
|
|
3524
|
+
resp = _context104.sent;
|
|
3493
3525
|
this._subscriptionService.destroyState();
|
|
3494
|
-
return
|
|
3526
|
+
return _context104.abrupt("return", resp);
|
|
3495
3527
|
case 5:
|
|
3496
3528
|
case "end":
|
|
3497
|
-
return
|
|
3529
|
+
return _context104.stop();
|
|
3530
|
+
}
|
|
3531
|
+
}, _callee104, this);
|
|
3532
|
+
}));
|
|
3533
|
+
};
|
|
3534
|
+
this.getBySlug = function (data) {
|
|
3535
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee105() {
|
|
3536
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
|
3537
|
+
while (1) switch (_context105.prev = _context105.next) {
|
|
3538
|
+
case 0:
|
|
3539
|
+
validate('stytch.organization.getBySlug').isString('organization_slug', data.organization_slug);
|
|
3540
|
+
return _context105.abrupt("return", this._networkClient.fetchSDK({
|
|
3541
|
+
url: "/b2b/organizations/search",
|
|
3542
|
+
method: 'POST',
|
|
3543
|
+
body: data
|
|
3544
|
+
}));
|
|
3545
|
+
case 2:
|
|
3546
|
+
case "end":
|
|
3547
|
+
return _context105.stop();
|
|
3548
|
+
}
|
|
3549
|
+
}, _callee105, this);
|
|
3550
|
+
}));
|
|
3551
|
+
};
|
|
3552
|
+
this.getConnectedApps = function () {
|
|
3553
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee106() {
|
|
3554
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
|
3555
|
+
while (1) switch (_context106.prev = _context106.next) {
|
|
3556
|
+
case 0:
|
|
3557
|
+
return _context106.abrupt("return", this._networkClient.fetchSDK({
|
|
3558
|
+
url: '/b2b/organizations/connected_apps',
|
|
3559
|
+
method: 'GET'
|
|
3560
|
+
}));
|
|
3561
|
+
case 1:
|
|
3562
|
+
case "end":
|
|
3563
|
+
return _context106.stop();
|
|
3498
3564
|
}
|
|
3499
|
-
},
|
|
3565
|
+
}, _callee106, this);
|
|
3500
3566
|
}));
|
|
3501
3567
|
};
|
|
3502
|
-
this.
|
|
3503
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3504
|
-
return _regeneratorRuntime().wrap(function
|
|
3505
|
-
while (1) switch (
|
|
3568
|
+
this.getConnectedApp = function (data) {
|
|
3569
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee107() {
|
|
3570
|
+
return _regeneratorRuntime().wrap(function _callee107$(_context107) {
|
|
3571
|
+
while (1) switch (_context107.prev = _context107.next) {
|
|
3506
3572
|
case 0:
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
method: 'POST',
|
|
3511
|
-
body: data
|
|
3573
|
+
return _context107.abrupt("return", this._networkClient.fetchSDK({
|
|
3574
|
+
url: "/b2b/organizations/connected_apps/".concat(data.connected_app_id),
|
|
3575
|
+
method: 'GET'
|
|
3512
3576
|
}));
|
|
3513
|
-
case
|
|
3577
|
+
case 1:
|
|
3514
3578
|
case "end":
|
|
3515
|
-
return
|
|
3579
|
+
return _context107.stop();
|
|
3516
3580
|
}
|
|
3517
|
-
},
|
|
3581
|
+
}, _callee107, this);
|
|
3518
3582
|
}));
|
|
3519
3583
|
};
|
|
3520
3584
|
this.members = {
|
|
3521
3585
|
create: function create(data) {
|
|
3522
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3523
|
-
return _regeneratorRuntime().wrap(function
|
|
3524
|
-
while (1) switch (
|
|
3586
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee108() {
|
|
3587
|
+
return _regeneratorRuntime().wrap(function _callee108$(_context108) {
|
|
3588
|
+
while (1) switch (_context108.prev = _context108.next) {
|
|
3525
3589
|
case 0:
|
|
3526
|
-
return
|
|
3590
|
+
return _context108.abrupt("return", this._networkClient.fetchSDK({
|
|
3527
3591
|
url: "/b2b/organizations/members",
|
|
3528
3592
|
method: 'POST',
|
|
3529
3593
|
body: data
|
|
3530
3594
|
}));
|
|
3531
3595
|
case 1:
|
|
3532
3596
|
case "end":
|
|
3533
|
-
return
|
|
3597
|
+
return _context108.stop();
|
|
3534
3598
|
}
|
|
3535
|
-
},
|
|
3599
|
+
}, _callee108, this);
|
|
3536
3600
|
}));
|
|
3537
3601
|
},
|
|
3538
3602
|
search: function search(data) {
|
|
3539
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3540
|
-
return _regeneratorRuntime().wrap(function
|
|
3541
|
-
while (1) switch (
|
|
3603
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee109() {
|
|
3604
|
+
return _regeneratorRuntime().wrap(function _callee109$(_context109) {
|
|
3605
|
+
while (1) switch (_context109.prev = _context109.next) {
|
|
3542
3606
|
case 0:
|
|
3543
|
-
return
|
|
3607
|
+
return _context109.abrupt("return", this._networkClient.fetchSDK({
|
|
3544
3608
|
url: "/b2b/organizations/me/members/search",
|
|
3545
3609
|
method: 'POST',
|
|
3546
3610
|
body: data
|
|
3547
3611
|
}));
|
|
3548
3612
|
case 1:
|
|
3549
3613
|
case "end":
|
|
3550
|
-
return
|
|
3614
|
+
return _context109.stop();
|
|
3551
3615
|
}
|
|
3552
|
-
},
|
|
3616
|
+
}, _callee109, this);
|
|
3553
3617
|
}));
|
|
3554
3618
|
},
|
|
3555
3619
|
update: function update(data) {
|
|
3556
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3620
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee110() {
|
|
3557
3621
|
var response;
|
|
3558
|
-
return _regeneratorRuntime().wrap(function
|
|
3559
|
-
while (1) switch (
|
|
3622
|
+
return _regeneratorRuntime().wrap(function _callee110$(_context110) {
|
|
3623
|
+
while (1) switch (_context110.prev = _context110.next) {
|
|
3560
3624
|
case 0:
|
|
3561
|
-
|
|
3625
|
+
_context110.next = 2;
|
|
3562
3626
|
return this._networkClient.fetchSDK({
|
|
3563
3627
|
url: "/b2b/organizations/members/".concat(data.member_id),
|
|
3564
3628
|
method: 'PUT',
|
|
3565
3629
|
body: data
|
|
3566
3630
|
});
|
|
3567
3631
|
case 2:
|
|
3568
|
-
response =
|
|
3632
|
+
response = _context110.sent;
|
|
3569
3633
|
this.updateMemberIfSelf(response);
|
|
3570
|
-
return
|
|
3634
|
+
return _context110.abrupt("return", response);
|
|
3571
3635
|
case 5:
|
|
3572
3636
|
case "end":
|
|
3573
|
-
return
|
|
3637
|
+
return _context110.stop();
|
|
3574
3638
|
}
|
|
3575
|
-
},
|
|
3639
|
+
}, _callee110, this);
|
|
3576
3640
|
}));
|
|
3577
3641
|
},
|
|
3578
3642
|
deletePassword: function deletePassword(passwordId) {
|
|
3579
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3643
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee111() {
|
|
3580
3644
|
var response;
|
|
3581
|
-
return _regeneratorRuntime().wrap(function
|
|
3582
|
-
while (1) switch (
|
|
3645
|
+
return _regeneratorRuntime().wrap(function _callee111$(_context111) {
|
|
3646
|
+
while (1) switch (_context111.prev = _context111.next) {
|
|
3583
3647
|
case 0:
|
|
3584
|
-
|
|
3648
|
+
_context111.next = 2;
|
|
3585
3649
|
return this._networkClient.fetchSDK({
|
|
3586
3650
|
url: "/b2b/organizations/members/passwords/".concat(passwordId),
|
|
3587
3651
|
method: 'DELETE'
|
|
3588
3652
|
});
|
|
3589
3653
|
case 2:
|
|
3590
|
-
response =
|
|
3654
|
+
response = _context111.sent;
|
|
3591
3655
|
this.updateMemberIfSelf(response);
|
|
3592
|
-
return
|
|
3656
|
+
return _context111.abrupt("return", response);
|
|
3593
3657
|
case 5:
|
|
3594
3658
|
case "end":
|
|
3595
|
-
return
|
|
3659
|
+
return _context111.stop();
|
|
3596
3660
|
}
|
|
3597
|
-
},
|
|
3661
|
+
}, _callee111, this);
|
|
3598
3662
|
}));
|
|
3599
3663
|
},
|
|
3600
3664
|
deleteMFAPhoneNumber: function deleteMFAPhoneNumber(memberId) {
|
|
3601
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3665
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee112() {
|
|
3602
3666
|
var response;
|
|
3603
|
-
return _regeneratorRuntime().wrap(function
|
|
3604
|
-
while (1) switch (
|
|
3667
|
+
return _regeneratorRuntime().wrap(function _callee112$(_context112) {
|
|
3668
|
+
while (1) switch (_context112.prev = _context112.next) {
|
|
3605
3669
|
case 0:
|
|
3606
|
-
|
|
3670
|
+
_context112.next = 2;
|
|
3607
3671
|
return this._networkClient.fetchSDK({
|
|
3608
3672
|
url: "/b2b/organizations/members/mfa_phone_numbers/".concat(memberId),
|
|
3609
3673
|
method: 'DELETE'
|
|
3610
3674
|
});
|
|
3611
3675
|
case 2:
|
|
3612
|
-
response =
|
|
3676
|
+
response = _context112.sent;
|
|
3613
3677
|
this.updateMemberIfSelf(response);
|
|
3614
|
-
return
|
|
3678
|
+
return _context112.abrupt("return", response);
|
|
3615
3679
|
case 5:
|
|
3616
3680
|
case "end":
|
|
3617
|
-
return
|
|
3681
|
+
return _context112.stop();
|
|
3618
3682
|
}
|
|
3619
|
-
},
|
|
3683
|
+
}, _callee112, this);
|
|
3620
3684
|
}));
|
|
3621
3685
|
},
|
|
3622
3686
|
deleteMFATOTP: function deleteMFATOTP(memberId) {
|
|
3623
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3687
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee113() {
|
|
3624
3688
|
var response;
|
|
3625
|
-
return _regeneratorRuntime().wrap(function
|
|
3626
|
-
while (1) switch (
|
|
3689
|
+
return _regeneratorRuntime().wrap(function _callee113$(_context113) {
|
|
3690
|
+
while (1) switch (_context113.prev = _context113.next) {
|
|
3627
3691
|
case 0:
|
|
3628
|
-
|
|
3692
|
+
_context113.next = 2;
|
|
3629
3693
|
return this._networkClient.fetchSDK({
|
|
3630
3694
|
url: "/b2b/organizations/members/totp/".concat(memberId),
|
|
3631
3695
|
method: 'DELETE'
|
|
3632
3696
|
});
|
|
3633
3697
|
case 2:
|
|
3634
|
-
response =
|
|
3698
|
+
response = _context113.sent;
|
|
3635
3699
|
this.updateMemberIfSelf(response);
|
|
3636
|
-
return
|
|
3700
|
+
return _context113.abrupt("return", response);
|
|
3637
3701
|
case 5:
|
|
3638
3702
|
case "end":
|
|
3639
|
-
return
|
|
3703
|
+
return _context113.stop();
|
|
3640
3704
|
}
|
|
3641
|
-
},
|
|
3705
|
+
}, _callee113, this);
|
|
3642
3706
|
}));
|
|
3643
3707
|
},
|
|
3644
3708
|
"delete": function _delete(memberId) {
|
|
3645
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3709
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee114() {
|
|
3646
3710
|
var _a, response;
|
|
3647
|
-
return _regeneratorRuntime().wrap(function
|
|
3648
|
-
while (1) switch (
|
|
3711
|
+
return _regeneratorRuntime().wrap(function _callee114$(_context114) {
|
|
3712
|
+
while (1) switch (_context114.prev = _context114.next) {
|
|
3649
3713
|
case 0:
|
|
3650
|
-
|
|
3714
|
+
_context114.next = 2;
|
|
3651
3715
|
return this._networkClient.fetchSDK({
|
|
3652
3716
|
url: "/b2b/organizations/members/".concat(memberId),
|
|
3653
3717
|
method: 'DELETE'
|
|
3654
3718
|
});
|
|
3655
3719
|
case 2:
|
|
3656
|
-
response =
|
|
3720
|
+
response = _context114.sent;
|
|
3657
3721
|
if (memberId === ((_a = this._subscriptionService.getMember()) === null || _a === void 0 ? void 0 : _a.member_id)) {
|
|
3658
3722
|
this._subscriptionService.destroyState();
|
|
3659
3723
|
}
|
|
3660
|
-
return
|
|
3724
|
+
return _context114.abrupt("return", response);
|
|
3661
3725
|
case 5:
|
|
3662
3726
|
case "end":
|
|
3663
|
-
return
|
|
3727
|
+
return _context114.stop();
|
|
3664
3728
|
}
|
|
3665
|
-
},
|
|
3729
|
+
}, _callee114, this);
|
|
3666
3730
|
}));
|
|
3667
3731
|
},
|
|
3668
3732
|
reactivate: function reactivate(memberId) {
|
|
3669
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3670
|
-
return _regeneratorRuntime().wrap(function
|
|
3671
|
-
while (1) switch (
|
|
3733
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee115() {
|
|
3734
|
+
return _regeneratorRuntime().wrap(function _callee115$(_context115) {
|
|
3735
|
+
while (1) switch (_context115.prev = _context115.next) {
|
|
3672
3736
|
case 0:
|
|
3673
|
-
return
|
|
3737
|
+
return _context115.abrupt("return", this._networkClient.fetchSDK({
|
|
3674
3738
|
url: "/b2b/organizations/members/".concat(memberId, "/reactivate"),
|
|
3675
3739
|
method: 'PUT'
|
|
3676
3740
|
}));
|
|
3677
3741
|
case 1:
|
|
3678
3742
|
case "end":
|
|
3679
|
-
return
|
|
3743
|
+
return _context115.stop();
|
|
3680
3744
|
}
|
|
3681
|
-
},
|
|
3745
|
+
}, _callee115, this);
|
|
3682
3746
|
}));
|
|
3683
3747
|
},
|
|
3684
3748
|
unlinkRetiredEmail: function unlinkRetiredEmail(data) {
|
|
3685
|
-
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3749
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee116() {
|
|
3686
3750
|
var member_id, body, response;
|
|
3687
|
-
return _regeneratorRuntime().wrap(function
|
|
3688
|
-
while (1) switch (
|
|
3751
|
+
return _regeneratorRuntime().wrap(function _callee116$(_context116) {
|
|
3752
|
+
while (1) switch (_context116.prev = _context116.next) {
|
|
3689
3753
|
case 0:
|
|
3690
3754
|
member_id = data.member_id, body = __rest$1(data, ["member_id"]);
|
|
3691
|
-
|
|
3755
|
+
_context116.next = 3;
|
|
3692
3756
|
return this._apiNetworkClient.fetchSDK({
|
|
3693
3757
|
url: "/b2b/organizations/members/".concat(member_id, "/unlink_retired_email"),
|
|
3694
3758
|
method: 'POST',
|
|
3695
3759
|
body: body
|
|
3696
3760
|
});
|
|
3697
3761
|
case 3:
|
|
3698
|
-
response =
|
|
3762
|
+
response = _context116.sent;
|
|
3699
3763
|
this.updateMemberIfSelf(response);
|
|
3700
|
-
return
|
|
3764
|
+
return _context116.abrupt("return", response);
|
|
3701
3765
|
case 6:
|
|
3702
3766
|
case "end":
|
|
3703
|
-
return
|
|
3767
|
+
return _context116.stop();
|
|
3704
3768
|
}
|
|
3705
|
-
},
|
|
3769
|
+
}, _callee116, this);
|
|
3770
|
+
}));
|
|
3771
|
+
},
|
|
3772
|
+
getConnectedApps: function getConnectedApps(data) {
|
|
3773
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee117() {
|
|
3774
|
+
return _regeneratorRuntime().wrap(function _callee117$(_context117) {
|
|
3775
|
+
while (1) switch (_context117.prev = _context117.next) {
|
|
3776
|
+
case 0:
|
|
3777
|
+
return _context117.abrupt("return", this._networkClient.fetchSDK({
|
|
3778
|
+
url: "b2b/organizations/members/".concat(data.member_id, "/connected_apps"),
|
|
3779
|
+
method: 'GET'
|
|
3780
|
+
}));
|
|
3781
|
+
case 1:
|
|
3782
|
+
case "end":
|
|
3783
|
+
return _context117.stop();
|
|
3784
|
+
}
|
|
3785
|
+
}, _callee117, this);
|
|
3786
|
+
}));
|
|
3787
|
+
},
|
|
3788
|
+
revokeConnectedApp: function revokeConnectedApp(data) {
|
|
3789
|
+
return __awaiter$1(_this13, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee118() {
|
|
3790
|
+
return _regeneratorRuntime().wrap(function _callee118$(_context118) {
|
|
3791
|
+
while (1) switch (_context118.prev = _context118.next) {
|
|
3792
|
+
case 0:
|
|
3793
|
+
return _context118.abrupt("return", this._networkClient.fetchSDK({
|
|
3794
|
+
url: "/b2b/organizations/members/".concat(data.member_id, "/connected_apps/").concat(data.connected_app_id, "/revoke"),
|
|
3795
|
+
method: 'POST'
|
|
3796
|
+
}));
|
|
3797
|
+
case 1:
|
|
3798
|
+
case "end":
|
|
3799
|
+
return _context118.stop();
|
|
3800
|
+
}
|
|
3801
|
+
}, _callee118, this);
|
|
3706
3802
|
}));
|
|
3707
3803
|
}
|
|
3708
3804
|
};
|
|
@@ -3725,20 +3821,20 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3725
3821
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
3726
3822
|
this.discovery = {
|
|
3727
3823
|
authenticate: function authenticate(data) {
|
|
3728
|
-
return __awaiter$1(_this14, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3824
|
+
return __awaiter$1(_this14, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee119() {
|
|
3729
3825
|
var pkPair, _yield$this$dfpProtec24, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
3730
|
-
return _regeneratorRuntime().wrap(function
|
|
3731
|
-
while (1) switch (
|
|
3826
|
+
return _regeneratorRuntime().wrap(function _callee119$(_context119) {
|
|
3827
|
+
while (1) switch (_context119.prev = _context119.next) {
|
|
3732
3828
|
case 0:
|
|
3733
3829
|
validate('stytch.oauth.discovery.authenticate').isString('discovery_oauth_token', data.discovery_oauth_token);
|
|
3734
|
-
|
|
3830
|
+
_context119.next = 3;
|
|
3735
3831
|
return this._pkceManager.getPKPair();
|
|
3736
3832
|
case 3:
|
|
3737
|
-
pkPair =
|
|
3738
|
-
|
|
3833
|
+
pkPair = _context119.sent;
|
|
3834
|
+
_context119.next = 6;
|
|
3739
3835
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3740
3836
|
case 6:
|
|
3741
|
-
_yield$this$dfpProtec24 =
|
|
3837
|
+
_yield$this$dfpProtec24 = _context119.sent;
|
|
3742
3838
|
dfp_telemetry_id = _yield$this$dfpProtec24.dfp_telemetry_id;
|
|
3743
3839
|
captcha_token = _yield$this$dfpProtec24.captcha_token;
|
|
3744
3840
|
requestBody = Object.assign({
|
|
@@ -3746,7 +3842,7 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3746
3842
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
3747
3843
|
captcha_token: captcha_token
|
|
3748
3844
|
}, data);
|
|
3749
|
-
|
|
3845
|
+
_context119.next = 12;
|
|
3750
3846
|
return this._networkClient.retriableFetchSDK({
|
|
3751
3847
|
url: '/b2b/oauth/discovery/authenticate',
|
|
3752
3848
|
body: requestBody,
|
|
@@ -3754,15 +3850,15 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3754
3850
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
3755
3851
|
});
|
|
3756
3852
|
case 12:
|
|
3757
|
-
resp =
|
|
3853
|
+
resp = _context119.sent;
|
|
3758
3854
|
this._pkceManager.clearPKPair();
|
|
3759
3855
|
this._subscriptionService.updateSession(resp);
|
|
3760
|
-
return
|
|
3856
|
+
return _context119.abrupt("return", resp);
|
|
3761
3857
|
case 16:
|
|
3762
3858
|
case "end":
|
|
3763
|
-
return
|
|
3859
|
+
return _context119.stop();
|
|
3764
3860
|
}
|
|
3765
|
-
},
|
|
3861
|
+
}, _callee119, this);
|
|
3766
3862
|
}));
|
|
3767
3863
|
}
|
|
3768
3864
|
};
|
|
@@ -3800,101 +3896,101 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3800
3896
|
return _createClass(HeadlessB2BOAuthClient, [{
|
|
3801
3897
|
key: "authenticate",
|
|
3802
3898
|
value: function authenticate(options) {
|
|
3803
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3899
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee120() {
|
|
3804
3900
|
var keyPair, _yield$this$dfpProtec25, dfp_telemetry_id, captcha_token, resp;
|
|
3805
|
-
return _regeneratorRuntime().wrap(function
|
|
3806
|
-
while (1) switch (
|
|
3901
|
+
return _regeneratorRuntime().wrap(function _callee120$(_context120) {
|
|
3902
|
+
while (1) switch (_context120.prev = _context120.next) {
|
|
3807
3903
|
case 0:
|
|
3808
3904
|
validate('stytch.oauth.authenticate').isString('oauth_token', options.oauth_token).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
|
|
3809
|
-
|
|
3905
|
+
_context120.next = 3;
|
|
3810
3906
|
return this._pkceManager.getPKPair();
|
|
3811
3907
|
case 3:
|
|
3812
|
-
keyPair =
|
|
3908
|
+
keyPair = _context120.sent;
|
|
3813
3909
|
if (!keyPair) {
|
|
3814
3910
|
logger.warn('No code verifier found in local storage for OAuth flow.\n' + 'Consider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.\n' + 'See https://stytch.com/docs/oauth#guides_pkce for more information.');
|
|
3815
3911
|
}
|
|
3816
|
-
|
|
3912
|
+
_context120.next = 7;
|
|
3817
3913
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
3818
3914
|
case 7:
|
|
3819
|
-
_yield$this$dfpProtec25 =
|
|
3915
|
+
_yield$this$dfpProtec25 = _context120.sent;
|
|
3820
3916
|
dfp_telemetry_id = _yield$this$dfpProtec25.dfp_telemetry_id;
|
|
3821
3917
|
captcha_token = _yield$this$dfpProtec25.captcha_token;
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3918
|
+
_context120.t0 = this._networkClient;
|
|
3919
|
+
_context120.t1 = Object;
|
|
3920
|
+
_context120.t2 = keyPair === null || keyPair === void 0 ? void 0 : keyPair.code_verifier;
|
|
3921
|
+
_context120.t3 = dfp_telemetry_id;
|
|
3922
|
+
_context120.t4 = captcha_token;
|
|
3923
|
+
_context120.next = 17;
|
|
3828
3924
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
3829
3925
|
case 17:
|
|
3830
|
-
|
|
3831
|
-
if (
|
|
3832
|
-
|
|
3926
|
+
_context120.t5 = _context120.sent;
|
|
3927
|
+
if (_context120.t5) {
|
|
3928
|
+
_context120.next = 20;
|
|
3833
3929
|
break;
|
|
3834
3930
|
}
|
|
3835
|
-
|
|
3931
|
+
_context120.t5 = undefined;
|
|
3836
3932
|
case 20:
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
pkce_code_verifier:
|
|
3840
|
-
dfp_telemetry_id:
|
|
3841
|
-
captcha_token:
|
|
3842
|
-
intermediate_session_token:
|
|
3933
|
+
_context120.t6 = _context120.t5;
|
|
3934
|
+
_context120.t7 = {
|
|
3935
|
+
pkce_code_verifier: _context120.t2,
|
|
3936
|
+
dfp_telemetry_id: _context120.t3,
|
|
3937
|
+
captcha_token: _context120.t4,
|
|
3938
|
+
intermediate_session_token: _context120.t6
|
|
3843
3939
|
};
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3940
|
+
_context120.t8 = options;
|
|
3941
|
+
_context120.t9 = _context120.t1.assign.call(_context120.t1, _context120.t7, _context120.t8);
|
|
3942
|
+
_context120.t10 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
3943
|
+
_context120.t11 = {
|
|
3848
3944
|
url: '/b2b/oauth/authenticate',
|
|
3849
3945
|
method: 'POST',
|
|
3850
|
-
body:
|
|
3851
|
-
retryCallback:
|
|
3946
|
+
body: _context120.t9,
|
|
3947
|
+
retryCallback: _context120.t10
|
|
3852
3948
|
};
|
|
3853
|
-
|
|
3854
|
-
return
|
|
3949
|
+
_context120.next = 28;
|
|
3950
|
+
return _context120.t0.retriableFetchSDK.call(_context120.t0, _context120.t11);
|
|
3855
3951
|
case 28:
|
|
3856
|
-
resp =
|
|
3952
|
+
resp = _context120.sent;
|
|
3857
3953
|
this._pkceManager.clearPKPair();
|
|
3858
3954
|
this._subscriptionService.updateSession(resp);
|
|
3859
|
-
return
|
|
3955
|
+
return _context120.abrupt("return", resp);
|
|
3860
3956
|
case 32:
|
|
3861
3957
|
case "end":
|
|
3862
|
-
return
|
|
3958
|
+
return _context120.stop();
|
|
3863
3959
|
}
|
|
3864
|
-
},
|
|
3960
|
+
}, _callee120, this);
|
|
3865
3961
|
}));
|
|
3866
3962
|
}
|
|
3867
3963
|
}, {
|
|
3868
3964
|
key: "getBaseApiUrl",
|
|
3869
3965
|
value: function getBaseApiUrl() {
|
|
3870
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3966
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee121() {
|
|
3871
3967
|
var _yield$this$_dynamicC4, cnameDomain;
|
|
3872
|
-
return _regeneratorRuntime().wrap(function
|
|
3873
|
-
while (1) switch (
|
|
3968
|
+
return _regeneratorRuntime().wrap(function _callee121$(_context121) {
|
|
3969
|
+
while (1) switch (_context121.prev = _context121.next) {
|
|
3874
3970
|
case 0:
|
|
3875
|
-
|
|
3971
|
+
_context121.next = 2;
|
|
3876
3972
|
return this._dynamicConfig;
|
|
3877
3973
|
case 2:
|
|
3878
|
-
_yield$this$_dynamicC4 =
|
|
3974
|
+
_yield$this$_dynamicC4 = _context121.sent;
|
|
3879
3975
|
cnameDomain = _yield$this$_dynamicC4.cnameDomain;
|
|
3880
3976
|
if (!cnameDomain) {
|
|
3881
|
-
|
|
3977
|
+
_context121.next = 6;
|
|
3882
3978
|
break;
|
|
3883
3979
|
}
|
|
3884
|
-
return
|
|
3980
|
+
return _context121.abrupt("return", "https://".concat(cnameDomain));
|
|
3885
3981
|
case 6:
|
|
3886
3982
|
if (!isTestPublicToken(this._config.publicToken)) {
|
|
3887
|
-
|
|
3983
|
+
_context121.next = 8;
|
|
3888
3984
|
break;
|
|
3889
3985
|
}
|
|
3890
|
-
return
|
|
3986
|
+
return _context121.abrupt("return", this._config.testAPIURL);
|
|
3891
3987
|
case 8:
|
|
3892
|
-
return
|
|
3988
|
+
return _context121.abrupt("return", this._config.liveAPIURL);
|
|
3893
3989
|
case 9:
|
|
3894
3990
|
case "end":
|
|
3895
|
-
return
|
|
3991
|
+
return _context121.stop();
|
|
3896
3992
|
}
|
|
3897
|
-
},
|
|
3993
|
+
}, _callee121, this);
|
|
3898
3994
|
}));
|
|
3899
3995
|
}
|
|
3900
3996
|
}, {
|
|
@@ -3908,20 +4004,20 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3908
4004
|
signup_redirect_url = _ref8.signup_redirect_url,
|
|
3909
4005
|
custom_scopes = _ref8.custom_scopes,
|
|
3910
4006
|
provider_params = _ref8.provider_params;
|
|
3911
|
-
return __awaiter$1(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4007
|
+
return __awaiter$1(_this15, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee122() {
|
|
3912
4008
|
var _yield$this$_dynamicC5, pkceRequiredForOAuth, baseURL, startUrl, key, keyPair;
|
|
3913
|
-
return _regeneratorRuntime().wrap(function
|
|
3914
|
-
while (1) switch (
|
|
4009
|
+
return _regeneratorRuntime().wrap(function _callee122$(_context122) {
|
|
4010
|
+
while (1) switch (_context122.prev = _context122.next) {
|
|
3915
4011
|
case 0:
|
|
3916
|
-
|
|
4012
|
+
_context122.next = 2;
|
|
3917
4013
|
return this._dynamicConfig;
|
|
3918
4014
|
case 2:
|
|
3919
|
-
_yield$this$_dynamicC5 =
|
|
4015
|
+
_yield$this$_dynamicC5 = _context122.sent;
|
|
3920
4016
|
pkceRequiredForOAuth = _yield$this$_dynamicC5.pkceRequiredForOAuth;
|
|
3921
|
-
|
|
4017
|
+
_context122.next = 6;
|
|
3922
4018
|
return this.getBaseApiUrl();
|
|
3923
4019
|
case 6:
|
|
3924
|
-
baseURL =
|
|
4020
|
+
baseURL = _context122.sent;
|
|
3925
4021
|
startUrl = new URL("".concat(baseURL, "/v1/b2b/public/oauth/").concat(providerType, "/start"));
|
|
3926
4022
|
startUrl.searchParams.set('public_token', this._config.publicToken);
|
|
3927
4023
|
if (organization_id && organization_id != '') {
|
|
@@ -3941,15 +4037,15 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3941
4037
|
}
|
|
3942
4038
|
}
|
|
3943
4039
|
if (!pkceRequiredForOAuth) {
|
|
3944
|
-
|
|
4040
|
+
_context122.next = 20;
|
|
3945
4041
|
break;
|
|
3946
4042
|
}
|
|
3947
|
-
|
|
4043
|
+
_context122.next = 16;
|
|
3948
4044
|
return this._pkceManager.startPKCETransaction();
|
|
3949
4045
|
case 16:
|
|
3950
|
-
keyPair =
|
|
4046
|
+
keyPair = _context122.sent;
|
|
3951
4047
|
startUrl.searchParams.set('pkce_code_challenge', keyPair.code_challenge);
|
|
3952
|
-
|
|
4048
|
+
_context122.next = 21;
|
|
3953
4049
|
break;
|
|
3954
4050
|
case 20:
|
|
3955
4051
|
this._pkceManager.clearPKPair();
|
|
@@ -3959,9 +4055,9 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3959
4055
|
window.location.href = startUrl.toString();
|
|
3960
4056
|
case 24:
|
|
3961
4057
|
case "end":
|
|
3962
|
-
return
|
|
4058
|
+
return _context122.stop();
|
|
3963
4059
|
}
|
|
3964
|
-
},
|
|
4060
|
+
}, _callee122, this);
|
|
3965
4061
|
}));
|
|
3966
4062
|
};
|
|
3967
4063
|
}
|
|
@@ -3973,20 +4069,20 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
3973
4069
|
var discovery_redirect_url = _ref9.discovery_redirect_url,
|
|
3974
4070
|
custom_scopes = _ref9.custom_scopes,
|
|
3975
4071
|
provider_params = _ref9.provider_params;
|
|
3976
|
-
return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4072
|
+
return __awaiter$1(_this16, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee123() {
|
|
3977
4073
|
var _yield$this$_dynamicC6, pkceRequiredForOAuth, baseURL, startUrl, key, keyPair;
|
|
3978
|
-
return _regeneratorRuntime().wrap(function
|
|
3979
|
-
while (1) switch (
|
|
4074
|
+
return _regeneratorRuntime().wrap(function _callee123$(_context123) {
|
|
4075
|
+
while (1) switch (_context123.prev = _context123.next) {
|
|
3980
4076
|
case 0:
|
|
3981
|
-
|
|
4077
|
+
_context123.next = 2;
|
|
3982
4078
|
return this._dynamicConfig;
|
|
3983
4079
|
case 2:
|
|
3984
|
-
_yield$this$_dynamicC6 =
|
|
4080
|
+
_yield$this$_dynamicC6 = _context123.sent;
|
|
3985
4081
|
pkceRequiredForOAuth = _yield$this$_dynamicC6.pkceRequiredForOAuth;
|
|
3986
|
-
|
|
4082
|
+
_context123.next = 6;
|
|
3987
4083
|
return this.getBaseApiUrl();
|
|
3988
4084
|
case 6:
|
|
3989
|
-
baseURL =
|
|
4085
|
+
baseURL = _context123.sent;
|
|
3990
4086
|
startUrl = new URL("".concat(baseURL, "/v1/b2b/public/oauth/").concat(providerType, "/discovery/start"));
|
|
3991
4087
|
startUrl.searchParams.set('public_token', this._config.publicToken);
|
|
3992
4088
|
if (custom_scopes) {
|
|
@@ -4000,15 +4096,15 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
4000
4096
|
}
|
|
4001
4097
|
}
|
|
4002
4098
|
if (!pkceRequiredForOAuth) {
|
|
4003
|
-
|
|
4099
|
+
_context123.next = 18;
|
|
4004
4100
|
break;
|
|
4005
4101
|
}
|
|
4006
|
-
|
|
4102
|
+
_context123.next = 14;
|
|
4007
4103
|
return this._pkceManager.startPKCETransaction();
|
|
4008
4104
|
case 14:
|
|
4009
|
-
keyPair =
|
|
4105
|
+
keyPair = _context123.sent;
|
|
4010
4106
|
startUrl.searchParams.set('pkce_code_challenge', keyPair.code_challenge);
|
|
4011
|
-
|
|
4107
|
+
_context123.next = 19;
|
|
4012
4108
|
break;
|
|
4013
4109
|
case 18:
|
|
4014
4110
|
this._pkceManager.clearPKPair();
|
|
@@ -4017,9 +4113,9 @@ var HeadlessB2BOAuthClient$1 = /*#__PURE__*/function () {
|
|
|
4017
4113
|
window.location.href = startUrl.toString();
|
|
4018
4114
|
case 21:
|
|
4019
4115
|
case "end":
|
|
4020
|
-
return
|
|
4116
|
+
return _context123.stop();
|
|
4021
4117
|
}
|
|
4022
|
-
},
|
|
4118
|
+
}, _callee123, this);
|
|
4023
4119
|
}));
|
|
4024
4120
|
};
|
|
4025
4121
|
}
|
|
@@ -4047,160 +4143,160 @@ var HeadlessB2BSessionClient = /*#__PURE__*/function () {
|
|
|
4047
4143
|
});
|
|
4048
4144
|
};
|
|
4049
4145
|
this.revoke = function (options) {
|
|
4050
|
-
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4146
|
+
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee124() {
|
|
4051
4147
|
var resp;
|
|
4052
|
-
return _regeneratorRuntime().wrap(function
|
|
4053
|
-
while (1) switch (
|
|
4148
|
+
return _regeneratorRuntime().wrap(function _callee124$(_context124) {
|
|
4149
|
+
while (1) switch (_context124.prev = _context124.next) {
|
|
4054
4150
|
case 0:
|
|
4055
|
-
|
|
4056
|
-
|
|
4151
|
+
_context124.prev = 0;
|
|
4152
|
+
_context124.next = 3;
|
|
4057
4153
|
return this._networkClient.fetchSDK({
|
|
4058
4154
|
url: "/b2b/sessions/revoke",
|
|
4059
4155
|
method: 'POST'
|
|
4060
4156
|
});
|
|
4061
4157
|
case 3:
|
|
4062
|
-
resp =
|
|
4158
|
+
resp = _context124.sent;
|
|
4063
4159
|
this._subscriptionService.destroyState();
|
|
4064
|
-
return
|
|
4160
|
+
return _context124.abrupt("return", resp);
|
|
4065
4161
|
case 8:
|
|
4066
|
-
|
|
4067
|
-
|
|
4162
|
+
_context124.prev = 8;
|
|
4163
|
+
_context124.t0 = _context124["catch"](0);
|
|
4068
4164
|
if (!!(options === null || options === void 0 ? void 0 : options.forceClear)) {
|
|
4069
4165
|
this._subscriptionService.destroyState();
|
|
4070
|
-
} else if (UNRECOVERABLE_ERROR_TYPES.includes(
|
|
4166
|
+
} else if (UNRECOVERABLE_ERROR_TYPES.includes(_context124.t0.error_type)) {
|
|
4071
4167
|
this._subscriptionService.destroyState();
|
|
4072
4168
|
}
|
|
4073
|
-
throw
|
|
4169
|
+
throw _context124.t0;
|
|
4074
4170
|
case 12:
|
|
4075
4171
|
case "end":
|
|
4076
|
-
return
|
|
4172
|
+
return _context124.stop();
|
|
4077
4173
|
}
|
|
4078
|
-
},
|
|
4174
|
+
}, _callee124, this, [[0, 8]]);
|
|
4079
4175
|
}));
|
|
4080
4176
|
};
|
|
4081
4177
|
this.revokeForMember = function (options) {
|
|
4082
|
-
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4083
|
-
return _regeneratorRuntime().wrap(function
|
|
4084
|
-
while (1) switch (
|
|
4178
|
+
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee125() {
|
|
4179
|
+
return _regeneratorRuntime().wrap(function _callee125$(_context125) {
|
|
4180
|
+
while (1) switch (_context125.prev = _context125.next) {
|
|
4085
4181
|
case 0:
|
|
4086
4182
|
validate('stytch.session.revokeForMember').isString('member_id', options.member_id);
|
|
4087
|
-
|
|
4183
|
+
_context125.next = 3;
|
|
4088
4184
|
return this._networkClient.fetchSDK({
|
|
4089
4185
|
url: "/b2b/sessions/revoke/".concat(options.member_id),
|
|
4090
4186
|
method: 'POST'
|
|
4091
4187
|
});
|
|
4092
4188
|
case 3:
|
|
4093
|
-
return
|
|
4189
|
+
return _context125.abrupt("return", _context125.sent);
|
|
4094
4190
|
case 4:
|
|
4095
4191
|
case "end":
|
|
4096
|
-
return
|
|
4192
|
+
return _context125.stop();
|
|
4097
4193
|
}
|
|
4098
|
-
},
|
|
4194
|
+
}, _callee125, this);
|
|
4099
4195
|
}));
|
|
4100
4196
|
};
|
|
4101
4197
|
this.authenticate = function (options) {
|
|
4102
|
-
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4198
|
+
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee126() {
|
|
4103
4199
|
var _this18 = this;
|
|
4104
4200
|
var initialSession, isSessionStale, requestBody, resp;
|
|
4105
|
-
return _regeneratorRuntime().wrap(function
|
|
4106
|
-
while (1) switch (
|
|
4201
|
+
return _regeneratorRuntime().wrap(function _callee126$(_context126) {
|
|
4202
|
+
while (1) switch (_context126.prev = _context126.next) {
|
|
4107
4203
|
case 0:
|
|
4108
4204
|
initialSession = this._subscriptionService.getSession();
|
|
4109
4205
|
isSessionStale = function isSessionStale() {
|
|
4110
4206
|
var _a;
|
|
4111
4207
|
return (initialSession === null || initialSession === void 0 ? void 0 : initialSession.member_session_id) !== ((_a = _this18._subscriptionService.getSession()) === null || _a === void 0 ? void 0 : _a.member_session_id);
|
|
4112
4208
|
};
|
|
4113
|
-
|
|
4209
|
+
_context126.prev = 2;
|
|
4114
4210
|
requestBody = {
|
|
4115
4211
|
session_duration_minutes: options === null || options === void 0 ? void 0 : options.session_duration_minutes
|
|
4116
4212
|
};
|
|
4117
|
-
|
|
4213
|
+
_context126.next = 6;
|
|
4118
4214
|
return this._networkClient.fetchSDK({
|
|
4119
4215
|
url: '/b2b/sessions/authenticate',
|
|
4120
4216
|
body: requestBody,
|
|
4121
4217
|
method: 'POST'
|
|
4122
4218
|
});
|
|
4123
4219
|
case 6:
|
|
4124
|
-
resp =
|
|
4220
|
+
resp = _context126.sent;
|
|
4125
4221
|
if (!isSessionStale()) {
|
|
4126
|
-
|
|
4222
|
+
_context126.next = 9;
|
|
4127
4223
|
break;
|
|
4128
4224
|
}
|
|
4129
|
-
return
|
|
4225
|
+
return _context126.abrupt("return", this.authenticate(options));
|
|
4130
4226
|
case 9:
|
|
4131
4227
|
this._subscriptionService.updateSession(resp);
|
|
4132
|
-
return
|
|
4228
|
+
return _context126.abrupt("return", resp);
|
|
4133
4229
|
case 13:
|
|
4134
|
-
|
|
4135
|
-
|
|
4230
|
+
_context126.prev = 13;
|
|
4231
|
+
_context126.t0 = _context126["catch"](2);
|
|
4136
4232
|
if (!isSessionStale()) {
|
|
4137
|
-
|
|
4233
|
+
_context126.next = 17;
|
|
4138
4234
|
break;
|
|
4139
4235
|
}
|
|
4140
|
-
return
|
|
4236
|
+
return _context126.abrupt("return", this.authenticate(options));
|
|
4141
4237
|
case 17:
|
|
4142
|
-
if (UNRECOVERABLE_ERROR_TYPES.includes(
|
|
4238
|
+
if (UNRECOVERABLE_ERROR_TYPES.includes(_context126.t0.error_type)) {
|
|
4143
4239
|
this._subscriptionService.destroySession();
|
|
4144
4240
|
}
|
|
4145
|
-
throw
|
|
4241
|
+
throw _context126.t0;
|
|
4146
4242
|
case 19:
|
|
4147
4243
|
case "end":
|
|
4148
|
-
return
|
|
4244
|
+
return _context126.stop();
|
|
4149
4245
|
}
|
|
4150
|
-
},
|
|
4246
|
+
}, _callee126, this, [[2, 13]]);
|
|
4151
4247
|
}));
|
|
4152
4248
|
};
|
|
4153
4249
|
this.exchange = function (data) {
|
|
4154
|
-
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4250
|
+
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee127() {
|
|
4155
4251
|
var resp;
|
|
4156
|
-
return _regeneratorRuntime().wrap(function
|
|
4157
|
-
while (1) switch (
|
|
4252
|
+
return _regeneratorRuntime().wrap(function _callee127$(_context127) {
|
|
4253
|
+
while (1) switch (_context127.prev = _context127.next) {
|
|
4158
4254
|
case 0:
|
|
4159
4255
|
validate('stytch.session.exchange').isString('organization_id', data.organization_id).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
|
|
4160
|
-
|
|
4161
|
-
|
|
4256
|
+
_context127.prev = 1;
|
|
4257
|
+
_context127.next = 4;
|
|
4162
4258
|
return this._networkClient.fetchSDK({
|
|
4163
4259
|
url: '/b2b/sessions/exchange',
|
|
4164
4260
|
body: data,
|
|
4165
4261
|
method: 'POST'
|
|
4166
4262
|
});
|
|
4167
4263
|
case 4:
|
|
4168
|
-
resp =
|
|
4264
|
+
resp = _context127.sent;
|
|
4169
4265
|
this._subscriptionService.updateSession(resp);
|
|
4170
|
-
return
|
|
4266
|
+
return _context127.abrupt("return", resp);
|
|
4171
4267
|
case 9:
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
throw
|
|
4268
|
+
_context127.prev = 9;
|
|
4269
|
+
_context127.t0 = _context127["catch"](1);
|
|
4270
|
+
throw _context127.t0;
|
|
4175
4271
|
case 12:
|
|
4176
4272
|
case "end":
|
|
4177
|
-
return
|
|
4273
|
+
return _context127.stop();
|
|
4178
4274
|
}
|
|
4179
|
-
},
|
|
4275
|
+
}, _callee127, this, [[1, 9]]);
|
|
4180
4276
|
}));
|
|
4181
4277
|
};
|
|
4182
4278
|
this.exchangeAccessToken = function (data) {
|
|
4183
|
-
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4279
|
+
return __awaiter$1(_this17, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee128() {
|
|
4184
4280
|
var resp;
|
|
4185
|
-
return _regeneratorRuntime().wrap(function
|
|
4186
|
-
while (1) switch (
|
|
4281
|
+
return _regeneratorRuntime().wrap(function _callee128$(_context128) {
|
|
4282
|
+
while (1) switch (_context128.prev = _context128.next) {
|
|
4187
4283
|
case 0:
|
|
4188
4284
|
validate('stytch.session.exchange').isString('organization_id', data.access_token).isNumber('session_duration_minutes', data.session_duration_minutes);
|
|
4189
|
-
|
|
4285
|
+
_context128.next = 3;
|
|
4190
4286
|
return this._networkClient.fetchSDK({
|
|
4191
4287
|
url: '/b2b/sessions/exchange_access_token',
|
|
4192
4288
|
body: data,
|
|
4193
4289
|
method: 'POST'
|
|
4194
4290
|
});
|
|
4195
4291
|
case 3:
|
|
4196
|
-
resp =
|
|
4292
|
+
resp = _context128.sent;
|
|
4197
4293
|
this._subscriptionService.updateSession(resp);
|
|
4198
|
-
return
|
|
4294
|
+
return _context128.abrupt("return", resp);
|
|
4199
4295
|
case 6:
|
|
4200
4296
|
case "end":
|
|
4201
|
-
return
|
|
4297
|
+
return _context128.stop();
|
|
4202
4298
|
}
|
|
4203
|
-
},
|
|
4299
|
+
}, _callee128, this);
|
|
4204
4300
|
}));
|
|
4205
4301
|
};
|
|
4206
4302
|
}
|
|
@@ -4225,120 +4321,120 @@ var HeadlessB2BDiscoveryClient = /*#__PURE__*/_createClass(function HeadlessB2BD
|
|
|
4225
4321
|
this._subscriptionService = _subscriptionService;
|
|
4226
4322
|
this.organizations = {
|
|
4227
4323
|
list: function list() {
|
|
4228
|
-
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4229
|
-
return _regeneratorRuntime().wrap(function
|
|
4230
|
-
while (1) switch (
|
|
4324
|
+
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee129() {
|
|
4325
|
+
return _regeneratorRuntime().wrap(function _callee129$(_context129) {
|
|
4326
|
+
while (1) switch (_context129.prev = _context129.next) {
|
|
4231
4327
|
case 0:
|
|
4232
|
-
|
|
4233
|
-
|
|
4328
|
+
_context129.t0 = this._networkClient;
|
|
4329
|
+
_context129.next = 3;
|
|
4234
4330
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4235
4331
|
case 3:
|
|
4236
|
-
|
|
4237
|
-
if (
|
|
4238
|
-
|
|
4332
|
+
_context129.t1 = _context129.sent;
|
|
4333
|
+
if (_context129.t1) {
|
|
4334
|
+
_context129.next = 6;
|
|
4239
4335
|
break;
|
|
4240
4336
|
}
|
|
4241
|
-
|
|
4337
|
+
_context129.t1 = undefined;
|
|
4242
4338
|
case 6:
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
intermediate_session_token:
|
|
4339
|
+
_context129.t2 = _context129.t1;
|
|
4340
|
+
_context129.t3 = {
|
|
4341
|
+
intermediate_session_token: _context129.t2
|
|
4246
4342
|
};
|
|
4247
|
-
|
|
4343
|
+
_context129.t4 = {
|
|
4248
4344
|
url: '/b2b/discovery/organizations',
|
|
4249
|
-
body:
|
|
4345
|
+
body: _context129.t3,
|
|
4250
4346
|
method: 'POST'
|
|
4251
4347
|
};
|
|
4252
|
-
return
|
|
4348
|
+
return _context129.abrupt("return", _context129.t0.fetchSDK.call(_context129.t0, _context129.t4));
|
|
4253
4349
|
case 10:
|
|
4254
4350
|
case "end":
|
|
4255
|
-
return
|
|
4351
|
+
return _context129.stop();
|
|
4256
4352
|
}
|
|
4257
|
-
},
|
|
4353
|
+
}, _callee129, this);
|
|
4258
4354
|
}));
|
|
4259
4355
|
},
|
|
4260
4356
|
create: function create(data) {
|
|
4261
|
-
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4357
|
+
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee130() {
|
|
4262
4358
|
var requestBody, resp;
|
|
4263
|
-
return _regeneratorRuntime().wrap(function
|
|
4264
|
-
while (1) switch (
|
|
4359
|
+
return _regeneratorRuntime().wrap(function _callee130$(_context130) {
|
|
4360
|
+
while (1) switch (_context130.prev = _context130.next) {
|
|
4265
4361
|
case 0:
|
|
4266
4362
|
validate('stytch.discovery.organizations.create').isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('organization_name', data.organization_name).isOptionalString('organization_slug', data.organization_slug).isOptionalString('organization_logo_url', data.organization_logo_url).isOptionalString('sso_jit_provisioning', data.sso_jit_provisioning).isOptionalStringArray('email_allowed_domains', data.email_allowed_domains).isOptionalString('email_invites', data.email_invites).isOptionalString('auth_methods', data.auth_methods).isOptionalStringArray('allowed_auth_methods', data.allowed_auth_methods).isOptionalString('mfa_policy', data.mfa_policy);
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4363
|
+
_context130.t0 = Object;
|
|
4364
|
+
_context130.t1 = Object.assign({}, data);
|
|
4365
|
+
_context130.next = 5;
|
|
4270
4366
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4271
4367
|
case 5:
|
|
4272
|
-
|
|
4273
|
-
if (
|
|
4274
|
-
|
|
4368
|
+
_context130.t2 = _context130.sent;
|
|
4369
|
+
if (_context130.t2) {
|
|
4370
|
+
_context130.next = 8;
|
|
4275
4371
|
break;
|
|
4276
4372
|
}
|
|
4277
|
-
|
|
4373
|
+
_context130.t2 = undefined;
|
|
4278
4374
|
case 8:
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
intermediate_session_token:
|
|
4375
|
+
_context130.t3 = _context130.t2;
|
|
4376
|
+
_context130.t4 = {
|
|
4377
|
+
intermediate_session_token: _context130.t3
|
|
4282
4378
|
};
|
|
4283
|
-
requestBody =
|
|
4284
|
-
|
|
4379
|
+
requestBody = _context130.t0.assign.call(_context130.t0, _context130.t1, _context130.t4);
|
|
4380
|
+
_context130.next = 13;
|
|
4285
4381
|
return this._networkClient.fetchSDK({
|
|
4286
4382
|
url: '/b2b/discovery/organizations/create',
|
|
4287
4383
|
body: requestBody,
|
|
4288
4384
|
method: 'POST'
|
|
4289
4385
|
});
|
|
4290
4386
|
case 13:
|
|
4291
|
-
resp =
|
|
4387
|
+
resp = _context130.sent;
|
|
4292
4388
|
this._subscriptionService.updateSession(resp);
|
|
4293
|
-
return
|
|
4389
|
+
return _context130.abrupt("return", resp);
|
|
4294
4390
|
case 16:
|
|
4295
4391
|
case "end":
|
|
4296
|
-
return
|
|
4392
|
+
return _context130.stop();
|
|
4297
4393
|
}
|
|
4298
|
-
},
|
|
4394
|
+
}, _callee130, this);
|
|
4299
4395
|
}));
|
|
4300
4396
|
}
|
|
4301
4397
|
};
|
|
4302
4398
|
this.intermediateSessions = {
|
|
4303
4399
|
exchange: function exchange(data) {
|
|
4304
|
-
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4400
|
+
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee131() {
|
|
4305
4401
|
var requestBody, resp;
|
|
4306
|
-
return _regeneratorRuntime().wrap(function
|
|
4307
|
-
while (1) switch (
|
|
4402
|
+
return _regeneratorRuntime().wrap(function _callee131$(_context131) {
|
|
4403
|
+
while (1) switch (_context131.prev = _context131.next) {
|
|
4308
4404
|
case 0:
|
|
4309
4405
|
validate('stytch.discovery.intermediateSessions.exchange').isString('organization_id', data.organization_id).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4406
|
+
_context131.t0 = Object;
|
|
4407
|
+
_context131.t1 = Object.assign({}, data);
|
|
4408
|
+
_context131.next = 5;
|
|
4313
4409
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4314
4410
|
case 5:
|
|
4315
|
-
|
|
4316
|
-
if (
|
|
4317
|
-
|
|
4411
|
+
_context131.t2 = _context131.sent;
|
|
4412
|
+
if (_context131.t2) {
|
|
4413
|
+
_context131.next = 8;
|
|
4318
4414
|
break;
|
|
4319
4415
|
}
|
|
4320
|
-
|
|
4416
|
+
_context131.t2 = undefined;
|
|
4321
4417
|
case 8:
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
intermediate_session_token:
|
|
4418
|
+
_context131.t3 = _context131.t2;
|
|
4419
|
+
_context131.t4 = {
|
|
4420
|
+
intermediate_session_token: _context131.t3
|
|
4325
4421
|
};
|
|
4326
|
-
requestBody =
|
|
4327
|
-
|
|
4422
|
+
requestBody = _context131.t0.assign.call(_context131.t0, _context131.t1, _context131.t4);
|
|
4423
|
+
_context131.next = 13;
|
|
4328
4424
|
return this._networkClient.fetchSDK({
|
|
4329
4425
|
url: '/b2b/discovery/intermediate_sessions/exchange',
|
|
4330
4426
|
body: requestBody,
|
|
4331
4427
|
method: 'POST'
|
|
4332
4428
|
});
|
|
4333
4429
|
case 13:
|
|
4334
|
-
resp =
|
|
4430
|
+
resp = _context131.sent;
|
|
4335
4431
|
this._subscriptionService.updateSession(resp);
|
|
4336
|
-
return
|
|
4432
|
+
return _context131.abrupt("return", resp);
|
|
4337
4433
|
case 16:
|
|
4338
4434
|
case "end":
|
|
4339
|
-
return
|
|
4435
|
+
return _context131.stop();
|
|
4340
4436
|
}
|
|
4341
|
-
},
|
|
4437
|
+
}, _callee131, this);
|
|
4342
4438
|
}));
|
|
4343
4439
|
}
|
|
4344
4440
|
};
|
|
@@ -4359,23 +4455,23 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4359
4455
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
4360
4456
|
this.discovery = {
|
|
4361
4457
|
resetByEmailStart: function resetByEmailStart(options) {
|
|
4362
|
-
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4458
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee132() {
|
|
4363
4459
|
var pkce_code_challenge, _yield$this$dfpProtec26, dfp_telemetry_id, captcha_token;
|
|
4364
|
-
return _regeneratorRuntime().wrap(function
|
|
4365
|
-
while (1) switch (
|
|
4460
|
+
return _regeneratorRuntime().wrap(function _callee132$(_context132) {
|
|
4461
|
+
while (1) switch (_context132.prev = _context132.next) {
|
|
4366
4462
|
case 0:
|
|
4367
4463
|
validate('stytch.passwords.discovery.resetByEmailStart').isString('email', options.email_address).isOptionalString('login_redirect_url', options.discovery_redirect_url).isOptionalString('reset_password_redirect_url', options.reset_password_redirect_url).isOptionalString('reset_password_template_id', options.reset_password_template_id).isOptionalNumber('reset_password_expiration_minutes', options.reset_password_expiration_minutes).isOptionalString('verify_email_template_id', options.verify_email_template_id);
|
|
4368
|
-
|
|
4464
|
+
_context132.next = 3;
|
|
4369
4465
|
return this.getCodeChallenge();
|
|
4370
4466
|
case 3:
|
|
4371
|
-
pkce_code_challenge =
|
|
4372
|
-
|
|
4467
|
+
pkce_code_challenge = _context132.sent;
|
|
4468
|
+
_context132.next = 6;
|
|
4373
4469
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4374
4470
|
case 6:
|
|
4375
|
-
_yield$this$dfpProtec26 =
|
|
4471
|
+
_yield$this$dfpProtec26 = _context132.sent;
|
|
4376
4472
|
dfp_telemetry_id = _yield$this$dfpProtec26.dfp_telemetry_id;
|
|
4377
4473
|
captcha_token = _yield$this$dfpProtec26.captcha_token;
|
|
4378
|
-
return
|
|
4474
|
+
return _context132.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
4379
4475
|
url: '/b2b/passwords/discovery/reset/start',
|
|
4380
4476
|
method: 'POST',
|
|
4381
4477
|
body: {
|
|
@@ -4393,94 +4489,94 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4393
4489
|
}));
|
|
4394
4490
|
case 10:
|
|
4395
4491
|
case "end":
|
|
4396
|
-
return
|
|
4492
|
+
return _context132.stop();
|
|
4397
4493
|
}
|
|
4398
|
-
},
|
|
4494
|
+
}, _callee132, this);
|
|
4399
4495
|
}));
|
|
4400
4496
|
},
|
|
4401
4497
|
resetByEmail: function resetByEmail(options) {
|
|
4402
|
-
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4498
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee133() {
|
|
4403
4499
|
var _yield$this$dfpProtec27, dfp_telemetry_id, captcha_token, pkPair, pkce_code_verifier, resp;
|
|
4404
|
-
return _regeneratorRuntime().wrap(function
|
|
4405
|
-
while (1) switch (
|
|
4500
|
+
return _regeneratorRuntime().wrap(function _callee133$(_context133) {
|
|
4501
|
+
while (1) switch (_context133.prev = _context133.next) {
|
|
4406
4502
|
case 0:
|
|
4407
4503
|
validate('stytch.passwords.discovery.resetByEmail').isString('password_reset_token', options.password_reset_token).isString('password', options.password);
|
|
4408
|
-
|
|
4504
|
+
_context133.next = 3;
|
|
4409
4505
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4410
4506
|
case 3:
|
|
4411
|
-
_yield$this$dfpProtec27 =
|
|
4507
|
+
_yield$this$dfpProtec27 = _context133.sent;
|
|
4412
4508
|
dfp_telemetry_id = _yield$this$dfpProtec27.dfp_telemetry_id;
|
|
4413
4509
|
captcha_token = _yield$this$dfpProtec27.captcha_token;
|
|
4414
|
-
|
|
4510
|
+
_context133.next = 8;
|
|
4415
4511
|
return this._pkceManager.getPKPair();
|
|
4416
4512
|
case 8:
|
|
4417
|
-
pkPair =
|
|
4513
|
+
pkPair = _context133.sent;
|
|
4418
4514
|
pkce_code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4515
|
+
_context133.t0 = this._networkClient;
|
|
4516
|
+
_context133.t1 = options.password_reset_token;
|
|
4517
|
+
_context133.t2 = options.password;
|
|
4518
|
+
_context133.t3 = captcha_token;
|
|
4519
|
+
_context133.t4 = dfp_telemetry_id;
|
|
4520
|
+
_context133.t5 = pkce_code_verifier;
|
|
4521
|
+
_context133.next = 18;
|
|
4426
4522
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4427
4523
|
case 18:
|
|
4428
|
-
|
|
4429
|
-
if (
|
|
4430
|
-
|
|
4524
|
+
_context133.t6 = _context133.sent;
|
|
4525
|
+
if (_context133.t6) {
|
|
4526
|
+
_context133.next = 21;
|
|
4431
4527
|
break;
|
|
4432
4528
|
}
|
|
4433
|
-
|
|
4529
|
+
_context133.t6 = undefined;
|
|
4434
4530
|
case 21:
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
password_reset_token:
|
|
4438
|
-
password:
|
|
4439
|
-
captcha_token:
|
|
4440
|
-
dfp_telemetry_id:
|
|
4441
|
-
pkce_code_verifier:
|
|
4442
|
-
intermediate_session_token:
|
|
4531
|
+
_context133.t7 = _context133.t6;
|
|
4532
|
+
_context133.t8 = {
|
|
4533
|
+
password_reset_token: _context133.t1,
|
|
4534
|
+
password: _context133.t2,
|
|
4535
|
+
captcha_token: _context133.t3,
|
|
4536
|
+
dfp_telemetry_id: _context133.t4,
|
|
4537
|
+
pkce_code_verifier: _context133.t5,
|
|
4538
|
+
intermediate_session_token: _context133.t7
|
|
4443
4539
|
};
|
|
4444
|
-
|
|
4445
|
-
|
|
4540
|
+
_context133.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4541
|
+
_context133.t10 = {
|
|
4446
4542
|
url: '/b2b/passwords/discovery/reset',
|
|
4447
4543
|
method: 'POST',
|
|
4448
|
-
body:
|
|
4449
|
-
retryCallback:
|
|
4544
|
+
body: _context133.t8,
|
|
4545
|
+
retryCallback: _context133.t9
|
|
4450
4546
|
};
|
|
4451
|
-
|
|
4452
|
-
return
|
|
4547
|
+
_context133.next = 27;
|
|
4548
|
+
return _context133.t0.retriableFetchSDK.call(_context133.t0, _context133.t10);
|
|
4453
4549
|
case 27:
|
|
4454
|
-
resp =
|
|
4550
|
+
resp = _context133.sent;
|
|
4455
4551
|
this._pkceManager.clearPKPair();
|
|
4456
4552
|
this._subscriptionService.updateSession(resp);
|
|
4457
|
-
return
|
|
4553
|
+
return _context133.abrupt("return", resp);
|
|
4458
4554
|
case 31:
|
|
4459
4555
|
case "end":
|
|
4460
|
-
return
|
|
4556
|
+
return _context133.stop();
|
|
4461
4557
|
}
|
|
4462
|
-
},
|
|
4558
|
+
}, _callee133, this);
|
|
4463
4559
|
}));
|
|
4464
4560
|
},
|
|
4465
4561
|
authenticate: function authenticate(options) {
|
|
4466
|
-
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4562
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee134() {
|
|
4467
4563
|
var pkPair, code_verifier, _yield$this$dfpProtec28, dfp_telemetry_id, captcha_token, resp;
|
|
4468
|
-
return _regeneratorRuntime().wrap(function
|
|
4469
|
-
while (1) switch (
|
|
4564
|
+
return _regeneratorRuntime().wrap(function _callee134$(_context134) {
|
|
4565
|
+
while (1) switch (_context134.prev = _context134.next) {
|
|
4470
4566
|
case 0:
|
|
4471
4567
|
validate('stytch.passwords.discovery.authenticate').isString('password', options.password).isString('email_address', options.email_address);
|
|
4472
|
-
|
|
4568
|
+
_context134.next = 3;
|
|
4473
4569
|
return this._pkceManager.getPKPair();
|
|
4474
4570
|
case 3:
|
|
4475
|
-
pkPair =
|
|
4571
|
+
pkPair = _context134.sent;
|
|
4476
4572
|
code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4477
|
-
|
|
4573
|
+
_context134.next = 7;
|
|
4478
4574
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4479
4575
|
case 7:
|
|
4480
|
-
_yield$this$dfpProtec28 =
|
|
4576
|
+
_yield$this$dfpProtec28 = _context134.sent;
|
|
4481
4577
|
dfp_telemetry_id = _yield$this$dfpProtec28.dfp_telemetry_id;
|
|
4482
4578
|
captcha_token = _yield$this$dfpProtec28.captcha_token;
|
|
4483
|
-
|
|
4579
|
+
_context134.next = 12;
|
|
4484
4580
|
return this._networkClient.retriableFetchSDK({
|
|
4485
4581
|
url: '/b2b/passwords/discovery/authenticate',
|
|
4486
4582
|
method: 'POST',
|
|
@@ -4494,14 +4590,14 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4494
4590
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4495
4591
|
});
|
|
4496
4592
|
case 12:
|
|
4497
|
-
resp =
|
|
4593
|
+
resp = _context134.sent;
|
|
4498
4594
|
this._subscriptionService.updateSession(resp);
|
|
4499
|
-
return
|
|
4595
|
+
return _context134.abrupt("return", resp);
|
|
4500
4596
|
case 15:
|
|
4501
4597
|
case "end":
|
|
4502
|
-
return
|
|
4598
|
+
return _context134.stop();
|
|
4503
4599
|
}
|
|
4504
|
-
},
|
|
4600
|
+
}, _callee134, this);
|
|
4505
4601
|
}));
|
|
4506
4602
|
}
|
|
4507
4603
|
};
|
|
@@ -4509,135 +4605,135 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4509
4605
|
return _createClass(HeadlessB2BPasswordsClient, [{
|
|
4510
4606
|
key: "getCodeChallenge",
|
|
4511
4607
|
value: function getCodeChallenge() {
|
|
4512
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4608
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee135() {
|
|
4513
4609
|
var _yield$this$_config6, pkceRequiredForPasswordResets, keyPair;
|
|
4514
|
-
return _regeneratorRuntime().wrap(function
|
|
4515
|
-
while (1) switch (
|
|
4610
|
+
return _regeneratorRuntime().wrap(function _callee135$(_context135) {
|
|
4611
|
+
while (1) switch (_context135.prev = _context135.next) {
|
|
4516
4612
|
case 0:
|
|
4517
|
-
|
|
4613
|
+
_context135.next = 2;
|
|
4518
4614
|
return this._config;
|
|
4519
4615
|
case 2:
|
|
4520
|
-
_yield$this$_config6 =
|
|
4616
|
+
_yield$this$_config6 = _context135.sent;
|
|
4521
4617
|
pkceRequiredForPasswordResets = _yield$this$_config6.pkceRequiredForPasswordResets;
|
|
4522
4618
|
if (pkceRequiredForPasswordResets) {
|
|
4523
|
-
|
|
4619
|
+
_context135.next = 6;
|
|
4524
4620
|
break;
|
|
4525
4621
|
}
|
|
4526
|
-
return
|
|
4622
|
+
return _context135.abrupt("return", undefined);
|
|
4527
4623
|
case 6:
|
|
4528
|
-
|
|
4624
|
+
_context135.next = 8;
|
|
4529
4625
|
return this._pkceManager.getPKPair();
|
|
4530
4626
|
case 8:
|
|
4531
|
-
keyPair =
|
|
4627
|
+
keyPair = _context135.sent;
|
|
4532
4628
|
if (!keyPair) {
|
|
4533
|
-
|
|
4629
|
+
_context135.next = 11;
|
|
4534
4630
|
break;
|
|
4535
4631
|
}
|
|
4536
|
-
return
|
|
4632
|
+
return _context135.abrupt("return", keyPair.code_challenge);
|
|
4537
4633
|
case 11:
|
|
4538
|
-
|
|
4634
|
+
_context135.next = 13;
|
|
4539
4635
|
return this._pkceManager.startPKCETransaction();
|
|
4540
4636
|
case 13:
|
|
4541
|
-
keyPair =
|
|
4542
|
-
return
|
|
4637
|
+
keyPair = _context135.sent;
|
|
4638
|
+
return _context135.abrupt("return", keyPair.code_challenge);
|
|
4543
4639
|
case 15:
|
|
4544
4640
|
case "end":
|
|
4545
|
-
return
|
|
4641
|
+
return _context135.stop();
|
|
4546
4642
|
}
|
|
4547
|
-
},
|
|
4643
|
+
}, _callee135, this);
|
|
4548
4644
|
}));
|
|
4549
4645
|
}
|
|
4550
4646
|
}, {
|
|
4551
4647
|
key: "authenticate",
|
|
4552
4648
|
value: function authenticate(options) {
|
|
4553
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4649
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee136() {
|
|
4554
4650
|
var pkPair, code_verifier, _yield$this$dfpProtec29, dfp_telemetry_id, captcha_token, resp;
|
|
4555
|
-
return _regeneratorRuntime().wrap(function
|
|
4556
|
-
while (1) switch (
|
|
4651
|
+
return _regeneratorRuntime().wrap(function _callee136$(_context136) {
|
|
4652
|
+
while (1) switch (_context136.prev = _context136.next) {
|
|
4557
4653
|
case 0:
|
|
4558
4654
|
validate('stytch.passwords.authenticate').isString('org_id', options.organization_id).isString('password', options.password).isString('email_address', options.email_address).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
|
|
4559
|
-
|
|
4655
|
+
_context136.next = 3;
|
|
4560
4656
|
return this._pkceManager.getPKPair();
|
|
4561
4657
|
case 3:
|
|
4562
|
-
pkPair =
|
|
4658
|
+
pkPair = _context136.sent;
|
|
4563
4659
|
code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4564
|
-
|
|
4660
|
+
_context136.next = 7;
|
|
4565
4661
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4566
4662
|
case 7:
|
|
4567
|
-
_yield$this$dfpProtec29 =
|
|
4663
|
+
_yield$this$dfpProtec29 = _context136.sent;
|
|
4568
4664
|
dfp_telemetry_id = _yield$this$dfpProtec29.dfp_telemetry_id;
|
|
4569
4665
|
captcha_token = _yield$this$dfpProtec29.captcha_token;
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4666
|
+
_context136.t0 = this._networkClient;
|
|
4667
|
+
_context136.t1 = options.organization_id;
|
|
4668
|
+
_context136.t2 = options.email_address;
|
|
4669
|
+
_context136.t3 = options.password;
|
|
4670
|
+
_context136.t4 = options.session_duration_minutes;
|
|
4671
|
+
_context136.t5 = options.locale;
|
|
4672
|
+
_context136.t6 = captcha_token;
|
|
4673
|
+
_context136.t7 = dfp_telemetry_id;
|
|
4674
|
+
_context136.t8 = code_verifier;
|
|
4675
|
+
_context136.next = 21;
|
|
4580
4676
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4581
4677
|
case 21:
|
|
4582
|
-
|
|
4583
|
-
if (
|
|
4584
|
-
|
|
4678
|
+
_context136.t9 = _context136.sent;
|
|
4679
|
+
if (_context136.t9) {
|
|
4680
|
+
_context136.next = 24;
|
|
4585
4681
|
break;
|
|
4586
4682
|
}
|
|
4587
|
-
|
|
4683
|
+
_context136.t9 = undefined;
|
|
4588
4684
|
case 24:
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
organization_id:
|
|
4592
|
-
email_address:
|
|
4593
|
-
password:
|
|
4594
|
-
session_duration_minutes:
|
|
4595
|
-
locale:
|
|
4596
|
-
captcha_token:
|
|
4597
|
-
dfp_telemetry_id:
|
|
4598
|
-
code_verifier:
|
|
4599
|
-
intermediate_session_token:
|
|
4685
|
+
_context136.t10 = _context136.t9;
|
|
4686
|
+
_context136.t11 = {
|
|
4687
|
+
organization_id: _context136.t1,
|
|
4688
|
+
email_address: _context136.t2,
|
|
4689
|
+
password: _context136.t3,
|
|
4690
|
+
session_duration_minutes: _context136.t4,
|
|
4691
|
+
locale: _context136.t5,
|
|
4692
|
+
captcha_token: _context136.t6,
|
|
4693
|
+
dfp_telemetry_id: _context136.t7,
|
|
4694
|
+
code_verifier: _context136.t8,
|
|
4695
|
+
intermediate_session_token: _context136.t10
|
|
4600
4696
|
};
|
|
4601
|
-
|
|
4602
|
-
|
|
4697
|
+
_context136.t12 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4698
|
+
_context136.t13 = {
|
|
4603
4699
|
url: '/b2b/passwords/authenticate',
|
|
4604
4700
|
method: 'POST',
|
|
4605
|
-
body:
|
|
4606
|
-
retryCallback:
|
|
4701
|
+
body: _context136.t11,
|
|
4702
|
+
retryCallback: _context136.t12
|
|
4607
4703
|
};
|
|
4608
|
-
|
|
4609
|
-
return
|
|
4704
|
+
_context136.next = 30;
|
|
4705
|
+
return _context136.t0.retriableFetchSDK.call(_context136.t0, _context136.t13);
|
|
4610
4706
|
case 30:
|
|
4611
|
-
resp =
|
|
4707
|
+
resp = _context136.sent;
|
|
4612
4708
|
this._subscriptionService.updateSession(resp);
|
|
4613
|
-
return
|
|
4709
|
+
return _context136.abrupt("return", resp);
|
|
4614
4710
|
case 33:
|
|
4615
4711
|
case "end":
|
|
4616
|
-
return
|
|
4712
|
+
return _context136.stop();
|
|
4617
4713
|
}
|
|
4618
|
-
},
|
|
4714
|
+
}, _callee136, this);
|
|
4619
4715
|
}));
|
|
4620
4716
|
}
|
|
4621
4717
|
}, {
|
|
4622
4718
|
key: "resetByEmailStart",
|
|
4623
4719
|
value: function resetByEmailStart(options) {
|
|
4624
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4720
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee137() {
|
|
4625
4721
|
var code_challenge, _yield$this$dfpProtec30, dfp_telemetry_id, captcha_token;
|
|
4626
|
-
return _regeneratorRuntime().wrap(function
|
|
4627
|
-
while (1) switch (
|
|
4722
|
+
return _regeneratorRuntime().wrap(function _callee137$(_context137) {
|
|
4723
|
+
while (1) switch (_context137.prev = _context137.next) {
|
|
4628
4724
|
case 0:
|
|
4629
4725
|
validate('stytch.passwords.resetByEmailStart').isString('email', options.email_address).isOptionalString('login_redirect_url', options.login_redirect_url).isOptionalString('reset_password_redirect_url', options.reset_password_redirect_url).isOptionalString('reset_password_template_id', options.reset_password_template_id).isOptionalNumber('reset_password_expiration_minutes', options.reset_password_expiration_minutes).isOptionalString('verify_email_template_id', options.verify_email_template_id);
|
|
4630
|
-
|
|
4726
|
+
_context137.next = 3;
|
|
4631
4727
|
return this.getCodeChallenge();
|
|
4632
4728
|
case 3:
|
|
4633
|
-
code_challenge =
|
|
4634
|
-
|
|
4729
|
+
code_challenge = _context137.sent;
|
|
4730
|
+
_context137.next = 6;
|
|
4635
4731
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4636
4732
|
case 6:
|
|
4637
|
-
_yield$this$dfpProtec30 =
|
|
4733
|
+
_yield$this$dfpProtec30 = _context137.sent;
|
|
4638
4734
|
dfp_telemetry_id = _yield$this$dfpProtec30.dfp_telemetry_id;
|
|
4639
4735
|
captcha_token = _yield$this$dfpProtec30.captcha_token;
|
|
4640
|
-
return
|
|
4736
|
+
return _context137.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
4641
4737
|
url: '/b2b/passwords/email/reset/start',
|
|
4642
4738
|
method: 'POST',
|
|
4643
4739
|
body: {
|
|
@@ -4656,97 +4752,97 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4656
4752
|
}));
|
|
4657
4753
|
case 10:
|
|
4658
4754
|
case "end":
|
|
4659
|
-
return
|
|
4755
|
+
return _context137.stop();
|
|
4660
4756
|
}
|
|
4661
|
-
},
|
|
4757
|
+
}, _callee137, this);
|
|
4662
4758
|
}));
|
|
4663
4759
|
}
|
|
4664
4760
|
}, {
|
|
4665
4761
|
key: "resetByEmail",
|
|
4666
4762
|
value: function resetByEmail(options) {
|
|
4667
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4763
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee138() {
|
|
4668
4764
|
var _yield$this$dfpProtec31, dfp_telemetry_id, captcha_token, pkPair, code_verifier, resp;
|
|
4669
|
-
return _regeneratorRuntime().wrap(function
|
|
4670
|
-
while (1) switch (
|
|
4765
|
+
return _regeneratorRuntime().wrap(function _callee138$(_context138) {
|
|
4766
|
+
while (1) switch (_context138.prev = _context138.next) {
|
|
4671
4767
|
case 0:
|
|
4672
4768
|
validate('stytch.passwords.resetByEmail').isString('password_reset_token', options.password_reset_token).isString('password', options.password).isNumber('session_duration_minutes', options.session_duration_minutes).isOptionalString('locale', options.locale);
|
|
4673
|
-
|
|
4769
|
+
_context138.next = 3;
|
|
4674
4770
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4675
4771
|
case 3:
|
|
4676
|
-
_yield$this$dfpProtec31 =
|
|
4772
|
+
_yield$this$dfpProtec31 = _context138.sent;
|
|
4677
4773
|
dfp_telemetry_id = _yield$this$dfpProtec31.dfp_telemetry_id;
|
|
4678
4774
|
captcha_token = _yield$this$dfpProtec31.captcha_token;
|
|
4679
|
-
|
|
4775
|
+
_context138.next = 8;
|
|
4680
4776
|
return this._pkceManager.getPKPair();
|
|
4681
4777
|
case 8:
|
|
4682
|
-
pkPair =
|
|
4778
|
+
pkPair = _context138.sent;
|
|
4683
4779
|
code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4780
|
+
_context138.t0 = this._networkClient;
|
|
4781
|
+
_context138.t1 = options.password_reset_token;
|
|
4782
|
+
_context138.t2 = options.password;
|
|
4783
|
+
_context138.t3 = options.session_duration_minutes;
|
|
4784
|
+
_context138.t4 = options.locale;
|
|
4785
|
+
_context138.t5 = captcha_token;
|
|
4786
|
+
_context138.t6 = dfp_telemetry_id;
|
|
4787
|
+
_context138.t7 = code_verifier;
|
|
4788
|
+
_context138.next = 20;
|
|
4693
4789
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4694
4790
|
case 20:
|
|
4695
|
-
|
|
4696
|
-
if (
|
|
4697
|
-
|
|
4791
|
+
_context138.t8 = _context138.sent;
|
|
4792
|
+
if (_context138.t8) {
|
|
4793
|
+
_context138.next = 23;
|
|
4698
4794
|
break;
|
|
4699
4795
|
}
|
|
4700
|
-
|
|
4796
|
+
_context138.t8 = undefined;
|
|
4701
4797
|
case 23:
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
password_reset_token:
|
|
4705
|
-
password:
|
|
4706
|
-
session_duration_minutes:
|
|
4707
|
-
locale:
|
|
4708
|
-
captcha_token:
|
|
4709
|
-
dfp_telemetry_id:
|
|
4710
|
-
code_verifier:
|
|
4711
|
-
intermediate_session_token:
|
|
4798
|
+
_context138.t9 = _context138.t8;
|
|
4799
|
+
_context138.t10 = {
|
|
4800
|
+
password_reset_token: _context138.t1,
|
|
4801
|
+
password: _context138.t2,
|
|
4802
|
+
session_duration_minutes: _context138.t3,
|
|
4803
|
+
locale: _context138.t4,
|
|
4804
|
+
captcha_token: _context138.t5,
|
|
4805
|
+
dfp_telemetry_id: _context138.t6,
|
|
4806
|
+
code_verifier: _context138.t7,
|
|
4807
|
+
intermediate_session_token: _context138.t9
|
|
4712
4808
|
};
|
|
4713
|
-
|
|
4714
|
-
|
|
4809
|
+
_context138.t11 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4810
|
+
_context138.t12 = {
|
|
4715
4811
|
url: '/b2b/passwords/email/reset',
|
|
4716
4812
|
method: 'POST',
|
|
4717
|
-
body:
|
|
4718
|
-
retryCallback:
|
|
4813
|
+
body: _context138.t10,
|
|
4814
|
+
retryCallback: _context138.t11
|
|
4719
4815
|
};
|
|
4720
|
-
|
|
4721
|
-
return
|
|
4816
|
+
_context138.next = 29;
|
|
4817
|
+
return _context138.t0.retriableFetchSDK.call(_context138.t0, _context138.t12);
|
|
4722
4818
|
case 29:
|
|
4723
|
-
resp =
|
|
4819
|
+
resp = _context138.sent;
|
|
4724
4820
|
this._pkceManager.clearPKPair();
|
|
4725
4821
|
this._subscriptionService.updateSession(resp);
|
|
4726
|
-
return
|
|
4822
|
+
return _context138.abrupt("return", resp);
|
|
4727
4823
|
case 33:
|
|
4728
4824
|
case "end":
|
|
4729
|
-
return
|
|
4825
|
+
return _context138.stop();
|
|
4730
4826
|
}
|
|
4731
|
-
},
|
|
4827
|
+
}, _callee138, this);
|
|
4732
4828
|
}));
|
|
4733
4829
|
}
|
|
4734
4830
|
}, {
|
|
4735
4831
|
key: "resetByExistingPassword",
|
|
4736
4832
|
value: function resetByExistingPassword(options) {
|
|
4737
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4833
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee139() {
|
|
4738
4834
|
var _yield$this$dfpProtec32, dfp_telemetry_id, captcha_token, resp;
|
|
4739
|
-
return _regeneratorRuntime().wrap(function
|
|
4740
|
-
while (1) switch (
|
|
4835
|
+
return _regeneratorRuntime().wrap(function _callee139$(_context139) {
|
|
4836
|
+
while (1) switch (_context139.prev = _context139.next) {
|
|
4741
4837
|
case 0:
|
|
4742
4838
|
validate('stytch.passwords.resetByExistingPassword').isString('email', options.email_address).isString('existing_password', options.existing_password).isString('new_password', options.new_password).isOptionalString('locale', options.locale).isNumber('session_duration_minutes', options.session_duration_minutes);
|
|
4743
|
-
|
|
4839
|
+
_context139.next = 3;
|
|
4744
4840
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4745
4841
|
case 3:
|
|
4746
|
-
_yield$this$dfpProtec32 =
|
|
4842
|
+
_yield$this$dfpProtec32 = _context139.sent;
|
|
4747
4843
|
dfp_telemetry_id = _yield$this$dfpProtec32.dfp_telemetry_id;
|
|
4748
4844
|
captcha_token = _yield$this$dfpProtec32.captcha_token;
|
|
4749
|
-
|
|
4845
|
+
_context139.next = 8;
|
|
4750
4846
|
return this._networkClient.retriableFetchSDK({
|
|
4751
4847
|
url: '/b2b/passwords/existing_password/reset',
|
|
4752
4848
|
method: 'POST',
|
|
@@ -4763,32 +4859,32 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4763
4859
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4764
4860
|
});
|
|
4765
4861
|
case 8:
|
|
4766
|
-
resp =
|
|
4862
|
+
resp = _context139.sent;
|
|
4767
4863
|
this._subscriptionService.updateSession(resp);
|
|
4768
|
-
return
|
|
4864
|
+
return _context139.abrupt("return", resp);
|
|
4769
4865
|
case 11:
|
|
4770
4866
|
case "end":
|
|
4771
|
-
return
|
|
4867
|
+
return _context139.stop();
|
|
4772
4868
|
}
|
|
4773
|
-
},
|
|
4869
|
+
}, _callee139, this);
|
|
4774
4870
|
}));
|
|
4775
4871
|
}
|
|
4776
4872
|
}, {
|
|
4777
4873
|
key: "resetBySession",
|
|
4778
4874
|
value: function resetBySession(options) {
|
|
4779
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4875
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee140() {
|
|
4780
4876
|
var _yield$this$dfpProtec33, dfp_telemetry_id, captcha_token, resp;
|
|
4781
|
-
return _regeneratorRuntime().wrap(function
|
|
4782
|
-
while (1) switch (
|
|
4877
|
+
return _regeneratorRuntime().wrap(function _callee140$(_context140) {
|
|
4878
|
+
while (1) switch (_context140.prev = _context140.next) {
|
|
4783
4879
|
case 0:
|
|
4784
4880
|
validate('stytch.passwords.resetBySession').isString('password', options.password);
|
|
4785
|
-
|
|
4881
|
+
_context140.next = 3;
|
|
4786
4882
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4787
4883
|
case 3:
|
|
4788
|
-
_yield$this$dfpProtec33 =
|
|
4884
|
+
_yield$this$dfpProtec33 = _context140.sent;
|
|
4789
4885
|
dfp_telemetry_id = _yield$this$dfpProtec33.dfp_telemetry_id;
|
|
4790
4886
|
captcha_token = _yield$this$dfpProtec33.captcha_token;
|
|
4791
|
-
|
|
4887
|
+
_context140.next = 8;
|
|
4792
4888
|
return this._networkClient.retriableFetchSDK({
|
|
4793
4889
|
url: '/b2b/passwords/session/reset',
|
|
4794
4890
|
method: 'POST',
|
|
@@ -4800,25 +4896,25 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4800
4896
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4801
4897
|
});
|
|
4802
4898
|
case 8:
|
|
4803
|
-
resp =
|
|
4899
|
+
resp = _context140.sent;
|
|
4804
4900
|
this._subscriptionService.updateSession(resp);
|
|
4805
|
-
return
|
|
4901
|
+
return _context140.abrupt("return", resp);
|
|
4806
4902
|
case 11:
|
|
4807
4903
|
case "end":
|
|
4808
|
-
return
|
|
4904
|
+
return _context140.stop();
|
|
4809
4905
|
}
|
|
4810
|
-
},
|
|
4906
|
+
}, _callee140, this);
|
|
4811
4907
|
}));
|
|
4812
4908
|
}
|
|
4813
4909
|
}, {
|
|
4814
4910
|
key: "strengthCheck",
|
|
4815
4911
|
value: function strengthCheck(options) {
|
|
4816
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4817
|
-
return _regeneratorRuntime().wrap(function
|
|
4818
|
-
while (1) switch (
|
|
4912
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee141() {
|
|
4913
|
+
return _regeneratorRuntime().wrap(function _callee141$(_context141) {
|
|
4914
|
+
while (1) switch (_context141.prev = _context141.next) {
|
|
4819
4915
|
case 0:
|
|
4820
4916
|
validate('stytch.passwords.strengthCheck').isOptionalString('email', options.email_address).isString('password', options.password);
|
|
4821
|
-
return
|
|
4917
|
+
return _context141.abrupt("return", this._networkClient.fetchSDK({
|
|
4822
4918
|
url: '/b2b/passwords/strength_check',
|
|
4823
4919
|
method: 'POST',
|
|
4824
4920
|
body: {
|
|
@@ -4828,9 +4924,9 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4828
4924
|
}));
|
|
4829
4925
|
case 2:
|
|
4830
4926
|
case "end":
|
|
4831
|
-
return
|
|
4927
|
+
return _context141.stop();
|
|
4832
4928
|
}
|
|
4833
|
-
},
|
|
4929
|
+
}, _callee141, this);
|
|
4834
4930
|
}));
|
|
4835
4931
|
}
|
|
4836
4932
|
}]);
|
|
@@ -4843,90 +4939,90 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4843
4939
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
4844
4940
|
this.sms = {
|
|
4845
4941
|
send: function send(data) {
|
|
4846
|
-
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4942
|
+
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee142() {
|
|
4847
4943
|
var _yield$this$dfpProtec34, dfp_telemetry_id, captcha_token;
|
|
4848
|
-
return _regeneratorRuntime().wrap(function
|
|
4849
|
-
while (1) switch (
|
|
4944
|
+
return _regeneratorRuntime().wrap(function _callee142$(_context142) {
|
|
4945
|
+
while (1) switch (_context142.prev = _context142.next) {
|
|
4850
4946
|
case 0:
|
|
4851
4947
|
validate('stytch.otps.sms.send').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isOptionalString('mfa_phone_number', data.mfa_phone_number).isOptionalString('locale', data.locale);
|
|
4852
|
-
|
|
4948
|
+
_context142.next = 3;
|
|
4853
4949
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4854
4950
|
case 3:
|
|
4855
|
-
_yield$this$dfpProtec34 =
|
|
4951
|
+
_yield$this$dfpProtec34 = _context142.sent;
|
|
4856
4952
|
dfp_telemetry_id = _yield$this$dfpProtec34.dfp_telemetry_id;
|
|
4857
4953
|
captcha_token = _yield$this$dfpProtec34.captcha_token;
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4954
|
+
_context142.t0 = this._networkClient;
|
|
4955
|
+
_context142.t1 = Object;
|
|
4956
|
+
_context142.t2 = Object.assign({}, data);
|
|
4957
|
+
_context142.t3 = dfp_telemetry_id;
|
|
4958
|
+
_context142.t4 = captcha_token;
|
|
4959
|
+
_context142.next = 13;
|
|
4864
4960
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4865
4961
|
case 13:
|
|
4866
|
-
|
|
4867
|
-
if (
|
|
4868
|
-
|
|
4962
|
+
_context142.t5 = _context142.sent;
|
|
4963
|
+
if (_context142.t5) {
|
|
4964
|
+
_context142.next = 16;
|
|
4869
4965
|
break;
|
|
4870
4966
|
}
|
|
4871
|
-
|
|
4967
|
+
_context142.t5 = undefined;
|
|
4872
4968
|
case 16:
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
dfp_telemetry_id:
|
|
4876
|
-
captcha_token:
|
|
4877
|
-
intermediate_session_token:
|
|
4969
|
+
_context142.t6 = _context142.t5;
|
|
4970
|
+
_context142.t7 = {
|
|
4971
|
+
dfp_telemetry_id: _context142.t3,
|
|
4972
|
+
captcha_token: _context142.t4,
|
|
4973
|
+
intermediate_session_token: _context142.t6
|
|
4878
4974
|
};
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4975
|
+
_context142.t8 = _context142.t1.assign.call(_context142.t1, _context142.t2, _context142.t7);
|
|
4976
|
+
_context142.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4977
|
+
_context142.t10 = {
|
|
4882
4978
|
url: '/b2b/otps/sms/send',
|
|
4883
|
-
body:
|
|
4979
|
+
body: _context142.t8,
|
|
4884
4980
|
method: 'POST',
|
|
4885
|
-
retryCallback:
|
|
4981
|
+
retryCallback: _context142.t9
|
|
4886
4982
|
};
|
|
4887
|
-
return
|
|
4983
|
+
return _context142.abrupt("return", _context142.t0.retriableFetchSDK.call(_context142.t0, _context142.t10));
|
|
4888
4984
|
case 22:
|
|
4889
4985
|
case "end":
|
|
4890
|
-
return
|
|
4986
|
+
return _context142.stop();
|
|
4891
4987
|
}
|
|
4892
|
-
},
|
|
4988
|
+
}, _callee142, this);
|
|
4893
4989
|
}));
|
|
4894
4990
|
},
|
|
4895
4991
|
authenticate: function authenticate(data) {
|
|
4896
|
-
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4992
|
+
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee143() {
|
|
4897
4993
|
var _yield$this$dfpProtec35, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
4898
|
-
return _regeneratorRuntime().wrap(function
|
|
4899
|
-
while (1) switch (
|
|
4994
|
+
return _regeneratorRuntime().wrap(function _callee143$(_context143) {
|
|
4995
|
+
while (1) switch (_context143.prev = _context143.next) {
|
|
4900
4996
|
case 0:
|
|
4901
4997
|
validate('stytch.otps.sms.authenticate').isNumber('session_duration_minutes', data.session_duration_minutes).isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('code', data.code).isOptionalString('set_mfa_enrollment', data.set_mfa_enrollment);
|
|
4902
|
-
|
|
4998
|
+
_context143.next = 3;
|
|
4903
4999
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4904
5000
|
case 3:
|
|
4905
|
-
_yield$this$dfpProtec35 =
|
|
5001
|
+
_yield$this$dfpProtec35 = _context143.sent;
|
|
4906
5002
|
dfp_telemetry_id = _yield$this$dfpProtec35.dfp_telemetry_id;
|
|
4907
5003
|
captcha_token = _yield$this$dfpProtec35.captcha_token;
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
5004
|
+
_context143.t0 = Object;
|
|
5005
|
+
_context143.t1 = Object.assign({}, data);
|
|
5006
|
+
_context143.t2 = dfp_telemetry_id;
|
|
5007
|
+
_context143.t3 = captcha_token;
|
|
5008
|
+
_context143.next = 12;
|
|
4913
5009
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4914
5010
|
case 12:
|
|
4915
|
-
|
|
4916
|
-
if (
|
|
4917
|
-
|
|
5011
|
+
_context143.t4 = _context143.sent;
|
|
5012
|
+
if (_context143.t4) {
|
|
5013
|
+
_context143.next = 15;
|
|
4918
5014
|
break;
|
|
4919
5015
|
}
|
|
4920
|
-
|
|
5016
|
+
_context143.t4 = undefined;
|
|
4921
5017
|
case 15:
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
dfp_telemetry_id:
|
|
4925
|
-
captcha_token:
|
|
4926
|
-
intermediate_session_token:
|
|
5018
|
+
_context143.t5 = _context143.t4;
|
|
5019
|
+
_context143.t6 = {
|
|
5020
|
+
dfp_telemetry_id: _context143.t2,
|
|
5021
|
+
captcha_token: _context143.t3,
|
|
5022
|
+
intermediate_session_token: _context143.t5
|
|
4927
5023
|
};
|
|
4928
|
-
requestBody =
|
|
4929
|
-
|
|
5024
|
+
requestBody = _context143.t0.assign.call(_context143.t0, _context143.t1, _context143.t6);
|
|
5025
|
+
_context143.next = 20;
|
|
4930
5026
|
return this._networkClient.retriableFetchSDK({
|
|
4931
5027
|
url: '/b2b/otps/sms/authenticate',
|
|
4932
5028
|
body: requestBody,
|
|
@@ -4934,32 +5030,32 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4934
5030
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4935
5031
|
});
|
|
4936
5032
|
case 20:
|
|
4937
|
-
resp =
|
|
5033
|
+
resp = _context143.sent;
|
|
4938
5034
|
this._subscriptionService.updateSession(resp);
|
|
4939
|
-
return
|
|
5035
|
+
return _context143.abrupt("return", resp);
|
|
4940
5036
|
case 23:
|
|
4941
5037
|
case "end":
|
|
4942
|
-
return
|
|
5038
|
+
return _context143.stop();
|
|
4943
5039
|
}
|
|
4944
|
-
},
|
|
5040
|
+
}, _callee143, this);
|
|
4945
5041
|
}));
|
|
4946
5042
|
}
|
|
4947
5043
|
};
|
|
4948
5044
|
this.email = {
|
|
4949
5045
|
loginOrSignup: function loginOrSignup(data) {
|
|
4950
|
-
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5046
|
+
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee144() {
|
|
4951
5047
|
var _yield$this$dfpProtec36, dfp_telemetry_id, captcha_token;
|
|
4952
|
-
return _regeneratorRuntime().wrap(function
|
|
4953
|
-
while (1) switch (
|
|
5048
|
+
return _regeneratorRuntime().wrap(function _callee144$(_context144) {
|
|
5049
|
+
while (1) switch (_context144.prev = _context144.next) {
|
|
4954
5050
|
case 0:
|
|
4955
5051
|
validate('stytch.otps.email.loginOrSignup').isString('organization_id', data.organization_id).isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('signup_template_id', data.signup_template_id).isOptionalString('locale', data.locale).isOptionalNumber('login_expiration_minutes', data.login_expiration_minutes).isOptionalNumber('signup_expiration_minutes', data.signup_expiration_minutes);
|
|
4956
|
-
|
|
5052
|
+
_context144.next = 3;
|
|
4957
5053
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4958
5054
|
case 3:
|
|
4959
|
-
_yield$this$dfpProtec36 =
|
|
5055
|
+
_yield$this$dfpProtec36 = _context144.sent;
|
|
4960
5056
|
dfp_telemetry_id = _yield$this$dfpProtec36.dfp_telemetry_id;
|
|
4961
5057
|
captcha_token = _yield$this$dfpProtec36.captcha_token;
|
|
4962
|
-
return
|
|
5058
|
+
return _context144.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
4963
5059
|
url: '/b2b/otps/email/login_or_signup',
|
|
4964
5060
|
body: Object.assign(Object.assign({}, data), {
|
|
4965
5061
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
@@ -4970,85 +5066,85 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4970
5066
|
}));
|
|
4971
5067
|
case 7:
|
|
4972
5068
|
case "end":
|
|
4973
|
-
return
|
|
5069
|
+
return _context144.stop();
|
|
4974
5070
|
}
|
|
4975
|
-
},
|
|
5071
|
+
}, _callee144, this);
|
|
4976
5072
|
}));
|
|
4977
5073
|
},
|
|
4978
5074
|
authenticate: function authenticate(data) {
|
|
4979
|
-
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5075
|
+
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee145() {
|
|
4980
5076
|
var _yield$this$dfpProtec37, dfp_telemetry_id, captcha_token, resp;
|
|
4981
|
-
return _regeneratorRuntime().wrap(function
|
|
4982
|
-
while (1) switch (
|
|
5077
|
+
return _regeneratorRuntime().wrap(function _callee145$(_context145) {
|
|
5078
|
+
while (1) switch (_context145.prev = _context145.next) {
|
|
4983
5079
|
case 0:
|
|
4984
5080
|
validate('stytch.otps.email.authenticate').isString('code', data.code).isString('email_address', data.email_address).isString('organization_id', data.organization_id).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('locale', data.locale);
|
|
4985
|
-
|
|
5081
|
+
_context145.next = 3;
|
|
4986
5082
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4987
5083
|
case 3:
|
|
4988
|
-
_yield$this$dfpProtec37 =
|
|
5084
|
+
_yield$this$dfpProtec37 = _context145.sent;
|
|
4989
5085
|
dfp_telemetry_id = _yield$this$dfpProtec37.dfp_telemetry_id;
|
|
4990
5086
|
captcha_token = _yield$this$dfpProtec37.captcha_token;
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
5087
|
+
_context145.t0 = this._networkClient;
|
|
5088
|
+
_context145.t1 = Object;
|
|
5089
|
+
_context145.t2 = Object.assign({}, data);
|
|
5090
|
+
_context145.next = 11;
|
|
4995
5091
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4996
5092
|
case 11:
|
|
4997
|
-
|
|
4998
|
-
if (
|
|
4999
|
-
|
|
5093
|
+
_context145.t3 = _context145.sent;
|
|
5094
|
+
if (_context145.t3) {
|
|
5095
|
+
_context145.next = 14;
|
|
5000
5096
|
break;
|
|
5001
5097
|
}
|
|
5002
|
-
|
|
5098
|
+
_context145.t3 = undefined;
|
|
5003
5099
|
case 14:
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
intermediate_session_token:
|
|
5009
|
-
dfp_telemetry_id:
|
|
5010
|
-
captcha_token:
|
|
5100
|
+
_context145.t4 = _context145.t3;
|
|
5101
|
+
_context145.t5 = dfp_telemetry_id;
|
|
5102
|
+
_context145.t6 = captcha_token;
|
|
5103
|
+
_context145.t7 = {
|
|
5104
|
+
intermediate_session_token: _context145.t4,
|
|
5105
|
+
dfp_telemetry_id: _context145.t5,
|
|
5106
|
+
captcha_token: _context145.t6
|
|
5011
5107
|
};
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5108
|
+
_context145.t8 = _context145.t1.assign.call(_context145.t1, _context145.t2, _context145.t7);
|
|
5109
|
+
_context145.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
5110
|
+
_context145.t10 = {
|
|
5015
5111
|
url: '/b2b/otps/email/authenticate',
|
|
5016
|
-
body:
|
|
5112
|
+
body: _context145.t8,
|
|
5017
5113
|
method: 'POST',
|
|
5018
|
-
retryCallback:
|
|
5114
|
+
retryCallback: _context145.t9
|
|
5019
5115
|
};
|
|
5020
|
-
|
|
5021
|
-
return
|
|
5116
|
+
_context145.next = 23;
|
|
5117
|
+
return _context145.t0.retriableFetchSDK.call(_context145.t0, _context145.t10);
|
|
5022
5118
|
case 23:
|
|
5023
|
-
resp =
|
|
5119
|
+
resp = _context145.sent;
|
|
5024
5120
|
this._subscriptionService.updateSession(resp);
|
|
5025
|
-
return
|
|
5121
|
+
return _context145.abrupt("return", resp);
|
|
5026
5122
|
case 26:
|
|
5027
5123
|
case "end":
|
|
5028
|
-
return
|
|
5124
|
+
return _context145.stop();
|
|
5029
5125
|
}
|
|
5030
|
-
},
|
|
5126
|
+
}, _callee145, this);
|
|
5031
5127
|
}));
|
|
5032
5128
|
},
|
|
5033
5129
|
discovery: {
|
|
5034
5130
|
send: function send(data) {
|
|
5035
|
-
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5131
|
+
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee146() {
|
|
5036
5132
|
var _yield$this$dfpProtec38, dfp_telemetry_id, captcha_token, requestBody;
|
|
5037
|
-
return _regeneratorRuntime().wrap(function
|
|
5038
|
-
while (1) switch (
|
|
5133
|
+
return _regeneratorRuntime().wrap(function _callee146$(_context146) {
|
|
5134
|
+
while (1) switch (_context146.prev = _context146.next) {
|
|
5039
5135
|
case 0:
|
|
5040
5136
|
validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale).isOptionalNumber('discovery_expiration_minutes', data.discovery_expiration_minutes);
|
|
5041
|
-
|
|
5137
|
+
_context146.next = 3;
|
|
5042
5138
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5043
5139
|
case 3:
|
|
5044
|
-
_yield$this$dfpProtec38 =
|
|
5140
|
+
_yield$this$dfpProtec38 = _context146.sent;
|
|
5045
5141
|
dfp_telemetry_id = _yield$this$dfpProtec38.dfp_telemetry_id;
|
|
5046
5142
|
captcha_token = _yield$this$dfpProtec38.captcha_token;
|
|
5047
5143
|
requestBody = Object.assign(Object.assign({}, data), {
|
|
5048
5144
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
5049
5145
|
captcha_token: captcha_token
|
|
5050
5146
|
});
|
|
5051
|
-
return
|
|
5147
|
+
return _context146.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
5052
5148
|
url: '/b2b/otps/email/discovery/send',
|
|
5053
5149
|
body: requestBody,
|
|
5054
5150
|
method: 'POST',
|
|
@@ -5056,29 +5152,29 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
5056
5152
|
}));
|
|
5057
5153
|
case 8:
|
|
5058
5154
|
case "end":
|
|
5059
|
-
return
|
|
5155
|
+
return _context146.stop();
|
|
5060
5156
|
}
|
|
5061
|
-
},
|
|
5157
|
+
}, _callee146, this);
|
|
5062
5158
|
}));
|
|
5063
5159
|
},
|
|
5064
5160
|
authenticate: function authenticate(data) {
|
|
5065
|
-
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5161
|
+
return __awaiter$1(_this21, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee147() {
|
|
5066
5162
|
var _yield$this$dfpProtec39, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
5067
|
-
return _regeneratorRuntime().wrap(function
|
|
5068
|
-
while (1) switch (
|
|
5163
|
+
return _regeneratorRuntime().wrap(function _callee147$(_context147) {
|
|
5164
|
+
while (1) switch (_context147.prev = _context147.next) {
|
|
5069
5165
|
case 0:
|
|
5070
5166
|
validate('stytch.otps.email.discovery.authenticate').isString('code', data.code).isString('email_address', data.email_address);
|
|
5071
|
-
|
|
5167
|
+
_context147.next = 3;
|
|
5072
5168
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5073
5169
|
case 3:
|
|
5074
|
-
_yield$this$dfpProtec39 =
|
|
5170
|
+
_yield$this$dfpProtec39 = _context147.sent;
|
|
5075
5171
|
dfp_telemetry_id = _yield$this$dfpProtec39.dfp_telemetry_id;
|
|
5076
5172
|
captcha_token = _yield$this$dfpProtec39.captcha_token;
|
|
5077
5173
|
requestBody = Object.assign({
|
|
5078
5174
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
5079
5175
|
captcha_token: captcha_token
|
|
5080
5176
|
}, data);
|
|
5081
|
-
|
|
5177
|
+
_context147.next = 9;
|
|
5082
5178
|
return this._networkClient.retriableFetchSDK({
|
|
5083
5179
|
url: '/b2b/otps/email/discovery/authenticate',
|
|
5084
5180
|
body: requestBody,
|
|
@@ -5086,14 +5182,14 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
5086
5182
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
5087
5183
|
});
|
|
5088
5184
|
case 9:
|
|
5089
|
-
resp =
|
|
5185
|
+
resp = _context147.sent;
|
|
5090
5186
|
this._subscriptionService.updateSession(resp);
|
|
5091
|
-
return
|
|
5187
|
+
return _context147.abrupt("return", resp);
|
|
5092
5188
|
case 12:
|
|
5093
5189
|
case "end":
|
|
5094
|
-
return
|
|
5190
|
+
return _context147.stop();
|
|
5095
5191
|
}
|
|
5096
|
-
},
|
|
5192
|
+
}, _callee147, this);
|
|
5097
5193
|
}));
|
|
5098
5194
|
}
|
|
5099
5195
|
}
|
|
@@ -5110,99 +5206,99 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
|
|
|
5110
5206
|
key: "create",
|
|
5111
5207
|
value: function create(data) {
|
|
5112
5208
|
var _a;
|
|
5113
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5209
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee148() {
|
|
5114
5210
|
var _yield$this$dfpProtec40, dfp_telemetry_id, captcha_token, response;
|
|
5115
|
-
return _regeneratorRuntime().wrap(function
|
|
5116
|
-
while (1) switch (
|
|
5211
|
+
return _regeneratorRuntime().wrap(function _callee148$(_context148) {
|
|
5212
|
+
while (1) switch (_context148.prev = _context148.next) {
|
|
5117
5213
|
case 0:
|
|
5118
5214
|
validate('stytch.totp.create').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isOptionalNumber('expiration_minutes', data.expiration_minutes);
|
|
5119
|
-
|
|
5215
|
+
_context148.next = 3;
|
|
5120
5216
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5121
5217
|
case 3:
|
|
5122
|
-
_yield$this$dfpProtec40 =
|
|
5218
|
+
_yield$this$dfpProtec40 = _context148.sent;
|
|
5123
5219
|
dfp_telemetry_id = _yield$this$dfpProtec40.dfp_telemetry_id;
|
|
5124
5220
|
captcha_token = _yield$this$dfpProtec40.captcha_token;
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5221
|
+
_context148.t0 = this._networkClient;
|
|
5222
|
+
_context148.t1 = Object;
|
|
5223
|
+
_context148.t2 = Object.assign({}, data);
|
|
5224
|
+
_context148.t3 = dfp_telemetry_id;
|
|
5225
|
+
_context148.t4 = captcha_token;
|
|
5226
|
+
_context148.next = 13;
|
|
5131
5227
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
5132
5228
|
case 13:
|
|
5133
|
-
|
|
5134
|
-
if (
|
|
5135
|
-
|
|
5229
|
+
_context148.t5 = _context148.sent;
|
|
5230
|
+
if (_context148.t5) {
|
|
5231
|
+
_context148.next = 16;
|
|
5136
5232
|
break;
|
|
5137
5233
|
}
|
|
5138
|
-
|
|
5234
|
+
_context148.t5 = undefined;
|
|
5139
5235
|
case 16:
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
dfp_telemetry_id:
|
|
5143
|
-
captcha_token:
|
|
5144
|
-
intermediate_session_token:
|
|
5236
|
+
_context148.t6 = _context148.t5;
|
|
5237
|
+
_context148.t7 = {
|
|
5238
|
+
dfp_telemetry_id: _context148.t3,
|
|
5239
|
+
captcha_token: _context148.t4,
|
|
5240
|
+
intermediate_session_token: _context148.t6
|
|
5145
5241
|
};
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5242
|
+
_context148.t8 = _context148.t1.assign.call(_context148.t1, _context148.t2, _context148.t7);
|
|
5243
|
+
_context148.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
5244
|
+
_context148.t10 = {
|
|
5149
5245
|
url: '/b2b/totp',
|
|
5150
|
-
body:
|
|
5246
|
+
body: _context148.t8,
|
|
5151
5247
|
method: 'POST',
|
|
5152
|
-
retryCallback:
|
|
5248
|
+
retryCallback: _context148.t9
|
|
5153
5249
|
};
|
|
5154
|
-
|
|
5155
|
-
return
|
|
5250
|
+
_context148.next = 23;
|
|
5251
|
+
return _context148.t0.retriableFetchSDK.call(_context148.t0, _context148.t10);
|
|
5156
5252
|
case 23:
|
|
5157
|
-
response =
|
|
5253
|
+
response = _context148.sent;
|
|
5158
5254
|
if (response.member_id === ((_a = this._subscriptionService.getMember()) === null || _a === void 0 ? void 0 : _a.member_id)) {
|
|
5159
5255
|
this._subscriptionService.updateMember(response.member);
|
|
5160
5256
|
}
|
|
5161
|
-
return
|
|
5257
|
+
return _context148.abrupt("return", response);
|
|
5162
5258
|
case 26:
|
|
5163
5259
|
case "end":
|
|
5164
|
-
return
|
|
5260
|
+
return _context148.stop();
|
|
5165
5261
|
}
|
|
5166
|
-
},
|
|
5262
|
+
}, _callee148, this);
|
|
5167
5263
|
}));
|
|
5168
5264
|
}
|
|
5169
5265
|
}, {
|
|
5170
5266
|
key: "authenticate",
|
|
5171
5267
|
value: function authenticate(data) {
|
|
5172
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5268
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee149() {
|
|
5173
5269
|
var _yield$this$dfpProtec41, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
5174
|
-
return _regeneratorRuntime().wrap(function
|
|
5175
|
-
while (1) switch (
|
|
5270
|
+
return _regeneratorRuntime().wrap(function _callee149$(_context149) {
|
|
5271
|
+
while (1) switch (_context149.prev = _context149.next) {
|
|
5176
5272
|
case 0:
|
|
5177
5273
|
validate('stytch.totp.authenticate').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('code', data.code).isNumber('session_duration_minutes', data.session_duration_minutes).isOptionalString('set_mfa_enrollment', data.set_mfa_enrollment).isOptionalBoolean('set_default_mfa', data.set_default_mfa);
|
|
5178
|
-
|
|
5274
|
+
_context149.next = 3;
|
|
5179
5275
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5180
5276
|
case 3:
|
|
5181
|
-
_yield$this$dfpProtec41 =
|
|
5277
|
+
_yield$this$dfpProtec41 = _context149.sent;
|
|
5182
5278
|
dfp_telemetry_id = _yield$this$dfpProtec41.dfp_telemetry_id;
|
|
5183
5279
|
captcha_token = _yield$this$dfpProtec41.captcha_token;
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5280
|
+
_context149.t0 = Object;
|
|
5281
|
+
_context149.t1 = Object.assign({}, data);
|
|
5282
|
+
_context149.t2 = dfp_telemetry_id;
|
|
5283
|
+
_context149.t3 = captcha_token;
|
|
5284
|
+
_context149.next = 12;
|
|
5189
5285
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
5190
5286
|
case 12:
|
|
5191
|
-
|
|
5192
|
-
if (
|
|
5193
|
-
|
|
5287
|
+
_context149.t4 = _context149.sent;
|
|
5288
|
+
if (_context149.t4) {
|
|
5289
|
+
_context149.next = 15;
|
|
5194
5290
|
break;
|
|
5195
5291
|
}
|
|
5196
|
-
|
|
5292
|
+
_context149.t4 = undefined;
|
|
5197
5293
|
case 15:
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
dfp_telemetry_id:
|
|
5201
|
-
captcha_token:
|
|
5202
|
-
intermediate_session_token:
|
|
5294
|
+
_context149.t5 = _context149.t4;
|
|
5295
|
+
_context149.t6 = {
|
|
5296
|
+
dfp_telemetry_id: _context149.t2,
|
|
5297
|
+
captcha_token: _context149.t3,
|
|
5298
|
+
intermediate_session_token: _context149.t5
|
|
5203
5299
|
};
|
|
5204
|
-
requestBody =
|
|
5205
|
-
|
|
5300
|
+
requestBody = _context149.t0.assign.call(_context149.t0, _context149.t1, _context149.t6);
|
|
5301
|
+
_context149.next = 20;
|
|
5206
5302
|
return this._networkClient.retriableFetchSDK({
|
|
5207
5303
|
url: '/b2b/totp/authenticate',
|
|
5208
5304
|
body: requestBody,
|
|
@@ -5210,14 +5306,14 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
|
|
|
5210
5306
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
5211
5307
|
});
|
|
5212
5308
|
case 20:
|
|
5213
|
-
resp =
|
|
5309
|
+
resp = _context149.sent;
|
|
5214
5310
|
this._subscriptionService.updateSession(resp);
|
|
5215
|
-
return
|
|
5311
|
+
return _context149.abrupt("return", resp);
|
|
5216
5312
|
case 23:
|
|
5217
5313
|
case "end":
|
|
5218
|
-
return
|
|
5314
|
+
return _context149.stop();
|
|
5219
5315
|
}
|
|
5220
|
-
},
|
|
5316
|
+
}, _callee149, this);
|
|
5221
5317
|
}));
|
|
5222
5318
|
}
|
|
5223
5319
|
}]);
|
|
@@ -5232,40 +5328,40 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5232
5328
|
return _createClass(HeadlessB2BRecoveryCodesClient, [{
|
|
5233
5329
|
key: "recover",
|
|
5234
5330
|
value: function recover(data) {
|
|
5235
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5331
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee150() {
|
|
5236
5332
|
var _yield$this$dfpProtec42, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
5237
|
-
return _regeneratorRuntime().wrap(function
|
|
5238
|
-
while (1) switch (
|
|
5333
|
+
return _regeneratorRuntime().wrap(function _callee150$(_context150) {
|
|
5334
|
+
while (1) switch (_context150.prev = _context150.next) {
|
|
5239
5335
|
case 0:
|
|
5240
5336
|
validate('stytch.recoveryCodes.recover').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('recovery_code', data.recovery_code).isNumber('session_duration_minutes', data.session_duration_minutes);
|
|
5241
|
-
|
|
5337
|
+
_context150.next = 3;
|
|
5242
5338
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5243
5339
|
case 3:
|
|
5244
|
-
_yield$this$dfpProtec42 =
|
|
5340
|
+
_yield$this$dfpProtec42 = _context150.sent;
|
|
5245
5341
|
dfp_telemetry_id = _yield$this$dfpProtec42.dfp_telemetry_id;
|
|
5246
5342
|
captcha_token = _yield$this$dfpProtec42.captcha_token;
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5343
|
+
_context150.t0 = Object;
|
|
5344
|
+
_context150.t1 = Object.assign({}, data);
|
|
5345
|
+
_context150.t2 = dfp_telemetry_id;
|
|
5346
|
+
_context150.t3 = captcha_token;
|
|
5347
|
+
_context150.next = 12;
|
|
5252
5348
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
5253
5349
|
case 12:
|
|
5254
|
-
|
|
5255
|
-
if (
|
|
5256
|
-
|
|
5350
|
+
_context150.t4 = _context150.sent;
|
|
5351
|
+
if (_context150.t4) {
|
|
5352
|
+
_context150.next = 15;
|
|
5257
5353
|
break;
|
|
5258
5354
|
}
|
|
5259
|
-
|
|
5355
|
+
_context150.t4 = undefined;
|
|
5260
5356
|
case 15:
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
dfp_telemetry_id:
|
|
5264
|
-
captcha_token:
|
|
5265
|
-
intermediate_session_token:
|
|
5357
|
+
_context150.t5 = _context150.t4;
|
|
5358
|
+
_context150.t6 = {
|
|
5359
|
+
dfp_telemetry_id: _context150.t2,
|
|
5360
|
+
captcha_token: _context150.t3,
|
|
5361
|
+
intermediate_session_token: _context150.t5
|
|
5266
5362
|
};
|
|
5267
|
-
requestBody =
|
|
5268
|
-
|
|
5363
|
+
requestBody = _context150.t0.assign.call(_context150.t0, _context150.t1, _context150.t6);
|
|
5364
|
+
_context150.next = 20;
|
|
5269
5365
|
return this._networkClient.retriableFetchSDK({
|
|
5270
5366
|
url: '/b2b/recovery_codes/recover',
|
|
5271
5367
|
body: requestBody,
|
|
@@ -5273,31 +5369,31 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5273
5369
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
5274
5370
|
});
|
|
5275
5371
|
case 20:
|
|
5276
|
-
resp =
|
|
5372
|
+
resp = _context150.sent;
|
|
5277
5373
|
this._subscriptionService.updateSession(resp);
|
|
5278
|
-
return
|
|
5374
|
+
return _context150.abrupt("return", resp);
|
|
5279
5375
|
case 23:
|
|
5280
5376
|
case "end":
|
|
5281
|
-
return
|
|
5377
|
+
return _context150.stop();
|
|
5282
5378
|
}
|
|
5283
|
-
},
|
|
5379
|
+
}, _callee150, this);
|
|
5284
5380
|
}));
|
|
5285
5381
|
}
|
|
5286
5382
|
}, {
|
|
5287
5383
|
key: "rotate",
|
|
5288
5384
|
value: function rotate() {
|
|
5289
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5385
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee151() {
|
|
5290
5386
|
var _yield$this$dfpProtec43, dfp_telemetry_id, captcha_token;
|
|
5291
|
-
return _regeneratorRuntime().wrap(function
|
|
5292
|
-
while (1) switch (
|
|
5387
|
+
return _regeneratorRuntime().wrap(function _callee151$(_context151) {
|
|
5388
|
+
while (1) switch (_context151.prev = _context151.next) {
|
|
5293
5389
|
case 0:
|
|
5294
|
-
|
|
5390
|
+
_context151.next = 2;
|
|
5295
5391
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5296
5392
|
case 2:
|
|
5297
|
-
_yield$this$dfpProtec43 =
|
|
5393
|
+
_yield$this$dfpProtec43 = _context151.sent;
|
|
5298
5394
|
dfp_telemetry_id = _yield$this$dfpProtec43.dfp_telemetry_id;
|
|
5299
5395
|
captcha_token = _yield$this$dfpProtec43.captcha_token;
|
|
5300
|
-
return
|
|
5396
|
+
return _context151.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
5301
5397
|
url: '/b2b/recovery_codes/rotate',
|
|
5302
5398
|
body: {
|
|
5303
5399
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
@@ -5308,27 +5404,27 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5308
5404
|
}));
|
|
5309
5405
|
case 6:
|
|
5310
5406
|
case "end":
|
|
5311
|
-
return
|
|
5407
|
+
return _context151.stop();
|
|
5312
5408
|
}
|
|
5313
|
-
},
|
|
5409
|
+
}, _callee151, this);
|
|
5314
5410
|
}));
|
|
5315
5411
|
}
|
|
5316
5412
|
}, {
|
|
5317
5413
|
key: "get",
|
|
5318
5414
|
value: function get() {
|
|
5319
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5320
|
-
return _regeneratorRuntime().wrap(function
|
|
5321
|
-
while (1) switch (
|
|
5415
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee152() {
|
|
5416
|
+
return _regeneratorRuntime().wrap(function _callee152$(_context152) {
|
|
5417
|
+
while (1) switch (_context152.prev = _context152.next) {
|
|
5322
5418
|
case 0:
|
|
5323
|
-
return
|
|
5419
|
+
return _context152.abrupt("return", this._networkClient.fetchSDK({
|
|
5324
5420
|
url: '/b2b/recovery_codes',
|
|
5325
5421
|
method: 'GET'
|
|
5326
5422
|
}));
|
|
5327
5423
|
case 1:
|
|
5328
5424
|
case "end":
|
|
5329
|
-
return
|
|
5425
|
+
return _context152.stop();
|
|
5330
5426
|
}
|
|
5331
|
-
},
|
|
5427
|
+
}, _callee152, this);
|
|
5332
5428
|
}));
|
|
5333
5429
|
}
|
|
5334
5430
|
}]);
|
|
@@ -5432,19 +5528,19 @@ var HeadlessB2BImpersonationClient = /*#__PURE__*/_createClass(function Headless
|
|
|
5432
5528
|
this._subscriptionService = _subscriptionService;
|
|
5433
5529
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
5434
5530
|
this.authenticate = function (data) {
|
|
5435
|
-
return __awaiter$1(_this27, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5531
|
+
return __awaiter$1(_this27, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee153() {
|
|
5436
5532
|
var _yield$this$dfpProtec44, dfp_telemetry_id, captcha_token, resp;
|
|
5437
|
-
return _regeneratorRuntime().wrap(function
|
|
5438
|
-
while (1) switch (
|
|
5533
|
+
return _regeneratorRuntime().wrap(function _callee153$(_context153) {
|
|
5534
|
+
while (1) switch (_context153.prev = _context153.next) {
|
|
5439
5535
|
case 0:
|
|
5440
5536
|
validate('stytch.impersonation.authenticate').isString('impersonation_token', data.impersonation_token);
|
|
5441
|
-
|
|
5537
|
+
_context153.next = 3;
|
|
5442
5538
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5443
5539
|
case 3:
|
|
5444
|
-
_yield$this$dfpProtec44 =
|
|
5540
|
+
_yield$this$dfpProtec44 = _context153.sent;
|
|
5445
5541
|
dfp_telemetry_id = _yield$this$dfpProtec44.dfp_telemetry_id;
|
|
5446
5542
|
captcha_token = _yield$this$dfpProtec44.captcha_token;
|
|
5447
|
-
|
|
5543
|
+
_context153.next = 8;
|
|
5448
5544
|
return this._networkClient.retriableFetchSDK({
|
|
5449
5545
|
url: '/b2b/impersonation/authenticate',
|
|
5450
5546
|
body: Object.assign(Object.assign({}, data), {
|
|
@@ -5455,14 +5551,14 @@ var HeadlessB2BImpersonationClient = /*#__PURE__*/_createClass(function Headless
|
|
|
5455
5551
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
5456
5552
|
});
|
|
5457
5553
|
case 8:
|
|
5458
|
-
resp =
|
|
5554
|
+
resp = _context153.sent;
|
|
5459
5555
|
this._subscriptionService.updateSession(resp);
|
|
5460
|
-
return
|
|
5556
|
+
return _context153.abrupt("return", resp);
|
|
5461
5557
|
case 11:
|
|
5462
5558
|
case "end":
|
|
5463
|
-
return
|
|
5559
|
+
return _context153.stop();
|
|
5464
5560
|
}
|
|
5465
|
-
},
|
|
5561
|
+
}, _callee153, this);
|
|
5466
5562
|
}));
|
|
5467
5563
|
};
|
|
5468
5564
|
});
|
|
@@ -5503,18 +5599,18 @@ var IframeHostClient = /*#__PURE__*/function () {
|
|
|
5503
5599
|
}, {
|
|
5504
5600
|
key: "call",
|
|
5505
5601
|
value: function call(method, args) {
|
|
5506
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5602
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee154() {
|
|
5507
5603
|
var _this28 = this;
|
|
5508
5604
|
var frame, channel;
|
|
5509
|
-
return _regeneratorRuntime().wrap(function
|
|
5510
|
-
while (1) switch (
|
|
5605
|
+
return _regeneratorRuntime().wrap(function _callee154$(_context154) {
|
|
5606
|
+
while (1) switch (_context154.prev = _context154.next) {
|
|
5511
5607
|
case 0:
|
|
5512
|
-
|
|
5608
|
+
_context154.next = 2;
|
|
5513
5609
|
return this.frame;
|
|
5514
5610
|
case 2:
|
|
5515
|
-
frame =
|
|
5611
|
+
frame = _context154.sent;
|
|
5516
5612
|
channel = new MessageChannel();
|
|
5517
|
-
return
|
|
5613
|
+
return _context154.abrupt("return", new Promise(function (resolve, reject) {
|
|
5518
5614
|
var _a;
|
|
5519
5615
|
channel.port1.onmessage = function (event) {
|
|
5520
5616
|
var resp = event.data;
|
|
@@ -5533,9 +5629,9 @@ var IframeHostClient = /*#__PURE__*/function () {
|
|
|
5533
5629
|
}));
|
|
5534
5630
|
case 5:
|
|
5535
5631
|
case "end":
|
|
5536
|
-
return
|
|
5632
|
+
return _context154.stop();
|
|
5537
5633
|
}
|
|
5538
|
-
},
|
|
5634
|
+
}, _callee154, this);
|
|
5539
5635
|
}));
|
|
5540
5636
|
}
|
|
5541
5637
|
}]);
|
|
@@ -5625,40 +5721,40 @@ var SessionManager = /*#__PURE__*/function () {
|
|
|
5625
5721
|
}
|
|
5626
5722
|
};
|
|
5627
5723
|
this._reauthenticateWithBackoff = function () {
|
|
5628
|
-
return __awaiter$1(_this30, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5724
|
+
return __awaiter$1(_this30, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee155() {
|
|
5629
5725
|
var count;
|
|
5630
|
-
return _regeneratorRuntime().wrap(function
|
|
5631
|
-
while (1) switch (
|
|
5726
|
+
return _regeneratorRuntime().wrap(function _callee155$(_context155) {
|
|
5727
|
+
while (1) switch (_context155.prev = _context155.next) {
|
|
5632
5728
|
case 0:
|
|
5633
5729
|
count = 0;
|
|
5634
5730
|
case 1:
|
|
5635
|
-
|
|
5636
|
-
|
|
5731
|
+
_context155.prev = 2;
|
|
5732
|
+
_context155.next = 5;
|
|
5637
5733
|
return this._headlessSessionClient.authenticate();
|
|
5638
5734
|
case 5:
|
|
5639
|
-
return
|
|
5735
|
+
return _context155.abrupt("return", _context155.sent);
|
|
5640
5736
|
case 8:
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
if (!SessionManager.isUnrecoverableError(
|
|
5644
|
-
|
|
5737
|
+
_context155.prev = 8;
|
|
5738
|
+
_context155.t0 = _context155["catch"](2);
|
|
5739
|
+
if (!SessionManager.isUnrecoverableError(_context155.t0)) {
|
|
5740
|
+
_context155.next = 12;
|
|
5645
5741
|
break;
|
|
5646
5742
|
}
|
|
5647
|
-
return
|
|
5743
|
+
return _context155.abrupt("return", Promise.reject(_context155.t0));
|
|
5648
5744
|
case 12:
|
|
5649
5745
|
count++;
|
|
5650
|
-
|
|
5746
|
+
_context155.next = 15;
|
|
5651
5747
|
return new Promise(function (done) {
|
|
5652
5748
|
return setTimeout(done, SessionManager.timeoutForAttempt(count));
|
|
5653
5749
|
});
|
|
5654
5750
|
case 15:
|
|
5655
|
-
|
|
5751
|
+
_context155.next = 1;
|
|
5656
5752
|
break;
|
|
5657
5753
|
case 17:
|
|
5658
5754
|
case "end":
|
|
5659
|
-
return
|
|
5755
|
+
return _context155.stop();
|
|
5660
5756
|
}
|
|
5661
|
-
},
|
|
5757
|
+
}, _callee155, this, [[2, 8]]);
|
|
5662
5758
|
}));
|
|
5663
5759
|
};
|
|
5664
5760
|
this.timeout = null;
|