@basiq/connect-auth 1.0.5 → 1.0.7

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.
@@ -923,6 +923,8 @@ function StartScreen(props) {
923
923
  shadow = props.shadow,
924
924
  authRequestId = props.authRequestId,
925
925
  showErrorScreen = props.showErrorScreen,
926
+ smsSent = props.smsSent,
927
+ setSmsSent = props.setSmsSent,
926
928
  test = props.test;
927
929
  var _useState = useState(false),
928
930
  loading = _useState[0],
@@ -946,8 +948,8 @@ function StartScreen(props) {
946
948
  while (1) switch (_context.prev = _context.next) {
947
949
  case 0:
948
950
  setLoading(true);
949
- if (!authRequestId) {
950
- _context.next = 6;
951
+ if (!(authRequestId && !smsSent)) {
952
+ _context.next = 8;
951
953
  break;
952
954
  }
953
955
  _context.next = 4;
@@ -958,12 +960,20 @@ function StartScreen(props) {
958
960
  case 4:
959
961
  response = _context.sent;
960
962
  if (response != null && response.ok) {
963
+ setSmsSent(true);
961
964
  setLoading(false);
962
965
  onContinue();
963
966
  } else {
964
967
  showErrorScreen(response == null ? void 0 : response.statusCode.toString());
965
968
  }
966
- case 6:
969
+ _context.next = 9;
970
+ break;
971
+ case 8:
972
+ if (smsSent) {
973
+ setLoading(false);
974
+ onContinue();
975
+ }
976
+ case 9:
967
977
  case "end":
968
978
  return _context.stop();
969
979
  }
@@ -1088,7 +1098,7 @@ function AuthScreen(_ref) {
1088
1098
  return function (_x) {
1089
1099
  return _ref2.apply(this, arguments);
1090
1100
  };
1091
- }(), [smsCode, error, authRequestId]);
1101
+ }(), [smsCode, error, authRequestId, action, test]);
1092
1102
  var buttons = [{
1093
1103
  label: t('continue'),
1094
1104
  onClick: function onClick() {
@@ -1199,6 +1209,9 @@ function App(props) {
1199
1209
  var _useState9 = useState(''),
1200
1210
  errorCode = _useState9[0],
1201
1211
  setErrorCode = _useState9[1];
1212
+ var _useState10 = useState(false),
1213
+ smsSent = _useState10[0],
1214
+ setSmsSent = _useState10[1];
1202
1215
  var handleConnectionsScroll = function handleConnectionsScroll(event) {
1203
1216
  setShadow(detectScrollToBottom(event));
1204
1217
  };
@@ -1209,25 +1222,28 @@ function App(props) {
1209
1222
  useEffect(function () {
1210
1223
  var getData = /*#__PURE__*/function () {
1211
1224
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1212
- var _window$location$path, id, action, response, _response$data, _response$data2, _response$data4, _response$data3, _response$data5;
1225
+ var id, actionParam, response, _response$data, _response$data2, _response$data4, _response$data3, _response$data5;
1213
1226
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1214
1227
  while (1) switch (_context.prev = _context.next) {
1215
1228
  case 0:
1216
- _window$location$path = window.location.pathname.substring(1).split('?action='), id = _window$location$path[0], action = _window$location$path[1];
1217
- action && setAction(action);
1229
+ id = window.location.pathname.substring(1);
1230
+ actionParam = window.location.search.split('?action=')[1];
1231
+ if ((actionParam == null ? void 0 : actionParam.length) > 0) {
1232
+ setAction(actionParam);
1233
+ }
1218
1234
  if (!((id == null ? void 0 : id.length) > 0)) {
1219
- _context.next = 11;
1235
+ _context.next = 12;
1220
1236
  break;
1221
1237
  }
1222
1238
  setAuthId(id);
1223
1239
  setLoading(true);
1224
- _context.next = 7;
1240
+ _context.next = 8;
1225
1241
  return authUser({
1226
1242
  authRequestId: id,
1227
1243
  method: 'GET',
1228
1244
  test: test
1229
1245
  });
1230
- case 7:
1246
+ case 8:
1231
1247
  response = _context.sent;
1232
1248
  if (response != null && response.ok) {
1233
1249
  setCurrentScreen(1);
@@ -1241,13 +1257,13 @@ function App(props) {
1241
1257
  } else {
1242
1258
  showErrorScreen(response == null ? void 0 : response.statusCode.toString());
1243
1259
  }
1244
- _context.next = 12;
1260
+ _context.next = 13;
1245
1261
  break;
1246
- case 11:
1247
- showErrorScreen('404');
1248
1262
  case 12:
1249
- setLoading(false);
1263
+ showErrorScreen('404');
1250
1264
  case 13:
1265
+ setLoading(false);
1266
+ case 14:
1251
1267
  case "end":
1252
1268
  return _context.stop();
1253
1269
  }
@@ -1277,6 +1293,8 @@ function App(props) {
1277
1293
  return setCurrentScreen(2);
1278
1294
  },
1279
1295
  authRequestId: authId,
1296
+ smsSent: smsSent,
1297
+ setSmsSent: setSmsSent,
1280
1298
  test: test
1281
1299
  });
1282
1300
  case 2: