@tap-payments/auth-jsconnect 1.0.45 → 1.0.48

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 (53) hide show
  1. package/build/@types/app.d.ts +8 -1
  2. package/build/@types/form.d.ts +2 -1
  3. package/build/@types/redux.d.ts +0 -1
  4. package/build/api/auth.d.ts +0 -2
  5. package/build/api/entity.d.ts +2 -1
  6. package/build/api/entity.js +5 -1
  7. package/build/api/index.d.ts +1 -0
  8. package/build/api/lead.d.ts +3 -2
  9. package/build/assets/locales/ar.json +3 -1
  10. package/build/assets/locales/en.json +3 -1
  11. package/build/components/Footer/Footer.js +5 -5
  12. package/build/constants/app.d.ts +2 -0
  13. package/build/constants/app.js +4 -2
  14. package/build/constants/dummy.d.ts +14 -0
  15. package/build/constants/dummy.js +29 -0
  16. package/build/constants/validation.d.ts +1 -0
  17. package/build/constants/validation.js +1 -0
  18. package/build/features/app/business/businessStore.d.ts +3 -3
  19. package/build/features/app/business/businessStore.js +52 -58
  20. package/build/features/app/connect/connectStore.d.ts +35 -13
  21. package/build/features/app/connect/connectStore.js +163 -186
  22. package/build/features/bank/Bank.js +1 -1
  23. package/build/features/business/Business.js +2 -15
  24. package/build/features/business/screens/Customers/CustomerLocations.js +1 -1
  25. package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -2
  26. package/build/features/business/screens/Customers/ExpectedSalesRange.js +1 -1
  27. package/build/features/connect/screens/Individual/Email.d.ts +3 -1
  28. package/build/features/connect/screens/Individual/Email.js +53 -5
  29. package/build/features/connect/screens/Individual/Individual.js +13 -9
  30. package/build/features/connect/screens/Individual/validation.d.ts +1 -1
  31. package/build/features/connect/screens/Individual/validation.js +7 -3
  32. package/build/features/connect/screens/Merchant/BrandList.d.ts +12 -0
  33. package/build/features/connect/screens/Merchant/BrandList.js +118 -0
  34. package/build/features/connect/screens/Merchant/BrandName.d.ts +4 -1
  35. package/build/features/connect/screens/Merchant/BrandName.js +56 -5
  36. package/build/features/connect/screens/Merchant/Merchant.js +14 -7
  37. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +4 -1
  38. package/build/features/connect/screens/Merchant/SocialMedia.js +4 -3
  39. package/build/features/connect/screens/Merchant/TAC.d.ts +2 -1
  40. package/build/features/connect/screens/Merchant/TAC.js +2 -1
  41. package/build/features/connect/screens/Merchant/validation.d.ts +4 -4
  42. package/build/features/connect/screens/Merchant/validation.js +60 -56
  43. package/build/features/connect/screens/Mobile/Mobile.js +6 -1
  44. package/build/features/connect/screens/Mobile/validation.d.ts +1 -1
  45. package/build/features/connect/screens/Mobile/validation.js +7 -2
  46. package/build/features/connect/screens/Password/Password.js +5 -3
  47. package/build/features/individual/Individual.js +1 -1
  48. package/build/features/password/Password.js +1 -1
  49. package/build/features/shared/Button/Button.js +1 -1
  50. package/build/features/tax/Tax.js +2 -2
  51. package/package.json +1 -1
  52. package/build/hooks/useElementSizeById.d.ts +0 -6
  53. package/build/hooks/useElementSizeById.js +0 -12
@@ -49,7 +49,7 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import { handleNextScreenStep } from '../../../app/settings';
51
51
  import API from '../../../api';
52
- import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE } from '../../../constants';
52
+ import { BRAND_LIST, CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, TWITTER_URL } from '../../../constants';
53
53
  import { defaultCountry } from '../../../constants';
54
54
  import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
55
55
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
@@ -87,7 +87,6 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
87
87
  phone: params.mobile || '',
88
88
  code: params.countryCode.idd_prefix.toString()
89
89
  },
90
- device_info: settings.data.deviceInfo,
91
90
  sign_in: false,
92
91
  step_name: CONNECT_STEP_NAMES.CREATE_AUTH_MOBILE,
93
92
  encryption_contract: ['user_credentail.phone', 'user_credentail.code']
@@ -118,7 +117,6 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
118
117
  date_of_birth: params.dob,
119
118
  country_code: connect.data.businessCountry.iso2
120
119
  },
121
- device_info: settings.data.deviceInfo,
122
120
  sign_in: false,
123
121
  step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
124
122
  encryption_contract: [
@@ -140,14 +138,15 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
140
138
  });
141
139
  }); });
142
140
  export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
143
- var _a, connect, settings, isAbsher, responseBody, payload, data, leadData;
144
- var _b, _c;
145
- return __generator(this, function (_d) {
146
- switch (_d.label) {
141
+ var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, payload, data, params_1, params_2;
142
+ var _c, _d;
143
+ return __generator(this, function (_e) {
144
+ switch (_e.label) {
147
145
  case 0:
148
146
  _a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
149
147
  isAbsher = connect.data.otpData.isAbsher;
150
- responseBody = (isAbsher ? connect.data.nidData : connect.data.mobileData).responseBody;
148
+ _b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData;
149
+ responseBody = (isAbsher ? nidData : mobileData).responseBody;
151
150
  payload = {
152
151
  data: params.otp,
153
152
  auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
@@ -163,95 +162,70 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
163
162
  };
164
163
  return [4, API.authService.verifyAuth(payload)];
165
164
  case 1:
166
- data = (_d.sent()).data;
167
- leadData = undefined;
168
- if (!!data.errors) return [3, 4];
169
- if (!(data === null || data === void 0 ? void 0 : data.lead_id)) return [3, 3];
170
- return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.lead_id)];
171
- case 2:
172
- leadData = _d.sent();
173
- _d.label = 3;
174
- case 3:
175
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { otp: params.otp });
176
- if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
177
- thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
178
- }
179
- else {
180
- thunkApi.dispatch(handleNextScreenStep('CONNECT_PASSWORD_STEP'));
165
+ data = (_e.sent()).data;
166
+ if (!data.errors) {
167
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
168
+ if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
169
+ params_1 = {
170
+ leadId: data === null || data === void 0 ? void 0 : data.lead_id,
171
+ stepName: 'CONNECT_INDIVIDUAL_STEP'
172
+ };
173
+ thunkApi.dispatch(retrieveLead(params_1));
174
+ }
175
+ else {
176
+ params_2 = {
177
+ individualId: data === null || data === void 0 ? void 0 : data.individual_id,
178
+ stepName: 'CONNECT_MERCHANT_INFO_STEP'
179
+ };
180
+ thunkApi.dispatch(createLead(params_2));
181
+ }
181
182
  }
182
- _d.label = 4;
183
- case 4: return [2, { response: data, leadResponse: leadData === null || leadData === void 0 ? void 0 : leadData.data, formData: params }];
183
+ return [2, { response: data, formData: params }];
184
184
  }
185
185
  });
186
186
  }); });
187
- export var createVerifyAuthPassword = createAsyncThunk('verifyAuthPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
188
- var _a, connect, settings, _b, businessCountry, mobileData, mobile, countryCode, requestBody, data, payload, response, leadResponse, leadPayload;
189
- var _c, _d, _e;
190
- return __generator(this, function (_f) {
191
- switch (_f.label) {
192
- case 0:
193
- _a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
194
- _b = connect.data, businessCountry = _b.businessCountry, mobileData = _b.mobileData;
195
- mobile = mobileData.mobile, countryCode = mobileData.countryCode;
196
- requestBody = {
197
- user_credentail: {
198
- phone: mobile || '',
199
- code: countryCode.idd_prefix.toString()
200
- },
201
- device_info: settings.data.deviceInfo,
202
- sign_in: true,
203
- step_name: CONNECT_STEP_NAMES.CREATE_AUTH_PASSWORD,
204
- encryption_contract: ['user_credentail.phone', 'user_credentail.code']
205
- };
206
- return [4, API.authService.createAuth(requestBody)];
187
+ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
188
+ var data;
189
+ return __generator(this, function (_a) {
190
+ switch (_a.label) {
191
+ case 0: return [4, API.leadService.retrieveLead(params.leadId)];
207
192
  case 1:
208
- data = (_f.sent()).data;
193
+ data = (_a.sent()).data;
194
+ thunkApi.dispatch(handleNextScreenStep(params.stepName));
195
+ return [2, { response: data, formData: params }];
196
+ }
197
+ });
198
+ }); });
199
+ export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
200
+ var connect, businessCountry, payload, data;
201
+ return __generator(this, function (_a) {
202
+ switch (_a.label) {
203
+ case 0:
204
+ connect = thunkApi.getState().connect;
205
+ businessCountry = connect.data.businessCountry;
209
206
  payload = {
210
- data: params.password,
211
- auth_token: data === null || data === void 0 ? void 0 : data.auth_token,
212
- auth_type: data === null || data === void 0 ? void 0 : data.auth_type,
213
- device_token: data === null || data === void 0 ? void 0 : data.device_token,
214
- service_name: data === null || data === void 0 ? void 0 : data.service_name,
215
- new_user: data === null || data === void 0 ? void 0 : data.new_user,
216
- sign_in: true,
217
- remember_me: data === null || data === void 0 ? void 0 : data.remember_me,
218
- scopes: data === null || data === void 0 ? void 0 : data.scopes,
219
- step_name: CONNECT_STEP_NAMES.VERIFY_AUTH_PASSWORD,
220
- encryption_contract: ['data']
221
- };
222
- return [4, API.authService.verifyAuth(payload)];
223
- case 2:
224
- response = _f.sent();
225
- leadResponse = undefined;
226
- leadPayload = {
227
- individual_id: (_c = response.data) === null || _c === void 0 ? void 0 : _c.individual_id,
207
+ individual_id: params.individualId,
228
208
  country_code: businessCountry.iso2
229
209
  };
230
- if (!(!data.errors && !response.data.errors)) return [3, 4];
231
- return [4, API.leadService.createLead(leadPayload)];
232
- case 3:
233
- leadResponse = _f.sent();
234
- thunkApi.dispatch(handleNextScreenStep());
235
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { password: params.password });
236
- _f.label = 4;
237
- case 4: return [2, { response: response.data, createAuthResponse: data, leadResponse: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, formData: params }];
210
+ return [4, API.leadService.createLead(payload)];
211
+ case 1:
212
+ data = (_a.sent()).data;
213
+ thunkApi.dispatch(handleNextScreenStep(params.stepName));
214
+ return [2, { response: data, formData: params }];
238
215
  }
239
216
  });
240
217
  }); });
241
218
  export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
242
- var _a, settings, connect, isAbsher, headers, payload, data;
219
+ var _a, settings, connect, isAbsher, payload, data;
243
220
  var _b, _c, _d, _e, _f;
244
221
  return __generator(this, function (_g) {
245
222
  switch (_g.label) {
246
223
  case 0:
247
224
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
248
225
  isAbsher = connect.data.otpData.isAbsher;
249
- headers = {
250
- lead_id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
251
- device_identifier: settings.data.deviceInfo.browser.browser_id
252
- };
253
226
  payload = {
254
227
  name: getIndividualName(params.name),
228
+ lead_id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
255
229
  contact: {
256
230
  email: params.email,
257
231
  phone: isAbsher
@@ -271,7 +245,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
271
245
  'contact.phone.number'
272
246
  ]
273
247
  };
274
- return [4, API.leadService.updateLead(payload, { headers: headers })];
248
+ return [4, API.leadService.updateLead(payload)];
275
249
  case 1:
276
250
  data = (_g.sent()).data;
277
251
  if (!data.errors) {
@@ -283,19 +257,14 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
283
257
  });
284
258
  }); });
285
259
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
286
- var _a, settings, connect, isNewUser, headers, payload, data;
287
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
288
- return __generator(this, function (_m) {
289
- switch (_m.label) {
260
+ var _a, settings, connect, instagram, twitter, payload, data;
261
+ var _b, _c, _d, _e, _f, _g, _h, _j;
262
+ return __generator(this, function (_k) {
263
+ switch (_k.label) {
290
264
  case 0:
291
265
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
292
- isNewUser = (_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
293
- headers = {
294
- lead_id: !isNewUser
295
- ? (_c = connect.data.passwordData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id
296
- : ((_d = connect.data.otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
297
- device_identifier: (_f = (_e = settings.data.deviceInfo) === null || _e === void 0 ? void 0 : _e.browser) === null || _f === void 0 ? void 0 : _f.browser_id
298
- };
266
+ instagram = !!((_b = params.links) === null || _b === void 0 ? void 0 : _b.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_c = params.links) === null || _c === void 0 ? void 0 : _c.twitter) : '';
267
+ twitter = !!((_d = params.links) === null || _d === void 0 ? void 0 : _d.twitter) ? "".concat(TWITTER_URL, "/").concat((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) : '';
299
268
  payload = {
300
269
  brand: {
301
270
  name: {
@@ -303,91 +272,97 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
303
272
  ar: params.brandName,
304
273
  zh: params.brandName
305
274
  },
306
- website: (_g = params.links) === null || _g === void 0 ? void 0 : _g.website,
307
- social: [(_h = params.links) === null || _h === void 0 ? void 0 : _h.twitter, (_j = params.links) === null || _j === void 0 ? void 0 : _j.instagram]
275
+ website: (_f = params.links) === null || _f === void 0 ? void 0 : _f.website,
276
+ social: [twitter, instagram]
308
277
  },
278
+ lead_id: ((_g = connect.data.otpData.responseBody) === null || _g === void 0 ? void 0 : _g.lead_id) || '',
309
279
  terms_conditions_accepted: params.termAndConditionChecked,
310
280
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
311
- encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
281
+ encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'social[0]', 'social[1]']
312
282
  };
313
- return [4, API.leadService.updateLead(payload, { headers: headers })];
283
+ return [4, API.leadService.updateLead(payload)];
314
284
  case 1:
315
- data = (_m.sent()).data;
285
+ data = (_k.sent()).data;
316
286
  if (!data.errors) {
317
287
  thunkApi.dispatch(handleNextScreenStep());
318
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, params);
288
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, params);
319
289
  }
320
290
  return [2, { response: data, formData: params }];
321
291
  }
322
292
  });
323
293
  }); });
324
- export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (email, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
325
- var _a, settings, connect, headers, requestBody, data;
326
- var _b, _c, _d;
327
- return __generator(this, function (_e) {
328
- switch (_e.label) {
329
- case 0:
330
- _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
331
- headers = {
332
- lead_id: (_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id,
333
- device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
334
- };
335
- requestBody = {
336
- email: email
337
- };
338
- return [4, API.availabilityServices.checkEmail(requestBody, { headers: headers })];
339
- case 1:
340
- data = (_e.sent()).data;
341
- if (!data.errors)
342
- return [2, { response: data, formData: email }];
343
- return [2];
344
- }
294
+ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (_a, thunkApi) {
295
+ var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
296
+ return __awaiter(void 0, void 0, void 0, function () {
297
+ var _b, settings, connect, headers, requestBody, data;
298
+ var _c, _d, _e;
299
+ return __generator(this, function (_f) {
300
+ switch (_f.label) {
301
+ case 0:
302
+ _b = thunkApi.getState(), settings = _b.settings, connect = _b.connect;
303
+ headers = {
304
+ lead_id: (_c = connect.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id,
305
+ device_identifier: (_e = (_d = settings.data.deviceInfo) === null || _d === void 0 ? void 0 : _d.browser) === null || _e === void 0 ? void 0 : _e.browser_id
306
+ };
307
+ requestBody = {
308
+ email: email
309
+ };
310
+ return [4, API.availabilityServices.checkEmail(requestBody, { headers: headers, cancelToken: cancelToken })];
311
+ case 1:
312
+ data = (_f.sent()).data;
313
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
314
+ if (!data.errors)
315
+ return [2, { response: data, formData: email }];
316
+ return [2];
317
+ }
318
+ });
345
319
  });
346
- }); });
347
- export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailability', function (brandName, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
348
- var _a, settings, connect, headers, requestBody, data;
349
- var _b, _c, _d;
350
- return __generator(this, function (_e) {
351
- switch (_e.label) {
352
- case 0:
353
- _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
354
- headers = {
355
- lead_id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
356
- device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
357
- };
358
- requestBody = {
359
- profile_name: brandName
360
- };
361
- return [4, API.availabilityServices.checkBrand(requestBody, { headers: headers })];
362
- case 1:
363
- data = (_e.sent()).data;
364
- if (!data.errors)
365
- return [2, { response: data, formData: brandName }];
366
- return [2];
367
- }
320
+ });
321
+ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailability', function (_a, thunkApi) {
322
+ var cancelToken = _a.cancelToken, name = _a.name, onSuccess = _a.onSuccess;
323
+ return __awaiter(void 0, void 0, void 0, function () {
324
+ var _b, settings, connect, headers, requestBody, data;
325
+ var _c, _d, _e;
326
+ return __generator(this, function (_f) {
327
+ switch (_f.label) {
328
+ case 0:
329
+ _b = thunkApi.getState(), settings = _b.settings, connect = _b.connect;
330
+ headers = {
331
+ lead_id: ((_c = connect.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id) || '',
332
+ device_identifier: (_e = (_d = settings.data.deviceInfo) === null || _d === void 0 ? void 0 : _d.browser) === null || _e === void 0 ? void 0 : _e.browser_id
333
+ };
334
+ requestBody = {
335
+ profile_name: name
336
+ };
337
+ return [4, API.availabilityServices.checkBrand(requestBody, { headers: headers, cancelToken: cancelToken })];
338
+ case 1:
339
+ data = (_f.sent()).data;
340
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
341
+ if (!data.errors)
342
+ return [2, { response: data, formData: { name: name } }];
343
+ return [2];
344
+ }
345
+ });
368
346
  });
369
- }); });
347
+ });
370
348
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
371
- var _a, settings, connect, headers, payload, data;
372
- var _b, _c, _d, _e, _f, _g, _h;
373
- return __generator(this, function (_j) {
374
- switch (_j.label) {
349
+ var _a, settings, connect, payload, data;
350
+ var _b, _c, _d, _e, _f;
351
+ return __generator(this, function (_g) {
352
+ switch (_g.label) {
375
353
  case 0:
376
354
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
377
- headers = {
378
- lead_id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
379
- device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
380
- };
381
355
  payload = {
382
356
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
383
357
  email_url: getClientEmailUrl(),
358
+ lead_id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
384
359
  encryption_contract: []
385
360
  };
386
- return [4, API.leadService.updateLead(payload, { headers: headers })];
361
+ return [4, API.leadService.updateLead(payload)];
387
362
  case 1:
388
- data = (_j.sent()).data;
389
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
390
- (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
363
+ data = (_g.sent()).data;
364
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
365
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
391
366
  return [2, { response: data, formData: params }];
392
367
  }
393
368
  });
@@ -395,7 +370,6 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
395
370
  var initialState = {
396
371
  error: null,
397
372
  loading: false,
398
- searchActive: false,
399
373
  data: {
400
374
  businessCountry: defaultCountry,
401
375
  countries: [],
@@ -412,9 +386,6 @@ var initialState = {
412
386
  otp: '',
413
387
  isAbsher: false
414
388
  },
415
- passwordData: {
416
- password: ''
417
- },
418
389
  individualData: {
419
390
  name: '',
420
391
  email: '',
@@ -449,8 +420,6 @@ export var connectSlice = createSlice({
449
420
  resetOTPScreen: function (state) {
450
421
  state.data.otpData.otp = '';
451
422
  },
452
- resetPasswordScreen: function (state) {
453
- },
454
423
  resetIndividualScreen: function (state) {
455
424
  state.data.individualData = initialState.data.individualData;
456
425
  },
@@ -520,17 +489,33 @@ export var connectSlice = createSlice({
520
489
  })
521
490
  .addCase(verifyAuth.fulfilled, function (state, action) {
522
491
  var _a;
523
- state.loading = false;
524
492
  state.error = null;
525
- var _b = action.payload, formData = _b.formData, response = _b.response, leadResponse = _b.leadResponse;
493
+ var _b = action.payload, formData = _b.formData, response = _b.response;
526
494
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
527
495
  if (description) {
496
+ state.loading = false;
528
497
  state.error = description;
529
498
  return;
530
499
  }
531
- var leadError = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.errors;
532
- if (!!leadResponse && !leadError) {
533
- var name_1 = leadResponse.name, contact = leadResponse.contact;
500
+ state.data.otpData.responseBody = response;
501
+ state.data.otpData.otp = formData.otp;
502
+ })
503
+ .addCase(verifyAuth.pending, function (state) {
504
+ state.loading = true;
505
+ state.error = null;
506
+ })
507
+ .addCase(verifyAuth.rejected, function (state, action) {
508
+ state.loading = false;
509
+ state.error = action.error.message;
510
+ })
511
+ .addCase(retrieveLead.fulfilled, function (state, action) {
512
+ var _a;
513
+ state.loading = false;
514
+ state.error = null;
515
+ var response = action.payload.response;
516
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
517
+ if (!!response && !description) {
518
+ var name_1 = response.name, contact = response.contact;
534
519
  var email = (contact || {}).email;
535
520
  var firstName = (name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ';
536
521
  var middleName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' : '';
@@ -543,37 +528,31 @@ export var connectSlice = createSlice({
543
528
  if (!!email)
544
529
  state.data.individualData.email = email;
545
530
  }
546
- state.data.otpData.otp = formData.otp;
547
- state.data.otpData.responseBody = response;
548
531
  })
549
- .addCase(verifyAuth.pending, function (state) {
532
+ .addCase(retrieveLead.pending, function (state) {
550
533
  state.loading = true;
551
534
  state.error = null;
552
535
  })
553
- .addCase(verifyAuth.rejected, function (state, action) {
536
+ .addCase(retrieveLead.rejected, function (state, action) {
554
537
  state.loading = false;
555
538
  state.error = action.error.message;
556
539
  })
557
- .addCase(createVerifyAuthPassword.fulfilled, function (state, action) {
558
- var _a, _b, _c;
540
+ .addCase(createLead.fulfilled, function (state, action) {
541
+ var _a;
559
542
  state.loading = false;
560
543
  state.error = null;
561
- var _d = action.payload, formData = _d.formData, response = _d.response, createAuthResponse = _d.createAuthResponse, leadResponse = _d.leadResponse;
562
- var error = ((_a = createAuthResponse === null || createAuthResponse === void 0 ? void 0 : createAuthResponse.errors) === null || _a === void 0 ? void 0 : _a[0]) || {};
563
- var description = (((_b = response === null || response === void 0 ? void 0 : response.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
564
- var leadError = ((_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.errors) === null || _c === void 0 ? void 0 : _c[0]) || {};
565
- if ((error === null || error === void 0 ? void 0 : error.description) || description || (leadError === null || leadError === void 0 ? void 0 : leadError.description)) {
566
- state.error = (error === null || error === void 0 ? void 0 : error.description) || description;
567
- return;
544
+ var response = action.payload.response;
545
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
546
+ if (!!response && !description) {
547
+ state.data.brandData.brandList = BRAND_LIST;
548
+ state.data.otpData.responseBody = response;
568
549
  }
569
- state.data.passwordData.password = formData.password;
570
- state.data.passwordData.responseBody = leadResponse;
571
550
  })
572
- .addCase(createVerifyAuthPassword.pending, function (state) {
551
+ .addCase(createLead.pending, function (state) {
573
552
  state.loading = true;
574
553
  state.error = null;
575
554
  })
576
- .addCase(createVerifyAuthPassword.rejected, function (state, action) {
555
+ .addCase(createLead.rejected, function (state, action) {
577
556
  state.loading = false;
578
557
  state.error = action.error.message;
579
558
  })
@@ -621,30 +600,28 @@ export var connectSlice = createSlice({
621
600
  })
622
601
  .addCase(checkEmailAvailability.fulfilled, function (state, action) {
623
602
  var _a;
624
- state.searchActive = false;
625
603
  state.error = null;
626
604
  state.data.individualData.responseBody = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response;
627
605
  })
628
606
  .addCase(checkEmailAvailability.pending, function (state) {
629
- state.searchActive = true;
630
607
  state.error = null;
631
608
  })
632
609
  .addCase(checkEmailAvailability.rejected, function (state, action) {
633
- state.searchActive = false;
610
+ if (action.error.message === 'Aborted')
611
+ return;
634
612
  state.error = action.error.message;
635
613
  })
636
614
  .addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
637
615
  var _a;
638
- state.searchActive = false;
639
616
  state.error = null;
640
617
  state.data.brandData.responseBody = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response;
641
618
  })
642
619
  .addCase(checkBrandNameAvailability.pending, function (state) {
643
- state.searchActive = true;
644
620
  state.error = null;
645
621
  })
646
622
  .addCase(checkBrandNameAvailability.rejected, function (state, action) {
647
- state.searchActive = false;
623
+ if (action.error.message === 'Aborted')
624
+ return;
648
625
  state.error = action.error.message;
649
626
  })
650
627
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
@@ -669,6 +646,6 @@ export var connectSlice = createSlice({
669
646
  });
670
647
  }
671
648
  });
672
- export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetMobileScreen = _a.resetMobileScreen, resetOTPScreen = _a.resetOTPScreen, resetIndividualScreen = _a.resetIndividualScreen, resetMerchantScreen = _a.resetMerchantScreen, resetNIDScreen = _a.resetNIDScreen, resetPasswordScreen = _a.resetPasswordScreen;
649
+ export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetMobileScreen = _a.resetMobileScreen, resetOTPScreen = _a.resetOTPScreen, resetIndividualScreen = _a.resetIndividualScreen, resetMerchantScreen = _a.resetMerchantScreen, resetNIDScreen = _a.resetNIDScreen;
673
650
  export default connectSlice.reducer;
674
651
  export var connectSelector = function (state) { return state.connect; };
@@ -18,10 +18,10 @@ import { store } from '../../app/store';
18
18
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
19
  import Collapse from '../../components/Collapse';
20
20
  import { reactElement } from '../../utils';
21
+ import { FeatureContainer } from '../shared/Containers';
21
22
  import { BANK_SCREENS_NAVIGATION } from '../../constants';
22
23
  import { bankFeatureScreens } from '../featuresScreens';
23
24
  import CustomFooter from '../shared/Footer';
24
- import { FeatureContainer } from '../shared/Containers';
25
25
  var Bank = memo(function (props) {
26
26
  var open = React.useState(true)[0];
27
27
  var theme = useAppTheme().theme;
@@ -11,10 +11,9 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React, { memo, useEffect } from 'react';
14
- import { styled } from '@mui/material/styles';
15
- import Box from '@mui/material/Box';
16
14
  import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
17
15
  import { settingsSelector } from '../../app/settings';
16
+ import { FeatureContainer } from '../shared/Containers';
18
17
  import { getCountries, verifyLeadToken } from '../app/business/businessStore';
19
18
  import AnimationFlow from '../../components/AnimationFlow';
20
19
  import { store } from '../../app/store';
@@ -24,18 +23,6 @@ import { getParameterByName, reactElement } from '../../utils';
24
23
  import { BUSINESS_SCREENS_NAVIGATION } from '../../constants';
25
24
  import { businessFeatureScreens } from '../featuresScreens';
26
25
  import CustomFooter from '../shared/Footer';
27
- var Container = styled(Box)(function (_a) {
28
- var _b;
29
- var theme = _a.theme;
30
- return (_b = {
31
- width: '100%',
32
- minHeight: theme.spacing(20)
33
- },
34
- _b[theme.transitions.create('height')] = {
35
- duration: theme.transitions.duration.enteringScreen
36
- },
37
- _b);
38
- });
39
26
  var Business = memo(function (props) {
40
27
  var open = React.useState(true)[0];
41
28
  var theme = useAppTheme().theme;
@@ -57,7 +44,7 @@ var Business = memo(function (props) {
57
44
  useEffect(function () {
58
45
  dispatch(getCountries());
59
46
  }, []);
60
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(Container, { children: businessFeatureScreens.map(function (_a, index) {
47
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
61
48
  var Element = _a.element, name = _a.name;
62
49
  var isActive = activeScreen.name === name;
63
50
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -111,7 +111,7 @@ var customerLocations = function (_a) {
111
111
  };
112
112
  var customerLocationsValue = customerLocationsControl.field.value;
113
113
  var customerLocationSelected = customerLocationsValue[customerLocationsValue.length - 1];
114
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('select_customer_base') }), _jsx(InputStyled, { readOnly: true, value: isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.nameAR : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
114
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('select_customer_base') }), _jsx(InputStyled, { readOnly: true, value: isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.titleAr : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.title, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
115
115
  return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.titleAr : item.title })) })), item.id === (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIconStyled, {}), checkRemainingCondition(item) && item.id != (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(RemainingCheck, {})] }));
116
116
  } }) }))] }) })));
117
117
  };
@@ -72,12 +72,12 @@ var ExpectedCustomers = function (_a) {
72
72
  }
73
73
  }, [response === null || response === void 0 ? void 0 : response.expectedCustomerSales]);
74
74
  var onSelectItem = function (expectedCustomers) {
75
- onCloseList();
76
75
  expectedCustomersControl.field.onChange(expectedCustomers);
76
+ onCloseList();
77
77
  };
78
78
  var expectedCustomersValue = expectedCustomersControl.field.value;
79
79
  var expectedCustomersSelected = expectedCustomersValue;
80
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.nameAR : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
80
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.titleAr : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.title, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
81
81
  return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.titleAr : item.title })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIconStyled, {})] }));
82
82
  } }) }))] }) })));
83
83
  };