@tap-payments/auth-jsconnect 2.3.72-test → 2.3.74-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.
@@ -241,42 +241,32 @@ export var BUSINESS_SCREENS_NAVIGATION = [
241
241
  export var INDIVIDUAL_SCREENS_NAVIGATION = [
242
242
  {
243
243
  name: 'INDIVIDUAL_VERIFY_STEP',
244
- next: [
245
- 'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP',
246
- 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
247
- 'INDIVIDUAL_LIST_STEP',
248
- 'INDIVIDUAL_PHONE_INFO_STEP'
249
- ],
250
- prev: '',
244
+ next: ['INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_LIST_STEP', 'INDIVIDUAL_PHONE_INFO_STEP'],
245
+ prev: 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
251
246
  order: 1
252
247
  },
253
248
  {
254
249
  name: 'INDIVIDUAL_PHONE_INFO_STEP',
255
- next: [
256
- 'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP',
257
- 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
258
- 'INDIVIDUAL_LIST_STEP',
259
- 'INDIVIDUAL_VERIFY_STEP'
260
- ],
250
+ next: ['INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_LIST_STEP', 'INDIVIDUAL_VERIFY_STEP'],
261
251
  prev: '',
262
252
  order: 1
263
253
  },
264
254
  {
265
255
  name: 'INDIVIDUAL_LIST_STEP',
266
- next: ['INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
256
+ next: 'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP',
267
257
  prev: 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
268
258
  order: 1
269
259
  },
270
260
  {
271
261
  name: 'INDIVIDUAL_LOADING_DATA_STEP',
272
- next: ['INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP', 'INDIVIDUAL_LIST_STEP'],
262
+ next: ['INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_LIST_STEP'],
273
263
  prev: '',
274
264
  order: 1
275
265
  },
276
266
  {
277
267
  name: 'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP',
278
268
  next: 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
279
- prev: 'INDIVIDUAL_LIST_STEP',
269
+ prev: ['INDIVIDUAL_LIST_STEP', 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
280
270
  order: 2
281
271
  },
282
272
  {
@@ -447,20 +437,20 @@ export var SigIn_SCREENS_NAVIGATION = [
447
437
  export var ENTITY_SCREENS_NAVIGATION = [
448
438
  {
449
439
  name: 'ENTITY_VERIFY_STEP',
450
- next: ['ENTITY_NAME_STEP', 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
451
- prev: '',
440
+ next: 'ENTITY_NAME_STEP',
441
+ prev: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
452
442
  order: 1
453
443
  },
454
444
  {
455
445
  name: 'ENTITY_LOADING_DATA_STEP',
456
- next: ['ENTITY_NAME_STEP', 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
446
+ next: 'ENTITY_NAME_STEP',
457
447
  prev: '',
458
448
  order: 1
459
449
  },
460
450
  {
461
451
  name: 'ENTITY_NAME_STEP',
462
452
  next: 'ENTITY_CAPITAL_STEP',
463
- prev: '',
453
+ prev: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
464
454
  order: 2
465
455
  },
466
456
  {
@@ -492,19 +482,19 @@ export var BRAND_SCREENS_NAVIGATION = [
492
482
  {
493
483
  name: 'BRAND_VERIFY_STEP',
494
484
  next: 'BRAND_INFO_STEP',
495
- prev: '',
485
+ prev: 'BRAND_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
496
486
  order: 1
497
487
  },
498
488
  {
499
489
  name: 'BRAND_LOADING_DATA_STEP',
500
490
  next: 'BRAND_INFO_STEP',
501
- prev: '',
491
+ prev: 'BRAND_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
502
492
  order: 1
503
493
  },
504
494
  {
505
495
  name: 'BRAND_INFO_STEP',
506
496
  next: 'BRAND_ACTIVITIES_STEP',
507
- prev: '',
497
+ prev: 'BRAND_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
508
498
  order: 2
509
499
  },
510
500
  {
@@ -17,7 +17,6 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
17
17
  contact: any;
18
18
  individuals: any;
19
19
  business: any;
20
- flows: any;
21
20
  };
22
21
  salesChannels: any;
23
22
  segmentsList: any;
@@ -39,13 +38,15 @@ export declare const verifyBrandLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
39
38
  contact: any;
40
39
  individuals: any;
41
40
  business: any;
42
- flows: any;
43
41
  };
44
42
  salesChannels: any;
45
43
  segmentsList: any;
46
44
  teamSizeList: any;
47
45
  formData: OTPFormValues;
48
46
  }, OTPFormValues, {}>;
47
+ export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<{
48
+ flows: any;
49
+ }, void, {}>;
49
50
  export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
50
51
  data: any;
51
52
  }, string, {}>;
@@ -60,13 +60,13 @@ var _a;
60
60
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
61
61
  import API from '../../../api';
62
62
  import { FlowsTypes } from '../../../@types';
63
- import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
63
+ import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { BRAND_STEP_NAMES } from '../../../constants';
65
65
  import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, sleep } from '../../../utils';
66
66
  export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
67
67
  var token = _a.token, isInternally = _a.isInternally;
68
68
  return __awaiter(void 0, void 0, void 0, function () {
69
- var payload, data, countryIso2, board_id, segmentsList, salesChannels, teamSizeList, boardInfoData, boardData;
69
+ var payload, data, countryIso2, board_id, segmentsList, salesChannels, teamSizeList, boardData;
70
70
  var _b, _c, _d;
71
71
  return __generator(this, function (_e) {
72
72
  switch (_e.label) {
@@ -91,12 +91,9 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
91
91
  boardData = undefined;
92
92
  if (isInternally)
93
93
  data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
94
- if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 7];
95
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
96
- case 2:
97
- boardInfoData = _e.sent();
94
+ if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 6];
98
95
  return [4, API.boardService.retrieveBoardDetails(board_id)];
99
- case 3:
96
+ case 2:
100
97
  boardData = _e.sent();
101
98
  if (!countryIso2) {
102
99
  countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
@@ -104,17 +101,17 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
104
101
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
105
102
  }
106
103
  return [4, API.dataService.getSegments({ page: 0 })];
107
- case 4:
104
+ case 3:
108
105
  segmentsList = _e.sent();
109
106
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
110
- case 5:
107
+ case 4:
111
108
  salesChannels = _e.sent();
112
109
  return [4, API.dataService.getTeamSize({ page: 0 })];
113
- case 6:
110
+ case 5:
114
111
  teamSizeList = _e.sent();
115
112
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
116
- _e.label = 7;
117
- case 7: return [2, {
113
+ _e.label = 6;
114
+ case 6: return [2, {
118
115
  data: data,
119
116
  boardResponse: {
120
117
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
@@ -125,8 +122,7 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
125
122
  name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
126
123
  contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
127
124
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
128
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
129
- flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
125
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business
130
126
  },
131
127
  salesChannels: salesChannels,
132
128
  segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
@@ -155,7 +151,7 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
155
151
  });
156
152
  }); });
157
153
  export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
158
- var _a, brand, settings, responseBody, payload, data, board_id, boardInfoData, boardData, segmentsList, salesChannels, teamSizeList;
154
+ var _a, brand, settings, responseBody, payload, data, board_id, boardData, segmentsList, salesChannels, teamSizeList;
159
155
  var _b, _c, _d, _e, _f, _g;
160
156
  return __generator(this, function (_h) {
161
157
  switch (_h.label) {
@@ -178,21 +174,18 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
178
174
  if (!board_id) {
179
175
  throw new Error('Internal server error');
180
176
  }
181
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
182
- case 2:
183
- boardInfoData = _h.sent();
184
177
  return [4, API.boardService.retrieveBoardDetails(board_id)];
185
- case 3:
178
+ case 2:
186
179
  boardData = _h.sent();
187
180
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
188
181
  return [4, API.dataService.getSegments({ page: 0 })];
189
- case 4:
182
+ case 3:
190
183
  segmentsList = _h.sent();
191
184
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
192
- case 5:
185
+ case 4:
193
186
  salesChannels = _h.sent();
194
187
  return [4, API.dataService.getTeamSize({ page: 0 })];
195
- case 6:
188
+ case 5:
196
189
  teamSizeList = _h.sent();
197
190
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
198
191
  return [2, {
@@ -206,8 +199,7 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
206
199
  name: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.names,
207
200
  contact: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.contact,
208
201
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
209
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
210
- flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
202
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business
211
203
  },
212
204
  salesChannels: salesChannels,
213
205
  segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
@@ -217,6 +209,21 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
217
209
  }
218
210
  });
219
211
  }); });
212
+ export var retrieveBoardStatus = createAsyncThunk('brand/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
213
+ var brand, board_id, data;
214
+ return __generator(this, function (_a) {
215
+ switch (_a.label) {
216
+ case 0:
217
+ brand = thunkApi.getState().brand;
218
+ board_id = (brand.data.verify.responseBody || {}).board_id;
219
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
220
+ case 1:
221
+ data = _a.sent();
222
+ thunkApi.dispatch(handlePrevScreenStep());
223
+ return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
224
+ }
225
+ });
226
+ }); });
220
227
  export var retrieveBoardDetails = createAsyncThunk('brandRetrieveBrandInfo', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
221
228
  var data;
222
229
  var _a, _b;
@@ -672,6 +679,20 @@ export var brandSlice = createSlice({
672
679
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
673
680
  state.error = action.error.message;
674
681
  state.loading = false;
682
+ })
683
+ .addCase(retrieveBoardStatus.pending, function (state) {
684
+ state.error = null;
685
+ state.loading = true;
686
+ })
687
+ .addCase(retrieveBoardStatus.fulfilled, function (state, action) {
688
+ state.error = null;
689
+ state.loading = false;
690
+ var flows = action.payload.flows;
691
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
692
+ })
693
+ .addCase(retrieveBoardStatus.rejected, function (state, action) {
694
+ state.error = action.error.message;
695
+ state.loading = false;
675
696
  })
676
697
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
677
698
  var _a;
@@ -39,6 +39,9 @@ export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<
39
39
  };
40
40
  formData: OTPFormValues;
41
41
  }, OTPFormValues, {}>;
42
+ export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<{
43
+ flows: any;
44
+ }, void, {}>;
42
45
  export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
43
46
  data: any;
44
47
  }, string, {}>;
@@ -60,7 +60,7 @@ var _a;
60
60
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
61
61
  import API from '../../../api';
62
62
  import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../../@types';
63
- import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
63
+ import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { ENTITY_STEP_NAMES } from '../../../constants';
65
65
  import moment from 'moment';
66
66
  import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep } from '../../../utils';
@@ -209,6 +209,21 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
209
209
  }
210
210
  });
211
211
  }); });
212
+ export var retrieveBoardStatus = createAsyncThunk('entity/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
213
+ var entity, board_id, data;
214
+ return __generator(this, function (_a) {
215
+ switch (_a.label) {
216
+ case 0:
217
+ entity = thunkApi.getState().entity;
218
+ board_id = (entity.data.verify.responseBody || {}).board_id;
219
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
220
+ case 1:
221
+ data = _a.sent();
222
+ thunkApi.dispatch(handlePrevScreenStep());
223
+ return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
224
+ }
225
+ });
226
+ }); });
212
227
  export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
213
228
  var data;
214
229
  var _a, _b;
@@ -625,6 +640,20 @@ export var entitySlice = createSlice({
625
640
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
626
641
  state.error = action.error.message;
627
642
  state.loading = false;
643
+ })
644
+ .addCase(retrieveBoardStatus.pending, function (state) {
645
+ state.error = null;
646
+ state.loading = true;
647
+ })
648
+ .addCase(retrieveBoardStatus.fulfilled, function (state, action) {
649
+ state.error = null;
650
+ state.loading = false;
651
+ var flows = action.payload.flows;
652
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
653
+ })
654
+ .addCase(retrieveBoardStatus.rejected, function (state, action) {
655
+ state.error = action.error.message;
656
+ state.loading = false;
628
657
  })
629
658
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
630
659
  var _a;
@@ -61,6 +61,9 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
61
61
  monthlyIncome: any;
62
62
  occupation: any;
63
63
  }, string, {}>;
64
+ export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<{
65
+ flows: any;
66
+ }, void, {}>;
64
67
  export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
65
68
  data: any;
66
69
  }, string, {}>;
@@ -69,7 +69,7 @@ var _a;
69
69
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
70
70
  import API from '../../../api';
71
71
  import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
72
- import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
72
+ import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
74
  import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose } from '../../../utils';
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
@@ -389,6 +389,21 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
389
389
  }
390
390
  });
391
391
  }); });
392
+ export var retrieveBoardStatus = createAsyncThunk('individual/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
393
+ var individual, board_id, data;
394
+ return __generator(this, function (_a) {
395
+ switch (_a.label) {
396
+ case 0:
397
+ individual = thunkApi.getState().individual;
398
+ board_id = (individual.data.verify.responseBody || {}).board_id;
399
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
400
+ case 1:
401
+ data = _a.sent();
402
+ thunkApi.dispatch(handlePrevScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
403
+ return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
404
+ }
405
+ });
406
+ }); });
392
407
  export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
393
408
  var _a, user, data;
394
409
  var _b, _c;
@@ -1146,6 +1161,20 @@ export var individualSlice = createSlice({
1146
1161
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
1147
1162
  state.error = action.error.message;
1148
1163
  state.loading = false;
1164
+ })
1165
+ .addCase(retrieveBoardStatus.pending, function (state) {
1166
+ state.error = null;
1167
+ state.loading = true;
1168
+ })
1169
+ .addCase(retrieveBoardStatus.fulfilled, function (state, action) {
1170
+ state.error = null;
1171
+ state.loading = false;
1172
+ var flows = action.payload.flows;
1173
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
1174
+ })
1175
+ .addCase(retrieveBoardStatus.rejected, function (state, action) {
1176
+ state.error = action.error.message;
1177
+ state.loading = false;
1149
1178
  })
1150
1179
  .addCase(checkEmailAvailability.fulfilled, function (state, action) {
1151
1180
  var _a;
@@ -19,8 +19,8 @@ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, u
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import { BrandValidationSchema } from './validation';
21
21
  import Button from '../../../shared/Button';
22
- import { settingsSelector } from '../../../../app/settings';
23
- import { clearError, brandSelector, updateBrand } from '../../../app/brand/brandStore';
22
+ import { handlePrevScreenStep } from '../../../../app/settings';
23
+ import { clearError, brandSelector, updateBrand, retrieveBoardStatus } from '../../../app/brand/brandStore';
24
24
  import { useTranslation } from 'react-i18next';
25
25
  import TeamSize from '../../../brand/screens/BrandInfo/TeamSize';
26
26
  import Collapse from '../../../../components/Collapse';
@@ -39,16 +39,15 @@ var ListType;
39
39
  ListType["TeamSizeList"] = "TeamSizeList";
40
40
  })(ListType || (ListType = {}));
41
41
  var BrandInfo = function (_a) {
42
- var _b;
43
- var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
44
- var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
42
+ var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
43
+ var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
45
44
  var dispatch = useAppDispatch();
46
45
  var t = useTranslation().t;
47
46
  var isAr = useLanguage().isAr;
48
- var settingData = useAppSelector(settingsSelector).data;
49
- var _e = useAppSelector(brandSelector), data = _e.data, loading = _e.loading, error = _e.error, uploadingBrandLogo = _e.uploadingBrandLogo;
50
- var _f = data.brandData, brandName = _f.brandName, segment = _f.segment, teamSize = _f.teamSize, salesChannels = _f.salesChannels, brandLogoId = _f.brandLogoId, responseBody = _f.responseBody;
51
- var _g = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, logo_details = _g.logo_details, data_status = _g.data_status;
47
+ var _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error, uploadingBrandLogo = _d.uploadingBrandLogo;
48
+ var _e = data.brandData, brandName = _e.brandName, segment = _e.segment, teamSize = _e.teamSize, salesChannels = _e.salesChannels, brandLogoId = _e.brandLogoId, responseBody = _e.responseBody;
49
+ var _f = data.verify.responseBody || {}, brand = _f.brand, flows = _f.flows;
50
+ var _g = brand || {}, logo_details = _g.logo_details, data_status = _g.data_status;
52
51
  var methods = useForm({
53
52
  resolver: yupResolver(BrandValidationSchema()),
54
53
  defaultValues: {
@@ -64,6 +63,13 @@ var BrandInfo = function (_a) {
64
63
  var onSubmit = function (data) {
65
64
  dispatch(updateBrand(data));
66
65
  };
66
+ var onBack = function () {
67
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
68
+ dispatch(handlePrevScreenStep());
69
+ return;
70
+ }
71
+ dispatch(retrieveBoardStatus());
72
+ };
67
73
  React.useEffect(function () {
68
74
  if (error)
69
75
  dispatch(clearError());
@@ -87,6 +93,6 @@ var BrandInfo = function (_a) {
87
93
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
88
94
  var isSegmentsListActive = listActive === ListType.SegmentsList;
89
95
  var isTeamSizeListActive = listActive === ListType.TeamSizeList;
90
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || noneEditable['name'], show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
96
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || noneEditable['name'], show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
91
97
  };
92
98
  export default BrandInfo;
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
@@ -28,7 +17,6 @@ import { useForm, FormProvider } from 'react-hook-form';
28
17
  import { yupResolver } from '@hookform/resolvers/yup';
29
18
  import Box from '@mui/material/Box/Box';
30
19
  import { styled } from '@mui/material/styles';
31
- import { handlePrevScreenStep } from '../../../../app/settings';
32
20
  import { useLanguage, useAppSelector } from '../../../../hooks';
33
21
  import { maskPhone } from '../../../../utils';
34
22
  import Form from '../../../../components/Form';
@@ -61,16 +49,18 @@ var VerifyNumber = function (_a) {
61
49
  var _b, _c;
62
50
  var dispatch = useAppDispatch();
63
51
  var _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error;
64
- var _e = data.otpData, responseBody = _e.responseBody, defaultValues = __rest(_e, ["responseBody"]);
52
+ var otp = data.otpData.otp;
65
53
  var methods = useForm({
66
54
  resolver: yupResolver(OTPValidation),
67
- defaultValues: defaultValues,
55
+ defaultValues: {
56
+ otp: otp
57
+ },
68
58
  mode: 'onChange'
69
59
  });
70
- useSetFromDefaultValues(methods, defaultValues);
60
+ useSetFromDefaultValues(methods, data.otpData);
71
61
  var t = useTranslation().t;
72
62
  var isAr = useLanguage().isAr;
73
- var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
63
+ var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
74
64
  var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
75
65
  React.useEffect(function () {
76
66
  if (error && methods.formState.isValid && phone)
@@ -82,10 +72,7 @@ var VerifyNumber = function (_a) {
82
72
  var onSubmit = function (formData) {
83
73
  dispatch(verifyBrandLeadOTP(formData));
84
74
  };
85
- var onBack = function () {
86
- dispatch(handlePrevScreenStep());
87
- };
88
75
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
89
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
76
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
90
77
  };
91
78
  export default React.memo(VerifyNumber);
@@ -16,12 +16,12 @@ import { useTranslation } from 'react-i18next';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
19
- import { settingsSelector } from '../../../../app/settings';
19
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
20
  import { getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
21
21
  import { BusinessType, DocumentPurpose } from '../../../../@types';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
24
- import { clearError, entitySelector, updateEntityName } from '../../../app/entity/entityStore';
24
+ import { clearError, entitySelector, retrieveBoardStatus, updateEntityName } from '../../../app/entity/entityStore';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
26
26
  import Button from '../../../shared/Button';
27
27
  import { EntityNameValidationSchema, EntityNameKWValidationSchema } from './validation';
@@ -51,7 +51,7 @@ var EntityName = function (_a) {
51
51
  var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
52
52
  var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
53
53
  var isCR = licenseType === BusinessType.CR;
54
- var entity = (data.verify.responseBody || {}).entity;
54
+ var _g = data.verify.responseBody || {}, entity = _g.entity, flows = _g.flows;
55
55
  var methods = useForm({
56
56
  resolver: yupResolver(isSACountry ? EntityNameValidationSchema() : EntityNameKWValidationSchema()),
57
57
  defaultValues: {
@@ -95,6 +95,13 @@ var EntityName = function (_a) {
95
95
  var handleEntityOpenClose = function (flag) {
96
96
  setEntityTypeAnchorEl(flag);
97
97
  };
98
+ var onBack = function () {
99
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
100
+ dispatch(handlePrevScreenStep());
101
+ return;
102
+ }
103
+ dispatch(retrieveBoardStatus());
104
+ };
98
105
  React.useEffect(function () {
99
106
  if (error)
100
107
  dispatch(clearError());
@@ -102,6 +109,6 @@ var EntityName = function (_a) {
102
109
  var disabled = !methods.formState.isValid || !!error || uploading || uploadingArticle;
103
110
  var showLicenseNumber = !isSACountry ? isCR : true;
104
111
  var showUnifiedNumber = isSACountry ? isCR : false;
105
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']) }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); } }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'] }), _jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'] })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'] }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'] }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: !(isKWCountry && !isCR), readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: true, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'] })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
112
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']) }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); } }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'] }), _jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'] })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'] }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'] }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: !(isKWCountry && !isCR), readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: true, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'] })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
106
113
  };
107
114
  export default EntityName;
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
@@ -28,7 +17,6 @@ import { useForm, FormProvider } from 'react-hook-form';
28
17
  import { yupResolver } from '@hookform/resolvers/yup';
29
18
  import Box from '@mui/material/Box/Box';
30
19
  import { styled } from '@mui/material/styles';
31
- import { handlePrevScreenStep } from '../../../../app/settings';
32
20
  import { useLanguage, useAppSelector } from '../../../../hooks';
33
21
  import { maskPhone } from '../../../../utils';
34
22
  import Form from '../../../../components/Form';
@@ -61,16 +49,18 @@ var VerifyNumber = function (_a) {
61
49
  var _b, _c;
62
50
  var dispatch = useAppDispatch();
63
51
  var _d = useAppSelector(entitySelector), data = _d.data, loading = _d.loading, error = _d.error;
64
- var _e = data.otpData, responseBody = _e.responseBody, defaultValues = __rest(_e, ["responseBody"]);
52
+ var otp = data.otpData.otp;
65
53
  var methods = useForm({
66
54
  resolver: yupResolver(OTPValidation),
67
- defaultValues: defaultValues,
55
+ defaultValues: {
56
+ otp: otp
57
+ },
68
58
  mode: 'onChange'
69
59
  });
70
- useSetFromDefaultValues(methods, defaultValues);
60
+ useSetFromDefaultValues(methods, data.otpData);
71
61
  var t = useTranslation().t;
72
62
  var isAr = useLanguage().isAr;
73
- var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
63
+ var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
74
64
  var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
75
65
  React.useEffect(function () {
76
66
  if (error && methods.formState.isValid && phone)
@@ -82,10 +72,7 @@ var VerifyNumber = function (_a) {
82
72
  var onSubmit = function (formData) {
83
73
  dispatch(verifyEntityLeadOTP(formData));
84
74
  };
85
- var onBack = function () {
86
- dispatch(handlePrevScreenStep());
87
- };
88
75
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
89
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
76
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
90
77
  };
91
78
  export default React.memo(VerifyNumber);
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { yupResolver } from '@hookform/resolvers/yup';
15
15
  import { useForm, FormProvider } from 'react-hook-form';
16
16
  import { useTranslation } from 'react-i18next';
17
- import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
17
+ import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
18
18
  import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
20
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
@@ -22,7 +22,7 @@ import { IndividualType } from '../../../../@types';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
24
24
  import Text from '../../../../components/Text';
25
- import { clearError, individualSelector, updateIndividualPersonalInfo } from '../../../app/individual/individualStore';
25
+ import { clearError, individualSelector, retrieveBoardStatus, updateIndividualPersonalInfo } from '../../../app/individual/individualStore';
26
26
  import Button from '../../../shared/Button';
27
27
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
28
28
  import { IndividualInfoValidationSchema } from './validation';
@@ -61,7 +61,7 @@ var IndividualPersonalInfo = function (_a) {
61
61
  var settingsData = useAppSelector(settingsSelector).data;
62
62
  var countries = settingsData.countries;
63
63
  var verify = data.verify, individualPersonalData = data.individualPersonalData;
64
- var user = (verify.responseBody || {}).user;
64
+ var _c = verify.responseBody || {}, user = _c.user, flows = _c.flows;
65
65
  var name = individualPersonalData.name, email = individualPersonalData.email, mobile = individualPersonalData.mobile, countryCode = individualPersonalData.countryCode, gender = individualPersonalData.gender, nid = individualPersonalData.nid, issuedCountry = individualPersonalData.issuedCountry, expiryDate = individualPersonalData.expiryDate, dob = individualPersonalData.dob, placeOfBirthCountry = individualPersonalData.placeOfBirthCountry, placeOfBirthCity = individualPersonalData.placeOfBirthCity, nationality = individualPersonalData.nationality;
66
66
  var methods = useForm({
67
67
  resolver: yupResolver(IndividualInfoValidationSchema),
@@ -82,9 +82,9 @@ var IndividualPersonalInfo = function (_a) {
82
82
  mode: 'onChange'
83
83
  });
84
84
  useSetFromDefaultValues(methods, data.individualPersonalData);
85
- var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
86
- var _d = React.useState(false), dobActive = _d[0], setDobActive = _d[1];
87
- var _e = React.useState(false), expiryDateActive = _e[0], setExpiryDateActive = _e[1];
85
+ var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
86
+ var _e = React.useState(false), dobActive = _e[0], setDobActive = _e[1];
87
+ var _f = React.useState(false), expiryDateActive = _f[0], setExpiryDateActive = _f[1];
88
88
  var originalReadOnly = useFormReadOnly(methods);
89
89
  var noneEditable = useDataNoneEditable(user === null || user === void 0 ? void 0 : user.data_status, [
90
90
  'name',
@@ -111,7 +111,15 @@ var IndividualPersonalInfo = function (_a) {
111
111
  var onBack = function () {
112
112
  if (error)
113
113
  dispatch(clearError());
114
- dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
114
+ if (user === null || user === void 0 ? void 0 : user.is_authorized) {
115
+ dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
116
+ return;
117
+ }
118
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
119
+ dispatch(handlePrevScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
120
+ return;
121
+ }
122
+ dispatch(retrieveBoardStatus());
115
123
  };
116
124
  var handleMenuClick = function (flag) {
117
125
  setListActive(flag);
@@ -149,7 +157,7 @@ var IndividualPersonalInfo = function (_a) {
149
157
  !isDateFieldActive &&
150
158
  !isIssuedCountryListActive &&
151
159
  !isBirthCountryListActive &&
152
- !isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Nationality, { readOnly: readOnly['nationality'] || noneEditable['nationality'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); } })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: !(user === null || user === void 0 ? void 0 : user.is_authorized), disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
160
+ !isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Nationality, { readOnly: readOnly['nationality'] || noneEditable['nationality'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); } })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
153
161
  };
154
162
  IndividualPersonalInfo.defaultProps = {};
155
163
  export default React.memo(IndividualPersonalInfo);
@@ -17,7 +17,6 @@ import { useForm, FormProvider } from 'react-hook-form';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import Box from '@mui/material/Box/Box';
19
19
  import { styled } from '@mui/material/styles';
20
- import { handlePrevScreenStep } from '../../../../app/settings';
21
20
  import { useLanguage, useAppSelector } from '../../../../hooks';
22
21
  import { maskPhone } from '../../../../utils';
23
22
  import Form from '../../../../components/Form';
@@ -73,12 +72,9 @@ var VerifyNumber = function (_a) {
73
72
  var onSubmit = function (formData) {
74
73
  dispatch(verifyLeadOTP(formData));
75
74
  };
76
- var onBack = function () {
77
- dispatch(handlePrevScreenStep());
78
- };
79
75
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
80
76
  var dataLoading = loading || cityLoading;
81
77
  var showMobileNumber = !loading && !cityLoading && phone;
82
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [dataLoading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), showMobileNumber && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
78
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [dataLoading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), showMobileNumber && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
83
79
  };
84
80
  export default React.memo(VerifyNumber);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.72-test",
3
+ "version": "2.3.74-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",