@tap-payments/auth-jsconnect 2.0.67-test → 2.0.69-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.
- package/build/features/app/business/businessStore.js +1 -3
- package/build/features/app/connect/connectStore.js +14 -8
- package/build/features/business/screens/BusinessType/BusinessType.js +5 -3
- package/build/features/business/screens/BusinessType/EntityName.js +14 -2
- package/build/features/business/screens/BusinessType/validation.d.ts +10 -0
- package/build/features/business/screens/BusinessType/validation.js +16 -0
- package/package.json +1 -1
|
@@ -61,7 +61,7 @@ import API from '../../../api';
|
|
|
61
61
|
import { BusinessType, FlowsTypes } from '../../../@types';
|
|
62
62
|
import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
63
63
|
import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW } from '../../../utils';
|
|
64
|
-
import { handleNextScreenStep
|
|
64
|
+
import { handleNextScreenStep } from '../../../app/settings';
|
|
65
65
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var payload, data, leadResponse, brandInfo, boardResponse, countryIso2, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
|
|
67
67
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -83,7 +83,6 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
83
83
|
case 2:
|
|
84
84
|
leadResponse = _h.sent();
|
|
85
85
|
countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
|
|
86
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
87
86
|
board_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_id;
|
|
88
87
|
board_info_id = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.board_info_id;
|
|
89
88
|
if (!(!!board_id && !!board_info_id)) return [3, 4];
|
|
@@ -440,7 +439,6 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
440
439
|
business: { ar: params.entityLegalName, en: params.entityLegalName },
|
|
441
440
|
encryption_contract: ['license_number', 'business_type', 'license_type']
|
|
442
441
|
};
|
|
443
|
-
console.log(payload, 'payload', params.entityLegalName);
|
|
444
442
|
return [4, API.leadService.updateLead(payload)];
|
|
445
443
|
case 1:
|
|
446
444
|
data = _h.sent();
|
|
@@ -939,14 +939,20 @@ export var connectSlice = createSlice({
|
|
|
939
939
|
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
940
940
|
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
941
941
|
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
942
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.
|
|
943
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a; return ((_a = c.name) === null || _a === void 0 ? void 0 : _a.en.
|
|
944
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
942
|
+
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a, _b, _c; return (_c = (_b = (_a = c.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === null || _c === void 0 ? void 0 : _c.includes('website'); });
|
|
943
|
+
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { var _a, _b, _c; return (_c = (_b = (_a = c.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === null || _c === void 0 ? void 0 : _c.includes('social'); });
|
|
944
|
+
if (isHasWebsite && (isHasTwitter || isHasInstagram)) {
|
|
945
|
+
if (websiteData)
|
|
946
|
+
selectedChannels.push(websiteData);
|
|
947
|
+
if (socialData)
|
|
948
|
+
selectedChannels.push(socialData);
|
|
949
|
+
}
|
|
950
|
+
else if ((isHasTwitter || isHasInstagram) && socialData) {
|
|
951
|
+
selectedChannels.push(socialData);
|
|
952
|
+
}
|
|
953
|
+
else if (isHasWebsite && websiteData) {
|
|
954
|
+
selectedChannels.push(websiteData);
|
|
955
|
+
}
|
|
950
956
|
state.data.brandData.salesChannels = selectedChannels;
|
|
951
957
|
})
|
|
952
958
|
.addCase(retrieveChannels.rejected, function (state, action) {
|
|
@@ -15,23 +15,25 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
|
-
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
18
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
19
19
|
import Form from '../../../../components/Form';
|
|
20
20
|
import Collapse from '../../../../components/Collapse';
|
|
21
21
|
import { useLanguage } from '../../../../hooks';
|
|
22
22
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
23
23
|
import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
24
24
|
import Button from '../../../shared/Button';
|
|
25
|
-
import { LicenseValidationSchema } from './validation';
|
|
25
|
+
import { KWLicenseValidationSchema, LicenseValidationSchema } from './validation';
|
|
26
26
|
import LicenseList from './LicenseList';
|
|
27
|
+
import { isKW } from '../../../../utils';
|
|
27
28
|
var BusinessType = function (_a) {
|
|
28
29
|
var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
30
|
+
var settingData = useAppSelector(settingsSelector).data;
|
|
29
31
|
var t = useTranslation().t;
|
|
30
32
|
var isAr = useLanguage().isAr;
|
|
31
33
|
var dispatch = useAppDispatch();
|
|
32
34
|
var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
|
|
33
35
|
var methods = useForm({
|
|
34
|
-
resolver: yupResolver(LicenseValidationSchema),
|
|
36
|
+
resolver: yupResolver(isKW(settingData.businessCountry.iso2) ? KWLicenseValidationSchema : LicenseValidationSchema),
|
|
35
37
|
defaultValues: data.businessTypeData,
|
|
36
38
|
mode: 'onChange'
|
|
37
39
|
});
|
|
@@ -10,7 +10,6 @@ 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 ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
14
13
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
15
14
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
16
15
|
import Input from '../../../shared/Input';
|
|
@@ -18,6 +17,19 @@ import Collapse from '../../../../components/Collapse';
|
|
|
18
17
|
import { useTranslation } from 'react-i18next';
|
|
19
18
|
import { useController, useFormContext } from 'react-hook-form';
|
|
20
19
|
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
20
|
+
import { styled } from '@mui/material/styles';
|
|
21
|
+
import Box from '@mui/material/Box';
|
|
22
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return ({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
direction: theme.direction,
|
|
28
|
+
fontFamily: theme.typography.fontFamily,
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
paddingBlockEnd: theme.spacing(2.5)
|
|
31
|
+
});
|
|
32
|
+
});
|
|
21
33
|
var EntityName = function (_a) {
|
|
22
34
|
var _b;
|
|
23
35
|
var show = _a.show;
|
|
@@ -34,6 +46,6 @@ var EntityName = function (_a) {
|
|
|
34
46
|
var clearEntityName = function () {
|
|
35
47
|
entityNameControl.field.onChange('');
|
|
36
48
|
};
|
|
37
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(
|
|
49
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(BoxStyled, { children: _jsx(Input, { label: t('entity_legal_name_title'), onChange: handleChange, value: entityNameValue, endAdornment: (entityNameValue === null || entityNameValue === void 0 ? void 0 : entityNameValue.length) >= 3 ? _jsx(CheckIcon, {}) : entityNameValue && _jsx(ClearIcon, { onClick: clearEntityName }), placeholder: t('entity_legal_name_placeholder'), warningType: 'alert', warningMessage: error && t(error) }) }) })));
|
|
38
50
|
};
|
|
39
51
|
export default EntityName;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const LicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
selectedLicense: any;
|
|
4
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
6
|
+
selectedLicense: any;
|
|
7
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
8
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
|
+
selectedLicense: any;
|
|
10
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
11
|
+
}>>>;
|
|
12
|
+
export declare const KWLicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
13
|
selectedLicense: any;
|
|
4
14
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
15
|
entityLegalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -12,6 +12,22 @@ var objectElements = {
|
|
|
12
12
|
type: yup.string()
|
|
13
13
|
};
|
|
14
14
|
export var LicenseValidationSchema = yup.object().shape({
|
|
15
|
+
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
16
|
+
licenseNumber: yup.string().test({
|
|
17
|
+
test: function (value) {
|
|
18
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
19
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
20
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
21
|
+
if (length === 0)
|
|
22
|
+
return true;
|
|
23
|
+
if (isCR) {
|
|
24
|
+
return length === CR_NUMBER_LENGTH ? true : this.createError({ message: 'cr_max_length' });
|
|
25
|
+
}
|
|
26
|
+
return length === FL_NUMBER_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
export var KWLicenseValidationSchema = yup.object().shape({
|
|
15
31
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
16
32
|
licenseNumber: yup
|
|
17
33
|
.string()
|