@basiq/connect-auth 1.0.6 → 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/components/pages/StartScreen.d.ts +2 -0
- package/dist/connect-auth.cjs.development.js +34 -10
- 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 +34 -10
- package/dist/connect-auth.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -931,6 +931,8 @@ function StartScreen(props) {
|
|
|
931
931
|
shadow = props.shadow,
|
|
932
932
|
authRequestId = props.authRequestId,
|
|
933
933
|
showErrorScreen = props.showErrorScreen,
|
|
934
|
+
smsSent = props.smsSent,
|
|
935
|
+
setSmsSent = props.setSmsSent,
|
|
934
936
|
test = props.test;
|
|
935
937
|
var _useState = React.useState(false),
|
|
936
938
|
loading = _useState[0],
|
|
@@ -954,8 +956,8 @@ function StartScreen(props) {
|
|
|
954
956
|
while (1) switch (_context.prev = _context.next) {
|
|
955
957
|
case 0:
|
|
956
958
|
setLoading(true);
|
|
957
|
-
if (!authRequestId) {
|
|
958
|
-
_context.next =
|
|
959
|
+
if (!(authRequestId && !smsSent)) {
|
|
960
|
+
_context.next = 8;
|
|
959
961
|
break;
|
|
960
962
|
}
|
|
961
963
|
_context.next = 4;
|
|
@@ -966,12 +968,20 @@ function StartScreen(props) {
|
|
|
966
968
|
case 4:
|
|
967
969
|
response = _context.sent;
|
|
968
970
|
if (response != null && response.ok) {
|
|
971
|
+
setSmsSent(true);
|
|
969
972
|
setLoading(false);
|
|
970
973
|
onContinue();
|
|
971
974
|
} else {
|
|
972
975
|
showErrorScreen(response == null ? void 0 : response.statusCode.toString());
|
|
973
976
|
}
|
|
974
|
-
|
|
977
|
+
_context.next = 9;
|
|
978
|
+
break;
|
|
979
|
+
case 8:
|
|
980
|
+
if (smsSent) {
|
|
981
|
+
setLoading(false);
|
|
982
|
+
onContinue();
|
|
983
|
+
}
|
|
984
|
+
case 9:
|
|
975
985
|
case "end":
|
|
976
986
|
return _context.stop();
|
|
977
987
|
}
|
|
@@ -1061,6 +1071,9 @@ function AuthScreen(_ref) {
|
|
|
1061
1071
|
var _useState5 = React.useState(false),
|
|
1062
1072
|
loading = _useState5[0],
|
|
1063
1073
|
setLoading = _useState5[1];
|
|
1074
|
+
var _useState6 = React.useState(false),
|
|
1075
|
+
tooManyAttemps = _useState6[0],
|
|
1076
|
+
setTooManyAttemps = _useState6[1];
|
|
1064
1077
|
var handleCodeApply = React.useCallback( /*#__PURE__*/function () {
|
|
1065
1078
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
1066
1079
|
var _response$data, response, _response$data2;
|
|
@@ -1068,7 +1081,7 @@ function AuthScreen(_ref) {
|
|
|
1068
1081
|
while (1) switch (_context.prev = _context.next) {
|
|
1069
1082
|
case 0:
|
|
1070
1083
|
if (!(smsCode.length === 4 && error.length === 0 && (!e || (e == null ? void 0 : e.key) === 'Enter'))) {
|
|
1071
|
-
_context.next =
|
|
1084
|
+
_context.next = 6;
|
|
1072
1085
|
break;
|
|
1073
1086
|
}
|
|
1074
1087
|
setLoading(true);
|
|
@@ -1082,12 +1095,15 @@ function AuthScreen(_ref) {
|
|
|
1082
1095
|
response = _context.sent;
|
|
1083
1096
|
if (response != null && (_response$data = response.data) != null && _response$data.access_token) {
|
|
1084
1097
|
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");
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1098
|
+
} else if ((response == null ? void 0 : response.statusCode) === 204) {
|
|
1099
|
+
setLoading(false);
|
|
1100
|
+
setTooManyAttemps(true);
|
|
1101
|
+
setError(t('too_many_attempts'));
|
|
1102
|
+
} else if (response != null && response.error) {
|
|
1087
1103
|
setLoading(false);
|
|
1088
1104
|
setError(t('this_code_doesnt_appear_to_be_valid'));
|
|
1089
1105
|
}
|
|
1090
|
-
case
|
|
1106
|
+
case 6:
|
|
1091
1107
|
case "end":
|
|
1092
1108
|
return _context.stop();
|
|
1093
1109
|
}
|
|
@@ -1161,14 +1177,15 @@ function AuthScreen(_ref) {
|
|
|
1161
1177
|
onChange: handleInput,
|
|
1162
1178
|
value: smsCode,
|
|
1163
1179
|
filled: smsCode.length === 4,
|
|
1164
|
-
error: !!error,
|
|
1180
|
+
error: tooManyAttemps || !!error,
|
|
1181
|
+
disabled: tooManyAttemps,
|
|
1165
1182
|
onKeyPress: function onKeyPress(e) {
|
|
1166
1183
|
return handleCodeApply(e);
|
|
1167
1184
|
}
|
|
1168
1185
|
})), React__default.createElement(PageConnectFooterControl, null, resend && React__default.createElement(StatusMessage, null, t('new_sms_code_has_been_sent')), !!error && React__default.createElement(StatusMessage, {
|
|
1169
1186
|
error: true
|
|
1170
1187
|
}, error), React__default.createElement(PageConnectFooterText, null, React__default.createElement("span", null, React__default.createElement(React__default.Fragment, null, t('didnt_receive_the_code'), " ", React__default.createElement(DivAsLink, {
|
|
1171
|
-
disabled: resendLoading,
|
|
1188
|
+
disabled: tooManyAttemps || resendLoading,
|
|
1172
1189
|
onClick: function onClick() {
|
|
1173
1190
|
return !resendLoading && handleResend();
|
|
1174
1191
|
}
|
|
@@ -1207,6 +1224,9 @@ function App(props) {
|
|
|
1207
1224
|
var _useState9 = React.useState(''),
|
|
1208
1225
|
errorCode = _useState9[0],
|
|
1209
1226
|
setErrorCode = _useState9[1];
|
|
1227
|
+
var _useState10 = React.useState(false),
|
|
1228
|
+
smsSent = _useState10[0],
|
|
1229
|
+
setSmsSent = _useState10[1];
|
|
1210
1230
|
var handleConnectionsScroll = function handleConnectionsScroll(event) {
|
|
1211
1231
|
setShadow(detectScrollToBottom(event));
|
|
1212
1232
|
};
|
|
@@ -1288,6 +1308,8 @@ function App(props) {
|
|
|
1288
1308
|
return setCurrentScreen(2);
|
|
1289
1309
|
},
|
|
1290
1310
|
authRequestId: authId,
|
|
1311
|
+
smsSent: smsSent,
|
|
1312
|
+
setSmsSent: setSmsSent,
|
|
1291
1313
|
test: test
|
|
1292
1314
|
});
|
|
1293
1315
|
case 2:
|
|
@@ -1346,6 +1368,7 @@ var resend_sms = "Resend SMS";
|
|
|
1346
1368
|
var failed_to_send_sms = "Failed to send SMS.";
|
|
1347
1369
|
var page_not_found = "Page not found";
|
|
1348
1370
|
var missing_authentication_token = "Missing Authentication Token";
|
|
1371
|
+
var too_many_attempts = "Too many attempts. Please use a new link to try again.";
|
|
1349
1372
|
var translationEN = {
|
|
1350
1373
|
back: back,
|
|
1351
1374
|
error: error,
|
|
@@ -1373,7 +1396,8 @@ var translationEN = {
|
|
|
1373
1396
|
resend_sms: resend_sms,
|
|
1374
1397
|
failed_to_send_sms: failed_to_send_sms,
|
|
1375
1398
|
page_not_found: page_not_found,
|
|
1376
|
-
missing_authentication_token: missing_authentication_token
|
|
1399
|
+
missing_authentication_token: missing_authentication_token,
|
|
1400
|
+
too_many_attempts: too_many_attempts
|
|
1377
1401
|
};
|
|
1378
1402
|
|
|
1379
1403
|
// the translations
|