@stytch/vanilla-js 5.21.0 → 5.21.1
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 +7 -0
- package/README.md +6 -5
- package/dist/b2b/index.esm.js +17 -11
- package/dist/b2b/index.headless.esm.js +1 -1
- package/dist/b2b/index.headless.js +1 -1
- package/dist/b2b/index.js +17 -11
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +1 -1
- package/dist/index.headless.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -74,22 +74,23 @@ stytch.magicLinks.email.loginOrSignup({
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
// Render prebuilt UI
|
|
77
|
-
stytch.
|
|
77
|
+
stytch.mount({
|
|
78
78
|
elementId: '#magic-link',
|
|
79
79
|
config: {
|
|
80
|
+
authFlowType: 'Discovery',
|
|
80
81
|
products: ['emailMagicLinks', 'oauth'],
|
|
81
82
|
emailMagicLinksOptions: {
|
|
82
83
|
loginRedirectURL: 'https://example.com/authenticate',
|
|
83
|
-
loginExpirationMinutes: 30,
|
|
84
84
|
signupRedirectURL: 'https://example.com/authenticate',
|
|
85
|
-
signupExpirationMinutes: 30,
|
|
86
|
-
createUserAsPending: true,
|
|
87
85
|
},
|
|
88
86
|
oauthOptions: {
|
|
89
87
|
providers: [{ type: 'google' }, { type: 'microsoft' }],
|
|
90
88
|
loginRedirectURL: 'https://example.com/authenticate',
|
|
91
89
|
signupRedirectURL: 'https://example.com/authenticate',
|
|
92
90
|
},
|
|
91
|
+
sessionOptions: {
|
|
92
|
+
sessionDurationMinutes: 60,
|
|
93
|
+
},
|
|
93
94
|
},
|
|
94
95
|
});
|
|
95
96
|
```
|
|
@@ -111,7 +112,7 @@ stytch.magicLinks.email.loginOrSignup({
|
|
|
111
112
|
```
|
|
112
113
|
|
|
113
114
|
For more information on how to use the Stytch SDK, please refer to the
|
|
114
|
-
[docs](https://stytch.com/docs/
|
|
115
|
+
[docs](https://stytch.com/docs/sdks).
|
|
115
116
|
|
|
116
117
|
## See Also
|
|
117
118
|
|
package/dist/b2b/index.esm.js
CHANGED
|
@@ -1867,15 +1867,28 @@ var PasswordUseButton = function PasswordUseButton(_ref50) {
|
|
|
1867
1867
|
onClick: handleUsePassword
|
|
1868
1868
|
}, "Use a password instead"));
|
|
1869
1869
|
};
|
|
1870
|
+
var extractErrorType = function extractErrorType(error) {
|
|
1871
|
+
if (error && _typeof(error) === 'object') {
|
|
1872
|
+
if ('error_type' in error && typeof error.error_type === 'string') {
|
|
1873
|
+
return error.error_type;
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1877
|
+
var extractEmailSendErrorMessage = function extractEmailSendErrorMessage(error) {
|
|
1878
|
+
var errorType = extractErrorType(error);
|
|
1879
|
+
if (errorType === 'inactive_email') {
|
|
1880
|
+
return 'The email address is marked as inactive. Please try another email address, or contact your admin if you think this is a mistake.';
|
|
1881
|
+
}
|
|
1882
|
+
return 'We were unable to send a passcode to the entered email address. Please try another email address, or contact your admin if you think this is a mistake.';
|
|
1883
|
+
};
|
|
1870
1884
|
var JIT_PROVISIONING_ERRORS = ['email_jit_provisioning_not_allowed', 'invalid_email_for_jit_provisioning'];
|
|
1871
1885
|
var parseErrorMessage = function parseErrorMessage(error, _ref51) {
|
|
1872
1886
|
var email = _ref51.email,
|
|
1873
1887
|
org = _ref51.org;
|
|
1874
1888
|
if (JIT_PROVISIONING_ERRORS.includes(error.error_type)) {
|
|
1875
1889
|
return "".concat(email, " does not have access to ").concat(org, ". If you think this is a mistake, contact your admin");
|
|
1876
|
-
} else {
|
|
1877
|
-
return error.error_message;
|
|
1878
1890
|
}
|
|
1891
|
+
return extractEmailSendErrorMessage(error);
|
|
1879
1892
|
};
|
|
1880
1893
|
var EmailForm = function EmailForm(_ref52) {
|
|
1881
1894
|
var showPasswordButton = _ref52.showPasswordButton;
|
|
@@ -2089,7 +2102,7 @@ var EmailDiscoveryForm = function EmailDiscoveryForm(_ref53) {
|
|
|
2089
2102
|
email: email,
|
|
2090
2103
|
setEmail: setEmail
|
|
2091
2104
|
}), error && /*#__PURE__*/wn.createElement(ErrorText, {
|
|
2092
|
-
errorMessage: error
|
|
2105
|
+
errorMessage: extractEmailSendErrorMessage(error)
|
|
2093
2106
|
})), /*#__PURE__*/wn.createElement(SubmitButton, {
|
|
2094
2107
|
isSubmitting: isMutating,
|
|
2095
2108
|
text: 'Continue with email'
|
|
@@ -4314,7 +4327,7 @@ var EmailOTPEntryScreen = function EmailOTPEntryScreen() {
|
|
|
4314
4327
|
resetAuthenticate = _useMutate6.reset;
|
|
4315
4328
|
var isAuthenticatingAny = isDiscoveryAuthenticating || isAuthenticating;
|
|
4316
4329
|
var authenticateAnyError = discoveryAuthenticateError || authenticateError;
|
|
4317
|
-
var errorMessage = authenticateAnyError ? 'Invalid passcode, please try again.' : sendError ?
|
|
4330
|
+
var errorMessage = authenticateAnyError ? 'Invalid passcode, please try again.' : sendError ? extractEmailSendErrorMessage(sendError) : undefined;
|
|
4318
4331
|
var resetAll = function resetAll() {
|
|
4319
4332
|
resetDiscoveryAuthenticate();
|
|
4320
4333
|
resetAuthenticate();
|
|
@@ -5988,13 +6001,6 @@ var PhoneInput = function PhoneInput(_ref121) {
|
|
|
5988
6001
|
required: true
|
|
5989
6002
|
}, hasPasskeys ? passwordManagerDisableAutofillProps : {})));
|
|
5990
6003
|
};
|
|
5991
|
-
var extractErrorType = function extractErrorType(error) {
|
|
5992
|
-
if (error && _typeof(error) === 'object') {
|
|
5993
|
-
if ('error_type' in error && typeof error.error_type === 'string') {
|
|
5994
|
-
return error.error_type;
|
|
5995
|
-
}
|
|
5996
|
-
}
|
|
5997
|
-
};
|
|
5998
6004
|
var DEFAULT_COUNTRY_CODE = 'US';
|
|
5999
6005
|
var InvalidPhoneNumberError = /*#__PURE__*/function (_StytchSDKError) {
|
|
6000
6006
|
function InvalidPhoneNumberError() {
|
|
@@ -216,7 +216,7 @@ var ClientsideServicesProvider = /*#__PURE__*/function () {
|
|
|
216
216
|
}
|
|
217
217
|
}]);
|
|
218
218
|
}();
|
|
219
|
-
var version = "5.21.
|
|
219
|
+
var version = "5.21.1";
|
|
220
220
|
var NetworkClient = /*#__PURE__*/function () {
|
|
221
221
|
function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
|
|
222
222
|
_classCallCheck(this, NetworkClient);
|
|
@@ -217,7 +217,7 @@ var ClientsideServicesProvider = /*#__PURE__*/function () {
|
|
|
217
217
|
}
|
|
218
218
|
}]);
|
|
219
219
|
}();
|
|
220
|
-
var version = "5.21.
|
|
220
|
+
var version = "5.21.1";
|
|
221
221
|
var NetworkClient = /*#__PURE__*/function () {
|
|
222
222
|
function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
|
|
223
223
|
_classCallCheck(this, NetworkClient);
|
package/dist/b2b/index.js
CHANGED
|
@@ -1868,15 +1868,28 @@ var PasswordUseButton = function PasswordUseButton(_ref50) {
|
|
|
1868
1868
|
onClick: handleUsePassword
|
|
1869
1869
|
}, "Use a password instead"));
|
|
1870
1870
|
};
|
|
1871
|
+
var extractErrorType = function extractErrorType(error) {
|
|
1872
|
+
if (error && _typeof(error) === 'object') {
|
|
1873
|
+
if ('error_type' in error && typeof error.error_type === 'string') {
|
|
1874
|
+
return error.error_type;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
var extractEmailSendErrorMessage = function extractEmailSendErrorMessage(error) {
|
|
1879
|
+
var errorType = extractErrorType(error);
|
|
1880
|
+
if (errorType === 'inactive_email') {
|
|
1881
|
+
return 'The email address is marked as inactive. Please try another email address, or contact your admin if you think this is a mistake.';
|
|
1882
|
+
}
|
|
1883
|
+
return 'We were unable to send a passcode to the entered email address. Please try another email address, or contact your admin if you think this is a mistake.';
|
|
1884
|
+
};
|
|
1871
1885
|
var JIT_PROVISIONING_ERRORS = ['email_jit_provisioning_not_allowed', 'invalid_email_for_jit_provisioning'];
|
|
1872
1886
|
var parseErrorMessage = function parseErrorMessage(error, _ref51) {
|
|
1873
1887
|
var email = _ref51.email,
|
|
1874
1888
|
org = _ref51.org;
|
|
1875
1889
|
if (JIT_PROVISIONING_ERRORS.includes(error.error_type)) {
|
|
1876
1890
|
return "".concat(email, " does not have access to ").concat(org, ". If you think this is a mistake, contact your admin");
|
|
1877
|
-
} else {
|
|
1878
|
-
return error.error_message;
|
|
1879
1891
|
}
|
|
1892
|
+
return extractEmailSendErrorMessage(error);
|
|
1880
1893
|
};
|
|
1881
1894
|
var EmailForm = function EmailForm(_ref52) {
|
|
1882
1895
|
var showPasswordButton = _ref52.showPasswordButton;
|
|
@@ -2090,7 +2103,7 @@ var EmailDiscoveryForm = function EmailDiscoveryForm(_ref53) {
|
|
|
2090
2103
|
email: email,
|
|
2091
2104
|
setEmail: setEmail
|
|
2092
2105
|
}), error && /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorText, {
|
|
2093
|
-
errorMessage: error
|
|
2106
|
+
errorMessage: extractEmailSendErrorMessage(error)
|
|
2094
2107
|
})), /*#__PURE__*/extractErrorMessage.wn.createElement(SubmitButton, {
|
|
2095
2108
|
isSubmitting: isMutating,
|
|
2096
2109
|
text: 'Continue with email'
|
|
@@ -4315,7 +4328,7 @@ var EmailOTPEntryScreen = function EmailOTPEntryScreen() {
|
|
|
4315
4328
|
resetAuthenticate = _useMutate6.reset;
|
|
4316
4329
|
var isAuthenticatingAny = isDiscoveryAuthenticating || isAuthenticating;
|
|
4317
4330
|
var authenticateAnyError = discoveryAuthenticateError || authenticateError;
|
|
4318
|
-
var errorMessage = authenticateAnyError ? 'Invalid passcode, please try again.' : sendError ?
|
|
4331
|
+
var errorMessage = authenticateAnyError ? 'Invalid passcode, please try again.' : sendError ? extractEmailSendErrorMessage(sendError) : undefined;
|
|
4319
4332
|
var resetAll = function resetAll() {
|
|
4320
4333
|
resetDiscoveryAuthenticate();
|
|
4321
4334
|
resetAuthenticate();
|
|
@@ -5989,13 +6002,6 @@ var PhoneInput = function PhoneInput(_ref121) {
|
|
|
5989
6002
|
required: true
|
|
5990
6003
|
}, hasPasskeys ? extractErrorMessage.passwordManagerDisableAutofillProps : {})));
|
|
5991
6004
|
};
|
|
5992
|
-
var extractErrorType = function extractErrorType(error) {
|
|
5993
|
-
if (error && _typeof(error) === 'object') {
|
|
5994
|
-
if ('error_type' in error && typeof error.error_type === 'string') {
|
|
5995
|
-
return error.error_type;
|
|
5996
|
-
}
|
|
5997
|
-
}
|
|
5998
|
-
};
|
|
5999
6005
|
var DEFAULT_COUNTRY_CODE = 'US';
|
|
6000
6006
|
var InvalidPhoneNumberError = /*#__PURE__*/function (_internal$StytchSDKEr) {
|
|
6001
6007
|
function InvalidPhoneNumberError() {
|