@tap-payments/auth-jsconnect 2.1.42-test → 2.1.44-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 (52) hide show
  1. package/build/@types/app.d.ts +4 -0
  2. package/build/@types/form.d.ts +3 -6
  3. package/build/api/entity.d.ts +0 -8
  4. package/build/api/entity.js +0 -15
  5. package/build/api/file.d.ts +13 -0
  6. package/build/api/file.js +24 -0
  7. package/build/api/index.d.ts +6 -2
  8. package/build/api/index.js +3 -1
  9. package/build/api/lead.d.ts +4 -0
  10. package/build/assets/locales/ar.json +5 -1
  11. package/build/assets/locales/en.json +7 -1
  12. package/build/components/FileInput/DragAndDrop.js +1 -1
  13. package/build/components/ProgressBar/CircularProgressBar.d.ts +3 -1
  14. package/build/components/ProgressBar/CircularProgressBar.js +2 -2
  15. package/build/constants/assets.d.ts +1 -0
  16. package/build/constants/assets.js +1 -0
  17. package/build/constants/validation.d.ts +1 -0
  18. package/build/constants/validation.js +1 -0
  19. package/build/features/app/bank/bankStore.js +1 -1
  20. package/build/features/app/business/businessStore.d.ts +7 -9
  21. package/build/features/app/business/businessStore.js +29 -67
  22. package/build/features/app/connect/connectStore.d.ts +1 -1
  23. package/build/features/app/connect/connectStore.js +68 -29
  24. package/build/features/app/individual/individualStore.d.ts +4 -16
  25. package/build/features/app/individual/individualStore.js +11 -89
  26. package/build/features/business/screens/BusinessType/Article.js +10 -13
  27. package/build/features/business/screens/BusinessType/BusinessType.js +2 -4
  28. package/build/features/business/screens/BusinessType/LicenseCertificate.js +12 -50
  29. package/build/features/business/screens/BusinessType/validation.d.ts +3 -6
  30. package/build/features/business/screens/BusinessType/validation.js +1 -11
  31. package/build/features/connect/screens/Merchant/BrandList.js +15 -2
  32. package/build/features/connect/screens/Merchant/Merchant.js +28 -8
  33. package/build/features/connect/screens/Merchant/Segments.d.ts +8 -0
  34. package/build/features/connect/screens/Merchant/Segments.js +74 -0
  35. package/build/features/connect/screens/Merchant/TeamSize.d.ts +8 -0
  36. package/build/features/connect/screens/Merchant/TeamSize.js +74 -0
  37. package/build/features/connect/screens/Merchant/validation.d.ts +6 -0
  38. package/build/features/connect/screens/Merchant/validation.js +5 -1
  39. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -4
  40. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +11 -62
  41. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +11 -59
  42. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +6 -12
  43. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -23
  44. package/build/features/shared/UploadFile/UploadFile.js +1 -1
  45. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +38 -0
  46. package/build/features/shared/UploadMultipleFile/UploadFile.js +184 -0
  47. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +27 -0
  48. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +147 -0
  49. package/build/features/shared/UploadMultipleFile/index.d.ts +2 -0
  50. package/build/features/shared/UploadMultipleFile/index.js +2 -0
  51. package/build/theme/typography.js +1 -1
  52. package/package.json +1 -1
@@ -21,12 +21,13 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { connectSelector } from '../../../app/connect/connectStore';
24
25
  import * as React from 'react';
25
26
  import { useTranslation } from 'react-i18next';
26
27
  import { useFormContext, useController } from 'react-hook-form';
27
28
  import Box from '@mui/material/Box';
28
29
  import { styled } from '@mui/material/styles';
29
- import { useLanguage } from '../../../../hooks';
30
+ import { useAppSelector, useLanguage } from '../../../../hooks';
30
31
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
31
32
  import Input from '../../../shared/Input';
32
33
  import CheckIcon from '../../../shared/CheckIcon';
@@ -52,7 +53,9 @@ var BrandList = function (_a) {
52
53
  var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
53
54
  var t = useTranslation().t;
54
55
  var isAr = useLanguage().isAr;
55
- var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
56
+ var data = useAppSelector(connectSelector).data;
57
+ var _c = data.individualData.responseBody || {}, segments_list = _c.segments_list, team_size_list = _c.team_size_list;
58
+ var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
56
59
  var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
57
60
  var selectedBrand = selectedBrandControl.field.value;
58
61
  var onOpenBrandList = function (event) {
@@ -84,6 +87,16 @@ var BrandList = function (_a) {
84
87
  setValue('salesChannels', [], { shouldValidate: true });
85
88
  setValue('brandName', '');
86
89
  }
90
+ setValue('segment', segments_list.find(function (_a) {
91
+ var _b;
92
+ var id = _a.id;
93
+ return ((_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.type) === id;
94
+ }), { shouldValidate: true });
95
+ setValue('teamSize', team_size_list.find(function (_a) {
96
+ var _b;
97
+ var id = _a.id;
98
+ return ((_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.team) === id;
99
+ }), { shouldValidate: true });
87
100
  onCloseBrandList();
88
101
  };
89
102
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('select_brand_label'), readOnly: true, onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', list: list, onSelectItem: onSelectItem, renderItem: function (item) {
@@ -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 TeamSize from '../../../connect/screens/Merchant/TeamSize';
13
14
  import * as React from 'react';
14
15
  import { useForm, FormProvider } from 'react-hook-form';
15
16
  import { useTranslation } from 'react-i18next';
@@ -27,34 +28,47 @@ import BrandName from './BrandName';
27
28
  import TAC from './TAC';
28
29
  import BrandList from './BrandList';
29
30
  import SalesChannels from './SalesChannels';
31
+ import Segments from './Segments';
32
+ var ListType;
33
+ (function (ListType) {
34
+ ListType["SegmentsList"] = "SegmentsList";
35
+ ListType["TeamSizeList"] = "TeamSizeList";
36
+ ListType["BrandList"] = "BrandList";
37
+ })(ListType || (ListType = {}));
30
38
  var Merchant = function (_a) {
31
39
  var _b;
32
40
  var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
33
- var _d = React.useState(false), isBrandListOpen = _d[0], setIsBrandListOpen = _d[1];
34
- var _e = React.useState(false), isRequiredNewBrand = _e[0], setIsRequiredNewBrand = _e[1];
35
- var _f = useAppSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error;
36
- var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels;
41
+ var _d = React.useState(false), isRequiredNewBrand = _d[0], setIsRequiredNewBrand = _d[1];
42
+ var _e = useAppSelector(connectSelector), data = _e.data, loading = _e.loading, error = _e.error;
43
+ var _f = data.brandData, brandName = _f.brandName, selectedBrandItem = _f.selectedBrandItem, termAndConditionChecked = _f.termAndConditionChecked, responseBody = _f.responseBody, salesChannels = _f.salesChannels, segment = _f.segment, teamSize = _f.teamSize;
37
44
  var brandList = (responseBody || {}).brand_list;
45
+ var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
38
46
  var methods = useForm({
39
47
  resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
40
48
  defaultValues: {
41
49
  brandName: brandName,
42
50
  selectedBrandItem: selectedBrandItem,
43
51
  termAndConditionChecked: termAndConditionChecked,
44
- salesChannels: salesChannels
52
+ salesChannels: salesChannels,
53
+ segment: segment,
54
+ teamSize: teamSize
45
55
  },
46
56
  mode: 'onChange'
47
57
  });
48
58
  var t = useTranslation().t;
49
59
  var isAr = useLanguage().isAr;
50
60
  var dispatch = useAppDispatch();
51
- var brandListItem = methods.watch('selectedBrandItem');
61
+ var brandListItem = methods.getValues('selectedBrandItem');
52
62
  var onSubmit = function (formData) {
53
63
  dispatch(updateLeadBrand(__assign(__assign({}, formData), { isNewBrand: isRequiredNewBrand })));
54
64
  };
55
65
  var onBack = function () {
56
66
  dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
57
67
  };
68
+ React.useEffect(function () {
69
+ methods.setValue('segment', segment);
70
+ methods.setValue('teamSize', teamSize);
71
+ }, [segment, teamSize]);
58
72
  React.useEffect(function () {
59
73
  if (error)
60
74
  dispatch(clearError());
@@ -67,7 +81,7 @@ var Merchant = function (_a) {
67
81
  if (termAndConditionChecked === true)
68
82
  methods.setValue('termAndConditionChecked', termAndConditionChecked);
69
83
  }, [termAndConditionChecked]);
70
- var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
84
+ var brandErrChecks = !!Object.entries(methods.formState.errors).length || !!error;
71
85
  var disabled = brandErrChecks || brandNameChecking || ((_b = data.brandData.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) === '5';
72
86
  var hasBrandList = (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0;
73
87
  var isOtherBrand = (brandListItem === null || brandListItem === void 0 ? void 0 : brandListItem.id) === 'other' && hasBrandList;
@@ -75,6 +89,12 @@ var Merchant = function (_a) {
75
89
  React.useEffect(function () {
76
90
  setIsRequiredNewBrand(isOtherBrand || isNewBrand);
77
91
  }, [isOtherBrand, isNewBrand]);
78
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen }), _jsx(Collapse, __assign({ in: !isBrandListOpen, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
92
+ var handleMenuClick = function (flag) {
93
+ setListActive(flag);
94
+ };
95
+ var isSegmentsListActive = listActive === ListType.SegmentsList;
96
+ var isTeamSizeListActive = listActive === ListType.TeamSizeList;
97
+ var isBrandListActive = listActive === ListType.BrandList;
98
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand) && !isTeamSizeListActive && !isSegmentsListActive, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Segments, { show: !isTeamSizeListActive && !isBrandListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentsListActive && !isBrandListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !listActive }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
79
99
  };
80
100
  export default React.memo(Merchant);
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ interface SegmentsProps {
3
+ show: boolean;
4
+ onListOpen?: () => void;
5
+ onListClose?: () => void;
6
+ }
7
+ declare const Segments: ({ show, onListOpen, onListClose }: SegmentsProps) => JSX.Element;
8
+ export default Segments;
@@ -0,0 +1,74 @@
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { connectSelector } from '../../../app/connect/connectStore';
14
+ import Collapse from '../../../../components/Collapse';
15
+ import { ScreenContainer } from '../../../../features/shared/Containers';
16
+ import Input from '../../../../features/shared/Input';
17
+ import { useAppSelector, useLanguage } from '../../../../hooks';
18
+ import React from 'react';
19
+ import { useTranslation } from 'react-i18next';
20
+ import { useController, useFormContext } from 'react-hook-form';
21
+ import SimpleList from '../../../../components/SimpleList';
22
+ import ExpandIcon from '../../../../components/ExpandIcon';
23
+ import Box from '@mui/material/Box';
24
+ import { styled } from '@mui/material/styles';
25
+ import Text from '../../../../components/Text';
26
+ import CheckIcon from '@mui/icons-material/Check';
27
+ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
28
+ var theme = _a.theme, isSelected = _a.isSelected;
29
+ 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' }));
30
+ });
31
+ var CheckIconStyled = styled(CheckIcon)(function (_a) {
32
+ var theme = _a.theme;
33
+ return ({
34
+ color: theme.palette.success.main,
35
+ display: 'flex',
36
+ alignItems: 'flex-end'
37
+ });
38
+ });
39
+ var Segments = function (_a) {
40
+ var _b, _c, _d, _e;
41
+ var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
42
+ var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
43
+ var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
44
+ var t = useTranslation().t;
45
+ var isAr = useLanguage().isAr;
46
+ var data = useAppSelector(connectSelector).data;
47
+ var control = useFormContext().control;
48
+ var segmentsList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segments_list) || [];
49
+ var segmentControl = useController({ control: control, name: 'segment' });
50
+ var segment = segmentControl.field.value;
51
+ var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
52
+ React.useEffect(function () {
53
+ if ((segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.length) > 0) {
54
+ setSegmentList(segmentsList);
55
+ }
56
+ }, [segmentsList]);
57
+ var onOpenList = function (event) {
58
+ setAnchorEl(event.currentTarget);
59
+ onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
60
+ };
61
+ var onCloseList = function () {
62
+ setAnchorEl(null);
63
+ onListClose === null || onListClose === void 0 ? void 0 : onListClose();
64
+ };
65
+ var onSelectItem = function (segment) {
66
+ onCloseList();
67
+ segmentControl.field.onChange(segment);
68
+ };
69
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('segment_title'), readOnly: true, 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
+ var _a, _b;
71
+ 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
+ } }) }))] })) })));
73
+ };
74
+ export default Segments;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ interface TeamSizeProps {
3
+ show: boolean;
4
+ onListOpen?: () => void;
5
+ onListClose?: () => void;
6
+ }
7
+ declare const TeamSize: ({ show, onListOpen, onListClose }: TeamSizeProps) => JSX.Element;
8
+ export default TeamSize;
@@ -0,0 +1,74 @@
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { connectSelector } from '../../../app/connect/connectStore';
14
+ import Box from '@mui/material/Box';
15
+ import Collapse from '../../../../components/Collapse';
16
+ import { ScreenContainer } from '../../../../features/shared/Containers';
17
+ import Input from '../../../../features/shared/Input';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
+ import React from 'react';
20
+ import { useTranslation } from 'react-i18next';
21
+ import { useController, useFormContext } from 'react-hook-form';
22
+ import SimpleList from '../../../../components/SimpleList';
23
+ import ExpandIcon from '../../../../components/ExpandIcon';
24
+ import { styled } from '@mui/material/styles';
25
+ import Text from '../../../../components/Text';
26
+ import CheckIcon from '@mui/icons-material/Check';
27
+ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
28
+ var theme = _a.theme, isSelected = _a.isSelected;
29
+ 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' }));
30
+ });
31
+ var CheckIconStyled = styled(CheckIcon)(function (_a) {
32
+ var theme = _a.theme;
33
+ return ({
34
+ color: theme.palette.success.main,
35
+ display: 'flex',
36
+ alignItems: 'flex-end'
37
+ });
38
+ });
39
+ var TeamSize = function (_a) {
40
+ var _b, _c, _d, _e;
41
+ var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
42
+ var _f = React.useState([]), teamSizeList = _f[0], setTeamSizeList = _f[1];
43
+ var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
44
+ var t = useTranslation().t;
45
+ var isAr = useLanguage().isAr;
46
+ var data = useAppSelector(connectSelector).data;
47
+ var control = useFormContext().control;
48
+ var teamSizesList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.team_size_list) || [];
49
+ var teamSizeControl = useController({ control: control, name: 'teamSize' });
50
+ var teamSize = teamSizeControl.field.value;
51
+ var error = (_c = teamSizeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
52
+ React.useEffect(function () {
53
+ if ((teamSizesList === null || teamSizesList === void 0 ? void 0 : teamSizesList.length) > 0) {
54
+ setTeamSizeList(teamSizesList);
55
+ }
56
+ }, [teamSizesList]);
57
+ var onOpenList = function (event) {
58
+ setAnchorEl(event.currentTarget);
59
+ onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
60
+ };
61
+ var onCloseList = function () {
62
+ setAnchorEl(null);
63
+ onListClose === null || onListClose === void 0 ? void 0 : onListClose();
64
+ };
65
+ var onSelectItem = function (teamSize) {
66
+ onCloseList();
67
+ teamSizeControl.field.onChange(teamSize);
68
+ };
69
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('team_size_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_team_size'), value: (isAr ? (_d = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = teamSize === null || teamSize === void 0 ? void 0 : teamSize.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.en', 'name.ar'], list: teamSizeList, onSelectItem: onSelectItem, renderItem: function (item) {
70
+ var _a, _b;
71
+ return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.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 === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(CheckIconStyled, {})] }));
72
+ } }) }))] })) })));
73
+ };
74
+ export default TeamSize;
@@ -9,6 +9,8 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
9
9
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
10
10
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>[] | undefined>;
12
+ segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
13
+ teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
12
14
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
15
  salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
14
16
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
@@ -19,6 +21,8 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
19
21
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
20
22
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
23
  }>>[] | undefined>;
24
+ segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
25
+ teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
22
26
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
23
27
  salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
28
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
@@ -29,4 +33,6 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
29
33
  }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
30
34
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
31
35
  }>>[] | undefined>;
36
+ segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
37
+ teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
32
38
  }>>>;
@@ -86,6 +86,8 @@ export var MerchantValidationSchema = function (isNewBrand) {
86
86
  })
87
87
  .required('enter_brand_name_english_chars_numbers_space'),
88
88
  termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
89
+ segment: yup.object().required('alert_choose_segment'),
90
+ teamSize: yup.object().required('alert_choose_teamSize'),
89
91
  salesChannels: yup
90
92
  .array()
91
93
  .min(1, 'choose_atleast_one_channel')
@@ -125,6 +127,8 @@ export var MerchantValidationSchema = function (isNewBrand) {
125
127
  return this.createError({ message: result });
126
128
  }
127
129
  })
128
- .required('choose_atleast_one_channel')
130
+ .required('choose_atleast_one_channel'),
131
+ segment: yup.object().required('alert_choose_segment'),
132
+ teamSize: yup.object().required('alert_choose_teamSize')
129
133
  });
130
134
  };
@@ -48,14 +48,27 @@ var AdditionalIndividualInfo = function (_a) {
48
48
  var settingsData = useAppSelector(settingsSelector).data;
49
49
  var countries = settingsData.countries;
50
50
  var user = (data.verify.responseBody || {}).user;
51
+ var _c = data.individualData, occupation = _c.occupation, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerName = _c.employerName, employerLocation = _c.employerLocation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer, civilID = _c.civilID, signatureFileId = _c.signatureFileId, civilIDUploading = _c.civilIDUploading, signatureFileUploading = _c.signatureFileUploading;
51
52
  var methods = useForm({
52
53
  resolver: yupResolver(IndividualInfoValidationSchema),
53
- defaultValues: data.individualData,
54
+ defaultValues: {
55
+ occupation: occupation,
56
+ sourceIncome: sourceIncome,
57
+ monthlyIncome: monthlyIncome,
58
+ employerName: employerName,
59
+ employerLocation: employerLocation,
60
+ isPEP: isPEP,
61
+ isInfluencer: isInfluencer,
62
+ civilID: civilID,
63
+ signatureFileId: signatureFileId,
64
+ civilIDUploading: civilIDUploading,
65
+ signatureFileUploading: signatureFileUploading
66
+ },
54
67
  mode: 'onChange'
55
68
  });
56
69
  useSetFromDefaultValues(methods, data.individualData, true);
57
- var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
58
- var _d = React.useState(false), employerFieldsActive = _d[0], setEmployerFieldsActive = _d[1];
70
+ var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
71
+ var _e = React.useState(false), employerFieldsActive = _e[0], setEmployerFieldsActive = _e[1];
59
72
  React.useEffect(function () {
60
73
  var _a, _b;
61
74
  if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
@@ -76,7 +89,8 @@ var AdditionalIndividualInfo = function (_a) {
76
89
  var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
77
90
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
78
91
  var isOccupationListActive = listActive === ListType.OccupationList;
79
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive && !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: user === null || user === void 0 ? void 0 : user.is_authorized })] })), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
92
+ var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
93
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive && !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: user === null || user === void 0 ? void 0 : user.is_authorized })] })), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
80
94
  };
81
95
  export default React.memo(AdditionalIndividualInfo);
82
96
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,14 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
2
  import { ScreenContainer } from '../../../../features/shared/Containers';
4
3
  import { styled } from '@mui/material/styles';
5
4
  import { useTranslation } from 'react-i18next';
6
5
  import { useController, useFormContext } from 'react-hook-form';
7
6
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
- import { individualSelector, uploadCivilIdFile } from '../../../../features/app/individual/individualStore';
9
- import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
10
- import UploadFile from '../../../../features/shared/UploadFile';
11
- import { maskFileName } from '../../../../utils';
7
+ import { civilIDUploadingStatus, individualSelector } from '../../../app/individual/individualStore';
8
+ import UploadMultipleFile from '../../../shared/UploadMultipleFile';
12
9
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
13
10
  var theme = _a.theme;
14
11
  return ({
@@ -16,66 +13,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
16
13
  });
17
14
  });
18
15
  var CivilIDFile = function () {
19
- var _a, _b;
20
- var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
16
+ var _a;
21
17
  var t = useTranslation().t;
22
- var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors, setValue = _d.setValue;
23
- var civilIDFileControl = useController({ name: 'civilIDFile', control: control });
24
- var civilIDFileIdControl = useController({ name: 'civilID', control: control });
25
- var _e = useAppSelector(individualSelector), data = _e.data, loading = _e.loading, sysError = _e.error;
26
- var _f = data.attachmentsData, civilIDUploading = _f.civilIDUploading, civilIDFile = _f.civilIDFile, civilID = _f.civilID;
27
18
  var dispatch = useAppDispatch();
28
- var civilIDValue = civilIDFileControl.field.value;
29
- var error = ((_a = civilIDFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = civilIDFileIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
30
- var handleCivilIDChange = function (files) {
31
- var _a;
32
- var file = files === null || files === void 0 ? void 0 : files[0];
33
- if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
34
- setError('civilIDFile', { message: 'file_not_supported_alert' });
35
- }
36
- else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
37
- setError('civilIDFile', { message: 'file_size_alert' });
38
- }
39
- else {
40
- civilIDFileControl.field.onChange(file);
41
- dispatch(uploadCivilIdFile({
42
- file: file,
43
- onProgress: function (value) {
44
- setProgress(value);
45
- },
46
- title: (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant_id
47
- }));
48
- }
19
+ var control = useFormContext().control;
20
+ var civilIDFileIdControl = useController({ name: 'civilID', control: control });
21
+ var _b = useAppSelector(individualSelector), loading = _b.loading, data = _b.data;
22
+ var handleCivilIDChange = function (ids) {
23
+ civilIDFileIdControl.field.onChange(ids);
49
24
  };
50
- var handleReset = function () {
51
- civilIDFileControl.field.onChange(null);
52
- civilIDFileIdControl.field.onChange('');
53
- setProgress(0);
25
+ var handleReset = function (ids) {
26
+ civilIDFileIdControl.field.onChange(ids);
54
27
  };
55
- React.useEffect(function () {
56
- if (!!civilIDFile) {
57
- setValue('civilIDFile', civilIDFile);
58
- setValue('civilID', civilID);
59
- }
60
- }, [civilIDFile, civilID]);
61
- React.useEffect(function () {
62
- if (sysError === 'file_upload_error') {
63
- setError('civilIDFileId', { message: sysError });
64
- civilIDFileControl.field.onChange(null);
65
- setProgress(0);
66
- }
67
- }, [sysError]);
68
- React.useEffect(function () {
69
- if ((civilIDFileControl.formState.isValid || !!civilIDValue) && error != 'file_upload_error')
70
- clearErrors();
71
- }, [civilIDFileControl.formState.isValid, civilIDValue]);
72
- React.useEffect(function () {
73
- if (!!civilIDFile) {
74
- civilIDFileControl.field.onChange(civilIDFile);
75
- civilIDFileIdControl.field.onChange(civilID);
76
- }
77
- }, []);
78
- var fileName = civilIDValue ? maskFileName(civilIDValue === null || civilIDValue === void 0 ? void 0 : civilIDValue.name) : '';
79
- return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isFileUploaded: !civilIDUploading && !!civilIDValue, isSubmitting: loading, isUploading: civilIDUploading, progress: progress, onReset: handleReset, initialFileName: fileName, error: error && t(error) }) }));
28
+ return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, fileTitle: (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant_id, purpose: 'identity_document', fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); } }) }));
80
29
  };
81
30
  export default CivilIDFile;
@@ -10,17 +10,14 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import React from 'react';
14
- import { ScreenContainer } from '../../../../features/shared/Containers';
15
- import { styled } from '@mui/material/styles';
16
13
  import { useTranslation } from 'react-i18next';
17
14
  import { useController, useFormContext } from 'react-hook-form';
15
+ import { styled } from '@mui/material/styles';
18
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
- import { individualSelector, uploadSignatureFile } from '../../../../features/app/individual/individualStore';
20
- import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
21
- import UploadFile from '../../../../features/shared/UploadFile';
17
+ import UploadMultipleFile from '../../../shared/UploadMultipleFile';
18
+ import { ScreenContainer } from '../../../shared/Containers';
19
+ import { individualSelector, signatureFileUploadingStatus } from '../../../app/individual/individualStore';
22
20
  import Collapse from '../../../../components/Collapse';
23
- import { maskFileName } from '../../../../utils';
24
21
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
25
22
  var theme = _a.theme;
26
23
  return ({
@@ -28,63 +25,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
28
25
  });
29
26
  });
30
27
  var SignatureFile = function (_a) {
31
- var _b, _c;
32
28
  var show = _a.show;
33
- var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
34
29
  var t = useTranslation().t;
35
- var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors, setValue = _e.setValue;
36
- var signatureFileControl = useController({ name: 'signatureFile', control: control });
30
+ var control = useFormContext().control;
37
31
  var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
38
- var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, sysError = _f.error;
39
- var _g = data.attachmentsData, signatureFileUploading = _g.signatureFileUploading, signatureFile = _g.signatureFile, signatureFileId = _g.signatureFileId;
32
+ var loading = useAppSelector(individualSelector).loading;
40
33
  var dispatch = useAppDispatch();
41
- var signatureValue = signatureFileControl.field.value;
42
- var error = ((_b = signatureFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = signatureFileIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
43
- var handleSignatureChange = function (files) {
44
- var file = files === null || files === void 0 ? void 0 : files[0];
45
- if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
46
- setError('signatureFile', { message: 'file_not_supported_alert' });
47
- }
48
- else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
49
- setError('signatureFile', { message: 'file_size_alert' });
50
- }
51
- else {
52
- signatureFileControl.field.onChange(file);
53
- dispatch(uploadSignatureFile({
54
- file: file,
55
- onProgress: function (value) {
56
- setProgress(value);
57
- }
58
- }));
59
- }
34
+ var handleSignatureChange = function (ids) {
35
+ signatureFileIdControl.field.onChange(ids);
60
36
  };
61
- var handleReset = function () {
62
- signatureFileControl.field.onChange(null);
63
- signatureFileIdControl.field.onChange('');
64
- setProgress(0);
37
+ var handleReset = function (ids) {
38
+ signatureFileIdControl.field.onChange(ids);
65
39
  };
66
- React.useEffect(function () {
67
- if (sysError === 'file_upload_error') {
68
- setError('signatureFileId', { message: sysError });
69
- signatureFileControl.field.onChange(null);
70
- setProgress(0);
71
- }
72
- }, [sysError]);
73
- React.useEffect(function () {
74
- if ((signatureFileControl.formState.isValid || !!signatureValue) && error != 'file_upload_error')
75
- clearErrors();
76
- }, [signatureFileControl.formState.isValid, signatureValue]);
77
- React.useEffect(function () {
78
- if (!!signatureFile) {
79
- setValue('signatureFile', signatureFile);
80
- setValue('signatureFileId', signatureFileId);
81
- }
82
- }, [signatureFile, signatureFileId]);
83
- React.useEffect(function () {
84
- if (!!signatureValue)
85
- signatureFileControl.field.onChange(signatureFile);
86
- }, []);
87
- var fileName = signatureValue ? maskFileName(signatureValue === null || signatureValue === void 0 ? void 0 : signatureValue.name) : '';
88
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isFileUploaded: !signatureFileUploading && !!signatureValue, isSubmitting: loading, initialFileName: fileName, isUploading: signatureFileUploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
40
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, purpose: 'customer_signature', fileTitle: 'Merchant Signature', fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); } }) }) })));
89
41
  };
90
42
  export default SignatureFile;