@tap-payments/auth-jsconnect 2.8.27-test → 2.8.28-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.
@@ -85,11 +85,10 @@ var EntityTypeList = function (props) {
85
85
  var controlValue = entityTypesControl.field.value || '';
86
86
  var dispatch = useAppDispatch();
87
87
  var _d = data.verify.responseBody || {}, entityTypes = _d.entityTypes, entity = _d.entity;
88
- var type = entity === null || entity === void 0 ? void 0 : entity.type;
89
88
  var isListAvailable = (entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes.length) > 0;
90
89
  var hide = React.useMemo(function () {
91
- return !type || hasVerifiedValue(entity === null || entity === void 0 ? void 0 : entity.data_verification, 'type');
92
- }, [type, entity === null || entity === void 0 ? void 0 : entity.data_verification]);
90
+ return hasVerifiedValue(entity === null || entity === void 0 ? void 0 : entity.data_verification, 'type');
91
+ }, [entity === null || entity === void 0 ? void 0 : entity.data_verification]);
93
92
  React.useEffect(function () {
94
93
  if ((entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes.length) > 0) {
95
94
  setEntityTypesMenuList(entityTypes);
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useController, useFormContext } from 'react-hook-form';
14
14
  import { useTranslation } from 'react-i18next';
15
- import { alpha, Collapse, styled } from '@mui/material';
15
+ import { alpha, styled } from '@mui/material';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
17
  import { getFutureDate } from '../../../../utils';
18
18
  import Text from '../../../../components/Text';
@@ -25,21 +25,19 @@ export var InputLabelStyled = styled(Text)(function (_a) {
25
25
  return (__assign({ margin: theme.spacing(0, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.6) }, theme.typography.caption));
26
26
  });
27
27
  var ExpiryDate = function (_a) {
28
- var _b, _c;
28
+ var _b;
29
29
  var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
30
30
  var t = useTranslation().t;
31
31
  var dispatch = useAppDispatch();
32
32
  var control = useFormContext().control;
33
- var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
34
- var entity = (data.verify.responseBody || {}).entity;
35
- var expiryDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.expiry_date;
33
+ var error = useAppSelector(entitySelector).error;
36
34
  var oDateControl = useController({ control: control, name: 'expiryDate' });
37
- var dateValue = (_c = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _c === void 0 ? void 0 : _c.value;
35
+ var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
38
36
  var handleExpiryDateChange = function (data) {
39
37
  if (error)
40
38
  dispatch(clearError());
41
39
  oDateControl.field.onChange(data);
42
40
  };
43
- return (_jsx(Collapse, __assign({ in: !!expiryDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })) })));
41
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })));
44
42
  };
45
43
  export default ExpiryDate;
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { useController, useFormContext } from 'react-hook-form';
15
- import { alpha, Collapse, styled } from '@mui/material';
15
+ import { alpha, styled } from '@mui/material';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
17
  import Text from '../../../../components/Text';
18
18
  import Calender from '../../../shared/Calender';
@@ -24,21 +24,19 @@ export var InputLabelStyled = styled(Text)(function (_a) {
24
24
  return (__assign({ margin: theme.spacing(0, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.6) }, theme.typography.caption));
25
25
  });
26
26
  var IssuingDate = function (_a) {
27
- var _b, _c;
27
+ var _b;
28
28
  var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
29
29
  var t = useTranslation().t;
30
30
  var dispatch = useAppDispatch();
31
31
  var control = useFormContext().control;
32
- var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
33
- var entity = (data.verify.responseBody || {}).entity;
34
- var issueDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
32
+ var error = useAppSelector(entitySelector).error;
35
33
  var oDateControl = useController({ control: control, name: 'issuingDate' });
36
- var dateValue = (_c = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _c === void 0 ? void 0 : _c.value;
34
+ var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
37
35
  var handleIssuingDateChange = function (data) {
38
36
  if (error)
39
37
  dispatch(clearError());
40
38
  oDateControl.field.onChange(data);
41
39
  };
42
- return (_jsx(Collapse, __assign({ in: !!issueDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('issue_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })) })));
40
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('issue_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })));
43
41
  };
44
42
  export default IssuingDate;
@@ -1,19 +1,7 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
2
  import * as React from 'react';
14
3
  import { useTranslation } from 'react-i18next';
15
4
  import { useController, useFormContext } from 'react-hook-form';
16
- import { Collapse } from '@mui/material';
17
5
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
18
6
  import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
19
7
  import { ScreenContainer } from '../../../shared/Containers';
@@ -44,6 +32,6 @@ var LegalName = function (_a) {
44
32
  var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
45
33
  legalNameControl.field.onChange(value);
46
34
  };
47
- return (_jsx(Collapse, __assign({ in: !!legalName }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { required: true, readOnly: readOnly, onChange: handleChange, value: legalNameValue, label: t('license_name_label'), placeholder: t('license_name_placeholder'), sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, endAdornment: _jsx(EndAdornment, { value: legalNameValue, isVerified: isVerified }) }) }) })));
35
+ return (_jsx(ScreenContainer, { children: _jsx(Input, { required: true, readOnly: readOnly, onChange: handleChange, value: legalNameValue, label: t('license_name_label'), placeholder: t('license_name_placeholder'), sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, endAdornment: _jsx(EndAdornment, { value: legalNameValue, isVerified: isVerified }) }) }));
48
36
  };
49
37
  export default React.memo(LegalName);
@@ -24,16 +24,14 @@ import Input from '../../../shared/Input';
24
24
  import { clearError, entitySelector } from '../../../app/entity/entityStore';
25
25
  import { EndAdornment } from '../../../shared/EndAdornment';
26
26
  var LicenseNumber = function (_a) {
27
- var _b, _c;
27
+ var _b;
28
28
  var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
29
29
  var t = useTranslation().t;
30
- var _d = useAppSelector(entitySelector), data = _d.data, bckError = _d.error;
30
+ var _c = useAppSelector(entitySelector), data = _c.data, bckError = _c.error;
31
31
  var dispatch = useAppDispatch();
32
32
  var settingsData = useAppSelector(settingsSelector).data;
33
33
  var control = useFormContext().control;
34
- var entity = (data.verify.responseBody || {}).entity;
35
34
  var type = data.entityNameData.licenseType;
36
- var number = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
37
35
  var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
38
36
  var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
39
37
  var handleChange = function (_a) {
@@ -45,10 +43,10 @@ var LicenseNumber = function (_a) {
45
43
  };
46
44
  var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
47
45
  var licenseNumberValue = licenseNumberControl.field.value;
48
- var error = (_c = licenseNumberControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
46
+ var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
49
47
  var isCR = type === BusinessType.CR;
50
48
  var length = isKWCountry || isOtherCountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_ENTITY_LENGTH;
51
49
  var minLength = isKWCountry || isOtherCountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
52
- return (_jsx(Collapse, __assign({ in: show && !!number }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('license_number_label'), onChange: handleChange, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }), endAdornment: _jsx(EndAdornment, { value: licenseNumberValue, isVerified: isVerified }) }) })) })));
50
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('license_number_label'), onChange: handleChange, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }), endAdornment: _jsx(EndAdornment, { value: licenseNumberValue, isVerified: isVerified }) }) })) })));
53
51
  };
54
52
  export default React.memo(LicenseNumber);
@@ -21,14 +21,12 @@ import Input from '../../../shared/Input';
21
21
  import { clearError, entitySelector } from '../../../app/entity/entityStore';
22
22
  import { EndAdornment } from '../../../shared/EndAdornment';
23
23
  var UnifiedNumber = function (_a) {
24
- var _b, _c, _d;
24
+ var _b;
25
25
  var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
26
26
  var t = useTranslation().t;
27
- var _e = useAppSelector(entitySelector), data = _e.data, bckError = _e.error;
27
+ var bckError = useAppSelector(entitySelector).error;
28
28
  var control = useFormContext().control;
29
29
  var dispatch = useAppDispatch();
30
- var entity = (data.verify.responseBody || {}).entity;
31
- var number = (_c = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number;
32
30
  var handleChange = function (_a) {
33
31
  var target = _a.target;
34
32
  if (bckError)
@@ -38,7 +36,7 @@ var UnifiedNumber = function (_a) {
38
36
  };
39
37
  var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
40
38
  var unifiedNumberValue = unifiedNumberControl.field.value;
41
- var error = (_d = unifiedNumberControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
42
- return (_jsx(Collapse, __assign({ in: show && !!number }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('unified_number_label'), onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) }) })) })));
39
+ var error = (_b = unifiedNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
40
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('unified_number_label'), onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) }) })) })));
43
41
  };
44
42
  export default React.memo(UnifiedNumber);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.27-test",
3
+ "version": "2.8.28-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",