@tap-payments/auth-jsconnect 2.8.63-sandbox → 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 (51) 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/constants/api.d.ts +1 -0
  6. package/build/constants/api.js +2 -0
  7. package/build/constants/app.d.ts +1 -0
  8. package/build/constants/app.js +1 -0
  9. package/build/features/app/bank/bankStore.d.ts +19 -13
  10. package/build/features/app/bank/bankStore.js +165 -183
  11. package/build/features/app/board/boardStore.js +10 -16
  12. package/build/features/app/brand/brandStore.d.ts +31 -16
  13. package/build/features/app/brand/brandStore.js +239 -243
  14. package/build/features/app/business/businessStore.js +1 -7
  15. package/build/features/app/entity/entityStore.d.ts +34 -20
  16. package/build/features/app/entity/entityStore.js +249 -204
  17. package/build/features/app/individual/individualStore.d.ts +36 -17
  18. package/build/features/app/individual/individualStore.js +270 -221
  19. package/build/features/app/password/passwordStore.d.ts +25 -19
  20. package/build/features/app/password/passwordStore.js +216 -170
  21. package/build/features/app/tax/taxStore.d.ts +7 -13
  22. package/build/features/app/tax/taxStore.js +147 -168
  23. package/build/features/auth/screens/AuthenticationList/LicenseNumber.js +2 -2
  24. package/build/features/bank/screens/BankDetails/BankDetails.js +4 -17
  25. package/build/features/brand/screens/BrandActivities/BrandActivities.js +11 -48
  26. package/build/features/brand/screens/BrandInfo/BrandInfo.js +4 -22
  27. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +6 -22
  28. package/build/features/business/screens/Activities/Activities.js +1 -9
  29. package/build/features/business/screens/BusinessType/LicenseNumber.js +2 -2
  30. package/build/features/business/screens/Customers/Customers.js +1 -9
  31. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +1 -7
  32. package/build/features/connectExpress/screens/AuthenticationList/LicenseNumber.js +2 -2
  33. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
  34. package/build/features/entity/screens/EntityCapital/EntityCapital.js +9 -33
  35. package/build/features/entity/screens/EntityName/EntityName.js +14 -31
  36. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +10 -43
  37. package/build/features/individual/screens/IndividualList/IndividualList.js +0 -7
  38. package/build/features/individual/screens/IndividualList/UserList.js +3 -3
  39. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +18 -73
  40. package/build/features/password/Password.js +1 -1
  41. package/build/features/shared/Button/FlowsButtons.js +1 -7
  42. package/build/features/signIn/SignIn.js +2 -10
  43. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -7
  44. package/build/hooks/index.d.ts +0 -1
  45. package/build/hooks/index.js +0 -1
  46. package/build/utils/common.js +3 -3
  47. package/build/utils/validation.d.ts +1 -0
  48. package/build/utils/validation.js +3 -0
  49. package/package.json +2 -2
  50. package/build/hooks/useFormDirtyCheck.d.ts +0 -10
  51. package/build/hooks/useFormDirtyCheck.js +0 -66
@@ -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, useFormDirtyCheck } from '../../../../hooks';
20
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
21
21
  import { DocumentPurpose, IndividualType } from '../../../../@types';
22
- import { deepCopy, getIndividualType, isKW, isKWOrSA, sendCustomEventToGTM } from '../../../../utils';
22
+ import { deepCopy, getIndividualType, isKW, isKWOrSA } 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, _c, _d, _e;
56
+ var _b;
57
57
  var t = useTranslation().t;
58
58
  var isAr = useLanguage().isAr;
59
59
  var dispatch = useAppDispatch();
60
- var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, error = _f.error;
60
+ var _c = useAppSelector(individualSelector), data = _c.data, loading = _c.loading, error = _c.error;
61
61
  var settingsData = useAppSelector(settingsSelector).data;
62
62
  var verify = data.verify;
63
63
  var user = (verify.responseBody || {}).user;
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;
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;
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,30 +95,6 @@ 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;
122
98
  var noneEditable = useDataNoneEditable(data_status, [
123
99
  'occupation',
124
100
  'source_of_income',
@@ -130,22 +106,13 @@ var AdditionalIndividualInfo = function (_a) {
130
106
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
131
107
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
132
108
  var dataVerified = useDataVerified(data_verification, ['occupation', 'is_relative_PEP', 'is_influencer']);
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);
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);
134
110
  var isPEPSwitchVerified = dataVerified['is_relative_PEP'] && is_relative_PEP === watch('isPEP');
135
111
  var isInfluencerSwitchVerified = dataVerified['is_influencer'] && is_influencer === watch('isInfluencer');
136
112
  var isAuthorizedSwitchVerified = dataVerified['is_authorized'] && is_authorized === watch('isAuthorized');
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
- }, []);
113
+ var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
146
114
  var onSubmit = function (data) {
147
- var formData = __assign(__assign({}, deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))), { isDirty: isDirty });
148
- dispatch(updateIndividualInfo(formData));
115
+ dispatch(updateIndividualInfo(deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))));
149
116
  };
150
117
  var onBack = function () {
151
118
  dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
@@ -170,7 +137,7 @@ var AdditionalIndividualInfo = function (_a) {
170
137
  return t('type_board_member');
171
138
  return t('type_user');
172
139
  };
173
- var _k = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _k.isUser, isShareholder = _k.isShareholder, isBoardMember = _k.isBoardMember, isBuyer = _k.isBuyer;
140
+ var _g = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _g.isUser, isShareholder = _g.isShareholder, isBoardMember = _g.isBoardMember, isBuyer = _g.isBuyer;
174
141
  var isUserORBuyerType = isUser || isBuyer;
175
142
  var isUserORBoardMemberType = isUser || isBoardMember;
176
143
  var isAuthorizedValue = watch('isAuthorized');
@@ -20,7 +20,6 @@ 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';
24
23
  import { ScreenContainer } from '../../../shared/Containers';
25
24
  import { individualSelector, retrieveBoardStatus } from '../../../app/individual/individualStore';
26
25
  import UserList from './UserList';
@@ -55,12 +54,6 @@ var IndividualList = function () {
55
54
  var settingsData = useAppSelector(settingsSelector).data;
56
55
  var flows = (data.verify.responseBody || {}).flows;
57
56
  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
- });
64
57
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
65
58
  dispatch(handlePrevScreenStep());
66
59
  return;
@@ -90,7 +90,7 @@ var UserList = function (_a) {
90
90
  var _l = data.individualCollectData, email = _l.email, mobile = _l.mobile, responseBody = _l.responseBody;
91
91
  var is_available = (responseBody || {}).is_available;
92
92
  var verify = data.verify;
93
- var _m = verify.responseBody || {}, userList = _m.userList, recipient = _m.recipient, userRes = _m.user;
93
+ var _m = verify.responseBody || {}, userList = _m.userList, notification = _m.notification, userRes = _m.user;
94
94
  var methods = useForm({
95
95
  resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
96
96
  defaultValues: {
@@ -159,10 +159,10 @@ var UserList = function (_a) {
159
159
  return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
160
160
  };
161
161
  var isSameUserRequestedBefore = function (user) {
162
- var _a;
162
+ var _a, _b;
163
163
  if (!(userRes === null || userRes === void 0 ? void 0 : userRes.is_authorized) && !isKWOrSA(settingsData.businessCountry.iso2))
164
164
  return false;
165
- return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes(recipient === null || recipient === void 0 ? void 0 : recipient.id);
165
+ return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes((_b = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _b === void 0 ? void 0 : _b.id);
166
166
  };
167
167
  var getUserStatus = function (user) {
168
168
  return user === null || user === void 0 ? void 0 : user.individual_data_state;
@@ -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, useFormDirtyCheck } from '../../../../hooks';
21
- import { convertToEnglishDateFormat, deepCopy, findCountryByIddPrefix, findCountryByIso2, getUserName, isKWOrSA, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
20
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
21
+ import { convertToEnglishDateFormat, deepCopy, getUserName, isKWOrSA, isOtherThanKWOrSA } 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, _l, _m, _o;
53
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
54
54
  var t = useTranslation().t;
55
55
  var isAr = useLanguage().isAr;
56
56
  var dispatch = useAppDispatch();
57
- var _p = useAppSelector(individualSelector), data = _p.data, loading = _p.loading, error = _p.error, cityLoading = _p.cityLoading;
57
+ var _l = useAppSelector(individualSelector), data = _l.data, loading = _l.loading, error = _l.error, cityLoading = _l.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 _q = verify.responseBody || {}, user = _q.user, flows = _q.flows;
61
+ var _m = verify.responseBody || {}, user = _m.user, flows = _m.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 _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;
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;
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,51 +82,9 @@ var IndividualPersonalInfo = function (_a) {
82
82
  });
83
83
  var watch = methods.watch;
84
84
  useSetFromDefaultValues(methods, data.individualPersonalData);
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;
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];
130
88
  var originalReadOnly = useFormReadOnly(methods);
131
89
  var noneEditable = useDataNoneEditable(data_status, [
132
90
  'name.en',
@@ -162,37 +120,30 @@ var IndividualPersonalInfo = function (_a) {
162
120
  'nationality',
163
121
  'gender'
164
122
  ]);
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));
165
125
  var isNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && getUserName(user, isAr) === watch('name');
166
126
  var isPhoneNumberVerified = dataVerified['contact.phone.number'] &&
167
127
  dataVerified['contact.phone.country_code'] &&
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());
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());
170
130
  var isEmailVerified = dataVerified['contact.email'] && (contact === null || contact === void 0 ? void 0 : contact.email) === watch('email');
171
131
  var isGenderVerified = dataVerified['gender'] && genderRes === watch('gender');
172
132
  var isIDVerified = dataVerified['identification.id'] && (identification === null || identification === void 0 ? void 0 : identification.id) === watch('nid');
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);
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);
174
134
  var isExpiryDateVerified = dataVerified['identification.expiry'] && expDateRes === watch('expiryDate');
175
135
  var isDOBVerified = dataVerified['birth.date'] && dobDateRes === watch('dob');
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);
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);
179
139
  var isKWOrSaCountry = React.useMemo(function () { return isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
180
140
  var onSubmit = function (data) {
181
- var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
182
- dispatch(updateIndividualPersonalInfo(formData));
141
+ dispatch(updateIndividualPersonalInfo(deepCopy(getFelids(data))));
183
142
  };
184
143
  React.useEffect(function () {
185
144
  if (error)
186
145
  dispatch(clearError());
187
146
  }, [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
- }, []);
196
147
  var onBack = function () {
197
148
  if (error)
198
149
  dispatch(clearError());
@@ -200,12 +151,6 @@ var IndividualPersonalInfo = function (_a) {
200
151
  dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
201
152
  return;
202
153
  }
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
- });
209
154
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
210
155
  dispatch(handlePrevScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
211
156
  return;
@@ -96,7 +96,7 @@ var Password = memo(function (_a) {
96
96
  title: 'Password'
97
97
  });
98
98
  if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
99
- dispatch(verifyOperationToken({ token: token, boardId: boardId, boardInfoId: boardInfoId, userId: userId, userType: userType }));
99
+ dispatch(verifyOperationToken({ token: token, boardId: boardId, boardInfoId: boardInfoId }));
100
100
  return [2];
101
101
  }
102
102
  dispatch(verifyLeadToken({ token: token, isInternally: isInternally }));
@@ -59,7 +59,7 @@ import CheckIcon from '@mui/icons-material/Check';
59
59
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../hooks';
60
60
  import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep, settingsSelector } from '../../../app/settings';
61
61
  import { FlowsTypes } from '../../../@types';
62
- import { dangerousMessage, getScreenNameBasedOnFlow, isKWOrSA, sendCustomEventToGTM } from '../../../utils';
62
+ import { dangerousMessage, getScreenNameBasedOnFlow, isKWOrSA } from '../../../utils';
63
63
  import API from '../../../api';
64
64
  import Text from '../../../components/Text';
65
65
  import Dot from '../Dot';
@@ -163,12 +163,6 @@ export default function FlowsButtons(_a) {
163
163
  if (!item.href)
164
164
  return;
165
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
- });
172
166
  if (flowName === item.name && !isResetPassword(item.name, item.status)) {
173
167
  var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
174
168
  dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
@@ -10,10 +10,10 @@ 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 React, { memo } from 'react';
13
+ import { memo } from 'react';
14
14
  import { createRoot } from 'react-dom/client';
15
15
  import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
16
- import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
16
+ import { settingsSelector } from '../../app/settings';
17
17
  import AnimationFlow from '../../components/AnimationFlow';
18
18
  import { store } from '../../app/store';
19
19
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
@@ -33,14 +33,6 @@ var SignIn = memo(function (props) {
33
33
  useErrorListener(signInError || error);
34
34
  useStepStartedListener();
35
35
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress, appConfig = data.appConfig;
36
- React.useEffect(function () {
37
- if (settingLoading || !props.open)
38
- return;
39
- if (!data.isValidOperator) {
40
- dispatch(handleCurrentActiveScreen('SIGIN_OPERATOR_ERROR_STEP'));
41
- return;
42
- }
43
- }, [data.isValidOperator, settingLoading]);
44
36
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, open: open, error: error, loading: settingLoading, breakpoint: 'sm', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, dialogEdgeFormat: data.appConfig.dialogEdgeFormat, features: appConfig.features }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: isMaturityExpress }, { children: signInFeatureScreens.map(function (_a, index) {
45
37
  var Element = _a.element, name = _a.name;
46
38
  var isActive = activeScreen.name === name;
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import Form from '../../../../components/Form';
19
- import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified, useFormDirtyCheck } from '../../../../hooks';
19
+ import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
20
20
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { DocumentPurpose } from '../../../../@types';
22
22
  import { deepCopy, getFileDetailsFromDocument, isSA } from '../../../../utils';
@@ -55,18 +55,13 @@ var TaxDetails = function () {
55
55
  var noneEditable = useDataNoneEditable(data_status, ['tax_number', 'documents', 'is_vat_acknowledged']);
56
56
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
57
57
  var dataVerified = useDataVerified(data_verification, ['tax_number']);
58
- var isDirty = useFormDirtyCheck(methods, {
59
- vatId: entity === null || entity === void 0 ? void 0 : entity.vat_id,
60
- confirmPolicy: entity === null || entity === void 0 ? void 0 : entity.is_vat_acknowledged
61
- }).isDirty;
62
58
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
63
59
  var isVatIdVerified = dataVerified['tax_number'] && vat_id === methods.watch('vatId');
64
60
  var t = useTranslation().t;
65
61
  var isAr = useLanguage().isAr;
66
62
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
67
63
  var onSubmit = function (data) {
68
- var formData = __assign(__assign({}, deepCopy(getFelids(data))), { isDirty: isDirty });
69
- dispatch(updateTaxInfo(formData));
64
+ dispatch(updateTaxInfo(deepCopy(getFelids(data))));
70
65
  };
71
66
  var onBack = function () {
72
67
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
@@ -20,4 +20,3 @@ export * from './useDataNoneEditable';
20
20
  export * from './useFormErrorAndUpdateReadOnly';
21
21
  export * from './useExcludeReadOnlyFelids';
22
22
  export * from './useDataVerified';
23
- export * from './useFormDirtyCheck';
@@ -20,4 +20,3 @@ export * from './useDataNoneEditable';
20
20
  export * from './useFormErrorAndUpdateReadOnly';
21
21
  export * from './useExcludeReadOnlyFelids';
22
22
  export * from './useDataVerified';
23
- export * from './useFormDirtyCheck';
@@ -1,5 +1,5 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_BETA_URL } from '../constants';
3
3
  export var sleep = function (milliseconds) {
4
4
  if (milliseconds === void 0) { milliseconds = 1000; }
5
5
  return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
@@ -13,7 +13,7 @@ export var dangerousMessage = function (message, callBack) {
13
13
  export var setBaseUrl = function (publicKey) {
14
14
  var isProd = publicKey.includes('pk_live');
15
15
  if (isProd) {
16
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
16
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.BETA_BASE_URL;
17
17
  return;
18
18
  }
19
19
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
@@ -35,7 +35,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
35
35
  window.history.replaceState({}, '', newUrl);
36
36
  };
37
37
  export var openConnect = function (pk, countryCode) {
38
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
38
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_BETA_URL : CONNECT_SANDBOX_URL);
39
39
  if (countryCode) {
40
40
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
41
41
  }
@@ -6,6 +6,7 @@ export declare const removeAllOtherThanAlphabetAndSpace: (str: string) => string
6
6
  export declare const removeAllNumberFromChars: (str: string) => string;
7
7
  export declare const keepEmailCharacters: (str: string) => string;
8
8
  export declare const removeAllOtherThanCharsAndNumber: (str: string) => string;
9
+ export declare const cleanFLandCRNumber: (str: string) => string;
9
10
  export declare const removeAllOtherThanCharsNumberSlashAndHyphen: (str: string) => string;
10
11
  export declare const removeAllOtherThanCharsNumbersAtAndDot: (str: string) => string;
11
12
  export declare const removeAllOtherThanCharsNumbersAndSpace: (str: string) => string;
@@ -22,6 +22,9 @@ export var keepEmailCharacters = function (str) {
22
22
  export var removeAllOtherThanCharsAndNumber = function (str) {
23
23
  return str.replace(/[^A-Za-z0-9]/g, '');
24
24
  };
25
+ export var cleanFLandCRNumber = function (str) {
26
+ return str.replace(/[^a-zA-Z0-9_-]/g, '');
27
+ };
25
28
  export var removeAllOtherThanCharsNumberSlashAndHyphen = function (str) {
26
29
  return str.replace(/[^A-Za-z0-9/-]/g, '');
27
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.63-sandbox",
3
+ "version": "2.8.64-beta",
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 sandbox"
24
+ "push": "npm publish --access public --tag beta"
25
25
  },
26
26
  "keywords": [],
27
27
  "author": {
@@ -1,10 +0,0 @@
1
- import { FieldValues, UseFormReturn } from 'react-hook-form';
2
- type UseFormWithDirtyCheck = {
3
- isDirty: boolean;
4
- };
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;
10
- export {};
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import _ from 'lodash';
3
- export var useFormDirtyCheck = function (method, backendData, customAttrs) {
4
- var _a = React.useState(false), isDirty = _a[0], setIsDirty = _a[1];
5
- var data = method.watch();
6
- var isValidData = function (formValue, backendValue) {
7
- if (_.isUndefined(formValue))
8
- return false;
9
- if (_.isArray(formValue) && formValue.length === 0)
10
- return false;
11
- if (_.isObject(formValue) && _.isEmpty(formValue))
12
- return false;
13
- if (formValue === '' && !backendValue)
14
- return false;
15
- return true;
16
- };
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) {
31
- var formValue = data === null || data === void 0 ? void 0 : data[key];
32
- var backEndValue = backendData === null || backendData === void 0 ? void 0 : backendData[key];
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;
58
- }
59
- return false;
60
- };
61
- React.useEffect(function () {
62
- var isDirty = deepComparison(data, backendData, customAttrs);
63
- setIsDirty(isDirty);
64
- }, [data, backendData]);
65
- return { isDirty: isDirty };
66
- };