@tap-payments/auth-jsconnect 1.0.60 → 1.0.63

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 (61) hide show
  1. package/build/@types/redux.d.ts +1 -0
  2. package/build/api/lead.d.ts +4 -1
  3. package/build/assets/locales/ar.json +5 -4
  4. package/build/assets/locales/en.json +5 -4
  5. package/build/constants/app.js +1 -1
  6. package/build/constants/assets.d.ts +17 -7
  7. package/build/constants/assets.js +17 -7
  8. package/build/features/Landing/Landing.js +5 -8
  9. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +6 -20
  10. package/build/features/app/bank/bankStore.js +4 -0
  11. package/build/features/app/business/businessStore.d.ts +6 -2
  12. package/build/features/app/business/businessStore.js +87 -60
  13. package/build/features/app/connect/connectStore.js +44 -23
  14. package/build/features/app/individual/individualStore.js +4 -0
  15. package/build/features/app/password/passwordStore.js +6 -0
  16. package/build/features/app/tax/taxStore.js +6 -0
  17. package/build/features/business/Business.js +3 -2
  18. package/build/features/business/screens/Activities/Activities.js +4 -0
  19. package/build/features/business/screens/Activities/ActivitiesList.js +5 -6
  20. package/build/features/business/screens/Activities/SalesChannels.js +4 -5
  21. package/build/features/business/screens/BusinessType/BusinessType.js +1 -6
  22. package/build/features/business/screens/BusinessType/LicenseList.js +18 -13
  23. package/build/features/business/screens/BusinessType/LicenseNumber.js +3 -3
  24. package/build/features/business/screens/Customers/Customers.js +0 -1
  25. package/build/features/business/screens/Success/Success.js +3 -2
  26. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -20
  27. package/build/features/business/screens/Verify/Verify.js +1 -1
  28. package/build/features/password/screens/CreatePassword/CreatePassword.js +0 -1
  29. package/build/features/shared/Button/AbsherButton.js +1 -0
  30. package/build/features/shared/Button/Button.js +1 -1
  31. package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
  32. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  33. package/build/features/shared/Button/FlowsButtons.js +12 -7
  34. package/build/features/shared/Button/MobileButton.js +1 -0
  35. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +2 -1
  36. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  37. package/build/utils/string.d.ts +1 -0
  38. package/build/utils/string.js +4 -0
  39. package/package.json +1 -1
  40. package/build/features/business/screens/BusinessType/CRNumber.d.ts +0 -7
  41. package/build/features/business/screens/BusinessType/CRNumber.js +0 -41
  42. package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +0 -11
  43. package/build/features/business/screens/BusinessType/CompanyLicense.js +0 -127
  44. package/build/features/business/screens/BusinessType/FLNumber.d.ts +0 -7
  45. package/build/features/business/screens/BusinessType/FLNumber.js +0 -41
  46. package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +0 -11
  47. package/build/features/business/screens/BusinessType/FreelanceLicense.js +0 -127
  48. package/build/features/business/screens/Confirm/Confirm.d.ts +0 -5
  49. package/build/features/business/screens/Confirm/Confirm.js +0 -56
  50. package/build/features/business/screens/Confirm/index.d.ts +0 -3
  51. package/build/features/business/screens/Confirm/index.js +0 -2
  52. package/build/features/connect/screens/Mobile/BusinessCountry.d.ts +0 -8
  53. package/build/features/connect/screens/Mobile/BusinessCountry.js +0 -40
  54. package/build/features/connect/screens/Password/Password.d.ts +0 -5
  55. package/build/features/connect/screens/Password/Password.js +0 -60
  56. package/build/features/connect/screens/Password/PasswordInput.d.ts +0 -5
  57. package/build/features/connect/screens/Password/PasswordInput.js +0 -39
  58. package/build/features/connect/screens/Password/index.d.ts +0 -3
  59. package/build/features/connect/screens/Password/index.js +0 -2
  60. package/build/features/connect/screens/Password/validation.d.ts +0 -8
  61. package/build/features/connect/screens/Password/validation.js +0 -4
@@ -60,7 +60,7 @@ import { handleNextScreenStep } from '../../../app/settings';
60
60
  import API from '../../../api';
61
61
  import { BRAND_LIST, CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
62
62
  import { defaultCountry } from '../../../constants';
63
- import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
63
+ import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
64
64
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var settings, countriesBody, businessCountry;
66
66
  return __generator(this, function (_a) {
@@ -259,14 +259,18 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
259
259
  });
260
260
  }); });
261
261
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
262
- var _a, settings, connect, instagram, twitter, payload, data;
263
- var _b, _c, _d, _e, _f, _g, _h, _j;
264
- return __generator(this, function (_k) {
265
- switch (_k.label) {
262
+ var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
263
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
264
+ return __generator(this, function (_m) {
265
+ switch (_m.label) {
266
266
  case 0:
267
267
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
268
- 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) : '';
269
- 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) : '';
268
+ instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.twitter) : '';
269
+ twitter = !!((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) ? "".concat(TWITTER_URL, "/").concat((_f = params.links) === null || _f === void 0 ? void 0 : _f.twitter) : '';
270
+ _b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData, otpData = _b.otpData, brandData = _b.brandData;
271
+ isAbsher = otpData.isAbsher;
272
+ responseBody = (isAbsher ? nidData : mobileData).responseBody;
273
+ isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
270
274
  payload = {
271
275
  brand: {
272
276
  name: {
@@ -274,20 +278,20 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
274
278
  ar: params.brandName,
275
279
  zh: params.brandName
276
280
  },
277
- website: (_f = params.links) === null || _f === void 0 ? void 0 : _f.website,
281
+ website: (_g = params.links) === null || _g === void 0 ? void 0 : _g.website,
278
282
  social: [twitter, instagram]
279
283
  },
280
- id: ((_g = connect.data.otpData.responseBody) === null || _g === void 0 ? void 0 : _g.lead_id) || '',
284
+ id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
281
285
  terms_conditions_accepted: params.termAndConditionChecked,
282
286
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
283
287
  encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'social[0]', 'social[1]']
284
288
  };
285
289
  return [4, API.leadService.updateLead(payload)];
286
290
  case 1:
287
- data = (_k.sent()).data;
291
+ data = (_m.sent()).data;
288
292
  if (!data.errors) {
289
293
  thunkApi.dispatch(handleNextScreenStep());
290
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, params);
294
+ (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, params);
291
295
  }
292
296
  return [2, { response: data, formData: params }];
293
297
  }
@@ -336,23 +340,32 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
336
340
  });
337
341
  });
338
342
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
339
- var _a, settings, connect, payload, data;
340
- var _b, _c, _d, _e, _f;
341
- return __generator(this, function (_g) {
342
- switch (_g.label) {
343
+ var _a, settings, connect, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
344
+ var _c, _d, _e, _f, _g, _h;
345
+ return __generator(this, function (_j) {
346
+ switch (_j.label) {
343
347
  case 0:
344
348
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
349
+ _b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData, otpData = _b.otpData, brandData = _b.brandData;
350
+ isAbsher = otpData.isAbsher;
351
+ responseBody = (isAbsher ? nidData : mobileData).responseBody;
352
+ isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
345
353
  payload = {
346
354
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
347
- email_url: getClientEmailUrl(),
348
- id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
355
+ flows: [
356
+ {
357
+ name: 'business',
358
+ url: getFlowUrl('/business')
359
+ }
360
+ ],
361
+ id: (isExistingUser ? (_c = brandData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id : (_d = otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
349
362
  encryption_contract: []
350
363
  };
351
364
  return [4, API.leadService.updateLead(payload)];
352
365
  case 1:
353
- data = (_g.sent()).data;
354
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
355
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
366
+ data = (_j.sent()).data;
367
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
368
+ (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
356
369
  return [2, { response: data, formData: params }];
357
370
  }
358
371
  });
@@ -360,6 +373,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
360
373
  var initialState = {
361
374
  error: null,
362
375
  loading: false,
376
+ customLoading: false,
363
377
  data: {
364
378
  businessCountry: defaultCountry,
365
379
  countries: [],
@@ -424,6 +438,7 @@ export var connectSlice = createSlice({
424
438
  builder
425
439
  .addCase(getCountries.fulfilled, function (state, action) {
426
440
  state.error = null;
441
+ state.customLoading = false;
427
442
  var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
428
443
  state.data.countries = countries;
429
444
  state.data.businessCountry = businessCountry || defaultCountry;
@@ -431,13 +446,16 @@ export var connectSlice = createSlice({
431
446
  })
432
447
  .addCase(getCountries.pending, function (state) {
433
448
  state.error = null;
449
+ state.customLoading = true;
434
450
  })
435
451
  .addCase(getCountries.rejected, function (state, action) {
436
452
  state.error = action.error.message;
453
+ state.customLoading = false;
437
454
  })
438
455
  .addCase(createMobileAuth.fulfilled, function (state, action) {
439
456
  var _a;
440
457
  state.loading = false;
458
+ state.customLoading = false;
441
459
  state.error = null;
442
460
  var _b = action.payload, formData = _b.formData, response = _b.response;
443
461
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -450,12 +468,15 @@ export var connectSlice = createSlice({
450
468
  state.data.otpData.isAbsher = false;
451
469
  })
452
470
  .addCase(createMobileAuth.pending, function (state, action) {
453
- var _a;
454
- state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
471
+ if (action.meta.arg.isResend)
472
+ state.customLoading = true;
473
+ if (!action.meta.arg.isResend)
474
+ state.loading = true;
455
475
  state.error = null;
456
476
  })
457
477
  .addCase(createMobileAuth.rejected, function (state, action) {
458
478
  state.loading = false;
479
+ state.customLoading = false;
459
480
  state.error = action.error.message;
460
481
  })
461
482
  .addCase(createNIDAuth.fulfilled, function (state, action) {
@@ -608,7 +629,7 @@ export var connectSlice = createSlice({
608
629
  .addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
609
630
  var _a;
610
631
  state.error = null;
611
- state.data.brandData.responseBody = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response;
632
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response);
612
633
  })
613
634
  .addCase(checkBrandNameAvailability.pending, function (state) {
614
635
  state.error = null;
@@ -164,6 +164,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
164
164
  var initialState = {
165
165
  error: null,
166
166
  loading: false,
167
+ customLoading: false,
167
168
  data: {
168
169
  verify: {
169
170
  token: ''
@@ -199,10 +200,12 @@ export var individualSlice = createSlice({
199
200
  builder
200
201
  .addCase(verifyLeadToken.pending, function (state) {
201
202
  state.error = null;
203
+ state.customLoading = true;
202
204
  })
203
205
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
204
206
  var _a;
205
207
  state.error = null;
208
+ state.customLoading = false;
206
209
  var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
207
210
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
208
211
  if (description) {
@@ -214,6 +217,7 @@ export var individualSlice = createSlice({
214
217
  })
215
218
  .addCase(verifyLeadToken.rejected, function (state, action) {
216
219
  state.error = action.error.message;
220
+ state.customLoading = false;
217
221
  })
218
222
  .addCase(verifyLeadOTP.pending, function (state) {
219
223
  state.loading = true;
@@ -158,6 +158,7 @@ export var passwordSlice = createSlice({
158
158
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
159
159
  var _a;
160
160
  state.error = null;
161
+ state.customLoading = false;
161
162
  var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
162
163
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
163
164
  if (description) {
@@ -166,9 +167,14 @@ export var passwordSlice = createSlice({
166
167
  }
167
168
  state.data.verify.responseBody = __assign(__assign({}, data), leadData);
168
169
  state.data.verify.token = token;
170
+ })
171
+ .addCase(verifyLeadToken.pending, function (state, action) {
172
+ state.customLoading = true;
173
+ state.error = null;
169
174
  })
170
175
  .addCase(verifyLeadToken.rejected, function (state, action) {
171
176
  state.error = action.error.message;
177
+ state.customLoading = false;
172
178
  })
173
179
  .addCase(verifyPasswordLeadOTP.pending, function (state) {
174
180
  state.loading = true;
@@ -190,6 +190,7 @@ export var taxSlice = createSlice({
190
190
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
191
191
  var _a;
192
192
  state.error = null;
193
+ state.customLoading = false;
193
194
  var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
194
195
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
195
196
  if (description) {
@@ -198,9 +199,14 @@ export var taxSlice = createSlice({
198
199
  }
199
200
  state.data.verify.responseBody = __assign(__assign({}, data), leadData);
200
201
  state.data.verify.token = token;
202
+ })
203
+ .addCase(verifyLeadToken.pending, function (state, action) {
204
+ state.error = null;
205
+ state.customLoading = true;
201
206
  })
202
207
  .addCase(verifyLeadToken.rejected, function (state, action) {
203
208
  state.error = action.error.message;
209
+ state.customLoading = false;
204
210
  })
205
211
  .addCase(verifyTaxLeadOTP.pending, function (state) {
206
212
  state.loading = true;
@@ -14,7 +14,7 @@ import React, { memo, useEffect } from 'react';
14
14
  import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
15
15
  import { settingsSelector } from '../../app/settings';
16
16
  import { FeatureContainer } from '../shared/Containers';
17
- import { getCountries, verifyLeadToken } from '../app/business/businessStore';
17
+ import { businessSelector, getCountries, verifyLeadToken } from '../app/business/businessStore';
18
18
  import AnimationFlow from '../../components/AnimationFlow';
19
19
  import { store } from '../../app/store';
20
20
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
@@ -28,6 +28,7 @@ var Business = memo(function (props) {
28
28
  var theme = useAppTheme().theme;
29
29
  var dispatch = useAppDispatch();
30
30
  var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
+ var customLoading = useAppSelector(businessSelector).customLoading;
31
32
  var loading = useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props)).loading;
32
33
  useErrorListener();
33
34
  var activeScreen = data.activeScreen;
@@ -44,7 +45,7 @@ var Business = memo(function (props) {
44
45
  useEffect(function () {
45
46
  dispatch(getCountries());
46
47
  }, []);
47
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
48
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
48
49
  var Element = _a.element, name = _a.name;
49
50
  var isActive = activeScreen.name === name;
50
51
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -61,6 +61,10 @@ var Activities = function () {
61
61
  var activities = activitiesData.activities;
62
62
  methods.setValue('activities', activities);
63
63
  }, [activitiesData === null || activitiesData === void 0 ? void 0 : activitiesData.activities]);
64
+ React.useEffect(function () {
65
+ if (activitiesData.operationStartDate)
66
+ methods.setValue('operationStartDate', activitiesData.operationStartDate, { shouldValidate: true });
67
+ }, [activitiesData.operationStartDate]);
64
68
  React.useEffect(function () {
65
69
  if (error)
66
70
  dispatch(clearError());
@@ -83,19 +83,18 @@ var ActivitiesList = function (_a) {
83
83
  var t = useTranslation().t;
84
84
  var isAr = useLanguage().isAr;
85
85
  var control = useFormContext().control;
86
+ var data = useSelector(businessSelector).data;
86
87
  var activitiesControl = useController({ name: 'activities', control: control });
87
88
  var controlValue = activitiesControl.field.value;
88
- var data = useSelector(businessSelector).data;
89
89
  var businessTypeData = data.businessTypeData;
90
- var response = businessTypeData.responseBody;
90
+ var activities = (businessTypeData.responseBody || {}).activities;
91
91
  var businessType = (_b = businessTypeData.selectedLicense) === null || _b === void 0 ? void 0 : _b.type;
92
92
  var isCR = businessType === BusinessType.CR;
93
93
  React.useEffect(function () {
94
- var _a;
95
- if (((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
96
- setActivitiesMenuList(response === null || response === void 0 ? void 0 : response.activities);
94
+ if ((activities === null || activities === void 0 ? void 0 : activities.length) > 0) {
95
+ setActivitiesMenuList(activities);
97
96
  }
98
- }, []);
97
+ }, [activities]);
99
98
  var onOpenList = function (event) {
100
99
  var _a;
101
100
  setAnchorEl(event.currentTarget);
@@ -84,13 +84,12 @@ var SalesChannels = function () {
84
84
  var channelsChecked = channelsControl.field.value;
85
85
  var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
86
86
  var data = useSelector(businessSelector).data;
87
- var response = data.businessTypeData.responseBody;
87
+ var channelList = (data.businessTypeData.responseBody || {}).channelList;
88
88
  React.useEffect(function () {
89
- var _a;
90
- if (((_a = response === null || response === void 0 ? void 0 : response.channelList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
91
- setChannelsMenuList(response === null || response === void 0 ? void 0 : response.channelList);
89
+ if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
90
+ setChannelsMenuList(channelList);
92
91
  }
93
- }, [response === null || response === void 0 ? void 0 : response.channelList]);
92
+ }, [channelList]);
94
93
  var handleSalesChannelChange = function (event, checked) {
95
94
  var selected = channelsMenuList.find(function (channel) { return channel.id.toString() === event.target.id; });
96
95
  var isExists = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (selected === null || selected === void 0 ? void 0 : selected.id); });
@@ -21,13 +21,12 @@ import Form from '../../../../components/Form';
21
21
  import Collapse from '../../../../components/Collapse';
22
22
  import { useLanguage } from '../../../../hooks';
23
23
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
- import { businessSelector, clearError, retrieveEntityList, updateLeadBusinessType } from '../../../app/business/businessStore';
24
+ import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
25
25
  import Button from '../../../shared/Button';
26
26
  import { LicenseValidationSchema } from './validation';
27
27
  import LicenseList from './LicenseList';
28
28
  var BusinessType = function (_a) {
29
29
  var _b = useSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
30
- var businessTypeData = data.businessTypeData;
31
30
  var t = useTranslation().t;
32
31
  var isAr = useLanguage().isAr;
33
32
  var dispatch = useAppDispatch();
@@ -37,10 +36,6 @@ var BusinessType = function (_a) {
37
36
  defaultValues: data.businessTypeData,
38
37
  mode: 'onChange'
39
38
  });
40
- React.useEffect(function () {
41
- if (!(businessTypeData === null || businessTypeData === void 0 ? void 0 : businessTypeData.responseBody))
42
- dispatch(retrieveEntityList());
43
- }, []);
44
39
  React.useEffect(function () {
45
40
  if (error)
46
41
  dispatch(clearError());
@@ -52,7 +52,7 @@ var LicenseContainer = styled(Box)(function () { return ({
52
52
  }); });
53
53
  var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
54
54
  var theme = _a.theme, isSelected = _a.isSelected;
55
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
55
+ return (__assign(__assign({ display: 'flex', color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
56
56
  });
57
57
  var LicenseList = function (_a) {
58
58
  var rest = __rest(_a, []);
@@ -64,7 +64,7 @@ var LicenseList = function (_a) {
64
64
  var dispatch = useAppDispatch();
65
65
  var _d = useFormContext(), setValue = _d.setValue, control = _d.control;
66
66
  var selectedLicenseControl = useController({ control: control, name: 'selectedLicense' });
67
- var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense;
67
+ var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber;
68
68
  var licenseList = (responseBody || { licenseList: [] }).licenseList;
69
69
  var onOpenLicenseList = function (event) {
70
70
  var _a;
@@ -77,12 +77,14 @@ var LicenseList = function (_a) {
77
77
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
78
78
  };
79
79
  React.useEffect(function () {
80
- var list = licenseList || [];
81
- if (list.length > 0) {
82
- setValue('licenseList', list);
80
+ if (licenseList.length > 0)
81
+ setValue('licenseList', licenseList);
82
+ }, [licenseList]);
83
+ React.useEffect(function () {
84
+ if (licenseList.length > 0) {
83
85
  if (!!selectedLicense) {
84
86
  setValue('selectedLicense', selectedLicense, { shouldValidate: true });
85
- setValue('licenseNumber', getLicenseNumber(selectedLicense), { shouldValidate: true });
87
+ setValue('licenseNumber', licenseNumber, { shouldValidate: true });
86
88
  }
87
89
  }
88
90
  }, [licenseList, selectedLicense]);
@@ -93,8 +95,8 @@ var LicenseList = function (_a) {
93
95
  var getLicenseName = function (item) {
94
96
  var _a, _b;
95
97
  if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.FL && !isOtherLicense(item))
96
- return 'future_work';
97
- return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
98
+ return t('future_work');
99
+ return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
98
100
  };
99
101
  var isOtherLicense = function (item) {
100
102
  var _a, _b;
@@ -110,15 +112,18 @@ var LicenseList = function (_a) {
110
112
  setValue('licenseNumber', getLicenseNumber(license), { shouldValidate: true });
111
113
  onCloseLicenseList();
112
114
  };
115
+ var getLicenseFullName = function (item) {
116
+ if (isAr)
117
+ return _jsx("span", { children: "".concat(getLicenseName(item), " - ").concat(getLicenseNumber(item)) });
118
+ return _jsx("span", { children: "".concat(getLicenseNumber(item), " - ").concat(getLicenseName(item)) });
119
+ };
113
120
  var showLicenseNumber = !anchorEl;
114
121
  var selected = selectedLicenseControl.field.value;
115
122
  var licenseReadonly = !isOtherLicense(selected);
116
123
  var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
117
- var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : t(getLicenseNumber(selected));
118
- return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
119
- return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item)
120
- ? t(getLicenseName(item))
121
- : getLicenseNumber(item) + ' - ' + getLicenseName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
124
+ var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
125
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? getLicenseName(selected) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
126
+ return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
122
127
  } }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
123
128
  };
124
129
  export default React.memo(LicenseList);
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH } from '../../../../constants';
17
- import { removeAllCharsFromNumber, removeAllOtherThanCharsAndNumber } from '../../../../utils';
17
+ import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -31,7 +31,7 @@ var LicenseNumber = function (_a) {
31
31
  var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
32
32
  var handleFLNumberChange = function (_a) {
33
33
  var target = _a.target;
34
- var value = isCR ? removeAllCharsFromNumber(target.value) : removeAllOtherThanCharsAndNumber(target.value);
34
+ var value = removeAllOtherThanCharsAndNumber(target.value);
35
35
  licenseNumberControl.field.onChange(value);
36
36
  };
37
37
  var clearLicenseNumber = function () {
@@ -41,6 +41,6 @@ var LicenseNumber = function (_a) {
41
41
  var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
42
42
  var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
43
43
  var label = isCR ? 'cr_number' : 'fl_number';
44
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '0123456789' : '12345678', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
44
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '01f3c5x78n' : '1a3c5b78', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
45
45
  };
46
46
  export default React.memo(LicenseNumber);
@@ -52,7 +52,6 @@ var Customers = function (_a) {
52
52
  mode: 'onChange'
53
53
  });
54
54
  var onSubmit = function (data) {
55
- console.log('data', data);
56
55
  dispatch(updateCustomersInfo(__assign({}, data)));
57
56
  };
58
57
  var onBack = function () {
@@ -4,6 +4,7 @@ import { useAppDispatch } from '../../../../hooks';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import SuccessScreen from '../../../shared/SuccessScreen';
6
6
  import { updateLeadSuccess } from '../../../app/business/businessStore';
7
+ import { handleNextScreenStep } from '../../../../app/settings';
7
8
  var Success = function (_a) {
8
9
  var t = useTranslation().t;
9
10
  var dispatch = useAppDispatch();
@@ -11,8 +12,8 @@ var Success = function (_a) {
11
12
  dispatch(updateLeadSuccess());
12
13
  }, []);
13
14
  var onSuccess = function () {
14
- window.open('mailto:');
15
+ dispatch(handleNextScreenStep());
15
16
  };
16
- return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
17
+ return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess, successTitle: 'continue' });
17
18
  };
18
19
  export default React.memo(Success);
@@ -19,19 +19,15 @@ import Container from '../../../shared/Containers/ScreenContainer';
19
19
  import { FlowsButtons } from '../../../shared/Button';
20
20
  import { ICONS_NAMES } from '../../../../constants';
21
21
  var TextContainerStyled = styled(Box)(function (_a) {
22
- var _b;
23
22
  var theme = _a.theme;
24
- return (_b = {
25
- background: theme.palette.common.white,
26
- border: '1px solid',
27
- width: '100%',
28
- borderColor: theme.palette.divider,
29
- borderRadius: theme.spacing(0, 0, 1.25, 1.25)
30
- },
31
- _b[theme.breakpoints.up('sm')] = {
32
- marginBottom: theme.spacing(7.5)
33
- },
34
- _b);
23
+ return ({
24
+ background: theme.palette.common.white,
25
+ border: '1px solid',
26
+ width: '100%',
27
+ borderColor: theme.palette.divider,
28
+ borderRadius: theme.spacing(0, 0, 1.25, 1.25),
29
+ marginBottom: theme.spacing(7.5)
30
+ });
35
31
  });
36
32
  var TitleStyled = styled(Text)(function (_a) {
37
33
  var theme = _a.theme;
@@ -55,24 +51,28 @@ var SuccessWithFlowButtons = function () {
55
51
  var t = useTranslation().t;
56
52
  return (_jsxs(ContainerStyled, { children: [_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [t('ide_successfully_verified_message'), " "] }) }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: [
57
53
  {
58
- title: t('tax_flow_completed'),
54
+ title: t('tax_flow_pending'),
59
55
  href: '#',
60
- src: ICONS_NAMES.TAX_ICON
56
+ src: ICONS_NAMES.Tax_filled_icon,
57
+ hoverSrc: ICONS_NAMES.Tax_white_icon
61
58
  },
62
59
  {
63
- title: t('individual_flow_completed'),
60
+ title: t('individual_flow_pending'),
64
61
  href: '#',
65
- src: ICONS_NAMES.INDIVIDUAL_ICON
62
+ src: ICONS_NAMES.User_filled_icon,
63
+ hoverSrc: ICONS_NAMES.User_white_icon
66
64
  },
67
65
  {
68
- title: t('bank_flow_completed'),
66
+ title: t('bank_flow_pending'),
69
67
  href: '#',
70
- src: ICONS_NAMES.BANK_ICON
68
+ src: ICONS_NAMES.Bank_filled_icon,
69
+ hoverSrc: ICONS_NAMES.Bank_white_icon
71
70
  },
72
71
  {
73
- title: t('password_flow_completed'),
72
+ title: t('password_flow_pending'),
74
73
  href: '#',
75
- src: ICONS_NAMES.PASSWORD_ICON
74
+ src: ICONS_NAMES.Password_filled_icon,
75
+ hoverSrc: ICONS_NAMES.Password_white_icon
76
76
  }
77
77
  ] }) })] }));
78
78
  };
@@ -59,7 +59,7 @@ var VerifyNumber = function (_a) {
59
59
  var t = useTranslation().t;
60
60
  var isAr = useLanguage().isAr;
61
61
  React.useEffect(function () {
62
- if (error)
62
+ if (error && methods.formState.isValid)
63
63
  dispatch(clearError());
64
64
  return function () {
65
65
  dispatch(resetOTPScreen());
@@ -43,7 +43,6 @@ var CreatePassword = function (_a) {
43
43
  var isAr = useLanguage().isAr;
44
44
  var dispatch = useAppDispatch();
45
45
  var onSubmit = function (data) {
46
- console.log('data', data);
47
46
  dispatch(handleNextScreenStep());
48
47
  };
49
48
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(Password, {}) }), _jsx(Button, __assign({ disableBack: true, isAr: isAr, disabled: !methods.formState.isValid, loading: false }, { children: t('next') }))] })) })) }));
@@ -44,6 +44,7 @@ var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return
44
44
  var theme = _a.theme, hideIcon = _a.hideIcon;
45
45
  return ({
46
46
  paddingInlineStart: theme.spacing(0.75),
47
+ textTransform: 'none',
47
48
  backgroundColor: theme.palette.common.white,
48
49
  border: "1px solid ".concat(hideIcon ? theme.palette.primary.main : theme.palette.primary.light),
49
50
  color: hideIcon ? theme.palette.primary.main : theme.palette.primary.light,
@@ -63,7 +63,7 @@ var ButtonStyled = styled(Button, {
63
63
  shouldForwardProp: function (prop) { return prop !== 'isBack' && prop !== 'isLoading'; }
64
64
  })(function (_a) {
65
65
  var theme = _a.theme, isBack = _a.isBack, isLoading = _a.isLoading;
66
- return (__assign({ paddingInlineStart: theme.spacing(2.5), marginInlineStart: isBack ? theme.spacing(-5) : theme.spacing(0), paddingLeft: isLoading ? 8 : 'auto', paddingRight: isLoading ? 8 : 'auto', transition: theme.transitions.create(['width', 'padding'], {
66
+ return (__assign({ paddingInlineStart: theme.spacing(2.5), marginInlineStart: isBack ? theme.spacing(-5) : theme.spacing(0), paddingLeft: isLoading ? 8 : 'auto', paddingRight: isLoading ? 8 : 'auto', textTransform: 'none', transition: theme.transitions.create(['width', 'padding'], {
67
67
  easing: theme.transitions.easing.easeInOut,
68
68
  duration: theme.transitions.duration.complex * 2
69
69
  }) }, (isLoading && {