@tap-payments/auth-jsconnect 2.8.28-test → 2.8.29-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/features/app/business/businessStore.d.ts +4 -7
- package/build/features/app/business/businessStore.js +112 -94
- package/build/features/business/screens/Activities/Activities.js +15 -7
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +3 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +2 -2
- package/build/features/business/screens/BusinessType/LicenseNumber.js +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -1
- package/build/features/business/screens/Customers/CustomerLocations.js +5 -3
- package/build/features/business/screens/Customers/Customers.js +39 -8
- package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +3 -1
- package/build/features/business/screens/Customers/ExpectedCustomers.js +5 -3
- package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +3 -1
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +5 -2
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +9 -2
- package/build/features/business/screens/Customers/RefundPolicy.js +13 -13
- package/build/features/business/screens/Customers/TransactionPolicy.d.ts +4 -1
- package/build/features/business/screens/Customers/TransactionPolicy.js +8 -5
- package/build/features/business/screens/Customers/validation.d.ts +6 -6
- package/build/features/business/screens/Customers/validation.js +3 -8
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes,
|
|
2
|
+
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, CivilFormValues, ActionState, AsyncThunkParams } from '../../../@types';
|
|
3
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
4
|
data: any;
|
|
5
5
|
isicActivityList: any;
|
|
@@ -173,11 +173,8 @@ export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThu
|
|
|
173
173
|
}>;
|
|
174
174
|
export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
175
175
|
data: any;
|
|
176
|
-
formData:
|
|
177
|
-
|
|
178
|
-
operationStartDate: string;
|
|
179
|
-
};
|
|
180
|
-
}, ActivitiesFormValues, {
|
|
176
|
+
formData: ActivitiesFormValues;
|
|
177
|
+
}, AsyncThunkParams<ActivitiesFormValues>, {
|
|
181
178
|
state?: unknown;
|
|
182
179
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
183
180
|
extra?: unknown;
|
|
@@ -205,7 +202,7 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
205
202
|
export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
206
203
|
data: any;
|
|
207
204
|
formData: CustomersFormValues;
|
|
208
|
-
}, CustomersFormValues
|
|
205
|
+
}, AsyncThunkParams<CustomersFormValues>, {
|
|
209
206
|
state?: unknown;
|
|
210
207
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
211
208
|
extra?: unknown;
|
|
@@ -59,15 +59,14 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
59
59
|
import API from '../../../api';
|
|
60
60
|
import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
|
|
61
61
|
import { BUSINESS_STEP_NAMES, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
62
|
-
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA } from '../../../utils';
|
|
62
|
+
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue } from '../../../utils';
|
|
63
63
|
import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
-
var
|
|
65
|
+
var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
|
|
66
66
|
var _b, _c;
|
|
67
67
|
return __generator(this, function (_d) {
|
|
68
68
|
switch (_d.label) {
|
|
69
69
|
case 0:
|
|
70
|
-
settings = thunkApi.getState().settings;
|
|
71
70
|
payload = {
|
|
72
71
|
service_name: 'tap_email',
|
|
73
72
|
verify_token: token
|
|
@@ -591,70 +590,79 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
591
590
|
entityData = _g.sent();
|
|
592
591
|
_g.label = 13;
|
|
593
592
|
case 13:
|
|
594
|
-
thunkApi.dispatch(handleNextScreenStep(stepName));
|
|
593
|
+
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep(stepName)); });
|
|
595
594
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
596
595
|
return [2, { data: __assign(__assign({}, data), { brand: brandData }), formData: params, accountData: accountData, documentData: documentData, entityData: entityData, isicActivityList: list || [] }];
|
|
597
596
|
}
|
|
598
597
|
});
|
|
599
598
|
}); });
|
|
600
|
-
export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (
|
|
601
|
-
var
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
id
|
|
616
|
-
activities
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
activities:
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
599
|
+
export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (_a, thunkApi) {
|
|
600
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
601
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
602
|
+
var _b, settings, business, _c, brand, entity_activities, entity, _d, brandActivities, brandId, data_status, activities, operationStartDate, isActivitiesNonEditable, isOperationStartDateNonEditable, stepName, id, removedActivities, payload, newBrandActivities, newEntityActivities, activityPayload, requestBody, data;
|
|
603
|
+
var _e, _f;
|
|
604
|
+
return __generator(this, function (_g) {
|
|
605
|
+
switch (_g.label) {
|
|
606
|
+
case 0:
|
|
607
|
+
_b = thunkApi.getState(), settings = _b.settings, business = _b.business;
|
|
608
|
+
_c = business.data.verify.responseBody || {}, brand = _c.brand, entity_activities = _c.entity_activities, entity = _c.entity;
|
|
609
|
+
_d = brand || {}, brandActivities = _d.activities, brandId = _d.id, data_status = _d.data_status;
|
|
610
|
+
activities = formData.activities, operationStartDate = formData.operationStartDate;
|
|
611
|
+
isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
|
|
612
|
+
isOperationStartDateNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'business_start_date');
|
|
613
|
+
stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
|
|
614
|
+
id = brandId;
|
|
615
|
+
removedActivities = (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
|
|
616
|
+
if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length))) return [3, 2];
|
|
617
|
+
payload = {
|
|
618
|
+
id: id,
|
|
619
|
+
activities: removedActivities.map(function (_a) {
|
|
620
|
+
var id = _a.id;
|
|
621
|
+
return ({ id: id });
|
|
622
|
+
})
|
|
623
|
+
};
|
|
624
|
+
return [4, API.brandService.removeBrandActivity(payload)];
|
|
625
|
+
case 1:
|
|
626
|
+
_g.sent();
|
|
627
|
+
_g.label = 2;
|
|
628
|
+
case 2:
|
|
629
|
+
newBrandActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(brandActivities || []).some(function (brandActivity) { return act.id === brandActivity.id; }); });
|
|
630
|
+
newEntityActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(entity_activities || []).some(function (entityActivity) { return act.id === entityActivity.id; }); });
|
|
631
|
+
if (!(!isActivitiesNonEditable && (newEntityActivities === null || newEntityActivities === void 0 ? void 0 : newEntityActivities.length))) return [3, 4];
|
|
632
|
+
activityPayload = {
|
|
633
|
+
id: entity === null || entity === void 0 ? void 0 : entity.id,
|
|
634
|
+
activities: newEntityActivities.map(function (_a) {
|
|
635
|
+
var id = _a.id;
|
|
636
|
+
return ({ id: id });
|
|
637
|
+
})
|
|
638
|
+
};
|
|
639
|
+
return [4, API.entityService.updateEntityActivity(activityPayload)];
|
|
640
|
+
case 3:
|
|
641
|
+
_g.sent();
|
|
642
|
+
_g.label = 4;
|
|
643
|
+
case 4:
|
|
644
|
+
requestBody = __assign(__assign(__assign({ id: id }, ((newBrandActivities === null || newBrandActivities === void 0 ? void 0 : newBrandActivities.length) && !isActivitiesNonEditable && { activities: newBrandActivities.map(function (_a) {
|
|
645
|
+
var id = _a.id;
|
|
646
|
+
return ({ id: id });
|
|
647
|
+
}) })), (!isOperationStartDateNonEditable && {
|
|
648
|
+
operations: {
|
|
649
|
+
start_date: operationStartDate
|
|
650
|
+
}
|
|
651
|
+
})), { step_name: stepName, encryption_contract: ['operations.start_date'] });
|
|
652
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
653
|
+
case 5:
|
|
654
|
+
data = _g.sent();
|
|
655
|
+
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
656
|
+
case 6:
|
|
657
|
+
_g.sent();
|
|
658
|
+
thunkApi.dispatch(updateStepName(stepName));
|
|
659
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
660
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
661
|
+
return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: originalFormData }];
|
|
662
|
+
}
|
|
663
|
+
});
|
|
656
664
|
});
|
|
657
|
-
});
|
|
665
|
+
});
|
|
658
666
|
export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
659
667
|
var settings, countryISO2, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
|
|
660
668
|
return __generator(this, function (_b) {
|
|
@@ -685,40 +693,50 @@ export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', funct
|
|
|
685
693
|
}
|
|
686
694
|
});
|
|
687
695
|
}); });
|
|
688
|
-
export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', function (
|
|
689
|
-
var
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
696
|
+
export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', function (_a, thunkApi) {
|
|
697
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
698
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
699
|
+
var _b, settings, business, _c, data_status, id, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, customerLocations, expectedCustomer, expectedSale, stepName, requestBody, customerLocation, customerBaseId, salesId, customerBase, data;
|
|
700
|
+
var _d, _e, _f;
|
|
701
|
+
return __generator(this, function (_g) {
|
|
702
|
+
switch (_g.label) {
|
|
703
|
+
case 0:
|
|
704
|
+
_b = thunkApi.getState(), settings = _b.settings, business = _b.business;
|
|
705
|
+
_c = ((_d = business.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) || {}, data_status = _c.data_status, id = _c.id;
|
|
706
|
+
isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
|
|
707
|
+
isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
|
|
708
|
+
isTermsNonEditable = hasNoneEditableValue(data_status, 'terms');
|
|
709
|
+
isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
|
|
710
|
+
customerLocations = formData.customerLocations, expectedCustomer = formData.expectedCustomer, expectedSale = formData.expectedSale;
|
|
711
|
+
stepName = BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS;
|
|
712
|
+
requestBody = {
|
|
713
|
+
term: !isTermsNonEditable ? ['refund', 'chargeback'] : undefined,
|
|
714
|
+
id: id,
|
|
715
|
+
step_name: stepName,
|
|
716
|
+
encryption_contract: []
|
|
717
|
+
};
|
|
718
|
+
customerLocation = (customerLocations || []).map(function (location) { return ({
|
|
719
|
+
id: location.id
|
|
720
|
+
}); });
|
|
721
|
+
customerBaseId = (expectedCustomer === null || expectedCustomer === void 0 ? void 0 : expectedCustomer.id) && { id: expectedCustomer.id, period: 'monthly' };
|
|
722
|
+
salesId = (expectedSale === null || expectedSale === void 0 ? void 0 : expectedSale.id) && { id: expectedSale.id, period: 'monthly' };
|
|
723
|
+
customerBase = (customerBaseId || customerLocation.length) && __assign(__assign({}, (customerBaseId && !isCustomerBaseNonEditable && { id: expectedCustomer.id, period: 'monthly' })), (customerLocation.length && !isCustomerBaseLocationNonEditable && { locations: customerLocation }));
|
|
724
|
+
if (customerBase && !(isCustomerBaseNonEditable && isCustomerBaseLocationNonEditable))
|
|
725
|
+
requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { customer_base: customerBase }) });
|
|
726
|
+
if (salesId && !isSalesRangeNonEditable) {
|
|
727
|
+
requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
|
|
728
|
+
}
|
|
729
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
730
|
+
case 1:
|
|
731
|
+
data = _g.sent();
|
|
732
|
+
thunkApi.dispatch(updateStepName(stepName));
|
|
733
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
734
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
735
|
+
return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: originalFormData }];
|
|
736
|
+
}
|
|
737
|
+
});
|
|
720
738
|
});
|
|
721
|
-
});
|
|
739
|
+
});
|
|
722
740
|
export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
723
741
|
var _a, settings, business, _b, steps, lead_id, flowCompleted, boardResponse, payload, data, board_id;
|
|
724
742
|
var _c, _d, _e, _f;
|
|
@@ -14,7 +14,7 @@ import * as React from 'react';
|
|
|
14
14
|
import { styled } from '@mui/material/styles';
|
|
15
15
|
import ActivitiesList from './ActivitiesList';
|
|
16
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
-
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useDataVerified, useExcludeReadOnlyFelids } from '../../../../hooks';
|
|
18
18
|
import Form from '../../../../components/Form';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { useTranslation } from 'react-i18next';
|
|
@@ -32,13 +32,14 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
32
32
|
flexDirection: 'column'
|
|
33
33
|
}); });
|
|
34
34
|
var Activities = function () {
|
|
35
|
-
var _a
|
|
36
|
-
var _b = React.useState(false),
|
|
35
|
+
var _a;
|
|
36
|
+
var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
37
|
+
var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
|
|
37
38
|
var dispatch = useAppDispatch();
|
|
38
39
|
var isAr = useLanguage().isAr;
|
|
39
40
|
var t = useTranslation().t;
|
|
40
|
-
var
|
|
41
|
-
var
|
|
41
|
+
var _d = useAppSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
42
|
+
var _e = data.activitiesData, activities = _e.activities, operationStartDate = _e.operationStartDate;
|
|
42
43
|
var methods = useForm({
|
|
43
44
|
resolver: yupResolver(ActivitiesValidationSchema),
|
|
44
45
|
defaultValues: {
|
|
@@ -48,8 +49,14 @@ var Activities = function () {
|
|
|
48
49
|
mode: 'onChange'
|
|
49
50
|
});
|
|
50
51
|
useSetFromDefaultValues(methods, data.activitiesData, true);
|
|
52
|
+
var _f = ((_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) || {}, data_status = _f.data_status, data_verification = _f.data_verification, operations = _f.operations;
|
|
53
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
54
|
+
var noneEditable = useDataNoneEditable(data_status, ['activities', 'operations.business_start_date']);
|
|
55
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
56
|
+
var dataVerified = useDataVerified(data_verification, ['operations.business_start_date']);
|
|
57
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
51
58
|
var onSubmit = function (data) {
|
|
52
|
-
dispatch(updateActivitiesInfo(deepCopy(data)));
|
|
59
|
+
dispatch(updateActivitiesInfo(deepCopy(getFelids(data))));
|
|
53
60
|
};
|
|
54
61
|
var handleCollapseOpenClose = function (flag) {
|
|
55
62
|
setCollapse(flag);
|
|
@@ -64,7 +71,8 @@ var Activities = function () {
|
|
|
64
71
|
var handleMenuClick = function () {
|
|
65
72
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
66
73
|
};
|
|
74
|
+
var isOperationStartDateVerified = dataVerified['operations.business_start_date'] && (operations === null || operations === void 0 ? void 0 : operations.business_start_date) === methods.watch('operationStartDate');
|
|
67
75
|
var disabled = !methods.formState.isValid;
|
|
68
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
76
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { readOnly: readOnly['activities'] || noneEditable['activities'], onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { isVerified: isOperationStartDateVerified, readOnly: readOnly['operationStartDate'] || noneEditable['operations.business_start_date'], onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
69
77
|
};
|
|
70
78
|
export default Activities;
|
|
@@ -7,6 +7,8 @@ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent
|
|
|
7
7
|
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
8
8
|
export interface OperationStartDateProps {
|
|
9
9
|
onDateClicked?: (flag: boolean) => void;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
isVerified?: boolean;
|
|
10
12
|
}
|
|
11
|
-
declare const OperationStartDate: ({ onDateClicked }: OperationStartDateProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const OperationStartDate: ({ onDateClicked, readOnly, isVerified }: OperationStartDateProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export default OperationStartDate;
|
|
@@ -28,7 +28,7 @@ export var MandatoryStyled = styled('span')(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
var OperationStartDate = function (_a) {
|
|
30
30
|
var _b;
|
|
31
|
-
var onDateClicked = _a.onDateClicked;
|
|
31
|
+
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
32
32
|
var t = useTranslation().t;
|
|
33
33
|
var dispatch = useAppDispatch();
|
|
34
34
|
var control = useFormContext().control;
|
|
@@ -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(Calender, { defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleOperationStartDateChange })] }));
|
|
43
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleOperationStartDateChange })] }));
|
|
44
44
|
};
|
|
45
45
|
export default OperationStartDate;
|
|
@@ -50,6 +50,6 @@ var LicenseNumber = function (_a) {
|
|
|
50
50
|
var minLength = isKWCountry || isOtherThanKWOrSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
|
|
51
51
|
var label = isCR ? 'cr_number' : 'fl_number';
|
|
52
52
|
var showCheckIcon = isKWCountry || isOtherThanKWOrSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
|
|
53
|
-
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 ? _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 }) }) }) })));
|
|
53
|
+
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 }) }) }) })));
|
|
54
54
|
};
|
|
55
55
|
export default React.memo(LicenseNumber);
|
|
@@ -60,6 +60,8 @@ interface CustomerLocationsProps {
|
|
|
60
60
|
show: boolean;
|
|
61
61
|
onListOpen?: () => void;
|
|
62
62
|
onListClose?: () => void;
|
|
63
|
+
readOnly?: boolean;
|
|
64
|
+
isVerified?: boolean;
|
|
63
65
|
}
|
|
64
|
-
declare const _default: React.MemoExoticComponent<({ ...rest }: CustomerLocationsProps) => import("react/jsx-runtime").JSX.Element>;
|
|
66
|
+
declare const _default: React.MemoExoticComponent<({ readOnly, isVerified, ...rest }: CustomerLocationsProps) => import("react/jsx-runtime").JSX.Element>;
|
|
65
67
|
export default _default;
|
|
@@ -31,10 +31,10 @@ import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
|
31
31
|
import Text from '../../../../components/Text';
|
|
32
32
|
import Collapse from '../../../../components/Collapse';
|
|
33
33
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
34
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
35
34
|
import InputSelect from '../../../shared/InputSelect';
|
|
36
35
|
import Tooltip from '../../../../components/Tooltip';
|
|
37
36
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
38
38
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
39
39
|
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
40
40
|
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
@@ -95,7 +95,7 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
|
95
95
|
height: 'fit-content'
|
|
96
96
|
}); });
|
|
97
97
|
var customerLocations = function (_a) {
|
|
98
|
-
var rest = __rest(_a, []);
|
|
98
|
+
var readOnly = _a.readOnly, isVerified = _a.isVerified, rest = __rest(_a, ["readOnly", "isVerified"]);
|
|
99
99
|
var _b = React.useState([]), customerLocationsList = _b[0], setCustomerLocationsList = _b[1];
|
|
100
100
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
101
101
|
var t = useTranslation().t;
|
|
@@ -109,6 +109,8 @@ var customerLocations = function (_a) {
|
|
|
109
109
|
var response = activitiesData.responseBody;
|
|
110
110
|
var onOpenList = function (event) {
|
|
111
111
|
var _a;
|
|
112
|
+
if (readOnly)
|
|
113
|
+
return;
|
|
112
114
|
setAnchorEl(event.currentTarget);
|
|
113
115
|
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
114
116
|
};
|
|
@@ -152,7 +154,7 @@ var customerLocations = function (_a) {
|
|
|
152
154
|
};
|
|
153
155
|
var customerLocationsValue = customerLocationsControl.field.value;
|
|
154
156
|
var customerLocationSelected = customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue[0];
|
|
155
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(BaseLabelStyled, { children: t('select_customer_base') }), _jsx(Tooltip, __assign({ title: t('customer_base_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(InputStyled, { placeholder: t('choose_expected_sales'), value: (isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.ar : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.en) || '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(
|
|
157
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(BaseLabelStyled, { children: t('select_customer_base') }), _jsx(Tooltip, __assign({ title: t('customer_base_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(InputStyled, { readOnly: readOnly, placeholder: t('choose_expected_sales'), value: (isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.ar : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.en) || '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name.en', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
|
|
156
158
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.name.ar : item.name.en })) })), item.id === (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIcon, {}), checkRemainingCondition(item) && item.id != (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIcon, {})] }));
|
|
157
159
|
} })] }))] }) })));
|
|
158
160
|
};
|
|
@@ -16,7 +16,7 @@ import * as React from 'react';
|
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
18
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useDataVerified, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
21
|
import { CustomerInfoValidation } from './validation';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
@@ -42,12 +42,12 @@ var ListType;
|
|
|
42
42
|
ListType["ExpectedSalesList"] = "ExpectedSalesList";
|
|
43
43
|
})(ListType || (ListType = {}));
|
|
44
44
|
var Customers = function (_a) {
|
|
45
|
-
var _b, _c;
|
|
46
|
-
var
|
|
45
|
+
var _b, _c, _d, _e, _f;
|
|
46
|
+
var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
|
|
47
47
|
var dispatch = useAppDispatch();
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
48
|
+
var _h = useAppSelector(businessSelector), data = _h.data, loading = _h.loading, error = _h.error;
|
|
49
|
+
var _j = data.customersData, customerLocations = _j.customerLocations, expectedCustomer = _j.expectedCustomer, expectedSale = _j.expectedSale, refundPolicy = _j.refundPolicy, transactionPolicy = _j.transactionPolicy;
|
|
50
|
+
var _k = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, data_status = _k.data_status, data_verification = _k.data_verification, operations = _k.operations, terms = _k.terms;
|
|
51
51
|
var methods = useForm({
|
|
52
52
|
resolver: yupResolver(CustomerInfoValidation),
|
|
53
53
|
defaultValues: {
|
|
@@ -60,6 +60,21 @@ var Customers = function (_a) {
|
|
|
60
60
|
mode: 'onChange'
|
|
61
61
|
});
|
|
62
62
|
useSetFromDefaultValues(methods, data.customersData);
|
|
63
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
64
|
+
var noneEditable = useDataNoneEditable(data_status, [
|
|
65
|
+
'activities',
|
|
66
|
+
'operations.customer_base_location',
|
|
67
|
+
'operations.customer_base',
|
|
68
|
+
'operations.sales_range',
|
|
69
|
+
'terms'
|
|
70
|
+
]);
|
|
71
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
72
|
+
var dataVerified = useDataVerified(data_verification, [
|
|
73
|
+
'operations.customer_base_location',
|
|
74
|
+
'operations.customer_base',
|
|
75
|
+
'operations.sales_range'
|
|
76
|
+
]);
|
|
77
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
63
78
|
React.useEffect(function () {
|
|
64
79
|
var _a, _b;
|
|
65
80
|
var isTermsAgreed = !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
|
|
@@ -74,8 +89,24 @@ var Customers = function (_a) {
|
|
|
74
89
|
setValue('transactionPolicy', true, { shouldValidate: true });
|
|
75
90
|
}
|
|
76
91
|
}, [terms]);
|
|
92
|
+
var locations = methods.watch('customerLocations');
|
|
93
|
+
var isCustomerLocationsHasVerifiedValue = React.useMemo(function () {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
var locationIds = locations === null || locations === void 0 ? void 0 : locations.map(function (_a) {
|
|
96
|
+
var id = _a.id;
|
|
97
|
+
return id;
|
|
98
|
+
});
|
|
99
|
+
var Ids = (_b = (_a = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _a === void 0 ? void 0 : _a.locations) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
100
|
+
var id = _a.id;
|
|
101
|
+
return id;
|
|
102
|
+
});
|
|
103
|
+
return (locationIds === null || locationIds === void 0 ? void 0 : locationIds.length) === (Ids === null || Ids === void 0 ? void 0 : Ids.length) && locationIds.every(function (locationId) { return Ids.includes(locationId); });
|
|
104
|
+
}, [locations, operations]);
|
|
105
|
+
var isCustomerLocationsVerified = dataVerified['operations.customer_base_location'] && isCustomerLocationsHasVerifiedValue;
|
|
106
|
+
var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((_c = operations === null || operations === void 0 ? void 0 : operations.sales) === null || _c === void 0 ? void 0 : _c.id) === ((_d = methods.watch('expectedSale')) === null || _d === void 0 ? void 0 : _d.id);
|
|
107
|
+
var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((_e = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _e === void 0 ? void 0 : _e.id) === ((_f = methods.watch('expectedCustomer')) === null || _f === void 0 ? void 0 : _f.id);
|
|
77
108
|
var onSubmit = function (data) {
|
|
78
|
-
dispatch(updateCustomersInfo(deepCopy(data)));
|
|
109
|
+
dispatch(updateCustomersInfo(deepCopy(getFelids(data))));
|
|
79
110
|
};
|
|
80
111
|
var onBack = function () {
|
|
81
112
|
dispatch(handlePrevScreenStep());
|
|
@@ -97,6 +128,6 @@ var Customers = function (_a) {
|
|
|
97
128
|
var whenNotSelectExpectedSales = !isCustomerLocationsListActive && !isExpectedCustomersListActive;
|
|
98
129
|
var isAnyListSelected = !isExpectedCustomersListActive && !isCustomerLocationsListActive && !isExpectedSalesListActive;
|
|
99
130
|
var disabled = !methods.formState.isValid;
|
|
100
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(CustomerLocations, { show: whenNotSelectCustomersLocation, onListOpen: function () { return handleMenuClick(ListType.CustomerLocationsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedCustomers, { show: whenNotSelectExpectedCustomers, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomersList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedSales, { show: whenNotSelectExpectedSales, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: isAnyListSelected }, { children: [_jsx(RefundPolicy, {}), _jsx(TransactionPolicy, {}), _jsx(Box, __assign({ sx: { mt: 2 } }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] }))] })) })) }));
|
|
131
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(CustomerLocations, { readOnly: readOnly['customerLocations'] || noneEditable['operations.customer_base_location'], show: whenNotSelectCustomersLocation, onListOpen: function () { return handleMenuClick(ListType.CustomerLocationsList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isCustomerLocationsVerified }), _jsx(ExpectedCustomers, { readOnly: readOnly['expectedCustomer'] || noneEditable['operations.customer_base'], show: whenNotSelectExpectedCustomers, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomersList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isExpectedCustomersVerified }), _jsx(ExpectedSales, { readOnly: readOnly['expectedSale'] || noneEditable['operations.sales_range'], show: whenNotSelectExpectedSales, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isExpectedSalesRangeVerified }), _jsxs(Collapse, __assign({ in: isAnyListSelected }, { children: [_jsx(RefundPolicy, { readOnly: readOnly['refundPolicy'] || noneEditable['terms'] }), _jsx(TransactionPolicy, { readOnly: readOnly['transactionPolicy'] || noneEditable['terms'] }), _jsx(Box, __assign({ sx: { mt: 2 } }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] }))] })) })) }));
|
|
101
132
|
};
|
|
102
133
|
export default React.memo(Customers);
|
|
@@ -2,6 +2,8 @@ interface ExpectedCustomersProps {
|
|
|
2
2
|
show: boolean;
|
|
3
3
|
onListOpen?: () => void;
|
|
4
4
|
onListClose?: () => void;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
isVerified?: boolean;
|
|
5
7
|
}
|
|
6
|
-
declare const ExpectedCustomers: ({ ...rest }: ExpectedCustomersProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const ExpectedCustomers: ({ readOnly, isVerified, ...rest }: ExpectedCustomersProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export default ExpectedCustomers;
|
|
@@ -29,7 +29,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
29
29
|
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
30
30
|
import SimpleList from '../../../../components/SimpleList';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
32
|
-
import
|
|
32
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
33
33
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
34
|
import { InputLabelStyled, NameContainer } from './CustomerLocations';
|
|
35
35
|
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
@@ -53,7 +53,7 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
|
53
53
|
height: 'fit-content'
|
|
54
54
|
}); });
|
|
55
55
|
var ExpectedCustomers = function (_a) {
|
|
56
|
-
var rest = __rest(_a, []);
|
|
56
|
+
var readOnly = _a.readOnly, isVerified = _a.isVerified, rest = __rest(_a, ["readOnly", "isVerified"]);
|
|
57
57
|
var _b = React.useState([]), expectedCustomersList = _b[0], setExpectedCustomersList = _b[1];
|
|
58
58
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
59
59
|
var t = useTranslation().t;
|
|
@@ -66,6 +66,8 @@ var ExpectedCustomers = function (_a) {
|
|
|
66
66
|
var response = activitiesData.responseBody;
|
|
67
67
|
var onOpenList = function (event) {
|
|
68
68
|
var _a;
|
|
69
|
+
if (readOnly)
|
|
70
|
+
return;
|
|
69
71
|
setAnchorEl(event.currentTarget);
|
|
70
72
|
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
71
73
|
};
|
|
@@ -98,7 +100,7 @@ var ExpectedCustomers = function (_a) {
|
|
|
98
100
|
};
|
|
99
101
|
var expectedCustomersValue = expectedCustomerControl.field.value;
|
|
100
102
|
var expectedCustomersSelected = expectedCustomersValue;
|
|
101
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { placeholder: t('choose_expected_sales'), value: (isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.ar : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.en) || '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(
|
|
103
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: readOnly, placeholder: t('choose_expected_sales'), value: (isAr ? expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.ar : expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.en) || '', onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
102
104
|
return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedCustomersValue === null || expectedCustomersValue === void 0 ? void 0 : expectedCustomersValue.id) }, { children: isAr ? item.name.ar : item.name.en })) }), item.id === (expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.id) && _jsx(CheckIcon, {})] }));
|
|
103
105
|
} })] }))] }) })));
|
|
104
106
|
};
|
|
@@ -2,6 +2,8 @@ interface ExpectedSalesRangeProps {
|
|
|
2
2
|
show: boolean;
|
|
3
3
|
onListOpen?: () => void;
|
|
4
4
|
onListClose?: () => void;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
isVerified?: boolean;
|
|
5
7
|
}
|
|
6
|
-
declare const ExpectedSalesRange: ({ show, onListClose, onListOpen }: ExpectedSalesRangeProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare const ExpectedSalesRange: ({ readOnly, isVerified, show, onListClose, onListOpen }: ExpectedSalesRangeProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export default ExpectedSalesRange;
|
|
@@ -20,6 +20,7 @@ import { settingsSelector } from '../../../../app/settings';
|
|
|
20
20
|
import SimpleList from '../../../../components/SimpleList';
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
23
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
23
24
|
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
24
25
|
import { getCurrencyByCountryIso2, isExist } from '../../../../utils';
|
|
25
26
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -54,7 +55,7 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
|
54
55
|
height: 'fit-content'
|
|
55
56
|
}); });
|
|
56
57
|
var ExpectedSalesRange = function (_a) {
|
|
57
|
-
var show = _a.show, onListClose = _a.onListClose, onListOpen = _a.onListOpen;
|
|
58
|
+
var readOnly = _a.readOnly, isVerified = _a.isVerified, show = _a.show, onListClose = _a.onListClose, onListOpen = _a.onListOpen;
|
|
58
59
|
var _b = React.useState([]), expectedSalesRangeList = _b[0], setExpectedSalesRangeList = _b[1];
|
|
59
60
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
60
61
|
var _d = React.useState(''), subIndex = _d[0], setSubIndex = _d[1];
|
|
@@ -70,6 +71,8 @@ var ExpectedSalesRange = function (_a) {
|
|
|
70
71
|
var expectedSalesRangeValue = expectedSaleControl.field.value;
|
|
71
72
|
var countryCode = settingsData.businessCountry;
|
|
72
73
|
var handleOpenMainMenu = function (event) {
|
|
74
|
+
if (readOnly)
|
|
75
|
+
return;
|
|
73
76
|
setAnchorEl(event.currentTarget);
|
|
74
77
|
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
75
78
|
};
|
|
@@ -123,7 +126,7 @@ var ExpectedSalesRange = function (_a) {
|
|
|
123
126
|
}, [countryCode.iso2]);
|
|
124
127
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
|
|
125
128
|
currency: getCurrency
|
|
126
|
-
}) }), _jsx(InputStyled, { value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(
|
|
129
|
+
}) }), _jsx(InputStyled, { readOnly: readOnly, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
|
|
127
130
|
var isOnlyOneItem = !item.sub || item.sub.length === 1;
|
|
128
131
|
if (isOnlyOneItem)
|
|
129
132
|
onSelectItem(item);
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material/Box';
|
|
3
|
+
interface ContainerStyledProps extends BoxProps {
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
}
|
|
2
6
|
export declare const ContainerStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
3
7
|
children?: React.ReactNode;
|
|
4
8
|
component?: React.ElementType<any> | undefined;
|
|
@@ -6,7 +10,7 @@ export declare const ContainerStyled: import("@emotion/styled").StyledComponent<
|
|
|
6
10
|
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
7
11
|
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
8
12
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
9
|
-
}, ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "component" | "ref" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme
|
|
13
|
+
}, ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "component" | "ref" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & ContainerStyledProps, {}, {}>;
|
|
10
14
|
export declare const CheckboxStyled: import("@emotion/styled").StyledComponent<import("../../../../components/CheckBox").CheckboxProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
11
15
|
export declare const TextStyled: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
12
16
|
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
@@ -24,5 +28,8 @@ export declare const LinkStyled: import("@emotion/styled").StyledComponent<Omit<
|
|
|
24
28
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
25
29
|
ref?: ((instance: HTMLAnchorElement | null) => void) | React.RefObject<HTMLAnchorElement> | null | undefined;
|
|
26
30
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "children" | "sx" | "underline" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "TypographyClasses"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
27
|
-
|
|
31
|
+
type RefundPolicyProps = {
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
};
|
|
34
|
+
declare const RefundPolicy: ({ readOnly }: RefundPolicyProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
35
|
export default RefundPolicy;
|
|
@@ -26,14 +26,11 @@ import { settingsSelector } from '../../../../app/settings';
|
|
|
26
26
|
import { useAppSelector } from '../../../../hooks';
|
|
27
27
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
28
28
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
29
|
-
export var ContainerStyled = styled(Box)(function (_a) {
|
|
30
|
-
var theme = _a.theme;
|
|
31
|
-
return ({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
padding: theme.spacing(0, 2.5, 1.5, 2.5)
|
|
36
|
-
});
|
|
29
|
+
export var ContainerStyled = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'readOnly'; } })(function (_a) {
|
|
30
|
+
var theme = _a.theme, readOnly = _a.readOnly;
|
|
31
|
+
return (__assign({ display: 'flex', flexDirection: 'row', alignItems: 'center', padding: theme.spacing(0, 2.5, 1.5, 2.5) }, (readOnly && {
|
|
32
|
+
opacity: '0.6'
|
|
33
|
+
})));
|
|
37
34
|
});
|
|
38
35
|
export var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
39
36
|
var theme = _a.theme;
|
|
@@ -66,19 +63,22 @@ export var LinkStyled = styled(Link)(function (_a) {
|
|
|
66
63
|
letterSpacing: theme.spacing(0)
|
|
67
64
|
});
|
|
68
65
|
});
|
|
69
|
-
var RefundPolicy = function () {
|
|
70
|
-
var
|
|
66
|
+
var RefundPolicy = function (_a) {
|
|
67
|
+
var _b, _c, _d;
|
|
68
|
+
var readOnly = _a.readOnly;
|
|
71
69
|
var t = useTranslation().t;
|
|
72
70
|
var isAr = useLanguage().isAr;
|
|
73
71
|
var control = useFormContext().control;
|
|
74
72
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
75
73
|
var data = useAppSelector(businessSelector).data;
|
|
76
|
-
var terms = (
|
|
74
|
+
var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
|
|
77
75
|
var refundControl = useController({ control: control, name: 'refundPolicy' });
|
|
78
76
|
var refundChecked = refundControl.field.value;
|
|
79
|
-
var warningMessage = (
|
|
77
|
+
var warningMessage = (_d = refundControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
80
78
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
81
79
|
var handleRefundCheckedChange = function (event, checked) {
|
|
80
|
+
if (readOnly)
|
|
81
|
+
return;
|
|
82
82
|
refundControl.field.onChange(checked);
|
|
83
83
|
};
|
|
84
84
|
var isChecked = React.useMemo(function () {
|
|
@@ -88,6 +88,6 @@ var RefundPolicy = function () {
|
|
|
88
88
|
return term === 'general';
|
|
89
89
|
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
90
90
|
}, [terms]);
|
|
91
|
-
return (_jsx(Collapse, __assign({ in: !isChecked }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { 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 (_jsx(Collapse, __assign({ in: !isChecked }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(ContainerStyled, __assign({ readOnly: readOnly }, { 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) })) }))] })) })));
|
|
92
92
|
};
|
|
93
93
|
export default RefundPolicy;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
type TransactionPolicyProps = {
|
|
2
|
+
readOnly?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const TransactionPolicy: ({ readOnly }: TransactionPolicyProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default TransactionPolicy;
|
|
@@ -25,19 +25,22 @@ import { ContainerStyled, CheckboxStyled, TextStyled, LinkStyled } from './Refun
|
|
|
25
25
|
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
26
26
|
width: '100%'
|
|
27
27
|
}); });
|
|
28
|
-
var TransactionPolicy = function () {
|
|
29
|
-
var
|
|
28
|
+
var TransactionPolicy = function (_a) {
|
|
29
|
+
var _b, _c, _d;
|
|
30
|
+
var readOnly = _a.readOnly;
|
|
30
31
|
var t = useTranslation().t;
|
|
31
32
|
var isAr = useLanguage().isAr;
|
|
32
33
|
var control = useFormContext().control;
|
|
33
34
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
34
35
|
var data = useAppSelector(businessSelector).data;
|
|
35
|
-
var terms = (
|
|
36
|
+
var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
|
|
36
37
|
var transactionControl = useController({ control: control, name: 'transactionPolicy' });
|
|
37
38
|
var transactionChecked = transactionControl.field.value;
|
|
38
|
-
var warningMessage = (
|
|
39
|
+
var warningMessage = (_d = transactionControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
39
40
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
40
41
|
var handleTransactionCheckedChange = function (event, checked) {
|
|
42
|
+
if (readOnly)
|
|
43
|
+
return;
|
|
41
44
|
transactionControl.field.onChange(checked);
|
|
42
45
|
};
|
|
43
46
|
var isChecked = React.useMemo(function () {
|
|
@@ -47,6 +50,6 @@ var TransactionPolicy = function () {
|
|
|
47
50
|
return term === 'general';
|
|
48
51
|
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
49
52
|
}, [terms]);
|
|
50
|
-
return (_jsx(Collapse, __assign({ in: !isChecked }, { children: _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) })) }))] }) })));
|
|
53
|
+
return (_jsx(Collapse, __assign({ in: !isChecked }, { children: _jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, __assign({ readOnly: readOnly }, { 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
54
|
};
|
|
52
55
|
export default TransactionPolicy;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const CustomerInfoValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
3
|
customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
expectedCustomer: 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
|
+
expectedSale: 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>>;
|
|
6
6
|
refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
7
7
|
transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
8
8
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
9
|
customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
expectedCustomer: 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>>;
|
|
11
|
+
expectedSale: 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>>;
|
|
12
12
|
refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
13
13
|
transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
14
14
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
15
|
customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
expectedCustomer: 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>>;
|
|
17
|
+
expectedSale: 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>>;
|
|
18
18
|
refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
19
19
|
transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
20
20
|
}>>>;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
var objectElements = {
|
|
3
|
-
id: yup.number(),
|
|
4
|
-
name_ar: yup.string(),
|
|
5
|
-
name_en: yup.string()
|
|
6
|
-
};
|
|
7
2
|
export var CustomerInfoValidation = yup.object().shape({
|
|
8
|
-
customerLocations: yup.array().required('please_choose_base'),
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
customerLocations: yup.array().min(1, 'please_choose_base').required('please_choose_base'),
|
|
4
|
+
expectedCustomer: yup.object().required('select_expected_customers_serve'),
|
|
5
|
+
expectedSale: yup.object().required('select_expected_sales'),
|
|
11
6
|
refundPolicy: yup.boolean().required().isTrue('refund_policy_error'),
|
|
12
7
|
transactionPolicy: yup.boolean().required().isTrue('transaction_policy_error')
|
|
13
8
|
});
|