@tap-payments/auth-jsconnect 2.8.23-test → 2.8.25-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.
@@ -252,7 +252,7 @@ export var AUTH_SCREENS_NAVIGATION = [
252
252
  },
253
253
  {
254
254
  name: 'AUTH_OTP_STEP',
255
- next: 'AUTH_PREPARING_DATA_STEP',
255
+ next: ['AUTH_PREPARING_DATA_STEP', 'AUTH_EMAIL_SENT_STEP'],
256
256
  prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_EMAIL_STEP', 'AUTH_PASSWORD_STEP'],
257
257
  order: 2
258
258
  },
@@ -280,6 +280,12 @@ export var AUTH_SCREENS_NAVIGATION = [
280
280
  prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_CIVIL_ID_STEP', 'AUTH_EMAIL_STEP'],
281
281
  order: 3
282
282
  },
283
+ {
284
+ name: 'AUTH_EMAIL_SENT_STEP',
285
+ next: '',
286
+ prev: 'AUTH_SWITCH_STEP',
287
+ order: 3
288
+ },
283
289
  {
284
290
  name: 'AUTH_ACCOUNT_NOT_FOUND_STEP',
285
291
  next: '',
@@ -314,7 +314,7 @@ export var resendEmailAuthOTP = createAsyncThunk('auth/resendEmailAuthOTP', func
314
314
  });
315
315
  }); });
316
316
  export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
317
- var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data;
317
+ var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data, stepName;
318
318
  var _d, _e, _f, _g;
319
319
  return __generator(this, function (_h) {
320
320
  switch (_h.label) {
@@ -346,8 +346,11 @@ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (pa
346
346
  openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
347
347
  return [2, data];
348
348
  }
349
+ stepName = 'AUTH_PREPARING_DATA_STEP';
350
+ if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.MIGRATION)
351
+ stepName = 'AUTH_EMAIL_SENT_STEP';
349
352
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
350
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_PREPARING_DATA_STEP')); });
353
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(stepName)); });
351
354
  return [2, data];
352
355
  }
353
356
  });
@@ -541,30 +544,28 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
541
544
  });
542
545
  }); });
543
546
  export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
544
- var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, _b, authId, auth_type, accountData, _c, step_name, brands, entities, brandList, entityList, isExistingUser;
545
- var _d;
546
- return __generator(this, function (_e) {
547
- switch (_e.label) {
547
+ var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData, _b, step_name, brands, entities, brandList, entityList, isExistingUser;
548
+ var _c;
549
+ return __generator(this, function (_d) {
550
+ switch (_d.label) {
548
551
  case 0:
549
552
  _a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
550
553
  authConfigData = settings.data.appConfig.data;
551
554
  authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
552
555
  isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
553
- data = (_d = auth.data.responseData) === null || _d === void 0 ? void 0 : _d.authResponse;
554
- _b = data || {}, authId = _b.id, auth_type = _b.auth_type;
555
- if (auth_type === AuthTypeNumber.MIGRATION) {
556
- }
556
+ data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
557
+ authId = (data || {}).id;
557
558
  return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
558
559
  case 1:
559
- accountData = _e.sent();
560
- _c = accountData || {}, step_name = _c.step_name, brands = _c.brands, entities = _c.entities;
560
+ accountData = _d.sent();
561
+ _b = accountData || {}, step_name = _b.step_name, brands = _b.brands, entities = _b.entities;
561
562
  brandList = brands || [];
562
563
  entityList = entities || [];
563
564
  isExistingUser = step_name === 'select_account';
564
565
  if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 3];
565
566
  return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
566
567
  case 2:
567
- _e.sent();
568
+ _d.sent();
568
569
  return [2, { brandList: brandList, entityList: entityList }];
569
570
  case 3:
570
571
  if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
@@ -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,
@@ -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
  }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface EmailSentProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: EmailSentProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,79 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box/Box';
15
+ import { styled } from '@mui/material/styles';
16
+ import { useTranslation, Trans } from 'react-i18next';
17
+ import Text from '../../../../components/Text';
18
+ import Icon from '../../../../components/Icon';
19
+ import Collapse from '../../../../components/Collapse';
20
+ import { ICONS_NAMES } from '../../../../constants';
21
+ import Button from '../../../shared/Button';
22
+ import FlatButton from '../../../../components/Button';
23
+ import Warning from '../../../../components/Warning';
24
+ import { handleCurrentActiveScreen } from '../../../../app/settings';
25
+ import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
26
+ import { authSelector, onSignUp } from '../../../app/auth/authStore';
27
+ import { maskEmail } from '../../../../utils';
28
+ var Container = styled(Box)(function (_a) {
29
+ var theme = _a.theme;
30
+ return ({
31
+ paddingBottom: theme.spacing(2.5),
32
+ paddingTop: theme.spacing(0)
33
+ });
34
+ });
35
+ var SubContainer = styled(Box)(function (_a) {
36
+ var theme = _a.theme;
37
+ return ({
38
+ display: 'flex',
39
+ justifyContent: 'center',
40
+ alignItems: 'center',
41
+ width: '100%',
42
+ flexDirection: 'column',
43
+ padding: theme.spacing(0, 3.75),
44
+ paddingTop: theme.spacing(0)
45
+ });
46
+ });
47
+ var TitleStyled = styled(Text)(function (_a) {
48
+ var theme = _a.theme;
49
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.info.dark, fontWeight: 700, marginTop: theme.spacing(2.5), marginBottom: theme.spacing(2), textAlign: 'center' }));
50
+ });
51
+ var SubTitleStyled = styled(Text)(function (_a) {
52
+ var theme = _a.theme;
53
+ return (__assign(__assign({}, theme.typography.body2), { color: 'rgba(63, 66, 77, 0.60)', fontWeight: 500, textAlign: 'center' }));
54
+ });
55
+ var IconStyled = styled(Icon)(function () { return ({
56
+ width: 66,
57
+ height: 66
58
+ }); });
59
+ var EmailSent = function (_a) {
60
+ var _b;
61
+ var t = useTranslation().t;
62
+ var dispatch = useAppDispatch();
63
+ var isAr = useLanguage().isAr;
64
+ var _c = useAppSelector(authSelector), loading = _c.loading, error = _c.error, data = _c.data;
65
+ var email = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authResponse) || {}).email;
66
+ var onSignIn = function () {
67
+ dispatch(handleCurrentActiveScreen('AUTH_SWITCH_STEP'));
68
+ };
69
+ var handleOnSignUp = function () {
70
+ dispatch(onSignUp());
71
+ };
72
+ var getEmail = function () {
73
+ if (email)
74
+ return email;
75
+ return maskEmail(data.emailData.email);
76
+ };
77
+ return (_jsxs(Container, __assign({ dir: isAr ? 'rtl' : 'ltr' }, { children: [_jsxs(SubContainer, { children: [_jsx(IconStyled, { src: ICONS_NAMES.account_not_found }), _jsx(TitleStyled, { children: t('migration_email_sent_title') }), _jsx(SubTitleStyled, { children: _jsx(Trans, { i18nKey: 'migration_email_sent_des', values: { email: getEmail() } }) })] }), _jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1, mt: 7.4 }, warningType: 'error' }, { children: t(error || '') })) })), _jsxs(SubContainer, { children: [_jsx(FlatButton, __assign({ sx: { mb: 1.5, mt: !!error ? 0 : 7.4 }, onClick: onSignIn, variant: 'text' }, { children: t('try_sign_in') })), _jsx(Button, __assign({ loading: loading, sx: { margin: 0, width: '100%' }, disableBack: true, onClick: handleOnSignUp, isAr: isAr }, { children: t('sign_up') }))] })] })));
78
+ };
79
+ export default React.memo(EmailSent);
@@ -0,0 +1,2 @@
1
+ import EmailSent from './EmailSent';
2
+ export default EmailSent;
@@ -0,0 +1,2 @@
1
+ import EmailSent from './EmailSent';
2
+ export default EmailSent;
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
16
16
  import Box from '@mui/material/Box/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import Text from '../../../../components/Text';
19
- import { clearError, authSelector, verifyMobileOtp, verifyNIDOtp, resetOTPValue } from '../../../app/auth/authStore';
19
+ import { clearError, authSelector, verifyMobileOtp, verifyNIDOtp, resetOTPValue, verifyEmailOtp } from '../../../app/auth/authStore';
20
20
  import Button from '../../../shared/Button';
21
21
  import { ScreenContainer } from '../../../shared/Containers';
22
22
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
@@ -98,6 +98,10 @@ var OTP = function () {
98
98
  dispatch(verifyNIDOtp(deepCopy(formData)));
99
99
  return;
100
100
  }
101
+ if (isEmailAuth) {
102
+ dispatch(verifyEmailOtp(deepCopy(formData)));
103
+ return;
104
+ }
101
105
  dispatch(verifyMobileOtp(deepCopy(formData)));
102
106
  };
103
107
  var onBack = function () {
@@ -42,6 +42,7 @@ import AccountNotFoundScreen from './auth/screens/AccountNotFound';
42
42
  import AuthAuthenticationListScreen from './auth/screens/AuthenticationList';
43
43
  import AuthMerchantScreen from './auth/screens/AuthMerchant';
44
44
  import AuthAccountCreatedLoaderScreen from './auth/screens/AccountCreatedLoader';
45
+ import AuthEmailSentScreen from './auth/screens/EmailSent';
45
46
  import CustomersPage from './business/screens/Customers';
46
47
  import IDBODPage from './business/screens/IDBOD';
47
48
  import BusinessVerifyPage from './business/screens/Verify';
@@ -283,6 +284,10 @@ export var authFeatureScreens = [
283
284
  {
284
285
  name: 'AUTH_ACCOUNT_CREATED_STEP',
285
286
  element: AuthAccountCreatedLoaderScreen
287
+ },
288
+ {
289
+ name: 'AUTH_EMAIL_SENT_STEP',
290
+ element: AuthEmailSentScreen
286
291
  }
287
292
  ];
288
293
  export var businessFeatureScreens = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.23-test",
3
+ "version": "2.8.25-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",