@tap-payments/auth-jsconnect 2.1.1-test → 2.1.3-test

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.
@@ -78,14 +78,21 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
78
78
  leadResponse = undefined;
79
79
  brandInfo = undefined;
80
80
  boardResponse = undefined;
81
+ countryIso2 = undefined;
81
82
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 18];
83
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
84
+ countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
85
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
86
+ }
82
87
  if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 18];
83
88
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
84
89
  case 2:
85
90
  leadResponse = _h.sent();
86
- countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
87
- if (countryIso2)
88
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
91
+ if (!countryIso2) {
92
+ countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
93
+ if (countryIso2)
94
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
95
+ }
89
96
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
90
97
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
91
98
  }
@@ -821,10 +828,10 @@ export var businessSlice = createSlice({
821
828
  state.error = null;
822
829
  })
823
830
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
824
- var _a, _b, _c, _d, _e;
831
+ var _a, _b, _c, _d;
825
832
  state.loading = false;
826
833
  state.error = null;
827
- var _f = action.payload, data = _f.data, formData = _f.formData, brandInfo = _f.brandInfo, leadData = _f.leadData;
834
+ var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo, leadData = _e.leadData;
828
835
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
829
836
  if (description) {
830
837
  state.error = description;
@@ -832,11 +839,11 @@ export var businessSlice = createSlice({
832
839
  }
833
840
  state.data.otpData = formData;
834
841
  state.data.otpData.responseBody = data;
835
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), leadData), { name: (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.name });
836
- var _g = leadData || {}, entity = _g.entity, entity_activities = _g.entity_activities, business_type = _g.business_type, business_name = _g.business_name;
842
+ state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: leadData === null || leadData === void 0 ? void 0 : leadData.flows });
843
+ var _f = leadData || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type, business_name = _f.business_name;
837
844
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
838
845
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
839
- : (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
846
+ : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
840
847
  if (!!issuingDate) {
841
848
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
842
849
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
@@ -851,13 +858,13 @@ export var businessSlice = createSlice({
851
858
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
852
859
  state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
853
860
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
854
- var licenseNumber_2 = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
855
- var _h = state.data.businessTypeData || {}, responseBody = _h.responseBody, selectedLicense = _h.selectedLicense;
861
+ var licenseNumber_2 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
862
+ var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
856
863
  var licenseList = (responseBody || {}).licenseList;
857
864
  var selectedLicenseData = selectedLicense;
858
865
  if (!!licenseNumber_2) {
859
866
  selectedLicenseData =
860
- ((_e = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _e === void 0 ? void 0 : _e.call(licenseList, function (_a) {
867
+ ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
861
868
  var license = _a.license;
862
869
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
863
870
  })) ||
@@ -54,7 +54,7 @@ import { ENTITY_STEP_NAMES } from '../../../constants';
54
54
  import moment from 'moment';
55
55
  import { convertNumbers2English } from '../../../utils';
56
56
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
57
- var payload, data, boardData, entityData, boardInfoData, board_id, board_info_id, entityId, countryIso2, info, hasEntityCompleted;
57
+ var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id, board_info_id, entityId, info, hasEntityCompleted;
58
58
  var _a, _b, _c, _d;
59
59
  return __generator(this, function (_e) {
60
60
  switch (_e.label) {
@@ -66,8 +66,13 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
66
66
  return [4, API.leadService.verifyLeadToken(payload)];
67
67
  case 1:
68
68
  data = (_e.sent()).data;
69
- boardInfoData = undefined;
69
+ countryIso2 = undefined;
70
70
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
71
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
72
+ countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
73
+ if (countryIso2)
74
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
75
+ }
71
76
  if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 8];
72
77
  board_id = data === null || data === void 0 ? void 0 : data.id;
73
78
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
@@ -90,9 +95,11 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
90
95
  entityData = _e.sent();
91
96
  _e.label = 7;
92
97
  case 7:
93
- countryIso2 = entityData.country;
94
- if (countryIso2)
95
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
98
+ if (!countryIso2) {
99
+ countryIso2 = entityData.country;
100
+ if (countryIso2)
101
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
102
+ }
96
103
  info = boardInfoData.info;
97
104
  hasEntityCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
98
105
  if (hasEntityCompleted) {
@@ -68,6 +68,10 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
68
68
  boardInfoData = undefined;
69
69
  countries = settings.data.countries;
70
70
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
71
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
72
+ countryCode = data === null || data === void 0 ? void 0 : data.country_code;
73
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
74
+ }
71
75
  if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 10];
72
76
  board_id = data === null || data === void 0 ? void 0 : data.id;
73
77
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
@@ -89,9 +93,11 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
89
93
  boardData = _f.sent();
90
94
  _f.label = 6;
91
95
  case 6:
92
- countryCode = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
93
- if (countryCode)
94
- thunkApi.dispatch(handleSetCountryByIso2(countryCode));
96
+ if (!countryCode) {
97
+ countryCode = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
98
+ if (countryCode)
99
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
100
+ }
95
101
  info = boardInfoData.info;
96
102
  hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
97
103
  if (!hasIndividualCompleted) return [3, 7];
@@ -354,6 +354,7 @@ export var taxSlice = createSlice({
354
354
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
355
355
  var _a;
356
356
  state.loading = false;
357
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateBoardSuccessLoading: false });
357
358
  state.error = null;
358
359
  var response = (action.payload || {}).response;
359
360
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -366,10 +367,12 @@ export var taxSlice = createSlice({
366
367
  })
367
368
  .addCase(updateLeadSuccess.pending, function (state) {
368
369
  state.loading = true;
370
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateBoardSuccessLoading: true });
369
371
  state.error = null;
370
372
  })
371
373
  .addCase(updateLeadSuccess.rejected, function (state, action) {
372
374
  state.loading = false;
375
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateBoardSuccessLoading: false });
373
376
  state.error = action.error.message;
374
377
  });
375
378
  }
@@ -7,10 +7,14 @@ import { bankSelector, updateBoardSuccess } from '../../../app/bank/bankStore';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var _b = useAppSelector(bankSelector), loading = _b.loading, error = _b.error;
11
- var onSuccess = function () {
10
+ var _b = useAppSelector(bankSelector), error = _b.error, loading = _b.loading;
11
+ var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
12
+ React.useEffect(function () {
12
13
  dispatch(updateBoardSuccess());
14
+ }, []);
15
+ var onSuccess = function () {
16
+ setClicked(true);
13
17
  };
14
- return (_jsx(SuccessScreen, { title: t('bank_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
18
+ return (_jsx(SuccessScreen, { title: t('bank_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: clicked && loading, error: error || '' }));
15
19
  };
16
20
  export default React.memo(Success);
@@ -7,10 +7,14 @@ import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var _b = useAppSelector(entitySelector), loading = _b.loading, error = _b.error;
11
- var onSuccess = function () {
10
+ var _b = useAppSelector(entitySelector), error = _b.error, loading = _b.loading;
11
+ var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
12
+ React.useEffect(function () {
12
13
  dispatch(updateBoardSuccess());
14
+ }, []);
15
+ var onSuccess = function () {
16
+ setClicked(true);
13
17
  };
14
- return (_jsx(SuccessScreen, { title: t('entity_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
18
+ return (_jsx(SuccessScreen, { title: t('entity_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: clicked && loading, error: error || '' }));
15
19
  };
16
20
  export default React.memo(Success);
@@ -7,10 +7,14 @@ import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var _b = useAppSelector(individualSelector), loading = _b.loading, error = _b.error;
11
- var onSuccess = function () {
10
+ var _b = useAppSelector(individualSelector), error = _b.error, loading = _b.loading;
11
+ var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
12
+ React.useEffect(function () {
12
13
  dispatch(updateBoardSuccess());
14
+ }, []);
15
+ var onSuccess = function () {
16
+ setClicked(true);
13
17
  };
14
- return (_jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
18
+ return (_jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: clicked && loading, error: error || '' }));
15
19
  };
16
20
  export default React.memo(Success);
@@ -36,7 +36,8 @@ var ContainerStyled = styled(Container)(function (_a) {
36
36
  return ({
37
37
  justifyContent: 'space-between',
38
38
  minHeight: theme.spacing(30),
39
- alignItems: 'center'
39
+ alignItems: 'center',
40
+ pointerEvents: 'auto'
40
41
  });
41
42
  });
42
43
  var IconStyled = styled(Icon)(function (_a) {
@@ -7,10 +7,16 @@ import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  var Success = function (_a) {
8
8
  var t = useTranslation().t;
9
9
  var dispatch = useAppDispatch();
10
- var _b = useAppSelector(taxSelector), loading = _b.loading, error = _b.error;
11
- var onSuccess = function () {
10
+ var _b = useAppSelector(taxSelector), error = _b.error, data = _b.data;
11
+ var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
12
+ var responseBody = data.verify.responseBody;
13
+ var updateBoardSuccessLoading = (responseBody || {}).updateBoardSuccessLoading;
14
+ React.useEffect(function () {
12
15
  dispatch(updateLeadSuccess());
16
+ }, []);
17
+ var onSuccess = function () {
18
+ setClicked(true);
13
19
  };
14
- return (_jsx(SuccessScreen, { title: t('tax_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
20
+ return (_jsx(SuccessScreen, { title: t('tax_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: clicked && updateBoardSuccessLoading, error: error || '' }));
15
21
  };
16
22
  export default React.memo(Success);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.1-test",
3
+ "version": "2.1.3-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",