@stytch/vanilla-js 5.6.2 → 5.8.0
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 +25 -0
- package/README.md +1 -1
- package/dist/adminPortal/index.esm.js +2 -2
- package/dist/adminPortal/index.js +2 -2
- package/dist/adminPortal/settings/AdminPortalOrgSettings.d.ts +1 -0
- package/dist/b2b/index.esm.js +1866 -1307
- package/dist/b2b/index.headless.esm.js +3 -3
- package/dist/b2b/index.headless.js +2 -2
- package/dist/b2b/index.js +1869 -1310
- package/dist/{extractErrorMessage-DqI8LnhU.js → extractErrorMessage-C0TeBTBa.js} +4 -4
- package/dist/{extractErrorMessage-Ddemk2Gq.js → extractErrorMessage-CYXucHbA.js} +5 -5
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +43 -39
- package/dist/index.headless.js +43 -39
- package/dist/index.js +1 -1
- package/dist/{internal-8PFEtDRF.js → internal-BeiYVaO7.js} +597 -435
- package/dist/{internal-B_3PRrIX.js → internal-HC6WhS3G.js} +598 -436
- package/dist/ui/b2b/GlobalContextProvider.d.ts +11 -4
- package/dist/ui/b2b/generateProductComponentsOrdering.d.ts +4 -3
- package/dist/ui/b2b/getOtpCodeExpiration.d.ts +1 -0
- package/dist/ui/b2b/hooks/useEmailOtpDiscoverySend.d.ts +5 -0
- package/dist/ui/b2b/hooks/useEmailOtpLoginOrSignup.d.ts +6 -0
- package/dist/ui/b2b/hooks/useEmlDiscoverySend.d.ts +5 -0
- package/dist/ui/b2b/hooks/useEmlLoginOrSignup.d.ts +6 -0
- package/dist/ui/b2b/reducer.d.ts +7 -1
- package/dist/ui/b2b/screens/EmailForm.d.ts +3 -0
- package/dist/ui/b2b/screens/EmailMethodSelectionScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/EmailOTPEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/utils.d.ts +3 -1
- package/dist/ui/components/LoadingButton.d.ts +8 -0
- package/dist/ui/components/MenuButton.d.ts +6 -0
- package/dist/ui/components/SubmitButton.d.ts +1 -1
- package/dist/utils/StyledComponentProps.d.ts +2 -0
- package/package.json +2 -2
- package/dist/ui/b2b/screens/MagicLinkForm.d.ts +0 -3
|
@@ -204,6 +204,7 @@ var StytchEventType;
|
|
|
204
204
|
StytchEventType["B2BDiscoveryOrganizationsCreate"] = "B2B_DISCOVERY_ORGANIZATIONS_CREATE";
|
|
205
205
|
StytchEventType["B2BDiscoveryIntermediateSessionExchange"] = "B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE";
|
|
206
206
|
StytchEventType["B2BPasswordAuthenticate"] = "B2B_PASSWORD_AUTHENTICATE";
|
|
207
|
+
StytchEventType["B2BPasswordDiscoveryAuthenticate"] = "B2B_PASSWORD_DISCOVERY_AUTHENTICATE";
|
|
207
208
|
StytchEventType["B2BPasswordResetByEmailStart"] = "B2B_PASSWORD_RESET_BY_EMAIL_START";
|
|
208
209
|
StytchEventType["B2BPasswordResetByEmail"] = "B2B_PASSWORD_RESET_BY_EMAIL";
|
|
209
210
|
StytchEventType["B2BPasswordResetBySession"] = "B2B_PASSWORD_RESET_BY_SESSION";
|
|
@@ -212,6 +213,8 @@ var StytchEventType;
|
|
|
212
213
|
StytchEventType["B2BTOTPCreate"] = "B2B_TOTP_CREATE";
|
|
213
214
|
StytchEventType["B2BTOTPAuthenticate"] = "B2B_TOTP_AUTHENTICATE";
|
|
214
215
|
StytchEventType["B2BRecoveryCodesRecover"] = "B2B_RECOVERY_CODES_RECOVER";
|
|
216
|
+
StytchEventType["B2BPasswordDiscoveryResetStart"] = "B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL_START";
|
|
217
|
+
StytchEventType["B2BDiscoveryPasswordReset"] = "B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL";
|
|
215
218
|
})(StytchEventType || (StytchEventType = {}));
|
|
216
219
|
var RNUIProducts;
|
|
217
220
|
(function (RNUIProducts) {
|
|
@@ -689,6 +692,7 @@ function errorToStytchError(error) {
|
|
|
689
692
|
var B2BProducts;
|
|
690
693
|
(function (B2BProducts) {
|
|
691
694
|
B2BProducts["emailMagicLinks"] = "emailMagicLinks";
|
|
695
|
+
B2BProducts["emailOtp"] = "emailOtp";
|
|
692
696
|
B2BProducts["sso"] = "sso";
|
|
693
697
|
B2BProducts["passwords"] = "passwords";
|
|
694
698
|
B2BProducts["oauth"] = "oauth";
|
|
@@ -4227,6 +4231,7 @@ var DefaultDynamicConfig = Promise.resolve({
|
|
|
4227
4231
|
});
|
|
4228
4232
|
var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
4229
4233
|
function HeadlessB2BPasswordsClient(_networkClient, _subscriptionService, _pkceManager) {
|
|
4234
|
+
var _this19 = this;
|
|
4230
4235
|
var _config = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DefaultDynamicConfig;
|
|
4231
4236
|
var dfpProtectedAuth = arguments.length > 4 ? arguments[4] : undefined;
|
|
4232
4237
|
_classCallCheck(this, HeadlessB2BPasswordsClient);
|
|
@@ -4235,110 +4240,267 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4235
4240
|
this._pkceManager = _pkceManager;
|
|
4236
4241
|
this._config = _config;
|
|
4237
4242
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
4243
|
+
this.discovery = {
|
|
4244
|
+
resetByEmailStart: function resetByEmailStart(options) {
|
|
4245
|
+
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee119() {
|
|
4246
|
+
var code_challenge, _yield$this$dfpProtec24, dfp_telemetry_id, captcha_token;
|
|
4247
|
+
return _regeneratorRuntime().wrap(function _callee119$(_context119) {
|
|
4248
|
+
while (1) switch (_context119.prev = _context119.next) {
|
|
4249
|
+
case 0:
|
|
4250
|
+
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);
|
|
4251
|
+
_context119.next = 3;
|
|
4252
|
+
return this.getCodeChallenge();
|
|
4253
|
+
case 3:
|
|
4254
|
+
code_challenge = _context119.sent;
|
|
4255
|
+
_context119.next = 6;
|
|
4256
|
+
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4257
|
+
case 6:
|
|
4258
|
+
_yield$this$dfpProtec24 = _context119.sent;
|
|
4259
|
+
dfp_telemetry_id = _yield$this$dfpProtec24.dfp_telemetry_id;
|
|
4260
|
+
captcha_token = _yield$this$dfpProtec24.captcha_token;
|
|
4261
|
+
return _context119.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
4262
|
+
url: '/b2b/passwords/discovery/reset/start',
|
|
4263
|
+
method: 'POST',
|
|
4264
|
+
body: {
|
|
4265
|
+
email_address: options.email_address,
|
|
4266
|
+
discovery_redirect_url: options.discovery_redirect_url,
|
|
4267
|
+
reset_password_redirect_url: options.reset_password_redirect_url,
|
|
4268
|
+
reset_password_expiration_minutes: options.reset_password_expiration_minutes,
|
|
4269
|
+
reset_password_template_id: options.reset_password_template_id,
|
|
4270
|
+
code_challenge: code_challenge,
|
|
4271
|
+
captcha_token: captcha_token,
|
|
4272
|
+
dfp_telemetry_id: dfp_telemetry_id
|
|
4273
|
+
},
|
|
4274
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4275
|
+
}));
|
|
4276
|
+
case 10:
|
|
4277
|
+
case "end":
|
|
4278
|
+
return _context119.stop();
|
|
4279
|
+
}
|
|
4280
|
+
}, _callee119, this);
|
|
4281
|
+
}));
|
|
4282
|
+
},
|
|
4283
|
+
resetByEmail: function resetByEmail(options) {
|
|
4284
|
+
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee120() {
|
|
4285
|
+
var _yield$this$dfpProtec25, dfp_telemetry_id, captcha_token, pkPair, code_verifier, resp;
|
|
4286
|
+
return _regeneratorRuntime().wrap(function _callee120$(_context120) {
|
|
4287
|
+
while (1) switch (_context120.prev = _context120.next) {
|
|
4288
|
+
case 0:
|
|
4289
|
+
validate('stytch.passwords.discovery.resetByEmail').isString('password_reset_token', options.password_reset_token).isString('password', options.password);
|
|
4290
|
+
_context120.next = 3;
|
|
4291
|
+
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4292
|
+
case 3:
|
|
4293
|
+
_yield$this$dfpProtec25 = _context120.sent;
|
|
4294
|
+
dfp_telemetry_id = _yield$this$dfpProtec25.dfp_telemetry_id;
|
|
4295
|
+
captcha_token = _yield$this$dfpProtec25.captcha_token;
|
|
4296
|
+
_context120.next = 8;
|
|
4297
|
+
return this._pkceManager.getPKPair();
|
|
4298
|
+
case 8:
|
|
4299
|
+
pkPair = _context120.sent;
|
|
4300
|
+
code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4301
|
+
_context120.t0 = this._networkClient;
|
|
4302
|
+
_context120.t1 = options.password_reset_token;
|
|
4303
|
+
_context120.t2 = options.password;
|
|
4304
|
+
_context120.t3 = captcha_token;
|
|
4305
|
+
_context120.t4 = dfp_telemetry_id;
|
|
4306
|
+
_context120.t5 = code_verifier;
|
|
4307
|
+
_context120.next = 18;
|
|
4308
|
+
return this._subscriptionService.getIntermediateSessionToken();
|
|
4309
|
+
case 18:
|
|
4310
|
+
_context120.t6 = _context120.sent;
|
|
4311
|
+
if (_context120.t6) {
|
|
4312
|
+
_context120.next = 21;
|
|
4313
|
+
break;
|
|
4314
|
+
}
|
|
4315
|
+
_context120.t6 = undefined;
|
|
4316
|
+
case 21:
|
|
4317
|
+
_context120.t7 = _context120.t6;
|
|
4318
|
+
_context120.t8 = {
|
|
4319
|
+
password_reset_token: _context120.t1,
|
|
4320
|
+
password: _context120.t2,
|
|
4321
|
+
captcha_token: _context120.t3,
|
|
4322
|
+
dfp_telemetry_id: _context120.t4,
|
|
4323
|
+
code_verifier: _context120.t5,
|
|
4324
|
+
intermediate_session_token: _context120.t7
|
|
4325
|
+
};
|
|
4326
|
+
_context120.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4327
|
+
_context120.t10 = {
|
|
4328
|
+
url: '/b2b/passwords/discovery/reset',
|
|
4329
|
+
method: 'POST',
|
|
4330
|
+
body: _context120.t8,
|
|
4331
|
+
retryCallback: _context120.t9
|
|
4332
|
+
};
|
|
4333
|
+
_context120.next = 27;
|
|
4334
|
+
return _context120.t0.retriableFetchSDK.call(_context120.t0, _context120.t10);
|
|
4335
|
+
case 27:
|
|
4336
|
+
resp = _context120.sent;
|
|
4337
|
+
this._pkceManager.clearPKPair();
|
|
4338
|
+
this._subscriptionService.updateStateAndTokens({
|
|
4339
|
+
state: null,
|
|
4340
|
+
session_token: null,
|
|
4341
|
+
session_jwt: null,
|
|
4342
|
+
intermediate_session_token: resp.intermediate_session_token
|
|
4343
|
+
});
|
|
4344
|
+
return _context120.abrupt("return", resp);
|
|
4345
|
+
case 31:
|
|
4346
|
+
case "end":
|
|
4347
|
+
return _context120.stop();
|
|
4348
|
+
}
|
|
4349
|
+
}, _callee120, this);
|
|
4350
|
+
}));
|
|
4351
|
+
},
|
|
4352
|
+
authenticate: function authenticate(options) {
|
|
4353
|
+
return __awaiter$1(_this19, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee121() {
|
|
4354
|
+
var pkPair, code_verifier, _yield$this$dfpProtec26, dfp_telemetry_id, captcha_token, resp;
|
|
4355
|
+
return _regeneratorRuntime().wrap(function _callee121$(_context121) {
|
|
4356
|
+
while (1) switch (_context121.prev = _context121.next) {
|
|
4357
|
+
case 0:
|
|
4358
|
+
validate('stytch.passwords.discovery.authenticate').isString('password', options.password).isString('email_address', options.email_address);
|
|
4359
|
+
_context121.next = 3;
|
|
4360
|
+
return this._pkceManager.getPKPair();
|
|
4361
|
+
case 3:
|
|
4362
|
+
pkPair = _context121.sent;
|
|
4363
|
+
code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4364
|
+
_context121.next = 7;
|
|
4365
|
+
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4366
|
+
case 7:
|
|
4367
|
+
_yield$this$dfpProtec26 = _context121.sent;
|
|
4368
|
+
dfp_telemetry_id = _yield$this$dfpProtec26.dfp_telemetry_id;
|
|
4369
|
+
captcha_token = _yield$this$dfpProtec26.captcha_token;
|
|
4370
|
+
_context121.next = 12;
|
|
4371
|
+
return this._networkClient.retriableFetchSDK({
|
|
4372
|
+
url: '/b2b/passwords/discovery/authenticate',
|
|
4373
|
+
method: 'POST',
|
|
4374
|
+
body: {
|
|
4375
|
+
email_address: options.email_address,
|
|
4376
|
+
password: options.password,
|
|
4377
|
+
captcha_token: captcha_token,
|
|
4378
|
+
dfp_telemetry_id: dfp_telemetry_id,
|
|
4379
|
+
code_verifier: code_verifier
|
|
4380
|
+
},
|
|
4381
|
+
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4382
|
+
});
|
|
4383
|
+
case 12:
|
|
4384
|
+
resp = _context121.sent;
|
|
4385
|
+
this._subscriptionService.updateStateAndTokens({
|
|
4386
|
+
state: null,
|
|
4387
|
+
session_token: null,
|
|
4388
|
+
session_jwt: null,
|
|
4389
|
+
intermediate_session_token: resp.intermediate_session_token
|
|
4390
|
+
});
|
|
4391
|
+
return _context121.abrupt("return", resp);
|
|
4392
|
+
case 15:
|
|
4393
|
+
case "end":
|
|
4394
|
+
return _context121.stop();
|
|
4395
|
+
}
|
|
4396
|
+
}, _callee121, this);
|
|
4397
|
+
}));
|
|
4398
|
+
}
|
|
4399
|
+
};
|
|
4238
4400
|
}
|
|
4239
4401
|
_createClass(HeadlessB2BPasswordsClient, [{
|
|
4240
4402
|
key: "getCodeChallenge",
|
|
4241
4403
|
value: function getCodeChallenge() {
|
|
4242
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4404
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee122() {
|
|
4243
4405
|
var _yield$this$_config6, pkceRequiredForPasswordResets, keyPair;
|
|
4244
|
-
return _regeneratorRuntime().wrap(function
|
|
4245
|
-
while (1) switch (
|
|
4406
|
+
return _regeneratorRuntime().wrap(function _callee122$(_context122) {
|
|
4407
|
+
while (1) switch (_context122.prev = _context122.next) {
|
|
4246
4408
|
case 0:
|
|
4247
|
-
|
|
4409
|
+
_context122.next = 2;
|
|
4248
4410
|
return this._config;
|
|
4249
4411
|
case 2:
|
|
4250
|
-
_yield$this$_config6 =
|
|
4412
|
+
_yield$this$_config6 = _context122.sent;
|
|
4251
4413
|
pkceRequiredForPasswordResets = _yield$this$_config6.pkceRequiredForPasswordResets;
|
|
4252
4414
|
if (pkceRequiredForPasswordResets) {
|
|
4253
|
-
|
|
4415
|
+
_context122.next = 6;
|
|
4254
4416
|
break;
|
|
4255
4417
|
}
|
|
4256
|
-
return
|
|
4418
|
+
return _context122.abrupt("return", undefined);
|
|
4257
4419
|
case 6:
|
|
4258
|
-
|
|
4420
|
+
_context122.next = 8;
|
|
4259
4421
|
return this._pkceManager.getPKPair();
|
|
4260
4422
|
case 8:
|
|
4261
|
-
keyPair =
|
|
4423
|
+
keyPair = _context122.sent;
|
|
4262
4424
|
if (!keyPair) {
|
|
4263
|
-
|
|
4425
|
+
_context122.next = 11;
|
|
4264
4426
|
break;
|
|
4265
4427
|
}
|
|
4266
|
-
return
|
|
4428
|
+
return _context122.abrupt("return", keyPair.code_challenge);
|
|
4267
4429
|
case 11:
|
|
4268
|
-
|
|
4430
|
+
_context122.next = 13;
|
|
4269
4431
|
return this._pkceManager.startPKCETransaction();
|
|
4270
4432
|
case 13:
|
|
4271
|
-
keyPair =
|
|
4272
|
-
return
|
|
4433
|
+
keyPair = _context122.sent;
|
|
4434
|
+
return _context122.abrupt("return", keyPair.code_challenge);
|
|
4273
4435
|
case 15:
|
|
4274
4436
|
case "end":
|
|
4275
|
-
return
|
|
4437
|
+
return _context122.stop();
|
|
4276
4438
|
}
|
|
4277
|
-
},
|
|
4439
|
+
}, _callee122, this);
|
|
4278
4440
|
}));
|
|
4279
4441
|
}
|
|
4280
4442
|
}, {
|
|
4281
4443
|
key: "authenticate",
|
|
4282
4444
|
value: function authenticate(options) {
|
|
4283
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4284
|
-
var pkPair, code_verifier, _yield$this$
|
|
4285
|
-
return _regeneratorRuntime().wrap(function
|
|
4286
|
-
while (1) switch (
|
|
4445
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee123() {
|
|
4446
|
+
var pkPair, code_verifier, _yield$this$dfpProtec27, dfp_telemetry_id, captcha_token, resp;
|
|
4447
|
+
return _regeneratorRuntime().wrap(function _callee123$(_context123) {
|
|
4448
|
+
while (1) switch (_context123.prev = _context123.next) {
|
|
4287
4449
|
case 0:
|
|
4288
4450
|
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);
|
|
4289
|
-
|
|
4451
|
+
_context123.next = 3;
|
|
4290
4452
|
return this._pkceManager.getPKPair();
|
|
4291
4453
|
case 3:
|
|
4292
|
-
pkPair =
|
|
4454
|
+
pkPair = _context123.sent;
|
|
4293
4455
|
code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4294
|
-
|
|
4456
|
+
_context123.next = 7;
|
|
4295
4457
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4296
4458
|
case 7:
|
|
4297
|
-
_yield$this$
|
|
4298
|
-
dfp_telemetry_id = _yield$this$
|
|
4299
|
-
captcha_token = _yield$this$
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4459
|
+
_yield$this$dfpProtec27 = _context123.sent;
|
|
4460
|
+
dfp_telemetry_id = _yield$this$dfpProtec27.dfp_telemetry_id;
|
|
4461
|
+
captcha_token = _yield$this$dfpProtec27.captcha_token;
|
|
4462
|
+
_context123.t0 = this._networkClient;
|
|
4463
|
+
_context123.t1 = options.organization_id;
|
|
4464
|
+
_context123.t2 = options.email_address;
|
|
4465
|
+
_context123.t3 = options.password;
|
|
4466
|
+
_context123.t4 = options.session_duration_minutes;
|
|
4467
|
+
_context123.t5 = options.locale;
|
|
4468
|
+
_context123.t6 = captcha_token;
|
|
4469
|
+
_context123.t7 = dfp_telemetry_id;
|
|
4470
|
+
_context123.t8 = code_verifier;
|
|
4471
|
+
_context123.next = 21;
|
|
4310
4472
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4311
4473
|
case 21:
|
|
4312
|
-
|
|
4313
|
-
if (
|
|
4314
|
-
|
|
4474
|
+
_context123.t9 = _context123.sent;
|
|
4475
|
+
if (_context123.t9) {
|
|
4476
|
+
_context123.next = 24;
|
|
4315
4477
|
break;
|
|
4316
4478
|
}
|
|
4317
|
-
|
|
4479
|
+
_context123.t9 = undefined;
|
|
4318
4480
|
case 24:
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
organization_id:
|
|
4322
|
-
email_address:
|
|
4323
|
-
password:
|
|
4324
|
-
session_duration_minutes:
|
|
4325
|
-
locale:
|
|
4326
|
-
captcha_token:
|
|
4327
|
-
dfp_telemetry_id:
|
|
4328
|
-
code_verifier:
|
|
4329
|
-
intermediate_session_token:
|
|
4481
|
+
_context123.t10 = _context123.t9;
|
|
4482
|
+
_context123.t11 = {
|
|
4483
|
+
organization_id: _context123.t1,
|
|
4484
|
+
email_address: _context123.t2,
|
|
4485
|
+
password: _context123.t3,
|
|
4486
|
+
session_duration_minutes: _context123.t4,
|
|
4487
|
+
locale: _context123.t5,
|
|
4488
|
+
captcha_token: _context123.t6,
|
|
4489
|
+
dfp_telemetry_id: _context123.t7,
|
|
4490
|
+
code_verifier: _context123.t8,
|
|
4491
|
+
intermediate_session_token: _context123.t10
|
|
4330
4492
|
};
|
|
4331
|
-
|
|
4332
|
-
|
|
4493
|
+
_context123.t12 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4494
|
+
_context123.t13 = {
|
|
4333
4495
|
url: '/b2b/passwords/authenticate',
|
|
4334
4496
|
method: 'POST',
|
|
4335
|
-
body:
|
|
4336
|
-
retryCallback:
|
|
4497
|
+
body: _context123.t11,
|
|
4498
|
+
retryCallback: _context123.t12
|
|
4337
4499
|
};
|
|
4338
|
-
|
|
4339
|
-
return
|
|
4500
|
+
_context123.next = 30;
|
|
4501
|
+
return _context123.t0.retriableFetchSDK.call(_context123.t0, _context123.t13);
|
|
4340
4502
|
case 30:
|
|
4341
|
-
resp =
|
|
4503
|
+
resp = _context123.sent;
|
|
4342
4504
|
if (resp.member_session) {
|
|
4343
4505
|
this._subscriptionService.updateStateAndTokens({
|
|
4344
4506
|
state: {
|
|
@@ -4358,34 +4520,34 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4358
4520
|
intermediate_session_token: resp.intermediate_session_token
|
|
4359
4521
|
});
|
|
4360
4522
|
}
|
|
4361
|
-
return
|
|
4523
|
+
return _context123.abrupt("return", resp);
|
|
4362
4524
|
case 33:
|
|
4363
4525
|
case "end":
|
|
4364
|
-
return
|
|
4526
|
+
return _context123.stop();
|
|
4365
4527
|
}
|
|
4366
|
-
},
|
|
4528
|
+
}, _callee123, this);
|
|
4367
4529
|
}));
|
|
4368
4530
|
}
|
|
4369
4531
|
}, {
|
|
4370
4532
|
key: "resetByEmailStart",
|
|
4371
4533
|
value: function resetByEmailStart(options) {
|
|
4372
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4373
|
-
var code_challenge, _yield$this$
|
|
4374
|
-
return _regeneratorRuntime().wrap(function
|
|
4375
|
-
while (1) switch (
|
|
4534
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee124() {
|
|
4535
|
+
var code_challenge, _yield$this$dfpProtec28, dfp_telemetry_id, captcha_token;
|
|
4536
|
+
return _regeneratorRuntime().wrap(function _callee124$(_context124) {
|
|
4537
|
+
while (1) switch (_context124.prev = _context124.next) {
|
|
4376
4538
|
case 0:
|
|
4377
4539
|
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);
|
|
4378
|
-
|
|
4540
|
+
_context124.next = 3;
|
|
4379
4541
|
return this.getCodeChallenge();
|
|
4380
4542
|
case 3:
|
|
4381
|
-
code_challenge =
|
|
4382
|
-
|
|
4543
|
+
code_challenge = _context124.sent;
|
|
4544
|
+
_context124.next = 6;
|
|
4383
4545
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4384
4546
|
case 6:
|
|
4385
|
-
_yield$this$
|
|
4386
|
-
dfp_telemetry_id = _yield$this$
|
|
4387
|
-
captcha_token = _yield$this$
|
|
4388
|
-
return
|
|
4547
|
+
_yield$this$dfpProtec28 = _context124.sent;
|
|
4548
|
+
dfp_telemetry_id = _yield$this$dfpProtec28.dfp_telemetry_id;
|
|
4549
|
+
captcha_token = _yield$this$dfpProtec28.captcha_token;
|
|
4550
|
+
return _context124.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
4389
4551
|
url: '/b2b/passwords/email/reset/start',
|
|
4390
4552
|
method: 'POST',
|
|
4391
4553
|
body: {
|
|
@@ -4403,71 +4565,71 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4403
4565
|
}));
|
|
4404
4566
|
case 10:
|
|
4405
4567
|
case "end":
|
|
4406
|
-
return
|
|
4568
|
+
return _context124.stop();
|
|
4407
4569
|
}
|
|
4408
|
-
},
|
|
4570
|
+
}, _callee124, this);
|
|
4409
4571
|
}));
|
|
4410
4572
|
}
|
|
4411
4573
|
}, {
|
|
4412
4574
|
key: "resetByEmail",
|
|
4413
4575
|
value: function resetByEmail(options) {
|
|
4414
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4415
|
-
var _yield$this$
|
|
4416
|
-
return _regeneratorRuntime().wrap(function
|
|
4417
|
-
while (1) switch (
|
|
4576
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee125() {
|
|
4577
|
+
var _yield$this$dfpProtec29, dfp_telemetry_id, captcha_token, pkPair, code_verifier, resp;
|
|
4578
|
+
return _regeneratorRuntime().wrap(function _callee125$(_context125) {
|
|
4579
|
+
while (1) switch (_context125.prev = _context125.next) {
|
|
4418
4580
|
case 0:
|
|
4419
4581
|
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);
|
|
4420
|
-
|
|
4582
|
+
_context125.next = 3;
|
|
4421
4583
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4422
4584
|
case 3:
|
|
4423
|
-
_yield$this$
|
|
4424
|
-
dfp_telemetry_id = _yield$this$
|
|
4425
|
-
captcha_token = _yield$this$
|
|
4426
|
-
|
|
4585
|
+
_yield$this$dfpProtec29 = _context125.sent;
|
|
4586
|
+
dfp_telemetry_id = _yield$this$dfpProtec29.dfp_telemetry_id;
|
|
4587
|
+
captcha_token = _yield$this$dfpProtec29.captcha_token;
|
|
4588
|
+
_context125.next = 8;
|
|
4427
4589
|
return this._pkceManager.getPKPair();
|
|
4428
4590
|
case 8:
|
|
4429
|
-
pkPair =
|
|
4591
|
+
pkPair = _context125.sent;
|
|
4430
4592
|
code_verifier = pkPair === null || pkPair === void 0 ? void 0 : pkPair.code_verifier;
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4593
|
+
_context125.t0 = this._networkClient;
|
|
4594
|
+
_context125.t1 = options.password_reset_token;
|
|
4595
|
+
_context125.t2 = options.password;
|
|
4596
|
+
_context125.t3 = options.session_duration_minutes;
|
|
4597
|
+
_context125.t4 = options.locale;
|
|
4598
|
+
_context125.t5 = captcha_token;
|
|
4599
|
+
_context125.t6 = dfp_telemetry_id;
|
|
4600
|
+
_context125.t7 = code_verifier;
|
|
4601
|
+
_context125.next = 20;
|
|
4440
4602
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4441
4603
|
case 20:
|
|
4442
|
-
|
|
4443
|
-
if (
|
|
4444
|
-
|
|
4604
|
+
_context125.t8 = _context125.sent;
|
|
4605
|
+
if (_context125.t8) {
|
|
4606
|
+
_context125.next = 23;
|
|
4445
4607
|
break;
|
|
4446
4608
|
}
|
|
4447
|
-
|
|
4609
|
+
_context125.t8 = undefined;
|
|
4448
4610
|
case 23:
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
password_reset_token:
|
|
4452
|
-
password:
|
|
4453
|
-
session_duration_minutes:
|
|
4454
|
-
locale:
|
|
4455
|
-
captcha_token:
|
|
4456
|
-
dfp_telemetry_id:
|
|
4457
|
-
code_verifier:
|
|
4458
|
-
intermediate_session_token:
|
|
4611
|
+
_context125.t9 = _context125.t8;
|
|
4612
|
+
_context125.t10 = {
|
|
4613
|
+
password_reset_token: _context125.t1,
|
|
4614
|
+
password: _context125.t2,
|
|
4615
|
+
session_duration_minutes: _context125.t3,
|
|
4616
|
+
locale: _context125.t4,
|
|
4617
|
+
captcha_token: _context125.t5,
|
|
4618
|
+
dfp_telemetry_id: _context125.t6,
|
|
4619
|
+
code_verifier: _context125.t7,
|
|
4620
|
+
intermediate_session_token: _context125.t9
|
|
4459
4621
|
};
|
|
4460
|
-
|
|
4461
|
-
|
|
4622
|
+
_context125.t11 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4623
|
+
_context125.t12 = {
|
|
4462
4624
|
url: '/b2b/passwords/email/reset',
|
|
4463
4625
|
method: 'POST',
|
|
4464
|
-
body:
|
|
4465
|
-
retryCallback:
|
|
4626
|
+
body: _context125.t10,
|
|
4627
|
+
retryCallback: _context125.t11
|
|
4466
4628
|
};
|
|
4467
|
-
|
|
4468
|
-
return
|
|
4629
|
+
_context125.next = 29;
|
|
4630
|
+
return _context125.t0.retriableFetchSDK.call(_context125.t0, _context125.t12);
|
|
4469
4631
|
case 29:
|
|
4470
|
-
resp =
|
|
4632
|
+
resp = _context125.sent;
|
|
4471
4633
|
this._pkceManager.clearPKPair();
|
|
4472
4634
|
if (resp.member_session) {
|
|
4473
4635
|
this._subscriptionService.updateStateAndTokens({
|
|
@@ -4488,30 +4650,30 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4488
4650
|
intermediate_session_token: resp.intermediate_session_token
|
|
4489
4651
|
});
|
|
4490
4652
|
}
|
|
4491
|
-
return
|
|
4653
|
+
return _context125.abrupt("return", resp);
|
|
4492
4654
|
case 33:
|
|
4493
4655
|
case "end":
|
|
4494
|
-
return
|
|
4656
|
+
return _context125.stop();
|
|
4495
4657
|
}
|
|
4496
|
-
},
|
|
4658
|
+
}, _callee125, this);
|
|
4497
4659
|
}));
|
|
4498
4660
|
}
|
|
4499
4661
|
}, {
|
|
4500
4662
|
key: "resetByExistingPassword",
|
|
4501
4663
|
value: function resetByExistingPassword(options) {
|
|
4502
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4503
|
-
var _yield$this$
|
|
4504
|
-
return _regeneratorRuntime().wrap(function
|
|
4505
|
-
while (1) switch (
|
|
4664
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee126() {
|
|
4665
|
+
var _yield$this$dfpProtec30, dfp_telemetry_id, captcha_token, resp;
|
|
4666
|
+
return _regeneratorRuntime().wrap(function _callee126$(_context126) {
|
|
4667
|
+
while (1) switch (_context126.prev = _context126.next) {
|
|
4506
4668
|
case 0:
|
|
4507
4669
|
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);
|
|
4508
|
-
|
|
4670
|
+
_context126.next = 3;
|
|
4509
4671
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4510
4672
|
case 3:
|
|
4511
|
-
_yield$this$
|
|
4512
|
-
dfp_telemetry_id = _yield$this$
|
|
4513
|
-
captcha_token = _yield$this$
|
|
4514
|
-
|
|
4673
|
+
_yield$this$dfpProtec30 = _context126.sent;
|
|
4674
|
+
dfp_telemetry_id = _yield$this$dfpProtec30.dfp_telemetry_id;
|
|
4675
|
+
captcha_token = _yield$this$dfpProtec30.captcha_token;
|
|
4676
|
+
_context126.next = 8;
|
|
4515
4677
|
return this._networkClient.retriableFetchSDK({
|
|
4516
4678
|
url: '/b2b/passwords/existing_password/reset',
|
|
4517
4679
|
method: 'POST',
|
|
@@ -4528,7 +4690,7 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4528
4690
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4529
4691
|
});
|
|
4530
4692
|
case 8:
|
|
4531
|
-
resp =
|
|
4693
|
+
resp = _context126.sent;
|
|
4532
4694
|
if (resp.member_session) {
|
|
4533
4695
|
this._subscriptionService.updateStateAndTokens({
|
|
4534
4696
|
state: {
|
|
@@ -4548,30 +4710,30 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4548
4710
|
intermediate_session_token: resp.intermediate_session_token
|
|
4549
4711
|
});
|
|
4550
4712
|
}
|
|
4551
|
-
return
|
|
4713
|
+
return _context126.abrupt("return", resp);
|
|
4552
4714
|
case 11:
|
|
4553
4715
|
case "end":
|
|
4554
|
-
return
|
|
4716
|
+
return _context126.stop();
|
|
4555
4717
|
}
|
|
4556
|
-
},
|
|
4718
|
+
}, _callee126, this);
|
|
4557
4719
|
}));
|
|
4558
4720
|
}
|
|
4559
4721
|
}, {
|
|
4560
4722
|
key: "resetBySession",
|
|
4561
4723
|
value: function resetBySession(options) {
|
|
4562
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4563
|
-
var _yield$this$
|
|
4564
|
-
return _regeneratorRuntime().wrap(function
|
|
4565
|
-
while (1) switch (
|
|
4724
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee127() {
|
|
4725
|
+
var _yield$this$dfpProtec31, dfp_telemetry_id, captcha_token, resp;
|
|
4726
|
+
return _regeneratorRuntime().wrap(function _callee127$(_context127) {
|
|
4727
|
+
while (1) switch (_context127.prev = _context127.next) {
|
|
4566
4728
|
case 0:
|
|
4567
4729
|
validate('stytch.passwords.resetBySession').isString('password', options.password);
|
|
4568
|
-
|
|
4730
|
+
_context127.next = 3;
|
|
4569
4731
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4570
4732
|
case 3:
|
|
4571
|
-
_yield$this$
|
|
4572
|
-
dfp_telemetry_id = _yield$this$
|
|
4573
|
-
captcha_token = _yield$this$
|
|
4574
|
-
|
|
4733
|
+
_yield$this$dfpProtec31 = _context127.sent;
|
|
4734
|
+
dfp_telemetry_id = _yield$this$dfpProtec31.dfp_telemetry_id;
|
|
4735
|
+
captcha_token = _yield$this$dfpProtec31.captcha_token;
|
|
4736
|
+
_context127.next = 8;
|
|
4575
4737
|
return this._networkClient.retriableFetchSDK({
|
|
4576
4738
|
url: '/b2b/passwords/session/reset',
|
|
4577
4739
|
method: 'POST',
|
|
@@ -4583,7 +4745,7 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4583
4745
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4584
4746
|
});
|
|
4585
4747
|
case 8:
|
|
4586
|
-
resp =
|
|
4748
|
+
resp = _context127.sent;
|
|
4587
4749
|
this._subscriptionService.updateStateAndTokens({
|
|
4588
4750
|
state: {
|
|
4589
4751
|
session: resp.member_session,
|
|
@@ -4594,23 +4756,23 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4594
4756
|
session_jwt: resp.session_jwt,
|
|
4595
4757
|
intermediate_session_token: null
|
|
4596
4758
|
});
|
|
4597
|
-
return
|
|
4759
|
+
return _context127.abrupt("return", resp);
|
|
4598
4760
|
case 11:
|
|
4599
4761
|
case "end":
|
|
4600
|
-
return
|
|
4762
|
+
return _context127.stop();
|
|
4601
4763
|
}
|
|
4602
|
-
},
|
|
4764
|
+
}, _callee127, this);
|
|
4603
4765
|
}));
|
|
4604
4766
|
}
|
|
4605
4767
|
}, {
|
|
4606
4768
|
key: "strengthCheck",
|
|
4607
4769
|
value: function strengthCheck(options) {
|
|
4608
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4609
|
-
return _regeneratorRuntime().wrap(function
|
|
4610
|
-
while (1) switch (
|
|
4770
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee128() {
|
|
4771
|
+
return _regeneratorRuntime().wrap(function _callee128$(_context128) {
|
|
4772
|
+
while (1) switch (_context128.prev = _context128.next) {
|
|
4611
4773
|
case 0:
|
|
4612
4774
|
validate('stytch.passwords.strengthCheck').isOptionalString('email', options.email_address).isString('password', options.password);
|
|
4613
|
-
return
|
|
4775
|
+
return _context128.abrupt("return", this._networkClient.fetchSDK({
|
|
4614
4776
|
url: '/b2b/passwords/strength_check',
|
|
4615
4777
|
method: 'POST',
|
|
4616
4778
|
body: {
|
|
@@ -4620,106 +4782,106 @@ var HeadlessB2BPasswordsClient = /*#__PURE__*/function () {
|
|
|
4620
4782
|
}));
|
|
4621
4783
|
case 2:
|
|
4622
4784
|
case "end":
|
|
4623
|
-
return
|
|
4785
|
+
return _context128.stop();
|
|
4624
4786
|
}
|
|
4625
|
-
},
|
|
4787
|
+
}, _callee128, this);
|
|
4626
4788
|
}));
|
|
4627
4789
|
}
|
|
4628
4790
|
}]);
|
|
4629
4791
|
return HeadlessB2BPasswordsClient;
|
|
4630
4792
|
}();
|
|
4631
4793
|
var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsClient(_networkClient, _subscriptionService, dfpProtectedAuth) {
|
|
4632
|
-
var
|
|
4794
|
+
var _this20 = this;
|
|
4633
4795
|
_classCallCheck(this, HeadlessB2BOTPsClient);
|
|
4634
4796
|
this._networkClient = _networkClient;
|
|
4635
4797
|
this._subscriptionService = _subscriptionService;
|
|
4636
4798
|
this.dfpProtectedAuth = dfpProtectedAuth;
|
|
4637
4799
|
this.sms = {
|
|
4638
4800
|
send: function send(data) {
|
|
4639
|
-
return __awaiter$1(
|
|
4640
|
-
var _yield$this$
|
|
4641
|
-
return _regeneratorRuntime().wrap(function
|
|
4642
|
-
while (1) switch (
|
|
4801
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee129() {
|
|
4802
|
+
var _yield$this$dfpProtec32, dfp_telemetry_id, captcha_token;
|
|
4803
|
+
return _regeneratorRuntime().wrap(function _callee129$(_context129) {
|
|
4804
|
+
while (1) switch (_context129.prev = _context129.next) {
|
|
4643
4805
|
case 0:
|
|
4644
4806
|
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);
|
|
4645
|
-
|
|
4807
|
+
_context129.next = 3;
|
|
4646
4808
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4647
4809
|
case 3:
|
|
4648
|
-
_yield$this$
|
|
4649
|
-
dfp_telemetry_id = _yield$this$
|
|
4650
|
-
captcha_token = _yield$this$
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4810
|
+
_yield$this$dfpProtec32 = _context129.sent;
|
|
4811
|
+
dfp_telemetry_id = _yield$this$dfpProtec32.dfp_telemetry_id;
|
|
4812
|
+
captcha_token = _yield$this$dfpProtec32.captcha_token;
|
|
4813
|
+
_context129.t0 = this._networkClient;
|
|
4814
|
+
_context129.t1 = Object;
|
|
4815
|
+
_context129.t2 = Object.assign({}, data);
|
|
4816
|
+
_context129.t3 = dfp_telemetry_id;
|
|
4817
|
+
_context129.t4 = captcha_token;
|
|
4818
|
+
_context129.next = 13;
|
|
4657
4819
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4658
4820
|
case 13:
|
|
4659
|
-
|
|
4660
|
-
if (
|
|
4661
|
-
|
|
4821
|
+
_context129.t5 = _context129.sent;
|
|
4822
|
+
if (_context129.t5) {
|
|
4823
|
+
_context129.next = 16;
|
|
4662
4824
|
break;
|
|
4663
4825
|
}
|
|
4664
|
-
|
|
4826
|
+
_context129.t5 = undefined;
|
|
4665
4827
|
case 16:
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
dfp_telemetry_id:
|
|
4669
|
-
captcha_token:
|
|
4670
|
-
intermediate_session_token:
|
|
4828
|
+
_context129.t6 = _context129.t5;
|
|
4829
|
+
_context129.t7 = {
|
|
4830
|
+
dfp_telemetry_id: _context129.t3,
|
|
4831
|
+
captcha_token: _context129.t4,
|
|
4832
|
+
intermediate_session_token: _context129.t6
|
|
4671
4833
|
};
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4834
|
+
_context129.t8 = _context129.t1.assign.call(_context129.t1, _context129.t2, _context129.t7);
|
|
4835
|
+
_context129.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4836
|
+
_context129.t10 = {
|
|
4675
4837
|
url: '/b2b/otps/sms/send',
|
|
4676
|
-
body:
|
|
4838
|
+
body: _context129.t8,
|
|
4677
4839
|
method: 'POST',
|
|
4678
|
-
retryCallback:
|
|
4840
|
+
retryCallback: _context129.t9
|
|
4679
4841
|
};
|
|
4680
|
-
return
|
|
4842
|
+
return _context129.abrupt("return", _context129.t0.retriableFetchSDK.call(_context129.t0, _context129.t10));
|
|
4681
4843
|
case 22:
|
|
4682
4844
|
case "end":
|
|
4683
|
-
return
|
|
4845
|
+
return _context129.stop();
|
|
4684
4846
|
}
|
|
4685
|
-
},
|
|
4847
|
+
}, _callee129, this);
|
|
4686
4848
|
}));
|
|
4687
4849
|
},
|
|
4688
4850
|
authenticate: function authenticate(data) {
|
|
4689
|
-
return __awaiter$1(
|
|
4690
|
-
var _yield$this$
|
|
4691
|
-
return _regeneratorRuntime().wrap(function
|
|
4692
|
-
while (1) switch (
|
|
4851
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee130() {
|
|
4852
|
+
var _yield$this$dfpProtec33, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
4853
|
+
return _regeneratorRuntime().wrap(function _callee130$(_context130) {
|
|
4854
|
+
while (1) switch (_context130.prev = _context130.next) {
|
|
4693
4855
|
case 0:
|
|
4694
4856
|
validate('stytch.otps.sms.authenticate').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('code', data.code).isOptionalString('set_mfa_enrollment', data.set_mfa_enrollment);
|
|
4695
|
-
|
|
4857
|
+
_context130.next = 3;
|
|
4696
4858
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4697
4859
|
case 3:
|
|
4698
|
-
_yield$this$
|
|
4699
|
-
dfp_telemetry_id = _yield$this$
|
|
4700
|
-
captcha_token = _yield$this$
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4860
|
+
_yield$this$dfpProtec33 = _context130.sent;
|
|
4861
|
+
dfp_telemetry_id = _yield$this$dfpProtec33.dfp_telemetry_id;
|
|
4862
|
+
captcha_token = _yield$this$dfpProtec33.captcha_token;
|
|
4863
|
+
_context130.t0 = Object;
|
|
4864
|
+
_context130.t1 = Object.assign({}, data);
|
|
4865
|
+
_context130.t2 = dfp_telemetry_id;
|
|
4866
|
+
_context130.t3 = captcha_token;
|
|
4867
|
+
_context130.next = 12;
|
|
4706
4868
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4707
4869
|
case 12:
|
|
4708
|
-
|
|
4709
|
-
if (
|
|
4710
|
-
|
|
4870
|
+
_context130.t4 = _context130.sent;
|
|
4871
|
+
if (_context130.t4) {
|
|
4872
|
+
_context130.next = 15;
|
|
4711
4873
|
break;
|
|
4712
4874
|
}
|
|
4713
|
-
|
|
4875
|
+
_context130.t4 = undefined;
|
|
4714
4876
|
case 15:
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
dfp_telemetry_id:
|
|
4718
|
-
captcha_token:
|
|
4719
|
-
intermediate_session_token:
|
|
4877
|
+
_context130.t5 = _context130.t4;
|
|
4878
|
+
_context130.t6 = {
|
|
4879
|
+
dfp_telemetry_id: _context130.t2,
|
|
4880
|
+
captcha_token: _context130.t3,
|
|
4881
|
+
intermediate_session_token: _context130.t5
|
|
4720
4882
|
};
|
|
4721
|
-
requestBody =
|
|
4722
|
-
|
|
4883
|
+
requestBody = _context130.t0.assign.call(_context130.t0, _context130.t1, _context130.t6);
|
|
4884
|
+
_context130.next = 20;
|
|
4723
4885
|
return this._networkClient.retriableFetchSDK({
|
|
4724
4886
|
url: '/b2b/otps/sms/authenticate',
|
|
4725
4887
|
body: requestBody,
|
|
@@ -4727,7 +4889,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4727
4889
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4728
4890
|
});
|
|
4729
4891
|
case 20:
|
|
4730
|
-
resp =
|
|
4892
|
+
resp = _context130.sent;
|
|
4731
4893
|
this._subscriptionService.updateStateAndTokens({
|
|
4732
4894
|
state: {
|
|
4733
4895
|
session: resp.member_session,
|
|
@@ -4738,30 +4900,30 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4738
4900
|
session_jwt: resp.session_jwt,
|
|
4739
4901
|
intermediate_session_token: null
|
|
4740
4902
|
});
|
|
4741
|
-
return
|
|
4903
|
+
return _context130.abrupt("return", resp);
|
|
4742
4904
|
case 23:
|
|
4743
4905
|
case "end":
|
|
4744
|
-
return
|
|
4906
|
+
return _context130.stop();
|
|
4745
4907
|
}
|
|
4746
|
-
},
|
|
4908
|
+
}, _callee130, this);
|
|
4747
4909
|
}));
|
|
4748
4910
|
}
|
|
4749
4911
|
};
|
|
4750
4912
|
this.email = {
|
|
4751
4913
|
loginOrSignup: function loginOrSignup(data) {
|
|
4752
|
-
return __awaiter$1(
|
|
4753
|
-
var _yield$this$
|
|
4754
|
-
return _regeneratorRuntime().wrap(function
|
|
4755
|
-
while (1) switch (
|
|
4914
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee131() {
|
|
4915
|
+
var _yield$this$dfpProtec34, dfp_telemetry_id, captcha_token;
|
|
4916
|
+
return _regeneratorRuntime().wrap(function _callee131$(_context131) {
|
|
4917
|
+
while (1) switch (_context131.prev = _context131.next) {
|
|
4756
4918
|
case 0:
|
|
4757
4919
|
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);
|
|
4758
|
-
|
|
4920
|
+
_context131.next = 3;
|
|
4759
4921
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4760
4922
|
case 3:
|
|
4761
|
-
_yield$this$
|
|
4762
|
-
dfp_telemetry_id = _yield$this$
|
|
4763
|
-
captcha_token = _yield$this$
|
|
4764
|
-
return
|
|
4923
|
+
_yield$this$dfpProtec34 = _context131.sent;
|
|
4924
|
+
dfp_telemetry_id = _yield$this$dfpProtec34.dfp_telemetry_id;
|
|
4925
|
+
captcha_token = _yield$this$dfpProtec34.captcha_token;
|
|
4926
|
+
return _context131.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
4765
4927
|
url: '/b2b/otps/email/login_or_signup',
|
|
4766
4928
|
body: Object.assign(Object.assign({}, data), {
|
|
4767
4929
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
@@ -4772,57 +4934,57 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4772
4934
|
}));
|
|
4773
4935
|
case 7:
|
|
4774
4936
|
case "end":
|
|
4775
|
-
return
|
|
4937
|
+
return _context131.stop();
|
|
4776
4938
|
}
|
|
4777
|
-
},
|
|
4939
|
+
}, _callee131, this);
|
|
4778
4940
|
}));
|
|
4779
4941
|
},
|
|
4780
4942
|
authenticate: function authenticate(data) {
|
|
4781
|
-
return __awaiter$1(
|
|
4782
|
-
var _yield$this$
|
|
4783
|
-
return _regeneratorRuntime().wrap(function
|
|
4784
|
-
while (1) switch (
|
|
4943
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee132() {
|
|
4944
|
+
var _yield$this$dfpProtec35, dfp_telemetry_id, captcha_token, resp;
|
|
4945
|
+
return _regeneratorRuntime().wrap(function _callee132$(_context132) {
|
|
4946
|
+
while (1) switch (_context132.prev = _context132.next) {
|
|
4785
4947
|
case 0:
|
|
4786
|
-
validate('stytch.otps.email.authenticate').isString('code', data.code).isString('
|
|
4787
|
-
|
|
4948
|
+
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);
|
|
4949
|
+
_context132.next = 3;
|
|
4788
4950
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4789
4951
|
case 3:
|
|
4790
|
-
_yield$this$
|
|
4791
|
-
dfp_telemetry_id = _yield$this$
|
|
4792
|
-
captcha_token = _yield$this$
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4952
|
+
_yield$this$dfpProtec35 = _context132.sent;
|
|
4953
|
+
dfp_telemetry_id = _yield$this$dfpProtec35.dfp_telemetry_id;
|
|
4954
|
+
captcha_token = _yield$this$dfpProtec35.captcha_token;
|
|
4955
|
+
_context132.t0 = this._networkClient;
|
|
4956
|
+
_context132.t1 = Object;
|
|
4957
|
+
_context132.t2 = Object.assign({}, data);
|
|
4958
|
+
_context132.next = 11;
|
|
4797
4959
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4798
4960
|
case 11:
|
|
4799
|
-
|
|
4800
|
-
if (
|
|
4801
|
-
|
|
4961
|
+
_context132.t3 = _context132.sent;
|
|
4962
|
+
if (_context132.t3) {
|
|
4963
|
+
_context132.next = 14;
|
|
4802
4964
|
break;
|
|
4803
4965
|
}
|
|
4804
|
-
|
|
4966
|
+
_context132.t3 = undefined;
|
|
4805
4967
|
case 14:
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
intermediate_session_token:
|
|
4811
|
-
dfp_telemetry_id:
|
|
4812
|
-
captcha_token:
|
|
4968
|
+
_context132.t4 = _context132.t3;
|
|
4969
|
+
_context132.t5 = dfp_telemetry_id;
|
|
4970
|
+
_context132.t6 = captcha_token;
|
|
4971
|
+
_context132.t7 = {
|
|
4972
|
+
intermediate_session_token: _context132.t4,
|
|
4973
|
+
dfp_telemetry_id: _context132.t5,
|
|
4974
|
+
captcha_token: _context132.t6
|
|
4813
4975
|
};
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4976
|
+
_context132.t8 = _context132.t1.assign.call(_context132.t1, _context132.t2, _context132.t7);
|
|
4977
|
+
_context132.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
4978
|
+
_context132.t10 = {
|
|
4817
4979
|
url: '/b2b/otps/email/authenticate',
|
|
4818
|
-
body:
|
|
4980
|
+
body: _context132.t8,
|
|
4819
4981
|
method: 'POST',
|
|
4820
|
-
retryCallback:
|
|
4982
|
+
retryCallback: _context132.t9
|
|
4821
4983
|
};
|
|
4822
|
-
|
|
4823
|
-
return
|
|
4984
|
+
_context132.next = 23;
|
|
4985
|
+
return _context132.t0.retriableFetchSDK.call(_context132.t0, _context132.t10);
|
|
4824
4986
|
case 23:
|
|
4825
|
-
resp =
|
|
4987
|
+
resp = _context132.sent;
|
|
4826
4988
|
if (resp && resp.member_session) {
|
|
4827
4989
|
this._subscriptionService.updateStateAndTokens({
|
|
4828
4990
|
state: {
|
|
@@ -4835,33 +4997,33 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4835
4997
|
intermediate_session_token: null
|
|
4836
4998
|
});
|
|
4837
4999
|
}
|
|
4838
|
-
return
|
|
5000
|
+
return _context132.abrupt("return", resp);
|
|
4839
5001
|
case 26:
|
|
4840
5002
|
case "end":
|
|
4841
|
-
return
|
|
5003
|
+
return _context132.stop();
|
|
4842
5004
|
}
|
|
4843
|
-
},
|
|
5005
|
+
}, _callee132, this);
|
|
4844
5006
|
}));
|
|
4845
5007
|
},
|
|
4846
5008
|
discovery: {
|
|
4847
5009
|
send: function send(data) {
|
|
4848
|
-
return __awaiter$1(
|
|
4849
|
-
var _yield$this$
|
|
4850
|
-
return _regeneratorRuntime().wrap(function
|
|
4851
|
-
while (1) switch (
|
|
5010
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee133() {
|
|
5011
|
+
var _yield$this$dfpProtec36, dfp_telemetry_id, captcha_token, requestBody;
|
|
5012
|
+
return _regeneratorRuntime().wrap(function _callee133$(_context133) {
|
|
5013
|
+
while (1) switch (_context133.prev = _context133.next) {
|
|
4852
5014
|
case 0:
|
|
4853
5015
|
validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale);
|
|
4854
|
-
|
|
5016
|
+
_context133.next = 3;
|
|
4855
5017
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4856
5018
|
case 3:
|
|
4857
|
-
_yield$this$
|
|
4858
|
-
dfp_telemetry_id = _yield$this$
|
|
4859
|
-
captcha_token = _yield$this$
|
|
5019
|
+
_yield$this$dfpProtec36 = _context133.sent;
|
|
5020
|
+
dfp_telemetry_id = _yield$this$dfpProtec36.dfp_telemetry_id;
|
|
5021
|
+
captcha_token = _yield$this$dfpProtec36.captcha_token;
|
|
4860
5022
|
requestBody = Object.assign(Object.assign({}, data), {
|
|
4861
5023
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
4862
5024
|
captcha_token: captcha_token
|
|
4863
5025
|
});
|
|
4864
|
-
return
|
|
5026
|
+
return _context133.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
4865
5027
|
url: '/b2b/otps/email/discovery/send',
|
|
4866
5028
|
body: requestBody,
|
|
4867
5029
|
method: 'POST',
|
|
@@ -4869,29 +5031,29 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4869
5031
|
}));
|
|
4870
5032
|
case 8:
|
|
4871
5033
|
case "end":
|
|
4872
|
-
return
|
|
5034
|
+
return _context133.stop();
|
|
4873
5035
|
}
|
|
4874
|
-
},
|
|
5036
|
+
}, _callee133, this);
|
|
4875
5037
|
}));
|
|
4876
5038
|
},
|
|
4877
5039
|
authenticate: function authenticate(data) {
|
|
4878
|
-
return __awaiter$1(
|
|
4879
|
-
var _yield$this$
|
|
4880
|
-
return _regeneratorRuntime().wrap(function
|
|
4881
|
-
while (1) switch (
|
|
5040
|
+
return __awaiter$1(_this20, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee134() {
|
|
5041
|
+
var _yield$this$dfpProtec37, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
5042
|
+
return _regeneratorRuntime().wrap(function _callee134$(_context134) {
|
|
5043
|
+
while (1) switch (_context134.prev = _context134.next) {
|
|
4882
5044
|
case 0:
|
|
4883
5045
|
validate('stytch.otps.email.discovery.authenticate').isString('code', data.code).isString('email_address', data.email_address);
|
|
4884
|
-
|
|
5046
|
+
_context134.next = 3;
|
|
4885
5047
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4886
5048
|
case 3:
|
|
4887
|
-
_yield$this$
|
|
4888
|
-
dfp_telemetry_id = _yield$this$
|
|
4889
|
-
captcha_token = _yield$this$
|
|
5049
|
+
_yield$this$dfpProtec37 = _context134.sent;
|
|
5050
|
+
dfp_telemetry_id = _yield$this$dfpProtec37.dfp_telemetry_id;
|
|
5051
|
+
captcha_token = _yield$this$dfpProtec37.captcha_token;
|
|
4890
5052
|
requestBody = Object.assign({
|
|
4891
5053
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
4892
5054
|
captcha_token: captcha_token
|
|
4893
5055
|
}, data);
|
|
4894
|
-
|
|
5056
|
+
_context134.next = 9;
|
|
4895
5057
|
return this._networkClient.retriableFetchSDK({
|
|
4896
5058
|
url: '/b2b/otps/email/discovery/authenticate',
|
|
4897
5059
|
body: requestBody,
|
|
@@ -4899,19 +5061,19 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4899
5061
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
4900
5062
|
});
|
|
4901
5063
|
case 9:
|
|
4902
|
-
resp =
|
|
5064
|
+
resp = _context134.sent;
|
|
4903
5065
|
this._subscriptionService.updateStateAndTokens({
|
|
4904
5066
|
state: null,
|
|
4905
5067
|
session_token: null,
|
|
4906
5068
|
session_jwt: null,
|
|
4907
5069
|
intermediate_session_token: resp.intermediate_session_token
|
|
4908
5070
|
});
|
|
4909
|
-
return
|
|
5071
|
+
return _context134.abrupt("return", resp);
|
|
4910
5072
|
case 12:
|
|
4911
5073
|
case "end":
|
|
4912
|
-
return
|
|
5074
|
+
return _context134.stop();
|
|
4913
5075
|
}
|
|
4914
|
-
},
|
|
5076
|
+
}, _callee134, this);
|
|
4915
5077
|
}));
|
|
4916
5078
|
}
|
|
4917
5079
|
}
|
|
@@ -4927,92 +5089,92 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
|
|
|
4927
5089
|
_createClass(HeadlessB2BTOTPsClient, [{
|
|
4928
5090
|
key: "create",
|
|
4929
5091
|
value: function create(data) {
|
|
4930
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4931
|
-
var _yield$this$
|
|
4932
|
-
return _regeneratorRuntime().wrap(function
|
|
4933
|
-
while (1) switch (
|
|
5092
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee135() {
|
|
5093
|
+
var _yield$this$dfpProtec38, dfp_telemetry_id, captcha_token;
|
|
5094
|
+
return _regeneratorRuntime().wrap(function _callee135$(_context135) {
|
|
5095
|
+
while (1) switch (_context135.prev = _context135.next) {
|
|
4934
5096
|
case 0:
|
|
4935
5097
|
validate('stytch.totp.create').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isOptionalNumber('expiration_minutes', data.expiration_minutes);
|
|
4936
|
-
|
|
5098
|
+
_context135.next = 3;
|
|
4937
5099
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4938
5100
|
case 3:
|
|
4939
|
-
_yield$this$
|
|
4940
|
-
dfp_telemetry_id = _yield$this$
|
|
4941
|
-
captcha_token = _yield$this$
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
5101
|
+
_yield$this$dfpProtec38 = _context135.sent;
|
|
5102
|
+
dfp_telemetry_id = _yield$this$dfpProtec38.dfp_telemetry_id;
|
|
5103
|
+
captcha_token = _yield$this$dfpProtec38.captcha_token;
|
|
5104
|
+
_context135.t0 = this._networkClient;
|
|
5105
|
+
_context135.t1 = Object;
|
|
5106
|
+
_context135.t2 = Object.assign({}, data);
|
|
5107
|
+
_context135.t3 = dfp_telemetry_id;
|
|
5108
|
+
_context135.t4 = captcha_token;
|
|
5109
|
+
_context135.next = 13;
|
|
4948
5110
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
4949
5111
|
case 13:
|
|
4950
|
-
|
|
4951
|
-
if (
|
|
4952
|
-
|
|
5112
|
+
_context135.t5 = _context135.sent;
|
|
5113
|
+
if (_context135.t5) {
|
|
5114
|
+
_context135.next = 16;
|
|
4953
5115
|
break;
|
|
4954
5116
|
}
|
|
4955
|
-
|
|
5117
|
+
_context135.t5 = undefined;
|
|
4956
5118
|
case 16:
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
dfp_telemetry_id:
|
|
4960
|
-
captcha_token:
|
|
4961
|
-
intermediate_session_token:
|
|
5119
|
+
_context135.t6 = _context135.t5;
|
|
5120
|
+
_context135.t7 = {
|
|
5121
|
+
dfp_telemetry_id: _context135.t3,
|
|
5122
|
+
captcha_token: _context135.t4,
|
|
5123
|
+
intermediate_session_token: _context135.t6
|
|
4962
5124
|
};
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
5125
|
+
_context135.t8 = _context135.t1.assign.call(_context135.t1, _context135.t2, _context135.t7);
|
|
5126
|
+
_context135.t9 = this.dfpProtectedAuth.retryWithCaptchaAndDFP;
|
|
5127
|
+
_context135.t10 = {
|
|
4966
5128
|
url: '/b2b/totp',
|
|
4967
|
-
body:
|
|
5129
|
+
body: _context135.t8,
|
|
4968
5130
|
method: 'POST',
|
|
4969
|
-
retryCallback:
|
|
5131
|
+
retryCallback: _context135.t9
|
|
4970
5132
|
};
|
|
4971
|
-
return
|
|
5133
|
+
return _context135.abrupt("return", _context135.t0.retriableFetchSDK.call(_context135.t0, _context135.t10));
|
|
4972
5134
|
case 22:
|
|
4973
5135
|
case "end":
|
|
4974
|
-
return
|
|
5136
|
+
return _context135.stop();
|
|
4975
5137
|
}
|
|
4976
|
-
},
|
|
5138
|
+
}, _callee135, this);
|
|
4977
5139
|
}));
|
|
4978
5140
|
}
|
|
4979
5141
|
}, {
|
|
4980
5142
|
key: "authenticate",
|
|
4981
5143
|
value: function authenticate(data) {
|
|
4982
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4983
|
-
var _yield$this$
|
|
4984
|
-
return _regeneratorRuntime().wrap(function
|
|
4985
|
-
while (1) switch (
|
|
5144
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee136() {
|
|
5145
|
+
var _yield$this$dfpProtec39, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
5146
|
+
return _regeneratorRuntime().wrap(function _callee136$(_context136) {
|
|
5147
|
+
while (1) switch (_context136.prev = _context136.next) {
|
|
4986
5148
|
case 0:
|
|
4987
5149
|
validate('stytch.totp.authenticate').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('code', data.code).isOptionalString('set_mfa_enrollment', data.set_mfa_enrollment).isOptionalBoolean('set_default_mfa', data.set_default_mfa);
|
|
4988
|
-
|
|
5150
|
+
_context136.next = 3;
|
|
4989
5151
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4990
5152
|
case 3:
|
|
4991
|
-
_yield$this$
|
|
4992
|
-
dfp_telemetry_id = _yield$this$
|
|
4993
|
-
captcha_token = _yield$this$
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
5153
|
+
_yield$this$dfpProtec39 = _context136.sent;
|
|
5154
|
+
dfp_telemetry_id = _yield$this$dfpProtec39.dfp_telemetry_id;
|
|
5155
|
+
captcha_token = _yield$this$dfpProtec39.captcha_token;
|
|
5156
|
+
_context136.t0 = Object;
|
|
5157
|
+
_context136.t1 = Object.assign({}, data);
|
|
5158
|
+
_context136.t2 = dfp_telemetry_id;
|
|
5159
|
+
_context136.t3 = captcha_token;
|
|
5160
|
+
_context136.next = 12;
|
|
4999
5161
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
5000
5162
|
case 12:
|
|
5001
|
-
|
|
5002
|
-
if (
|
|
5003
|
-
|
|
5163
|
+
_context136.t4 = _context136.sent;
|
|
5164
|
+
if (_context136.t4) {
|
|
5165
|
+
_context136.next = 15;
|
|
5004
5166
|
break;
|
|
5005
5167
|
}
|
|
5006
|
-
|
|
5168
|
+
_context136.t4 = undefined;
|
|
5007
5169
|
case 15:
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
dfp_telemetry_id:
|
|
5011
|
-
captcha_token:
|
|
5012
|
-
intermediate_session_token:
|
|
5170
|
+
_context136.t5 = _context136.t4;
|
|
5171
|
+
_context136.t6 = {
|
|
5172
|
+
dfp_telemetry_id: _context136.t2,
|
|
5173
|
+
captcha_token: _context136.t3,
|
|
5174
|
+
intermediate_session_token: _context136.t5
|
|
5013
5175
|
};
|
|
5014
|
-
requestBody =
|
|
5015
|
-
|
|
5176
|
+
requestBody = _context136.t0.assign.call(_context136.t0, _context136.t1, _context136.t6);
|
|
5177
|
+
_context136.next = 20;
|
|
5016
5178
|
return this._networkClient.retriableFetchSDK({
|
|
5017
5179
|
url: '/b2b/totp/authenticate',
|
|
5018
5180
|
body: requestBody,
|
|
@@ -5020,7 +5182,7 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
|
|
|
5020
5182
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
5021
5183
|
});
|
|
5022
5184
|
case 20:
|
|
5023
|
-
resp =
|
|
5185
|
+
resp = _context136.sent;
|
|
5024
5186
|
this._subscriptionService.updateStateAndTokens({
|
|
5025
5187
|
state: {
|
|
5026
5188
|
session: resp.member_session,
|
|
@@ -5031,12 +5193,12 @@ var HeadlessB2BTOTPsClient = /*#__PURE__*/function () {
|
|
|
5031
5193
|
session_jwt: resp.session_jwt,
|
|
5032
5194
|
intermediate_session_token: null
|
|
5033
5195
|
});
|
|
5034
|
-
return
|
|
5196
|
+
return _context136.abrupt("return", resp);
|
|
5035
5197
|
case 23:
|
|
5036
5198
|
case "end":
|
|
5037
|
-
return
|
|
5199
|
+
return _context136.stop();
|
|
5038
5200
|
}
|
|
5039
|
-
},
|
|
5201
|
+
}, _callee136, this);
|
|
5040
5202
|
}));
|
|
5041
5203
|
}
|
|
5042
5204
|
}]);
|
|
@@ -5052,40 +5214,40 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5052
5214
|
_createClass(HeadlessB2BRecoveryCodesClient, [{
|
|
5053
5215
|
key: "recover",
|
|
5054
5216
|
value: function recover(data) {
|
|
5055
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5056
|
-
var _yield$this$
|
|
5057
|
-
return _regeneratorRuntime().wrap(function
|
|
5058
|
-
while (1) switch (
|
|
5217
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee137() {
|
|
5218
|
+
var _yield$this$dfpProtec40, dfp_telemetry_id, captcha_token, requestBody, resp;
|
|
5219
|
+
return _regeneratorRuntime().wrap(function _callee137$(_context137) {
|
|
5220
|
+
while (1) switch (_context137.prev = _context137.next) {
|
|
5059
5221
|
case 0:
|
|
5060
5222
|
validate('stytch.recoveryCodes.recover').isString('organization_id', data.organization_id).isString('member_id', data.member_id).isString('recovery_code', data.recovery_code);
|
|
5061
|
-
|
|
5223
|
+
_context137.next = 3;
|
|
5062
5224
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5063
5225
|
case 3:
|
|
5064
|
-
_yield$this$
|
|
5065
|
-
dfp_telemetry_id = _yield$this$
|
|
5066
|
-
captcha_token = _yield$this$
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5226
|
+
_yield$this$dfpProtec40 = _context137.sent;
|
|
5227
|
+
dfp_telemetry_id = _yield$this$dfpProtec40.dfp_telemetry_id;
|
|
5228
|
+
captcha_token = _yield$this$dfpProtec40.captcha_token;
|
|
5229
|
+
_context137.t0 = Object;
|
|
5230
|
+
_context137.t1 = Object.assign({}, data);
|
|
5231
|
+
_context137.t2 = dfp_telemetry_id;
|
|
5232
|
+
_context137.t3 = captcha_token;
|
|
5233
|
+
_context137.next = 12;
|
|
5072
5234
|
return this._subscriptionService.getIntermediateSessionToken();
|
|
5073
5235
|
case 12:
|
|
5074
|
-
|
|
5075
|
-
if (
|
|
5076
|
-
|
|
5236
|
+
_context137.t4 = _context137.sent;
|
|
5237
|
+
if (_context137.t4) {
|
|
5238
|
+
_context137.next = 15;
|
|
5077
5239
|
break;
|
|
5078
5240
|
}
|
|
5079
|
-
|
|
5241
|
+
_context137.t4 = undefined;
|
|
5080
5242
|
case 15:
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
dfp_telemetry_id:
|
|
5084
|
-
captcha_token:
|
|
5085
|
-
intermediate_session_token:
|
|
5243
|
+
_context137.t5 = _context137.t4;
|
|
5244
|
+
_context137.t6 = {
|
|
5245
|
+
dfp_telemetry_id: _context137.t2,
|
|
5246
|
+
captcha_token: _context137.t3,
|
|
5247
|
+
intermediate_session_token: _context137.t5
|
|
5086
5248
|
};
|
|
5087
|
-
requestBody =
|
|
5088
|
-
|
|
5249
|
+
requestBody = _context137.t0.assign.call(_context137.t0, _context137.t1, _context137.t6);
|
|
5250
|
+
_context137.next = 20;
|
|
5089
5251
|
return this._networkClient.retriableFetchSDK({
|
|
5090
5252
|
url: '/b2b/recovery_codes/recover',
|
|
5091
5253
|
body: requestBody,
|
|
@@ -5093,7 +5255,7 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5093
5255
|
retryCallback: this.dfpProtectedAuth.retryWithCaptchaAndDFP
|
|
5094
5256
|
});
|
|
5095
5257
|
case 20:
|
|
5096
|
-
resp =
|
|
5258
|
+
resp = _context137.sent;
|
|
5097
5259
|
this._subscriptionService.updateStateAndTokens({
|
|
5098
5260
|
state: {
|
|
5099
5261
|
session: resp.member_session,
|
|
@@ -5104,29 +5266,29 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5104
5266
|
session_jwt: resp.session_jwt,
|
|
5105
5267
|
intermediate_session_token: null
|
|
5106
5268
|
});
|
|
5107
|
-
return
|
|
5269
|
+
return _context137.abrupt("return", resp);
|
|
5108
5270
|
case 23:
|
|
5109
5271
|
case "end":
|
|
5110
|
-
return
|
|
5272
|
+
return _context137.stop();
|
|
5111
5273
|
}
|
|
5112
|
-
},
|
|
5274
|
+
}, _callee137, this);
|
|
5113
5275
|
}));
|
|
5114
5276
|
}
|
|
5115
5277
|
}, {
|
|
5116
5278
|
key: "rotate",
|
|
5117
5279
|
value: function rotate() {
|
|
5118
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5119
|
-
var _yield$this$
|
|
5120
|
-
return _regeneratorRuntime().wrap(function
|
|
5121
|
-
while (1) switch (
|
|
5280
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee138() {
|
|
5281
|
+
var _yield$this$dfpProtec41, dfp_telemetry_id, captcha_token;
|
|
5282
|
+
return _regeneratorRuntime().wrap(function _callee138$(_context138) {
|
|
5283
|
+
while (1) switch (_context138.prev = _context138.next) {
|
|
5122
5284
|
case 0:
|
|
5123
|
-
|
|
5285
|
+
_context138.next = 2;
|
|
5124
5286
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5125
5287
|
case 2:
|
|
5126
|
-
_yield$this$
|
|
5127
|
-
dfp_telemetry_id = _yield$this$
|
|
5128
|
-
captcha_token = _yield$this$
|
|
5129
|
-
return
|
|
5288
|
+
_yield$this$dfpProtec41 = _context138.sent;
|
|
5289
|
+
dfp_telemetry_id = _yield$this$dfpProtec41.dfp_telemetry_id;
|
|
5290
|
+
captcha_token = _yield$this$dfpProtec41.captcha_token;
|
|
5291
|
+
return _context138.abrupt("return", this._networkClient.retriableFetchSDK({
|
|
5130
5292
|
url: '/b2b/recovery_codes/rotate',
|
|
5131
5293
|
body: {
|
|
5132
5294
|
dfp_telemetry_id: dfp_telemetry_id,
|
|
@@ -5137,27 +5299,27 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5137
5299
|
}));
|
|
5138
5300
|
case 6:
|
|
5139
5301
|
case "end":
|
|
5140
|
-
return
|
|
5302
|
+
return _context138.stop();
|
|
5141
5303
|
}
|
|
5142
|
-
},
|
|
5304
|
+
}, _callee138, this);
|
|
5143
5305
|
}));
|
|
5144
5306
|
}
|
|
5145
5307
|
}, {
|
|
5146
5308
|
key: "get",
|
|
5147
5309
|
value: function get() {
|
|
5148
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5149
|
-
return _regeneratorRuntime().wrap(function
|
|
5150
|
-
while (1) switch (
|
|
5310
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee139() {
|
|
5311
|
+
return _regeneratorRuntime().wrap(function _callee139$(_context139) {
|
|
5312
|
+
while (1) switch (_context139.prev = _context139.next) {
|
|
5151
5313
|
case 0:
|
|
5152
|
-
return
|
|
5314
|
+
return _context139.abrupt("return", this._networkClient.fetchSDK({
|
|
5153
5315
|
url: '/b2b/recovery_codes',
|
|
5154
5316
|
method: 'GET'
|
|
5155
5317
|
}));
|
|
5156
5318
|
case 1:
|
|
5157
5319
|
case "end":
|
|
5158
|
-
return
|
|
5320
|
+
return _context139.stop();
|
|
5159
5321
|
}
|
|
5160
|
-
},
|
|
5322
|
+
}, _callee139, this);
|
|
5161
5323
|
}));
|
|
5162
5324
|
}
|
|
5163
5325
|
}]);
|
|
@@ -5165,16 +5327,16 @@ var HeadlessB2BRecoveryCodesClient = /*#__PURE__*/function () {
|
|
|
5165
5327
|
}();
|
|
5166
5328
|
var HeadlessB2BRBACClient = /*#__PURE__*/function () {
|
|
5167
5329
|
function HeadlessB2BRBACClient(cachedConfig, dynamicConfig, _subscriptionService) {
|
|
5168
|
-
var
|
|
5330
|
+
var _this21 = this;
|
|
5169
5331
|
_classCallCheck(this, HeadlessB2BRBACClient);
|
|
5170
5332
|
this._subscriptionService = _subscriptionService;
|
|
5171
5333
|
this.isAuthorizedSync = function (resourceId, action) {
|
|
5172
5334
|
var _a;
|
|
5173
|
-
return !!((_a =
|
|
5335
|
+
return !!((_a = _this21.cachedPolicy) === null || _a === void 0 ? void 0 : _a.callerIsAuthorized(_this21.roleIds(), resourceId, action));
|
|
5174
5336
|
};
|
|
5175
5337
|
this.isAuthorized = function (resourceId, action) {
|
|
5176
|
-
return
|
|
5177
|
-
return policy.callerIsAuthorized(
|
|
5338
|
+
return _this21.policyPromise.then(function (policy) {
|
|
5339
|
+
return policy.callerIsAuthorized(_this21.roleIds(), resourceId, action);
|
|
5178
5340
|
});
|
|
5179
5341
|
};
|
|
5180
5342
|
this.cachedPolicy = cachedConfig.rbacPolicy ? RBACPolicy.fromJSON(cachedConfig.rbacPolicy) : null;
|
|
@@ -5183,16 +5345,16 @@ var HeadlessB2BRBACClient = /*#__PURE__*/function () {
|
|
|
5183
5345
|
logger.error('Unable to retrieve RBAC policy from servers. Assuming caller has no permissions.');
|
|
5184
5346
|
return new RBACPolicy([], []);
|
|
5185
5347
|
}
|
|
5186
|
-
|
|
5187
|
-
return
|
|
5348
|
+
_this21.cachedPolicy = RBACPolicy.fromJSON(data.rbacPolicy);
|
|
5349
|
+
return _this21.cachedPolicy;
|
|
5188
5350
|
});
|
|
5189
5351
|
}
|
|
5190
5352
|
_createClass(HeadlessB2BRBACClient, [{
|
|
5191
5353
|
key: "allPermissions",
|
|
5192
5354
|
value: function allPermissions() {
|
|
5193
|
-
var
|
|
5355
|
+
var _this22 = this;
|
|
5194
5356
|
return this.policyPromise.then(function (policy) {
|
|
5195
|
-
return policy.allPermissionsForCaller(
|
|
5357
|
+
return policy.allPermissionsForCaller(_this22.roleIds());
|
|
5196
5358
|
});
|
|
5197
5359
|
}
|
|
5198
5360
|
}, {
|
|
@@ -5245,18 +5407,18 @@ var IframeHostClient = /*#__PURE__*/function () {
|
|
|
5245
5407
|
}, {
|
|
5246
5408
|
key: "call",
|
|
5247
5409
|
value: function call(method, args) {
|
|
5248
|
-
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5249
|
-
var
|
|
5410
|
+
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee140() {
|
|
5411
|
+
var _this23 = this;
|
|
5250
5412
|
var frame, channel;
|
|
5251
|
-
return _regeneratorRuntime().wrap(function
|
|
5252
|
-
while (1) switch (
|
|
5413
|
+
return _regeneratorRuntime().wrap(function _callee140$(_context140) {
|
|
5414
|
+
while (1) switch (_context140.prev = _context140.next) {
|
|
5253
5415
|
case 0:
|
|
5254
|
-
|
|
5416
|
+
_context140.next = 2;
|
|
5255
5417
|
return this.frame;
|
|
5256
5418
|
case 2:
|
|
5257
|
-
frame =
|
|
5419
|
+
frame = _context140.sent;
|
|
5258
5420
|
channel = new MessageChannel();
|
|
5259
|
-
return
|
|
5421
|
+
return _context140.abrupt("return", new Promise(function (resolve, reject) {
|
|
5260
5422
|
var _a;
|
|
5261
5423
|
channel.port1.onmessage = function (event) {
|
|
5262
5424
|
var resp = event.data;
|
|
@@ -5271,13 +5433,13 @@ var IframeHostClient = /*#__PURE__*/function () {
|
|
|
5271
5433
|
method: method,
|
|
5272
5434
|
args: args
|
|
5273
5435
|
};
|
|
5274
|
-
(_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message,
|
|
5436
|
+
(_a = frame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, _this23.iframeURL, [channel.port2]);
|
|
5275
5437
|
}));
|
|
5276
5438
|
case 5:
|
|
5277
5439
|
case "end":
|
|
5278
|
-
return
|
|
5440
|
+
return _context140.stop();
|
|
5279
5441
|
}
|
|
5280
|
-
},
|
|
5442
|
+
}, _callee140, this);
|
|
5281
5443
|
}));
|
|
5282
5444
|
}
|
|
5283
5445
|
}]);
|
|
@@ -5292,11 +5454,11 @@ var SearchDataManager = /*#__PURE__*/function () {
|
|
|
5292
5454
|
_createClass(SearchDataManager, [{
|
|
5293
5455
|
key: "searchUser",
|
|
5294
5456
|
value: function searchUser(email) {
|
|
5295
|
-
var
|
|
5457
|
+
var _this25 = this;
|
|
5296
5458
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref7) {
|
|
5297
5459
|
var dfp_telemetry_id = _ref7.dfp_telemetry_id,
|
|
5298
5460
|
captcha_token = _ref7.captcha_token;
|
|
5299
|
-
return
|
|
5461
|
+
return _this25._networkClient.fetchSDK({
|
|
5300
5462
|
url: "/users/search",
|
|
5301
5463
|
method: 'POST',
|
|
5302
5464
|
body: {
|
|
@@ -5327,52 +5489,52 @@ var shouldTryRefresh = function shouldTryRefresh(state) {
|
|
|
5327
5489
|
};
|
|
5328
5490
|
var SessionManager = /*#__PURE__*/function () {
|
|
5329
5491
|
function SessionManager(_subscriptionService, _headlessSessionClient) {
|
|
5330
|
-
var
|
|
5492
|
+
var _this26 = this;
|
|
5331
5493
|
_classCallCheck(this, SessionManager);
|
|
5332
5494
|
this._subscriptionService = _subscriptionService;
|
|
5333
5495
|
this._headlessSessionClient = _headlessSessionClient;
|
|
5334
5496
|
this._onDataChange = function (state) {
|
|
5335
5497
|
if (shouldTryRefresh(state)) {
|
|
5336
|
-
|
|
5498
|
+
_this26.scheduleBackgroundRefresh();
|
|
5337
5499
|
} else {
|
|
5338
|
-
|
|
5500
|
+
_this26.cancelBackgroundRefresh();
|
|
5339
5501
|
}
|
|
5340
5502
|
};
|
|
5341
5503
|
this._reauthenticateWithBackoff = function () {
|
|
5342
|
-
return __awaiter$1(
|
|
5504
|
+
return __awaiter$1(_this26, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee142() {
|
|
5343
5505
|
var count;
|
|
5344
|
-
return _regeneratorRuntime().wrap(function
|
|
5345
|
-
while (1) switch (
|
|
5506
|
+
return _regeneratorRuntime().wrap(function _callee142$(_context142) {
|
|
5507
|
+
while (1) switch (_context142.prev = _context142.next) {
|
|
5346
5508
|
case 0:
|
|
5347
5509
|
count = 0;
|
|
5348
5510
|
case 1:
|
|
5349
|
-
|
|
5350
|
-
|
|
5511
|
+
_context142.prev = 2;
|
|
5512
|
+
_context142.next = 5;
|
|
5351
5513
|
return this._headlessSessionClient.authenticate();
|
|
5352
5514
|
case 5:
|
|
5353
|
-
return
|
|
5515
|
+
return _context142.abrupt("return", _context142.sent);
|
|
5354
5516
|
case 8:
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
if (!SessionManager.isUnrecoverableError(
|
|
5358
|
-
|
|
5517
|
+
_context142.prev = 8;
|
|
5518
|
+
_context142.t0 = _context142["catch"](2);
|
|
5519
|
+
if (!SessionManager.isUnrecoverableError(_context142.t0)) {
|
|
5520
|
+
_context142.next = 12;
|
|
5359
5521
|
break;
|
|
5360
5522
|
}
|
|
5361
|
-
return
|
|
5523
|
+
return _context142.abrupt("return", Promise.reject(_context142.t0));
|
|
5362
5524
|
case 12:
|
|
5363
5525
|
count++;
|
|
5364
|
-
|
|
5526
|
+
_context142.next = 15;
|
|
5365
5527
|
return new Promise(function (done) {
|
|
5366
5528
|
return setTimeout(done, SessionManager.timeoutForAttempt(count));
|
|
5367
5529
|
});
|
|
5368
5530
|
case 15:
|
|
5369
|
-
|
|
5531
|
+
_context142.next = 1;
|
|
5370
5532
|
break;
|
|
5371
5533
|
case 17:
|
|
5372
5534
|
case "end":
|
|
5373
|
-
return
|
|
5535
|
+
return _context142.stop();
|
|
5374
5536
|
}
|
|
5375
|
-
},
|
|
5537
|
+
}, _callee142, this, [[2, 8]]);
|
|
5376
5538
|
}));
|
|
5377
5539
|
};
|
|
5378
5540
|
this.timeout = null;
|
|
@@ -5381,23 +5543,23 @@ var SessionManager = /*#__PURE__*/function () {
|
|
|
5381
5543
|
_createClass(SessionManager, [{
|
|
5382
5544
|
key: "performBackgroundRefresh",
|
|
5383
5545
|
value: function performBackgroundRefresh() {
|
|
5384
|
-
var
|
|
5546
|
+
var _this27 = this;
|
|
5385
5547
|
this._reauthenticateWithBackoff().then(function () {
|
|
5386
|
-
|
|
5548
|
+
_this27.scheduleBackgroundRefresh();
|
|
5387
5549
|
})["catch"](function (error) {
|
|
5388
5550
|
logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
|
|
5389
5551
|
error: error
|
|
5390
5552
|
});
|
|
5391
|
-
|
|
5553
|
+
_this27._subscriptionService.destroySession();
|
|
5392
5554
|
});
|
|
5393
5555
|
}
|
|
5394
5556
|
}, {
|
|
5395
5557
|
key: "scheduleBackgroundRefresh",
|
|
5396
5558
|
value: function scheduleBackgroundRefresh() {
|
|
5397
|
-
var
|
|
5559
|
+
var _this28 = this;
|
|
5398
5560
|
this.cancelBackgroundRefresh();
|
|
5399
5561
|
this.timeout = setTimeout(function () {
|
|
5400
|
-
|
|
5562
|
+
_this28.performBackgroundRefresh();
|
|
5401
5563
|
}, SessionManager.REFRESH_INTERVAL_MS);
|
|
5402
5564
|
}
|
|
5403
5565
|
}, {
|
|
@@ -5426,34 +5588,34 @@ var SessionManager = /*#__PURE__*/function () {
|
|
|
5426
5588
|
}();
|
|
5427
5589
|
SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
|
|
5428
5590
|
var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
|
|
5429
|
-
var
|
|
5591
|
+
var _this29 = this;
|
|
5430
5592
|
_classCallCheck(this, StateChangeClient);
|
|
5431
5593
|
this._subscriptionService = _subscriptionService;
|
|
5432
5594
|
this.emptyState = emptyState;
|
|
5433
5595
|
this.onStateChange = function (callback) {
|
|
5434
|
-
return
|
|
5435
|
-
callback(state !== null && state !== void 0 ? state :
|
|
5596
|
+
return _this29._subscriptionService.subscribeToState(function (state) {
|
|
5597
|
+
callback(state !== null && state !== void 0 ? state : _this29.emptyState);
|
|
5436
5598
|
});
|
|
5437
5599
|
};
|
|
5438
5600
|
});
|
|
5439
5601
|
var WILDCARD_ACTION = '*';
|
|
5440
5602
|
var RBACPolicy = /*#__PURE__*/function () {
|
|
5441
5603
|
function RBACPolicy(roles, resources) {
|
|
5442
|
-
var
|
|
5604
|
+
var _this35 = this;
|
|
5443
5605
|
_classCallCheck(this, RBACPolicy);
|
|
5444
5606
|
this.roles = roles;
|
|
5445
5607
|
this.resources = resources;
|
|
5446
5608
|
this.rolesByID = {};
|
|
5447
5609
|
roles.forEach(function (role) {
|
|
5448
|
-
return
|
|
5610
|
+
return _this35.rolesByID[role.role_id] = role;
|
|
5449
5611
|
});
|
|
5450
5612
|
}
|
|
5451
5613
|
_createClass(RBACPolicy, [{
|
|
5452
5614
|
key: "callerIsAuthorized",
|
|
5453
5615
|
value: function callerIsAuthorized(memberRoles, resourceId, action) {
|
|
5454
|
-
var
|
|
5616
|
+
var _this36 = this;
|
|
5455
5617
|
return !!memberRoles.map(function (roleId) {
|
|
5456
|
-
return
|
|
5618
|
+
return _this36.rolesByID[roleId];
|
|
5457
5619
|
}).filter(function (v) {
|
|
5458
5620
|
return v;
|
|
5459
5621
|
}).flatMap(function (role) {
|
|
@@ -5467,12 +5629,12 @@ var RBACPolicy = /*#__PURE__*/function () {
|
|
|
5467
5629
|
}, {
|
|
5468
5630
|
key: "allPermissionsForCaller",
|
|
5469
5631
|
value: function allPermissionsForCaller(memberRoles) {
|
|
5470
|
-
var
|
|
5632
|
+
var _this37 = this;
|
|
5471
5633
|
var allPermsMap = Object.create(null);
|
|
5472
5634
|
this.resources.forEach(function (resource) {
|
|
5473
5635
|
allPermsMap[resource.resource_id] = {};
|
|
5474
5636
|
resource.actions.forEach(function (action) {
|
|
5475
|
-
allPermsMap[resource.resource_id][action] =
|
|
5637
|
+
allPermsMap[resource.resource_id][action] = _this37.callerIsAuthorized(memberRoles, resource.resource_id, action);
|
|
5476
5638
|
});
|
|
5477
5639
|
});
|
|
5478
5640
|
return allPermsMap;
|
|
@@ -5606,4 +5768,4 @@ var readB2BInternals = function readB2BInternals(obj) {
|
|
|
5606
5768
|
}
|
|
5607
5769
|
return casted[internalSymB2B];
|
|
5608
5770
|
};
|
|
5609
|
-
export {
|
|
5771
|
+
export { SignInWithAppleMisconfigured as $, AuthFlowType as A, B2BMFAProducts as B, COUNTRIES_LIST as C, DEFAULT_SESSION_DURATION_MINUTES as D, EMAIL_REGEX as E, FailedCodeChallengeError as F, MissingUrlError as G, NoBiometricsRegistrationError as H, InternalError as I, JSONDataNotConvertibleToStringError as J, KeyInvalidatedError as K, NoCredentialsPresentError as L, MissingAttestationObjectError as M, NoBiometricsEnrolledError as N, OAuthProviders as O, Products as P, NoCurrentSessionError as Q, PasskeysInvalidEncoding as R, StytchEventType as S, PasskeysMisconfigured as T, PasskeysUnsupportedError as U, RNUIProducts as V, Wallets as W, RandomNumberGenerationFailed as X, SDKAPIUnreachableError as Y, SDKNotConfiguredError as Z, __rest as _, B2BProducts as a, StytchAPISchemaError as a0, StytchAPIUnreachableError as a1, StytchError as a2, StytchSDKAPIError as a3, StytchSDKSchemaError as a4, StytchSDKUsageError as a5, UNRECOVERABLE_ERROR_TYPES as a6, UserCancellationError as a7, UserLockedOutError as a8, errorToStytchError as a9, HeadlessB2BMagicLinksClient as aA, HeadlessB2BSSOClient as aB, HeadlessB2BDiscoveryClient as aC, HeadlessB2BPasswordsClient as aD, HeadlessB2BOTPsClient as aE, HeadlessB2BTOTPsClient as aF, HeadlessB2BRecoveryCodesClient as aG, HeadlessB2BRBACClient as aH, HeadlessB2BSCIMClient as aI, SessionManager as aJ, SearchDataManager as aK, writeB2BInternals as aL, createDeepEqual as aa, getPersistentStorageKey as ab, HeadlessB2BOAuthClient$1 as ac, loadESModule as ad, IframeHostClient as ae, validate as af, hasMultipleCookies as ag, isLocalhost as ah, GOOGLE_ONE_TAP_HOST as ai, GOOGLE_ONE_TAP_SCRIPT_URL as aj, EventLogger as ak, DEFAULT_MAX_BATCH_SIZE as al, DEFAULT_INTERVAL_DURATION_MS as am, createEventId as an, createAppSessionId as ao, createPersistentId as ap, baseFetchSDK as aq, retriableFetchSDK as ar, checkB2BNotSSR as as, checkPublicToken as at, buildFinalConfig as au, StateChangeClient as av, DFPProtectedAuthProvider as aw, HeadlessB2BOrganizationClient as ax, HeadlessB2BSelfClient as ay, HeadlessB2BSessionClient as az, OTPMethods as b, B2BOAuthProviders as c, __awaiter as d, StytchAPIError as e, OneTapPositions as f, debounce as g, StytchSDKError as h, isTestPublicToken as i, checkNotSSR as j, BiometricsFailedError as k, logger as l, BiometricsUnavailableError as m, ChallengeSigningFailedError as n, DeviceCredentialsNotAllowedError as o, FailedToDecryptDataError as p, InvalidAuthorizationCredentialError as q, readB2BInternals as r, InvalidCredentialTypeError as s, InvalidRedirectSchemeError as t, InvalidStartUrlError as u, KeystoreUnavailableError as v, MissingAuthorizationCredentialIDTokenError as w, MissingGoogleClientIDError as x, MissingPKCEError as y, MissingPublicKeyError as z };
|