@tap-payments/auth-jsconnect 2.1.9-test → 2.1.10-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/form.d.ts +4 -3
- package/build/api/entity.d.ts +1 -1
- package/build/assets/locales/ar.json +7 -0
- package/build/assets/locales/en.json +7 -0
- package/build/components/FileInput/DragAndDrop.d.ts +3 -2
- package/build/components/FileInput/DragAndDrop.js +4 -4
- package/build/components/Lottie/Lottie.d.ts +2924 -127
- package/build/components/Lottie/Lottie.js +8 -4
- package/build/components/Lottie/files/error.json +692 -0
- package/build/components/Lottie/files/start_loading.json +1140 -0
- package/build/components/Lottie/files/still_loading.json +1140 -0
- package/build/features/app/business/businessStore.d.ts +8 -1
- package/build/features/app/business/businessStore.js +74 -15
- package/build/features/app/connect/connectStore.d.ts +1 -1
- package/build/features/app/connect/connectStore.js +47 -38
- package/build/features/bank/screens/BankDetails/BankStatement.js +14 -11
- package/build/features/business/screens/BusinessType/Article.d.ts +6 -0
- package/build/features/business/screens/BusinessType/Article.js +89 -0
- package/build/features/business/screens/BusinessType/BusinessType.js +16 -10
- package/build/features/business/screens/BusinessType/EntityName.js +1 -1
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +14 -9
- package/build/features/business/screens/BusinessType/LicenseList.js +3 -2
- package/build/features/business/screens/BusinessType/LicenseType.js +3 -3
- package/build/features/business/screens/BusinessType/validation.js +17 -8
- package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +9 -134
- package/build/features/connect/screens/Merchant/Merchant.js +4 -24
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +2 -5
- package/build/features/connect/screens/Merchant/SalesChannels.js +29 -99
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +9 -73
- package/build/features/entity/screens/EntityInfoConfirm/Article.js +14 -11
- package/build/features/shared/PaciVerification/PaciVerification.d.ts +12 -0
- package/build/features/shared/PaciVerification/PaciVerification.js +91 -0
- package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACILoading.d.ts +1 -0
- package/build/features/shared/PaciVerification/VerifyPACILoading.js +13 -0
- package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.d.ts +0 -0
- package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.js +1 -1
- package/build/features/shared/PaciVerification/index.d.ts +2 -0
- package/build/features/shared/PaciVerification/index.js +2 -0
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +11 -0
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +100 -0
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +10 -0
- package/build/features/shared/SalesChannels/SalesChannel.js +132 -0
- package/build/features/shared/SalesChannels/index.d.ts +2 -0
- package/build/features/shared/SalesChannels/index.js +2 -0
- package/build/features/shared/UploadFile/UploadFile.d.ts +3 -2
- package/build/features/shared/UploadFile/UploadFile.js +13 -13
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useCountUp.d.ts +9 -0
- package/build/hooks/useCountUp.js +17 -0
- package/package.json +1 -1
- package/build/components/Lottie/files/pulsating_circle_waves.json +0 -236
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +0 -23
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +0 -8
- package/build/features/connect/screens/Merchant/SocialMedia.js +0 -156
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +0 -6
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +0 -23
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +0 -5
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +0 -8
|
@@ -0,0 +1,91 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import Box from '@mui/material/Box/Box';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import Text from '../../../components/Text';
|
|
18
|
+
import { ScreenContainer } from '../../shared/Containers';
|
|
19
|
+
import { MobileButton } from '../../shared/Button';
|
|
20
|
+
import { mobileOS } from '../../../utils';
|
|
21
|
+
import { useCountUp } from '../../../hooks';
|
|
22
|
+
import VerifyPACILoading from './VerifyPACILoading';
|
|
23
|
+
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
24
|
+
var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
|
|
25
|
+
var theme = _a.theme;
|
|
26
|
+
return ({
|
|
27
|
+
direction: theme.direction,
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
marginBottom: theme.spacing(2.5)
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var VerifyPACITitleStyled = styled(Text)(function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBottom: theme.spacing(2.4), lineHeight: '19.2px' }));
|
|
37
|
+
});
|
|
38
|
+
var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
|
|
39
|
+
var theme = _a.theme;
|
|
40
|
+
return (__assign(__assign({}, theme.typography.body2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, lineHeight: '16.8px' }));
|
|
41
|
+
});
|
|
42
|
+
var Container = styled(Box)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return ({
|
|
45
|
+
position: 'relative',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
maxHeight: '300px',
|
|
50
|
+
marginBottom: theme.spacing(3.25)
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
var VerifyPACI = function (_a) {
|
|
54
|
+
var success = _a.success, expiryInSeconds = _a.expiryInSeconds, urls = _a.urls, onFinish = _a.onFinish;
|
|
55
|
+
var t = useTranslation().t;
|
|
56
|
+
var count = useCountUp({ start: 0, end: expiryInSeconds, sleepMS: 1000 }).count;
|
|
57
|
+
var errorWaitingTime = 3;
|
|
58
|
+
var phases = 2;
|
|
59
|
+
var remainingTime = expiryInSeconds - errorWaitingTime;
|
|
60
|
+
var phaseNumber = Math.floor((count / remainingTime) * phases) + 1;
|
|
61
|
+
var isEnded = count === expiryInSeconds;
|
|
62
|
+
var endPhaseStarted = count >= remainingTime;
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
if (isEnded && onFinish)
|
|
65
|
+
onFinish();
|
|
66
|
+
}, [isEnded]);
|
|
67
|
+
var onRedirect = React.useCallback(function () {
|
|
68
|
+
if (os === 'Android') {
|
|
69
|
+
window.open(urls === null || urls === void 0 ? void 0 : urls.android, '_blank');
|
|
70
|
+
}
|
|
71
|
+
if (os === 'iOS') {
|
|
72
|
+
window.open(urls === null || urls === void 0 ? void 0 : urls.ios, '_blank');
|
|
73
|
+
}
|
|
74
|
+
}, [urls]);
|
|
75
|
+
var os = React.useMemo(function () { return mobileOS(); }, []);
|
|
76
|
+
var isAndroid = React.useMemo(function () { return os === 'Android' && (urls === null || urls === void 0 ? void 0 : urls.android); }, [os, urls]);
|
|
77
|
+
var isIOS = React.useMemo(function () { return os === 'iOS' && (urls === null || urls === void 0 ? void 0 : urls.ios); }, [os, urls]);
|
|
78
|
+
var title = React.useMemo(function () {
|
|
79
|
+
if (phaseNumber === 1)
|
|
80
|
+
return 'paci_verification_title_wait';
|
|
81
|
+
return 'paci_verification_title_check';
|
|
82
|
+
}, [phaseNumber]);
|
|
83
|
+
var description = React.useMemo(function () {
|
|
84
|
+
if (phaseNumber === 1)
|
|
85
|
+
return 'paci_verification_description_wait';
|
|
86
|
+
return 'paci_verification_description_check';
|
|
87
|
+
}, [phaseNumber]);
|
|
88
|
+
var isErrorPhase = endPhaseStarted && !success;
|
|
89
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, { type: isErrorPhase ? 3 : phaseNumber }) }), isErrorPhase ? (_jsxs(_Fragment, { children: [_jsx(VerifyPACITitleStyled, { children: t('paci_verification_title_error') }), _jsx(VerifyPACISubTitleStyled, __assign({ sx: { pb: 1 } }, { children: t('paci_verification_description_error') })), _jsx(VerifyPACISubTitleStyled, { children: t('paci_verification_redirection_message') })] })) : (_jsxs(_Fragment, { children: [_jsx(VerifyPACITitleStyled, { children: t(title) }), _jsx(VerifyPACISubTitleStyled, { children: t(description) })] }))] }), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') })))] })));
|
|
90
|
+
};
|
|
91
|
+
export default React.memo(VerifyPACI);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import LottieFile, { LottieAnimationFiles } from '../../../components/Lottie';
|
|
4
|
+
var VerifyPACILoading = function (_a) {
|
|
5
|
+
var _b = _a.loop, loop = _b === void 0 ? true : _b, type = _a.type;
|
|
6
|
+
if (type === 1)
|
|
7
|
+
return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.start_loading, loop: loop, width: '90%' }) }));
|
|
8
|
+
if (type === 2)
|
|
9
|
+
return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.still_loading, loop: loop, width: '90%' }) }));
|
|
10
|
+
return (_jsx(_Fragment, { children: _jsx(LottieFile, { file: LottieAnimationFiles.error, loop: false, width: '90%' }) }));
|
|
11
|
+
};
|
|
12
|
+
VerifyPACILoading.defaultProps = {};
|
|
13
|
+
export default memo(VerifyPACILoading);
|
|
File without changes
|
package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import LottieFile, { LottieAnimationFiles } from '
|
|
3
|
+
import LottieFile, { LottieAnimationFiles } from '../../../components/Lottie';
|
|
4
4
|
var VerifyPACISuccess = function () {
|
|
5
5
|
return (_jsx(_Fragment, { children: _jsx(LottieFile, { loop: false, file: LottieAnimationFiles.success, width: '90%' }) }));
|
|
6
6
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SaleChannel } from '../../../@types';
|
|
3
|
+
interface SaleChannelIconsInputProps {
|
|
4
|
+
selectedChannels: SaleChannel[];
|
|
5
|
+
onSelectIcon: (id: string) => void;
|
|
6
|
+
selectedIconId: string;
|
|
7
|
+
onChangeValue: (val: string, id: string) => void;
|
|
8
|
+
error: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export default function SaleChannelIconsInput({ selectedChannels, onSelectIcon, selectedIconId, onChangeValue, error }: SaleChannelIconsInputProps): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import Input from '../../../components/Input';
|
|
17
|
+
import Warning from '../../../components/Warning';
|
|
18
|
+
import Text from '../../../components/Text';
|
|
19
|
+
import Collapse from '../../../components/Collapse';
|
|
20
|
+
import SocialMediaGroup from '../../../components/SocialMediaGroup';
|
|
21
|
+
import ToggleButton from '../../../components/ToggleButton';
|
|
22
|
+
import Icon from '../../../components/Icon';
|
|
23
|
+
import { useLanguage } from '../../../hooks';
|
|
24
|
+
import { isWebsite, isTwitter } from '../../../utils';
|
|
25
|
+
var SocialMediaGroupStyled = styled(SocialMediaGroup)(function (_a) {
|
|
26
|
+
var theme = _a.theme, defaultValue = _a.defaultValue;
|
|
27
|
+
return ({
|
|
28
|
+
borderTop: "1px solid ".concat(alpha(theme.palette.divider, 0.8)),
|
|
29
|
+
borderBottom: !defaultValue ? "1px solid ".concat(alpha(theme.palette.divider, 0.8)) : '',
|
|
30
|
+
width: '100%'
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
var InputStyled = styled(Input)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return ({
|
|
36
|
+
padding: theme.spacing(0, 2, 0, 0),
|
|
37
|
+
paddingInlineEnd: theme.spacing(2),
|
|
38
|
+
input: {
|
|
39
|
+
paddingInlineStart: theme.spacing(0)
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
44
|
+
var theme = _a.theme;
|
|
45
|
+
return ({
|
|
46
|
+
padding: theme.spacing(0, 0, 0, 1.5)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var ToggleIconStyled = styled(Icon, {
|
|
50
|
+
shouldForwardProp: function (prop) { return prop !== 'isActive'; }
|
|
51
|
+
})(function (_a) {
|
|
52
|
+
var theme = _a.theme, isActive = _a.isActive;
|
|
53
|
+
return ({
|
|
54
|
+
width: theme.spacing(3),
|
|
55
|
+
height: theme.spacing(3),
|
|
56
|
+
filter: isActive ? 'invert(1) sepia(1) saturate(5) hue-rotate(175deg)' : ''
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
var SocialMediaButtonStyled = styled(ToggleButton, {
|
|
60
|
+
shouldForwardProp: function (prop) { return prop !== 'isActive' && prop !== 'isShow'; }
|
|
61
|
+
})(function (_a) {
|
|
62
|
+
var theme = _a.theme, isActive = _a.isActive, isShow = _a.isShow;
|
|
63
|
+
return ({
|
|
64
|
+
borderBottom: isActive ? "".concat(theme.spacing(0.1875), " solid #3478F6") : 'none',
|
|
65
|
+
display: isShow ? 'inherit' : 'none',
|
|
66
|
+
transition: 'display 0.3s'
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
export default function SaleChannelIconsInput(_a) {
|
|
70
|
+
var selectedChannels = _a.selectedChannels, onSelectIcon = _a.onSelectIcon, selectedIconId = _a.selectedIconId, onChangeValue = _a.onChangeValue, error = _a.error;
|
|
71
|
+
var isAr = useLanguage().isAr;
|
|
72
|
+
var t = useTranslation().t;
|
|
73
|
+
var getPlaceHolder = function (item) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
if (isAr)
|
|
76
|
+
return ((_a = item.name) === null || _a === void 0 ? void 0 : _a.ar) || '';
|
|
77
|
+
return ((_b = item.name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
78
|
+
};
|
|
79
|
+
return (_jsx(Collapse, __assign({ in: selectedChannels.length > 0 }, { children: _jsxs(Box, __assign({ sx: { mb: 3, direction: 'ltr' } }, { children: [_jsx(SocialMediaGroupStyled, __assign({ exclusive: true, onChange: function (e, value) {
|
|
80
|
+
onSelectIcon(value);
|
|
81
|
+
} }, { children: selectedChannels.map(function (channel, index) {
|
|
82
|
+
var _a;
|
|
83
|
+
var isActive = selectedIconId === channel.id;
|
|
84
|
+
return ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) ? (channel.sub.map(function (sub, subIndex) {
|
|
85
|
+
var isSubActive = selectedIconId === sub.id;
|
|
86
|
+
return (_jsx(SocialMediaButtonStyled, __assign({ isShow: true, isActive: isSubActive, value: sub.id }, { children: _jsx(ToggleIconStyled, { isActive: isSubActive, src: (sub === null || sub === void 0 ? void 0 : sub.logo) || '' }) }), "sub_".concat(subIndex)));
|
|
87
|
+
})) : (_jsx(SocialMediaButtonStyled, __assign({ isShow: true, isActive: isActive, value: channel.id || '' }, { children: _jsx(ToggleIconStyled, { isActive: isActive, src: (channel === null || channel === void 0 ? void 0 : channel.logo) || '' }) }), index));
|
|
88
|
+
}) })), selectedChannels.map(function (channel, index) {
|
|
89
|
+
var _a;
|
|
90
|
+
var isActive = selectedIconId === channel.id;
|
|
91
|
+
return ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) ? (channel.sub.map(function (sub, subIndex) {
|
|
92
|
+
var isSubActive = selectedIconId === sub.id;
|
|
93
|
+
return (_jsx(Collapse, __assign({ in: isSubActive, timeout: 300 }, { children: _jsx(InputStyled, { onChange: function (e) {
|
|
94
|
+
onChangeValue(e.target.value, sub.id);
|
|
95
|
+
}, value: sub.address || '', startAdornment: _jsx(TextStyled, __assign({ sx: __assign({}, (isTwitter(sub.code) && { fontSize: '20px' })) }, { children: isWebsite(sub.code) ? "https://" : isTwitter(sub.code) ? "@" : '' })), placeholder: t(getPlaceHolder(sub)) }) }), "sub_".concat(subIndex)));
|
|
96
|
+
})) : (_jsx(Collapse, __assign({ in: isActive, timeout: 300 }, { children: _jsx(InputStyled, { onChange: function (e) {
|
|
97
|
+
onChangeValue(e.target.value, channel.id);
|
|
98
|
+
}, value: channel.address || '', startAdornment: _jsx(TextStyled, __assign({ sx: __assign({}, (isTwitter(channel.code) && { fontSize: '20px' })) }, { children: isWebsite(channel.code) ? "https://" : isTwitter(channel.code) ? "@" : '' })), placeholder: t(getPlaceHolder(channel)) }) }), index));
|
|
99
|
+
}), _jsx(Collapse, __assign({ in: !!(error && error !== 'choose_atleast_one_channel') }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] })) })));
|
|
100
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SaleChannel } from '../../../@types';
|
|
3
|
+
interface SalesChannelProps {
|
|
4
|
+
list: SaleChannel[];
|
|
5
|
+
error: string | undefined;
|
|
6
|
+
onChange: (channel: SaleChannel[]) => void;
|
|
7
|
+
defaultValues?: SaleChannel[];
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ list, onChange, error, defaultValues }: SalesChannelProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
+
import React from 'react';
|
|
23
|
+
import Box from '@mui/material/Box';
|
|
24
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
25
|
+
import { useTranslation } from 'react-i18next';
|
|
26
|
+
import { useLanguage } from '../../../hooks';
|
|
27
|
+
import Text from '../../../components/Text';
|
|
28
|
+
import CheckBox from '../../../components/CheckBox';
|
|
29
|
+
import Warning from '../../../components/Warning';
|
|
30
|
+
import Collapse from '../../../components/Collapse';
|
|
31
|
+
import { findFirstId } from '../../../utils';
|
|
32
|
+
import SaleChannelIconsInput from './SaleChannelIconsInput';
|
|
33
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return (__assign({ margin: theme.spacing(2.5, 2.5, 0.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
36
|
+
});
|
|
37
|
+
var ContainerStyled = styled(Box)(function (_a) {
|
|
38
|
+
var theme = _a.theme;
|
|
39
|
+
return ({
|
|
40
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
padding: theme.spacing(0, 0.5, 0, 0.5),
|
|
44
|
+
height: theme.spacing(3.625),
|
|
45
|
+
marginBlockEnd: theme.spacing(0.2)
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre' }, theme.typography.body2), { marginBlockStart: theme.spacing(1.75) }));
|
|
51
|
+
});
|
|
52
|
+
var CheckBoxStyled = styled(CheckBox)(function (_a) {
|
|
53
|
+
var theme = _a.theme;
|
|
54
|
+
return ({
|
|
55
|
+
paddingInline: '15px',
|
|
56
|
+
marginInlineEnd: theme.spacing(-1),
|
|
57
|
+
'& .MuiSvgIcon-root': {
|
|
58
|
+
fontSize: 30
|
|
59
|
+
},
|
|
60
|
+
'&.Mui-checked': {
|
|
61
|
+
color: theme.palette.text.primary,
|
|
62
|
+
borderRadius: theme.spacing(2.5)
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
var MandatoryStyled = styled('span')(function (_a) {
|
|
67
|
+
var theme = _a.theme;
|
|
68
|
+
return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
|
|
69
|
+
});
|
|
70
|
+
var CollapseStyled = styled(Collapse)(function (_a) {
|
|
71
|
+
var theme = _a.theme;
|
|
72
|
+
return ({
|
|
73
|
+
marginBlockStart: theme.spacing(2)
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
var SalesChannel = function (_a) {
|
|
77
|
+
var _b = _a.list, list = _b === void 0 ? [] : _b, onChange = _a.onChange, error = _a.error, defaultValues = _a.defaultValues;
|
|
78
|
+
var _c = React.useState([]), selectedSalas = _c[0], setSelectedSales = _c[1];
|
|
79
|
+
var _d = React.useState(''), activeSaleIconId = _d[0], setActiveSaleIconId = _d[1];
|
|
80
|
+
var t = useTranslation().t;
|
|
81
|
+
var isAr = useLanguage().isAr;
|
|
82
|
+
var isChecked = function (id) {
|
|
83
|
+
return !!selectedSalas.find(function (item) { return item.id === id; });
|
|
84
|
+
};
|
|
85
|
+
var onChangeActiveSaleIcon = function (id) {
|
|
86
|
+
setActiveSaleIconId(id);
|
|
87
|
+
};
|
|
88
|
+
var onSelectSalesChannel = function (channel) {
|
|
89
|
+
if (isChecked(channel.id)) {
|
|
90
|
+
var newSelectedSales = selectedSalas.filter(function (item) { return item.id !== channel.id; });
|
|
91
|
+
setSelectedSales(newSelectedSales);
|
|
92
|
+
onChange(newSelectedSales);
|
|
93
|
+
var item = newSelectedSales.at(-1);
|
|
94
|
+
if (item)
|
|
95
|
+
onChangeActiveSaleIcon(findFirstId([item]));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
onChangeActiveSaleIcon(findFirstId([channel]));
|
|
99
|
+
setSelectedSales(__spreadArray(__spreadArray([], selectedSalas, true), [channel], false));
|
|
100
|
+
};
|
|
101
|
+
var onValueChange = function (value, id) {
|
|
102
|
+
var newSelectedSales = selectedSalas.map(function (item) {
|
|
103
|
+
var _a;
|
|
104
|
+
if ((_a = item.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
105
|
+
var sub = item.sub.map(function (subItem) {
|
|
106
|
+
if (subItem.id === id) {
|
|
107
|
+
return __assign(__assign({}, subItem), { address: value });
|
|
108
|
+
}
|
|
109
|
+
return subItem;
|
|
110
|
+
});
|
|
111
|
+
return __assign(__assign({}, item), { sub: sub });
|
|
112
|
+
}
|
|
113
|
+
if (item.id === id) {
|
|
114
|
+
return __assign(__assign({}, item), { address: value });
|
|
115
|
+
}
|
|
116
|
+
return item;
|
|
117
|
+
});
|
|
118
|
+
setSelectedSales(newSelectedSales);
|
|
119
|
+
onChange(newSelectedSales);
|
|
120
|
+
};
|
|
121
|
+
React.useEffect(function () {
|
|
122
|
+
if (defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues.length) {
|
|
123
|
+
setSelectedSales(defaultValues);
|
|
124
|
+
onChangeActiveSaleIcon(findFirstId(defaultValues));
|
|
125
|
+
}
|
|
126
|
+
}, [defaultValues]);
|
|
127
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Box, __assign({ sx: { mb: 3 } }, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), list.map(function (channel, index) {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: isChecked(channel.id), onChange: function () { return onSelectSalesChannel(channel); } }), _jsxs(TextStyled, { children: [isAr ? (_a = channel === null || channel === void 0 ? void 0 : channel.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = channel === null || channel === void 0 ? void 0 : channel.name) === null || _b === void 0 ? void 0 : _b.en, " "] })] }, "".concat(channel.id, "-indx").concat(index)));
|
|
130
|
+
}), _jsx(CollapseStyled, __assign({ in: error === 'choose_atleast_one_channel' }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] }), 'salesChannels'), _jsx(SaleChannelIconsInput, { error: error, selectedIconId: activeSaleIconId, onSelectIcon: onChangeActiveSaleIcon, onChangeValue: onValueChange, selectedChannels: selectedSalas }, 'saleChannelIconsInput')] }));
|
|
131
|
+
};
|
|
132
|
+
export default React.memo(SalesChannel);
|
|
@@ -20,9 +20,10 @@ interface UploadFileProps {
|
|
|
20
20
|
isSubmitting?: boolean;
|
|
21
21
|
isUploading?: boolean;
|
|
22
22
|
isFileUploaded?: boolean;
|
|
23
|
-
onFileUploaded: (
|
|
23
|
+
onFileUploaded: (files: Array<File>) => void;
|
|
24
24
|
onReset: () => void;
|
|
25
25
|
initialFileName?: string;
|
|
26
|
+
multiple?: boolean;
|
|
26
27
|
}
|
|
27
|
-
declare const UploadFile: ({ label, required, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, isUploading, isFileUploaded, error, progress, onFileUploaded, onReset, initialFileName }: UploadFileProps) => JSX.Element;
|
|
28
|
+
declare const UploadFile: ({ label, required, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, isUploading, isFileUploaded, error, progress, onFileUploaded, onReset, initialFileName, multiple }: UploadFileProps) => JSX.Element;
|
|
28
29
|
export default UploadFile;
|
|
@@ -55,21 +55,21 @@ var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
|
55
55
|
color: theme.palette.common.white
|
|
56
56
|
});
|
|
57
57
|
});
|
|
58
|
-
export var InputContainerStyled = styled(Box)(function (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
justifyContent: 'center'
|
|
64
|
-
});
|
|
65
|
-
});
|
|
58
|
+
export var InputContainerStyled = styled(Box)(function () { return ({
|
|
59
|
+
display: 'flex',
|
|
60
|
+
width: '100%',
|
|
61
|
+
justifyContent: 'center'
|
|
62
|
+
}); });
|
|
66
63
|
var UploadFile = function (_a) {
|
|
67
|
-
var label = _a.label, required = _a.required, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, isUploading = _a.isUploading, isFileUploaded = _a.isFileUploaded, error = _a.error, progress = _a.progress, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset, initialFileName = _a.initialFileName;
|
|
64
|
+
var label = _a.label, required = _a.required, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, isUploading = _a.isUploading, isFileUploaded = _a.isFileUploaded, error = _a.error, progress = _a.progress, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset, initialFileName = _a.initialFileName, multiple = _a.multiple;
|
|
68
65
|
var _b = React.useState(initialFileName || ''), fileName = _b[0], setFileName = _b[1];
|
|
69
66
|
var _c = React.useState(!!initialFileName), showFile = _c[0], setShowFile = _c[1];
|
|
70
|
-
var handleFileChange = function (
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
var handleFileChange = function (files) {
|
|
68
|
+
var _a;
|
|
69
|
+
if ((files === null || files === void 0 ? void 0 : files.length) > 0) {
|
|
70
|
+
setFileName(maskFileName((_a = files === null || files === void 0 ? void 0 : files[0]) === null || _a === void 0 ? void 0 : _a.name));
|
|
71
|
+
onFileUploaded === null || onFileUploaded === void 0 ? void 0 : onFileUploaded(files);
|
|
72
|
+
}
|
|
73
73
|
};
|
|
74
74
|
var handleReset = function () {
|
|
75
75
|
if (!isSubmitting) {
|
|
@@ -86,6 +86,6 @@ var UploadFile = function (_a) {
|
|
|
86
86
|
else
|
|
87
87
|
setShowFile(false);
|
|
88
88
|
}, [isFileUploaded]);
|
|
89
|
-
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !showFile }, { children: _jsx(InputContainerStyled, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: !!fileName, uploadingTitle: uploadingTitle, successTitle: successTitle, progress: progress, uploading: isUploading, uploadSuccess: isFileUploaded, onSuccess: handleFileChange, error: error }) }) })), _jsx(Collapse, __assign({ in: showFile, timeout: 300 }, { children: _jsxs(InputContainerStyled, { children: [_jsxs(BoxStyled, { children: [_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: fileName })] })), _jsx(Box, { children: _jsx(CheckIcon, {}) })] }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(ClearIconStyled, {}) }))] }) }))] }));
|
|
89
|
+
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !showFile }, { children: _jsx(InputContainerStyled, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: !!fileName, uploadingTitle: uploadingTitle, successTitle: successTitle, progress: progress, uploading: isUploading, uploadSuccess: isFileUploaded, onSuccess: handleFileChange, error: error, multiple: multiple }) }) })), _jsx(Collapse, __assign({ in: showFile, timeout: 300 }, { children: _jsxs(InputContainerStyled, { children: [_jsxs(BoxStyled, { children: [_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: fileName })] })), _jsx(Box, { children: _jsx(CheckIcon, {}) })] }), _jsx(UploadBoxStyled, __assign({ onClick: handleReset }, { children: _jsx(ClearIconStyled, {}) }))] }) }))] }));
|
|
90
90
|
};
|
|
91
91
|
export default UploadFile;
|
package/build/hooks/index.d.ts
CHANGED
package/build/hooks/index.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
export var useCountUp = function (_a) {
|
|
3
|
+
var end = _a.end, _b = _a.start, start = _b === void 0 ? 0 : _b, _c = _a.sleepMS, sleepMS = _c === void 0 ? 0 : _c;
|
|
4
|
+
var _d = useState(start), count = _d[0], setCount = _d[1];
|
|
5
|
+
var increment = function () {
|
|
6
|
+
setCount(count + 1);
|
|
7
|
+
};
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
if (count >= end)
|
|
10
|
+
return;
|
|
11
|
+
var timer = setTimeout(function () {
|
|
12
|
+
increment();
|
|
13
|
+
}, sleepMS);
|
|
14
|
+
return function () { return clearTimeout(timer); };
|
|
15
|
+
}, [count]);
|
|
16
|
+
return { count: count };
|
|
17
|
+
};
|