@tap-payments/auth-jsconnect 2.3.26-test → 2.3.27-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 (155) hide show
  1. package/build/@types/app.d.ts +12 -1
  2. package/build/@types/app.js +1 -0
  3. package/build/@types/form.d.ts +2 -1
  4. package/build/app/settings.d.ts +3 -1
  5. package/build/app/settings.js +5 -1
  6. package/build/assets/locales/ar.json +3 -1
  7. package/build/assets/locales/en.json +3 -1
  8. package/build/constants/app.d.ts +2 -1
  9. package/build/constants/app.js +1 -0
  10. package/build/constants/validation.d.ts +1 -0
  11. package/build/constants/validation.js +1 -0
  12. package/build/features/app/brand/brandStore.d.ts +5 -2
  13. package/build/features/app/brand/brandStore.js +12 -3
  14. package/build/features/bank/screens/BankDetails/BankDetails.js +18 -4
  15. package/build/features/bank/screens/BankDetails/BankName.d.ts +4 -1
  16. package/build/features/bank/screens/BankDetails/BankName.js +8 -7
  17. package/build/features/bank/screens/BankDetails/BankStatement.d.ts +4 -1
  18. package/build/features/bank/screens/BankDetails/BankStatement.js +3 -8
  19. package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +2 -1
  20. package/build/features/bank/screens/BankDetails/Beneficiary.js +8 -7
  21. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +4 -1
  22. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +6 -3
  23. package/build/features/bank/screens/BankDetails/IBAN.d.ts +2 -1
  24. package/build/features/bank/screens/BankDetails/IBAN.js +2 -2
  25. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -1
  26. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +11 -6
  27. package/build/features/brand/screens/BrandActivities/BrandActivities.js +3 -1
  28. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -1
  29. package/build/features/brand/screens/BrandActivities/CustomerBase.js +12 -9
  30. package/build/features/brand/screens/BrandActivities/ExpectedCustomers.d.ts +2 -1
  31. package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +10 -7
  32. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.d.ts +2 -1
  33. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +9 -6
  34. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +4 -1
  35. package/build/features/brand/screens/BrandActivities/RefundPolicy.js +7 -4
  36. package/build/features/brand/screens/BrandActivities/TAC.d.ts +2 -1
  37. package/build/features/brand/screens/BrandActivities/TAC.js +3 -1
  38. package/build/features/brand/screens/BrandActivities/TransactionPolicy.d.ts +4 -1
  39. package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +7 -4
  40. package/build/features/brand/screens/BrandInfo/BrandInfo.js +14 -9
  41. package/build/features/brand/screens/BrandInfo/BrandLogo.d.ts +9 -0
  42. package/build/features/brand/screens/BrandInfo/BrandLogo.js +52 -0
  43. package/build/features/brand/screens/BrandInfo/BrandName.d.ts +2 -1
  44. package/build/features/brand/screens/BrandInfo/BrandName.js +2 -2
  45. package/build/features/brand/screens/BrandInfo/SalesChannels.d.ts +2 -1
  46. package/build/features/brand/screens/BrandInfo/SalesChannels.js +2 -1
  47. package/build/features/brand/screens/BrandInfo/Segments.d.ts +2 -1
  48. package/build/features/brand/screens/BrandInfo/Segments.js +3 -1
  49. package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +2 -1
  50. package/build/features/brand/screens/BrandInfo/TeamSize.js +3 -1
  51. package/build/features/brand/screens/BrandInfo/validation.d.ts +3 -0
  52. package/build/features/brand/screens/BrandInfo/validation.js +1 -0
  53. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -1
  54. package/build/features/entity/screens/EntityCapital/ActivityList.js +12 -22
  55. package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +2 -1
  56. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +2 -1
  57. package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +2 -1
  58. package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +2 -1
  59. package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +2 -1
  60. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +2 -1
  61. package/build/features/entity/screens/EntityCapital/EntityCapital.js +3 -1
  62. package/build/features/entity/screens/EntityName/Article.d.ts +4 -1
  63. package/build/features/entity/screens/EntityName/Article.js +3 -4
  64. package/build/features/entity/screens/EntityName/EntityName.js +6 -3
  65. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +2 -1
  66. package/build/features/entity/screens/EntityName/EntityTypeList.js +9 -19
  67. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +2 -1
  68. package/build/features/entity/screens/EntityName/ExpiryDate.js +2 -2
  69. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +2 -1
  70. package/build/features/entity/screens/EntityName/IssuingDate.js +2 -2
  71. package/build/features/entity/screens/EntityName/LegalName.d.ts +2 -1
  72. package/build/features/entity/screens/EntityName/LegalName.js +2 -1
  73. package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +4 -1
  74. package/build/features/entity/screens/EntityName/LicenseCertificate.js +3 -8
  75. package/build/features/entity/screens/EntityName/LicenseNumber.d.ts +2 -1
  76. package/build/features/entity/screens/EntityName/LicenseNumber.js +2 -2
  77. package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +2 -1
  78. package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
  79. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +5 -2
  80. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.d.ts +6 -3
  81. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +3 -8
  82. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.d.ts +2 -1
  83. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +3 -4
  84. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +2 -1
  85. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -22
  86. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +2 -1
  87. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -23
  88. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -1
  89. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +3 -4
  90. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +2 -1
  91. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +2 -2
  92. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +2 -1
  93. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +2 -2
  94. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.d.ts +4 -1
  95. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +3 -8
  96. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +2 -1
  97. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +12 -23
  98. package/build/features/individual/screens/IndividualList/MobileNumber.js +0 -1
  99. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +1 -0
  100. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +3 -1
  101. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +1 -0
  102. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +3 -1
  103. package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +2 -1
  104. package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +2 -2
  105. package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +2 -1
  106. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
  107. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +2 -1
  108. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +3 -4
  109. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +2 -1
  110. package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +3 -1
  111. package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +2 -1
  112. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +2 -7
  113. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +3 -3
  114. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +1 -0
  115. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +4 -6
  116. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +1 -0
  117. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +2 -4
  118. package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +2 -1
  119. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +2 -2
  120. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +1 -0
  121. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +4 -6
  122. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +1 -0
  123. package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +6 -3
  124. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
  125. package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +2 -1
  126. package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +3 -3
  127. package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
  128. package/build/features/shared/SalesChannels/SalesChannel.js +3 -3
  129. package/build/features/shared/UploadFile/FileUpload.d.ts +3 -1
  130. package/build/features/shared/UploadFile/FileUpload.js +14 -10
  131. package/build/features/shared/UploadFile/UploadWrapper.d.ts +3 -1
  132. package/build/features/shared/UploadFile/UploadWrapper.js +3 -2
  133. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -1
  134. package/build/features/shared/UploadMultipleFile/UploadFile.js +9 -5
  135. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -1
  136. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +3 -3
  137. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +4 -1
  138. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +6 -3
  139. package/build/features/tax/screens/TaxDetails/TaxDetails.js +4 -2
  140. package/build/features/tax/screens/TaxDetails/TaxDocument.d.ts +4 -1
  141. package/build/features/tax/screens/TaxDetails/TaxDocument.js +3 -8
  142. package/build/features/tax/screens/TaxDetails/VATId.d.ts +4 -1
  143. package/build/features/tax/screens/TaxDetails/VATId.js +5 -7
  144. package/build/hooks/index.d.ts +2 -0
  145. package/build/hooks/index.js +2 -0
  146. package/build/hooks/useAppConfig.d.ts +1 -1
  147. package/build/hooks/useAppConfig.js +4 -2
  148. package/build/hooks/useDataNoneEditable.d.ts +2 -0
  149. package/build/hooks/useDataNoneEditable.js +19 -0
  150. package/build/hooks/useFormReadOnly.d.ts +6 -0
  151. package/build/hooks/useFormReadOnly.js +38 -0
  152. package/build/utils/string.js +7 -8
  153. package/package.json +1 -1
  154. package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +0 -20
  155. package/build/features/brand/screens/BrandActivities/OperationStartDate.js +0 -45
@@ -19,6 +19,7 @@ import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues }
19
19
  import { yupResolver } from '@hookform/resolvers/yup';
20
20
  import { BrandActivitiesValidationSchema } from './validation';
21
21
  import Button from '../../../shared/Button';
22
+ import { settingsSelector } from '../../../../app/settings';
22
23
  import { brandSelector, updateBrandActivities } from '../../../app/brand/brandStore';
23
24
  import { handlePrevScreenStep } from '../../../../app/settings';
24
25
  import { useTranslation } from 'react-i18next';
@@ -37,6 +38,7 @@ var FormStyled = styled(Form)(function () { return ({
37
38
  var BrandActivities = function (_a) {
38
39
  var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
39
40
  var dispatch = useAppDispatch();
41
+ var settingData = useAppSelector(settingsSelector).data;
40
42
  var _c = useAppSelector(brandSelector), data = _c.data, loading = _c.loading, error = _c.error;
41
43
  var brand = (data.verify.responseBody || {}).brand;
42
44
  var _d = data.brandActivities, activities = _d.activities, customerLocations = _d.customerLocations, expectedCustomer = _d.expectedCustomer, expectedSale = _d.expectedSale, termAndConditionChecked = _d.termAndConditionChecked, refundPolicy = _d.refundPolicy, transactionPolicy = _d.transactionPolicy;
@@ -77,6 +79,6 @@ var BrandActivities = function (_a) {
77
79
  var isCustomerBaseListActive = listActive === ListType.CustomerBaseList;
78
80
  var isExpectedCustomerListActive = listActive === ListType.ExpectedCustomerList;
79
81
  var isExpectedSalesListActive = listActive === ListType.ExpectedSalesList;
80
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivitiesList, { show: !isCustomerBaseListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ActivitiesList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(CustomerBase, { show: !isActivitiesListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.CustomerBaseList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedCustomers, { show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomerList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedSalesRange, { show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedCustomerListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(TAC, { show: true }), _jsx(RefundPolicy, {}), _jsx(TransactionPolicy, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
82
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivitiesList, { readOnly: !settingData.boardMaturity && (activities === null || activities === void 0 ? void 0 : activities.length) > 0, show: !isCustomerBaseListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ActivitiesList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(CustomerBase, { readOnly: !settingData.boardMaturity && (customerLocations === null || customerLocations === void 0 ? void 0 : customerLocations.length) > 0, show: !isActivitiesListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.CustomerBaseList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedCustomers, { readOnly: !settingData.boardMaturity && !!(expectedCustomer === null || expectedCustomer === void 0 ? void 0 : expectedCustomer.id), show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomerList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpectedSalesRange, { readOnly: !settingData.boardMaturity && !!(expectedSale === null || expectedSale === void 0 ? void 0 : expectedSale.id), show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedCustomerListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(TAC, { show: true, readOnly: !settingData.boardMaturity && termAndConditionChecked === true }), _jsx(RefundPolicy, { readOnly: !settingData.boardMaturity && refundPolicy === true }), _jsx(TransactionPolicy, { readOnly: !settingData.boardMaturity && transactionPolicy === true }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
81
83
  };
82
84
  export default BrandActivities;
@@ -77,6 +77,7 @@ interface CustomerBaseProps {
77
77
  show: boolean;
78
78
  onListOpen?: () => void;
79
79
  onListClose?: () => void;
80
+ readOnly?: boolean;
80
81
  }
81
- declare const _default: React.MemoExoticComponent<({ ...rest }: CustomerBaseProps) => JSX.Element>;
82
+ declare const _default: React.MemoExoticComponent<({ readOnly, ...props }: CustomerBaseProps) => JSX.Element>;
82
83
  export default _default;
@@ -79,28 +79,31 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
79
79
  height: 'fit-content'
80
80
  }); });
81
81
  var CustomerBase = function (_a) {
82
- var rest = __rest(_a, []);
83
- var _b = React.useState([]), customerLocationsList = _b[0], setCustomerLocationsList = _b[1];
84
- var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
82
+ var _b, _c;
83
+ var readOnly = _a.readOnly, props = __rest(_a, ["readOnly"]);
84
+ var _d = React.useState([]), customerLocationsList = _d[0], setCustomerLocationsList = _d[1];
85
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
85
86
  var t = useTranslation().t;
86
87
  var isAr = useLanguage().isAr;
87
88
  var control = useFormContext().control;
88
89
  var dispatch = useAppDispatch();
89
90
  var customerLocationsControl = useController({ name: 'customerLocations', control: control });
90
- var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
91
- var _e = React.useState(false), isHovered = _e[0], setIsHovered = _e[1];
92
- var brandActivities = data.brandActivities, verify = data.verify;
91
+ var _f = useAppSelector(brandSelector), data = _f.data, error = _f.error;
92
+ var _g = React.useState(false), isHovered = _g[0], setIsHovered = _g[1];
93
+ var brandActivities = data.brandActivities;
93
94
  var response = brandActivities.responseBody;
94
95
  var disabled = false;
95
96
  var onOpenList = function (event) {
96
97
  var _a;
98
+ if (readOnly)
99
+ return;
97
100
  setAnchorEl(event.currentTarget);
98
- (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
101
+ (_a = props.onListOpen) === null || _a === void 0 ? void 0 : _a.call(props);
99
102
  };
100
103
  var onCloseList = function () {
101
104
  var _a, _b;
102
105
  setAnchorEl(null);
103
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
106
+ (_a = props.onListClose) === null || _a === void 0 ? void 0 : _a.call(props);
104
107
  if (((_b = response === null || response === void 0 ? void 0 : response.customerBases) === null || _b === void 0 ? void 0 : _b.length) > 0) {
105
108
  setCustomerLocationsList(response === null || response === void 0 ? void 0 : response.customerBases);
106
109
  }
@@ -137,7 +140,7 @@ var CustomerBase = function (_a) {
137
140
  };
138
141
  var customerLocationsValue = customerLocationsControl.field.value;
139
142
  var customerLocationSelected = customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue[0];
140
- 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: true, disabled: disabled, 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: disabled ? undefined : !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: disabled ? _jsx(_Fragment, {}) : _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) {
143
+ return (_jsx(Collapse, __assign({ in: props.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: true, disabled: disabled, placeholder: t('choose_expected_sales'), value: isAr ? (_b = customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name.en) !== null && _c !== void 0 ? _c : '', onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: disabled ? _jsx(_Fragment, {}) : _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) {
141
144
  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(CheckIconStyled, {}), checkRemainingCondition(item) && item.id != (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(RemainingCheck, {})] }));
142
145
  } })] }))] }) })));
143
146
  };
@@ -3,6 +3,7 @@ interface ExpectedCustomersProps {
3
3
  show: boolean;
4
4
  onListOpen?: () => void;
5
5
  onListClose?: () => void;
6
+ readOnly?: boolean;
6
7
  }
7
- declare const ExpectedCustomers: ({ ...rest }: ExpectedCustomersProps) => JSX.Element;
8
+ declare const ExpectedCustomers: ({ readOnly, ...props }: ExpectedCustomersProps) => JSX.Element;
8
9
  export default ExpectedCustomers;
@@ -45,26 +45,29 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
45
45
  height: 'fit-content'
46
46
  }); });
47
47
  var ExpectedCustomers = function (_a) {
48
- var rest = __rest(_a, []);
49
- var _b = React.useState([]), expectedCustomersList = _b[0], setExpectedCustomersList = _b[1];
50
- var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
48
+ var _b, _c;
49
+ var readOnly = _a.readOnly, props = __rest(_a, ["readOnly"]);
50
+ var _d = React.useState([]), expectedCustomersList = _d[0], setExpectedCustomersList = _d[1];
51
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
51
52
  var t = useTranslation().t;
52
53
  var isAr = useLanguage().isAr;
53
54
  var dispatch = useAppDispatch();
54
55
  var control = useFormContext().control;
55
56
  var expectedCustomerControl = useController({ name: 'expectedCustomer', control: control });
56
- var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
57
+ var _f = useAppSelector(brandSelector), data = _f.data, error = _f.error;
57
58
  var brandActivities = data.brandActivities;
58
59
  var response = brandActivities.responseBody;
59
60
  var onOpenList = function (event) {
60
61
  var _a;
62
+ if (readOnly)
63
+ return;
61
64
  setAnchorEl(event.currentTarget);
62
- (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
65
+ (_a = props.onListOpen) === null || _a === void 0 ? void 0 : _a.call(props);
63
66
  };
64
67
  var onCloseList = function () {
65
68
  var _a, _b;
66
69
  setAnchorEl(null);
67
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
70
+ (_a = props.onListClose) === null || _a === void 0 ? void 0 : _a.call(props);
68
71
  if (((_b = response === null || response === void 0 ? void 0 : response.expectedCustomerSales) === null || _b === void 0 ? void 0 : _b.length) > 0) {
69
72
  setExpectedCustomersList(response === null || response === void 0 ? void 0 : response.expectedCustomerSales);
70
73
  }
@@ -90,7 +93,7 @@ var ExpectedCustomers = function (_a) {
90
93
  };
91
94
  var expectedCustomersValue = expectedCustomerControl.field.value;
92
95
  var expectedCustomersSelected = expectedCustomersValue;
93
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, 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) {
96
+ return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_customers_to_serve') }), _jsx(InputStyled, { readOnly: true, placeholder: t('choose_expected_sales'), value: isAr ? (_b = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = expectedCustomersSelected === null || expectedCustomersSelected === void 0 ? void 0 : expectedCustomersSelected.name.en) !== null && _c !== void 0 ? _c : '', 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) {
94
97
  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(CheckIconStyled, {})] }));
95
98
  } })] }))] }) })));
96
99
  };
@@ -3,6 +3,7 @@ interface ExpectedSalesRangeProps {
3
3
  show: boolean;
4
4
  onListOpen?: () => void;
5
5
  onListClose?: () => void;
6
+ readOnly?: boolean;
6
7
  }
7
- declare const ExpectedSalesRange: ({ show, onListClose, onListOpen }: ExpectedSalesRangeProps) => JSX.Element;
8
+ declare const ExpectedSalesRange: ({ show, onListClose, onListOpen, readOnly }: ExpectedSalesRangeProps) => JSX.Element;
8
9
  export default ExpectedSalesRange;
@@ -46,16 +46,17 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
46
46
  height: 'fit-content'
47
47
  }); });
48
48
  var ExpectedSalesRange = function (_a) {
49
- var show = _a.show, onListClose = _a.onListClose, onListOpen = _a.onListOpen;
50
- var _b = React.useState([]), expectedSalesRangeList = _b[0], setExpectedSalesRangeList = _b[1];
51
- var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
52
- var _d = React.useState(''), subIndex = _d[0], setSubIndex = _d[1];
49
+ var _b, _c;
50
+ var show = _a.show, onListClose = _a.onListClose, onListOpen = _a.onListOpen, readOnly = _a.readOnly;
51
+ var _d = React.useState([]), expectedSalesRangeList = _d[0], setExpectedSalesRangeList = _d[1];
52
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
53
+ var _f = React.useState(''), subIndex = _f[0], setSubIndex = _f[1];
53
54
  var t = useTranslation().t;
54
55
  var isAr = useLanguage().isAr;
55
56
  var control = useFormContext().control;
56
57
  var dispatch = useAppDispatch();
57
58
  var expectedSaleControl = useController({ name: 'expectedSale', control: control });
58
- var _e = useAppSelector(brandSelector), data = _e.data, error = _e.error;
59
+ var _g = useAppSelector(brandSelector), data = _g.data, error = _g.error;
59
60
  var settingsData = useAppSelector(settingsSelector).data;
60
61
  var brandActivities = data.brandActivities, verify = data.verify;
61
62
  var expectedSales = (brandActivities.responseBody || {}).expectedSales;
@@ -63,6 +64,8 @@ var ExpectedSalesRange = function (_a) {
63
64
  var countryCode = settingsData.businessCountry;
64
65
  var disabled = false;
65
66
  var handleOpenMainMenu = function (event) {
67
+ if (disabled || readOnly)
68
+ return;
66
69
  setAnchorEl(event.currentTarget);
67
70
  onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
68
71
  };
@@ -113,7 +116,7 @@ var ExpectedSalesRange = function (_a) {
113
116
  }, [anchorEl, expectedSalesRangeValue]);
114
117
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
115
118
  currency: t(findCurrencyByIso2(countryCode.iso2))
116
- }) }), _jsx(InputStyled, { readOnly: true, disabled: disabled, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: disabled ? undefined : !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: disabled ? _jsx(_Fragment, {}) : _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) {
119
+ }) }), _jsx(InputStyled, { readOnly: true, disabled: disabled, value: isAr ? (_b = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) !== null && _c !== void 0 ? _c : '', onClick: disabled ? undefined : !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: disabled ? _jsx(_Fragment, {}) : _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) {
117
120
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
118
121
  if (isOnlyOneItem)
119
122
  onSelectItem(item);
@@ -32,5 +32,8 @@ export declare const LinkStyled: import("@emotion/styled").StyledComponent<Omit<
32
32
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & {
33
33
  ref?: ((instance: HTMLAnchorElement | null) => void) | React.RefObject<HTMLAnchorElement> | null | undefined;
34
34
  }, "type" | 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" | "translate" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "underline" | "variant" | "href" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "referrerPolicy" | "TypographyClasses"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
35
- declare const RefundPolicy: () => JSX.Element;
35
+ declare type RefundPolicyProps = {
36
+ readOnly?: boolean;
37
+ };
38
+ declare const RefundPolicy: ({ readOnly }: RefundPolicyProps) => JSX.Element;
36
39
  export default RefundPolicy;
@@ -66,17 +66,18 @@ export var LinkStyled = styled(Link)(function (_a) {
66
66
  letterSpacing: theme.spacing(0)
67
67
  });
68
68
  });
69
- var RefundPolicy = function () {
70
- var _a, _b, _c;
69
+ var RefundPolicy = function (_a) {
70
+ var _b, _c, _d;
71
+ var readOnly = _a.readOnly;
71
72
  var t = useTranslation().t;
72
73
  var isAr = useLanguage().isAr;
73
74
  var control = useFormContext().control;
74
75
  var settingsData = useAppSelector(settingsSelector).data;
75
76
  var data = useAppSelector(brandSelector).data;
76
- var terms = (_b = (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.terms;
77
+ var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
77
78
  var refundControl = useController({ control: control, name: 'refundPolicy' });
78
79
  var refundChecked = refundControl.field.value;
79
- var warningMessage = (_c = refundControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
80
+ var warningMessage = (_d = refundControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
80
81
  var countryCode = settingsData.businessCountry.iso2.toLowerCase();
81
82
  var disabled = React.useMemo(function () {
82
83
  var _a, _b;
@@ -86,6 +87,8 @@ var RefundPolicy = function () {
86
87
  })) === null || _b === void 0 ? void 0 : _b.agree);
87
88
  }, [terms]);
88
89
  var handleRefundCheckedChange = function (event, checked) {
90
+ if (readOnly)
91
+ return;
89
92
  refundControl.field.onChange(checked);
90
93
  };
91
94
  return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: refundChecked, onChange: handleRefundCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_refund_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_EN, target: '_blank', underline: 'always' }, { children: t('refund_policy_compliance') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  interface TACProps {
3
3
  show: boolean;
4
+ readOnly?: boolean;
4
5
  }
5
- declare const _default: React.MemoExoticComponent<({ show }: TACProps) => JSX.Element>;
6
+ declare const _default: React.MemoExoticComponent<({ show, readOnly }: TACProps) => JSX.Element>;
6
7
  export default _default;
@@ -68,7 +68,7 @@ var CollapseStyled = styled(Collapse)(function () { return ({
68
68
  }); });
69
69
  var TAC = function (_a) {
70
70
  var _b, _c, _d;
71
- var show = _a.show;
71
+ var show = _a.show, readOnly = _a.readOnly;
72
72
  var t = useTranslation().t;
73
73
  var isAr = useLanguage().isAr;
74
74
  var control = useFormContext().control;
@@ -87,6 +87,8 @@ var TAC = function (_a) {
87
87
  })) === null || _b === void 0 ? void 0 : _b.agree);
88
88
  }, [terms]);
89
89
  var handleTACCheckedChange = function (event, checked) {
90
+ if (readOnly)
91
+ return;
90
92
  tacControl.field.onChange(checked);
91
93
  };
92
94
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
@@ -1,3 +1,6 @@
1
1
  /// <reference types="react" />
2
- declare const TransactionPolicy: () => JSX.Element;
2
+ declare type TransactionPolicyProps = {
3
+ readOnly?: boolean;
4
+ };
5
+ declare const TransactionPolicy: ({ readOnly }: TransactionPolicyProps) => JSX.Element;
3
6
  export default TransactionPolicy;
@@ -26,17 +26,18 @@ import { brandSelector } from '../../../app/brand/brandStore';
26
26
  var CollapseStyled = styled(Collapse)(function () { return ({
27
27
  width: '100%'
28
28
  }); });
29
- var TransactionPolicy = function () {
30
- var _a, _b, _c;
29
+ var TransactionPolicy = function (_a) {
30
+ var _b, _c, _d;
31
+ var readOnly = _a.readOnly;
31
32
  var t = useTranslation().t;
32
33
  var isAr = useLanguage().isAr;
33
34
  var control = useFormContext().control;
34
35
  var settingsData = useAppSelector(settingsSelector).data;
35
36
  var data = useAppSelector(brandSelector).data;
36
- var terms = (_b = (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.terms;
37
+ var terms = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.terms;
37
38
  var transactionControl = useController({ control: control, name: 'transactionPolicy' });
38
39
  var transactionChecked = transactionControl.field.value;
39
- var warningMessage = (_c = transactionControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
40
+ var warningMessage = (_d = transactionControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
40
41
  var countryCode = settingsData.businessCountry.iso2.toLowerCase();
41
42
  var disabled = React.useMemo(function () {
42
43
  var _a, _b;
@@ -46,6 +47,8 @@ var TransactionPolicy = function () {
46
47
  })) === null || _b === void 0 ? void 0 : _b.agree);
47
48
  }, [terms]);
48
49
  var handleTransactionCheckedChange = function (event, checked) {
50
+ if (readOnly)
51
+ return;
49
52
  transactionControl.field.onChange(checked);
50
53
  };
51
54
  return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disabled: disabled, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: transactionChecked, onChange: handleTransactionCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_chargeback_policy'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_EN, target: '_blank', underline: 'always' }, { children: t('chargeback_policy') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
@@ -28,6 +28,7 @@ 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,25 +39,29 @@ var ListType;
38
39
  ListType["TeamSizeList"] = "TeamSizeList";
39
40
  })(ListType || (ListType = {}));
40
41
  var BrandInfo = function (_a) {
41
- var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
42
- var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
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 _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error;
48
- var _e = data.brandData, brandName = _e.brandName, segment = _e.segment, teamSize = _e.teamSize, salesChannels = _e.salesChannels, responseBody = _e.responseBody;
49
+ var _e = useAppSelector(brandSelector), data = _e.data, loading = _e.loading, error = _e.error;
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 logo_details = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}).logo_details;
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: [],
59
+ brandLogoId: brandLogoId
56
60
  },
57
61
  mode: 'onChange'
58
62
  });
59
- useSetFromDefaultValues(methods, data.brandData, true);
63
+ useSetFromDefaultValues(methods, __assign(__assign({}, data.brandData), { salesChannels: [] }), true);
64
+ var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
60
65
  var onSubmit = function (data) {
61
66
  dispatch(updateBrand(data));
62
67
  };
@@ -65,9 +70,9 @@ var BrandInfo = function (_a) {
65
70
  dispatch(clearError());
66
71
  }, [methods.formState.isValid]);
67
72
  React.useEffect(function () {
68
- if (salesChannels.length)
73
+ if (salesChannels.length && !methods.getValues('salesChannels').length)
69
74
  methods.setValue('salesChannels', mapSalesChannel(salesChannels), { shouldValidate: true });
70
- }, []);
75
+ }, [salesChannels]);
71
76
  React.useEffect(function () {
72
77
  if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
73
78
  methods.setError('brandName', { message: 'brand_name_already_exist' });
@@ -79,6 +84,6 @@ var BrandInfo = function (_a) {
79
84
  };
80
85
  var isSegmentsListActive = listActive === ListType.SegmentsList;
81
86
  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') }))] }))] })) })) }));
87
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: !settingData.boardMaturity && !!brandName, show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: !settingData.boardMaturity && !!defaultBrandLogoFile, show: !listActive }), _jsx(Segments, { readOnly: !settingData.boardMaturity && !!(segment === null || segment === void 0 ? void 0 : segment.id), show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { readOnly: !settingData.boardMaturity && !!(teamSize === null || teamSize === void 0 ? void 0 : teamSize.id), show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: !settingData.boardMaturity && (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.length) > 0 }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
83
88
  };
84
89
  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;
@@ -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;
@@ -38,7 +38,7 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
38
38
  });
39
39
  var Segments = function (_a) {
40
40
  var _b, _c, _d, _e;
41
- var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
41
+ var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly;
42
42
  var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
43
43
  var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
44
44
  var t = useTranslation().t;
@@ -55,6 +55,8 @@ var Segments = function (_a) {
55
55
  }
56
56
  }, [segmentsList]);
57
57
  var onOpenList = function (event) {
58
+ if (readOnly)
59
+ return;
58
60
  setAnchorEl(event.currentTarget);
59
61
  onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
60
62
  };
@@ -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;
@@ -38,7 +38,7 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
38
38
  });
39
39
  var TeamSize = function (_a) {
40
40
  var _b, _c, _d, _e;
41
- var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
41
+ var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly;
42
42
  var _f = React.useState([]), teamSizeList = _f[0], setTeamSizeList = _f[1];
43
43
  var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
44
44
  var t = useTranslation().t;
@@ -55,6 +55,8 @@ var TeamSize = function (_a) {
55
55
  }
56
56
  }, [teamSizesList]);
57
57
  var onOpenList = function (event) {
58
+ if (readOnly)
59
+ return;
58
60
  setAnchorEl(event.currentTarget);
59
61
  onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
60
62
  };