@stytch/vanilla-js 5.22.3 → 5.22.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 +8 -0
- package/dist/adminPortal/index.esm.js +1 -1
- package/dist/adminPortal/index.js +1 -1
- package/dist/b2b/index.esm.js +3 -3
- package/dist/b2b/index.headless.esm.js +3 -3
- package/dist/b2b/index.headless.js +3 -2
- package/dist/b2b/index.js +3 -2
- package/dist/{extractErrorMessage-CceNQdlW.js → extractErrorMessage-B_b8zyEs.js} +1 -1
- package/dist/{extractErrorMessage-CafCL2m8.js → extractErrorMessage-CV4jfIZF.js} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +42 -41
- package/dist/index.headless.js +42 -40
- package/dist/index.js +1 -1
- package/dist/{internal-az9hLwxx.js → internal-67Oevzu4.js} +46 -44
- package/dist/{internal-5q6em7Zx.js → internal-BtI2_suI.js} +46 -45
- package/package.json +2 -2
|
@@ -648,12 +648,20 @@ var InvalidPrivateKeyLength = /*#__PURE__*/function (_StytchSDKError35) {
|
|
|
648
648
|
_inherits$1(InvalidPrivateKeyLength, _StytchSDKError35);
|
|
649
649
|
return _createClass$1(InvalidPrivateKeyLength);
|
|
650
650
|
}(StytchSDKError);
|
|
651
|
-
var
|
|
651
|
+
var BiometricRegistrationIdIsNullOrBlank = /*#__PURE__*/function (_StytchSDKError36) {
|
|
652
|
+
function BiometricRegistrationIdIsNullOrBlank() {
|
|
653
|
+
_classCallCheck$1(this, BiometricRegistrationIdIsNullOrBlank);
|
|
654
|
+
return _callSuper$1(this, BiometricRegistrationIdIsNullOrBlank, ['BiometricRegistrationIdIsNullOrBlank', 'Attempted to set a blank or null biometric registration ID. This is not allowed, and indicates no registration was created on the server. Consider deleting any local keys that may have been generated.']);
|
|
655
|
+
}
|
|
656
|
+
_inherits$1(BiometricRegistrationIdIsNullOrBlank, _StytchSDKError36);
|
|
657
|
+
return _createClass$1(BiometricRegistrationIdIsNullOrBlank);
|
|
658
|
+
}(StytchSDKError);
|
|
659
|
+
var IDPOAuthFlowMissingParamError = /*#__PURE__*/function (_StytchSDKError37) {
|
|
652
660
|
function IDPOAuthFlowMissingParamError(details) {
|
|
653
661
|
_classCallCheck$1(this, IDPOAuthFlowMissingParamError);
|
|
654
662
|
return _callSuper$1(this, IDPOAuthFlowMissingParamError, ['IDPOAuthFlowMissingParamError', details]);
|
|
655
663
|
}
|
|
656
|
-
_inherits$1(IDPOAuthFlowMissingParamError,
|
|
664
|
+
_inherits$1(IDPOAuthFlowMissingParamError, _StytchSDKError37);
|
|
657
665
|
return _createClass$1(IDPOAuthFlowMissingParamError);
|
|
658
666
|
}(StytchSDKError);
|
|
659
667
|
function errorToStytchError(error) {
|
|
@@ -734,6 +742,8 @@ function errorToStytchError(error) {
|
|
|
734
742
|
return new MissingCipherIv();
|
|
735
743
|
case 'invalid_private_key_length':
|
|
736
744
|
return new InvalidPrivateKeyLength();
|
|
745
|
+
case 'biometric_registration_id_is_null_or_blank':
|
|
746
|
+
return new BiometricRegistrationIdIsNullOrBlank();
|
|
737
747
|
default:
|
|
738
748
|
return new InternalError(error);
|
|
739
749
|
}
|
|
@@ -2252,15 +2262,6 @@ var ErrorMarshaller = /*#__PURE__*/function () {
|
|
|
2252
2262
|
_classCallCheck(this, ErrorMarshaller);
|
|
2253
2263
|
}
|
|
2254
2264
|
return _createClass(ErrorMarshaller, null, [{
|
|
2255
|
-
key: "marshall",
|
|
2256
|
-
value: function marshall(error) {
|
|
2257
|
-
return Object.assign(Object.assign({}, error), {
|
|
2258
|
-
name: error.name,
|
|
2259
|
-
message: error.message,
|
|
2260
|
-
stack: error.stack
|
|
2261
|
-
});
|
|
2262
|
-
}
|
|
2263
|
-
}, {
|
|
2264
2265
|
key: "inflate",
|
|
2265
2266
|
value: function inflate(ErrorClass, ErrorData) {
|
|
2266
2267
|
var err = new ErrorClass(ErrorData);
|
|
@@ -2400,7 +2401,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2400
2401
|
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
2401
2402
|
while (1) switch (_context62.prev = _context62.next) {
|
|
2402
2403
|
case 0:
|
|
2403
|
-
validate('stytch.magicLinks.email.
|
|
2404
|
+
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);
|
|
2404
2405
|
return _context62.abrupt("return", this._networkClient.fetchSDK({
|
|
2405
2406
|
url: '/b2b/magic_links/email/invite',
|
|
2406
2407
|
body: data,
|
|
@@ -2419,7 +2420,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2419
2420
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
2420
2421
|
while (1) switch (_context63.prev = _context63.next) {
|
|
2421
2422
|
case 0:
|
|
2422
|
-
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);
|
|
2423
|
+
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);
|
|
2423
2424
|
_context63.next = 3;
|
|
2424
2425
|
return this.getCodeChallenge();
|
|
2425
2426
|
case 3:
|
|
@@ -2446,7 +2447,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2446
2447
|
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
2447
2448
|
while (1) switch (_context64.prev = _context64.next) {
|
|
2448
2449
|
case 0:
|
|
2449
|
-
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);
|
|
2450
|
+
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);
|
|
2450
2451
|
_context64.next = 3;
|
|
2451
2452
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2452
2453
|
case 3:
|
|
@@ -4943,7 +4944,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4943
4944
|
return _regeneratorRuntime().wrap(function _callee135$(_context135) {
|
|
4944
4945
|
while (1) switch (_context135.prev = _context135.next) {
|
|
4945
4946
|
case 0:
|
|
4946
|
-
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);
|
|
4947
|
+
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);
|
|
4947
4948
|
_context135.next = 3;
|
|
4948
4949
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4949
4950
|
case 3:
|
|
@@ -5028,7 +5029,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
5028
5029
|
return _regeneratorRuntime().wrap(function _callee137$(_context137) {
|
|
5029
5030
|
while (1) switch (_context137.prev = _context137.next) {
|
|
5030
5031
|
case 0:
|
|
5031
|
-
validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale);
|
|
5032
|
+
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);
|
|
5032
5033
|
_context137.next = 3;
|
|
5033
5034
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5034
5035
|
case 3:
|
|
@@ -5540,11 +5541,11 @@ var SearchDataManager = /*#__PURE__*/function () {
|
|
|
5540
5541
|
return _createClass(SearchDataManager, [{
|
|
5541
5542
|
key: "searchUser",
|
|
5542
5543
|
value: function searchUser(email) {
|
|
5543
|
-
var
|
|
5544
|
+
var _this29 = this;
|
|
5544
5545
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref10) {
|
|
5545
5546
|
var dfp_telemetry_id = _ref10.dfp_telemetry_id,
|
|
5546
5547
|
captcha_token = _ref10.captcha_token;
|
|
5547
|
-
return
|
|
5548
|
+
return _this29._networkClient.fetchSDK({
|
|
5548
5549
|
url: "/users/search",
|
|
5549
5550
|
method: 'POST',
|
|
5550
5551
|
body: {
|
|
@@ -5603,53 +5604,53 @@ var SessionManagerRegistry = /*#__PURE__*/function () {
|
|
|
5603
5604
|
}();
|
|
5604
5605
|
var SessionManager = /*#__PURE__*/function () {
|
|
5605
5606
|
function SessionManager(_subscriptionService, _headlessSessionClient, _publicToken) {
|
|
5606
|
-
var
|
|
5607
|
+
var _this30 = this;
|
|
5607
5608
|
_classCallCheck(this, SessionManager);
|
|
5608
5609
|
this._subscriptionService = _subscriptionService;
|
|
5609
5610
|
this._headlessSessionClient = _headlessSessionClient;
|
|
5610
5611
|
this._publicToken = _publicToken;
|
|
5611
5612
|
this._onDataChange = function (state) {
|
|
5612
5613
|
if (shouldTryRefresh(state)) {
|
|
5613
|
-
|
|
5614
|
+
_this30.scheduleBackgroundRefresh();
|
|
5614
5615
|
} else {
|
|
5615
|
-
|
|
5616
|
+
_this30.cancelBackgroundRefresh();
|
|
5616
5617
|
}
|
|
5617
5618
|
};
|
|
5618
5619
|
this._reauthenticateWithBackoff = function () {
|
|
5619
|
-
return __awaiter$1(
|
|
5620
|
+
return __awaiter$1(_this30, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee146() {
|
|
5620
5621
|
var count;
|
|
5621
|
-
return _regeneratorRuntime().wrap(function
|
|
5622
|
-
while (1) switch (
|
|
5622
|
+
return _regeneratorRuntime().wrap(function _callee146$(_context146) {
|
|
5623
|
+
while (1) switch (_context146.prev = _context146.next) {
|
|
5623
5624
|
case 0:
|
|
5624
5625
|
count = 0;
|
|
5625
5626
|
case 1:
|
|
5626
|
-
|
|
5627
|
-
|
|
5627
|
+
_context146.prev = 2;
|
|
5628
|
+
_context146.next = 5;
|
|
5628
5629
|
return this._headlessSessionClient.authenticate();
|
|
5629
5630
|
case 5:
|
|
5630
|
-
return
|
|
5631
|
+
return _context146.abrupt("return", _context146.sent);
|
|
5631
5632
|
case 8:
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
if (!SessionManager.isUnrecoverableError(
|
|
5635
|
-
|
|
5633
|
+
_context146.prev = 8;
|
|
5634
|
+
_context146.t0 = _context146["catch"](2);
|
|
5635
|
+
if (!SessionManager.isUnrecoverableError(_context146.t0)) {
|
|
5636
|
+
_context146.next = 12;
|
|
5636
5637
|
break;
|
|
5637
5638
|
}
|
|
5638
|
-
return
|
|
5639
|
+
return _context146.abrupt("return", Promise.reject(_context146.t0));
|
|
5639
5640
|
case 12:
|
|
5640
5641
|
count++;
|
|
5641
|
-
|
|
5642
|
+
_context146.next = 15;
|
|
5642
5643
|
return new Promise(function (done) {
|
|
5643
5644
|
return setTimeout(done, SessionManager.timeoutForAttempt(count));
|
|
5644
5645
|
});
|
|
5645
5646
|
case 15:
|
|
5646
|
-
|
|
5647
|
+
_context146.next = 1;
|
|
5647
5648
|
break;
|
|
5648
5649
|
case 17:
|
|
5649
5650
|
case "end":
|
|
5650
|
-
return
|
|
5651
|
+
return _context146.stop();
|
|
5651
5652
|
}
|
|
5652
|
-
},
|
|
5653
|
+
}, _callee146, this, [[2, 8]]);
|
|
5653
5654
|
}));
|
|
5654
5655
|
};
|
|
5655
5656
|
this.timeout = null;
|
|
@@ -5668,24 +5669,24 @@ var SessionManager = /*#__PURE__*/function () {
|
|
|
5668
5669
|
}, {
|
|
5669
5670
|
key: "performBackgroundRefresh",
|
|
5670
5671
|
value: function performBackgroundRefresh() {
|
|
5671
|
-
var
|
|
5672
|
+
var _this31 = this;
|
|
5672
5673
|
this._reauthenticateWithBackoff().then(function () {
|
|
5673
|
-
|
|
5674
|
+
_this31.scheduleBackgroundRefresh();
|
|
5674
5675
|
})["catch"](function (error) {
|
|
5675
5676
|
logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
|
|
5676
5677
|
error: error
|
|
5677
5678
|
});
|
|
5678
|
-
|
|
5679
|
+
_this31._subscriptionService.destroySession();
|
|
5679
5680
|
});
|
|
5680
5681
|
}
|
|
5681
5682
|
}, {
|
|
5682
5683
|
key: "scheduleBackgroundRefresh",
|
|
5683
5684
|
value: function scheduleBackgroundRefresh() {
|
|
5684
|
-
var
|
|
5685
|
+
var _this32 = this;
|
|
5685
5686
|
this.cancelBackgroundRefresh();
|
|
5686
5687
|
this.register();
|
|
5687
5688
|
this.timeout = setTimeout(function () {
|
|
5688
|
-
|
|
5689
|
+
_this32.performBackgroundRefresh();
|
|
5689
5690
|
}, SessionManager.REFRESH_INTERVAL_MS);
|
|
5690
5691
|
}
|
|
5691
5692
|
}, {
|
|
@@ -5715,13 +5716,13 @@ var SessionManager = /*#__PURE__*/function () {
|
|
|
5715
5716
|
SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
|
|
5716
5717
|
SessionManager.registry = new SessionManagerRegistry();
|
|
5717
5718
|
var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
|
|
5718
|
-
var
|
|
5719
|
+
var _this33 = this;
|
|
5719
5720
|
_classCallCheck(this, StateChangeClient);
|
|
5720
5721
|
this._subscriptionService = _subscriptionService;
|
|
5721
5722
|
this.emptyState = emptyState;
|
|
5722
5723
|
this.onStateChange = function (callback) {
|
|
5723
|
-
return
|
|
5724
|
-
callback(state !== null && state !== void 0 ? state :
|
|
5724
|
+
return _this33._subscriptionService.subscribeToState(function (state) {
|
|
5725
|
+
callback(state !== null && state !== void 0 ? state : _this33.emptyState);
|
|
5725
5726
|
});
|
|
5726
5727
|
};
|
|
5727
5728
|
});
|
|
@@ -5848,6 +5849,7 @@ var readB2BInternals = function readB2BInternals(obj) {
|
|
|
5848
5849
|
}
|
|
5849
5850
|
return casted[internalSymB2B];
|
|
5850
5851
|
};
|
|
5852
|
+
exports.BiometricRegistrationIdIsNullOrBlank = BiometricRegistrationIdIsNullOrBlank;
|
|
5851
5853
|
exports.BiometricsAlreadyEnrolledError = BiometricsAlreadyEnrolledError;
|
|
5852
5854
|
exports.BiometricsFailedError = BiometricsFailedError;
|
|
5853
5855
|
exports.BiometricsUnavailableError = BiometricsUnavailableError;
|
|
@@ -646,12 +646,20 @@ var InvalidPrivateKeyLength = /*#__PURE__*/function (_StytchSDKError35) {
|
|
|
646
646
|
_inherits$1(InvalidPrivateKeyLength, _StytchSDKError35);
|
|
647
647
|
return _createClass$1(InvalidPrivateKeyLength);
|
|
648
648
|
}(StytchSDKError);
|
|
649
|
-
var
|
|
649
|
+
var BiometricRegistrationIdIsNullOrBlank = /*#__PURE__*/function (_StytchSDKError36) {
|
|
650
|
+
function BiometricRegistrationIdIsNullOrBlank() {
|
|
651
|
+
_classCallCheck$1(this, BiometricRegistrationIdIsNullOrBlank);
|
|
652
|
+
return _callSuper$1(this, BiometricRegistrationIdIsNullOrBlank, ['BiometricRegistrationIdIsNullOrBlank', 'Attempted to set a blank or null biometric registration ID. This is not allowed, and indicates no registration was created on the server. Consider deleting any local keys that may have been generated.']);
|
|
653
|
+
}
|
|
654
|
+
_inherits$1(BiometricRegistrationIdIsNullOrBlank, _StytchSDKError36);
|
|
655
|
+
return _createClass$1(BiometricRegistrationIdIsNullOrBlank);
|
|
656
|
+
}(StytchSDKError);
|
|
657
|
+
var IDPOAuthFlowMissingParamError = /*#__PURE__*/function (_StytchSDKError37) {
|
|
650
658
|
function IDPOAuthFlowMissingParamError(details) {
|
|
651
659
|
_classCallCheck$1(this, IDPOAuthFlowMissingParamError);
|
|
652
660
|
return _callSuper$1(this, IDPOAuthFlowMissingParamError, ['IDPOAuthFlowMissingParamError', details]);
|
|
653
661
|
}
|
|
654
|
-
_inherits$1(IDPOAuthFlowMissingParamError,
|
|
662
|
+
_inherits$1(IDPOAuthFlowMissingParamError, _StytchSDKError37);
|
|
655
663
|
return _createClass$1(IDPOAuthFlowMissingParamError);
|
|
656
664
|
}(StytchSDKError);
|
|
657
665
|
function errorToStytchError(error) {
|
|
@@ -732,6 +740,8 @@ function errorToStytchError(error) {
|
|
|
732
740
|
return new MissingCipherIv();
|
|
733
741
|
case 'invalid_private_key_length':
|
|
734
742
|
return new InvalidPrivateKeyLength();
|
|
743
|
+
case 'biometric_registration_id_is_null_or_blank':
|
|
744
|
+
return new BiometricRegistrationIdIsNullOrBlank();
|
|
735
745
|
default:
|
|
736
746
|
return new InternalError(error);
|
|
737
747
|
}
|
|
@@ -2250,15 +2260,6 @@ var ErrorMarshaller = /*#__PURE__*/function () {
|
|
|
2250
2260
|
_classCallCheck(this, ErrorMarshaller);
|
|
2251
2261
|
}
|
|
2252
2262
|
return _createClass(ErrorMarshaller, null, [{
|
|
2253
|
-
key: "marshall",
|
|
2254
|
-
value: function marshall(error) {
|
|
2255
|
-
return Object.assign(Object.assign({}, error), {
|
|
2256
|
-
name: error.name,
|
|
2257
|
-
message: error.message,
|
|
2258
|
-
stack: error.stack
|
|
2259
|
-
});
|
|
2260
|
-
}
|
|
2261
|
-
}, {
|
|
2262
2263
|
key: "inflate",
|
|
2263
2264
|
value: function inflate(ErrorClass, ErrorData) {
|
|
2264
2265
|
var err = new ErrorClass(ErrorData);
|
|
@@ -2398,7 +2399,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2398
2399
|
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
|
2399
2400
|
while (1) switch (_context62.prev = _context62.next) {
|
|
2400
2401
|
case 0:
|
|
2401
|
-
validate('stytch.magicLinks.email.
|
|
2402
|
+
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);
|
|
2402
2403
|
return _context62.abrupt("return", this._networkClient.fetchSDK({
|
|
2403
2404
|
url: '/b2b/magic_links/email/invite',
|
|
2404
2405
|
body: data,
|
|
@@ -2417,7 +2418,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2417
2418
|
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
|
2418
2419
|
while (1) switch (_context63.prev = _context63.next) {
|
|
2419
2420
|
case 0:
|
|
2420
|
-
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);
|
|
2421
|
+
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);
|
|
2421
2422
|
_context63.next = 3;
|
|
2422
2423
|
return this.getCodeChallenge();
|
|
2423
2424
|
case 3:
|
|
@@ -2444,7 +2445,7 @@ var HeadlessB2BMagicLinksClient = /*#__PURE__*/function () {
|
|
|
2444
2445
|
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
|
2445
2446
|
while (1) switch (_context64.prev = _context64.next) {
|
|
2446
2447
|
case 0:
|
|
2447
|
-
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);
|
|
2448
|
+
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);
|
|
2448
2449
|
_context64.next = 3;
|
|
2449
2450
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
2450
2451
|
case 3:
|
|
@@ -4941,7 +4942,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
4941
4942
|
return _regeneratorRuntime().wrap(function _callee135$(_context135) {
|
|
4942
4943
|
while (1) switch (_context135.prev = _context135.next) {
|
|
4943
4944
|
case 0:
|
|
4944
|
-
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);
|
|
4945
|
+
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);
|
|
4945
4946
|
_context135.next = 3;
|
|
4946
4947
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
4947
4948
|
case 3:
|
|
@@ -5026,7 +5027,7 @@ var HeadlessB2BOTPsClient = /*#__PURE__*/_createClass(function HeadlessB2BOTPsCl
|
|
|
5026
5027
|
return _regeneratorRuntime().wrap(function _callee137$(_context137) {
|
|
5027
5028
|
while (1) switch (_context137.prev = _context137.next) {
|
|
5028
5029
|
case 0:
|
|
5029
|
-
validate('stytch.otps.email.discovery.send').isString('email_address', data.email_address).isOptionalString('login_template_id', data.login_template_id).isOptionalString('locale', data.locale);
|
|
5030
|
+
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);
|
|
5030
5031
|
_context137.next = 3;
|
|
5031
5032
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();
|
|
5032
5033
|
case 3:
|
|
@@ -5538,11 +5539,11 @@ var SearchDataManager = /*#__PURE__*/function () {
|
|
|
5538
5539
|
return _createClass(SearchDataManager, [{
|
|
5539
5540
|
key: "searchUser",
|
|
5540
5541
|
value: function searchUser(email) {
|
|
5541
|
-
var
|
|
5542
|
+
var _this29 = this;
|
|
5542
5543
|
return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(function (_ref10) {
|
|
5543
5544
|
var dfp_telemetry_id = _ref10.dfp_telemetry_id,
|
|
5544
5545
|
captcha_token = _ref10.captcha_token;
|
|
5545
|
-
return
|
|
5546
|
+
return _this29._networkClient.fetchSDK({
|
|
5546
5547
|
url: "/users/search",
|
|
5547
5548
|
method: 'POST',
|
|
5548
5549
|
body: {
|
|
@@ -5601,53 +5602,53 @@ var SessionManagerRegistry = /*#__PURE__*/function () {
|
|
|
5601
5602
|
}();
|
|
5602
5603
|
var SessionManager = /*#__PURE__*/function () {
|
|
5603
5604
|
function SessionManager(_subscriptionService, _headlessSessionClient, _publicToken) {
|
|
5604
|
-
var
|
|
5605
|
+
var _this30 = this;
|
|
5605
5606
|
_classCallCheck(this, SessionManager);
|
|
5606
5607
|
this._subscriptionService = _subscriptionService;
|
|
5607
5608
|
this._headlessSessionClient = _headlessSessionClient;
|
|
5608
5609
|
this._publicToken = _publicToken;
|
|
5609
5610
|
this._onDataChange = function (state) {
|
|
5610
5611
|
if (shouldTryRefresh(state)) {
|
|
5611
|
-
|
|
5612
|
+
_this30.scheduleBackgroundRefresh();
|
|
5612
5613
|
} else {
|
|
5613
|
-
|
|
5614
|
+
_this30.cancelBackgroundRefresh();
|
|
5614
5615
|
}
|
|
5615
5616
|
};
|
|
5616
5617
|
this._reauthenticateWithBackoff = function () {
|
|
5617
|
-
return __awaiter$1(
|
|
5618
|
+
return __awaiter$1(_this30, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee146() {
|
|
5618
5619
|
var count;
|
|
5619
|
-
return _regeneratorRuntime().wrap(function
|
|
5620
|
-
while (1) switch (
|
|
5620
|
+
return _regeneratorRuntime().wrap(function _callee146$(_context146) {
|
|
5621
|
+
while (1) switch (_context146.prev = _context146.next) {
|
|
5621
5622
|
case 0:
|
|
5622
5623
|
count = 0;
|
|
5623
5624
|
case 1:
|
|
5624
|
-
|
|
5625
|
-
|
|
5625
|
+
_context146.prev = 2;
|
|
5626
|
+
_context146.next = 5;
|
|
5626
5627
|
return this._headlessSessionClient.authenticate();
|
|
5627
5628
|
case 5:
|
|
5628
|
-
return
|
|
5629
|
+
return _context146.abrupt("return", _context146.sent);
|
|
5629
5630
|
case 8:
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
if (!SessionManager.isUnrecoverableError(
|
|
5633
|
-
|
|
5631
|
+
_context146.prev = 8;
|
|
5632
|
+
_context146.t0 = _context146["catch"](2);
|
|
5633
|
+
if (!SessionManager.isUnrecoverableError(_context146.t0)) {
|
|
5634
|
+
_context146.next = 12;
|
|
5634
5635
|
break;
|
|
5635
5636
|
}
|
|
5636
|
-
return
|
|
5637
|
+
return _context146.abrupt("return", Promise.reject(_context146.t0));
|
|
5637
5638
|
case 12:
|
|
5638
5639
|
count++;
|
|
5639
|
-
|
|
5640
|
+
_context146.next = 15;
|
|
5640
5641
|
return new Promise(function (done) {
|
|
5641
5642
|
return setTimeout(done, SessionManager.timeoutForAttempt(count));
|
|
5642
5643
|
});
|
|
5643
5644
|
case 15:
|
|
5644
|
-
|
|
5645
|
+
_context146.next = 1;
|
|
5645
5646
|
break;
|
|
5646
5647
|
case 17:
|
|
5647
5648
|
case "end":
|
|
5648
|
-
return
|
|
5649
|
+
return _context146.stop();
|
|
5649
5650
|
}
|
|
5650
|
-
},
|
|
5651
|
+
}, _callee146, this, [[2, 8]]);
|
|
5651
5652
|
}));
|
|
5652
5653
|
};
|
|
5653
5654
|
this.timeout = null;
|
|
@@ -5666,24 +5667,24 @@ var SessionManager = /*#__PURE__*/function () {
|
|
|
5666
5667
|
}, {
|
|
5667
5668
|
key: "performBackgroundRefresh",
|
|
5668
5669
|
value: function performBackgroundRefresh() {
|
|
5669
|
-
var
|
|
5670
|
+
var _this31 = this;
|
|
5670
5671
|
this._reauthenticateWithBackoff().then(function () {
|
|
5671
|
-
|
|
5672
|
+
_this31.scheduleBackgroundRefresh();
|
|
5672
5673
|
})["catch"](function (error) {
|
|
5673
5674
|
logger.warn('Session background refresh failed. Signalling to app that user is logged out.', {
|
|
5674
5675
|
error: error
|
|
5675
5676
|
});
|
|
5676
|
-
|
|
5677
|
+
_this31._subscriptionService.destroySession();
|
|
5677
5678
|
});
|
|
5678
5679
|
}
|
|
5679
5680
|
}, {
|
|
5680
5681
|
key: "scheduleBackgroundRefresh",
|
|
5681
5682
|
value: function scheduleBackgroundRefresh() {
|
|
5682
|
-
var
|
|
5683
|
+
var _this32 = this;
|
|
5683
5684
|
this.cancelBackgroundRefresh();
|
|
5684
5685
|
this.register();
|
|
5685
5686
|
this.timeout = setTimeout(function () {
|
|
5686
|
-
|
|
5687
|
+
_this32.performBackgroundRefresh();
|
|
5687
5688
|
}, SessionManager.REFRESH_INTERVAL_MS);
|
|
5688
5689
|
}
|
|
5689
5690
|
}, {
|
|
@@ -5713,13 +5714,13 @@ var SessionManager = /*#__PURE__*/function () {
|
|
|
5713
5714
|
SessionManager.REFRESH_INTERVAL_MS = 1000 * 60 * 3;
|
|
5714
5715
|
SessionManager.registry = new SessionManagerRegistry();
|
|
5715
5716
|
var StateChangeClient = /*#__PURE__*/_createClass(function StateChangeClient(_subscriptionService, emptyState) {
|
|
5716
|
-
var
|
|
5717
|
+
var _this33 = this;
|
|
5717
5718
|
_classCallCheck(this, StateChangeClient);
|
|
5718
5719
|
this._subscriptionService = _subscriptionService;
|
|
5719
5720
|
this.emptyState = emptyState;
|
|
5720
5721
|
this.onStateChange = function (callback) {
|
|
5721
|
-
return
|
|
5722
|
-
callback(state !== null && state !== void 0 ? state :
|
|
5722
|
+
return _this33._subscriptionService.subscribeToState(function (state) {
|
|
5723
|
+
callback(state !== null && state !== void 0 ? state : _this33.emptyState);
|
|
5723
5724
|
});
|
|
5724
5725
|
};
|
|
5725
5726
|
});
|
|
@@ -5846,4 +5847,4 @@ var readB2BInternals = function readB2BInternals(obj) {
|
|
|
5846
5847
|
}
|
|
5847
5848
|
return casted[internalSymB2B];
|
|
5848
5849
|
};
|
|
5849
|
-
export {
|
|
5850
|
+
export { PasskeysMisconfigured as $, AuthFlowType as A, B2BMFAProducts as B, COUNTRIES_LIST as C, DEFAULT_SESSION_DURATION_MINUTES as D, EMAIL_REGEX as E, FailedCodeChallengeError as F, MissingAuthorizationCredentialIDTokenError as G, MissingCipherIv as H, IDPOAuthFlowMissingParamError as I, JSONDataNotConvertibleToStringError as J, KeyInvalidatedError as K, MissingGoogleClientIDError as L, MissingAttestationObjectError as M, NoCurrentSessionError as N, OAuthProviders as O, Products as P, MissingPKCEError as Q, RedirectURLType as R, StytchEventType as S, MissingPublicKeyError as T, MissingUrlError as U, NoBiometricsEnrolledError as V, Wallets as W, NoBiometricsRegistrationError as X, NoCredentialsPresentError as Y, PasskeysInvalidEncoding as Z, __rest as _, B2BProducts as a, PasskeysUnsupportedError as a0, RNUIProducts as a1, RandomNumberGenerationFailed as a2, SDKAPIUnreachableError as a3, SDKNotConfiguredError as a4, SignInWithAppleMisconfigured as a5, StytchAPISchemaError as a6, StytchAPIUnreachableError as a7, StytchError as a8, StytchSDKAPIError as a9, checkPublicToken as aA, buildFinalConfig as aB, StateChangeClient as aC, DFPProtectedAuthProvider as aD, HeadlessB2BOrganizationClient as aE, HeadlessB2BSelfClient as aF, HeadlessB2BSessionClient as aG, HeadlessB2BMagicLinksClient as aH, HeadlessB2BSSOClient as aI, HeadlessB2BDiscoveryClient as aJ, HeadlessB2BPasswordsClient as aK, HeadlessB2BOTPsClient as aL, HeadlessB2BTOTPsClient as aM, HeadlessB2BRecoveryCodesClient as aN, HeadlessB2BRBACClient as aO, HeadlessB2BSCIMClient as aP, HeadlessB2BImpersonationClient as aQ, SessionManager as aR, SearchDataManager as aS, VERTICAL_CONSUMER as aT, writeB2BInternals as aU, StytchSDKSchemaError as aa, StytchSDKUsageError as ab, UNRECOVERABLE_ERROR_TYPES as ac, UserCancellationError as ad, UserLockedOutError as ae, errorToStytchError as af, createDeepEqual as ag, getPersistentStorageKey as ah, loadESModule as ai, IframeHostClient 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, baseSubmitFormSDK as ar, retriableFetchSDK as as, validate as at, hasMultipleCookies as au, isLocalhost as av, HeadlessB2BOAuthClient$1 as aw, DisabledDFPProtectedAuthProvider as ax, GOOGLE_ONE_TAP_HOST as ay, GOOGLE_ONE_TAP_SCRIPT_URL 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, checkB2BNotSSR as j, BiometricRegistrationIdIsNullOrBlank as k, logger as l, BiometricsAlreadyEnrolledError as m, BiometricsFailedError as n, BiometricsUnavailableError as o, ChallengeSigningFailedError as p, DeviceCredentialsNotAllowedError as q, readB2BInternals as r, FailedToDecryptDataError as s, InternalError as t, InvalidAuthorizationCredentialError as u, InvalidCredentialTypeError as v, InvalidPrivateKeyLength as w, InvalidRedirectSchemeError as x, InvalidStartUrlError as y, KeystoreUnavailableError as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/vanilla-js",
|
|
3
|
-
"version": "5.22.
|
|
3
|
+
"version": "5.22.4",
|
|
4
4
|
"description": "Stytch's official Javascript Client Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"hoistingLimits": "workspaces"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@stytch/core": "2.
|
|
42
|
+
"@stytch/core": "2.48.0",
|
|
43
43
|
"@types/google-one-tap": "^1.2.0",
|
|
44
44
|
"type-fest": "4.15.0"
|
|
45
45
|
},
|