@tap-payments/auth-jsconnect 2.8.27-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.
Files changed (26) hide show
  1. package/build/features/app/business/businessStore.d.ts +4 -7
  2. package/build/features/app/business/businessStore.js +112 -94
  3. package/build/features/business/screens/Activities/Activities.js +15 -7
  4. package/build/features/business/screens/Activities/OperationStartDate.d.ts +3 -1
  5. package/build/features/business/screens/Activities/OperationStartDate.js +2 -2
  6. package/build/features/business/screens/BusinessType/LicenseNumber.js +1 -1
  7. package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -1
  8. package/build/features/business/screens/Customers/CustomerLocations.js +5 -3
  9. package/build/features/business/screens/Customers/Customers.js +39 -8
  10. package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +3 -1
  11. package/build/features/business/screens/Customers/ExpectedCustomers.js +5 -3
  12. package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +3 -1
  13. package/build/features/business/screens/Customers/ExpectedSalesRange.js +5 -2
  14. package/build/features/business/screens/Customers/RefundPolicy.d.ts +9 -2
  15. package/build/features/business/screens/Customers/RefundPolicy.js +13 -13
  16. package/build/features/business/screens/Customers/TransactionPolicy.d.ts +4 -1
  17. package/build/features/business/screens/Customers/TransactionPolicy.js +8 -5
  18. package/build/features/business/screens/Customers/validation.d.ts +6 -6
  19. package/build/features/business/screens/Customers/validation.js +3 -8
  20. package/build/features/entity/screens/EntityName/EntityTypeList.js +2 -3
  21. package/build/features/entity/screens/EntityName/ExpiryDate.js +5 -7
  22. package/build/features/entity/screens/EntityName/IssuingDate.js +5 -7
  23. package/build/features/entity/screens/EntityName/LegalName.js +1 -13
  24. package/build/features/entity/screens/EntityName/LicenseNumber.js +4 -6
  25. package/build/features/entity/screens/EntityName/UnifiedNumber.js +4 -6
  26. 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, Activity, CivilFormValues, ActionState } from '../../../@types';
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
- activities: Activity[] | undefined;
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 settings, payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
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 (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
601
- var _a, settings, business, _b, brand, entity_activities, entity, _c, brandActivities, brandId, activities, operationStartDate, stepName, id, removedActivities, payload, newBrandActivities, newEntityActivities, activityPayload, requestBody, data;
602
- var _d, _e;
603
- return __generator(this, function (_f) {
604
- switch (_f.label) {
605
- case 0:
606
- _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
607
- _b = business.data.verify.responseBody || {}, brand = _b.brand, entity_activities = _b.entity_activities, entity = _b.entity;
608
- _c = brand || {}, brandActivities = _c.activities, brandId = _c.id;
609
- activities = params.activities, operationStartDate = params.operationStartDate;
610
- stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
611
- id = brandId;
612
- removedActivities = (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
613
- if (!(removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length)) return [3, 2];
614
- payload = {
615
- id: id,
616
- activities: removedActivities.map(function (_a) {
617
- var id = _a.id;
618
- return ({ id: id });
619
- })
620
- };
621
- return [4, API.brandService.removeBrandActivity(payload)];
622
- case 1:
623
- _f.sent();
624
- _f.label = 2;
625
- case 2:
626
- newBrandActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(brandActivities || []).some(function (brandActivity) { return act.id === brandActivity.id; }); });
627
- newEntityActivities = activities === null || activities === void 0 ? void 0 : activities.filter(function (act) { return !(entity_activities || []).some(function (entityActivity) { return act.id === entityActivity.id; }); });
628
- if (!(newEntityActivities === null || newEntityActivities === void 0 ? void 0 : newEntityActivities.length)) return [3, 4];
629
- activityPayload = {
630
- id: entity === null || entity === void 0 ? void 0 : entity.id,
631
- activities: newEntityActivities.map(function (_a) {
632
- var id = _a.id;
633
- return ({ id: id });
634
- })
635
- };
636
- return [4, API.entityService.updateEntityActivity(activityPayload)];
637
- case 3:
638
- _f.sent();
639
- _f.label = 4;
640
- case 4:
641
- requestBody = __assign(__assign({ id: id }, ((newBrandActivities === null || newBrandActivities === void 0 ? void 0 : newBrandActivities.length) && { activities: newBrandActivities.map(function (_a) {
642
- var id = _a.id;
643
- return ({ id: id });
644
- }) })), { operations: {
645
- start_date: operationStartDate
646
- }, step_name: stepName, encryption_contract: ['operations.start_date'] });
647
- return [4, API.brandService.updateBrandInfo(requestBody)];
648
- case 5:
649
- data = _f.sent();
650
- thunkApi.dispatch(retrieveDataList());
651
- thunkApi.dispatch(updateStepName(stepName));
652
- thunkApi.dispatch(handleNextScreenStep());
653
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
654
- return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: __assign({}, params) }];
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 (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
689
- var _a, settings, business, id, customerLocation, customerBase, sales, stepName, requestBody, data;
690
- var _b, _c, _d, _e, _f, _g;
691
- return __generator(this, function (_h) {
692
- switch (_h.label) {
693
- case 0:
694
- _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
695
- id = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
696
- customerLocation = params.customerLocations.map(function (location) { return ({
697
- id: location === null || location === void 0 ? void 0 : location.id
698
- }); });
699
- customerBase = { id: ((_d = params.expectedCustomer) === null || _d === void 0 ? void 0 : _d.id) || '', period: 'monthly', locations: customerLocation };
700
- sales = { id: ((_e = params.expectedSale) === null || _e === void 0 ? void 0 : _e.id) || '', period: 'monthly' };
701
- stepName = BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS;
702
- requestBody = {
703
- operations: {
704
- customer_base: customerBase,
705
- sales: sales
706
- },
707
- term: ['refund', 'chargeback'],
708
- id: id,
709
- step_name: stepName,
710
- encryption_contract: []
711
- };
712
- return [4, API.brandService.updateBrandInfo(requestBody)];
713
- case 1:
714
- data = _h.sent();
715
- thunkApi.dispatch(updateStepName(stepName));
716
- thunkApi.dispatch(handleNextScreenStep());
717
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
718
- return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: params }];
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 = React.useState(false), anchorEl = _a[0], setAnchorEl = _a[1];
36
- var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
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 _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
41
- var _d = data.activitiesData, activities = _d.activities, operationStartDate = _d.operationStartDate;
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(ExpandIcon, { anchorEl: !!anchorEl }) }), _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) {
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 _d = React.useState(), listActive = _d[0], setListActive = _d[1];
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 _e = useAppSelector(businessSelector), data = _e.data, loading = _e.loading, error = _e.error;
49
- var _f = data.customersData, customerLocations = _f.customerLocations, expectedCustomer = _f.expectedCustomer, expectedSale = _f.expectedSale, refundPolicy = _f.refundPolicy, transactionPolicy = _f.transactionPolicy;
50
- var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
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 ExpandIcon from '../../../../components/ExpandIcon';
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(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedCustomersList, onSelectItem: onSelectItem, renderItem: function (item) {
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(ExpandIcon, { anchorEl: !!anchorEl }) }), _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) {
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
- declare const RefundPolicy: () => import("react/jsx-runtime").JSX.Element;
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
- display: 'flex',
33
- flexDirection: 'row',
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 _a, _b, _c;
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 = (_b = (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.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 = (_c = refundControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
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
- declare const TransactionPolicy: () => import("react/jsx-runtime").JSX.Element;
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 _a, _b, _c;
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 = (_b = (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.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 = (_c = transactionControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
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
- expectedCustomers: any;
5
- expectedSalesRange: any;
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
- expectedCustomers: any;
11
- expectedSalesRange: any;
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
- expectedCustomers: any;
17
- expectedSalesRange: any;
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
- expectedCustomers: yup.object().shape(objectElements).required('select_expected_customers_serve'),
10
- expectedSalesRange: yup.object().shape(objectElements).required('select_expected_sales'),
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
  });
@@ -85,11 +85,10 @@ var EntityTypeList = function (props) {
85
85
  var controlValue = entityTypesControl.field.value || '';
86
86
  var dispatch = useAppDispatch();
87
87
  var _d = data.verify.responseBody || {}, entityTypes = _d.entityTypes, entity = _d.entity;
88
- var type = entity === null || entity === void 0 ? void 0 : entity.type;
89
88
  var isListAvailable = (entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes.length) > 0;
90
89
  var hide = React.useMemo(function () {
91
- return !type || hasVerifiedValue(entity === null || entity === void 0 ? void 0 : entity.data_verification, 'type');
92
- }, [type, entity === null || entity === void 0 ? void 0 : entity.data_verification]);
90
+ return hasVerifiedValue(entity === null || entity === void 0 ? void 0 : entity.data_verification, 'type');
91
+ }, [entity === null || entity === void 0 ? void 0 : entity.data_verification]);
93
92
  React.useEffect(function () {
94
93
  if ((entityTypes === null || entityTypes === void 0 ? void 0 : entityTypes.length) > 0) {
95
94
  setEntityTypesMenuList(entityTypes);
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useController, useFormContext } from 'react-hook-form';
14
14
  import { useTranslation } from 'react-i18next';
15
- import { alpha, Collapse, styled } from '@mui/material';
15
+ import { alpha, styled } from '@mui/material';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
17
  import { getFutureDate } from '../../../../utils';
18
18
  import Text from '../../../../components/Text';
@@ -25,21 +25,19 @@ export var InputLabelStyled = styled(Text)(function (_a) {
25
25
  return (__assign({ margin: theme.spacing(0, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.6) }, theme.typography.caption));
26
26
  });
27
27
  var ExpiryDate = function (_a) {
28
- var _b, _c;
28
+ var _b;
29
29
  var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
30
30
  var t = useTranslation().t;
31
31
  var dispatch = useAppDispatch();
32
32
  var control = useFormContext().control;
33
- var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
34
- var entity = (data.verify.responseBody || {}).entity;
35
- var expiryDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.expiry_date;
33
+ var error = useAppSelector(entitySelector).error;
36
34
  var oDateControl = useController({ control: control, name: 'expiryDate' });
37
- var dateValue = (_c = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _c === void 0 ? void 0 : _c.value;
35
+ var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
38
36
  var handleExpiryDateChange = function (data) {
39
37
  if (error)
40
38
  dispatch(clearError());
41
39
  oDateControl.field.onChange(data);
42
40
  };
43
- return (_jsx(Collapse, __assign({ in: !!expiryDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })) })));
41
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })));
44
42
  };
45
43
  export default ExpiryDate;
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { useController, useFormContext } from 'react-hook-form';
15
- import { alpha, Collapse, styled } from '@mui/material';
15
+ import { alpha, styled } from '@mui/material';
16
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
17
  import Text from '../../../../components/Text';
18
18
  import Calender from '../../../shared/Calender';
@@ -24,21 +24,19 @@ export var InputLabelStyled = styled(Text)(function (_a) {
24
24
  return (__assign({ margin: theme.spacing(0, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.6) }, theme.typography.caption));
25
25
  });
26
26
  var IssuingDate = function (_a) {
27
- var _b, _c;
27
+ var _b;
28
28
  var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
29
29
  var t = useTranslation().t;
30
30
  var dispatch = useAppDispatch();
31
31
  var control = useFormContext().control;
32
- var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
33
- var entity = (data.verify.responseBody || {}).entity;
34
- var issueDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
32
+ var error = useAppSelector(entitySelector).error;
35
33
  var oDateControl = useController({ control: control, name: 'issuingDate' });
36
- var dateValue = (_c = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _c === void 0 ? void 0 : _c.value;
34
+ var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
37
35
  var handleIssuingDateChange = function (data) {
38
36
  if (error)
39
37
  dispatch(clearError());
40
38
  oDateControl.field.onChange(data);
41
39
  };
42
- return (_jsx(Collapse, __assign({ in: !!issueDate }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('issue_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })) })));
40
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('issue_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })));
43
41
  };
44
42
  export default IssuingDate;
@@ -1,19 +1,7 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
2
  import * as React from 'react';
14
3
  import { useTranslation } from 'react-i18next';
15
4
  import { useController, useFormContext } from 'react-hook-form';
16
- import { Collapse } from '@mui/material';
17
5
  import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
18
6
  import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
19
7
  import { ScreenContainer } from '../../../shared/Containers';
@@ -44,6 +32,6 @@ var LegalName = function (_a) {
44
32
  var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
45
33
  legalNameControl.field.onChange(value);
46
34
  };
47
- return (_jsx(Collapse, __assign({ in: !!legalName }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { required: true, readOnly: readOnly, onChange: handleChange, value: legalNameValue, label: t('license_name_label'), placeholder: t('license_name_placeholder'), sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, endAdornment: _jsx(EndAdornment, { value: legalNameValue, isVerified: isVerified }) }) }) })));
35
+ return (_jsx(ScreenContainer, { children: _jsx(Input, { required: true, readOnly: readOnly, onChange: handleChange, value: legalNameValue, label: t('license_name_label'), placeholder: t('license_name_placeholder'), sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, endAdornment: _jsx(EndAdornment, { value: legalNameValue, isVerified: isVerified }) }) }));
48
36
  };
49
37
  export default React.memo(LegalName);
@@ -24,16 +24,14 @@ import Input from '../../../shared/Input';
24
24
  import { clearError, entitySelector } from '../../../app/entity/entityStore';
25
25
  import { EndAdornment } from '../../../shared/EndAdornment';
26
26
  var LicenseNumber = function (_a) {
27
- var _b, _c;
27
+ var _b;
28
28
  var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
29
29
  var t = useTranslation().t;
30
- var _d = useAppSelector(entitySelector), data = _d.data, bckError = _d.error;
30
+ var _c = useAppSelector(entitySelector), data = _c.data, bckError = _c.error;
31
31
  var dispatch = useAppDispatch();
32
32
  var settingsData = useAppSelector(settingsSelector).data;
33
33
  var control = useFormContext().control;
34
- var entity = (data.verify.responseBody || {}).entity;
35
34
  var type = data.entityNameData.licenseType;
36
- var number = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.number;
37
35
  var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
38
36
  var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
39
37
  var handleChange = function (_a) {
@@ -45,10 +43,10 @@ var LicenseNumber = function (_a) {
45
43
  };
46
44
  var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
47
45
  var licenseNumberValue = licenseNumberControl.field.value;
48
- var error = (_c = licenseNumberControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
46
+ var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
49
47
  var isCR = type === BusinessType.CR;
50
48
  var length = isKWCountry || isOtherCountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_ENTITY_LENGTH;
51
49
  var minLength = isKWCountry || isOtherCountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
52
- return (_jsx(Collapse, __assign({ in: show && !!number }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('license_number_label'), onChange: handleChange, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }), endAdornment: _jsx(EndAdornment, { value: licenseNumberValue, isVerified: isVerified }) }) })) })));
50
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('license_number_label'), onChange: handleChange, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }), endAdornment: _jsx(EndAdornment, { value: licenseNumberValue, isVerified: isVerified }) }) })) })));
53
51
  };
54
52
  export default React.memo(LicenseNumber);
@@ -21,14 +21,12 @@ import Input from '../../../shared/Input';
21
21
  import { clearError, entitySelector } from '../../../app/entity/entityStore';
22
22
  import { EndAdornment } from '../../../shared/EndAdornment';
23
23
  var UnifiedNumber = function (_a) {
24
- var _b, _c, _d;
24
+ var _b;
25
25
  var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
26
26
  var t = useTranslation().t;
27
- var _e = useAppSelector(entitySelector), data = _e.data, bckError = _e.error;
27
+ var bckError = useAppSelector(entitySelector).error;
28
28
  var control = useFormContext().control;
29
29
  var dispatch = useAppDispatch();
30
- var entity = (data.verify.responseBody || {}).entity;
31
- var number = (_c = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number;
32
30
  var handleChange = function (_a) {
33
31
  var target = _a.target;
34
32
  if (bckError)
@@ -38,7 +36,7 @@ var UnifiedNumber = function (_a) {
38
36
  };
39
37
  var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
40
38
  var unifiedNumberValue = unifiedNumberControl.field.value;
41
- var error = (_d = unifiedNumberControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
42
- return (_jsx(Collapse, __assign({ in: show && !!number }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('unified_number_label'), onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) }) })) })));
39
+ var error = (_b = unifiedNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
40
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('unified_number_label'), onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) }) })) })));
43
41
  };
44
42
  export default React.memo(UnifiedNumber);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.27-test",
3
+ "version": "2.8.29-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",