@tap-payments/auth-jsconnect 2.8.63-development → 2.8.64-beta

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/redux.d.ts +0 -1
  2. package/build/api/entity.d.ts +2 -2
  3. package/build/api/entity.js +4 -12
  4. package/build/api/index.d.ts +2 -2
  5. package/build/app/settings.js +2 -3
  6. package/build/components/Tooltip/Tooltip.js +1 -1
  7. package/build/constants/api.d.ts +1 -0
  8. package/build/constants/api.js +2 -0
  9. package/build/constants/app.d.ts +3 -0
  10. package/build/constants/app.js +3 -0
  11. package/build/features/app/bank/bankStore.d.ts +19 -13
  12. package/build/features/app/bank/bankStore.js +165 -183
  13. package/build/features/app/board/boardStore.js +10 -16
  14. package/build/features/app/brand/brandStore.d.ts +31 -16
  15. package/build/features/app/brand/brandStore.js +239 -243
  16. package/build/features/app/business/businessStore.js +1 -7
  17. package/build/features/app/entity/entityStore.d.ts +34 -20
  18. package/build/features/app/entity/entityStore.js +249 -204
  19. package/build/features/app/individual/individualStore.d.ts +36 -17
  20. package/build/features/app/individual/individualStore.js +270 -221
  21. package/build/features/app/password/passwordStore.d.ts +25 -21
  22. package/build/features/app/password/passwordStore.js +219 -196
  23. package/build/features/app/tax/taxStore.d.ts +7 -13
  24. package/build/features/app/tax/taxStore.js +147 -168
  25. package/build/features/auth/screens/AuthenticationList/LicenseNumber.js +2 -2
  26. package/build/features/bank/screens/BankDetails/BankDetails.js +4 -17
  27. package/build/features/brand/screens/BrandActivities/BrandActivities.js +11 -48
  28. package/build/features/brand/screens/BrandInfo/BrandInfo.js +4 -22
  29. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +6 -22
  30. package/build/features/business/screens/Activities/Activities.js +1 -9
  31. package/build/features/business/screens/BusinessType/LicenseNumber.js +2 -2
  32. package/build/features/business/screens/Customers/Customers.js +1 -9
  33. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +1 -7
  34. package/build/features/connectExpress/screens/AuthenticationList/LicenseNumber.js +2 -2
  35. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
  36. package/build/features/entity/screens/EntityCapital/EntityCapital.js +9 -33
  37. package/build/features/entity/screens/EntityName/EntityName.js +14 -31
  38. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +10 -43
  39. package/build/features/individual/screens/IndividualList/IndividualList.js +0 -7
  40. package/build/features/individual/screens/IndividualList/UserList.js +3 -3
  41. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +18 -73
  42. package/build/features/password/Password.js +1 -1
  43. package/build/features/shared/Button/FlowsButtons.js +1 -7
  44. package/build/features/signIn/SignIn.js +2 -10
  45. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -7
  46. package/build/hooks/index.d.ts +0 -1
  47. package/build/hooks/index.js +0 -1
  48. package/build/utils/common.js +4 -4
  49. package/build/utils/validation.d.ts +1 -0
  50. package/build/utils/validation.js +3 -0
  51. package/package.json +2 -2
  52. package/build/hooks/useFormDirtyCheck.d.ts +0 -10
  53. package/build/hooks/useFormDirtyCheck.js +0 -66
@@ -15,13 +15,13 @@ import { ScreenContainer } from '../../../shared/Containers';
15
15
  import { FormProvider, useForm } from 'react-hook-form';
16
16
  import Form from '../../../../components/Form';
17
17
  import { styled } from '@mui/material/styles';
18
- import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
18
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import { BrandActivitiesValidationSchema } from './validation';
21
21
  import Button from '../../../shared/Button';
22
22
  import { brandSelector, updateBrandActivities } from '../../../app/brand/brandStore';
23
- import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
24
- import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
23
+ import { handlePrevScreenStep } from '../../../../app/settings';
24
+ import { deepCopy } from '../../../../utils';
25
25
  import { useTranslation } from 'react-i18next';
26
26
  import ActivitiesList from './ActivitiesList';
27
27
  import CustomerBase from './CustomerBase';
@@ -36,12 +36,11 @@ var FormStyled = styled(Form)(function () { return ({
36
36
  flexDirection: 'column'
37
37
  }); });
38
38
  var BrandActivities = function (_a) {
39
- var _b, _c, _d, _e;
40
- var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
39
+ var _b, _c, _d, _e, _f;
40
+ var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
41
41
  var dispatch = useAppDispatch();
42
- var settingsData = useAppSelector(settingsSelector).data;
43
- var _g = useAppSelector(brandSelector), data = _g.data, loading = _g.loading, error = _g.error;
44
- var _h = data.brandActivities, activities = _h.activities, customerLocations = _h.customerLocations, expectedCustomer = _h.expectedCustomer, expectedSale = _h.expectedSale, termAndConditionChecked = _h.termAndConditionChecked, refundPolicy = _h.refundPolicy, transactionPolicy = _h.transactionPolicy;
42
+ var _h = useAppSelector(brandSelector), data = _h.data, loading = _h.loading, error = _h.error;
43
+ var _j = data.brandActivities, activities = _j.activities, customerLocations = _j.customerLocations, expectedCustomer = _j.expectedCustomer, expectedSale = _j.expectedSale, termAndConditionChecked = _j.termAndConditionChecked, refundPolicy = _j.refundPolicy, transactionPolicy = _j.transactionPolicy;
45
44
  var ListType;
46
45
  (function (ListType) {
47
46
  ListType["ActivitiesList"] = "ActivitiesList";
@@ -49,14 +48,6 @@ var BrandActivities = function (_a) {
49
48
  ListType["ExpectedCustomerList"] = "ExpectedCustomerList";
50
49
  ListType["ExpectedSalesList"] = "ExpectedSalesList";
51
50
  })(ListType || (ListType = {}));
52
- React.useEffect(function () {
53
- sendCustomEventToGTM({
54
- event: 'Send Event',
55
- event_category: 'Board Flows - Brand',
56
- event_action: 'Update Brand Activities Details Page',
57
- event_label: settingsData.businessCountry.iso2
58
- });
59
- }, []);
60
51
  var methods = useForm({
61
52
  resolver: yupResolver(BrandActivitiesValidationSchema()),
62
53
  defaultValues: {
@@ -71,8 +62,7 @@ var BrandActivities = function (_a) {
71
62
  mode: 'onChange'
72
63
  });
73
64
  useSetFromDefaultValues(methods, data.brandActivities, true);
74
- var _j = data.verify.responseBody || {}, activitiesDefaultValues = _j.activitiesDefaultValues, brand = _j.brand;
75
- var _k = brand || {}, data_status = _k.data_status, data_verification = _k.data_verification, operations = _k.operations;
65
+ var _k = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, data_status = _k.data_status, data_verification = _k.data_verification, operations = _k.operations;
76
66
  var originalReadOnly = useFormReadOnly(methods);
77
67
  var noneEditable = useDataNoneEditable(data_status, [
78
68
  'activities',
@@ -88,32 +78,6 @@ var BrandActivities = function (_a) {
88
78
  'operations.sales_range'
89
79
  ]);
90
80
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
91
- var isDirty = useFormDirtyCheck(methods, {
92
- activities: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.activities,
93
- customerLocations: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.customerLocations,
94
- expectedCustomer: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.expectedCustomer,
95
- expectedSale: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.expectedSale,
96
- termAndConditionChecked: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.termAndConditionChecked,
97
- refundPolicy: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.transactionPolicy,
98
- transactionPolicy: activitiesDefaultValues === null || activitiesDefaultValues === void 0 ? void 0 : activitiesDefaultValues.refundPolicy
99
- }, [
100
- {
101
- name: 'activities',
102
- keys: ['id']
103
- },
104
- {
105
- name: 'customerLocations',
106
- keys: ['id']
107
- },
108
- {
109
- name: 'expectedCustomer',
110
- keys: ['id']
111
- },
112
- {
113
- name: 'expectedSale',
114
- keys: ['id']
115
- }
116
- ]).isDirty;
117
81
  var locations = methods.watch('customerLocations');
118
82
  var isCustomerLocationsHasVerifiedValue = React.useMemo(function () {
119
83
  var _a, _b;
@@ -128,11 +92,10 @@ var BrandActivities = function (_a) {
128
92
  return (locationIds === null || locationIds === void 0 ? void 0 : locationIds.length) === (Ids === null || Ids === void 0 ? void 0 : Ids.length) && locationIds.every(function (locationId) { return Ids.includes(locationId); });
129
93
  }, [locations, operations]);
130
94
  var isCustomerLocationsVerified = dataVerified['operations.customer_base_location'] && isCustomerLocationsHasVerifiedValue;
131
- var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((_b = operations === null || operations === void 0 ? void 0 : operations.sales) === null || _b === void 0 ? void 0 : _b.id) === ((_c = methods.watch('expectedSale')) === null || _c === void 0 ? void 0 : _c.id);
132
- var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((_d = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _d === void 0 ? void 0 : _d.id) === ((_e = methods.watch('expectedCustomer')) === null || _e === void 0 ? void 0 : _e.id);
95
+ var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((_c = operations === null || operations === void 0 ? void 0 : operations.sales) === null || _c === void 0 ? void 0 : _c.id) === ((_d = methods.watch('expectedSale')) === null || _d === void 0 ? void 0 : _d.id);
96
+ var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((_e = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _e === void 0 ? void 0 : _e.id) === ((_f = methods.watch('expectedCustomer')) === null || _f === void 0 ? void 0 : _f.id);
133
97
  var onSubmit = function (data) {
134
- var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
135
- dispatch(updateBrandActivities(formData));
98
+ dispatch(updateBrandActivities(deepCopy(getFelids(data))));
136
99
  };
137
100
  var onBack = function () {
138
101
  dispatch(handlePrevScreenStep());
@@ -14,11 +14,11 @@ import React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { FormProvider, useForm } from 'react-hook-form';
16
16
  import { styled } from '@mui/material/styles';
17
- import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
17
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
18
18
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import Form from '../../../../components/Form';
21
- import { deepCopy, mapSalesChannel, sendCustomEventToGTM } from '../../../../utils';
21
+ import { deepCopy, mapSalesChannel } from '../../../../utils';
22
22
  import Button from '../../../shared/Button';
23
23
  import { clearError, brandSelector, updateBrand, retrieveBoardStatus } from '../../../app/brand/brandStore';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -39,7 +39,7 @@ var BrandInfo = function (_a) {
39
39
  var settingsData = useAppSelector(settingsSelector).data;
40
40
  var _d = data.brandData, brandName = _d.brandName, salesChannels = _d.salesChannels, brandLogoId = _d.brandLogoId, responseBody = _d.responseBody;
41
41
  var _e = data.verify.responseBody || {}, brand = _e.brand, flows = _e.flows;
42
- var _f = brand || {}, logo_details = _f.logo_details, data_status = _f.data_status, data_verification = _f.data_verification, name = _f.name, channel_services = _f.channel_services;
42
+ var _f = brand || {}, logo_details = _f.logo_details, data_status = _f.data_status, data_verification = _f.data_verification, name = _f.name;
43
43
  var methods = useForm({
44
44
  resolver: yupResolver(BrandValidationSchema()),
45
45
  defaultValues: {
@@ -52,17 +52,6 @@ var BrandInfo = function (_a) {
52
52
  var watch = methods.watch;
53
53
  useSetFromDefaultValues(methods, data.brandData, true);
54
54
  var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
55
- var initialSalesChannels = React.useMemo(function () { return mapSalesChannel(channel_services || []); }, [channel_services]);
56
- var isDirty = useFormDirtyCheck(methods, {
57
- brandName: ((name === null || name === void 0 ? void 0 : name.en) || '').trim(),
58
- salesChannels: initialSalesChannels,
59
- brandLogoId: defaultBrandLogoFile === null || defaultBrandLogoFile === void 0 ? void 0 : defaultBrandLogoFile.id
60
- }, [
61
- {
62
- name: 'salesChannels',
63
- keys: ['id', 'address', 'code', 'sub']
64
- }
65
- ]).isDirty;
66
55
  var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
67
56
  var noneEditable = useDataNoneEditable(data_status, ['name.en', 'name.ar', 'channel_services', 'logo']);
68
57
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
@@ -70,16 +59,9 @@ var BrandInfo = function (_a) {
70
59
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
71
60
  var isBrandNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && ((name === null || name === void 0 ? void 0 : name.en) === watch('brandName') || (name === null || name === void 0 ? void 0 : name.ar) === watch('brandName'));
72
61
  var onSubmit = function (data) {
73
- var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
74
- dispatch(updateBrand(formData));
62
+ dispatch(updateBrand(deepCopy(getFelids(data))));
75
63
  };
76
64
  var onBack = function () {
77
- sendCustomEventToGTM({
78
- event: 'Send Event',
79
- event_category: 'Board Flows - Brand',
80
- event_action: 'Brand Details Back button',
81
- event_label: settingsData.businessCountry.iso2
82
- });
83
65
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
84
66
  dispatch(handlePrevScreenStep());
85
67
  return;
@@ -14,12 +14,12 @@ import React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { FormProvider, useForm } from 'react-hook-form';
16
16
  import { styled } from '@mui/material/styles';
17
- import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
18
- import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
17
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
18
+ import { handlePrevScreenStep } from '../../../../app/settings';
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import Collapse from '../../../../components/Collapse';
21
21
  import Form from '../../../../components/Form';
22
- import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
22
+ import { deepCopy } from '../../../../utils';
23
23
  import { ScreenContainer } from '../../../shared/Containers';
24
24
  import { clearError, brandSelector, updateSegmentBrand } from '../../../app/brand/brandStore';
25
25
  import Button from '../../../shared/Button';
@@ -46,10 +46,9 @@ var BrandInfo = function (_a) {
46
46
  var t = useTranslation().t;
47
47
  var isAr = useLanguage().isAr;
48
48
  var _l = useAppSelector(brandSelector), data = _l.data, loading = _l.loading, error = _l.error;
49
- var settingsData = useAppSelector(settingsSelector).data;
50
49
  var _m = data.brandSegmentData, segmentLocation = _m.segmentLocation, segmentProfit = _m.segmentProfit, segmentTech = _m.segmentTech, teamSize = _m.teamSize;
51
- var _o = data.verify.responseBody || {}, brand = _o.brand, segmentDefaultValues = _o.segmentDefaultValues;
52
- var _p = brand || {}, data_status = _p.data_status, data_verification = _p.data_verification, resSegment = _p.segment;
50
+ var brand = (data.verify.responseBody || {}).brand;
51
+ var _o = brand || {}, data_status = _o.data_status, data_verification = _o.data_verification, resSegment = _o.segment;
53
52
  var methods = useForm({
54
53
  resolver: yupResolver(BrandValidationSchema()),
55
54
  defaultValues: {
@@ -62,12 +61,6 @@ var BrandInfo = function (_a) {
62
61
  });
63
62
  var watch = methods.watch;
64
63
  useSetFromDefaultValues(methods, data.brandSegmentData, true);
65
- var isDirty = useFormDirtyCheck(methods, {
66
- segmentLocation: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.segmentLocation,
67
- segmentProfit: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.segmentProfit,
68
- segmentTech: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.segmentTech,
69
- teamSize: segmentDefaultValues === null || segmentDefaultValues === void 0 ? void 0 : segmentDefaultValues.teamSize
70
- }).isDirty;
71
64
  var originalReadOnly = useFormReadOnly(methods);
72
65
  var noneEditable = useDataNoneEditable(data_status, [
73
66
  'segment.location_type',
@@ -88,20 +81,11 @@ var BrandInfo = function (_a) {
88
81
  var isSegmentTechVerified = dataVerified['segment.tech_type'] && ((_f = resSegment === null || resSegment === void 0 ? void 0 : resSegment.tech_type) === null || _f === void 0 ? void 0 : _f.id) === ((_g = watch('segmentTech')) === null || _g === void 0 ? void 0 : _g.id);
89
82
  var isTeamSizeVerified = dataVerified['segment.teams'] && ((_h = resSegment === null || resSegment === void 0 ? void 0 : resSegment.team) === null || _h === void 0 ? void 0 : _h.id) === ((_j = watch('teamSize')) === null || _j === void 0 ? void 0 : _j.id);
90
83
  var onSubmit = function (data) {
91
- var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
92
- dispatch(updateSegmentBrand(formData));
84
+ dispatch(updateSegmentBrand(deepCopy(getFelids(data))));
93
85
  };
94
86
  var onBack = function () {
95
87
  dispatch(handlePrevScreenStep());
96
88
  };
97
- React.useEffect(function () {
98
- sendCustomEventToGTM({
99
- event: 'Send Event',
100
- event_category: 'Board Flows - Brand',
101
- event_action: 'Update Business Market & Size',
102
- event_label: settingsData.businessCountry.iso2
103
- });
104
- }, []);
105
89
  React.useEffect(function () {
106
90
  if (error)
107
91
  dispatch(clearError());
@@ -20,7 +20,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import { useTranslation } from 'react-i18next';
21
21
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
22
22
  import Button from '../../../shared/Button';
23
- import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
23
+ import { deepCopy } from '../../../../utils';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
25
25
  import Collapse from '../../../../components/Collapse';
26
26
  import OperationStartDate from './OperationStartDate';
@@ -65,14 +65,6 @@ var Activities = function () {
65
65
  var onBack = function () {
66
66
  dispatch(handlePrevScreenStep());
67
67
  };
68
- React.useEffect(function () {
69
- sendCustomEventToGTM({
70
- event: 'Send Event',
71
- event_category: 'Account Creation Flow',
72
- event_action: 'Brand Activities Details Page',
73
- event_label: settingsData.businessCountry.iso2
74
- });
75
- }, []);
76
68
  React.useEffect(function () {
77
69
  if (error)
78
70
  dispatch(clearError());
@@ -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_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber, isOtherLicense, isKW, isOtherThanKWOrSA } from '../../../../utils';
17
+ import { isOtherLicense, isKW, isOtherThanKWOrSA, cleanFLandCRNumber } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -38,7 +38,7 @@ var LicenseNumber = function (_a) {
38
38
  var readOnly = !isOtherLicense(selectedLicense) || (selectedEntityLicense && !isOtherLicense(selectedEntityLicense));
39
39
  var handleFLNumberChange = function (_a) {
40
40
  var target = _a.target;
41
- var value = removeAllOtherThanCharsAndNumber(target.value);
41
+ var value = cleanFLandCRNumber(target.value);
42
42
  licenseNumberControl.field.onChange(value);
43
43
  };
44
44
  var clearLicenseNumber = function () {
@@ -30,7 +30,7 @@ import TransactionPolicy from './TransactionPolicy';
30
30
  import { ScreenContainer } from '../../../shared/Containers';
31
31
  import Collapse from '../../../../components/Collapse';
32
32
  import { businessSelector, clearError, updateCustomersInfo } from '../../../app/business/businessStore';
33
- import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
33
+ import { deepCopy } from '../../../../utils';
34
34
  var FormStyled = styled(Form)(function () { return ({
35
35
  display: 'flex',
36
36
  flexDirection: 'column'
@@ -76,14 +76,6 @@ var Customers = function (_a) {
76
76
  'operations.sales_range'
77
77
  ]);
78
78
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
79
- React.useEffect(function () {
80
- sendCustomEventToGTM({
81
- event: 'Send Event',
82
- event_category: 'Account Creation Flow',
83
- event_action: 'Business Market and Size Details Page',
84
- event_label: settingsData.businessCountry.iso2
85
- });
86
- }, []);
87
79
  React.useEffect(function () {
88
80
  var _a, _b;
89
81
  var isTermsAgreed = !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
@@ -52,7 +52,7 @@ import { useAppSelector, useAppDispatch, useLanguage } from '../../../../hooks';
52
52
  import { ScreenContainer } from '../../../shared/Containers';
53
53
  import BusinessCountry from '../../../shared/BusinessCountry';
54
54
  import Button from '../../../shared/Button';
55
- import { findCountryByIso2, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, updateLocationUrlWithCountry } from '../../../../utils';
55
+ import { findCountryByIso2, isKW, isOtherThanKWOrSA, updateLocationUrlWithCountry } from '../../../../utils';
56
56
  import Collapse from '../../../../components/Collapse';
57
57
  import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
58
58
  import { connectSelector, setDefaultCountryCode, updateBusinessCountry, storeIsStartFromBusinessCountry, clearError } from '../../../app/connect/connectStore';
@@ -81,12 +81,6 @@ var BusinessCountryScreen = function (_a) {
81
81
  return [2];
82
82
  countryCode = findCountryByIso2(settingsData.countries, iso2);
83
83
  dispatch(handleSetCountryByIso2(iso2));
84
- sendCustomEventToGTM({
85
- event: 'Send Event',
86
- event_category: 'User Registration Flow',
87
- event_action: 'Country selection page view',
88
- event_label: iso2
89
- });
90
84
  if (settingsData.appConfig.mode !== 'popup')
91
85
  updateLocationUrlWithCountry(iso2);
92
86
  if (!data.leadId) return [3, 2];
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useController, useFormContext } from 'react-hook-form';
5
5
  import { KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH, LICENSE_NUMBER_MAX_LENGTH, LICENSE_NUMBER_MIN_LENGTH } from '../../../../constants';
6
- import { removeAllOtherThanCharsNumberSlashAndHyphen, isSA } from '../../../../utils';
6
+ import { isSA, cleanFLandCRNumber } from '../../../../utils';
7
7
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
8
8
  import ClearIcon from '../../../shared/ClearIcon';
9
9
  import CheckIcon from '../../../shared/CheckIcon';
@@ -19,7 +19,7 @@ var LicenseNumber = function () {
19
19
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
20
20
  var handleFLNumberChange = function (_a) {
21
21
  var target = _a.target;
22
- var value = removeAllOtherThanCharsNumberSlashAndHyphen(target.value);
22
+ var value = cleanFLandCRNumber(target.value);
23
23
  licenseNumberControl.field.onChange(value);
24
24
  };
25
25
  var clearLicenseNumber = function () {
@@ -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_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber, isKW, isOtherThanKWOrSA } from '../../../../utils';
17
+ import { isKW, isOtherThanKWOrSA, cleanFLandCRNumber } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -36,7 +36,7 @@ var LicenseNumber = function (_a) {
36
36
  var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
37
37
  var handleFLNumberChange = function (_a) {
38
38
  var target = _a.target;
39
- var value = removeAllOtherThanCharsAndNumber(target.value);
39
+ var value = cleanFLandCRNumber(target.value);
40
40
  licenseNumberControl.field.onChange(value);
41
41
  };
42
42
  var clearLicenseNumber = function () {
@@ -15,11 +15,11 @@ import { FormProvider, useForm } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { styled } from '@mui/material/styles';
17
17
  import Collapse from '@mui/material/Collapse';
18
- import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
19
- import { deepCopy, formatNumberAsCurrency, removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
18
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
19
+ import { deepCopy, removeAllCharsFromNumber } from '../../../../utils';
20
20
  import { clearError, entitySelector, updateEntityCapital } from '../../../app/entity/entityStore';
21
21
  import { yupResolver } from '@hookform/resolvers/yup';
22
- import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
22
+ import { handlePrevScreenStep } from '../../../../app/settings';
23
23
  import { ScreenContainer } from '../../../shared/Containers';
24
24
  import Form from '../../../../components/Form';
25
25
  import Button from '../../../shared/Button';
@@ -39,36 +39,21 @@ var EntityCapital = function (_a) {
39
39
  var isAr = useLanguage().isAr;
40
40
  var t = useTranslation().t;
41
41
  var dispatch = useAppDispatch();
42
- var settingsData = useAppSelector(settingsSelector).data;
43
42
  var _k = data.entityCapitalData, responseBody = _k.responseBody, capitalPaid = _k.capitalPaid, capitalShareCount = _k.capitalShareCount, capitalShareValue = _k.capitalShareValue, activities = _k.activities;
44
43
  var entity = (data.verify.responseBody || {}).entity;
45
- var _l = entity || {}, data_verification = _l.data_verification, capital = _l.capital, resActivities = _l.activities;
46
- var resCapitalPaidValue = (_b = capital === null || capital === void 0 ? void 0 : capital.paid) === null || _b === void 0 ? void 0 : _b.toString();
47
- var resCapitalShareCount = (_d = (_c = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _c === void 0 ? void 0 : _c.count) === null || _d === void 0 ? void 0 : _d.toString();
48
- var resCapitalShareValue = (_f = (_e = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.toString();
44
+ var _l = entity || {}, data_verification = _l.data_verification, capital = _l.capital;
49
45
  var methods = useForm({
50
46
  resolver: yupResolver(EntityCapitalValidationSchema()),
51
47
  defaultValues: {
52
48
  activities: activities,
53
49
  capitalPaid: capitalPaid,
54
- capitalShareCount: capitalShareCount === null || capitalShareCount === void 0 ? void 0 : capitalShareCount.toString(),
50
+ capitalShareCount: capitalShareCount,
55
51
  capitalShareValue: capitalShareValue
56
52
  },
57
53
  mode: 'onChange'
58
54
  });
59
55
  useSetFromDefaultValues(methods, data.entityCapitalData, true);
60
56
  var watch = methods.watch;
61
- var isDirty = useFormDirtyCheck(methods, {
62
- activities: resActivities,
63
- capitalPaid: resCapitalPaidValue && formatNumberAsCurrency(resCapitalPaidValue),
64
- capitalShareCount: resCapitalShareCount,
65
- capitalShareValue: resCapitalShareValue && formatNumberAsCurrency(resCapitalShareValue)
66
- }, [
67
- {
68
- name: 'activities',
69
- keys: ['id']
70
- }
71
- ]).isDirty;
72
57
  var originalReadOnly = useFormReadOnly(methods);
73
58
  var noneEditable = useDataNoneEditable(entity === null || entity === void 0 ? void 0 : entity.data_status, [
74
59
  'activities',
@@ -79,20 +64,11 @@ var EntityCapital = function (_a) {
79
64
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
80
65
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
81
66
  var dataVerified = useDataVerified(data_verification, ['capital.paid', 'capital.shares.count', 'capital.shares.value']);
82
- var isCapitalPaidVerified = dataVerified['capital.paid'] && resCapitalPaidValue === removeAllCharsFromNumber(watch('capitalPaid'));
83
- var isCapitalShareCountVerified = dataVerified['capital.shares.count'] && resCapitalShareCount === ((_g = watch('capitalShareCount')) === null || _g === void 0 ? void 0 : _g.toString());
84
- var isCapitalShareValueVerified = dataVerified['capital.shares.value'] && resCapitalShareValue === removeAllCharsFromNumber(watch('capitalShareValue'));
85
- React.useEffect(function () {
86
- sendCustomEventToGTM({
87
- event: 'Send Event',
88
- event_category: 'Board Flows - Entity',
89
- event_action: 'Entity Activities and Capital Details Page',
90
- event_label: settingsData.businessCountry.iso2
91
- });
92
- }, []);
67
+ var isCapitalPaidVerified = dataVerified['capital.paid'] && ((_b = capital === null || capital === void 0 ? void 0 : capital.paid) === null || _b === void 0 ? void 0 : _b.toString()) === removeAllCharsFromNumber(watch('capitalPaid'));
68
+ var isCapitalShareCountVerified = dataVerified['capital.shares.count'] && ((_d = (_c = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _c === void 0 ? void 0 : _c.count) === null || _d === void 0 ? void 0 : _d.toString()) === ((_e = watch('capitalShareCount')) === null || _e === void 0 ? void 0 : _e.toString());
69
+ var isCapitalShareValueVerified = dataVerified['capital.shares.value'] && ((_g = (_f = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.toString()) === removeAllCharsFromNumber(watch('capitalShareValue'));
93
70
  var onSubmit = function (data) {
94
- var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
95
- dispatch(updateEntityCapital(formData));
71
+ dispatch(updateEntityCapital(deepCopy(getFelids(data))));
96
72
  };
97
73
  var onBack = function () {
98
74
  dispatch(handlePrevScreenStep());
@@ -15,9 +15,9 @@ import { FormProvider, useForm } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
- import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
18
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
- import { convertToEnglishDateFormat, deepCopy, getFileDetailsFromDocument, isKW, isSA, sendCustomEventToGTM } from '../../../../utils';
20
+ import { convertToEnglishDateFormat, deepCopy, getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
21
21
  import { BusinessType, DocumentPurpose } from '../../../../@types';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
@@ -38,22 +38,22 @@ var FormStyled = styled(Form)(function () { return ({
38
38
  flexDirection: 'column'
39
39
  }); });
40
40
  var EntityName = function (_a) {
41
- var _b, _c;
42
- var _d = React.useState(false), issueAnchorEl = _d[0], setIssueAnchorEl = _d[1];
43
- var _e = React.useState(false), expiryAnchorEl = _e[0], setExpiryAnchorEl = _e[1];
44
- var _f = React.useState(false), entityTypeAnchorEl = _f[0], setEntityTypeAnchorEl = _f[1];
45
- var _g = useAppSelector(entitySelector), data = _g.data, loading = _g.loading, error = _g.error, uploading = _g.uploading, uploadingArticle = _g.uploadingArticle;
41
+ var _b;
42
+ var _c = React.useState(false), issueAnchorEl = _c[0], setIssueAnchorEl = _c[1];
43
+ var _d = React.useState(false), expiryAnchorEl = _d[0], setExpiryAnchorEl = _d[1];
44
+ var _e = React.useState(false), entityTypeAnchorEl = _e[0], setEntityTypeAnchorEl = _e[1];
45
+ var _f = useAppSelector(entitySelector), data = _f.data, loading = _f.loading, error = _f.error, uploading = _f.uploading, uploadingArticle = _f.uploadingArticle;
46
46
  var settingsData = useAppSelector(settingsSelector).data;
47
47
  var isAr = useLanguage().isAr;
48
48
  var t = useTranslation().t;
49
49
  var dispatch = useAppDispatch();
50
- var _h = data.entityNameData, legalName = _h.legalName, licenseNumber = _h.licenseNumber, licenseType = _h.licenseType, entityType = _h.entityType, issuingDate = _h.issuingDate, expiryDate = _h.expiryDate, unifiedNumber = _h.unifiedNumber, certificateId = _h.certificateId, articleId = _h.articleId;
50
+ var _g = data.entityNameData, legalName = _g.legalName, licenseNumber = _g.licenseNumber, licenseType = _g.licenseType, entityType = _g.entityType, issuingDate = _g.issuingDate, expiryDate = _g.expiryDate, unifiedNumber = _g.unifiedNumber, certificateId = _g.certificateId, articleId = _g.articleId;
51
51
  var country_code = settingsData.businessCountry.iso2;
52
52
  var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
53
53
  var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
54
54
  var isCR = licenseType === BusinessType.CR;
55
- var _j = data.verify.responseBody || {}, entity = _j.entity, flows = _j.flows, entityTypes = _j.entityTypes;
56
- var _k = entity || {}, AOA_file = _k.AOA_file, id = _k.id, documents = _k.documents, data_status = _k.data_status, data_verification = _k.data_verification, legal_name = _k.legal_name, type = _k.type, license = _k.license;
55
+ var _h = data.verify.responseBody || {}, entity = _h.entity, flows = _h.flows;
56
+ var _j = entity || {}, AOA_file = _j.AOA_file, id = _j.id, documents = _j.documents, data_status = _j.data_status, data_verification = _j.data_verification, legal_name = _j.legal_name, type = _j.type, license = _j.license;
57
57
  var getSchema = function () {
58
58
  if (isSACountry)
59
59
  return EntityNameValidationSchema();
@@ -80,18 +80,6 @@ var EntityName = function (_a) {
80
80
  useSetFromDefaultValues(methods, data.entityNameData, true);
81
81
  var defaultCertificateFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CR); }, [documents]);
82
82
  var defaultArticleFile = React.useMemo(function () { return AOA_file && __assign(__assign({}, AOA_file), { docId: id }); }, [AOA_file]);
83
- var issueDateRes = (license === null || license === void 0 ? void 0 : license.issuing_date) && convertToEnglishDateFormat(new Date(license.issuing_date));
84
- var expDateRes = (license === null || license === void 0 ? void 0 : license.expiry_date) && convertToEnglishDateFormat(new Date(license.expiry_date));
85
- var isDirty = useFormDirtyCheck(methods, {
86
- legalName: (legal_name === null || legal_name === void 0 ? void 0 : legal_name.en) || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar),
87
- licenseNumber: license === null || license === void 0 ? void 0 : license.number,
88
- licenseType: (license === null || license === void 0 ? void 0 : license.type) === 'freelance' ? BusinessType.FL : BusinessType.CR,
89
- entityType: type || (entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes[0]),
90
- issuingDate: issueDateRes,
91
- expiryDate: expDateRes,
92
- unifiedNumber: (_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number,
93
- articleId: defaultArticleFile === null || defaultArticleFile === void 0 ? void 0 : defaultArticleFile.id
94
- }).isDirty;
95
83
  var originalReadOnly = useFormReadOnly(methods, { certificateId: defaultCertificateFiles, articleId: defaultArticleFile });
96
84
  var noneEditable = useDataNoneEditable(data_status, [
97
85
  'legal_name.en',
@@ -116,16 +104,17 @@ var EntityName = function (_a) {
116
104
  'license.expiry_date',
117
105
  'AOA_file_id'
118
106
  ]);
107
+ var issueDateRes = (license === null || license === void 0 ? void 0 : license.issuing_date) && convertToEnglishDateFormat(new Date(license.issuing_date));
108
+ var expDateRes = (license === null || license === void 0 ? void 0 : license.expiry_date) && convertToEnglishDateFormat(new Date(license.expiry_date));
119
109
  var isLegalNameVerified = dataVerified['legal_name.en'] && dataVerified['legal_name.ar'] && ((legal_name === null || legal_name === void 0 ? void 0 : legal_name.en) === watch('legalName') || (legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar) === watch('legalName'));
120
110
  var isEntityTypeVerified = dataVerified['type'] && type === watch('entityType');
121
111
  var isLicenseNumberVerified = dataVerified['license.number'] && (license === null || license === void 0 ? void 0 : license.number) === watch('licenseNumber');
122
- var isUnifiedNumberVerified = dataVerified['license.additional_info'] && ((_c = license === null || license === void 0 ? void 0 : license.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) === watch('unifiedNumber');
112
+ var isUnifiedNumberVerified = dataVerified['license.additional_info'] && ((_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) === watch('unifiedNumber');
123
113
  var isIssuingDateVerified = dataVerified['license.issuing_date'] && issueDateRes === watch('issuingDate');
124
114
  var isExpiryDateVerified = dataVerified['license.expiry_date'] && expDateRes === watch('expiryDate');
125
115
  var isArticleIdVerified = dataVerified['AOA_file_id'];
126
116
  var onSubmit = function (data) {
127
- var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
128
- dispatch(updateEntityName(formData));
117
+ dispatch(updateEntityName(deepCopy(getFelids(data))));
129
118
  };
130
119
  var handleIssueDateOpenClose = function (flag) {
131
120
  setIssueAnchorEl(flag);
@@ -137,12 +126,6 @@ var EntityName = function (_a) {
137
126
  setEntityTypeAnchorEl(flag);
138
127
  };
139
128
  var onBack = function () {
140
- sendCustomEventToGTM({
141
- event: 'Send Event',
142
- event_category: 'Board Flows - Entity',
143
- event_action: 'Entity Details Back button',
144
- event_label: settingsData.businessCountry.iso2
145
- });
146
129
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
147
130
  dispatch(handlePrevScreenStep());
148
131
  return;