@tap-payments/auth-jsconnect 2.3.18-test → 2.3.22-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/@types/app.d.ts +5 -0
- package/build/@types/app.js +6 -0
- package/build/features/app/brand/brandStore.d.ts +3 -3
- package/build/features/app/brand/brandStore.js +5 -7
- package/build/features/app/business/businessStore.js +2 -2
- package/build/features/app/entity/entityStore.js +5 -4
- package/build/features/brand/screens/BrandActivities/RefundPolicy.js +14 -3
- package/build/features/brand/screens/BrandActivities/TAC.js +13 -3
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +14 -3
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +19 -14
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +7 -25
- package/build/features/brand/screens/BrandInfo/validation.d.ts +1 -1
- package/build/features/brand/screens/BrandInfo/validation.js +3 -5
- package/build/features/business/screens/Activities/OperationStartDate.js +1 -1
- package/build/features/entity/screens/EntityCapital/ActivityList.js +8 -5
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +5 -2
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +5 -2
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +5 -2
- package/build/features/entity/screens/EntityName/Article.js +7 -3
- package/build/features/entity/screens/EntityName/EntityTypeList.js +13 -6
- package/build/features/entity/screens/EntityName/LegalName.js +6 -3
- package/build/features/entity/screens/EntityName/LicenseCertificate.js +6 -2
- package/build/features/entity/screens/EntityName/LicenseNumber.js +6 -3
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +6 -3
- package/build/utils/object.d.ts +4 -0
- package/build/utils/object.js +17 -0
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
package/build/@types/app.js
CHANGED
|
@@ -68,3 +68,9 @@ export var DocumentPurpose;
|
|
|
68
68
|
DocumentPurpose["CUSTOMER_SIGNATURE"] = "customer_signature";
|
|
69
69
|
DocumentPurpose["TAX_DOCUMENT"] = "tax_document_user_upload";
|
|
70
70
|
})(DocumentPurpose || (DocumentPurpose = {}));
|
|
71
|
+
export var VerificationStatus;
|
|
72
|
+
(function (VerificationStatus) {
|
|
73
|
+
VerificationStatus["VERIFIED"] = "verified";
|
|
74
|
+
VerificationStatus["ENTERED"] = "entered";
|
|
75
|
+
VerificationStatus["NOT_ENTERED"] = "not_entered";
|
|
76
|
+
})(VerificationStatus || (VerificationStatus = {}));
|
|
@@ -61,8 +61,8 @@ export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").Asyn
|
|
|
61
61
|
}, {}>;
|
|
62
62
|
export declare const updateBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
63
63
|
data: any;
|
|
64
|
-
formData: BrandFormValues
|
|
65
|
-
}, BrandFormValues, {}>;
|
|
64
|
+
formData: Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">;
|
|
65
|
+
}, Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">, {}>;
|
|
66
66
|
export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
67
67
|
leadId: string;
|
|
68
68
|
}, {}>;
|
|
@@ -86,7 +86,7 @@ declare type VerifyData = {
|
|
|
86
86
|
export interface BrandData {
|
|
87
87
|
verify: ResponseData & VerifyData;
|
|
88
88
|
otpData: OTPFormValues & ResponseData;
|
|
89
|
-
brandData: BrandFormValues & ResponseData;
|
|
89
|
+
brandData: Omit<BrandFormValues, 'selectedBrandItem' | 'termAndConditionChecked'> & ResponseData;
|
|
90
90
|
brandActivities: BrandActivitiesFormValues & ResponseData;
|
|
91
91
|
flowName: FlowsTypes;
|
|
92
92
|
}
|
|
@@ -272,9 +272,9 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (params,
|
|
|
272
272
|
teamSizeId = teamSize && { id: teamSize.id };
|
|
273
273
|
getAddress = function (value, isTwitter, isWeb) {
|
|
274
274
|
if (isTwitter)
|
|
275
|
-
return '@' + value;
|
|
275
|
+
return '@' + value.replaceAll('@', '');
|
|
276
276
|
if (isWeb)
|
|
277
|
-
return 'https://' + value;
|
|
277
|
+
return 'https://www.' + value.replaceAll('https://www.', '');
|
|
278
278
|
return value;
|
|
279
279
|
};
|
|
280
280
|
channel_services = isChannelServicesEditable
|
|
@@ -444,9 +444,7 @@ var initialState = {
|
|
|
444
444
|
},
|
|
445
445
|
brandData: {
|
|
446
446
|
brandName: '',
|
|
447
|
-
salesChannels: []
|
|
448
|
-
termAndConditionChecked: false,
|
|
449
|
-
selectedBrandItem: {}
|
|
447
|
+
salesChannels: []
|
|
450
448
|
},
|
|
451
449
|
brandActivities: {
|
|
452
450
|
activities: [],
|
|
@@ -485,7 +483,7 @@ export var brandSlice = createSlice({
|
|
|
485
483
|
state.customLoading = false;
|
|
486
484
|
var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse, segmentsList = _e.segmentsList, teamSizeList = _e.teamSizeList, salesChannels = _e.salesChannels;
|
|
487
485
|
var brand = boardResponse.brand, entity = boardResponse.entity;
|
|
488
|
-
state.data.brandData.brandName = (_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en;
|
|
486
|
+
state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
|
|
489
487
|
var selectedSegment = (_b = segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.filter(function (segment) {
|
|
490
488
|
var _a, _b;
|
|
491
489
|
return segment.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id);
|
|
@@ -538,7 +536,7 @@ export var brandSlice = createSlice({
|
|
|
538
536
|
var brand = boardResponse.brand, entity = boardResponse.entity;
|
|
539
537
|
state.data.otpData = formData;
|
|
540
538
|
state.data.otpData.responseBody = data;
|
|
541
|
-
state.data.brandData.brandName = (_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en;
|
|
539
|
+
state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
|
|
542
540
|
var selectedSegment = (_b = segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.filter(function (segment) {
|
|
543
541
|
var _a, _b;
|
|
544
542
|
return segment.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id);
|
|
@@ -781,7 +781,7 @@ export var businessSlice = createSlice({
|
|
|
781
781
|
if (isRequireOTP)
|
|
782
782
|
return;
|
|
783
783
|
var _e = state.data.verify.responseBody || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
|
|
784
|
-
var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date)
|
|
784
|
+
var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
|
|
785
785
|
if (issuingDate)
|
|
786
786
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
787
787
|
var activities = entity_activities || [];
|
|
@@ -848,7 +848,7 @@ export var businessSlice = createSlice({
|
|
|
848
848
|
state.data.otpData.responseBody = data;
|
|
849
849
|
state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
|
|
850
850
|
var _e = leadData || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
|
|
851
|
-
var issuingDate = ((_a = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date)
|
|
851
|
+
var issuingDate = ((_a = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
|
|
852
852
|
if (issuingDate)
|
|
853
853
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
854
854
|
var activities = entity_activities || [];
|
|
@@ -63,7 +63,7 @@ import { BusinessType, DocumentPurpose, FlowsTypes } from '../../../@types';
|
|
|
63
63
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
65
65
|
import moment from 'moment';
|
|
66
|
-
import { convertNumbers2English, getRecentDocumentBasedOnPurpose } from '../../../utils';
|
|
66
|
+
import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue } from '../../../utils';
|
|
67
67
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
|
|
68
68
|
var token = _a.token, isInternally = _a.isInternally;
|
|
69
69
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -242,14 +242,14 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
242
242
|
});
|
|
243
243
|
}); });
|
|
244
244
|
export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
245
|
-
var _a, settings, entity, entityData, _b, id, data_status, issuingDate, expiryDate, isFL, isLegalNameEditable, isLicenseTypeEditable, isEntityTypeEditable, isLicenseNumberEditable, isUnifiedNumberEditable, isIssuingDateEditable, isExpiryDateEditable, documentResponse, document, documentBody, documentBody, payload, data, list;
|
|
245
|
+
var _a, settings, entity, entityData, _b, id, data_status, data_verification, issuingDate, expiryDate, isFL, isLegalNameEditable, isLicenseTypeEditable, isEntityTypeEditable, isLicenseNumberEditable, isUnifiedNumberEditable, isIssuingDateEditable, isExpiryDateEditable, isEntityTypeVerified, documentResponse, document, documentBody, documentBody, payload, data, list;
|
|
246
246
|
var _c, _d;
|
|
247
247
|
return __generator(this, function (_e) {
|
|
248
248
|
switch (_e.label) {
|
|
249
249
|
case 0:
|
|
250
250
|
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
251
251
|
entityData = (entity.data.verify.responseBody || {}).entity;
|
|
252
|
-
_b = entityData || {}, id = _b.id, data_status = _b.data_status;
|
|
252
|
+
_b = entityData || {}, id = _b.id, data_status = _b.data_status, data_verification = _b.data_verification;
|
|
253
253
|
issuingDate = new Date(params.issuingDate).getTime();
|
|
254
254
|
expiryDate = new Date(params.expiryDate).getTime();
|
|
255
255
|
isFL = params.licenseType === BusinessType.FL;
|
|
@@ -260,6 +260,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
260
260
|
isUnifiedNumberEditable = true;
|
|
261
261
|
isIssuingDateEditable = true;
|
|
262
262
|
isExpiryDateEditable = true;
|
|
263
|
+
isEntityTypeVerified = hasVerifiedValue(data_verification, 'type');
|
|
263
264
|
documentResponse = undefined;
|
|
264
265
|
document = getRecentDocumentBasedOnPurpose(entityData === null || entityData === void 0 ? void 0 : entityData.documents, DocumentPurpose.CR);
|
|
265
266
|
if (!((params.certificateId || []).length > 0)) return [3, 4];
|
|
@@ -300,7 +301,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
300
301
|
}
|
|
301
302
|
: undefined
|
|
302
303
|
},
|
|
303
|
-
type: isEntityTypeEditable && params.entityType ? params.entityType : undefined,
|
|
304
|
+
type: !isEntityTypeVerified && isEntityTypeEditable && params.entityType ? params.entityType : undefined,
|
|
304
305
|
legal_name: isLegalNameEditable && params.legalName
|
|
305
306
|
? {
|
|
306
307
|
ar: params.legalName,
|
|
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
13
14
|
import Box from '@mui/material/Box';
|
|
14
15
|
import { styled, alpha } from '@mui/material/styles';
|
|
15
16
|
import CheckBox from '../../../../components/CheckBox';
|
|
@@ -24,6 +25,7 @@ import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
|
|
|
24
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
26
|
import { settingsSelector } from '../../../../app/settings';
|
|
26
27
|
import { useAppSelector } from '../../../../hooks';
|
|
28
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
27
29
|
export var ContainerStyled = styled(Box)(function (_a) {
|
|
28
30
|
var theme = _a.theme;
|
|
29
31
|
return ({
|
|
@@ -65,18 +67,27 @@ export var LinkStyled = styled(Link)(function (_a) {
|
|
|
65
67
|
});
|
|
66
68
|
});
|
|
67
69
|
var RefundPolicy = function () {
|
|
68
|
-
var _a;
|
|
70
|
+
var _a, _b, _c;
|
|
69
71
|
var t = useTranslation().t;
|
|
70
72
|
var isAr = useLanguage().isAr;
|
|
71
73
|
var control = useFormContext().control;
|
|
72
74
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
75
|
+
var data = useAppSelector(brandSelector).data;
|
|
76
|
+
var terms = (_b = (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.terms;
|
|
73
77
|
var refundControl = useController({ control: control, name: 'refundPolicy' });
|
|
74
78
|
var refundChecked = refundControl.field.value;
|
|
75
|
-
var warningMessage = (
|
|
79
|
+
var warningMessage = (_c = refundControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
76
80
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
81
|
+
var disabled = React.useMemo(function () {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
|
|
84
|
+
var term = _a.term;
|
|
85
|
+
return term === 'refund';
|
|
86
|
+
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
87
|
+
}, [terms]);
|
|
77
88
|
var handleRefundCheckedChange = function (event, checked) {
|
|
78
89
|
refundControl.field.onChange(checked);
|
|
79
90
|
};
|
|
80
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: refundChecked, onChange: handleRefundCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_refund_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_EN, target: '_blank', underline: 'always' }, { children: t('refund_policy_compliance') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
91
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: refundChecked, onChange: handleRefundCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_refund_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_EN, target: '_blank', underline: 'always' }, { children: t('refund_policy_compliance') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
81
92
|
};
|
|
82
93
|
export default RefundPolicy;
|
|
@@ -25,6 +25,7 @@ import Collapse from '../../../../components/Collapse';
|
|
|
25
25
|
import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
|
|
26
26
|
import { settingsSelector } from '../../../../app/settings';
|
|
27
27
|
import { useAppSelector } from '../../../../hooks';
|
|
28
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
28
29
|
var TACContainerStyled = styled(Box)(function (_a) {
|
|
29
30
|
var theme = _a.theme;
|
|
30
31
|
return ({
|
|
@@ -66,19 +67,28 @@ var CollapseStyled = styled(Collapse)(function () { return ({
|
|
|
66
67
|
width: '100%'
|
|
67
68
|
}); });
|
|
68
69
|
var TAC = function (_a) {
|
|
69
|
-
var _b;
|
|
70
|
+
var _b, _c, _d;
|
|
70
71
|
var show = _a.show;
|
|
71
72
|
var t = useTranslation().t;
|
|
72
73
|
var isAr = useLanguage().isAr;
|
|
73
74
|
var control = useFormContext().control;
|
|
74
75
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
76
|
+
var data = useAppSelector(brandSelector).data;
|
|
77
|
+
var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
|
|
75
78
|
var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
|
|
76
79
|
var tacChecked = tacControl.field.value;
|
|
77
|
-
var warningMessage = (
|
|
80
|
+
var warningMessage = (_d = tacControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
78
81
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
82
|
+
var disabled = React.useMemo(function () {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
|
|
85
|
+
var term = _a.term;
|
|
86
|
+
return term === 'general';
|
|
87
|
+
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
88
|
+
}, [terms]);
|
|
79
89
|
var handleTACCheckedChange = function (event, checked) {
|
|
80
90
|
tacControl.field.onChange(checked);
|
|
81
91
|
};
|
|
82
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
|
|
92
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
|
|
83
93
|
};
|
|
84
94
|
export default React.memo(TAC);
|
|
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
13
14
|
import { styled } from '@mui/material/styles';
|
|
14
15
|
import Collapse from '../../../../components/Collapse';
|
|
15
16
|
import { useTranslation } from 'react-i18next';
|
|
@@ -21,22 +22,32 @@ import { ContainerStyled, CheckboxStyled, TextStyled, LinkStyled } from './Refun
|
|
|
21
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
23
|
import { settingsSelector } from '../../../../app/settings';
|
|
23
24
|
import { useAppSelector } from '../../../../hooks';
|
|
25
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
24
26
|
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
25
27
|
width: '100%'
|
|
26
28
|
}); });
|
|
27
29
|
var TransactionPolicy = function () {
|
|
28
|
-
var _a;
|
|
30
|
+
var _a, _b, _c;
|
|
29
31
|
var t = useTranslation().t;
|
|
30
32
|
var isAr = useLanguage().isAr;
|
|
31
33
|
var control = useFormContext().control;
|
|
32
34
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
35
|
+
var data = useAppSelector(brandSelector).data;
|
|
36
|
+
var terms = (_b = (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.terms;
|
|
33
37
|
var transactionControl = useController({ control: control, name: 'transactionPolicy' });
|
|
34
38
|
var transactionChecked = transactionControl.field.value;
|
|
35
|
-
var warningMessage = (
|
|
39
|
+
var warningMessage = (_c = transactionControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
36
40
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
41
|
+
var disabled = React.useMemo(function () {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
|
|
44
|
+
var term = _a.term;
|
|
45
|
+
return term === 'chargeback';
|
|
46
|
+
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
47
|
+
}, [terms]);
|
|
37
48
|
var handleTransactionCheckedChange = function (event, checked) {
|
|
38
49
|
transactionControl.field.onChange(checked);
|
|
39
50
|
};
|
|
40
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: transactionChecked, onChange: handleTransactionCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_chargeback_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_EN, target: '_blank', underline: 'always' }, { children: t('chargeback_policy') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
51
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: transactionChecked, onChange: handleTransactionCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_chargeback_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_EN, target: '_blank', underline: 'always' }, { children: t('chargeback_policy') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
41
52
|
};
|
|
42
53
|
export default TransactionPolicy;
|
|
@@ -19,32 +19,40 @@ import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues }
|
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
22
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
22
23
|
import { clearError, brandSelector, updateBrand } from '../../../app/brand/brandStore';
|
|
23
24
|
import { useTranslation } from 'react-i18next';
|
|
25
|
+
import TeamSize from '../../../../features/brand/screens/BrandInfo/TeamSize';
|
|
26
|
+
import Collapse from '../../../../components/Collapse';
|
|
27
|
+
import { mapSalesChannel } from '../../../../utils';
|
|
24
28
|
import BrandName from './BrandName';
|
|
25
29
|
import Segments from './Segments';
|
|
26
30
|
import SalesChannels from './SalesChannels';
|
|
27
|
-
import TeamSize from '../../../../features/brand/screens/BrandInfo/TeamSize';
|
|
28
|
-
import Collapse from '../../../../components/Collapse';
|
|
29
31
|
var FormStyled = styled(Form)(function () { return ({
|
|
30
32
|
display: 'flex',
|
|
31
33
|
flexDirection: 'column'
|
|
32
34
|
}); });
|
|
35
|
+
var ListType;
|
|
36
|
+
(function (ListType) {
|
|
37
|
+
ListType["SegmentsList"] = "SegmentsList";
|
|
38
|
+
ListType["TeamSizeList"] = "TeamSizeList";
|
|
39
|
+
})(ListType || (ListType = {}));
|
|
33
40
|
var BrandInfo = function (_a) {
|
|
34
41
|
var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
|
|
35
42
|
var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
|
|
36
43
|
var dispatch = useAppDispatch();
|
|
44
|
+
var t = useTranslation().t;
|
|
45
|
+
var isAr = useLanguage().isAr;
|
|
46
|
+
var settingData = useAppSelector(settingsSelector).data;
|
|
37
47
|
var _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
38
|
-
var _e = data.brandData, brandName = _e.brandName, segment = _e.segment, teamSize = _e.teamSize, salesChannels = _e.salesChannels,
|
|
48
|
+
var _e = data.brandData, brandName = _e.brandName, segment = _e.segment, teamSize = _e.teamSize, salesChannels = _e.salesChannels, responseBody = _e.responseBody;
|
|
39
49
|
var methods = useForm({
|
|
40
|
-
resolver: yupResolver(BrandValidationSchema(
|
|
50
|
+
resolver: yupResolver(BrandValidationSchema()),
|
|
41
51
|
defaultValues: {
|
|
42
52
|
brandName: brandName,
|
|
43
53
|
segment: segment,
|
|
44
54
|
teamSize: teamSize,
|
|
45
|
-
salesChannels: salesChannels
|
|
46
|
-
termAndConditionChecked: termAndConditionChecked,
|
|
47
|
-
selectedBrandItem: selectedBrandItem
|
|
55
|
+
salesChannels: salesChannels
|
|
48
56
|
},
|
|
49
57
|
mode: 'onChange'
|
|
50
58
|
});
|
|
@@ -52,21 +60,18 @@ var BrandInfo = function (_a) {
|
|
|
52
60
|
var onSubmit = function (data) {
|
|
53
61
|
dispatch(updateBrand(data));
|
|
54
62
|
};
|
|
55
|
-
var ListType;
|
|
56
|
-
(function (ListType) {
|
|
57
|
-
ListType["SegmentsList"] = "SegmentsList";
|
|
58
|
-
ListType["TeamSizeList"] = "TeamSizeList";
|
|
59
|
-
})(ListType || (ListType = {}));
|
|
60
63
|
React.useEffect(function () {
|
|
61
64
|
if (error)
|
|
62
65
|
dispatch(clearError());
|
|
63
66
|
}, [methods.formState.isValid]);
|
|
67
|
+
React.useEffect(function () {
|
|
68
|
+
if (salesChannels.length)
|
|
69
|
+
methods.setValue('salesChannels', mapSalesChannel(salesChannels), { shouldValidate: true });
|
|
70
|
+
}, []);
|
|
64
71
|
React.useEffect(function () {
|
|
65
72
|
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
|
|
66
73
|
methods.setError('brandName', { message: 'brand_name_already_exist' });
|
|
67
74
|
}, [responseBody]);
|
|
68
|
-
var t = useTranslation().t;
|
|
69
|
-
var isAr = useLanguage().isAr;
|
|
70
75
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
71
76
|
var disabled = brandErrChecks || brandNameChecking;
|
|
72
77
|
var handleMenuClick = function (flag) {
|
|
@@ -1,42 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useController, useFormContext } from 'react-hook-form';
|
|
4
|
-
import { FieldType } from '../../../../@types';
|
|
5
4
|
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
6
5
|
import { mapSalesChannel } from '../../../../utils';
|
|
7
6
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
8
7
|
import SalesChannel from '../../../shared/SalesChannels';
|
|
9
8
|
var SalesChannels = function (_a) {
|
|
10
|
-
var _b
|
|
11
|
-
var
|
|
9
|
+
var _b;
|
|
10
|
+
var control = useFormContext().control;
|
|
12
11
|
var dispatch = useAppDispatch();
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var _g = verify.responseBody || {}, channelList = _g.channel_list, brand = _g.brand;
|
|
18
|
-
var isNonEditable = ((_b = brand === null || brand === void 0 ? void 0 : brand.data_status) === null || _b === void 0 ? void 0 : _b.name) === FieldType.NON_EDITABLE;
|
|
19
|
-
var selectedBrandControl = getValues('selectedBrandItem');
|
|
20
|
-
React.useEffect(function () {
|
|
21
|
-
if (selectedBrandItem.id) {
|
|
22
|
-
setValue('selectedBrandItem', selectedBrandItem);
|
|
23
|
-
var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
|
|
24
|
-
field.onChange(sales);
|
|
25
|
-
}
|
|
26
|
-
}, [selectedBrandItem]);
|
|
27
|
-
React.useEffect(function () {
|
|
28
|
-
var _a;
|
|
29
|
-
if ((defaultSalesChannels === null || defaultSalesChannels === void 0 ? void 0 : defaultSalesChannels.length) > 0 && ((_a = field === null || field === void 0 ? void 0 : field.value) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
30
|
-
var sales = mapSalesChannel(defaultSalesChannels);
|
|
31
|
-
field.onChange(sales);
|
|
32
|
-
}
|
|
33
|
-
}, [defaultSalesChannels]);
|
|
12
|
+
var _c = useController({ control: control, name: 'salesChannels' }), fieldState = _c.fieldState, field = _c.field;
|
|
13
|
+
var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
|
|
14
|
+
var channelList = (data.verify.responseBody || {}).channel_list;
|
|
15
|
+
var isNonEditable = false;
|
|
34
16
|
var selectedSalesChannels = React.useMemo(function () { return mapSalesChannel(field.value); }, [(field.value || []).length]);
|
|
35
17
|
var onChange = function (channels) {
|
|
36
18
|
if (error)
|
|
37
19
|
dispatch(clearError());
|
|
38
20
|
field.onChange(channels);
|
|
39
21
|
};
|
|
40
|
-
return (_jsx(SalesChannel, { disabled: isNonEditable, error: (
|
|
22
|
+
return (_jsx(SalesChannel, { disabled: isNonEditable, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
41
23
|
};
|
|
42
24
|
export default SalesChannels;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare const BrandValidationSchema: (
|
|
2
|
+
export declare const BrandValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
3
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
4
4
|
segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
5
5
|
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
@@ -7,7 +7,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
import { FieldType } from '../../../../@types';
|
|
11
10
|
import { REGEX_WEBSITE, LINKEDIN_URL, SOCIAL_USERNAME, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
|
|
12
11
|
import * as yup from 'yup';
|
|
13
12
|
var validationSalesChannels = function (channels) {
|
|
@@ -70,10 +69,9 @@ var validationSalesChannels = function (channels) {
|
|
|
70
69
|
}
|
|
71
70
|
return true;
|
|
72
71
|
};
|
|
73
|
-
export var BrandValidationSchema = function (
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var isSalesChannelsOptional = !channel_services && (data_status === null || data_status === void 0 ? void 0 : data_status.channel_services) === FieldType.NON_EDITABLE;
|
|
72
|
+
export var BrandValidationSchema = function () {
|
|
73
|
+
var isNameOptional = false;
|
|
74
|
+
var isSalesChannelsOptional = false;
|
|
77
75
|
return yup.object().shape({
|
|
78
76
|
brandName: isNameOptional
|
|
79
77
|
? yup.string().optional()
|
|
@@ -40,6 +40,6 @@ var OperationStartDate = function (_a) {
|
|
|
40
40
|
oDateControl.field.onChange(data);
|
|
41
41
|
};
|
|
42
42
|
var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
43
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) :
|
|
43
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : undefined, dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] }));
|
|
44
44
|
};
|
|
45
45
|
export default OperationStartDate;
|
|
@@ -38,7 +38,7 @@ import { alpha, styled } from '@mui/material/styles';
|
|
|
38
38
|
import InfoIcon from '@mui/icons-material/Info';
|
|
39
39
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
40
40
|
import CheckIcon from '@mui/icons-material/Check';
|
|
41
|
-
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
41
|
+
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
42
42
|
import { BusinessType } from '../../../../@types';
|
|
43
43
|
import { sortActivitiesByName } from '../../../../utils';
|
|
44
44
|
import Text from '../../../../components/Text';
|
|
@@ -48,7 +48,7 @@ import Collapse from '../../../../components/Collapse';
|
|
|
48
48
|
import SimpleList from '../../../../components/SimpleList';
|
|
49
49
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
50
50
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
51
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
51
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
52
52
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
53
53
|
var theme = _a.theme;
|
|
54
54
|
return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
@@ -109,12 +109,13 @@ var ActivitiesList = function (_a) {
|
|
|
109
109
|
var t = useTranslation().t;
|
|
110
110
|
var isAr = useLanguage().isAr;
|
|
111
111
|
var control = useFormContext().control;
|
|
112
|
-
var
|
|
112
|
+
var dispatch = useAppDispatch();
|
|
113
|
+
var _e = useAppSelector(entitySelector), data = _e.data, error = _e.error;
|
|
113
114
|
var activitiesControl = useController({ name: 'activities', control: control });
|
|
114
115
|
var controlValue = activitiesControl.field.value;
|
|
115
|
-
var
|
|
116
|
+
var _f = React.useState(false), isHovered = _f[0], setIsHovered = _f[1];
|
|
116
117
|
var verify = data.verify;
|
|
117
|
-
var
|
|
118
|
+
var _g = verify.responseBody || {}, activityList = _g.activityList, entity = _g.entity;
|
|
118
119
|
var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
|
|
119
120
|
var type = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
|
|
120
121
|
var isCR = type === BusinessType.CR;
|
|
@@ -144,6 +145,8 @@ var ActivitiesList = function (_a) {
|
|
|
144
145
|
};
|
|
145
146
|
var onSelectItem = function (item) {
|
|
146
147
|
var _a;
|
|
148
|
+
if (error)
|
|
149
|
+
dispatch(clearError());
|
|
147
150
|
var isActivityExistInBackend = (_a = entity === null || entity === void 0 ? void 0 : entity.activities) === null || _a === void 0 ? void 0 : _a.find(function (activity) { return activity.id === item.id; });
|
|
148
151
|
if (isActivityExistInBackend)
|
|
149
152
|
return;
|
|
@@ -14,24 +14,27 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
|
-
import { useAppSelector } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
19
|
import { findCurrencyByIso2, removeAllCharsFromNumber } from '../../../../utils';
|
|
20
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
21
|
import Input from '../../../shared/Input';
|
|
22
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
22
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
23
23
|
var CapitalPaid = function (_a) {
|
|
24
24
|
var _b, _c;
|
|
25
25
|
var t = useTranslation().t;
|
|
26
26
|
var data = useAppSelector(entitySelector).data;
|
|
27
27
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
28
28
|
var control = useFormContext().control;
|
|
29
|
+
var dispatch = useAppDispatch();
|
|
29
30
|
var entity = (data.verify.responseBody || {}).entity;
|
|
30
31
|
var paid = (_b = entity === null || entity === void 0 ? void 0 : entity.capital) === null || _b === void 0 ? void 0 : _b.paid;
|
|
31
32
|
var countryCode = settingsData.businessCountry.iso2;
|
|
32
33
|
var disabled = false;
|
|
33
34
|
var handleChange = function (_a) {
|
|
34
35
|
var target = _a.target;
|
|
36
|
+
if (error)
|
|
37
|
+
dispatch(clearError());
|
|
35
38
|
var value = removeAllCharsFromNumber(target.value);
|
|
36
39
|
capitalPaidControl.field.onChange(value);
|
|
37
40
|
};
|
|
@@ -14,22 +14,25 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
|
-
import { useAppSelector } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
18
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
21
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
21
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
22
22
|
var CapitalShareCount = function (_a) {
|
|
23
23
|
var _b, _c, _d;
|
|
24
24
|
var t = useTranslation().t;
|
|
25
25
|
var data = useAppSelector(entitySelector).data;
|
|
26
26
|
var control = useFormContext().control;
|
|
27
|
+
var dispatch = useAppDispatch();
|
|
27
28
|
var entity = (data.verify.responseBody || {}).entity;
|
|
28
29
|
var shareCount = (_c = (_b = entity === null || entity === void 0 ? void 0 : entity.capital) === null || _b === void 0 ? void 0 : _b.shares) === null || _c === void 0 ? void 0 : _c.count;
|
|
29
30
|
var disabled = false;
|
|
30
31
|
var hide = !shareCount && disabled;
|
|
31
32
|
var handleChange = function (_a) {
|
|
32
33
|
var target = _a.target;
|
|
34
|
+
if (error)
|
|
35
|
+
dispatch(clearError());
|
|
33
36
|
var value = removeAllCharsFromNumber(target.value);
|
|
34
37
|
capitalShareCountControl.field.onChange(value);
|
|
35
38
|
};
|
|
@@ -16,8 +16,8 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
17
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
18
18
|
import Input from '../../../shared/Input';
|
|
19
|
-
import { useAppSelector } from '../../../../hooks';
|
|
20
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
19
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
21
21
|
import { findCurrencyByIso2, removeAllCharsFromNumber } from '../../../../utils';
|
|
22
22
|
import { settingsSelector } from '../../../../app/settings';
|
|
23
23
|
var CapitalShareValue = function (_a) {
|
|
@@ -26,6 +26,7 @@ var CapitalShareValue = function (_a) {
|
|
|
26
26
|
var data = useAppSelector(entitySelector).data;
|
|
27
27
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
28
28
|
var control = useFormContext().control;
|
|
29
|
+
var dispatch = useAppDispatch();
|
|
29
30
|
var entity = (data.verify.responseBody || {}).entity;
|
|
30
31
|
var shareValue = (_c = (_b = entity === null || entity === void 0 ? void 0 : entity.capital) === null || _b === void 0 ? void 0 : _b.shares) === null || _c === void 0 ? void 0 : _c.value;
|
|
31
32
|
var countryCode = settingsData.businessCountry.iso2;
|
|
@@ -33,6 +34,8 @@ var CapitalShareValue = function (_a) {
|
|
|
33
34
|
var hide = !shareValue && disabled;
|
|
34
35
|
var handleChange = function (_a) {
|
|
35
36
|
var target = _a.target;
|
|
37
|
+
if (error)
|
|
38
|
+
dispatch(clearError());
|
|
36
39
|
var value = removeAllCharsFromNumber(target.value);
|
|
37
40
|
capitalShareValueControl.field.onChange(value);
|
|
38
41
|
};
|
|
@@ -19,7 +19,7 @@ import { FileRemoveType } from '../../../../constants';
|
|
|
19
19
|
import Collapse from '../../../../components/Collapse';
|
|
20
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
21
|
import { UploadWrapper } from '../../../shared/UploadFile';
|
|
22
|
-
import { entitySelector, uploadingArticleStatus, clearAOAFile } from '../../../app/entity/entityStore';
|
|
22
|
+
import { entitySelector, uploadingArticleStatus, clearAOAFile, clearError } from '../../../app/entity/entityStore';
|
|
23
23
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
24
24
|
var theme = _a.theme;
|
|
25
25
|
return ({
|
|
@@ -34,12 +34,16 @@ var Article = function (_a) {
|
|
|
34
34
|
var articleIdControl = useController({ name: 'articleId', control: control });
|
|
35
35
|
var loading = useAppSelector(entitySelector).loading;
|
|
36
36
|
var dispatch = useAppDispatch();
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var _c = useAppSelector(entitySelector), data = _c.data, error = _c.error;
|
|
38
|
+
var _d = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}, AOA_file = _d.AOA_file, id = _d.id;
|
|
39
39
|
var handleArticleChange = function (id) {
|
|
40
|
+
if (error)
|
|
41
|
+
dispatch(clearError());
|
|
40
42
|
articleIdControl.field.onChange(id);
|
|
41
43
|
};
|
|
42
44
|
var handleReset = function () {
|
|
45
|
+
if (error)
|
|
46
|
+
dispatch(clearError());
|
|
43
47
|
if (AOA_file)
|
|
44
48
|
dispatch(clearAOAFile());
|
|
45
49
|
articleIdControl.field.onChange(undefined);
|
|
@@ -29,17 +29,17 @@ import { alpha, styled, useTheme } from '@mui/material/styles';
|
|
|
29
29
|
import InfoIcon from '@mui/icons-material/Info';
|
|
30
30
|
import CheckIcon from '@mui/icons-material/Check';
|
|
31
31
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
32
|
-
import { useAppSelector } from '../../../../hooks';
|
|
32
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
33
33
|
import Text from '../../../../components/Text';
|
|
34
34
|
import Collapse from '../../../../components/Collapse';
|
|
35
35
|
import SimpleList from '../../../../components/SimpleList';
|
|
36
36
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
37
|
import Input from '../../../../components/Input';
|
|
38
38
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
39
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
39
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
40
40
|
import Search from '../../../shared/Search';
|
|
41
41
|
import SharedInput from '../../../shared/Input';
|
|
42
|
-
import { removeAllOtherThanAlphabet } from '../../../../utils';
|
|
42
|
+
import { hasVerifiedValue, removeAllOtherThanAlphabet } from '../../../../utils';
|
|
43
43
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
44
44
|
var theme = _a.theme;
|
|
45
45
|
return (__assign({ color: alpha(theme.palette.text.primary, 0.6) }, theme.typography.caption));
|
|
@@ -99,14 +99,17 @@ var EntityTypeList = function (_a) {
|
|
|
99
99
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
100
100
|
var t = useTranslation().t;
|
|
101
101
|
var control = useFormContext().control;
|
|
102
|
-
var
|
|
102
|
+
var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
|
|
103
103
|
var entityTypesControl = useController({ name: 'entityType', control: control });
|
|
104
104
|
var controlValue = entityTypesControl.field.value || '';
|
|
105
|
-
var
|
|
105
|
+
var dispatch = useAppDispatch();
|
|
106
|
+
var _e = data.verify.responseBody || {}, entityTypes = _e.entityTypes, entity = _e.entity;
|
|
106
107
|
var type = entity === null || entity === void 0 ? void 0 : entity.type;
|
|
107
108
|
var disabled = false;
|
|
108
|
-
var hide = !type && disabled;
|
|
109
109
|
var isListAvailable = (entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes.length) > 0;
|
|
110
|
+
var hide = React.useMemo(function () {
|
|
111
|
+
return (!type && disabled) || hasVerifiedValue(entity === null || entity === void 0 ? void 0 : entity.data_verification, 'type');
|
|
112
|
+
}, [type, disabled, entity === null || entity === void 0 ? void 0 : entity.data_verification]);
|
|
110
113
|
React.useEffect(function () {
|
|
111
114
|
if ((entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes.length) > 0) {
|
|
112
115
|
setEntityTypesMenuList(entityTypes);
|
|
@@ -123,11 +126,15 @@ var EntityTypeList = function (_a) {
|
|
|
123
126
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
124
127
|
};
|
|
125
128
|
var onSelectItem = function (item) {
|
|
129
|
+
if (error)
|
|
130
|
+
dispatch(clearError());
|
|
126
131
|
entityTypesControl.field.onChange(item);
|
|
127
132
|
onCloseList();
|
|
128
133
|
};
|
|
129
134
|
var handleChange = function (_a) {
|
|
130
135
|
var target = _a.target;
|
|
136
|
+
if (error)
|
|
137
|
+
dispatch(clearError());
|
|
131
138
|
var value = removeAllOtherThanAlphabet(target.value);
|
|
132
139
|
entityTypesControl.field.onChange(value);
|
|
133
140
|
};
|
|
@@ -14,16 +14,17 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { Collapse } from '@mui/material';
|
|
17
|
-
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
18
18
|
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
20
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
21
21
|
import Input from '../../../shared/Input';
|
|
22
22
|
var LegalName = function (_a) {
|
|
23
23
|
var t = useTranslation().t;
|
|
24
24
|
var isAr = useLanguage();
|
|
25
25
|
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
26
|
-
var
|
|
26
|
+
var dispatch = useAppDispatch();
|
|
27
|
+
var _c = useAppSelector(entitySelector), data = _c.data, error = _c.error;
|
|
27
28
|
var responseBody = data.verify.responseBody;
|
|
28
29
|
var entity = (responseBody || {}).entity;
|
|
29
30
|
var legalName = entity === null || entity === void 0 ? void 0 : entity.legal_name;
|
|
@@ -38,6 +39,8 @@ var LegalName = function (_a) {
|
|
|
38
39
|
}, [name]);
|
|
39
40
|
var handleChange = function (_a) {
|
|
40
41
|
var target = _a.target;
|
|
42
|
+
if (error)
|
|
43
|
+
dispatch(clearError());
|
|
41
44
|
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
42
45
|
legalNameControl.field.onChange(value);
|
|
43
46
|
};
|
|
@@ -20,7 +20,7 @@ import { FileType } from '../../../../constants';
|
|
|
20
20
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
21
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
22
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
-
import { entitySelector, uploadingStatus } from '../../../app/entity/entityStore';
|
|
23
|
+
import { clearError, entitySelector, uploadingStatus } from '../../../app/entity/entityStore';
|
|
24
24
|
import UploadMultipleFile from '../../../shared/UploadMultipleFile';
|
|
25
25
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
26
26
|
var theme = _a.theme;
|
|
@@ -35,12 +35,16 @@ var LicenseCertificate = function (_a) {
|
|
|
35
35
|
var control = useFormContext().control;
|
|
36
36
|
var dispatch = useAppDispatch();
|
|
37
37
|
var certificateIdControl = useController({ name: 'certificateId', control: control });
|
|
38
|
-
var _c = useAppSelector(entitySelector), loading = _c.loading, data = _c.data;
|
|
38
|
+
var _c = useAppSelector(entitySelector), loading = _c.loading, data = _c.data, error = _c.error;
|
|
39
39
|
var documents = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).documents;
|
|
40
40
|
var handleLicenseCertificateChange = function (ids) {
|
|
41
|
+
if (error)
|
|
42
|
+
dispatch(clearError());
|
|
41
43
|
certificateIdControl.field.onChange(ids);
|
|
42
44
|
};
|
|
43
45
|
var handleReset = function (ids) {
|
|
46
|
+
if (error)
|
|
47
|
+
dispatch(clearError());
|
|
44
48
|
certificateIdControl.field.onChange(ids);
|
|
45
49
|
};
|
|
46
50
|
var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CR); }, [documents]);
|
|
@@ -13,20 +13,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import { useAppSelector } from '../../../../hooks';
|
|
16
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
17
|
import { BusinessType } from '../../../../@types';
|
|
18
18
|
import { isSA, removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
19
19
|
import { settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import { CR_NUMBER_LENGTH, FL_NUMBER_ENTITY_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
21
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
22
|
import Input from '../../../shared/Input';
|
|
23
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
23
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
24
24
|
import Collapse from '../../../../components/Collapse';
|
|
25
25
|
var LicenseNumber = function (_a) {
|
|
26
26
|
var _b, _c;
|
|
27
27
|
var show = _a.show;
|
|
28
28
|
var t = useTranslation().t;
|
|
29
|
-
var
|
|
29
|
+
var _d = useAppSelector(entitySelector), data = _d.data, bckError = _d.error;
|
|
30
|
+
var dispatch = useAppDispatch();
|
|
30
31
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
31
32
|
var control = useFormContext().control;
|
|
32
33
|
var entity = (data.verify.responseBody || {}).entity;
|
|
@@ -37,6 +38,8 @@ var LicenseNumber = function (_a) {
|
|
|
37
38
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
38
39
|
var handleChange = function (_a) {
|
|
39
40
|
var target = _a.target;
|
|
41
|
+
if (bckError)
|
|
42
|
+
dispatch(clearError());
|
|
40
43
|
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
41
44
|
licenseNumberControl.field.onChange(value);
|
|
42
45
|
};
|
|
@@ -13,24 +13,27 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import { useAppSelector } from '../../../../hooks';
|
|
16
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
17
|
import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
18
18
|
import Collapse from '../../../../components/Collapse';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
21
|
-
import { entitySelector } from '../../../app/entity/entityStore';
|
|
21
|
+
import { clearError, entitySelector } from '../../../app/entity/entityStore';
|
|
22
22
|
var UnifiedNumber = function (_a) {
|
|
23
23
|
var _b, _c, _d;
|
|
24
24
|
var show = _a.show;
|
|
25
25
|
var t = useTranslation().t;
|
|
26
|
-
var
|
|
26
|
+
var _e = useAppSelector(entitySelector), data = _e.data, bckError = _e.error;
|
|
27
27
|
var control = useFormContext().control;
|
|
28
|
+
var dispatch = useAppDispatch();
|
|
28
29
|
var entity = (data.verify.responseBody || {}).entity;
|
|
29
30
|
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;
|
|
30
31
|
var disabled = false;
|
|
31
32
|
var hide = !number && disabled;
|
|
32
33
|
var handleChange = function (_a) {
|
|
33
34
|
var target = _a.target;
|
|
35
|
+
if (bckError)
|
|
36
|
+
dispatch(clearError());
|
|
34
37
|
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
35
38
|
unifiedNumberControl.field.onChange(value);
|
|
36
39
|
};
|
package/build/utils/object.d.ts
CHANGED
|
@@ -3,3 +3,7 @@ export declare const encodeObjectBase64: (obj: any) => string;
|
|
|
3
3
|
export declare const decodeObjectBase64: (str: string) => any;
|
|
4
4
|
export declare const hasKey: (obj: any, key: string) => boolean;
|
|
5
5
|
export declare const concatenateObjectValues: (data: Record<string, any>, keys: Array<string>) => string;
|
|
6
|
+
export declare const hasKeyValue: (obj: any, path: string, value: string | number | boolean) => boolean;
|
|
7
|
+
export declare const hasNoneEditableValue: (obj: any, path: string) => boolean;
|
|
8
|
+
export declare const hasEditableValue: (obj: any, path: string) => boolean;
|
|
9
|
+
export declare const hasVerifiedValue: (obj: any, path: string) => boolean;
|
package/build/utils/object.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { get } from 'lodash-es';
|
|
2
|
+
import { FieldType, VerificationStatus } from '../@types';
|
|
1
3
|
export var compareTwoObjects = function (obj1, obj2) {
|
|
2
4
|
if (obj1 === obj2)
|
|
3
5
|
return true;
|
|
@@ -33,3 +35,18 @@ export var concatenateObjectValues = function (data, keys) {
|
|
|
33
35
|
}
|
|
34
36
|
return result.trim();
|
|
35
37
|
};
|
|
38
|
+
export var hasKeyValue = function (obj, path, value) {
|
|
39
|
+
return get(obj, path) === value;
|
|
40
|
+
};
|
|
41
|
+
export var hasNoneEditableValue = function (obj, path) {
|
|
42
|
+
var value = FieldType.NON_EDITABLE;
|
|
43
|
+
return hasKeyValue(obj, path, value);
|
|
44
|
+
};
|
|
45
|
+
export var hasEditableValue = function (obj, path) {
|
|
46
|
+
var value = FieldType.EDITABLE;
|
|
47
|
+
return hasKeyValue(obj, path, value);
|
|
48
|
+
};
|
|
49
|
+
export var hasVerifiedValue = function (obj, path) {
|
|
50
|
+
var value = VerificationStatus.VERIFIED;
|
|
51
|
+
return hasKeyValue(obj, path, value);
|
|
52
|
+
};
|