@tap-payments/auth-jsconnect 2.8.24-test → 2.8.26-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.
Files changed (27) hide show
  1. package/build/@types/app.d.ts +2 -0
  2. package/build/constants/dummy.d.ts +6 -0
  3. package/build/constants/dummy.js +36 -12
  4. package/build/features/app/bank/bankStore.js +31 -25
  5. package/build/features/app/brand/brandStore.js +34 -28
  6. package/build/features/app/entity/entityStore.js +27 -25
  7. package/build/features/app/individual/individualStore.js +85 -75
  8. package/build/features/app/tax/taxStore.js +28 -22
  9. package/build/features/auth/screens/Mobile/MobileNumber.js +7 -4
  10. package/build/features/auth/screens/Mobile/validation.js +8 -3
  11. package/build/features/connect/screens/Individual/MobileNumber.js +6 -3
  12. package/build/features/connect/screens/Individual/validation.js +8 -3
  13. package/build/features/connect/screens/Mobile/MobileNumber.js +6 -3
  14. package/build/features/connect/screens/Mobile/validation.js +8 -3
  15. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +7 -4
  16. package/build/features/connectExpress/screens/CollectIndividualInfo/validation.js +8 -3
  17. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +7 -4
  18. package/build/features/connectExpress/screens/Mobile/validation.js +16 -6
  19. package/build/features/individual/screens/IndividualList/MobileNumber.js +6 -3
  20. package/build/features/individual/screens/IndividualList/validation.js +8 -3
  21. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +6 -3
  22. package/build/features/individual/screens/IndividualPersonalInfo/validation.js +8 -3
  23. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +7 -4
  24. package/build/features/individual/screens/IndividualPhoneInfo/validation.js +8 -3
  25. package/build/features/signIn/screens/Mobile/MobileNumber.js +6 -3
  26. package/build/features/signIn/screens/Mobile/validation.js +8 -3
  27. package/package.json +1 -1
@@ -75,10 +75,10 @@ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountry
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
78
- var settings, payload, data, userList, recipientData, countries, countryCode, publicKey, _b, business_id, recipient, board_id, board_info_id, notification, _c, id_1, type, individualData, birthCountry;
79
- var _d, _e, _f, _g;
80
- return __generator(this, function (_h) {
81
- switch (_h.label) {
78
+ var settings, payload, data, userList, recipientData, countries, _b, country_code, config, boardId, countryCode, publicKey, data_1, _c, business_id, recipient, board_id, board_info_id, notification, _d, id_1, type, individualData, birthCountry;
79
+ var _e, _f, _g, _h;
80
+ return __generator(this, function (_j) {
81
+ switch (_j.label) {
82
82
  case 0:
83
83
  settings = thunkApi.getState().settings;
84
84
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
@@ -88,77 +88,87 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
88
88
  }));
89
89
  return [4, API.leadService.verifyLeadToken(payload)];
90
90
  case 1:
91
- data = (_h.sent()).data;
91
+ data = (_j.sent()).data;
92
92
  recipientData = undefined;
93
93
  countries = settings.data.countries;
94
- if (((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
94
+ if (((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
95
95
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
96
96
  if (isInternally)
97
97
  data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
98
- countryCode = data === null || data === void 0 ? void 0 : data.country_code;
99
- if (data === null || data === void 0 ? void 0 : data.country_code)
100
- thunkApi.dispatch(handleSetCountryByIso2(countryCode));
101
- publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
98
+ _b = data || {}, country_code = _b.country_code, config = _b.config, boardId = _b.id;
99
+ countryCode = country_code;
100
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
101
+ if (country_code)
102
+ thunkApi.dispatch(handleSetCountryByIso2(country_code));
102
103
  if (publicKey)
103
104
  thunkApi.dispatch(handlePublicKey(publicKey));
104
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
105
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
106
- return [3, 16];
105
+ if (!!country_code) return [3, 3];
106
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
107
107
  case 2:
108
- if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 15];
109
- _b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
108
+ data_1 = _j.sent();
109
+ countryCode = (_f = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _f === void 0 ? void 0 : _f.country;
110
+ if (countryCode)
111
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
112
+ _j.label = 3;
113
+ case 3:
114
+ if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 4];
115
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
116
+ return [3, 18];
117
+ case 4:
118
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 17];
119
+ _c = data || {}, business_id = _c.business_id, recipient = _c.recipient, board_id = _c.id, board_info_id = _c.board_info_id;
110
120
  recipientData = recipient;
111
- if (!!((_f = data === null || data === void 0 ? void 0 : data.recipient) === null || _f === void 0 ? void 0 : _f.id)) return [3, 4];
112
- if (!(board_id && board_info_id)) return [3, 4];
121
+ if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 6];
122
+ if (!(board_id && board_info_id)) return [3, 6];
113
123
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
114
- case 3:
115
- notification = (_h.sent()).notification;
124
+ case 5:
125
+ notification = (_j.sent()).notification;
116
126
  recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
117
127
  if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
118
128
  throw new Error('individual_id_missing');
119
- _h.label = 4;
120
- case 4:
121
- _c = recipientData || {}, id_1 = _c.id, type = _c.type;
122
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id_1, type: type, countryCode: countryCode })).unwrap()];
123
- case 5:
124
- individualData = (_h.sent()).data;
125
- if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 8];
126
- if (!business_id) return [3, 7];
127
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
129
+ _j.label = 6;
128
130
  case 6:
129
- userList = _h.sent();
130
- _h.label = 7;
131
+ _d = recipientData || {}, id_1 = _d.id, type = _d.type;
132
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id_1, type: type, countryCode: countryCode })).unwrap()];
131
133
  case 7:
132
- userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id_1; });
133
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
134
- return [3, 14];
135
- case 8:
136
- if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
137
- if (!business_id) return [3, 10];
134
+ individualData = (_j.sent()).data;
135
+ if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 10];
136
+ if (!business_id) return [3, 9];
138
137
  return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
138
+ case 8:
139
+ userList = _j.sent();
140
+ _j.label = 9;
139
141
  case 9:
140
- userList = _h.sent();
141
- _h.label = 10;
142
- case 10:
142
+ userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id_1; });
143
143
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
144
- return [3, 14];
144
+ return [3, 16];
145
+ case 10:
146
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 13];
147
+ if (!business_id) return [3, 12];
148
+ return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
145
149
  case 11:
146
- birthCountry = ((_g = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _g === void 0 ? void 0 : _g.country) || countryCode;
147
- if (!birthCountry) return [3, 13];
148
- return [4, thunkApi.dispatch(getCityList(birthCountry))];
150
+ userList = _j.sent();
151
+ _j.label = 12;
149
152
  case 12:
150
- _h.sent();
151
- _h.label = 13;
153
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
154
+ return [3, 16];
152
155
  case 13:
153
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
154
- _h.label = 14;
155
- case 14: return [3, 16];
156
+ birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
157
+ if (!birthCountry) return [3, 15];
158
+ return [4, thunkApi.dispatch(getCityList(birthCountry))];
159
+ case 14:
160
+ _j.sent();
161
+ _j.label = 15;
156
162
  case 15:
163
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
164
+ _j.label = 16;
165
+ case 16: return [3, 18];
166
+ case 17:
157
167
  if (isUpdatePhoneInfo) {
158
168
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
159
169
  }
160
- _h.label = 16;
161
- case 16: return [2, {
170
+ _j.label = 18;
171
+ case 18: return [2, {
162
172
  data: data,
163
173
  countries: countries,
164
174
  countryCode: countryCode,
@@ -225,7 +235,7 @@ export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', func
225
235
  });
226
236
  }); });
227
237
  export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
228
- var individual, _a, merchant_id, board_id, user, collectInfo, id, objects, ids, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_1, user_1, payload, data;
238
+ var individual, _a, merchant_id, board_id, user, collectInfo, id, objects, ids, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_2, user_1, payload, data;
229
239
  var _c;
230
240
  return __generator(this, function (_d) {
231
241
  switch (_d.label) {
@@ -255,8 +265,8 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
255
265
  };
256
266
  return [4, API.individualService.updateMultipleIndividual(requestBody)];
257
267
  case 1:
258
- data_1 = _d.sent();
259
- user_1 = (sortUserList(mapUserList(data_1 === null || data_1 === void 0 ? void 0 : data_1.individuals)) || [])[0];
268
+ data_2 = _d.sent();
269
+ user_1 = (sortUserList(mapUserList(data_2 === null || data_2 === void 0 ? void 0 : data_2.individuals)) || [])[0];
260
270
  individualData = user_1;
261
271
  _d.label = 2;
262
272
  case 2:
@@ -399,7 +409,7 @@ export var retrieveBoardStatus = createAsyncThunk('individual/retrieveBoardStatu
399
409
  export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (_a, thunkApi) {
400
410
  var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
401
411
  return __awaiter(void 0, void 0, void 0, function () {
402
- var _b, individual, settings, individualData, _c, user, data, data_2, data_state;
412
+ var _b, individual, settings, individualData, _c, user, data, data_3, data_state;
403
413
  var _d, _e, _f;
404
414
  return __generator(this, function (_g) {
405
415
  switch (_g.label) {
@@ -416,8 +426,8 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
416
426
  if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && id && type)) return [3, 4];
417
427
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: settings.data.businessCountry.iso2 })).unwrap()];
418
428
  case 3:
419
- data_2 = (_g.sent()).data;
420
- individualData = data_2;
429
+ data_3 = (_g.sent()).data;
430
+ individualData = data_3;
421
431
  _g.label = 4;
422
432
  case 4:
423
433
  data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && (data === null || data === void 0 ? void 0 : data.individuals) ? data === null || data === void 0 ? void 0 : data.individuals : individualData) || {}).data_state;
@@ -432,9 +442,9 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
432
442
  });
433
443
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
434
444
  var _a, individual, settings, responseBody, countries, payload, data, userList, recipientData, publicKey, countryCode, _b, business_id, recipient, board_id, board_info_id, notification, _c, id, type, individualData, birthCountry;
435
- var _d, _e, _f, _g, _h, _j, _k;
436
- return __generator(this, function (_l) {
437
- switch (_l.label) {
445
+ var _d, _e, _f, _g, _h, _j, _k, _l;
446
+ return __generator(this, function (_m) {
447
+ switch (_m.label) {
438
448
  case 0:
439
449
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
440
450
  responseBody = individual.data.verify.responseBody;
@@ -448,38 +458,38 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
448
458
  };
449
459
  return [4, API.leadService.verifyLeadOTP(payload)];
450
460
  case 1:
451
- data = (_l.sent()).data;
461
+ data = (_m.sent()).data;
452
462
  recipientData = undefined;
453
463
  if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
454
464
  throw new Error(data.errors[0].description);
455
465
  publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
466
+ countryCode = data === null || data === void 0 ? void 0 : data.country_code;
456
467
  if (publicKey)
457
468
  thunkApi.dispatch(handlePublicKey(publicKey));
458
- countryCode = data === null || data === void 0 ? void 0 : data.country_code;
459
- if (countryCode)
469
+ if (!((_g = settings.data.businessCountry) === null || _g === void 0 ? void 0 : _g.iso2) && countryCode)
460
470
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
461
471
  _b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
462
472
  recipientData = recipient;
463
- if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 3];
473
+ if (!!((_h = data === null || data === void 0 ? void 0 : data.recipient) === null || _h === void 0 ? void 0 : _h.id)) return [3, 3];
464
474
  if (!(board_id && board_info_id)) return [3, 3];
465
475
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
466
476
  case 2:
467
- notification = (_l.sent()).notification;
477
+ notification = (_m.sent()).notification;
468
478
  recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
469
479
  if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
470
480
  throw new Error('individual_id_missing');
471
- _l.label = 3;
481
+ _m.label = 3;
472
482
  case 3:
473
483
  _c = recipientData || {}, id = _c.id, type = _c.type;
474
484
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
475
485
  case 4:
476
- individualData = (_l.sent()).data;
486
+ individualData = (_m.sent()).data;
477
487
  if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 7];
478
488
  if (!business_id) return [3, 6];
479
489
  return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
480
490
  case 5:
481
- userList = _l.sent();
482
- _l.label = 6;
491
+ userList = _m.sent();
492
+ _m.label = 6;
483
493
  case 6:
484
494
  userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id; });
485
495
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
@@ -489,23 +499,23 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
489
499
  if (!business_id) return [3, 9];
490
500
  return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
491
501
  case 8:
492
- userList = _l.sent();
493
- _l.label = 9;
502
+ userList = _m.sent();
503
+ _m.label = 9;
494
504
  case 9:
495
505
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
496
506
  return [3, 13];
497
507
  case 10:
498
- birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
508
+ birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
499
509
  if (!birthCountry) return [3, 12];
500
510
  return [4, thunkApi.dispatch(getCityList(birthCountry))];
501
511
  case 11:
502
- _l.sent();
503
- _l.label = 12;
512
+ _m.sent();
513
+ _m.label = 12;
504
514
  case 12:
505
515
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
506
- _l.label = 13;
516
+ _m.label = 13;
507
517
  case 13:
508
- (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { otp: params.otp });
518
+ (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
509
519
  return [2, {
510
520
  data: data,
511
521
  countries: countries,
@@ -55,10 +55,10 @@ import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, retrieveIndividu
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, entityData, _b, config, country_code, entity_id, boardId, publicKey, countryIso2, data_1;
59
- var _c, _d;
60
- return __generator(this, function (_e) {
61
- switch (_e.label) {
58
+ var payload, data, entityData, _b, config, country_code, entity_id, boardId, publicKey, data_1;
59
+ var _c, _d, _e;
60
+ return __generator(this, function (_f) {
61
+ switch (_f.label) {
62
62
  case 0:
63
63
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
64
64
  notification: {
@@ -67,7 +67,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
67
67
  }));
68
68
  return [4, API.leadService.verifyLeadToken(payload)];
69
69
  case 1:
70
- data = (_e.sent()).data;
70
+ data = (_f.sent()).data;
71
71
  entityData = undefined;
72
72
  if (((_c = data === null || data === void 0 ? void 0 : data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
73
73
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
@@ -77,9 +77,8 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
77
77
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
78
78
  if (publicKey)
79
79
  thunkApi.dispatch(handlePublicKey(publicKey));
80
- countryIso2 = country_code;
81
- if (countryIso2)
82
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
80
+ if (country_code)
81
+ thunkApi.dispatch(handleSetCountryByIso2(country_code));
83
82
  if (!(data.step_name === TAX_STEP_NAMES.PHONE_AUTH)) return [3, 2];
84
83
  thunkApi.dispatch(handleCurrentActiveScreen('TAX_VERIFY_STEP'));
85
84
  return [3, 7];
@@ -88,18 +87,20 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
88
87
  if (!!entity_id) return [3, 4];
89
88
  return [4, API.boardService.retrieveBoardDetails(boardId)];
90
89
  case 3:
91
- data_1 = _e.sent();
90
+ data_1 = _f.sent();
92
91
  if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.id))
93
92
  throw new Error('entity_id_missing');
94
93
  entityData = data_1;
95
94
  return [3, 6];
96
95
  case 4: return [4, API.entityService.retrieveEntity(entity_id)];
97
96
  case 5:
98
- entityData = _e.sent();
99
- _e.label = 6;
97
+ entityData = _f.sent();
98
+ _f.label = 6;
100
99
  case 6:
100
+ if (!country_code && ((_e = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _e === void 0 ? void 0 : _e.country))
101
+ thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
101
102
  thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
102
- _e.label = 7;
103
+ _f.label = 7;
103
104
  case 7: return [2, {
104
105
  data: data,
105
106
  entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
@@ -173,10 +174,10 @@ export var retrieveBoardDetails = createAsyncThunk('tax/retrieveBrandInfo', func
173
174
  });
174
175
  });
175
176
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
176
- var _a, tax, settings, responseBody, payload, data, _b, config, entity_id, boardId, entityData, publicKey, data_2;
177
- var _c, _d, _e, _f, _g;
178
- return __generator(this, function (_h) {
179
- switch (_h.label) {
177
+ var _a, tax, settings, responseBody, payload, data, _b, config, entity_id, boardId, country_code, entityData, publicKey, countryIso2, data_2;
178
+ var _c, _d, _e, _f, _g, _h;
179
+ return __generator(this, function (_j) {
180
+ switch (_j.label) {
180
181
  case 0:
181
182
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
182
183
  responseBody = tax.data.verify.responseBody;
@@ -189,28 +190,33 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
189
190
  };
190
191
  return [4, API.leadService.verifyLeadOTP(payload)];
191
192
  case 1:
192
- data = (_h.sent()).data;
193
+ data = (_j.sent()).data;
193
194
  if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
194
195
  throw new Error(data.errors[0].description);
195
- _b = data || {}, config = _b.config, entity_id = _b.entity_id, boardId = _b.id;
196
+ _b = data || {}, config = _b.config, entity_id = _b.entity_id, boardId = _b.id, country_code = _b.country_code;
196
197
  entityData = undefined;
197
198
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
199
+ countryIso2 = country_code || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
198
200
  if (publicKey)
199
201
  thunkApi.dispatch(handlePublicKey(publicKey));
202
+ if (countryIso2)
203
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
200
204
  if (!!entity_id) return [3, 3];
201
205
  return [4, API.boardService.retrieveBoardDetails(boardId)];
202
206
  case 2:
203
- data_2 = _h.sent();
207
+ data_2 = _j.sent();
204
208
  if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
205
209
  throw new Error('entity_id_missing');
206
210
  entityData = data_2;
207
211
  return [3, 5];
208
212
  case 3: return [4, API.entityService.retrieveEntity(entity_id)];
209
213
  case 4:
210
- entityData = _h.sent();
211
- _h.label = 5;
214
+ entityData = _j.sent();
215
+ _j.label = 5;
212
216
  case 5:
213
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, { otp: params.otp });
217
+ if (!countryIso2 && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
218
+ thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
219
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
214
220
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
215
221
  return [2, { data: data, entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity, formData: params }];
216
222
  }
@@ -95,9 +95,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
95
95
  var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
96
96
  var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
97
97
  var isSA = countryCodeValue.iso2 === 'SA';
98
- var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
98
+ var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
99
+ var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
99
100
  var isStartsWith5 = mobileValue.startsWith('5');
100
- var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
101
+ var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
102
+ var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
103
+ var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
101
104
  React.useEffect(function () {
102
105
  if (mobileValue)
103
106
  setValue('mobile', mobileValue, { shouldValidate: true });
@@ -144,11 +147,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
144
147
  });
145
148
  setCountries(filteredCountries);
146
149
  };
147
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 5 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl || readOnly, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
150
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 5 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl || readOnly, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
148
151
  if (readOnly)
149
152
  return;
150
153
  toggleCountryList();
151
- } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
154
+ } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
152
155
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
153
156
  } })] }))] })) })));
154
157
  });
@@ -7,7 +7,8 @@ export var PhoneValidationSchema = function () {
7
7
  test: function (value) {
8
8
  var countryCode = this.parent.countryCode;
9
9
  var isSA = countryCode.iso2 === 'SA';
10
- var digits = countryCode.digits;
10
+ var maxDigits = countryCode.max_digits;
11
+ var minDigits = countryCode.min_digits;
11
12
  var mobileValue = value || '';
12
13
  var valueLen = mobileValue.length;
13
14
  var isNumber = mobileValue.match(/^[0-9]/g);
@@ -19,10 +20,14 @@ export var PhoneValidationSchema = function () {
19
20
  if (isSA) {
20
21
  if (!isSaudiNumber)
21
22
  return this.createError({ message: 'start_with_number' });
22
- var requiredLen = isStartWith5 ? digits - 1 : digits;
23
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
23
24
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
24
25
  }
25
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
26
+ if (valueLen >= minDigits && valueLen <= maxDigits)
27
+ return true;
28
+ if (minDigits === maxDigits)
29
+ return this.createError({ message: 'enter_valid_mobile_number' });
30
+ return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
26
31
  }
27
32
  })
28
33
  .required('mobile_number_error')
@@ -95,9 +95,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
95
95
  var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
96
96
  var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
97
97
  var isSA = countryCodeValue.iso2 === 'SA';
98
- var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
98
+ var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
99
+ var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
99
100
  var isStartsWith5 = mobileValue.startsWith('5');
100
- var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
101
+ var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
102
+ var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
103
+ var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
101
104
  var _k = ((_f = (_e = data.otpData.responseBody) === null || _e === void 0 ? void 0 : _e.contact) === null || _f === void 0 ? void 0 : _f.phone) || {}, number = _k.number, country_code = _k.country_code;
102
105
  var readOnly = number && country_code && !error;
103
106
  React.useEffect(function () {
@@ -146,7 +149,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
146
149
  });
147
150
  setCountries(filteredCountries);
148
151
  };
149
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl || readOnly, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: readOnly ? undefined : function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
152
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl || readOnly, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: readOnly ? undefined : function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
150
153
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
151
154
  } })] }))] })) })));
152
155
  });
@@ -13,7 +13,8 @@ export var IndividualMobileValidation = yup.object().shape({
13
13
  test: function (value) {
14
14
  var countryCode = this.parent.countryCode;
15
15
  var isSA = countryCode.iso2 === 'SA';
16
- var digits = countryCode.digits;
16
+ var maxDigits = countryCode.max_digits;
17
+ var minDigits = countryCode.min_digits;
17
18
  var mobileValue = value || '';
18
19
  var valueLen = mobileValue.length;
19
20
  var isNumber = mobileValue.match(/^[0-9]/g);
@@ -25,10 +26,14 @@ export var IndividualMobileValidation = yup.object().shape({
25
26
  if (isSA) {
26
27
  if (!isSaudiNumber)
27
28
  return this.createError({ message: 'start_with_number' });
28
- var requiredLen = isStartWith5 ? digits - 1 : digits;
29
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
29
30
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
30
31
  }
31
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
32
+ if (valueLen >= minDigits && valueLen <= maxDigits)
33
+ return true;
34
+ if (minDigits === maxDigits)
35
+ return this.createError({ message: 'enter_valid_mobile_number' });
36
+ return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
32
37
  }
33
38
  })
34
39
  .required('mobile_number_error')
@@ -97,9 +97,12 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
97
97
  var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
98
98
  var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
99
99
  var isSA = countryCodeValue.iso2 === 'SA';
100
- var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
100
+ var mobileMaxLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.max_digits;
101
+ var mobileMinLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.min_digits;
101
102
  var isStartsWith5 = mobileValue.startsWith('5');
102
- var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
103
+ var requiredSALen = isStartsWith5 ? mobileMaxLen - 1 : mobileMaxLen;
104
+ var requiredMinLen = isSA ? requiredSALen : mobileMinLen;
105
+ var requiredMaxLen = isSA ? requiredSALen : mobileMaxLen;
103
106
  var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_e = settingsStore.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2]);
104
107
  React.useEffect(function () {
105
108
  if (mobileValue)
@@ -154,7 +157,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
154
157
  });
155
158
  setCountries(filteredCountries);
156
159
  };
157
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
160
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredMaxLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { minLength: requiredMinLen, length: requiredMaxLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
158
161
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
159
162
  } })] }))] })) })));
160
163
  });
@@ -6,7 +6,8 @@ export var PhoneValidationSchema = yup.object().shape({
6
6
  test: function (value) {
7
7
  var countryCode = this.parent.countryCode;
8
8
  var isSA = countryCode.iso2 === 'SA';
9
- var digits = countryCode.digits;
9
+ var maxDigits = countryCode.max_digits;
10
+ var minDigits = countryCode.min_digits;
10
11
  var mobileValue = value || '';
11
12
  var valueLen = mobileValue.length;
12
13
  var isNumber = mobileValue.match(/^[0-9]/g);
@@ -18,10 +19,14 @@ export var PhoneValidationSchema = yup.object().shape({
18
19
  if (isSA) {
19
20
  if (!isSaudiNumber)
20
21
  return this.createError({ message: 'start_with_number' });
21
- var requiredLen = isStartWith5 ? digits - 1 : digits;
22
+ var requiredLen = isStartWith5 ? maxDigits - 1 : maxDigits;
22
23
  return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
23
24
  }
24
- return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
25
+ if (valueLen >= minDigits && valueLen <= maxDigits)
26
+ return true;
27
+ if (minDigits === maxDigits)
28
+ return this.createError({ message: 'enter_valid_mobile_number' });
29
+ return this.createError({ message: 'enter_valid_mobile_number_min_max_length' });
25
30
  }
26
31
  })
27
32
  .required('mobile_number_error')