@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
@@ -17,9 +17,9 @@ import { useTranslation } from 'react-i18next';
17
17
  import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
18
18
  import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
- import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
20
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
21
21
  import { DocumentPurpose, IndividualType } from '../../../../@types';
22
- import { deepCopy, getIndividualType, isKW, isKWOrSA } from '../../../../utils';
22
+ import { deepCopy, getIndividualType, isKW, isKWOrSA, sendCustomEventToGTM } from '../../../../utils';
23
23
  import Form from '../../../../components/Form';
24
24
  import Collapse from '../../../../components/Collapse';
25
25
  import Text from '../../../../components/Text';
@@ -53,16 +53,16 @@ var ListType;
53
53
  ListType["OccupationList"] = "OccupationList";
54
54
  })(ListType || (ListType = {}));
55
55
  var AdditionalIndividualInfo = function (_a) {
56
- var _b;
56
+ var _b, _c, _d, _e;
57
57
  var t = useTranslation().t;
58
58
  var isAr = useLanguage().isAr;
59
59
  var dispatch = useAppDispatch();
60
- var _c = useAppSelector(individualSelector), data = _c.data, loading = _c.loading, error = _c.error;
60
+ var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, error = _f.error;
61
61
  var settingsData = useAppSelector(settingsSelector).data;
62
62
  var verify = data.verify;
63
63
  var user = (verify.responseBody || {}).user;
64
- var _d = data.individualData, occupation = _d.occupation, sourceIncome = _d.sourceIncome, monthlyIncome = _d.monthlyIncome, employerName = _d.employerName, isPEP = _d.isPEP, isInfluencer = _d.isInfluencer, civilID = _d.civilID, signatureFileId = _d.signatureFileId, civilIDUploading = _d.civilIDUploading, signatureFileUploading = _d.signatureFileUploading, shareCount = _d.shareCount, shareValue = _d.shareValue, isAuthorized = _d.isAuthorized;
65
- var _e = user || {}, documents = _e.documents, is_authorized = _e.is_authorized, data_status = _e.data_status, data_verification = _e.data_verification, names = _e.names, role = _e.role, occupationRes = _e.occupation, is_relative_PEP = _e.is_relative_PEP, is_influencer = _e.is_influencer, objects = _e.objects;
64
+ var _g = data.individualData, occupation = _g.occupation, sourceIncome = _g.sourceIncome, monthlyIncome = _g.monthlyIncome, employerName = _g.employerName, isPEP = _g.isPEP, isInfluencer = _g.isInfluencer, civilID = _g.civilID, signatureFileId = _g.signatureFileId, civilIDUploading = _g.civilIDUploading, signatureFileUploading = _g.signatureFileUploading, shareCount = _g.shareCount, shareValue = _g.shareValue, isAuthorized = _g.isAuthorized;
65
+ var _h = user || {}, documents = _h.documents, is_authorized = _h.is_authorized, data_status = _h.data_status, data_verification = _h.data_verification, names = _h.names, role = _h.role, occupationRes = _h.occupation, source_income = _h.source_income, monthly_income = _h.monthly_income, shares = _h.shares, is_relative_PEP = _h.is_relative_PEP, is_influencer = _h.is_influencer, objects = _h.objects;
66
66
  var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
67
67
  var isOtherThanKWAndSa = React.useMemo(function () { return !isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
68
68
  var showIsAuthorized = isOtherThanKWAndSa;
@@ -95,6 +95,30 @@ var AdditionalIndividualInfo = function (_a) {
95
95
  civilID: defaultCivilIdFiles,
96
96
  signatureFileId: defaultSignatureFiles
97
97
  });
98
+ var isDirty = useFormDirtyCheck(methods, {
99
+ occupation: ((_b = occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.chapter) === null || _b === void 0 ? void 0 : _b.id) && { id: occupationRes.chapter.id },
100
+ sourceIncome: source_income === null || source_income === void 0 ? void 0 : source_income[0],
101
+ monthlyIncome: monthly_income,
102
+ employerName: '',
103
+ isPEP: is_relative_PEP,
104
+ isInfluencer: is_influencer,
105
+ shareCount: (_c = shares === null || shares === void 0 ? void 0 : shares.count) === null || _c === void 0 ? void 0 : _c.toString(),
106
+ shareValue: (_d = shares === null || shares === void 0 ? void 0 : shares.value) === null || _d === void 0 ? void 0 : _d.toString(),
107
+ isAuthorized: is_authorized
108
+ }, [
109
+ {
110
+ name: 'occupation',
111
+ keys: ['id']
112
+ },
113
+ {
114
+ name: 'sourceIncome',
115
+ keys: ['id']
116
+ },
117
+ {
118
+ name: 'monthlyIncome',
119
+ keys: ['id']
120
+ }
121
+ ]).isDirty;
98
122
  var noneEditable = useDataNoneEditable(data_status, [
99
123
  'occupation',
100
124
  'source_of_income',
@@ -106,13 +130,22 @@ var AdditionalIndividualInfo = function (_a) {
106
130
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
107
131
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
108
132
  var dataVerified = useDataVerified(data_verification, ['occupation', 'is_relative_PEP', 'is_influencer']);
109
- var isOccupationVerified = dataVerified['occupation'] && (occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.id) === ((_b = watch('occupation')) === null || _b === void 0 ? void 0 : _b.id);
133
+ var isOccupationVerified = dataVerified['occupation'] && (occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.id) === ((_e = watch('occupation')) === null || _e === void 0 ? void 0 : _e.id);
110
134
  var isPEPSwitchVerified = dataVerified['is_relative_PEP'] && is_relative_PEP === watch('isPEP');
111
135
  var isInfluencerSwitchVerified = dataVerified['is_influencer'] && is_influencer === watch('isInfluencer');
112
136
  var isAuthorizedSwitchVerified = dataVerified['is_authorized'] && is_authorized === watch('isAuthorized');
113
- var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
137
+ var _j = React.useState(), listActive = _j[0], setListActive = _j[1];
138
+ React.useEffect(function () {
139
+ sendCustomEventToGTM({
140
+ event: 'Send Event',
141
+ event_category: 'Board Flows - Individual',
142
+ event_action: 'Income Details Page',
143
+ event_label: settingsData.businessCountry.iso2
144
+ });
145
+ }, []);
114
146
  var onSubmit = function (data) {
115
- dispatch(updateIndividualInfo(deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))));
147
+ var formData = __assign(__assign({}, deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))), { isDirty: isDirty });
148
+ dispatch(updateIndividualInfo(formData));
116
149
  };
117
150
  var onBack = function () {
118
151
  dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
@@ -137,7 +170,7 @@ var AdditionalIndividualInfo = function (_a) {
137
170
  return t('type_board_member');
138
171
  return t('type_user');
139
172
  };
140
- var _g = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _g.isUser, isShareholder = _g.isShareholder, isBoardMember = _g.isBoardMember, isBuyer = _g.isBuyer;
173
+ var _k = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _k.isUser, isShareholder = _k.isShareholder, isBoardMember = _k.isBoardMember, isBuyer = _k.isBuyer;
141
174
  var isUserORBuyerType = isUser || isBuyer;
142
175
  var isUserORBoardMemberType = isUser || isBoardMember;
143
176
  var isAuthorizedValue = watch('isAuthorized');
@@ -20,6 +20,7 @@ import Collapse from '../../../../components/Collapse';
20
20
  import Warning from '../../../../components/Warning';
21
21
  import Button from '../../../../components/Button';
22
22
  import Loader from '../../../../components/Loader';
23
+ import { sendCustomEventToGTM } from '../../../../utils';
23
24
  import { ScreenContainer } from '../../../shared/Containers';
24
25
  import { individualSelector, retrieveBoardStatus } from '../../../app/individual/individualStore';
25
26
  import UserList from './UserList';
@@ -54,6 +55,12 @@ var IndividualList = function () {
54
55
  var settingsData = useAppSelector(settingsSelector).data;
55
56
  var flows = (data.verify.responseBody || {}).flows;
56
57
  var onBack = function () {
58
+ sendCustomEventToGTM({
59
+ event: 'Send Event',
60
+ event_category: 'Board Flows - Individual',
61
+ event_action: 'Individual Details Back Button',
62
+ event_label: settingsData.businessCountry.iso2
63
+ });
57
64
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
58
65
  dispatch(handlePrevScreenStep());
59
66
  return;
@@ -17,8 +17,8 @@ import { useTranslation } from 'react-i18next';
17
17
  import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
18
18
  import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
- import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
21
- import { convertToEnglishDateFormat, deepCopy, getUserName, isKWOrSA, isOtherThanKWOrSA } from '../../../../utils';
20
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
21
+ import { convertToEnglishDateFormat, deepCopy, findCountryByIddPrefix, findCountryByIso2, getUserName, isKWOrSA, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
24
24
  import Text from '../../../../components/Text';
@@ -50,17 +50,17 @@ var ListType;
50
50
  ListType["NationalityList"] = "NationalityList";
51
51
  })(ListType || (ListType = {}));
52
52
  var IndividualPersonalInfo = function (_a) {
53
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
53
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
54
54
  var t = useTranslation().t;
55
55
  var isAr = useLanguage().isAr;
56
56
  var dispatch = useAppDispatch();
57
- var _l = useAppSelector(individualSelector), data = _l.data, loading = _l.loading, error = _l.error, cityLoading = _l.cityLoading;
57
+ var _p = useAppSelector(individualSelector), data = _p.data, loading = _p.loading, error = _p.error, cityLoading = _p.cityLoading;
58
58
  var settingsData = useAppSelector(settingsSelector).data;
59
59
  var countries = settingsData.countries;
60
60
  var verify = data.verify, individualPersonalData = data.individualPersonalData;
61
- var _m = verify.responseBody || {}, user = _m.user, flows = _m.flows;
61
+ var _q = verify.responseBody || {}, user = _q.user, flows = _q.flows;
62
62
  var name = individualPersonalData.name, email = individualPersonalData.email, mobile = individualPersonalData.mobile, countryCode = individualPersonalData.countryCode, gender = individualPersonalData.gender, nid = individualPersonalData.nid, issuedCountry = individualPersonalData.issuedCountry, expiryDate = individualPersonalData.expiryDate, dob = individualPersonalData.dob, placeOfBirthCountry = individualPersonalData.placeOfBirthCountry, placeOfBirthCity = individualPersonalData.placeOfBirthCity, nationality = individualPersonalData.nationality;
63
- var _o = user || {}, data_status = _o.data_status, is_authorized = _o.is_authorized, data_verification = _o.data_verification, contact = _o.contact, genderRes = _o.gender, identification = _o.identification, birth = _o.birth, nationalityRes = _o.nationality;
63
+ var _r = user || {}, data_status = _r.data_status, is_authorized = _r.is_authorized, data_verification = _r.data_verification, contact = _r.contact, genderRes = _r.gender, identification = _r.identification, birth = _r.birth, nationalityRes = _r.nationality;
64
64
  var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
65
65
  var methods = useForm({
66
66
  resolver: yupResolver(IndividualInfoValidationSchema(isOtherCountry)),
@@ -82,9 +82,51 @@ var IndividualPersonalInfo = function (_a) {
82
82
  });
83
83
  var watch = methods.watch;
84
84
  useSetFromDefaultValues(methods, data.individualPersonalData);
85
- var _p = React.useState(), listActive = _p[0], setListActive = _p[1];
86
- var _q = React.useState(false), dobActive = _q[0], setDobActive = _q[1];
87
- var _r = React.useState(false), expiryDateActive = _r[0], setExpiryDateActive = _r[1];
85
+ var _s = React.useState(), listActive = _s[0], setListActive = _s[1];
86
+ var _t = React.useState(false), dobActive = _t[0], setDobActive = _t[1];
87
+ var _u = React.useState(false), expiryDateActive = _u[0], setExpiryDateActive = _u[1];
88
+ var expDateRes = (identification === null || identification === void 0 ? void 0 : identification.expiry) && convertToEnglishDateFormat(new Date(identification === null || identification === void 0 ? void 0 : identification.expiry));
89
+ var dobDateRes = (birth === null || birth === void 0 ? void 0 : birth.date) && convertToEnglishDateFormat(new Date(birth === null || birth === void 0 ? void 0 : birth.date));
90
+ var resCountryCode = React.useMemo(function () {
91
+ var _a;
92
+ if (!((_a = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _a === void 0 ? void 0 : _a.country_code))
93
+ return {};
94
+ return findCountryByIddPrefix(countries, contact.phone.country_code) || {};
95
+ }, [(_b = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _b === void 0 ? void 0 : _b.country_code]);
96
+ var resIssuedCountry = React.useMemo(function () {
97
+ if (!(identification === null || identification === void 0 ? void 0 : identification.issued_country_code))
98
+ return;
99
+ return findCountryByIso2(countries, identification.issued_country_code);
100
+ }, [identification === null || identification === void 0 ? void 0 : identification.issued_country_code]);
101
+ var resPlaceOfBirthCountry = React.useMemo(function () {
102
+ if (!(birth === null || birth === void 0 ? void 0 : birth.country))
103
+ return;
104
+ return findCountryByIso2(countries, birth.country);
105
+ }, [birth === null || birth === void 0 ? void 0 : birth.country]);
106
+ var resNationality = React.useMemo(function () {
107
+ if (!nationalityRes)
108
+ return;
109
+ return findCountryByIso2(countries, nationalityRes);
110
+ }, [nationalityRes]);
111
+ var isDirty = useFormDirtyCheck(methods, {
112
+ name: getUserName(user, false),
113
+ email: contact === null || contact === void 0 ? void 0 : contact.email,
114
+ mobile: (_c = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _c === void 0 ? void 0 : _c.number,
115
+ countryCode: resCountryCode,
116
+ gender: genderRes === null || genderRes === void 0 ? void 0 : genderRes.toLowerCase(),
117
+ nid: identification === null || identification === void 0 ? void 0 : identification.id,
118
+ issuedCountry: resIssuedCountry,
119
+ expiryDate: expDateRes,
120
+ dob: dobDateRes,
121
+ placeOfBirthCountry: resPlaceOfBirthCountry,
122
+ placeOfBirthCity: ((_d = birth === null || birth === void 0 ? void 0 : birth.city) === null || _d === void 0 ? void 0 : _d.cityId) && { id: birth.city.cityId },
123
+ nationality: resNationality
124
+ }, [
125
+ {
126
+ name: 'placeOfBirthCity',
127
+ keys: ['id']
128
+ }
129
+ ]).isDirty;
88
130
  var originalReadOnly = useFormReadOnly(methods);
89
131
  var noneEditable = useDataNoneEditable(data_status, [
90
132
  'name.en',
@@ -120,30 +162,37 @@ var IndividualPersonalInfo = function (_a) {
120
162
  'nationality',
121
163
  'gender'
122
164
  ]);
123
- var expDateRes = (identification === null || identification === void 0 ? void 0 : identification.expiry) && convertToEnglishDateFormat(new Date(identification === null || identification === void 0 ? void 0 : identification.expiry));
124
- var dobDateRes = (birth === null || birth === void 0 ? void 0 : birth.date) && convertToEnglishDateFormat(new Date(birth === null || birth === void 0 ? void 0 : birth.date));
125
165
  var isNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && getUserName(user, isAr) === watch('name');
126
166
  var isPhoneNumberVerified = dataVerified['contact.phone.number'] &&
127
167
  dataVerified['contact.phone.country_code'] &&
128
- ((_b = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _b === void 0 ? void 0 : _b.number) === watch('mobile') &&
129
- ((_c = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _c === void 0 ? void 0 : _c.country_code) === ((_e = (_d = watch('countryCode')) === null || _d === void 0 ? void 0 : _d.idd_prefix) === null || _e === void 0 ? void 0 : _e.toString());
168
+ ((_e = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _e === void 0 ? void 0 : _e.number) === watch('mobile') &&
169
+ ((_f = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _f === void 0 ? void 0 : _f.country_code) === ((_h = (_g = watch('countryCode')) === null || _g === void 0 ? void 0 : _g.idd_prefix) === null || _h === void 0 ? void 0 : _h.toString());
130
170
  var isEmailVerified = dataVerified['contact.email'] && (contact === null || contact === void 0 ? void 0 : contact.email) === watch('email');
131
171
  var isGenderVerified = dataVerified['gender'] && genderRes === watch('gender');
132
172
  var isIDVerified = dataVerified['identification.id'] && (identification === null || identification === void 0 ? void 0 : identification.id) === watch('nid');
133
- var isIssuedCountryVerified = dataVerified['identification.issuer_country'] && (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) === ((_f = watch('issuedCountry')) === null || _f === void 0 ? void 0 : _f.iso2);
173
+ var isIssuedCountryVerified = dataVerified['identification.issuer_country'] && (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) === ((_j = watch('issuedCountry')) === null || _j === void 0 ? void 0 : _j.iso2);
134
174
  var isExpiryDateVerified = dataVerified['identification.expiry'] && expDateRes === watch('expiryDate');
135
175
  var isDOBVerified = dataVerified['birth.date'] && dobDateRes === watch('dob');
136
- var isBirthCountryVerified = dataVerified['birth.country'] && (birth === null || birth === void 0 ? void 0 : birth.country) === ((_g = watch('placeOfBirthCountry')) === null || _g === void 0 ? void 0 : _g.iso2);
137
- var isBirthCityVerified = dataVerified['birth.city'] && ((_h = birth === null || birth === void 0 ? void 0 : birth.city) === null || _h === void 0 ? void 0 : _h.cityId) === ((_j = watch('placeOfBirthCity')) === null || _j === void 0 ? void 0 : _j.id);
138
- var isNationalityVerified = dataVerified['nationality'] && nationalityRes === ((_k = watch('nationality')) === null || _k === void 0 ? void 0 : _k.iso2);
176
+ var isBirthCountryVerified = dataVerified['birth.country'] && (birth === null || birth === void 0 ? void 0 : birth.country) === ((_k = watch('placeOfBirthCountry')) === null || _k === void 0 ? void 0 : _k.iso2);
177
+ var isBirthCityVerified = dataVerified['birth.city'] && ((_l = birth === null || birth === void 0 ? void 0 : birth.city) === null || _l === void 0 ? void 0 : _l.cityId) === ((_m = watch('placeOfBirthCity')) === null || _m === void 0 ? void 0 : _m.id);
178
+ var isNationalityVerified = dataVerified['nationality'] && nationalityRes === ((_o = watch('nationality')) === null || _o === void 0 ? void 0 : _o.iso2);
139
179
  var isKWOrSaCountry = React.useMemo(function () { return isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
140
180
  var onSubmit = function (data) {
141
- dispatch(updateIndividualPersonalInfo(deepCopy(getFelids(data))));
181
+ var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
182
+ dispatch(updateIndividualPersonalInfo(formData));
142
183
  };
143
184
  React.useEffect(function () {
144
185
  if (error)
145
186
  dispatch(clearError());
146
187
  }, [methods.formState.isValid]);
188
+ React.useEffect(function () {
189
+ sendCustomEventToGTM({
190
+ event: 'Send Event',
191
+ event_category: 'Board Flows - Individual',
192
+ event_action: 'Update Personal Data Page',
193
+ event_label: settingsData.businessCountry.iso2
194
+ });
195
+ }, []);
147
196
  var onBack = function () {
148
197
  if (error)
149
198
  dispatch(clearError());
@@ -151,6 +200,12 @@ var IndividualPersonalInfo = function (_a) {
151
200
  dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
152
201
  return;
153
202
  }
203
+ sendCustomEventToGTM({
204
+ event: 'Send Event',
205
+ event_category: 'Board Flows - Individual',
206
+ event_action: 'Individual Details Back Button',
207
+ event_label: settingsData.businessCountry.iso2
208
+ });
154
209
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
155
210
  dispatch(handlePrevScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
156
211
  return;
@@ -48,6 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
49
  import { useState } from 'react';
50
50
  import { useTranslation } from 'react-i18next';
51
+ import { capitalize } from 'lodash-es';
51
52
  import Button from '../../../components/Button';
52
53
  import { Button as SharedButton } from '../../shared/Button';
53
54
  import { alpha, styled } from '@mui/material/styles';
@@ -57,7 +58,8 @@ import { ICONS_NAMES } from '../../../constants';
57
58
  import CheckIcon from '@mui/icons-material/Check';
58
59
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../hooks';
59
60
  import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep, settingsSelector } from '../../../app/settings';
60
- import { dangerousMessage, getScreenNameBasedOnFlow, isKWOrSA } from '../../../utils';
61
+ import { FlowsTypes } from '../../../@types';
62
+ import { dangerousMessage, getScreenNameBasedOnFlow, isKWOrSA, sendCustomEventToGTM } from '../../../utils';
61
63
  import API from '../../../api';
62
64
  import Text from '../../../components/Text';
63
65
  import Dot from '../Dot';
@@ -160,6 +162,13 @@ export default function FlowsButtons(_a) {
160
162
  var onRedirect = function (item) {
161
163
  if (!item.href)
162
164
  return;
165
+ var name = flowName === FlowsTypes.BANK ? 'Wallet' : capitalize(flowName);
166
+ sendCustomEventToGTM({
167
+ event: 'Send Event',
168
+ event_category: "Board Flows - ".concat(name),
169
+ event_action: "".concat(name, " Kit Click"),
170
+ event_label: settingsData.businessCountry.iso2
171
+ });
163
172
  if (flowName === item.name && !isResetPassword(item.name, item.status)) {
164
173
  var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
165
174
  dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
@@ -2,5 +2,9 @@ import { FieldValues, UseFormReturn } from 'react-hook-form';
2
2
  type UseFormWithDirtyCheck = {
3
3
  isDirty: boolean;
4
4
  };
5
- export declare const useFormDirtyCheck: <TFieldValues extends FieldValues>(method: UseFormReturn<TFieldValues, any, undefined>, backendData: TFieldValues) => UseFormWithDirtyCheck;
5
+ type CustomAttrProps = {
6
+ name: string;
7
+ keys: string[];
8
+ };
9
+ export declare const useFormDirtyCheck: <TFieldValues extends FieldValues>(method: UseFormReturn<TFieldValues, any, undefined>, backendData: TFieldValues, customAttrs?: CustomAttrProps[]) => UseFormWithDirtyCheck;
6
10
  export {};
@@ -1,28 +1,65 @@
1
1
  import React from 'react';
2
2
  import _ from 'lodash';
3
- export var useFormDirtyCheck = function (method, backendData) {
3
+ export var useFormDirtyCheck = function (method, backendData, customAttrs) {
4
4
  var _a = React.useState(false), isDirty = _a[0], setIsDirty = _a[1];
5
5
  var data = method.watch();
6
- var isValidData = function (data, backendData) {
7
- if (data === undefined)
6
+ var isValidData = function (formValue, backendValue) {
7
+ if (_.isUndefined(formValue))
8
8
  return false;
9
- if (Array.isArray(data) && !data.length)
9
+ if (_.isArray(formValue) && formValue.length === 0)
10
10
  return false;
11
- if (data === '' && !backendData)
11
+ if (_.isObject(formValue) && _.isEmpty(formValue))
12
+ return false;
13
+ if (formValue === '' && !backendValue)
12
14
  return false;
13
15
  return true;
14
16
  };
15
- var deepComparison = function (data, backendData) {
16
- for (var key in backendData) {
17
+ var isArray = function (data, backendData) {
18
+ return backendData && data && _.isArray(backendData) && _.isArray(data);
19
+ };
20
+ var isObject = function (data, backendData) {
21
+ return backendData && data && _.isObject(data) && _.isObject(backendData);
22
+ };
23
+ var mapArrayOfObjectWithKeys = function (items, keys) {
24
+ return _.map(items, function (item) { return _.pick(item, keys); });
25
+ };
26
+ var mapObjectWithKeys = function (item, keys) {
27
+ return _.pick(item, keys);
28
+ };
29
+ var deepComparison = function (data, backendData, customAttrs) {
30
+ var _loop_1 = function (key) {
17
31
  var formValue = data === null || data === void 0 ? void 0 : data[key];
18
32
  var backEndValue = backendData === null || backendData === void 0 ? void 0 : backendData[key];
19
- if (isValidData(formValue, backEndValue) && !_.isEqual(formValue, backEndValue))
20
- return true;
33
+ if (!isValidData(formValue, backEndValue))
34
+ return "continue";
35
+ var customAttr = customAttrs === null || customAttrs === void 0 ? void 0 : customAttrs.find(function (el) { return el.name === key; });
36
+ if (customAttr) {
37
+ var keys = customAttr.keys;
38
+ if (isArray(formValue, backEndValue)) {
39
+ formValue = mapArrayOfObjectWithKeys(formValue, keys);
40
+ backEndValue = mapArrayOfObjectWithKeys(backEndValue, keys);
41
+ if (formValue.length !== backEndValue.length)
42
+ return { value: true };
43
+ if (_.differenceWith(formValue, backEndValue, _.isEqual).length > 0)
44
+ return { value: true };
45
+ }
46
+ if (isObject(formValue, backEndValue)) {
47
+ formValue = mapObjectWithKeys(formValue, keys);
48
+ backEndValue = mapObjectWithKeys(backEndValue, keys);
49
+ }
50
+ }
51
+ if (!_.isEqual(formValue, backEndValue))
52
+ return { value: true };
53
+ };
54
+ for (var key in backendData) {
55
+ var state_1 = _loop_1(key);
56
+ if (typeof state_1 === "object")
57
+ return state_1.value;
21
58
  }
22
59
  return false;
23
60
  };
24
61
  React.useEffect(function () {
25
- var isDirty = deepComparison(data, backendData);
62
+ var isDirty = deepComparison(data, backendData, customAttrs);
26
63
  setIsDirty(isDirty);
27
64
  }, [data, backendData]);
28
65
  return { isDirty: isDirty };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.45-test",
3
+ "version": "2.8.49-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -21,7 +21,7 @@
21
21
  "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
22
  "tsc:alias": "tsc-alias -p tsconfig.json",
23
23
  "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public --tag test"
24
+ "push": "npm publish --access public --tag development"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {