@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
@@ -26,6 +26,8 @@ export interface CountryCode {
26
26
  logo: string;
27
27
  digits: number;
28
28
  supported_by_tap: boolean;
29
+ min_digits: number;
30
+ max_digits: number;
29
31
  }
30
32
  export interface City {
31
33
  id: string;
@@ -76,6 +76,8 @@ export declare const defaultCountry: {
76
76
  logo: string;
77
77
  digits: number;
78
78
  supported_by_tap: boolean;
79
+ min_digits: number;
80
+ max_digits: number;
79
81
  };
80
82
  export declare const businessCountries: ({
81
83
  created: number;
@@ -102,6 +104,8 @@ export declare const businessCountries: ({
102
104
  logo: string;
103
105
  digits: number;
104
106
  supported_by_tap: boolean;
107
+ min_digits: number;
108
+ max_digits: number;
105
109
  } | {
106
110
  created: number;
107
111
  updated: number;
@@ -126,6 +130,8 @@ export declare const businessCountries: ({
126
130
  idd_prefix: number;
127
131
  logo: string;
128
132
  digits: number;
133
+ min_digits: number;
134
+ max_digits: number;
129
135
  supported_by_tap?: undefined;
130
136
  })[];
131
137
  export declare const countriesCode: ({
@@ -360,7 +360,9 @@ export var defaultCountry = {
360
360
  idd_prefix: 966,
361
361
  logo: 'https://back-end.b-cdn.net/country/png/SA.png',
362
362
  digits: 10,
363
- supported_by_tap: true
363
+ supported_by_tap: true,
364
+ min_digits: 10,
365
+ max_digits: 10
364
366
  };
365
367
  export var businessCountries = [
366
368
  {
@@ -387,7 +389,9 @@ export var businessCountries = [
387
389
  idd_prefix: 965,
388
390
  logo: 'https://back-end.b-cdn.net/country/png/KW.png',
389
391
  digits: 8,
390
- supported_by_tap: true
392
+ supported_by_tap: true,
393
+ min_digits: 8,
394
+ max_digits: 8
391
395
  },
392
396
  {
393
397
  created: 1577690965000,
@@ -413,7 +417,9 @@ export var businessCountries = [
413
417
  idd_prefix: 966,
414
418
  logo: 'https://back-end.b-cdn.net/country/png/SA.png',
415
419
  digits: 10,
416
- supported_by_tap: true
420
+ supported_by_tap: true,
421
+ min_digits: 10,
422
+ max_digits: 10
417
423
  },
418
424
  {
419
425
  created: 1577690965000,
@@ -439,7 +445,9 @@ export var businessCountries = [
439
445
  idd_prefix: 971,
440
446
  logo: 'https://back-end.b-cdn.net/country/png/AE.png',
441
447
  digits: 9,
442
- supported_by_tap: true
448
+ supported_by_tap: true,
449
+ min_digits: 9,
450
+ max_digits: 9
443
451
  },
444
452
  {
445
453
  created: 1577690965000,
@@ -465,7 +473,9 @@ export var businessCountries = [
465
473
  idd_prefix: 20,
466
474
  logo: 'https://back-end.b-cdn.net/country/png/EG.png',
467
475
  digits: 10,
468
- supported_by_tap: true
476
+ supported_by_tap: true,
477
+ min_digits: 10,
478
+ max_digits: 10
469
479
  },
470
480
  {
471
481
  created: 1577690965000,
@@ -491,7 +501,9 @@ export var businessCountries = [
491
501
  idd_prefix: 973,
492
502
  logo: 'https://back-end.b-cdn.net/country/png/BH.png',
493
503
  digits: 8,
494
- supported_by_tap: true
504
+ supported_by_tap: true,
505
+ min_digits: 8,
506
+ max_digits: 8
495
507
  },
496
508
  {
497
509
  created: 1577690965000,
@@ -517,7 +529,9 @@ export var businessCountries = [
517
529
  idd_prefix: 961,
518
530
  logo: 'https://back-end.b-cdn.net/country/png/LB.png',
519
531
  digits: 8,
520
- supported_by_tap: true
532
+ supported_by_tap: true,
533
+ min_digits: 7,
534
+ max_digits: 8
521
535
  },
522
536
  {
523
537
  created: 1577690965000,
@@ -543,7 +557,9 @@ export var businessCountries = [
543
557
  idd_prefix: 1,
544
558
  logo: 'https://back-end.b-cdn.net/country/png/US.png',
545
559
  digits: 10,
546
- supported_by_tap: true
560
+ supported_by_tap: true,
561
+ min_digits: 10,
562
+ max_digits: 10
547
563
  },
548
564
  {
549
565
  created: 1577690965000,
@@ -568,7 +584,9 @@ export var businessCountries = [
568
584
  geoNameId: '2635167',
569
585
  idd_prefix: 44,
570
586
  logo: 'https://back-end.b-cdn.net/country/png/GB.png',
571
- digits: 10
587
+ digits: 10,
588
+ min_digits: 10,
589
+ max_digits: 10
572
590
  },
573
591
  {
574
592
  created: 1577690965000,
@@ -594,7 +612,9 @@ export var businessCountries = [
594
612
  idd_prefix: 974,
595
613
  logo: 'https://back-end.b-cdn.net/country/png/QA.png',
596
614
  digits: 8,
597
- supported_by_tap: true
615
+ supported_by_tap: true,
616
+ min_digits: 8,
617
+ max_digits: 8
598
618
  },
599
619
  {
600
620
  created: 1577690965000,
@@ -620,7 +640,9 @@ export var businessCountries = [
620
640
  idd_prefix: 968,
621
641
  logo: 'https://back-end.b-cdn.net/country/png/OM.png',
622
642
  digits: 8,
623
- supported_by_tap: true
643
+ supported_by_tap: true,
644
+ min_digits: 9,
645
+ max_digits: 9
624
646
  },
625
647
  {
626
648
  created: 1577690965000,
@@ -645,7 +667,9 @@ export var businessCountries = [
645
667
  geoNameId: '2963597',
646
668
  idd_prefix: 353,
647
669
  logo: 'https://back-end.b-cdn.net/country/png/IE.png',
648
- digits: 10
670
+ digits: 10,
671
+ min_digits: 10,
672
+ max_digits: 10
649
673
  }
650
674
  ];
651
675
  export var countriesCode = [
@@ -55,10 +55,10 @@ import { hasNoneEditableValue, isStringHasOneAsterisk, retrieveIndividualData, s
55
55
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', 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, bankData, _b, config, country_code, step_name, bank_account_id, wallet_id, boardId, publicKey, countryIso2, data_1;
59
- var _c, _d, _e, _f, _g;
60
- return __generator(this, function (_h) {
61
- switch (_h.label) {
58
+ var payload, data, bankData, _b, config, country_code, step_name, bank_account_id, wallet_id, boardId, publicKey, data_1;
59
+ var _c, _d, _e, _f, _g, _h;
60
+ return __generator(this, function (_j) {
61
+ switch (_j.label) {
62
62
  case 0:
63
63
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
64
64
  notification: {
@@ -67,15 +67,14 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
67
67
  }));
68
68
  return [4, API.leadService.verifyLeadToken(payload)];
69
69
  case 1:
70
- data = (_h.sent()).data;
70
+ data = (_j.sent()).data;
71
71
  if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
72
72
  throw new Error(data.errors[0].description);
73
73
  bankData = undefined;
74
74
  _b = data || {}, config = _b.config, country_code = _b.country_code, step_name = _b.step_name, bank_account_id = _b.bank_account_id, wallet_id = _b.wallet_id, boardId = _b.id;
75
75
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
76
- countryIso2 = country_code;
77
- if (countryIso2)
78
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
76
+ if (country_code)
77
+ thunkApi.dispatch(handleSetCountryByIso2(country_code));
79
78
  if (publicKey)
80
79
  thunkApi.dispatch(handlePublicKey(publicKey));
81
80
  if (isInternally)
@@ -85,11 +84,13 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
85
84
  return [3, 7];
86
85
  case 2:
87
86
  if (!(step_name === BANK_STEP_NAMES.BANK_INFO)) return [3, 7];
88
- if (!!wallet_id) return [3, 4];
87
+ if (!(!wallet_id || !country_code)) return [3, 4];
89
88
  return [4, API.boardService.retrieveBoardDetails(boardId)];
90
89
  case 3:
91
- data_1 = _h.sent();
92
- if (!((_g = (_f = (_e = (_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.business) === null || _d === void 0 ? void 0 : _d.entity) === null || _e === void 0 ? void 0 : _e.merchant) === null || _f === void 0 ? void 0 : _f.wallet) === null || _g === void 0 ? void 0 : _g.id))
90
+ data_1 = _j.sent();
91
+ if (!country_code && ((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.country))
92
+ thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
93
+ if (!((_h = (_g = (_f = (_e = data_1 === null || data_1 === void 0 ? void 0 : data_1.business) === null || _e === void 0 ? void 0 : _e.entity) === null || _f === void 0 ? void 0 : _f.merchant) === null || _g === void 0 ? void 0 : _g.wallet) === null || _h === void 0 ? void 0 : _h.id))
93
94
  throw new Error('wallet_id_missing');
94
95
  if (data_1 === null || data_1 === void 0 ? void 0 : data_1.bank_account)
95
96
  bankData = data_1.bank_account;
@@ -98,11 +99,11 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
98
99
  if (!bank_account_id) return [3, 6];
99
100
  return [4, API.entityService.retrieveBankAccount(bank_account_id)];
100
101
  case 5:
101
- bankData = _h.sent();
102
- _h.label = 6;
102
+ bankData = _j.sent();
103
+ _j.label = 6;
103
104
  case 6:
104
105
  thunkApi.dispatch(handleNextScreenStep());
105
- _h.label = 7;
106
+ _j.label = 7;
106
107
  case 7: return [2, {
107
108
  data: data,
108
109
  bankData: bankData,
@@ -130,10 +131,10 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
130
131
  });
131
132
  }); });
132
133
  export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
133
- var _a, bank, settings, responseBody, payload, data, publicKey, _b, bank_account_id, wallet_id, boardId, bankData, data_2;
134
- var _c, _d, _e, _f, _g, _h, _j, _k, _l;
135
- return __generator(this, function (_m) {
136
- switch (_m.label) {
134
+ var _a, bank, settings, responseBody, payload, data, countryIso2, publicKey, _b, bank_account_id, wallet_id, boardId, bankData, data_2;
135
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
136
+ return __generator(this, function (_o) {
137
+ switch (_o.label) {
137
138
  case 0:
138
139
  _a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
139
140
  responseBody = bank.data.verify.responseBody;
@@ -146,19 +147,24 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
146
147
  };
147
148
  return [4, API.leadService.verifyLeadOTP(payload)];
148
149
  case 1:
149
- data = (_m.sent()).data;
150
+ data = (_o.sent()).data;
150
151
  if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
151
152
  throw new Error(data.errors[0].description);
153
+ countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
152
154
  publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
155
+ if (countryIso2)
156
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
153
157
  if (publicKey)
154
158
  thunkApi.dispatch(handlePublicKey(publicKey));
155
159
  _b = data || {}, bank_account_id = _b.bank_account_id, wallet_id = _b.wallet_id, boardId = _b.id;
156
160
  bankData = undefined;
157
- if (!!wallet_id) return [3, 3];
161
+ if (!(!wallet_id || !countryIso2)) return [3, 3];
158
162
  return [4, API.boardService.retrieveBoardDetails(boardId)];
159
163
  case 2:
160
- data_2 = _m.sent();
161
- if (!((_j = (_h = (_g = (_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.business) === null || _f === void 0 ? void 0 : _f.entity) === null || _g === void 0 ? void 0 : _g.merchant) === null || _h === void 0 ? void 0 : _h.wallet) === null || _j === void 0 ? void 0 : _j.id))
164
+ data_2 = _o.sent();
165
+ if (!countryIso2 && ((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _f === void 0 ? void 0 : _f.country))
166
+ thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
167
+ if (!((_k = (_j = (_h = (_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.business) === null || _g === void 0 ? void 0 : _g.entity) === null || _h === void 0 ? void 0 : _h.merchant) === null || _j === void 0 ? void 0 : _j.wallet) === null || _k === void 0 ? void 0 : _k.id))
162
168
  throw new Error('wallet_id_missing');
163
169
  if (data_2 === null || data_2 === void 0 ? void 0 : data_2.bank_account)
164
170
  bankData = data_2.bank_account;
@@ -167,10 +173,10 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
167
173
  if (!bank_account_id) return [3, 5];
168
174
  return [4, API.entityService.retrieveBankAccount(bank_account_id)];
169
175
  case 4:
170
- bankData = _m.sent();
171
- _m.label = 5;
176
+ bankData = _o.sent();
177
+ _o.label = 5;
172
178
  case 5:
173
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
179
+ (_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, { otp: params.otp });
174
180
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
175
181
  return [2, {
176
182
  data: data,
@@ -66,10 +66,10 @@ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retr
66
66
  export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', 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, _b, config, brand_id, entity_id, board_id, publicKey, salesChannels, brandData, data_1;
70
- var _c, _d;
71
- return __generator(this, function (_e) {
72
- switch (_e.label) {
69
+ var payload, data, _b, config, brand_id, entity_id, board_id, country_code, publicKey, salesChannels, brandData, data_1;
70
+ var _c, _d, _e;
71
+ return __generator(this, function (_f) {
72
+ switch (_f.label) {
73
73
  case 0:
74
74
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
75
75
  notification: {
@@ -78,37 +78,38 @@ export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function
78
78
  }));
79
79
  return [4, API.leadService.verifyLeadToken(payload)];
80
80
  case 1:
81
- data = (_e.sent()).data;
81
+ data = (_f.sent()).data;
82
82
  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))
83
83
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
84
- countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
85
- if (countryIso2)
86
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
87
- _b = data || {}, config = _b.config, brand_id = _b.brand_id, entity_id = _b.entity_id, board_id = _b.id;
84
+ _b = data || {}, config = _b.config, brand_id = _b.brand_id, entity_id = _b.entity_id, board_id = _b.id, country_code = _b.country_code;
88
85
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
86
+ if (country_code)
87
+ thunkApi.dispatch(handleSetCountryByIso2(country_code));
89
88
  if (publicKey)
90
89
  thunkApi.dispatch(handlePublicKey(publicKey));
91
90
  brandData = undefined;
92
91
  if (isInternally)
93
92
  data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
94
93
  if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 7];
95
- if (!!brand_id) return [3, 3];
94
+ if (!(!brand_id || !country_code)) return [3, 3];
96
95
  return [4, API.boardService.retrieveBoardDetails(board_id)];
97
96
  case 2:
98
- data_1 = _e.sent();
99
- if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand) === null || _d === void 0 ? void 0 : _d.id))
97
+ data_1 = _f.sent();
98
+ if (!country_code && ((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.country))
99
+ thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
100
+ if (!((_e = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand) === null || _e === void 0 ? void 0 : _e.id))
100
101
  throw new Error('brand_id_missing');
101
102
  brandData = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand;
102
103
  return [3, 5];
103
104
  case 3: return [4, API.brandService.retrieveBrand(brand_id)];
104
105
  case 4:
105
- brandData = _e.sent();
106
- _e.label = 5;
106
+ brandData = _f.sent();
107
+ _f.label = 5;
107
108
  case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
108
109
  case 6:
109
- salesChannels = _e.sent();
110
+ salesChannels = _f.sent();
110
111
  thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
111
- _e.label = 7;
112
+ _f.label = 7;
112
113
  case 7: return [2, {
113
114
  data: data,
114
115
  brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
@@ -138,10 +139,10 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
138
139
  });
139
140
  }); });
140
141
  export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
141
- var _a, brand, settings, responseBody, payload, data, publicKey, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
142
- var _c, _d, _e, _f, _g, _h;
143
- return __generator(this, function (_j) {
144
- switch (_j.label) {
142
+ var _a, brand, settings, responseBody, payload, data, publicKey, countryIso2, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
143
+ var _c, _d, _e, _f, _g, _h, _j;
144
+ return __generator(this, function (_k) {
145
+ switch (_k.label) {
145
146
  case 0:
146
147
  _a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
147
148
  responseBody = brand.data.verify.responseBody;
@@ -154,30 +155,35 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
154
155
  };
155
156
  return [4, API.leadService.verifyLeadOTP(payload)];
156
157
  case 1:
157
- data = (_j.sent()).data;
158
+ data = (_k.sent()).data;
158
159
  if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
159
160
  throw new Error(data.errors[0].description);
160
161
  publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
162
+ countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
161
163
  if (publicKey)
162
164
  thunkApi.dispatch(handlePublicKey(publicKey));
165
+ if (countryIso2)
166
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
163
167
  _b = data || {}, brand_id = _b.brand_id, entity_id = _b.entity_id, boardId = _b.id;
164
168
  brandData = undefined;
165
- if (!!brand_id) return [3, 3];
169
+ if (!(!brand_id || !countryIso2)) return [3, 3];
166
170
  return [4, API.boardService.retrieveBoardDetails(boardId)];
167
171
  case 2:
168
- data_2 = _j.sent();
169
- if (!((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _f === void 0 ? void 0 : _f.id))
172
+ data_2 = _k.sent();
173
+ if (!countryIso2 && ((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _f === void 0 ? void 0 : _f.country))
174
+ thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
175
+ if (!((_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _g === void 0 ? void 0 : _g.id))
170
176
  throw new Error('brand_id_missing');
171
177
  brandData = data_2;
172
178
  return [3, 5];
173
179
  case 3: return [4, API.brandService.retrieveBrand(brand_id)];
174
180
  case 4:
175
- brandData = _j.sent();
176
- _j.label = 5;
181
+ brandData = _k.sent();
182
+ _k.label = 5;
177
183
  case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
178
184
  case 6:
179
- salesChannels = _j.sent();
180
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
185
+ salesChannels = _k.sent();
186
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
181
187
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
182
188
  return [2, {
183
189
  data: data,
@@ -67,8 +67,8 @@ import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedVal
67
67
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
68
68
  var token = _a.token, isInternally = _a.isInternally;
69
69
  return __awaiter(void 0, void 0, void 0, function () {
70
- var payload, data, entityData, entityTypes, countryIso2, publicKey, _b, entity_id, boardId, data_1;
71
- var _c, _d, _e, _f;
70
+ var payload, data, entityData, entityTypes, _b, country_code, config, publicKey, _c, entity_id, boardId, data_1;
71
+ var _d, _e, _f;
72
72
  return __generator(this, function (_g) {
73
73
  switch (_g.label) {
74
74
  case 0:
@@ -80,19 +80,19 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
80
80
  return [4, API.leadService.verifyLeadToken(payload)];
81
81
  case 1:
82
82
  data = (_g.sent()).data;
83
- countryIso2 = undefined;
84
- 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))
83
+ entityTypes = undefined;
84
+ if (((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
85
85
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
86
86
  if (isInternally)
87
87
  data.step_name = ENTITY_STEP_NAMES.ENTITY_INFO;
88
- countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
89
- if (countryIso2)
90
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
91
- publicKey = (_d = data === null || data === void 0 ? void 0 : data.config) === null || _d === void 0 ? void 0 : _d.public_key;
88
+ _b = data || {}, country_code = _b.country_code, config = _b.config;
89
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
90
+ if (country_code)
91
+ thunkApi.dispatch(handleSetCountryByIso2(country_code));
92
92
  if (publicKey)
93
93
  thunkApi.dispatch(handlePublicKey(publicKey));
94
94
  if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 7];
95
- _b = data || {}, entity_id = _b.entity_id, boardId = _b.id;
95
+ _c = data || {}, entity_id = _c.entity_id, boardId = _c.id;
96
96
  if (!!entity_id) return [3, 3];
97
97
  return [4, API.boardService.retrieveBoardDetails(boardId)];
98
98
  case 2:
@@ -106,11 +106,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
106
106
  entityData = _g.sent();
107
107
  _g.label = 5;
108
108
  case 5:
109
- if (!countryIso2) {
110
- countryIso2 = (_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country;
111
- if (countryIso2)
112
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
113
- }
109
+ if (!country_code && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
110
+ thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
114
111
  return [4, API.entityService.retrieveEntityType()];
115
112
  case 6:
116
113
  entityTypes = _g.sent();
@@ -144,10 +141,10 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
144
141
  });
145
142
  }); });
146
143
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
147
- var _a, entity, settings, responseBody, payload, data, _b, entity_id, config, boardId, entityData, publicKey, data_2, entityTypes;
148
- var _c, _d, _e, _f, _g;
149
- return __generator(this, function (_h) {
150
- switch (_h.label) {
144
+ var _a, entity, settings, responseBody, payload, data, _b, entity_id, config, boardId, country_code, entityData, publicKey, countryIso2, data_2, entityTypes;
145
+ var _c, _d, _e, _f, _g, _h;
146
+ return __generator(this, function (_j) {
147
+ switch (_j.label) {
151
148
  case 0:
152
149
  _a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
153
150
  responseBody = entity.data.verify.responseBody;
@@ -160,31 +157,36 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
160
157
  };
161
158
  return [4, API.leadService.verifyLeadOTP(payload)];
162
159
  case 1:
163
- data = (_h.sent()).data;
160
+ data = (_j.sent()).data;
164
161
  if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
165
162
  throw new Error(data.errors[0].description);
166
- _b = data || {}, entity_id = _b.entity_id, config = _b.config, boardId = _b.id;
163
+ _b = data || {}, entity_id = _b.entity_id, config = _b.config, boardId = _b.id, country_code = _b.country_code;
167
164
  entityData = undefined;
168
165
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
166
+ countryIso2 = country_code || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
169
167
  if (publicKey)
170
168
  thunkApi.dispatch(handlePublicKey(publicKey));
169
+ if (countryIso2)
170
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
171
171
  if (!!entity_id) return [3, 3];
172
172
  return [4, API.boardService.retrieveBoardDetails(boardId)];
173
173
  case 2:
174
- data_2 = _h.sent();
174
+ data_2 = _j.sent();
175
175
  if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
176
176
  throw new Error('entity_id_missing');
177
177
  entityData = data_2;
178
178
  return [3, 5];
179
179
  case 3: return [4, API.entityService.retrieveEntity(entity_id)];
180
180
  case 4:
181
- entityData = _h.sent();
182
- _h.label = 5;
181
+ entityData = _j.sent();
182
+ _j.label = 5;
183
183
  case 5:
184
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, { otp: params.otp });
184
+ if (!countryIso2 && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
185
+ thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
186
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
185
187
  return [4, API.entityService.retrieveEntityType()];
186
188
  case 6:
187
- entityTypes = _h.sent();
189
+ entityTypes = _j.sent();
188
190
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
189
191
  return [2, {
190
192
  data: data,