@basiq/connect-auth 1.0.7 → 1.0.8
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/dist/connect-auth.cjs.development.js +16 -7
- package/dist/connect-auth.cjs.development.js.map +1 -1
- package/dist/connect-auth.cjs.production.min.js +1 -1
- package/dist/connect-auth.cjs.production.min.js.map +1 -1
- package/dist/connect-auth.esm.js +16 -7
- package/dist/connect-auth.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/connect-auth.esm.js
CHANGED
|
@@ -1063,6 +1063,9 @@ function AuthScreen(_ref) {
|
|
|
1063
1063
|
var _useState5 = useState(false),
|
|
1064
1064
|
loading = _useState5[0],
|
|
1065
1065
|
setLoading = _useState5[1];
|
|
1066
|
+
var _useState6 = useState(false),
|
|
1067
|
+
tooManyAttemps = _useState6[0],
|
|
1068
|
+
setTooManyAttemps = _useState6[1];
|
|
1066
1069
|
var handleCodeApply = useCallback( /*#__PURE__*/function () {
|
|
1067
1070
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
1068
1071
|
var _response$data, response, _response$data2;
|
|
@@ -1070,7 +1073,7 @@ function AuthScreen(_ref) {
|
|
|
1070
1073
|
while (1) switch (_context.prev = _context.next) {
|
|
1071
1074
|
case 0:
|
|
1072
1075
|
if (!(smsCode.length === 4 && error.length === 0 && (!e || (e == null ? void 0 : e.key) === 'Enter'))) {
|
|
1073
|
-
_context.next =
|
|
1076
|
+
_context.next = 6;
|
|
1074
1077
|
break;
|
|
1075
1078
|
}
|
|
1076
1079
|
setLoading(true);
|
|
@@ -1084,12 +1087,15 @@ function AuthScreen(_ref) {
|
|
|
1084
1087
|
response = _context.sent;
|
|
1085
1088
|
if (response != null && (_response$data = response.data) != null && _response$data.access_token) {
|
|
1086
1089
|
window.open("https://consent.basiq.io/home?token=" + (response == null || (_response$data2 = response.data) == null ? void 0 : _response$data2.access_token) + "&action=" + (action.length > 0 ? action : 'connect'), "_self");
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1090
|
+
} else if ((response == null ? void 0 : response.statusCode) === 204) {
|
|
1091
|
+
setLoading(false);
|
|
1092
|
+
setTooManyAttemps(true);
|
|
1093
|
+
setError(t('too_many_attempts'));
|
|
1094
|
+
} else if (response != null && response.error) {
|
|
1089
1095
|
setLoading(false);
|
|
1090
1096
|
setError(t('this_code_doesnt_appear_to_be_valid'));
|
|
1091
1097
|
}
|
|
1092
|
-
case
|
|
1098
|
+
case 6:
|
|
1093
1099
|
case "end":
|
|
1094
1100
|
return _context.stop();
|
|
1095
1101
|
}
|
|
@@ -1163,14 +1169,15 @@ function AuthScreen(_ref) {
|
|
|
1163
1169
|
onChange: handleInput,
|
|
1164
1170
|
value: smsCode,
|
|
1165
1171
|
filled: smsCode.length === 4,
|
|
1166
|
-
error: !!error,
|
|
1172
|
+
error: tooManyAttemps || !!error,
|
|
1173
|
+
disabled: tooManyAttemps,
|
|
1167
1174
|
onKeyPress: function onKeyPress(e) {
|
|
1168
1175
|
return handleCodeApply(e);
|
|
1169
1176
|
}
|
|
1170
1177
|
})), React.createElement(PageConnectFooterControl, null, resend && React.createElement(StatusMessage, null, t('new_sms_code_has_been_sent')), !!error && React.createElement(StatusMessage, {
|
|
1171
1178
|
error: true
|
|
1172
1179
|
}, error), React.createElement(PageConnectFooterText, null, React.createElement("span", null, React.createElement(React.Fragment, null, t('didnt_receive_the_code'), " ", React.createElement(DivAsLink, {
|
|
1173
|
-
disabled: resendLoading,
|
|
1180
|
+
disabled: tooManyAttemps || resendLoading,
|
|
1174
1181
|
onClick: function onClick() {
|
|
1175
1182
|
return !resendLoading && handleResend();
|
|
1176
1183
|
}
|
|
@@ -1353,6 +1360,7 @@ var resend_sms = "Resend SMS";
|
|
|
1353
1360
|
var failed_to_send_sms = "Failed to send SMS.";
|
|
1354
1361
|
var page_not_found = "Page not found";
|
|
1355
1362
|
var missing_authentication_token = "Missing Authentication Token";
|
|
1363
|
+
var too_many_attempts = "Too many attempts. Please use a new link to try again.";
|
|
1356
1364
|
var translationEN = {
|
|
1357
1365
|
back: back,
|
|
1358
1366
|
error: error,
|
|
@@ -1380,7 +1388,8 @@ var translationEN = {
|
|
|
1380
1388
|
resend_sms: resend_sms,
|
|
1381
1389
|
failed_to_send_sms: failed_to_send_sms,
|
|
1382
1390
|
page_not_found: page_not_found,
|
|
1383
|
-
missing_authentication_token: missing_authentication_token
|
|
1391
|
+
missing_authentication_token: missing_authentication_token,
|
|
1392
|
+
too_many_attempts: too_many_attempts
|
|
1384
1393
|
};
|
|
1385
1394
|
|
|
1386
1395
|
// the translations
|