@tap-payments/auth-jsconnect 2.3.58-test → 2.3.61-test

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.
@@ -40,6 +40,7 @@ var ListStyled = styled(List)(function (_a) {
40
40
  height: theme.spacing(40)
41
41
  },
42
42
  _b[theme.breakpoints.down('sm')] = {
43
+ height: 'unset',
43
44
  maxHeight: "calc(100vh - ".concat(theme.spacing(34.875), ")")
44
45
  },
45
46
  _b['&::-webkit-scrollbar'] = {
@@ -120,17 +120,25 @@ var ActivitiesList = function (_a) {
120
120
  var activities = (verify.responseBody || {}).activities;
121
121
  var isCR = ((_d = (_c = (_b = verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) === null || _d === void 0 ? void 0 : _d.type) === 'commercial_registration';
122
122
  var disabled = false;
123
+ var setSelectedActivitiesBeginning = function (list) {
124
+ var mapSelectedListFirst = __spreadArray(__spreadArray([], list.filter(function (a) { return (controlValue || []).some(function (c) { return a.id === c.id; }); }), true), list.filter(function (a) { return !(controlValue || []).some(function (c) { return a.id === c.id; }); }), true);
125
+ setActivitiesMenuList(mapSelectedListFirst);
126
+ };
123
127
  React.useEffect(function () {
124
128
  if ((activities === null || activities === void 0 ? void 0 : activities.length) > 0) {
125
129
  var list = __spreadArray([], activities, true);
126
130
  var sortedList = sortActivitiesByName(list, isAr ? 'name.ar' : 'name.en');
127
- setActivitiesMenuList(sortedList);
131
+ setSelectedActivitiesBeginning(sortedList);
128
132
  }
129
133
  }, [activities]);
130
134
  var onOpenList = function (event) {
131
135
  var _a;
132
136
  if (readOnly)
133
137
  return;
138
+ if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) > (activities === null || activities === void 0 ? void 0 : activities.length)) {
139
+ var list = __spreadArray([], activitiesMenuList, true);
140
+ setSelectedActivitiesBeginning(list);
141
+ }
134
142
  setAnchorEl(event.currentTarget);
135
143
  (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
136
144
  };
@@ -60,19 +60,15 @@ import { debounce } from 'lodash-es';
60
60
  import Collapse from '../../../../components/Collapse';
61
61
  import { styled } from '@mui/material/styles';
62
62
  import CircularProgress from '@mui/material/CircularProgress';
63
- var InputStyled = styled(Input)(function (_a) {
64
- var theme = _a.theme;
65
- return ({
66
- input: {
67
- textTransform: 'lowercase'
68
- }
69
- });
70
- });
63
+ var InputStyled = styled(Input)(function () { return ({
64
+ input: {
65
+ textTransform: 'lowercase'
66
+ }
67
+ }); });
71
68
  var cancelToken = null;
72
69
  var Email = function (_a) {
73
70
  var _b, _c, _d;
74
71
  var show = _a.show, fetchingEmail = _a.fetchingEmail, emailChecking = _a.emailChecking;
75
- var _e = React.useState(''), storedEmail = _e[0], setStoredEmail = _e[1];
76
72
  var dispatch = useAppDispatch();
77
73
  var data = useAppSelector(connectSelector).data;
78
74
  var t = useTranslation().t;
@@ -97,15 +93,9 @@ var Email = function (_a) {
97
93
  var handleEmailChange = function (event) {
98
94
  emailControl.field.onChange(event.target.value);
99
95
  };
100
- React.useEffect(function () {
101
- var _a, _b;
102
- var email = (_b = (_a = data.otpData.responseBody) === null || _a === void 0 ? void 0 : _a.contact) === null || _b === void 0 ? void 0 : _b.email;
103
- if (!!email)
104
- setStoredEmail(email);
105
- }, [data.otpData.responseBody]);
106
96
  React.useEffect(function () {
107
97
  var isValid = emailValue && !error && emailValue.length > 3;
108
- if (isValid && emailValue != storedEmail) {
98
+ if (isValid && emailValue != email) {
109
99
  fetchingEmail(true);
110
100
  checkEmail(emailValue);
111
101
  }
@@ -108,12 +108,15 @@ var ActivitiesList = function (props) {
108
108
  var type = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
109
109
  var isCR = type === BusinessType.CR;
110
110
  var disabled = false;
111
+ var setSelectedActivitiesBeginning = function (list) {
112
+ var mapSelectedListFirst = __spreadArray(__spreadArray([], list.filter(function (a) { return (controlValue || []).some(function (c) { return a.id === c.id; }); }), true), list.filter(function (a) { return !(controlValue || []).some(function (c) { return a.id === c.id; }); }), true);
113
+ setActivitiesMenuList(mapSelectedListFirst);
114
+ };
111
115
  React.useEffect(function () {
112
116
  if ((activityList === null || activityList === void 0 ? void 0 : activityList.length) > 0) {
113
117
  var list = __spreadArray([], activityList, true);
114
118
  var sortedList = sortActivitiesByName(list, isAr ? 'name.ar' : 'name.en');
115
- var mapSelectedListFirst = __spreadArray(__spreadArray([], sortedList.filter(function (a) { return (controlValue || []).some(function (c) { return a.id === c.id; }); }), true), sortedList.filter(function (a) { return !(controlValue || []).some(function (c) { return a.id === c.id; }); }), true);
116
- setActivitiesMenuList(mapSelectedListFirst);
119
+ setSelectedActivitiesBeginning(sortedList);
117
120
  }
118
121
  }, [activityList]);
119
122
  var onOpenList = function (event) {
@@ -122,8 +125,7 @@ var ActivitiesList = function (props) {
122
125
  return;
123
126
  if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) > ((_a = entity === null || entity === void 0 ? void 0 : entity.activities) === null || _a === void 0 ? void 0 : _a.length)) {
124
127
  var list = __spreadArray([], activitiesMenuList, true);
125
- var mapSelectedListFirst = __spreadArray(__spreadArray([], list.filter(function (a) { return (controlValue || []).some(function (c) { return a.id === c.id; }); }), true), list.filter(function (a) { return !(controlValue || []).some(function (c) { return a.id === c.id; }); }), true);
126
- setActivitiesMenuList(mapSelectedListFirst);
128
+ setSelectedActivitiesBeginning(list);
127
129
  }
128
130
  setAnchorEl(event.currentTarget);
129
131
  (_b = props.onListOpen) === null || _b === void 0 ? void 0 : _b.call(props);
@@ -145,7 +145,7 @@ var IndividualPersonalInfo = function (_a) {
145
145
  var isBirthCountryListActive = listActive === ListType.BirthCountryList;
146
146
  var isBirthCityListActive = listActive === ListType.BirthCityList;
147
147
  var isNationalityListActive = listActive === ListType.NationalityList;
148
- return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserOccupation() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || noneEditable['name'] }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'] }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'] }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'] }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'] }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
148
+ return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserOccupation() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || noneEditable['name'] }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive && !isIssuedCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'] }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'] }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'] }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'] }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
149
149
  !isDateFieldActive &&
150
150
  !isIssuedCountryListActive &&
151
151
  !isBirthCountryListActive &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.58-test",
3
+ "version": "2.3.61-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",