@tap-payments/auth-jsconnect 2.0.51 → 2.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +90 -7
- package/build/@types/app.js +7 -0
- package/build/@types/form.d.ts +21 -20
- package/build/@types/theme.d.ts +1 -1
- package/build/api/account.d.ts +2 -2
- package/build/api/auth.d.ts +11 -11
- package/build/api/availabilityServices.d.ts +3 -3
- package/build/api/axios.js +1 -1
- package/build/api/board.d.ts +3 -3
- package/build/api/country.d.ts +1 -1
- package/build/api/data.d.ts +10 -10
- package/build/api/document.d.ts +2 -2
- package/build/api/entity.d.ts +12 -12
- package/build/api/file.d.ts +1 -1
- package/build/api/individual.d.ts +5 -5
- package/build/api/lead.d.ts +10 -10
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +1 -1
- package/build/api/user.d.ts +2 -2
- package/build/app/settings.d.ts +4 -11
- package/build/app/settings.js +13 -5
- package/build/app/store.d.ts +4 -4
- package/build/assets/locales/ar.json +3 -1
- package/build/assets/locales/en.json +3 -1
- package/build/components/DatePicker/DatePicker.js +1 -0
- package/build/components/RadioGroup/RadioGroup.d.ts +5 -2
- package/build/components/RadioGroup/RadioGroup.js +5 -9
- package/build/components/RadioGroup/index.d.ts +1 -1
- package/build/components/Slide/Slide.d.ts +1 -1
- package/build/constants/app.d.ts +3 -2
- package/build/constants/app.js +1 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.d.ts +9 -73
- package/build/features/app/bank/bankStore.js +68 -91
- package/build/features/app/brand/brandStore.d.ts +16 -103
- package/build/features/app/brand/brandStore.js +62 -49
- package/build/features/app/business/businessStore.d.ts +18 -162
- package/build/features/app/business/businessStore.js +4 -3
- package/build/features/app/connect/connectStore.d.ts +13 -121
- package/build/features/app/connect/connectStore.js +5 -4
- package/build/features/app/connectExpress/connectExpressStore.d.ts +22 -211
- package/build/features/app/connectExpress/connectExpressStore.js +9 -10
- package/build/features/app/entity/entityStore.d.ts +9 -74
- package/build/features/app/entity/entityStore.js +129 -152
- package/build/features/app/individual/individualStore.d.ts +21 -167
- package/build/features/app/individual/individualStore.js +176 -202
- package/build/features/app/password/passwordStore.d.ts +12 -102
- package/build/features/app/password/passwordStore.js +1 -1
- package/build/features/app/signIn/signInStore.d.ts +7 -61
- package/build/features/app/signIn/signInStore.js +1 -1
- package/build/features/app/tax/taxStore.d.ts +8 -62
- package/build/features/app/tax/taxStore.js +48 -62
- package/build/features/bank/screens/BankDetails/BankDetails.js +20 -5
- package/build/features/bank/screens/BankDetails/BankName.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/BankName.js +8 -7
- package/build/features/bank/screens/BankDetails/BankStatement.d.ts +5 -2
- package/build/features/bank/screens/BankDetails/BankStatement.js +3 -8
- package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/Beneficiary.js +8 -7
- package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +12 -13
- package/build/features/bank/screens/BankDetails/IBAN.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/IBAN.js +3 -3
- package/build/features/bank/screens/BankDetails/validation.d.ts +14 -14
- package/build/features/bank/screens/BankDetails/validation.js +16 -21
- package/build/features/bank/screens/Verify/OTPInput.js +5 -3
- package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +15 -18
- package/build/features/brand/screens/BrandActivities/ActivitiesList.js +14 -9
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +14 -5
- package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +12 -16
- package/build/features/brand/screens/BrandActivities/CustomerBase.js +16 -13
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +22 -9
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +20 -7
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +13 -6
- package/build/features/brand/screens/BrandActivities/RefundPolicy.js +23 -12
- package/build/features/brand/screens/BrandActivities/TAC.d.ts +14 -1
- package/build/features/brand/screens/BrandActivities/TAC.js +21 -12
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.d.ts +4 -1
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +18 -4
- package/build/features/brand/screens/BrandActivities/validation.d.ts +7 -7
- package/build/features/brand/screens/BrandActivities/validation.js +10 -19
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +20 -12
- package/build/features/brand/screens/BrandInfo/BrandLogo.d.ts +9 -0
- package/build/features/brand/screens/BrandInfo/BrandLogo.js +52 -0
- package/build/features/brand/screens/BrandInfo/BrandName.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/BrandName.js +3 -3
- package/build/features/brand/screens/BrandInfo/SalesChannels.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +2 -1
- package/build/features/brand/screens/BrandInfo/Segments.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/Segments.js +12 -2
- package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/TeamSize.js +12 -2
- package/build/features/brand/screens/BrandInfo/validation.d.ts +6 -6
- package/build/features/brand/screens/BrandInfo/validation.js +36 -42
- package/build/features/brand/screens/Verify/OTPInput.js +5 -3
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +12 -17
- package/build/features/business/screens/Activities/ActivitiesList.js +5 -5
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +2 -2
- package/build/features/business/screens/Activities/OperationStartDate.js +2 -2
- package/build/features/business/screens/BusinessType/Article.d.ts +1 -1
- package/build/features/business/screens/BusinessType/LicenseList.js +1 -1
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +5 -5
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +10 -15
- package/build/features/business/screens/Customers/CustomerLocations.js +5 -5
- package/build/features/business/screens/Customers/ExpectedCustomers.js +12 -2
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +12 -2
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +5 -5
- package/build/features/business/screens/IDBOD/DOB.js +1 -1
- package/build/features/business/screens/Verify/OTPInput.js +5 -3
- package/build/features/connect/screens/Individual/Email.js +1 -1
- package/build/features/connect/screens/Merchant/BrandList.js +1 -1
- package/build/features/connect/screens/Merchant/BrandName.js +1 -1
- package/build/features/connect/screens/Merchant/Segments.js +6 -1
- package/build/features/connect/screens/Merchant/TeamSize.js +6 -1
- package/build/features/connect/screens/Merchant/validation.js +5 -5
- package/build/features/connectExpress/screens/Brand/Brand.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +3 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +5 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +7 -5
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.d.ts +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +7 -6
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.js +4 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +14 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +9 -10
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +9 -5
- package/build/features/connectExpress/screens/CollectIndividualInfo/Email.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +3 -3
- package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +6 -2
- package/build/features/connectExpress/screens/CollectIndividualInfo/Name.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/Name.js +2 -2
- package/build/features/connectExpress/screens/Mobile/Mobile.js +4 -2
- package/build/features/connectExpress/screens/Mobile/MobileNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -2
- package/build/features/connectExpress/screens/Mobile/TAC.d.ts +2 -1
- package/build/features/connectExpress/screens/Mobile/TAC.js +3 -1
- package/build/features/connectExpress/screens/NID/DOB.d.ts +2 -1
- package/build/features/connectExpress/screens/NID/DOB.js +2 -2
- package/build/features/connectExpress/screens/NID/IDNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
- package/build/features/connectExpress/screens/NID/NID.js +4 -2
- package/build/features/connectExpress/screens/NID/TAC.d.ts +14 -1
- package/build/features/connectExpress/screens/NID/TAC.js +9 -10
- package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +14 -18
- package/build/features/entity/screens/EntityCapital/ActivityList.js +20 -27
- package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +7 -3
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +7 -3
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +7 -3
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +19 -17
- package/build/features/entity/screens/EntityCapital/validation.d.ts +10 -10
- package/build/features/entity/screens/EntityCapital/validation.js +4 -10
- package/build/features/entity/screens/EntityName/Article.d.ts +5 -2
- package/build/features/entity/screens/EntityName/Article.js +9 -6
- package/build/features/entity/screens/EntityName/EntityName.js +20 -5
- package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +14 -18
- package/build/features/entity/screens/EntityName/EntityTypeList.js +24 -27
- package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +4 -3
- package/build/features/entity/screens/EntityName/ExpiryDate.js +2 -2
- package/build/features/entity/screens/EntityName/IssuingDate.d.ts +4 -3
- package/build/features/entity/screens/EntityName/IssuingDate.js +2 -2
- package/build/features/entity/screens/EntityName/LegalName.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LegalName.js +8 -4
- package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +4 -1
- package/build/features/entity/screens/EntityName/LicenseCertificate.js +8 -9
- package/build/features/entity/screens/EntityName/LicenseNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LicenseNumber.js +8 -5
- package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +8 -5
- package/build/features/entity/screens/EntityName/validation.d.ts +35 -35
- package/build/features/entity/screens/EntityName/validation.js +68 -93
- package/build/features/entity/screens/Verify/OTPInput.js +5 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +25 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.d.ts +7 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +21 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +8 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +25 -25
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +25 -25
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +6 -5
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +8 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +8 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +8 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.d.ts +4 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +8 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +25 -25
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -11
- package/build/features/individual/screens/IndividualList/Email.js +1 -1
- package/build/features/individual/screens/IndividualList/IndividualList.d.ts +4 -4
- package/build/features/individual/screens/IndividualList/MobileNumber.js +0 -1
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +12 -2
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +12 -2
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +3 -3
- package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +4 -5
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +7 -6
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +4 -2
- package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ID.js +2 -7
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +20 -4
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +13 -7
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +11 -10
- package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Name.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +13 -7
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +1 -0
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +6 -3
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +4 -2
- package/build/features/individual/screens/Verify/OTPInput.js +5 -3
- package/build/features/password/screens/Verify/OTPInput.js +5 -3
- package/build/features/shared/Address/CountryList.d.ts +9 -9
- package/build/features/shared/Address/CountryList.js +1 -1
- package/build/features/shared/Address/InputSelect.d.ts +9 -9
- package/build/features/shared/Address/InputSelect.js +2 -2
- package/build/features/shared/Button/EmailProvidersButtons.d.ts +1 -1
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -1
- package/build/features/shared/Button/FlowsButtons.js +15 -20
- package/build/features/shared/Button/IndividualActionButtons.d.ts +1 -1
- package/build/features/shared/Containers/FeatureContainer.d.ts +1 -1
- package/build/features/shared/Containers/ScreenContainer.d.ts +1 -1
- package/build/features/shared/GenericError/GenericError.js +1 -1
- package/build/features/shared/Input/Input.d.ts +3 -3
- package/build/features/shared/Input/Input.js +2 -3
- package/build/features/shared/OTP/OTP.d.ts +2 -1
- package/build/features/shared/OTP/OTP.js +2 -2
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +2 -1
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +5 -4
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
- package/build/features/shared/SalesChannels/SalesChannel.js +5 -4
- package/build/features/shared/UploadFile/FileUpload.d.ts +6 -4
- package/build/features/shared/UploadFile/FileUpload.js +19 -15
- package/build/features/shared/UploadFile/UploadFile.d.ts +2 -2
- package/build/features/shared/UploadFile/UploadFile.js +7 -7
- package/build/features/shared/UploadFile/UploadWrapper.d.ts +5 -3
- package/build/features/shared/UploadFile/UploadWrapper.js +3 -2
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +5 -4
- package/build/features/shared/UploadMultipleFile/UploadFile.js +14 -10
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +4 -3
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +3 -3
- package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +12 -12
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +9 -4
- package/build/features/tax/screens/TaxDetails/TaxDocument.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/TaxDocument.js +3 -8
- package/build/features/tax/screens/TaxDetails/VATId.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/VATId.js +5 -7
- package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
- package/build/features/tax/screens/TaxDetails/validation.js +2 -5
- package/build/features/tax/screens/Verify/OTPInput.js +5 -3
- package/build/hooks/index.d.ts +3 -0
- package/build/hooks/index.js +3 -0
- package/build/hooks/useAppConfig.d.ts +1 -1
- package/build/hooks/useAppConfig.js +4 -2
- package/build/hooks/useDataNoneEditable.d.ts +2 -0
- package/build/hooks/useDataNoneEditable.js +19 -0
- package/build/hooks/useFormErrorAndUpdateReadOnly.d.ts +6 -0
- package/build/hooks/useFormErrorAndUpdateReadOnly.js +48 -0
- package/build/hooks/useFormReadOnly.d.ts +6 -0
- package/build/hooks/useFormReadOnly.js +40 -0
- package/build/utils/error.d.ts +1 -0
- package/build/utils/error.js +3 -0
- package/build/utils/object.d.ts +4 -0
- package/build/utils/object.js +17 -0
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +13 -7
- package/package.json +2 -2
- package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +0 -20
- package/build/features/brand/screens/BrandActivities/OperationStartDate.js +0 -45
|
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
13
14
|
import Box from '@mui/material/Box';
|
|
14
15
|
import { styled, alpha } from '@mui/material/styles';
|
|
15
16
|
import CheckBox from '../../../../components/CheckBox';
|
|
@@ -24,14 +25,12 @@ import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
|
|
|
24
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
26
|
import { settingsSelector } from '../../../../app/settings';
|
|
26
27
|
import { useAppSelector } from '../../../../hooks';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
padding: theme.spacing(0, 2.5, 1.5, 2.5)
|
|
34
|
-
});
|
|
28
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
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
|
+
})));
|
|
35
34
|
});
|
|
36
35
|
export var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
37
36
|
var theme = _a.theme;
|
|
@@ -64,19 +63,31 @@ export var LinkStyled = styled(Link)(function (_a) {
|
|
|
64
63
|
letterSpacing: theme.spacing(0)
|
|
65
64
|
});
|
|
66
65
|
});
|
|
67
|
-
var RefundPolicy = function () {
|
|
68
|
-
var
|
|
66
|
+
var RefundPolicy = function (_a) {
|
|
67
|
+
var _b, _c, _d;
|
|
68
|
+
var readOnly = _a.readOnly;
|
|
69
69
|
var t = useTranslation().t;
|
|
70
70
|
var isAr = useLanguage().isAr;
|
|
71
71
|
var control = useFormContext().control;
|
|
72
72
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
73
|
+
var data = useAppSelector(brandSelector).data;
|
|
74
|
+
var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
|
|
73
75
|
var refundControl = useController({ control: control, name: 'refundPolicy' });
|
|
74
76
|
var refundChecked = refundControl.field.value;
|
|
75
|
-
var warningMessage = (
|
|
77
|
+
var warningMessage = (_d = refundControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
76
78
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
79
|
+
var disabled = React.useMemo(function () {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
return !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
|
|
82
|
+
var term = _a.term;
|
|
83
|
+
return term === 'refund';
|
|
84
|
+
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
85
|
+
}, [terms]);
|
|
77
86
|
var handleRefundCheckedChange = function (event, checked) {
|
|
87
|
+
if (readOnly)
|
|
88
|
+
return;
|
|
78
89
|
refundControl.field.onChange(checked);
|
|
79
90
|
};
|
|
80
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: refundChecked, onChange: handleRefundCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_refund_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_EN, target: '_blank', underline: 'always' }, { children: t('refund_policy_compliance') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
91
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, __assign({ readOnly: readOnly }, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: refundChecked, onChange: handleRefundCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_refund_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_EN, target: '_blank', underline: 'always' }, { children: t('refund_policy_compliance') }))] })] })), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
81
92
|
};
|
|
82
93
|
export default RefundPolicy;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material/Box';
|
|
3
|
+
interface TACContainerStyledProps extends BoxProps {
|
|
4
|
+
readOnly?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const TACContainerStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
component?: React.ElementType<any> | undefined;
|
|
9
|
+
ref?: React.Ref<unknown> | undefined;
|
|
10
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
11
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
12
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
13
|
+
}, 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") | "ref" | "children" | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & TACContainerStyledProps, {}, {}>;
|
|
2
14
|
interface TACProps {
|
|
3
15
|
show: boolean;
|
|
16
|
+
readOnly?: boolean;
|
|
4
17
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: TACProps) => JSX.Element>;
|
|
18
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly }: TACProps) => JSX.Element>;
|
|
6
19
|
export default _default;
|
|
@@ -25,14 +25,12 @@ import Collapse from '../../../../components/Collapse';
|
|
|
25
25
|
import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
|
|
26
26
|
import { settingsSelector } from '../../../../app/settings';
|
|
27
27
|
import { useAppSelector } from '../../../../hooks';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
padding: theme.spacing(0, 2.5, 1.5, 2.5)
|
|
35
|
-
});
|
|
28
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
29
|
+
export var TACContainerStyled = 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
|
+
})));
|
|
36
34
|
});
|
|
37
35
|
var TextStyled = styled(Text)(function (_a) {
|
|
38
36
|
var theme = _a.theme;
|
|
@@ -66,19 +64,30 @@ var CollapseStyled = styled(Collapse)(function () { return ({
|
|
|
66
64
|
width: '100%'
|
|
67
65
|
}); });
|
|
68
66
|
var TAC = function (_a) {
|
|
69
|
-
var _b;
|
|
70
|
-
var show = _a.show;
|
|
67
|
+
var _b, _c, _d;
|
|
68
|
+
var show = _a.show, 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;
|
|
73
|
+
var data = useAppSelector(brandSelector).data;
|
|
74
|
+
var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
|
|
75
75
|
var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
|
|
76
76
|
var tacChecked = tacControl.field.value;
|
|
77
|
-
var warningMessage = (
|
|
77
|
+
var warningMessage = (_d = tacControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
78
78
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
79
|
+
var disabled = React.useMemo(function () {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
return !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
|
|
82
|
+
var term = _a.term;
|
|
83
|
+
return term === 'general';
|
|
84
|
+
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
85
|
+
}, [terms]);
|
|
79
86
|
var handleTACCheckedChange = function (event, checked) {
|
|
87
|
+
if (readOnly)
|
|
88
|
+
return;
|
|
80
89
|
tacControl.field.onChange(checked);
|
|
81
90
|
};
|
|
82
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
|
|
91
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(TACContainerStyled, __assign({ readOnly: readOnly }, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] })), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
|
|
83
92
|
};
|
|
84
93
|
export default React.memo(TAC);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare
|
|
2
|
+
declare type TransactionPolicyProps = {
|
|
3
|
+
readOnly?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const TransactionPolicy: ({ readOnly }: TransactionPolicyProps) => JSX.Element;
|
|
3
6
|
export default TransactionPolicy;
|
|
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
13
14
|
import { styled } from '@mui/material/styles';
|
|
14
15
|
import Collapse from '../../../../components/Collapse';
|
|
15
16
|
import { useTranslation } from 'react-i18next';
|
|
@@ -21,22 +22,35 @@ import { ContainerStyled, CheckboxStyled, TextStyled, LinkStyled } from './Refun
|
|
|
21
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
23
|
import { settingsSelector } from '../../../../app/settings';
|
|
23
24
|
import { useAppSelector } from '../../../../hooks';
|
|
25
|
+
import { brandSelector } from '../../../app/brand/brandStore';
|
|
24
26
|
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
25
27
|
width: '100%'
|
|
26
28
|
}); });
|
|
27
|
-
var TransactionPolicy = function () {
|
|
28
|
-
var
|
|
29
|
+
var TransactionPolicy = function (_a) {
|
|
30
|
+
var _b, _c, _d;
|
|
31
|
+
var readOnly = _a.readOnly;
|
|
29
32
|
var t = useTranslation().t;
|
|
30
33
|
var isAr = useLanguage().isAr;
|
|
31
34
|
var control = useFormContext().control;
|
|
32
35
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
36
|
+
var data = useAppSelector(brandSelector).data;
|
|
37
|
+
var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
|
|
33
38
|
var transactionControl = useController({ control: control, name: 'transactionPolicy' });
|
|
34
39
|
var transactionChecked = transactionControl.field.value;
|
|
35
|
-
var warningMessage = (
|
|
40
|
+
var warningMessage = (_d = transactionControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
36
41
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
42
|
+
var disabled = React.useMemo(function () {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return !!((_b = (_a = terms === null || terms === void 0 ? void 0 : terms.find) === null || _a === void 0 ? void 0 : _a.call(terms, function (_a) {
|
|
45
|
+
var term = _a.term;
|
|
46
|
+
return term === 'chargeback';
|
|
47
|
+
})) === null || _b === void 0 ? void 0 : _b.agree);
|
|
48
|
+
}, [terms]);
|
|
37
49
|
var handleTransactionCheckedChange = function (event, checked) {
|
|
50
|
+
if (readOnly)
|
|
51
|
+
return;
|
|
38
52
|
transactionControl.field.onChange(checked);
|
|
39
53
|
};
|
|
40
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: transactionChecked, onChange: handleTransactionCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_chargeback_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_EN, target: '_blank', underline: 'always' }, { children: t('chargeback_policy') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
54
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, __assign({ readOnly: readOnly }, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: transactionChecked, onChange: handleTransactionCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_chargeback_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_EN, target: '_blank', underline: 'always' }, { children: t('chargeback_policy') }))] })] })), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
41
55
|
};
|
|
42
56
|
export default TransactionPolicy;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare const BrandActivitiesValidationSchema: (
|
|
3
|
-
activities: yup.ArraySchema<yup.
|
|
2
|
+
export declare const BrandActivitiesValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
4
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
5
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
6
6
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -16,14 +16,14 @@ export declare const BrandActivitiesValidationSchema: (brand: any) => yup.Object
|
|
|
16
16
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
17
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
18
|
}>>[] | undefined>;
|
|
19
|
-
customerLocations:
|
|
19
|
+
customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
|
|
20
20
|
expectedCustomers: any;
|
|
21
21
|
expectedSalesRange: any;
|
|
22
22
|
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
23
23
|
refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
24
24
|
transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
25
25
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
26
|
-
activities: yup.ArraySchema<yup.
|
|
26
|
+
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
27
27
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
28
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
29
29
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -39,14 +39,14 @@ export declare const BrandActivitiesValidationSchema: (brand: any) => yup.Object
|
|
|
39
39
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
40
40
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
41
41
|
}>>[] | undefined>;
|
|
42
|
-
customerLocations:
|
|
42
|
+
customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
|
|
43
43
|
expectedCustomers: any;
|
|
44
44
|
expectedSalesRange: any;
|
|
45
45
|
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
46
46
|
refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
47
47
|
transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
48
48
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
49
|
-
activities: yup.ArraySchema<yup.
|
|
49
|
+
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
50
50
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
51
51
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
52
52
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -62,7 +62,7 @@ export declare const BrandActivitiesValidationSchema: (brand: any) => yup.Object
|
|
|
62
62
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
63
63
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
64
64
|
}>>[] | undefined>;
|
|
65
|
-
customerLocations:
|
|
65
|
+
customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
|
|
66
66
|
expectedCustomers: any;
|
|
67
67
|
expectedSalesRange: any;
|
|
68
68
|
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { FieldType } from '../../../../@types';
|
|
3
2
|
var objectElements = {
|
|
4
3
|
id: yup.number(),
|
|
5
4
|
name_ar: yup.string(),
|
|
6
5
|
name_en: yup.string()
|
|
7
6
|
};
|
|
8
|
-
export var BrandActivitiesValidationSchema = function (
|
|
9
|
-
var _a, _b, _c;
|
|
10
|
-
var _d = brand || {}, activities = _d.activities, operations = _d.operations, data_status = _d.data_status;
|
|
11
|
-
var _e = operations || {}, customer_base = _e.customer_base, sales = _e.sales;
|
|
12
|
-
var isActivitiesOptional = !((activities === null || activities === void 0 ? void 0 : activities.length) > 0) && (data_status === null || data_status === void 0 ? void 0 : data_status.activities) === FieldType.NON_EDITABLE;
|
|
13
|
-
var isCustomerLocationsOptional = !(((_a = customer_base === null || customer_base === void 0 ? void 0 : customer_base.locations) === null || _a === void 0 ? void 0 : _a.length) > 0) && ((_b = data_status === null || data_status === void 0 ? void 0 : data_status.customer_base) === null || _b === void 0 ? void 0 : _b.location) === FieldType.NON_EDITABLE;
|
|
14
|
-
var isExpectedSalesRangeOptional = !(sales === null || sales === void 0 ? void 0 : sales.id) && ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.operations) === null || _c === void 0 ? void 0 : _c.sales_range) === FieldType.NON_EDITABLE;
|
|
7
|
+
export var BrandActivitiesValidationSchema = function () {
|
|
15
8
|
return yup.object().shape({
|
|
16
|
-
activities:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})),
|
|
25
|
-
customerLocations: isCustomerLocationsOptional ? yup.array().optional() : yup.array().required('please_choose_base'),
|
|
9
|
+
activities: yup
|
|
10
|
+
.array()
|
|
11
|
+
.min(1, 'activities_list_alert')
|
|
12
|
+
.of(yup.object().shape({
|
|
13
|
+
ar: yup.string(),
|
|
14
|
+
en: yup.string()
|
|
15
|
+
})),
|
|
16
|
+
customerLocations: yup.array().required('please_choose_base'),
|
|
26
17
|
expectedCustomers: yup.object().shape(objectElements).required('select_expected_customers_serve'),
|
|
27
|
-
expectedSalesRange:
|
|
18
|
+
expectedSalesRange: yup.object().shape(objectElements).required('select_expected_sales'),
|
|
28
19
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
|
|
29
20
|
refundPolicy: yup.boolean().required().isTrue('refund_policy_error'),
|
|
30
21
|
transactionPolicy: yup.boolean().required().isTrue('transaction_policy_error')
|
|
@@ -10,24 +10,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { ScreenContainer } from '
|
|
13
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
14
14
|
import React from 'react';
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
16
|
import Form from '../../../../components/Form';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { BrandValidationSchema } from './validation';
|
|
21
21
|
import Button from '../../../shared/Button';
|
|
22
22
|
import { settingsSelector } from '../../../../app/settings';
|
|
23
23
|
import { clearError, brandSelector, updateBrand } from '../../../app/brand/brandStore';
|
|
24
24
|
import { useTranslation } from 'react-i18next';
|
|
25
|
-
import TeamSize from '
|
|
25
|
+
import TeamSize from '../../../brand/screens/BrandInfo/TeamSize';
|
|
26
26
|
import Collapse from '../../../../components/Collapse';
|
|
27
27
|
import { mapSalesChannel } from '../../../../utils';
|
|
28
28
|
import BrandName from './BrandName';
|
|
29
29
|
import Segments from './Segments';
|
|
30
30
|
import SalesChannels from './SalesChannels';
|
|
31
|
+
import BrandLogo from './BrandLogo';
|
|
31
32
|
var FormStyled = styled(Form)(function () { return ({
|
|
32
33
|
display: 'flex',
|
|
33
34
|
flexDirection: 'column'
|
|
@@ -38,21 +39,24 @@ var ListType;
|
|
|
38
39
|
ListType["TeamSizeList"] = "TeamSizeList";
|
|
39
40
|
})(ListType || (ListType = {}));
|
|
40
41
|
var BrandInfo = function (_a) {
|
|
41
|
-
var _b
|
|
42
|
-
var _c = React.useState(
|
|
42
|
+
var _b;
|
|
43
|
+
var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
|
|
44
|
+
var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
|
|
43
45
|
var dispatch = useAppDispatch();
|
|
44
46
|
var t = useTranslation().t;
|
|
45
47
|
var isAr = useLanguage().isAr;
|
|
46
48
|
var settingData = useAppSelector(settingsSelector).data;
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
+
var _e = useAppSelector(brandSelector), data = _e.data, loading = _e.loading, error = _e.error, uploadingBrandLogo = _e.uploadingBrandLogo;
|
|
50
|
+
var _f = data.brandData, brandName = _f.brandName, segment = _f.segment, teamSize = _f.teamSize, salesChannels = _f.salesChannels, brandLogoId = _f.brandLogoId, responseBody = _f.responseBody;
|
|
51
|
+
var _g = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, logo_details = _g.logo_details, data_status = _g.data_status;
|
|
49
52
|
var methods = useForm({
|
|
50
53
|
resolver: yupResolver(BrandValidationSchema()),
|
|
51
54
|
defaultValues: {
|
|
52
55
|
brandName: brandName,
|
|
53
56
|
segment: segment,
|
|
54
57
|
teamSize: teamSize,
|
|
55
|
-
salesChannels: salesChannels
|
|
58
|
+
salesChannels: salesChannels,
|
|
59
|
+
brandLogoId: brandLogoId
|
|
56
60
|
},
|
|
57
61
|
mode: 'onChange'
|
|
58
62
|
});
|
|
@@ -65,20 +69,24 @@ var BrandInfo = function (_a) {
|
|
|
65
69
|
dispatch(clearError());
|
|
66
70
|
}, [methods.formState.isValid]);
|
|
67
71
|
React.useEffect(function () {
|
|
68
|
-
if (salesChannels.length)
|
|
72
|
+
if (salesChannels.length && !methods.getValues('salesChannels').length)
|
|
69
73
|
methods.setValue('salesChannels', mapSalesChannel(salesChannels), { shouldValidate: true });
|
|
70
|
-
}, []);
|
|
74
|
+
}, [salesChannels]);
|
|
71
75
|
React.useEffect(function () {
|
|
72
76
|
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
|
|
73
77
|
methods.setError('brandName', { message: 'brand_name_already_exist' });
|
|
74
78
|
}, [responseBody]);
|
|
75
79
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
76
|
-
var disabled = brandErrChecks || brandNameChecking;
|
|
80
|
+
var disabled = brandErrChecks || brandNameChecking || uploadingBrandLogo;
|
|
77
81
|
var handleMenuClick = function (flag) {
|
|
78
82
|
setListActive(flag);
|
|
79
83
|
};
|
|
84
|
+
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
85
|
+
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
86
|
+
var noneEditable = useDataNoneEditable(data_status, ['name', 'segment.type', 'segment.teams', 'channel_services']);
|
|
87
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
80
88
|
var isSegmentsListActive = listActive === ListType.SegmentsList;
|
|
81
89
|
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
82
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Segments, { show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, {}), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
90
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || noneEditable['name'], show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
83
91
|
};
|
|
84
92
|
export default BrandInfo;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FileDetails } from '../../../../@types';
|
|
3
|
+
declare type BrandLogoProps = {
|
|
4
|
+
show: boolean;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
defaultFile?: FileDetails;
|
|
7
|
+
};
|
|
8
|
+
declare const BrandLogo: ({ show, readOnly, defaultFile }: BrandLogoProps) => JSX.Element;
|
|
9
|
+
export default BrandLogo;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
+
import { DocumentPurpose } from '../../../../@types';
|
|
18
|
+
import { FileRemoveType, VALID_FILE_FORMATS_FOR_IMAGE } from '../../../../constants';
|
|
19
|
+
import Collapse from '../../../../components/Collapse';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { UploadWrapper } from '../../../shared/UploadFile';
|
|
22
|
+
import { brandSelector, uploadingBrandLogoStatus, clearBrandLogo, clearError } from '../../../app/brand/brandStore';
|
|
23
|
+
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return ({
|
|
26
|
+
marginBlockStart: theme.spacing(3)
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
var BrandLogo = function (_a) {
|
|
30
|
+
var _b;
|
|
31
|
+
var show = _a.show, readOnly = _a.readOnly, defaultFile = _a.defaultFile;
|
|
32
|
+
var t = useTranslation().t;
|
|
33
|
+
var control = useFormContext().control;
|
|
34
|
+
var brandLogoIdControl = useController({ name: 'brandLogoId', control: control });
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var _c = useAppSelector(brandSelector), data = _c.data, error = _c.error, loading = _c.loading;
|
|
37
|
+
var logo_details = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}).logo_details;
|
|
38
|
+
var handleBrandLogoChange = function (id) {
|
|
39
|
+
if (error)
|
|
40
|
+
dispatch(clearError());
|
|
41
|
+
brandLogoIdControl.field.onChange(id);
|
|
42
|
+
};
|
|
43
|
+
var handleReset = function () {
|
|
44
|
+
if (error)
|
|
45
|
+
dispatch(clearError());
|
|
46
|
+
if (logo_details)
|
|
47
|
+
dispatch(clearBrandLogo());
|
|
48
|
+
brandLogoIdControl.field.onChange(undefined);
|
|
49
|
+
};
|
|
50
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); } }) }) })));
|
|
51
|
+
};
|
|
52
|
+
export default BrandLogo;
|
|
@@ -3,6 +3,7 @@ interface BrandNameProps {
|
|
|
3
3
|
show: boolean;
|
|
4
4
|
fetchingBrandName: (flag: boolean) => void;
|
|
5
5
|
brandNameChecking: boolean;
|
|
6
|
+
readOnly?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName }: BrandNameProps) => JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName, readOnly }: BrandNameProps) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -24,7 +24,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
24
24
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
25
|
function step(op) {
|
|
26
26
|
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (
|
|
27
|
+
while (_) try {
|
|
28
28
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
29
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
30
|
switch (op[0]) {
|
|
@@ -99,7 +99,7 @@ var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
|
99
99
|
var cancelToken = null;
|
|
100
100
|
var BrandName = function (_a) {
|
|
101
101
|
var _b, _c;
|
|
102
|
-
var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName;
|
|
102
|
+
var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName, readOnly = _a.readOnly;
|
|
103
103
|
var dispatch = useAppDispatch();
|
|
104
104
|
var _d = React.useState(false), isHovered = _d[0], setIsHovered = _d[1];
|
|
105
105
|
var t = useTranslation().t;
|
|
@@ -138,6 +138,6 @@ var BrandName = function (_a) {
|
|
|
138
138
|
var clearBrandName = function () {
|
|
139
139
|
brandControl.field.onChange('');
|
|
140
140
|
};
|
|
141
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue || '', disabled: isNonEditable, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
|
|
141
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleBrandNameChange, value: brandNameValue || '', disabled: isNonEditable, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
|
|
142
142
|
};
|
|
143
143
|
export default React.memo(BrandName);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface SalesChannelsProps {
|
|
3
|
+
readOnly?: boolean;
|
|
3
4
|
}
|
|
4
|
-
declare const SalesChannels: ({}: SalesChannelsProps) => JSX.Element;
|
|
5
|
+
declare const SalesChannels: ({ readOnly }: SalesChannelsProps) => JSX.Element;
|
|
5
6
|
export default SalesChannels;
|
|
@@ -7,6 +7,7 @@ import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
|
7
7
|
import SalesChannel from '../../../shared/SalesChannels';
|
|
8
8
|
var SalesChannels = function (_a) {
|
|
9
9
|
var _b;
|
|
10
|
+
var readOnly = _a.readOnly;
|
|
10
11
|
var control = useFormContext().control;
|
|
11
12
|
var dispatch = useAppDispatch();
|
|
12
13
|
var _c = useController({ control: control, name: 'salesChannels' }), fieldState = _c.fieldState, field = _c.field;
|
|
@@ -19,6 +20,6 @@ var SalesChannels = function (_a) {
|
|
|
19
20
|
dispatch(clearError());
|
|
20
21
|
field.onChange(channels);
|
|
21
22
|
};
|
|
22
|
-
return (_jsx(SalesChannel, { disabled: isNonEditable, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
23
|
+
return (_jsx(SalesChannel, { disabled: isNonEditable, readOnly: readOnly, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
23
24
|
};
|
|
24
25
|
export default SalesChannels;
|
|
@@ -3,6 +3,7 @@ interface SegmentsProps {
|
|
|
3
3
|
show: boolean;
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
|
+
readOnly?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const Segments: ({ show, onListOpen, onListClose }: SegmentsProps) => JSX.Element;
|
|
8
|
+
declare const Segments: ({ show, onListOpen, onListClose, readOnly }: SegmentsProps) => JSX.Element;
|
|
8
9
|
export default Segments;
|
|
@@ -24,6 +24,14 @@ import Box from '@mui/material/Box';
|
|
|
24
24
|
import { styled } from '@mui/material/styles';
|
|
25
25
|
import Text from '../../../../components/Text';
|
|
26
26
|
import CheckIcon from '@mui/icons-material/Check';
|
|
27
|
+
var InputStyled = styled(Input)(function (_a) {
|
|
28
|
+
var readOnly = _a.readOnly;
|
|
29
|
+
return ({
|
|
30
|
+
'& .MuiInputBase-input': {
|
|
31
|
+
cursor: readOnly ? 'default' : 'pointer'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
27
35
|
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
28
36
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
29
37
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
@@ -38,7 +46,7 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
38
46
|
});
|
|
39
47
|
var Segments = function (_a) {
|
|
40
48
|
var _b, _c, _d, _e;
|
|
41
|
-
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
|
|
49
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly;
|
|
42
50
|
var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
|
|
43
51
|
var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
|
|
44
52
|
var t = useTranslation().t;
|
|
@@ -55,6 +63,8 @@ var Segments = function (_a) {
|
|
|
55
63
|
}
|
|
56
64
|
}, [segmentsList]);
|
|
57
65
|
var onOpenList = function (event) {
|
|
66
|
+
if (readOnly)
|
|
67
|
+
return;
|
|
58
68
|
setAnchorEl(event.currentTarget);
|
|
59
69
|
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
60
70
|
};
|
|
@@ -66,7 +76,7 @@ var Segments = function (_a) {
|
|
|
66
76
|
onCloseList();
|
|
67
77
|
segmentControl.field.onChange(segment);
|
|
68
78
|
};
|
|
69
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(
|
|
79
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { required: true, label: t('segment_title'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
70
80
|
var _a, _b;
|
|
71
81
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIconStyled, {})] }));
|
|
72
82
|
} }) }))] })) })));
|
|
@@ -3,6 +3,7 @@ interface TeamSizeProps {
|
|
|
3
3
|
show: boolean;
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
|
+
readOnly?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const TeamSize: ({ show, onListOpen, onListClose }: TeamSizeProps) => JSX.Element;
|
|
8
|
+
declare const TeamSize: ({ show, onListOpen, onListClose, readOnly }: TeamSizeProps) => JSX.Element;
|
|
8
9
|
export default TeamSize;
|