@tap-payments/auth-jsconnect 2.8.22-test → 2.8.24-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, publicKey, countryIso2;
59
- var _c;
60
- return __generator(this, function (_d) {
61
- switch (_d.label) {
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) {
62
62
  case 0:
63
63
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
64
64
  notification: {
@@ -67,11 +67,11 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
67
67
  }));
68
68
  return [4, API.leadService.verifyLeadToken(payload)];
69
69
  case 1:
70
- data = (_d.sent()).data;
70
+ data = (_h.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
- _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;
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
76
  countryIso2 = country_code;
77
77
  if (countryIso2)
@@ -82,20 +82,28 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
82
82
  data.step_name = BANK_STEP_NAMES.BANK_INFO;
83
83
  if (!(step_name === BANK_STEP_NAMES.PHONE_AUTH)) return [3, 2];
84
84
  thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
85
- return [3, 5];
85
+ return [3, 7];
86
86
  case 2:
87
- if (!(step_name === BANK_STEP_NAMES.BANK_INFO)) return [3, 5];
88
- if (!wallet_id)
89
- throw new Error('Internal server error');
90
- if (!bank_account_id) return [3, 4];
91
- return [4, API.entityService.retrieveBankAccount(bank_account_id)];
87
+ if (!(step_name === BANK_STEP_NAMES.BANK_INFO)) return [3, 7];
88
+ if (!!wallet_id) return [3, 4];
89
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
92
90
  case 3:
93
- bankData = _d.sent();
94
- _d.label = 4;
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))
93
+ throw new Error('wallet_id_missing');
94
+ if (data_1 === null || data_1 === void 0 ? void 0 : data_1.bank_account)
95
+ bankData = data_1.bank_account;
96
+ return [3, 6];
95
97
  case 4:
98
+ if (!bank_account_id) return [3, 6];
99
+ return [4, API.entityService.retrieveBankAccount(bank_account_id)];
100
+ case 5:
101
+ bankData = _h.sent();
102
+ _h.label = 6;
103
+ case 6:
96
104
  thunkApi.dispatch(handleNextScreenStep());
97
- _d.label = 5;
98
- case 5: return [2, {
105
+ _h.label = 7;
106
+ case 7: return [2, {
99
107
  data: data,
100
108
  bankData: bankData,
101
109
  token: token
@@ -122,10 +130,10 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
122
130
  });
123
131
  }); });
124
132
  export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
125
- var _a, bank, settings, responseBody, payload, data, publicKey, _b, bank_account_id, wallet_id, bankData;
126
- var _c, _d, _e, _f, _g;
127
- return __generator(this, function (_h) {
128
- switch (_h.label) {
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) {
129
137
  case 0:
130
138
  _a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
131
139
  responseBody = bank.data.verify.responseBody;
@@ -138,23 +146,31 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
138
146
  };
139
147
  return [4, API.leadService.verifyLeadOTP(payload)];
140
148
  case 1:
141
- data = (_h.sent()).data;
149
+ data = (_m.sent()).data;
142
150
  if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
143
151
  throw new Error(data.errors[0].description);
144
152
  publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
145
153
  if (publicKey)
146
154
  thunkApi.dispatch(handlePublicKey(publicKey));
147
- _b = data || {}, bank_account_id = _b.bank_account_id, wallet_id = _b.wallet_id;
148
- if (!wallet_id)
149
- throw new Error('Internal server error');
155
+ _b = data || {}, bank_account_id = _b.bank_account_id, wallet_id = _b.wallet_id, boardId = _b.id;
150
156
  bankData = undefined;
151
- if (!bank_account_id) return [3, 3];
152
- return [4, API.entityService.retrieveBankAccount(bank_account_id)];
157
+ if (!!wallet_id) return [3, 3];
158
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
153
159
  case 2:
154
- bankData = _h.sent();
155
- _h.label = 3;
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))
162
+ throw new Error('wallet_id_missing');
163
+ if (data_2 === null || data_2 === void 0 ? void 0 : data_2.bank_account)
164
+ bankData = data_2.bank_account;
165
+ return [3, 5];
156
166
  case 3:
157
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, { otp: params.otp });
167
+ if (!bank_account_id) return [3, 5];
168
+ return [4, API.entityService.retrieveBankAccount(bank_account_id)];
169
+ case 4:
170
+ bankData = _m.sent();
171
+ _m.label = 5;
172
+ 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 });
158
174
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
159
175
  return [2, {
160
176
  data: data,
@@ -96,9 +96,9 @@ export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function
96
96
  return [4, API.boardService.retrieveBoardDetails(board_id)];
97
97
  case 2:
98
98
  data_1 = _e.sent();
99
- brandData = data_1;
100
99
  if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand) === null || _d === void 0 ? void 0 : _d.id))
101
100
  throw new Error('brand_id_missing');
101
+ brandData = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand;
102
102
  return [3, 5];
103
103
  case 3: return [4, API.brandService.retrieveBrand(brand_id)];
104
104
  case 4:
@@ -166,9 +166,9 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
166
166
  return [4, API.boardService.retrieveBoardDetails(boardId)];
167
167
  case 2:
168
168
  data_2 = _j.sent();
169
- brandData = data_2;
170
169
  if (!((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _f === void 0 ? void 0 : _f.id))
171
170
  throw new Error('brand_id_missing');
171
+ brandData = data_2;
172
172
  return [3, 5];
173
173
  case 3: return [4, API.brandService.retrieveBrand(brand_id)];
174
174
  case 4:
@@ -67,10 +67,10 @@ 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, entity_id;
71
- var _b, _c, _d;
72
- return __generator(this, function (_e) {
73
- switch (_e.label) {
70
+ var payload, data, entityData, entityTypes, countryIso2, publicKey, _b, entity_id, boardId, data_1;
71
+ var _c, _d, _e, _f;
72
+ return __generator(this, function (_g) {
73
+ switch (_g.label) {
74
74
  case 0:
75
75
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
76
76
  notification: {
@@ -79,36 +79,44 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
79
79
  }));
80
80
  return [4, API.leadService.verifyLeadToken(payload)];
81
81
  case 1:
82
- data = (_e.sent()).data;
82
+ data = (_g.sent()).data;
83
83
  countryIso2 = undefined;
84
- if (((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
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))
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
88
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
89
89
  if (countryIso2)
90
90
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
91
- publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
91
+ publicKey = (_d = data === null || data === void 0 ? void 0 : data.config) === null || _d === void 0 ? void 0 : _d.public_key;
92
92
  if (publicKey)
93
93
  thunkApi.dispatch(handlePublicKey(publicKey));
94
- if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 4];
95
- entity_id = (data || {}).entity_id;
96
- if (!entity_id)
97
- throw new Error('Internal server error');
98
- return [4, API.entityService.retrieveEntity(entity_id)];
94
+ if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 7];
95
+ _b = data || {}, entity_id = _b.entity_id, boardId = _b.id;
96
+ if (!!entity_id) return [3, 3];
97
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
99
98
  case 2:
100
- entityData = _e.sent();
99
+ data_1 = _g.sent();
100
+ if (!((_e = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _e === void 0 ? void 0 : _e.id))
101
+ throw new Error('entity_id_missing');
102
+ entityData = data_1;
103
+ return [3, 5];
104
+ case 3: return [4, API.entityService.retrieveEntity(entity_id)];
105
+ case 4:
106
+ entityData = _g.sent();
107
+ _g.label = 5;
108
+ case 5:
101
109
  if (!countryIso2) {
102
- countryIso2 = (_d = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _d === void 0 ? void 0 : _d.country;
110
+ countryIso2 = (_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country;
103
111
  if (countryIso2)
104
112
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
105
113
  }
106
114
  return [4, API.entityService.retrieveEntityType()];
107
- case 3:
108
- entityTypes = _e.sent();
115
+ case 6:
116
+ entityTypes = _g.sent();
109
117
  thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP'));
110
- _e.label = 4;
111
- case 4: return [2, {
118
+ _g.label = 7;
119
+ case 7: return [2, {
112
120
  data: data,
113
121
  entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
114
122
  entityTypes: entityTypes,
@@ -136,10 +144,10 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
136
144
  });
137
145
  }); });
138
146
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
139
- var _a, entity, settings, responseBody, payload, data, _b, entity_id, config, publicKey, entityData, entityTypes;
140
- var _c, _d, _e, _f;
141
- return __generator(this, function (_g) {
142
- switch (_g.label) {
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) {
143
151
  case 0:
144
152
  _a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
145
153
  responseBody = entity.data.verify.responseBody;
@@ -152,22 +160,31 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
152
160
  };
153
161
  return [4, API.leadService.verifyLeadOTP(payload)];
154
162
  case 1:
155
- data = (_g.sent()).data;
163
+ data = (_h.sent()).data;
156
164
  if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
157
165
  throw new Error(data.errors[0].description);
158
- _b = data || {}, entity_id = _b.entity_id, config = _b.config;
166
+ _b = data || {}, entity_id = _b.entity_id, config = _b.config, boardId = _b.id;
167
+ entityData = undefined;
159
168
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
160
169
  if (publicKey)
161
170
  thunkApi.dispatch(handlePublicKey(publicKey));
162
- if (!entity_id)
163
- throw new Error('Internal server error');
164
- return [4, API.entityService.retrieveEntity(entity_id)];
171
+ if (!!entity_id) return [3, 3];
172
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
165
173
  case 2:
166
- entityData = _g.sent();
167
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
174
+ data_2 = _h.sent();
175
+ if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
176
+ throw new Error('entity_id_missing');
177
+ entityData = data_2;
178
+ return [3, 5];
179
+ case 3: return [4, API.entityService.retrieveEntity(entity_id)];
180
+ case 4:
181
+ entityData = _h.sent();
182
+ _h.label = 5;
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 });
168
185
  return [4, API.entityService.retrieveEntityType()];
169
- case 3:
170
- entityTypes = _g.sent();
186
+ case 6:
187
+ entityTypes = _h.sent();
171
188
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
172
189
  return [2, {
173
190
  data: data,
@@ -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, publicKey, countryIso2;
59
- var _c;
60
- return __generator(this, function (_d) {
61
- switch (_d.label) {
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) {
62
62
  case 0:
63
63
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
64
64
  notification: {
@@ -67,13 +67,13 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
67
67
  }));
68
68
  return [4, API.leadService.verifyLeadToken(payload)];
69
69
  case 1:
70
- data = (_d.sent()).data;
70
+ data = (_e.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));
74
74
  if (isInternally)
75
75
  data.step_name = TAX_STEP_NAMES.TAX_INFO;
76
- _b = data || {}, config = _b.config, country_code = _b.country_code, entity_id = _b.entity_id;
76
+ _b = data || {}, config = _b.config, country_code = _b.country_code, entity_id = _b.entity_id, boardId = _b.id;
77
77
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
78
78
  if (publicKey)
79
79
  thunkApi.dispatch(handlePublicKey(publicKey));
@@ -82,17 +82,25 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
82
82
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
83
83
  if (!(data.step_name === TAX_STEP_NAMES.PHONE_AUTH)) return [3, 2];
84
84
  thunkApi.dispatch(handleCurrentActiveScreen('TAX_VERIFY_STEP'));
85
- return [3, 4];
85
+ return [3, 7];
86
86
  case 2:
87
- if (!(data.step_name === TAX_STEP_NAMES.TAX_INFO)) return [3, 4];
88
- if (!entity_id)
89
- throw new Error('Internal server error');
90
- return [4, API.entityService.retrieveEntity(entity_id)];
87
+ if (!(data.step_name === TAX_STEP_NAMES.TAX_INFO)) return [3, 7];
88
+ if (!!entity_id) return [3, 4];
89
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
91
90
  case 3:
92
- entityData = _d.sent();
91
+ data_1 = _e.sent();
92
+ if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.id))
93
+ throw new Error('entity_id_missing');
94
+ entityData = data_1;
95
+ return [3, 6];
96
+ case 4: return [4, API.entityService.retrieveEntity(entity_id)];
97
+ case 5:
98
+ entityData = _e.sent();
99
+ _e.label = 6;
100
+ case 6:
93
101
  thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
94
- _d.label = 4;
95
- case 4: return [2, {
102
+ _e.label = 7;
103
+ case 7: return [2, {
96
104
  data: data,
97
105
  entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
98
106
  token: token
@@ -165,10 +173,10 @@ export var retrieveBoardDetails = createAsyncThunk('tax/retrieveBrandInfo', func
165
173
  });
166
174
  });
167
175
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
168
- var _a, tax, settings, responseBody, payload, data, _b, config, entity_id, publicKey, entityData;
169
- var _c, _d, _e, _f;
170
- return __generator(this, function (_g) {
171
- switch (_g.label) {
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) {
172
180
  case 0:
173
181
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
174
182
  responseBody = tax.data.verify.responseBody;
@@ -181,19 +189,28 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
181
189
  };
182
190
  return [4, API.leadService.verifyLeadOTP(payload)];
183
191
  case 1:
184
- data = (_g.sent()).data;
192
+ data = (_h.sent()).data;
185
193
  if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
186
194
  throw new Error(data.errors[0].description);
187
- _b = data || {}, config = _b.config, entity_id = _b.entity_id;
195
+ _b = data || {}, config = _b.config, entity_id = _b.entity_id, boardId = _b.id;
196
+ entityData = undefined;
188
197
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
189
198
  if (publicKey)
190
199
  thunkApi.dispatch(handlePublicKey(publicKey));
191
- if (!entity_id)
192
- throw new Error('Internal server error');
193
- return [4, API.entityService.retrieveEntity(entity_id)];
200
+ if (!!entity_id) return [3, 3];
201
+ return [4, API.boardService.retrieveBoardDetails(boardId)];
194
202
  case 2:
195
- entityData = _g.sent();
196
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
203
+ data_2 = _h.sent();
204
+ if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
205
+ throw new Error('entity_id_missing');
206
+ entityData = data_2;
207
+ return [3, 5];
208
+ case 3: return [4, API.entityService.retrieveEntity(entity_id)];
209
+ case 4:
210
+ entityData = _h.sent();
211
+ _h.label = 5;
212
+ 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 });
197
214
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
198
215
  return [2, { data: data, entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity, formData: params }];
199
216
  }
@@ -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.22-test",
3
+ "version": "2.8.24-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",