@basiq/connect-auth 0.1.85 → 0.1.88

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.
@@ -822,7 +822,8 @@ var verifySmsCode = /*#__PURE__*/function () {
822
822
  return _context.abrupt("return", {
823
823
  data: json,
824
824
  headers: result.headers,
825
- statusCode: result.status
825
+ statusCode: result.status,
826
+ ok: true
826
827
  });
827
828
 
828
829
  case 15:
@@ -834,14 +835,16 @@ var verifySmsCode = /*#__PURE__*/function () {
834
835
  return _context.abrupt("return", {
835
836
  headers: result.headers,
836
837
  statusCode: result.status,
837
- error: result.statusText || 'Something went wrong'
838
+ error: result.statusText || 'Something went wrong',
839
+ ok: false
838
840
  });
839
841
 
840
842
  case 17:
841
843
  return _context.abrupt("return", {
842
844
  headers: result.headers,
843
845
  statusCode: result.status,
844
- error: result.statusText || 'Something went wrong'
846
+ error: result.statusText || 'Something went wrong',
847
+ ok: false
845
848
  });
846
849
 
847
850
  case 18:
@@ -906,7 +909,8 @@ var authUser = /*#__PURE__*/function () {
906
909
  return _context2.abrupt("return", {
907
910
  data: json,
908
911
  headers: result.headers,
909
- statusCode: result.status
912
+ statusCode: result.status,
913
+ ok: true
910
914
  });
911
915
 
912
916
  case 15:
@@ -915,7 +919,7 @@ var authUser = /*#__PURE__*/function () {
915
919
  break;
916
920
  }
917
921
 
918
- if (!(result.status === 403)) {
922
+ if (![403, 404].includes(result.status)) {
919
923
  _context2.next = 20;
920
924
  break;
921
925
  }
@@ -936,14 +940,16 @@ var authUser = /*#__PURE__*/function () {
936
940
  return _context2.abrupt("return", {
937
941
  headers: result.headers,
938
942
  statusCode: result.status,
939
- error: _json.message || result.statusText || 'Something went wrong'
943
+ error: (_json == null ? void 0 : _json.message) || result.statusText || 'Something went wrong',
944
+ ok: false
940
945
  });
941
946
 
942
947
  case 25:
943
948
  return _context2.abrupt("return", {
944
949
  headers: result.headers,
945
950
  statusCode: result.status,
946
- error: result.statusText || 'Something went wrong'
951
+ error: result.statusText || 'Something went wrong',
952
+ ok: false
947
953
  });
948
954
 
949
955
  case 26:
@@ -1003,7 +1009,8 @@ function StartScreen(props) {
1003
1009
  var onContinue = props.onContinue,
1004
1010
  appName = props.appName,
1005
1011
  shadow = props.shadow,
1006
- authId = props.authId;
1012
+ authId = props.authId,
1013
+ showErrorScreen = props.showErrorScreen;
1007
1014
 
1008
1015
  var _useState = useState(false),
1009
1016
  loading = _useState[0],
@@ -1014,8 +1021,7 @@ function StartScreen(props) {
1014
1021
 
1015
1022
  var handleContinue = /*#__PURE__*/function () {
1016
1023
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1017
- var _response$data, response;
1018
-
1024
+ var response;
1019
1025
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1020
1026
  while (1) {
1021
1027
  switch (_context.prev = _context.next) {
@@ -1033,9 +1039,11 @@ function StartScreen(props) {
1033
1039
  case 4:
1034
1040
  response = _context.sent;
1035
1041
 
1036
- if ((response == null ? void 0 : (_response$data = response.data) == null ? void 0 : _response$data.status) === 'code-sent') {
1042
+ if (response != null && response.ok) {
1037
1043
  setLoading(false);
1038
1044
  onContinue();
1045
+ } else {
1046
+ showErrorScreen(response == null ? void 0 : response.statusCode.toString());
1039
1047
  }
1040
1048
 
1041
1049
  case 6:
@@ -1287,7 +1295,7 @@ function App() {
1287
1295
  useEffect(function () {
1288
1296
  var getData = /*#__PURE__*/function () {
1289
1297
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1290
- var id, _response$data, response, _response$data2, _response$data3, _response$data5, _response$data5$partn, _response$data4, _response$data6, _response$data6$partn;
1298
+ var id, response, _response$data, _response$data2, _response$data4, _response$data4$partn, _response$data3, _response$data5, _response$data5$partn;
1291
1299
 
1292
1300
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1293
1301
  while (1) {
@@ -1296,7 +1304,7 @@ function App() {
1296
1304
  id = window.location.pathname.substring(1);
1297
1305
 
1298
1306
  if (!((id == null ? void 0 : id.length) > 0)) {
1299
- _context.next = 11;
1307
+ _context.next = 10;
1300
1308
  break;
1301
1309
  }
1302
1310
 
@@ -1308,28 +1316,30 @@ function App() {
1308
1316
  case 6:
1309
1317
  response = _context.sent;
1310
1318
 
1311
- if ((response == null ? void 0 : (_response$data = response.data) == null ? void 0 : _response$data.status) === 'code-not-sent') {
1319
+ if (response != null && response.ok) {
1312
1320
  setCurrentScreen(1);
1313
- setMobile(response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2.mobile);
1321
+ setMobile(response == null ? void 0 : (_response$data = response.data) == null ? void 0 : _response$data.mobile);
1314
1322
 
1315
- if (response != null && (_response$data3 = response.data) != null && _response$data3.appName) {
1316
- setAppName(response == null ? void 0 : (_response$data4 = response.data) == null ? void 0 : _response$data4.appName);
1323
+ if (response != null && (_response$data2 = response.data) != null && _response$data2.appName) {
1324
+ setAppName(response == null ? void 0 : (_response$data3 = response.data) == null ? void 0 : _response$data3.appName);
1317
1325
  }
1318
1326
 
1319
- if (response != null && (_response$data5 = response.data) != null && (_response$data5$partn = _response$data5.partner) != null && _response$data5$partn.logoUrl) {
1320
- setLogo(response == null ? void 0 : (_response$data6 = response.data) == null ? void 0 : (_response$data6$partn = _response$data6.partner) == null ? void 0 : _response$data6$partn.logoUrl);
1327
+ if (response != null && (_response$data4 = response.data) != null && (_response$data4$partn = _response$data4.partner) != null && _response$data4$partn.logoUrl) {
1328
+ setLogo(response == null ? void 0 : (_response$data5 = response.data) == null ? void 0 : (_response$data5$partn = _response$data5.partner) == null ? void 0 : _response$data5$partn.logoUrl);
1321
1329
  }
1322
1330
  } else {
1323
1331
  showErrorScreen(response == null ? void 0 : response.statusCode.toString());
1324
1332
  }
1325
1333
 
1326
- setLoading(false);
1327
- _context.next = 12;
1334
+ _context.next = 11;
1328
1335
  break;
1329
1336
 
1330
- case 11:
1337
+ case 10:
1331
1338
  showErrorScreen('404');
1332
1339
 
1340
+ case 11:
1341
+ setLoading(false);
1342
+
1333
1343
  case 12:
1334
1344
  case "end":
1335
1345
  return _context.stop();