@tap-payments/auth-jsconnect 2.8.45-test → 2.8.49-development

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 (37) hide show
  1. package/build/@types/app.d.ts +1 -0
  2. package/build/features/app/bank/bankStore.js +13 -6
  3. package/build/features/app/brand/brandStore.js +97 -69
  4. package/build/features/app/business/businessStore.js +7 -1
  5. package/build/features/app/connectExpress/connectExpressStore.js +8 -1
  6. package/build/features/app/entity/entityStore.d.ts +5 -1
  7. package/build/features/app/entity/entityStore.js +62 -43
  8. package/build/features/app/individual/individualStore.d.ts +1 -1
  9. package/build/features/app/individual/individualStore.js +27 -18
  10. package/build/features/app/tax/taxStore.js +1 -0
  11. package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +13 -1
  12. package/build/features/auth/screens/BusinessCountry/BusinessCountry.js +7 -1
  13. package/build/features/bank/screens/BankDetails/BankDetails.js +7 -2
  14. package/build/features/brand/screens/BrandActivities/BrandActivities.js +48 -11
  15. package/build/features/brand/screens/BrandInfo/BrandInfo.js +22 -4
  16. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +22 -6
  17. package/build/features/business/screens/Activities/Activities.js +11 -2
  18. package/build/features/business/screens/BusinessType/BusinessType.js +9 -1
  19. package/build/features/business/screens/Customers/Customers.js +11 -2
  20. package/build/features/business/screens/IDBOD/IDBOD.js +9 -1
  21. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -1
  22. package/build/features/business/screens/Verify/Verify.js +12 -2
  23. package/build/features/connect/Connect.js +3 -2
  24. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +7 -1
  25. package/build/features/connect/screens/Mobile/Mobile.js +10 -7
  26. package/build/features/connectExpress/ConnectExpress.js +2 -1
  27. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +7 -1
  28. package/build/features/connectExpress/screens/Mobile/Mobile.js +8 -1
  29. package/build/features/entity/screens/EntityCapital/EntityCapital.js +33 -9
  30. package/build/features/entity/screens/EntityName/EntityName.js +31 -14
  31. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +43 -10
  32. package/build/features/individual/screens/IndividualList/IndividualList.js +7 -0
  33. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +73 -18
  34. package/build/features/shared/Button/FlowsButtons.js +10 -1
  35. package/build/hooks/useFormDirtyCheck.d.ts +5 -1
  36. package/build/hooks/useFormDirtyCheck.js +47 -10
  37. package/package.json +2 -2
@@ -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 } from '../../../../hooks';
18
- import { handlePrevScreenStep } from '../../../../app/settings';
17
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
18
+ import { handlePrevScreenStep, settingsSelector } 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 } from '../../../../utils';
22
+ import { deepCopy, sendCustomEventToGTM } 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,9 +46,10 @@ 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;
49
50
  var _m = data.brandSegmentData, segmentLocation = _m.segmentLocation, segmentProfit = _m.segmentProfit, segmentTech = _m.segmentTech, teamSize = _m.teamSize;
50
- var brand = (data.verify.responseBody || {}).brand;
51
- var _o = brand || {}, data_status = _o.data_status, data_verification = _o.data_verification, resSegment = _o.segment;
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;
52
53
  var methods = useForm({
53
54
  resolver: yupResolver(BrandValidationSchema()),
54
55
  defaultValues: {
@@ -61,6 +62,12 @@ var BrandInfo = function (_a) {
61
62
  });
62
63
  var watch = methods.watch;
63
64
  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;
64
71
  var originalReadOnly = useFormReadOnly(methods);
65
72
  var noneEditable = useDataNoneEditable(data_status, [
66
73
  'segment.location_type',
@@ -81,11 +88,20 @@ var BrandInfo = function (_a) {
81
88
  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);
82
89
  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);
83
90
  var onSubmit = function (data) {
84
- dispatch(updateSegmentBrand(deepCopy(getFelids(data))));
91
+ var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
92
+ dispatch(updateSegmentBrand(formData));
85
93
  };
86
94
  var onBack = function () {
87
95
  dispatch(handlePrevScreenStep());
88
96
  };
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
+ }, []);
89
105
  React.useEffect(function () {
90
106
  if (error)
91
107
  dispatch(clearError());
@@ -18,9 +18,9 @@ import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, u
18
18
  import Form from '../../../../components/Form';
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import { useTranslation } from 'react-i18next';
21
- import { handlePrevScreenStep } from '../../../../app/settings';
21
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
22
22
  import Button from '../../../shared/Button';
23
- import { deepCopy } from '../../../../utils';
23
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
25
25
  import Collapse from '../../../../components/Collapse';
26
26
  import OperationStartDate from './OperationStartDate';
@@ -36,6 +36,7 @@ var Activities = function () {
36
36
  var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
37
37
  var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
38
38
  var dispatch = useAppDispatch();
39
+ var settingsData = useAppSelector(settingsSelector).data;
39
40
  var isAr = useLanguage().isAr;
40
41
  var t = useTranslation().t;
41
42
  var _d = useAppSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
@@ -64,6 +65,14 @@ var Activities = function () {
64
65
  var onBack = function () {
65
66
  dispatch(handlePrevScreenStep());
66
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
+ }, []);
67
76
  React.useEffect(function () {
68
77
  if (error)
69
78
  dispatch(clearError());
@@ -23,7 +23,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
23
  import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
24
24
  import { BusinessType as Type } from '../../../../@types';
25
25
  import Button from '../../../shared/Button';
26
- import { deepCopy, isKW, isOtherLicense, isOtherThanKWOrSA, isSA } from '../../../../utils';
26
+ import { deepCopy, isKW, isOtherLicense, isOtherThanKWOrSA, isSA, sendCustomEventToGTM } from '../../../../utils';
27
27
  import { KWLicenseValidationSchema, LicenseValidationSchema, OtherCountryLicenseValidationSchema } from './validation';
28
28
  import LicenseList from './LicenseList';
29
29
  import LicenseCertificate from './LicenseCertificate';
@@ -46,6 +46,14 @@ var BusinessType = function (_a) {
46
46
  var isAr = useLanguage().isAr;
47
47
  var dispatch = useAppDispatch();
48
48
  var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
49
+ React.useEffect(function () {
50
+ sendCustomEventToGTM({
51
+ event: 'Send Event',
52
+ event_category: 'Account Creation Flow',
53
+ event_action: 'CR Page',
54
+ event_label: settingsData.businessCountry.iso2
55
+ });
56
+ }, []);
49
57
  var handleMenuClick = function (flag) {
50
58
  setListActive(flag);
51
59
  };
@@ -17,7 +17,7 @@ import { useTranslation } from 'react-i18next';
17
17
  import { useForm, FormProvider } from 'react-hook-form';
18
18
  import { yupResolver } from '@hookform/resolvers/yup';
19
19
  import { useAppDispatch, useAppSelector, useDataNoneEditable, useDataVerified, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
20
- import { handlePrevScreenStep } from '../../../../app/settings';
20
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { CustomerInfoValidation } from './validation';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button from '../../../shared/Button';
@@ -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 } from '../../../../utils';
33
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
34
34
  var FormStyled = styled(Form)(function () { return ({
35
35
  display: 'flex',
36
36
  flexDirection: 'column'
@@ -45,6 +45,7 @@ var Customers = function (_a) {
45
45
  var _b, _c, _d, _e, _f;
46
46
  var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
47
47
  var dispatch = useAppDispatch();
48
+ var settingsData = useAppSelector(settingsSelector).data;
48
49
  var _h = useAppSelector(businessSelector), data = _h.data, loading = _h.loading, error = _h.error;
49
50
  var _j = data.customersData, customerLocations = _j.customerLocations, expectedCustomer = _j.expectedCustomer, expectedSale = _j.expectedSale, refundPolicy = _j.refundPolicy, transactionPolicy = _j.transactionPolicy;
50
51
  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, terms = _k.terms;
@@ -75,6 +76,14 @@ var Customers = function (_a) {
75
76
  'operations.sales_range'
76
77
  ]);
77
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
+ }, []);
78
87
  React.useEffect(function () {
79
88
  var _a, _b;
80
89
  var isTermsAgreed = !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
@@ -22,7 +22,7 @@ import Button from '../../../shared/Button';
22
22
  import { ScreenContainer } from '../../../shared/Containers';
23
23
  import { businessSelector, clearError, updateLeadIdentity } from '../../../app/business/businessStore';
24
24
  import Collapse from '../../../../components/Collapse';
25
- import { deepCopy, isOtherThanKWOrSA } from '../../../../utils';
25
+ import { deepCopy, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
26
26
  import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
27
27
  import ID from './ID';
28
28
  import DOB from './DOB';
@@ -44,6 +44,14 @@ var IDBOD = function (_a) {
44
44
  mode: 'onChange'
45
45
  });
46
46
  useSetFromDefaultValues(methods, data.nidData);
47
+ React.useEffect(function () {
48
+ sendCustomEventToGTM({
49
+ event: 'Send Event',
50
+ event_category: 'Account Creation Flow',
51
+ event_action: 'ID Details Step',
52
+ event_label: settingsData.businessCountry.iso2
53
+ });
54
+ }, []);
47
55
  React.useEffect(function () {
48
56
  if (error)
49
57
  dispatch(clearError());
@@ -10,13 +10,24 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { memo } from 'react';
13
+ import React, { memo } from 'react';
14
14
  import { useAppSelector } from '../../../../hooks';
15
15
  import { businessSelector } from '../../../app/business/businessStore';
16
16
  import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
17
+ import { sendCustomEventToGTM } from '../../../../utils';
18
+ import { settingsSelector } from '../../../../app/settings';
17
19
  var SuccessWithFlowButtons = function () {
18
20
  var data = useAppSelector(businessSelector).data;
21
+ var settingsData = useAppSelector(settingsSelector).data;
19
22
  var _a = data.verify.responseBody || {}, flows = _a.flows, entity = _a.entity, brand = _a.brand, bank = _a.bank_account, merchant = _a.merchant, user = _a.user, business = _a.business, board_id = _a.board_id, board_info_id = _a.board_info_id, name = _a.name, individuals = _a.individuals, recipient = _a.recipient;
23
+ React.useEffect(function () {
24
+ sendCustomEventToGTM({
25
+ event: 'Send Event',
26
+ event_category: 'Account Creation Flow',
27
+ event_action: 'Board Page View',
28
+ event_label: settingsData.businessCountry.iso2
29
+ });
30
+ }, []);
20
31
  return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, individuals: individuals, boardInfoId: board_info_id, flows: flows || [], recipient: recipient }));
21
32
  };
22
33
  export default memo(SuccessWithFlowButtons);
@@ -17,9 +17,9 @@ import { useForm, FormProvider } from 'react-hook-form';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import Box from '@mui/material/Box/Box';
19
19
  import { styled } from '@mui/material/styles';
20
- import { handlePrevScreenStep } from '../../../../app/settings';
20
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { useLanguage } from '../../../../hooks';
22
- import { deepCopy, maskPhone } from '../../../../utils';
22
+ import { deepCopy, maskPhone, sendCustomEventToGTM } from '../../../../utils';
23
23
  import Form from '../../../../components/Form';
24
24
  import Text from '../../../../components/Text';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
@@ -49,6 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
49
49
  var VerifyNumber = function (_a) {
50
50
  var _b, _c;
51
51
  var dispatch = useAppDispatch();
52
+ var settingsData = useAppSelector(settingsSelector).data;
52
53
  var _d = useAppSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
53
54
  var methods = useForm({
54
55
  resolver: yupResolver(OTPValidation),
@@ -59,6 +60,15 @@ var VerifyNumber = function (_a) {
59
60
  var isAr = useLanguage().isAr;
60
61
  var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
61
62
  var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
63
+ React.useEffect(function () {
64
+ var _a;
65
+ sendCustomEventToGTM({
66
+ event: 'Send Event',
67
+ event_category: 'Account Creation Flow',
68
+ event_action: 'Business OTP Step',
69
+ event_label: (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2
70
+ });
71
+ }, []);
62
72
  React.useEffect(function () {
63
73
  if (error && methods.formState.isValid && phone)
64
74
  dispatch(clearError());
@@ -120,14 +120,15 @@ var Connect = memo(function (props) {
120
120
  event: 'Send Event',
121
121
  event_category: 'User Registration Flow',
122
122
  event_action: 'Registration Landing Page Viewed',
123
- event_value: (_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2
123
+ event_label: (_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2
124
124
  });
125
125
  sendCustomDimension({
126
126
  event: 'PageView',
127
127
  website_country: (_c = data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2
128
128
  });
129
129
  sendPageView({
130
- title: 'Connect'
130
+ title: 'Connect',
131
+ connect_flow: 'Normal'
131
132
  });
132
133
  }
133
134
  }, [data.businessCountry]);
@@ -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, updateLocationUrlWithCountry } from '../../../../utils';
55
+ import { findCountryByIso2, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, 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,6 +81,12 @@ 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
+ });
84
90
  if (settingsData.appConfig.mode !== 'popup')
85
91
  updateLocationUrlWithCountry(iso2);
86
92
  if (!data.leadId) return [3, 2];
@@ -74,12 +74,12 @@ var ListType;
74
74
  ListType["CountryCodeList"] = "CountryCodeList";
75
75
  })(ListType || (ListType = {}));
76
76
  var Mobile = function (_a) {
77
- var _b, _c;
77
+ var _b;
78
78
  var settingsStore = useAppSelector(settingsSelector);
79
- var _d = useAppSelector(connectSelector), data = _d.data, loading = _d.loading, error = _d.error;
80
- var _e = React.useState(), listType = _e[0], setListType = _e[1];
79
+ var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
80
+ var _d = React.useState(), listType = _d[0], setListType = _d[1];
81
81
  var dispatch = useAppDispatch();
82
- var _f = data.mobileData, mobile = _f.mobile, countryCode = _f.countryCode, termAndConditionChecked = _f.termAndConditionChecked;
82
+ var _e = data.mobileData, mobile = _e.mobile, countryCode = _e.countryCode, termAndConditionChecked = _e.termAndConditionChecked;
83
83
  var methods = useForm({
84
84
  resolver: yupResolver(PhoneValidationSchema),
85
85
  defaultValues: {
@@ -92,6 +92,7 @@ var Mobile = function (_a) {
92
92
  useSetFromDefaultValues(methods, data.mobileData);
93
93
  var t = useTranslation().t;
94
94
  var isAr = useLanguage().isAr;
95
+ var country = (_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
95
96
  var handleMenuListClick = function (flag) {
96
97
  setListType(flag);
97
98
  };
@@ -107,13 +108,15 @@ var Mobile = function (_a) {
107
108
  dispatch(resetNIDScreen());
108
109
  dispatch(resetCivilScreen());
109
110
  };
110
- var isKWCountry = React.useMemo(function () { var _a; return isKW((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2]);
111
- var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_c = settingsStore.data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2]);
111
+ var isKWCountry = React.useMemo(function () { return isKW(country); }, [country]);
112
+ var isOtherThanKWOrSACountry = React.useMemo(function () { return isOtherThanKWOrSA(country); }, [country]);
112
113
  var onBack = function () {
114
+ var eventAction = isKWCountry ? 'PACI Click' : 'Abser Click';
113
115
  sendCustomEventToGTM({
114
116
  event: 'Send Event',
115
117
  event_category: 'User Registration Flow',
116
- event_action: 'Switch to ID Login Clicked'
118
+ event_action: eventAction,
119
+ event_label: country
117
120
  });
118
121
  dispatch(handlePrevScreenStep(isKWCountry ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP'));
119
122
  };
@@ -94,7 +94,8 @@ var ConnectExpress = memo(function (_a) {
94
94
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant;
95
95
  React.useEffect(function () {
96
96
  sendPageView({
97
- title: 'Connect Express'
97
+ title: 'Connect Express',
98
+ connect_flow: 'Express'
98
99
  });
99
100
  }, []);
100
101
  React.useEffect(function () {
@@ -53,7 +53,7 @@ import { ScreenContainer } from '../../../shared/Containers';
53
53
  import BusinessCountry from '../../../shared/BusinessCountry';
54
54
  import Button from '../../../shared/Button';
55
55
  import Collapse from '../../../../components/Collapse';
56
- import { findCountryByIso2, isKW, isOtherThanKWOrSA } from '../../../../utils';
56
+ import { findCountryByIso2, isKW, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
57
57
  import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
58
58
  import { clearError, connectExpressSelector, setDefaultCountryCode, storeIsStartFromBusinessCountry, updateBusinessCountryAsync } from '../../../app/connectExpress/connectExpressStore';
59
59
  var BusinessCountryScreen = function (_a) {
@@ -81,6 +81,12 @@ 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
+ });
84
90
  if (!data.leadId) return [3, 2];
85
91
  return [4, dispatch(updateBusinessCountryAsync(iso2))];
86
92
  case 1:
@@ -30,7 +30,7 @@ import MobileNumber from './MobileNumber';
30
30
  import { PhoneValidationSchema } from './validation';
31
31
  import { ICONS_NAMES } from '../../../../constants';
32
32
  import TAC from './TAC';
33
- import { deepCopy } from '../../../../utils';
33
+ import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
34
34
  var FormStyled = styled(Form)(function () { return ({
35
35
  display: 'flex',
36
36
  flexDirection: 'column'
@@ -96,6 +96,13 @@ var Mobile = function (_a) {
96
96
  };
97
97
  var onBack = function () {
98
98
  var screen = isKuwait ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP';
99
+ var eventAction = isKuwait ? 'PACI Click' : 'Abser Click';
100
+ sendCustomEventToGTM({
101
+ event: 'Send Event',
102
+ event_category: 'User Registration Flow',
103
+ event_action: eventAction,
104
+ event_label: settingData.businessCountry.iso2
105
+ });
99
106
  dispatch(handlePrevScreenStep(screen));
100
107
  };
101
108
  var onBackToCountryList = 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 } from '../../../../hooks';
19
- import { deepCopy, removeAllCharsFromNumber } from '../../../../utils';
18
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
19
+ import { deepCopy, formatNumberAsCurrency, removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
20
20
  import { clearError, entitySelector, updateEntityCapital } from '../../../app/entity/entityStore';
21
21
  import { yupResolver } from '@hookform/resolvers/yup';
22
- import { handlePrevScreenStep } from '../../../../app/settings';
22
+ import { handlePrevScreenStep, settingsSelector } 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,21 +39,36 @@ 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;
42
43
  var _k = data.entityCapitalData, responseBody = _k.responseBody, capitalPaid = _k.capitalPaid, capitalShareCount = _k.capitalShareCount, capitalShareValue = _k.capitalShareValue, activities = _k.activities;
43
44
  var entity = (data.verify.responseBody || {}).entity;
44
- var _l = entity || {}, data_verification = _l.data_verification, capital = _l.capital;
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();
45
49
  var methods = useForm({
46
50
  resolver: yupResolver(EntityCapitalValidationSchema()),
47
51
  defaultValues: {
48
52
  activities: activities,
49
53
  capitalPaid: capitalPaid,
50
- capitalShareCount: capitalShareCount,
54
+ capitalShareCount: capitalShareCount === null || capitalShareCount === void 0 ? void 0 : capitalShareCount.toString(),
51
55
  capitalShareValue: capitalShareValue
52
56
  },
53
57
  mode: 'onChange'
54
58
  });
55
59
  useSetFromDefaultValues(methods, data.entityCapitalData, true);
56
60
  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;
57
72
  var originalReadOnly = useFormReadOnly(methods);
58
73
  var noneEditable = useDataNoneEditable(entity === null || entity === void 0 ? void 0 : entity.data_status, [
59
74
  'activities',
@@ -64,11 +79,20 @@ var EntityCapital = function (_a) {
64
79
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
65
80
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
66
81
  var dataVerified = useDataVerified(data_verification, ['capital.paid', 'capital.shares.count', 'capital.shares.value']);
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'));
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
+ }, []);
70
93
  var onSubmit = function (data) {
71
- dispatch(updateEntityCapital(deepCopy(getFelids(data))));
94
+ var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
95
+ dispatch(updateEntityCapital(formData));
72
96
  };
73
97
  var onBack = function () {
74
98
  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 } from '../../../../hooks';
18
+ import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
- import { convertToEnglishDateFormat, deepCopy, getFileDetailsFromDocument, isKW, isSA } from '../../../../utils';
20
+ import { convertToEnglishDateFormat, deepCopy, getFileDetailsFromDocument, isKW, isSA, sendCustomEventToGTM } 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;
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;
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;
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 _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;
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;
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 _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;
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;
57
57
  var getSchema = function () {
58
58
  if (isSACountry)
59
59
  return EntityNameValidationSchema();
@@ -80,6 +80,18 @@ 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;
83
95
  var originalReadOnly = useFormReadOnly(methods, { certificateId: defaultCertificateFiles, articleId: defaultArticleFile });
84
96
  var noneEditable = useDataNoneEditable(data_status, [
85
97
  'legal_name.en',
@@ -104,17 +116,16 @@ var EntityName = function (_a) {
104
116
  'license.expiry_date',
105
117
  'AOA_file_id'
106
118
  ]);
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));
109
119
  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'));
110
120
  var isEntityTypeVerified = dataVerified['type'] && type === watch('entityType');
111
121
  var isLicenseNumberVerified = dataVerified['license.number'] && (license === null || license === void 0 ? void 0 : license.number) === watch('licenseNumber');
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');
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');
113
123
  var isIssuingDateVerified = dataVerified['license.issuing_date'] && issueDateRes === watch('issuingDate');
114
124
  var isExpiryDateVerified = dataVerified['license.expiry_date'] && expDateRes === watch('expiryDate');
115
125
  var isArticleIdVerified = dataVerified['AOA_file_id'];
116
126
  var onSubmit = function (data) {
117
- dispatch(updateEntityName(deepCopy(getFelids(data))));
127
+ var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
128
+ dispatch(updateEntityName(formData));
118
129
  };
119
130
  var handleIssueDateOpenClose = function (flag) {
120
131
  setIssueAnchorEl(flag);
@@ -126,6 +137,12 @@ var EntityName = function (_a) {
126
137
  setEntityTypeAnchorEl(flag);
127
138
  };
128
139
  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
+ });
129
146
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
130
147
  dispatch(handlePrevScreenStep());
131
148
  return;