@tap-payments/auth-jsconnect 1.0.55 → 1.0.56

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.
@@ -209,7 +209,7 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
209
209
  license_type: ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL ? 'freelance' : 'commercial_registration',
210
210
  business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
211
211
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
212
- encryption_contract: []
212
+ encryption_contract: ['license_number', 'business_type', 'license_type']
213
213
  };
214
214
  return [4, API.leadService.updateLead(payload)];
215
215
  case 1:
@@ -112,15 +112,13 @@ var LicenseList = function (_a) {
112
112
  };
113
113
  var showLicenseNumber = !anchorEl;
114
114
  var selected = selectedLicenseControl.field.value;
115
- var crReadonly = !isOtherLicense(selected);
115
+ var licenseReadonly = !isOtherLicense(selected);
116
116
  var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
117
- var flValue = !isOtherLicense(selected) ? t(getLicenseName(selected)) : t(getLicenseNumber(selected));
117
+ var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : t(getLicenseNumber(selected));
118
118
  return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
119
119
  return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item)
120
120
  ? t(getLicenseName(item))
121
- : isAr
122
- ? getLicenseName(item)
123
- : getLicenseNumber(item) + ' - ' + getLicenseName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
124
- } }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: crReadonly })] }));
121
+ : getLicenseNumber(item) + ' - ' + getLicenseName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
122
+ } }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
125
123
  };
126
124
  export default React.memo(LicenseList);
@@ -14,7 +14,7 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH } from '../../../../constants';
17
- import { removeAllCharsFromNumber } from '../../../../utils';
17
+ import { removeAllCharsFromNumber, removeAllOtherThanCharsAndNumber } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -27,9 +27,11 @@ var LicenseNumber = function (_a) {
27
27
  var t = useTranslation().t;
28
28
  var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
29
29
  var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
30
+ var selectedLicense = getValues('selectedLicense');
31
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
30
32
  var handleFLNumberChange = function (_a) {
31
33
  var target = _a.target;
32
- var value = removeAllCharsFromNumber(target.value);
34
+ var value = isCR ? removeAllCharsFromNumber(target.value) : removeAllOtherThanCharsAndNumber(target.value);
33
35
  licenseNumberControl.field.onChange(value);
34
36
  };
35
37
  var clearLicenseNumber = function () {
@@ -37,8 +39,6 @@ var LicenseNumber = function (_a) {
37
39
  };
38
40
  var licenseNumberValue = licenseNumberControl.field.value;
39
41
  var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
40
- var selectedLicense = getValues('selectedLicense');
41
- var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
42
42
  var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
43
43
  var label = isCR ? 'cr_number' : 'fl_number';
44
44
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '0123456789' : '12345678', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",