@tap-payments/auth-jsconnect 2.10.16-development → 2.10.18-development
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/constants/app.d.ts +9 -0
- package/build/constants/app.js +6 -3
- package/build/features/app/business/businessStore.js +10 -6
- package/build/features/app/connectExpress/connectExpressStore.js +13 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +3 -2
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +15 -8
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +1 -1
- package/build/features/business/screens/BusinessType/validation.js +4 -7
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +13 -7
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +0 -18
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +23 -18
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +3 -1
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +2 -2
- package/package.json +1 -1
package/build/constants/app.d.ts
CHANGED
|
@@ -234,6 +234,9 @@ export declare const OTHER_FL_LICENSE: {
|
|
|
234
234
|
};
|
|
235
235
|
license: {
|
|
236
236
|
number: string;
|
|
237
|
+
additional_info: {
|
|
238
|
+
unified_number: string;
|
|
239
|
+
};
|
|
237
240
|
};
|
|
238
241
|
type: BusinessType;
|
|
239
242
|
};
|
|
@@ -245,6 +248,9 @@ export declare const OTHER_ENTITY_LICENSE: {
|
|
|
245
248
|
};
|
|
246
249
|
license: {
|
|
247
250
|
number: string;
|
|
251
|
+
additional_info: {
|
|
252
|
+
unified_number: string;
|
|
253
|
+
};
|
|
248
254
|
};
|
|
249
255
|
type: BusinessType;
|
|
250
256
|
};
|
|
@@ -255,6 +261,9 @@ export declare const OTHER_CR_LICENSE: {
|
|
|
255
261
|
};
|
|
256
262
|
license: {
|
|
257
263
|
number: string;
|
|
264
|
+
additional_info: {
|
|
265
|
+
unified_number: string;
|
|
266
|
+
};
|
|
258
267
|
};
|
|
259
268
|
type: BusinessType;
|
|
260
269
|
};
|
package/build/constants/app.js
CHANGED
|
@@ -1241,7 +1241,8 @@ export var OTHER_FL_LICENSE = {
|
|
|
1241
1241
|
en: 'add_other_fl'
|
|
1242
1242
|
},
|
|
1243
1243
|
license: {
|
|
1244
|
-
number: 'other_fl'
|
|
1244
|
+
number: 'other_fl',
|
|
1245
|
+
additional_info: { unified_number: 'other_fl' }
|
|
1245
1246
|
},
|
|
1246
1247
|
type: BusinessType.FL
|
|
1247
1248
|
};
|
|
@@ -1252,7 +1253,8 @@ export var OTHER_ENTITY_LICENSE = {
|
|
|
1252
1253
|
en: 'add_other'
|
|
1253
1254
|
},
|
|
1254
1255
|
license: {
|
|
1255
|
-
number: 'other_entity'
|
|
1256
|
+
number: 'other_entity',
|
|
1257
|
+
additional_info: { unified_number: 'other_entity' }
|
|
1256
1258
|
},
|
|
1257
1259
|
type: BusinessType.CR
|
|
1258
1260
|
};
|
|
@@ -1262,7 +1264,8 @@ export var OTHER_CR_LICENSE = {
|
|
|
1262
1264
|
en: 'add_other_cr'
|
|
1263
1265
|
},
|
|
1264
1266
|
license: {
|
|
1265
|
-
number: 'other_cr'
|
|
1267
|
+
number: 'other_cr',
|
|
1268
|
+
additional_info: { unified_number: 'other_cr' }
|
|
1266
1269
|
},
|
|
1267
1270
|
type: BusinessType.CR
|
|
1268
1271
|
};
|
|
@@ -1265,7 +1265,7 @@ export var businessSlice = createSlice({
|
|
|
1265
1265
|
state.loading = true;
|
|
1266
1266
|
})
|
|
1267
1267
|
.addCase(retrieveEntityList.fulfilled, function (state, action) {
|
|
1268
|
-
var _a, _b, _c, _d;
|
|
1268
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1269
1269
|
state.error = null;
|
|
1270
1270
|
state.loading = false;
|
|
1271
1271
|
var data = action.payload;
|
|
@@ -1286,7 +1286,7 @@ export var businessSlice = createSlice({
|
|
|
1286
1286
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), mappedFL, true);
|
|
1287
1287
|
licenseList = licenseList.filter(function (_a) {
|
|
1288
1288
|
var license = _a.license;
|
|
1289
|
-
return !(entityLicenseList || []).some(function (e) { return e.license.number === license.number; });
|
|
1289
|
+
return !(entityLicenseList || []).some(function (e) { var _a, _b; return e.license.number === license.number || ((_a = e.license.additional_info) === null || _a === void 0 ? void 0 : _a.unified_number) === ((_b = license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number); });
|
|
1290
1290
|
});
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
@@ -1296,8 +1296,10 @@ export var businessSlice = createSlice({
|
|
|
1296
1296
|
var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
|
|
1297
1297
|
var isOtherLicense_1 = ((_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_fl' || ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_cr';
|
|
1298
1298
|
state.data.businessTypeData.selectedLicense = selectedLicense;
|
|
1299
|
-
if (!isOtherLicense_1)
|
|
1299
|
+
if (!isOtherLicense_1) {
|
|
1300
1300
|
state.data.businessTypeData.licenseNumber = ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) || '';
|
|
1301
|
+
state.data.businessTypeData.unifiedNumber = ((_f = (_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.additional_info) === null || _f === void 0 ? void 0 : _f.unified_number) || '';
|
|
1302
|
+
}
|
|
1301
1303
|
}
|
|
1302
1304
|
})
|
|
1303
1305
|
.addCase(retrieveEntityList.rejected, function (state, action) {
|
|
@@ -1309,10 +1311,10 @@ export var businessSlice = createSlice({
|
|
|
1309
1311
|
state.loading = true;
|
|
1310
1312
|
})
|
|
1311
1313
|
.addCase(retrieveAllEntityList.fulfilled, function (state, action) {
|
|
1312
|
-
var _a;
|
|
1314
|
+
var _a, _b, _c;
|
|
1313
1315
|
state.error = null;
|
|
1314
1316
|
state.loading = false;
|
|
1315
|
-
var
|
|
1317
|
+
var _d = action.payload, data = _d.data, businessCountryCode = _d.businessCountryCode, entityId = _d.entityId;
|
|
1316
1318
|
var isKWCountry = isKW(businessCountryCode);
|
|
1317
1319
|
var list = (data === null || data === void 0 ? void 0 : data.entities_info) || [];
|
|
1318
1320
|
if (isKWCountry) {
|
|
@@ -1330,8 +1332,10 @@ export var businessSlice = createSlice({
|
|
|
1330
1332
|
var selectedLicense = findEntity ? findEntity : entityLicenseList[0];
|
|
1331
1333
|
state.data.businessTypeData.selectedEntityLicense = selectedLicense;
|
|
1332
1334
|
state.data.businessTypeData.selectedLicense = selectedLicense;
|
|
1333
|
-
if (!isOtherLicense(selectedLicense))
|
|
1335
|
+
if (!isOtherLicense(selectedLicense)) {
|
|
1334
1336
|
state.data.businessTypeData.licenseNumber = ((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
1337
|
+
state.data.businessTypeData.unifiedNumber = ((_c = (_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '';
|
|
1338
|
+
}
|
|
1335
1339
|
}
|
|
1336
1340
|
})
|
|
1337
1341
|
.addCase(retrieveAllEntityList.rejected, function (state, action) {
|
|
@@ -1800,7 +1800,7 @@ export var connectSlice = createSlice({
|
|
|
1800
1800
|
}
|
|
1801
1801
|
}
|
|
1802
1802
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
|
|
1803
|
-
var _c = ((_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) || {}, license_number = _c.license_number, license_type = _c.license_type;
|
|
1803
|
+
var _c = ((_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) || {}, license_number = _c.license_number, license_type = _c.license_type, unified_number = _c.unified_number;
|
|
1804
1804
|
var selectedLicense = undefined;
|
|
1805
1805
|
if (license_number) {
|
|
1806
1806
|
var findLicense = licenseList.find(function (_a) {
|
|
@@ -1816,6 +1816,18 @@ export var connectSlice = createSlice({
|
|
|
1816
1816
|
selectedLicense = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: license_number } });
|
|
1817
1817
|
state.data.businessData.licenseNumber = license_number;
|
|
1818
1818
|
}
|
|
1819
|
+
if (unified_number) {
|
|
1820
|
+
var findLicense = licenseList.find(function (_a) {
|
|
1821
|
+
var _b;
|
|
1822
|
+
var license = _a.license;
|
|
1823
|
+
return ((_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) === unified_number;
|
|
1824
|
+
});
|
|
1825
|
+
if (findLicense)
|
|
1826
|
+
selectedLicense = findLicense;
|
|
1827
|
+
else
|
|
1828
|
+
selectedLicense = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: '', additional_info: { unified_number: unified_number } } });
|
|
1829
|
+
state.data.businessData.unifiedNumber = unified_number;
|
|
1830
|
+
}
|
|
1819
1831
|
state.data.businessData.selectedLicense = selectedLicense;
|
|
1820
1832
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { licenseList: licenseList });
|
|
1821
1833
|
})
|
|
@@ -104,8 +104,8 @@ var BusinessType = function (_a) {
|
|
|
104
104
|
var showLicenseNumber = function () {
|
|
105
105
|
if (isKWCountry)
|
|
106
106
|
return !isAnyListActive && isCR;
|
|
107
|
-
if (isSACountry
|
|
108
|
-
return !isAnyListActive &&
|
|
107
|
+
if (isSACountry)
|
|
108
|
+
return !isAnyListActive && isFL;
|
|
109
109
|
return !isAnyListActive;
|
|
110
110
|
};
|
|
111
111
|
var isLicenseListActive = listActive === ListType.LicenseList;
|
|
@@ -114,6 +114,7 @@ var BusinessType = function (_a) {
|
|
|
114
114
|
var selected = methods.getValues('selectedLicense');
|
|
115
115
|
var selectedLicenseEntity = methods.getValues('selectedEntityLicense');
|
|
116
116
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.CR;
|
|
117
|
+
var isFL = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.FL;
|
|
117
118
|
var hasEntityList = !!(entityLicenseList === null || entityLicenseList === void 0 ? void 0 : entityLicenseList.length);
|
|
118
119
|
var showLicenseList = hasEntityList ? (isSACountry || isOtherCountry) && isOtherLicense(selectedLicenseEntity) : isSACountry || isOtherCountry;
|
|
119
120
|
var showEntityList = isKWCountry ? hasEntityList && !isLicenseListActive && isCR : hasEntityList && !isLicenseListActive;
|
|
@@ -36,7 +36,7 @@ import { businessSelector, clearError } from '../../../app/business/businessStor
|
|
|
36
36
|
import Text from '../../../../components/Text';
|
|
37
37
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
38
38
|
import Collapse from '../../../../components/Collapse';
|
|
39
|
-
import { isKW, isOtherLicense } from '../../../../utils';
|
|
39
|
+
import { isKW, isOtherLicense, isSA } from '../../../../utils';
|
|
40
40
|
import { settingsSelector } from '../../../../app/settings';
|
|
41
41
|
import { OTHER_CR_LICENSE } from '../../../../constants';
|
|
42
42
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
@@ -67,6 +67,7 @@ var EntityLicenseList = function (_a) {
|
|
|
67
67
|
var entityLicenseList = (responseBody || {}).entityLicenseList;
|
|
68
68
|
var country_code = settingsData.businessCountry.iso2;
|
|
69
69
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
70
|
+
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
70
71
|
var onOpenLicenseList = function (event) {
|
|
71
72
|
var _a;
|
|
72
73
|
setAnchorEl(event.currentTarget);
|
|
@@ -90,8 +91,10 @@ var EntityLicenseList = function (_a) {
|
|
|
90
91
|
}
|
|
91
92
|
}, [entityLicenseList, selectedEntityLicense]);
|
|
92
93
|
var getLicenseNumber = function (item) {
|
|
93
|
-
var _a;
|
|
94
|
-
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.CR && isSACountry)
|
|
96
|
+
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
97
|
+
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
95
98
|
};
|
|
96
99
|
var getLicenseName = function (item) {
|
|
97
100
|
var _a, _b;
|
|
@@ -100,6 +103,7 @@ var EntityLicenseList = function (_a) {
|
|
|
100
103
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
101
104
|
};
|
|
102
105
|
var onSelectItem = function (license) {
|
|
106
|
+
var _a, _b, _c;
|
|
103
107
|
if (error)
|
|
104
108
|
dispatch(clearError());
|
|
105
109
|
selectedEntityLicenseControl.field.onChange(license);
|
|
@@ -107,10 +111,12 @@ var EntityLicenseList = function (_a) {
|
|
|
107
111
|
var license_1 = isKWCountry ? OTHER_CR_LICENSE : {};
|
|
108
112
|
setValue('selectedLicense', license_1, { shouldValidate: true });
|
|
109
113
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
114
|
+
setValue('unifiedNumber', '', { shouldValidate: true });
|
|
110
115
|
}
|
|
111
116
|
else {
|
|
112
117
|
setValue('selectedLicense', license, { shouldValidate: true });
|
|
113
|
-
setValue('licenseNumber',
|
|
118
|
+
setValue('licenseNumber', ((_a = license === null || license === void 0 ? void 0 : license.license) === null || _a === void 0 ? void 0 : _a.number) || '', { shouldValidate: true });
|
|
119
|
+
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
114
120
|
}
|
|
115
121
|
onCloseLicenseList();
|
|
116
122
|
};
|
|
@@ -122,7 +128,7 @@ var EntityLicenseList = function (_a) {
|
|
|
122
128
|
var selected = selectedEntityLicenseControl.field.value;
|
|
123
129
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
124
130
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
125
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_entity_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_entity'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: entityLicenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
131
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_entity_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_entity'), value: (isCR ? t(getLicenseName(selected)) : flValue) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: entityLicenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
126
132
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
127
133
|
} }) }))] }) })));
|
|
128
134
|
};
|
|
@@ -36,7 +36,7 @@ import { businessSelector, clearError } from '../../../app/business/businessStor
|
|
|
36
36
|
import Text from '../../../../components/Text';
|
|
37
37
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
38
38
|
import Collapse from '../../../../components/Collapse';
|
|
39
|
-
import { isKW, isOtherLicense } from '../../../../utils';
|
|
39
|
+
import { isKW, isOtherLicense, isSA } from '../../../../utils';
|
|
40
40
|
import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
|
|
41
41
|
import { settingsSelector } from '../../../../app/settings';
|
|
42
42
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
@@ -66,6 +66,7 @@ var LicenseList = function (_a) {
|
|
|
66
66
|
var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber, entityLegalName = businessTypeData.entityLegalName;
|
|
67
67
|
var licenseList = (responseBody || { licenseList: [] }).licenseList;
|
|
68
68
|
var country_code = settingsData.businessCountry.iso2;
|
|
69
|
+
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
69
70
|
var onOpenLicenseList = function (event) {
|
|
70
71
|
var _a;
|
|
71
72
|
setAnchorEl(event.currentTarget);
|
|
@@ -99,8 +100,10 @@ var LicenseList = function (_a) {
|
|
|
99
100
|
}
|
|
100
101
|
}, [country_code]);
|
|
101
102
|
var getLicenseNumber = function (item) {
|
|
102
|
-
var _a;
|
|
103
|
-
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.CR && isSACountry)
|
|
105
|
+
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
106
|
+
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
104
107
|
};
|
|
105
108
|
var getLicenseName = function (item) {
|
|
106
109
|
var _a, _b;
|
|
@@ -109,14 +112,18 @@ var LicenseList = function (_a) {
|
|
|
109
112
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
110
113
|
};
|
|
111
114
|
var onSelectItem = function (license) {
|
|
115
|
+
var _a, _b, _c;
|
|
112
116
|
if (error)
|
|
113
117
|
dispatch(clearError());
|
|
114
118
|
selectedLicenseControl.field.onChange(license);
|
|
115
|
-
if (isOtherLicense(license))
|
|
119
|
+
if (isOtherLicense(license)) {
|
|
116
120
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
setValue('unifiedNumber', '', { shouldValidate: true });
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
setValue('licenseNumber', ((_a = license === null || license === void 0 ? void 0 : license.license) === null || _a === void 0 ? void 0 : _a.number) || '', { shouldValidate: true });
|
|
125
|
+
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
126
|
+
}
|
|
120
127
|
onCloseLicenseList();
|
|
121
128
|
};
|
|
122
129
|
var getLicenseFullName = function (item) {
|
|
@@ -127,7 +134,7 @@ var LicenseList = function (_a) {
|
|
|
127
134
|
var selected = selectedLicenseControl.field.value;
|
|
128
135
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
129
136
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
130
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), 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) {
|
|
137
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), 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) {
|
|
131
138
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
132
139
|
} }) }))] }) })));
|
|
133
140
|
};
|
|
@@ -79,6 +79,6 @@ var UnifiedNumber = function (_a) {
|
|
|
79
79
|
var unifiedNumberValue = unifiedNumberControl.field.value;
|
|
80
80
|
var error = (_b = unifiedNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
81
81
|
var readOnly = !isOtherLicense(selectedLicense) || (selectedEntityLicense && !isOtherLicense(selectedEntityLicense));
|
|
82
|
-
return (_jsx(Collapse, __assign({ in: show
|
|
82
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('v1_company_unified_number_label') }), _jsx(Tooltip, __assign({ title: t('v1_company_unified_number_description'), onMouseOver: function () { return setHovered(true); }, onMouseLeave: function () { return setHovered(false); }, onTouchStartCapture: function () { return setHovered(true); } }, { children: hovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('v1_company_unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) })] })) })));
|
|
83
83
|
};
|
|
84
84
|
export default React.memo(UnifiedNumber);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { REGEX_BRAND_NAME, KW_MIN_LICENSE_LENGTH, MAX_FILE_SIZE, VALID_FILE_FORMATS, FL_MIN_LICENSE_LENGTH,
|
|
2
|
+
import { REGEX_BRAND_NAME, KW_MIN_LICENSE_LENGTH, MAX_FILE_SIZE, VALID_FILE_FORMATS, FL_MIN_LICENSE_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
3
3
|
import { BusinessType } from '../../../../@types';
|
|
4
4
|
import { isOtherLicense } from '../../../../utils';
|
|
5
5
|
var objectElements = {
|
|
@@ -8,7 +8,7 @@ var objectElements = {
|
|
|
8
8
|
en: yup.string()
|
|
9
9
|
}),
|
|
10
10
|
license: yup.object().shape({
|
|
11
|
-
number: yup.string()
|
|
11
|
+
number: yup.string().nullable()
|
|
12
12
|
}),
|
|
13
13
|
type: yup.string()
|
|
14
14
|
};
|
|
@@ -43,11 +43,8 @@ export var LicenseValidationSchema = yup.object().shape({
|
|
|
43
43
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
44
44
|
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
45
45
|
return false;
|
|
46
|
-
if (isCR)
|
|
47
|
-
|
|
48
|
-
return true;
|
|
49
|
-
return length >= CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
|
|
50
|
-
}
|
|
46
|
+
if (isCR || !isOtherLicense(selectedEntityLicense))
|
|
47
|
+
return true;
|
|
51
48
|
if (length === 0)
|
|
52
49
|
return this.createError({ message: '' });
|
|
53
50
|
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
@@ -105,8 +105,10 @@ var LicenseList = function (_a) {
|
|
|
105
105
|
}
|
|
106
106
|
}, [country_code]);
|
|
107
107
|
var getLicenseNumber = function (item) {
|
|
108
|
-
var _a;
|
|
109
|
-
|
|
108
|
+
var _a, _b, _c;
|
|
109
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.CR && isSACountry)
|
|
110
|
+
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
111
|
+
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
110
112
|
};
|
|
111
113
|
var getLicenseName = function (item) {
|
|
112
114
|
var _a, _b;
|
|
@@ -115,14 +117,18 @@ var LicenseList = function (_a) {
|
|
|
115
117
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
116
118
|
};
|
|
117
119
|
var onSelectItem = function (license) {
|
|
120
|
+
var _a, _b, _c;
|
|
118
121
|
if (error)
|
|
119
122
|
dispatch(clearError());
|
|
120
123
|
selectedLicenseControl.field.onChange(license);
|
|
121
|
-
if (isOtherLicense(license))
|
|
124
|
+
if (isOtherLicense(license)) {
|
|
122
125
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
setValue('unifiedNumber', '', { shouldValidate: true });
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
setValue('licenseNumber', ((_a = license === null || license === void 0 ? void 0 : license.license) === null || _a === void 0 ? void 0 : _a.number) || '', { shouldValidate: true });
|
|
130
|
+
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
131
|
+
}
|
|
126
132
|
onCloseLicenseList();
|
|
127
133
|
};
|
|
128
134
|
var getLicenseFullName = function (item) {
|
|
@@ -143,7 +149,7 @@ var LicenseList = function (_a) {
|
|
|
143
149
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
144
150
|
var isFL = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.FL;
|
|
145
151
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
146
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry || isOtherThanKWOrSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, 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) {
|
|
152
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry || isOtherThanKWOrSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, 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) {
|
|
147
153
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
148
154
|
} }) }))] })), _jsx(LicenseType, { show: show && isKWCountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: showLicenseNumber(), readOnly: licenseReadonly }), _jsx(UnifiedNumber, { show: isSACountry && isCR && show, readOnly: licenseReadonly })] }));
|
|
149
155
|
};
|
|
@@ -42,12 +42,12 @@ var LicenseNumber = function (_a) {
|
|
|
42
42
|
var clearLicenseNumber = function () {
|
|
43
43
|
licenseNumberControl.field.onChange('');
|
|
44
44
|
};
|
|
45
|
-
var licenseNumberValue = licenseNumberControl.field.value;
|
|
45
|
+
var licenseNumberValue = licenseNumberControl.field.value || '';
|
|
46
46
|
var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
47
47
|
var length = isKWCountry || isOtherThanKWOrSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
|
|
48
48
|
var minLength = isKWCountry || isOtherThanKWOrSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
|
|
49
49
|
var label = isCR ? 'cr_number' : 'fl_number';
|
|
50
50
|
var showCheckIcon = isKWCountry || isOtherThanKWOrSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
|
|
51
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: isKWCountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || (readOnly && licenseNumberValue) ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
|
|
51
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: isKWCountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || (readOnly && licenseNumberValue) ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) })) })));
|
|
52
52
|
};
|
|
53
53
|
export default React.memo(LicenseNumber);
|
|
@@ -74,7 +74,7 @@ var UnifiedNumber = function (_a) {
|
|
|
74
74
|
unifiedNumberControl.field.onChange(value);
|
|
75
75
|
};
|
|
76
76
|
var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
|
|
77
|
-
var unifiedNumberValue = unifiedNumberControl.field.value;
|
|
77
|
+
var unifiedNumberValue = unifiedNumberControl.field.value || '';
|
|
78
78
|
var error = (_b = unifiedNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
79
79
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('v1_company_unified_number_label') }), _jsx(Tooltip, __assign({ title: t('v1_company_unified_number_description'), onMouseOver: function () { return setHovered(true); }, onMouseLeave: function () { return setHovered(false); }, onTouchStartCapture: function () { return setHovered(true); } }, { children: hovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('v1_company_unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) })] })) })));
|
|
80
80
|
};
|
|
@@ -17,34 +17,16 @@ export declare const BusinessDataSchema: (isLeadIdPassed: boolean) => yup.Object
|
|
|
17
17
|
selectedLicense: any;
|
|
18
18
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
19
19
|
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
|
-
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
21
20
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
22
21
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
22
|
selectedLicense: any;
|
|
24
23
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
24
|
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
|
-
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
27
25
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
28
26
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
27
|
selectedLicense: any;
|
|
30
28
|
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
31
29
|
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
|
-
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
33
|
-
}>>> | yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
34
|
-
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
35
|
-
selectedLicense: any;
|
|
36
|
-
unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
37
|
-
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
38
|
-
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
39
|
-
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
40
|
-
selectedLicense: any;
|
|
41
|
-
unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
42
|
-
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
43
|
-
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
44
|
-
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
45
|
-
selectedLicense: any;
|
|
46
|
-
unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
47
|
-
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
48
30
|
}>>>;
|
|
49
31
|
export declare const KWBusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
50
32
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -7,7 +7,7 @@ var objectElements = {
|
|
|
7
7
|
en: yup.string()
|
|
8
8
|
}),
|
|
9
9
|
license: yup.object().shape({
|
|
10
|
-
number: yup.string()
|
|
10
|
+
number: yup.string().nullable()
|
|
11
11
|
}),
|
|
12
12
|
type: yup.string()
|
|
13
13
|
};
|
|
@@ -145,35 +145,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
145
145
|
})
|
|
146
146
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
147
147
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
148
|
-
unifiedNumber: yup
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
unifiedNumber: yup.string().test({
|
|
149
|
+
name: 'unifiedNumber',
|
|
150
|
+
message: '',
|
|
151
151
|
test: function (value) {
|
|
152
|
+
var _a;
|
|
152
153
|
var selectedLicense = this.parent.selectedLicense;
|
|
153
|
-
var
|
|
154
|
+
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
154
155
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
155
|
-
if (
|
|
156
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
157
|
+
return false;
|
|
158
|
+
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
156
159
|
return true;
|
|
157
|
-
if (
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
return true;
|
|
160
|
+
if (length === 0)
|
|
161
|
+
return this.createError({ message: '' });
|
|
162
|
+
return this.createError({ message: 'unified_number_required' });
|
|
161
163
|
}
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
.test({
|
|
164
|
+
}),
|
|
165
|
+
licenseNumber: yup.string().test({
|
|
166
|
+
name: 'licenseNumber',
|
|
167
|
+
message: '',
|
|
167
168
|
test: function (value) {
|
|
169
|
+
var _a;
|
|
168
170
|
var selectedLicense = this.parent.selectedLicense;
|
|
169
171
|
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
170
172
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
171
|
-
if (
|
|
173
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
174
|
+
return false;
|
|
175
|
+
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
172
176
|
return true;
|
|
173
|
-
|
|
177
|
+
if (length === 0)
|
|
178
|
+
return this.createError({ message: '' });
|
|
179
|
+
return this.createError({ message: 'fl_max_length' });
|
|
174
180
|
}
|
|
175
181
|
})
|
|
176
|
-
.required('')
|
|
177
182
|
});
|
|
178
183
|
};
|
|
179
184
|
export var KWBusinessDataSchema = function (isLeadIdPassed) {
|
|
@@ -177,7 +177,7 @@ export default function FlowsButtons(_a) {
|
|
|
177
177
|
});
|
|
178
178
|
if (flowName === item.name && !isResetPassword(item.name, item.status)) {
|
|
179
179
|
var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
|
|
180
|
-
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
|
|
180
|
+
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry, data.terminalStepName)));
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
|
|
@@ -19,6 +19,7 @@ interface SuccessFlowButtonsProps {
|
|
|
19
19
|
onClose?: () => void;
|
|
20
20
|
loading?: boolean;
|
|
21
21
|
status: 'complete' | 'incomplete';
|
|
22
|
+
terminalStepName?: string;
|
|
22
23
|
}
|
|
23
|
-
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status }: SuccessFlowButtonsProps) => JSX.Element>;
|
|
24
|
+
declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals, recipient, onClose, loading, status, terminalStepName }: SuccessFlowButtonsProps) => JSX.Element>;
|
|
24
25
|
export default _default;
|
|
@@ -45,7 +45,7 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
45
45
|
});
|
|
46
46
|
var SuccessFlowButtons = function (_a) {
|
|
47
47
|
var _b, _c, _d;
|
|
48
|
-
var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status;
|
|
48
|
+
var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals, recipient = _a.recipient, onClose = _a.onClose, loading = _a.loading, status = _a.status, terminalStepName = _a.terminalStepName;
|
|
49
49
|
var _e = useState([]), buttons = _e[0], setButtons = _e[1];
|
|
50
50
|
var t = useTranslation().t;
|
|
51
51
|
var isAr = useLanguage().isAr;
|
|
@@ -127,7 +127,8 @@ var SuccessFlowButtons = function (_a) {
|
|
|
127
127
|
email: email || '',
|
|
128
128
|
emailUrl: url,
|
|
129
129
|
brandName: shortenBrand(brandName),
|
|
130
|
-
isAuthorizedUser: is_authorized
|
|
130
|
+
isAuthorizedUser: is_authorized,
|
|
131
|
+
terminalStepName: terminalStepName
|
|
131
132
|
} }) })] }));
|
|
132
133
|
};
|
|
133
134
|
export default memo(SuccessFlowButtons);
|
|
@@ -14,6 +14,8 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
16
16
|
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
17
|
+
import Button from '../../../../components/Button';
|
|
18
|
+
import Loader from '../../../../components/Loader';
|
|
17
19
|
import { ICONS_NAMES } from '../../../../constants';
|
|
18
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
21
|
import { linkNewTerminal, retrieveBoardDetails, retrieveBoardStatus, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
@@ -51,6 +53,6 @@ var NoTerminalDeviceLinked = function () {
|
|
|
51
53
|
})
|
|
52
54
|
.catch(function () { });
|
|
53
55
|
};
|
|
54
|
-
return (
|
|
56
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { ml: 2.5, mr: 2.5 }, minHeight: 280, justifyContent: 'space-between' }, { children: [_jsxs(NoTerminalDeviceLinkedContainer, { children: [_jsx(DeviceImage, { src: ICONS_NAMES.terminal_device }), _jsx(TitleTypography, { children: t('terminal_no_terminal_linked') }), _jsx(DescriptionTypography, { children: t('terminal_no_terminal_linked_description') })] }), _jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return handleOnBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') }))] })));
|
|
55
57
|
};
|
|
56
58
|
export default React.memo(NoTerminalDeviceLinked);
|
|
@@ -13,19 +13,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { memo } from 'react';
|
|
14
14
|
import { settingsSelector } from '../../../../app/settings';
|
|
15
15
|
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
16
|
-
import { SCOPE_AUTH } from '../../../../constants';
|
|
16
|
+
import { CONNECT_FLOWS, SCOPE_AUTH } from '../../../../constants';
|
|
17
17
|
import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
|
|
18
18
|
import { onCloseCompleteTerminal, terminalSelector } from '../../../app/terminal/terminalStore';
|
|
19
19
|
var SuccessWithFlowButtons = function () {
|
|
20
|
+
var _a;
|
|
20
21
|
var dispatch = useAppDispatch();
|
|
21
|
-
var
|
|
22
|
+
var _b = useAppSelector(terminalSelector), data = _b.data, loading = _b.loading;
|
|
22
23
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
23
24
|
var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
25
|
+
var _c = data.responseData || {}, boardFlows = _c.boardFlows, boardData = _c.boardData, terminalData = _c.terminalData;
|
|
26
|
+
var _d = boardData || {}, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, user = _d.user, business = _d.business, board_id = _d.board_id, board_info_id = _d.board_info_id, name = _d.name, individuals = _d.individuals, recipient = _d.recipient, board_status = _d.board_status;
|
|
26
27
|
var onClose = function () {
|
|
27
28
|
dispatch(onCloseCompleteTerminal());
|
|
28
29
|
};
|
|
29
|
-
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status }));
|
|
30
|
+
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: boardFlows || [], onClose: isScopeAuthentication ? onClose : undefined, recipient: recipient, status: board_status, terminalStepName: ((_a = terminalData === null || terminalData === void 0 ? void 0 : terminalData.terminal_devices) === null || _a === void 0 ? void 0 : _a.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked }));
|
|
30
31
|
};
|
|
31
32
|
export default memo(SuccessWithFlowButtons);
|
package/build/utils/string.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
|
|
|
43
43
|
};
|
|
44
44
|
export declare const removeRequestHeaders: () => void;
|
|
45
45
|
export declare const getBaseUrl: () => string;
|
|
46
|
-
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean) => string;
|
|
46
|
+
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean, terminalStepName?: string) => string;
|
|
47
47
|
export declare const getEighteenYearsAgo: () => string;
|
|
48
48
|
export declare const isKW: (flag: string) => boolean;
|
|
49
49
|
export declare const isSA: (flag: string) => boolean;
|
package/build/utils/string.js
CHANGED
|
@@ -179,7 +179,7 @@ export var getBaseUrl = function () {
|
|
|
179
179
|
}
|
|
180
180
|
return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
181
181
|
};
|
|
182
|
-
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry) {
|
|
182
|
+
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry, terminalStepName) {
|
|
183
183
|
if (flow === FlowsTypes.BANK) {
|
|
184
184
|
return 'BANK_BANK_DETAILS_STEP';
|
|
185
185
|
}
|
|
@@ -205,7 +205,7 @@ export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherT
|
|
|
205
205
|
return 'PASSWORD_CREATE_PASSWORD_STEP';
|
|
206
206
|
}
|
|
207
207
|
if (flow === FlowsTypes.TERMINAL) {
|
|
208
|
-
return CONNECT_FLOWS.terminal.terminalDeviceList;
|
|
208
|
+
return terminalStepName !== null && terminalStepName !== void 0 ? terminalStepName : CONNECT_FLOWS.terminal.terminalDeviceList;
|
|
209
209
|
}
|
|
210
210
|
return '';
|
|
211
211
|
};
|