@tap-payments/auth-jsconnect 2.0.49-test → 2.0.51-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/app.d.ts +6 -4
- package/build/@types/app.js +2 -2
- package/build/@types/form.d.ts +3 -0
- package/build/api/auth.d.ts +6 -1
- package/build/api/auth.js +16 -1
- package/build/api/data.d.ts +4 -1
- package/build/api/data.js +6 -2
- package/build/api/index.d.ts +4 -1
- package/build/assets/locales/ar.json +7 -1
- package/build/assets/locales/en.json +7 -1
- package/build/components/AnimationFlow/AnimationFlow.js +3 -5
- package/build/components/AnimationFlow/BottomSheet.js +2 -1
- package/build/components/AnimationFlow/Dialog.d.ts +1 -1
- package/build/components/AnimationFlow/Dialog.js +2 -2
- package/build/components/FileInput/DragAndDrop.d.ts +9 -1
- package/build/components/FileInput/DragAndDrop.js +113 -8
- package/build/components/Lottie/Lottie.d.ts +220 -0
- package/build/components/Lottie/Lottie.js +56 -0
- package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
- package/build/components/Lottie/index.d.ts +3 -0
- package/build/components/Lottie/index.js +3 -0
- package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
- package/build/components/ProgressBar/CircularProgressBar.js +48 -0
- package/build/components/ProgressBar/index.d.ts +2 -0
- package/build/components/ProgressBar/index.js +2 -0
- package/build/constants/api.js +1 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +16 -3
- package/build/constants/assets.d.ts +7 -0
- package/build/constants/assets.js +7 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.d.ts +4 -0
- package/build/features/app/bank/bankStore.js +42 -22
- package/build/features/app/business/businessStore.js +16 -12
- package/build/features/app/connect/connectStore.d.ts +9 -1
- package/build/features/app/connect/connectStore.js +115 -13
- package/build/features/app/entity/entityStore.js +13 -9
- package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
- package/build/features/bank/screens/BankDetails/BankStatement.js +33 -8
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/connect/Connect.js +11 -5
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +85 -0
- package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
- package/build/features/connect/screens/CivilID/index.d.ts +3 -0
- package/build/features/connect/screens/CivilID/index.js +2 -0
- package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
- package/build/features/connect/screens/CivilID/validation.js +4 -0
- package/build/features/connect/screens/Individual/Individual.js +5 -2
- package/build/features/connect/screens/Merchant/Merchant.js +7 -4
- package/build/features/connect/screens/Merchant/SalesChannels.js +1 -1
- package/build/features/connect/screens/Merchant/SocialMedia.js +7 -7
- package/build/features/connect/screens/Mobile/Mobile.js +7 -4
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +118 -0
- package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyPACI/index.js +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +1 -1
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +1 -1
- package/build/features/featuresScreens.js +10 -0
- package/build/features/shared/Background/Background.d.ts +2 -5
- package/build/features/shared/Background/Background.js +6 -4
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Input/Input.js +2 -2
- package/build/features/shared/UploadFile/UploadFile.d.ts +8 -3
- package/build/features/shared/UploadFile/UploadFile.js +23 -8
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/utils/device.d.ts +1 -0
- package/build/utils/device.js +13 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/string.d.ts +2 -0
- package/build/utils/string.js +9 -0
- package/package.json +2 -1
|
@@ -0,0 +1,59 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import Box from '@mui/material/Box';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import Text from '../../../../components/Text';
|
|
19
|
+
import Input from '../../../shared/Input';
|
|
20
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
21
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
22
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
23
|
+
import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
24
|
+
import { CIVIL_ID_NUMBER_LENGTH } from '../../../../constants';
|
|
25
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
return ({
|
|
28
|
+
display: 'flex',
|
|
29
|
+
justifyContent: 'space-between',
|
|
30
|
+
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
36
|
+
});
|
|
37
|
+
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
38
|
+
var _b;
|
|
39
|
+
var sx = _a.sx;
|
|
40
|
+
var t = useTranslation().t;
|
|
41
|
+
var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
|
|
42
|
+
var civilIdControl = useController({ control: control, name: 'civilId' });
|
|
43
|
+
React.useEffect(function () {
|
|
44
|
+
if (civilIdControl.field.value)
|
|
45
|
+
setValue('civilId', civilIdControl.field.value, { shouldValidate: true });
|
|
46
|
+
}, []);
|
|
47
|
+
var handleIdChange = function (_a) {
|
|
48
|
+
var target = _a.target;
|
|
49
|
+
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
50
|
+
civilIdControl.field.onChange(value);
|
|
51
|
+
};
|
|
52
|
+
var clearIdNumber = function () {
|
|
53
|
+
civilIdControl.field.onChange('');
|
|
54
|
+
};
|
|
55
|
+
var idValue = civilIdControl.field.value;
|
|
56
|
+
var error = (_b = civilIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
57
|
+
return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: !error && idValue ? _jsx(CheckIcon, {}) : idValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
|
|
58
|
+
});
|
|
59
|
+
export default React.memo(IDNumber);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const civilIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
civilId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
18
18
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
20
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
-
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
22
22
|
import { IndividualValidation, IndividualMobileValidation } from './validation';
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
24
24
|
import Button from '../../../shared/Button';
|
|
@@ -36,6 +36,7 @@ var Individual = function (_a) {
|
|
|
36
36
|
var _b, _c, _d;
|
|
37
37
|
var _e = React.useState(false), listActive = _e[0], setListActive = _e[1];
|
|
38
38
|
var _f = React.useState(false), emailChecking = _f[0], setEmailChecking = _f[1];
|
|
39
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
39
40
|
var _g = useAppSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error;
|
|
40
41
|
var dispatch = useAppDispatch();
|
|
41
42
|
var t = useTranslation().t;
|
|
@@ -51,8 +52,10 @@ var Individual = function (_a) {
|
|
|
51
52
|
dispatch(updateLeadIndividual(formData));
|
|
52
53
|
};
|
|
53
54
|
var onBack = function () {
|
|
55
|
+
var _a, _b;
|
|
54
56
|
dispatch(resetIndividualScreen());
|
|
55
|
-
|
|
57
|
+
var isKW = ((_b = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) === 'kw';
|
|
58
|
+
dispatch(handlePrevScreenStep(isAbsher ? (isKW ? 'CONNECT_ID_STEP' : 'CONNECT_NID_STEP') : 'CONNECT_MOBILE_STEP'));
|
|
56
59
|
};
|
|
57
60
|
React.useEffect(function () {
|
|
58
61
|
if (error)
|
|
@@ -16,7 +16,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
-
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
19
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
21
21
|
import { INSTAGRAM_URL, TWITTER_URL } from '../../../../constants';
|
|
22
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -35,6 +35,7 @@ var Merchant = function (_a) {
|
|
|
35
35
|
var _e = React.useState(ValidationOptions.NEW_USER), userType = _e[0], setUserType = _e[1];
|
|
36
36
|
var _f = React.useState(false), listActive = _f[0], setListActive = _f[1];
|
|
37
37
|
var _g = useAppSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error;
|
|
38
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
38
39
|
var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
|
|
39
40
|
var isAbsher = data.otpData.isAbsher;
|
|
40
41
|
var _h = data.brandData.responseBody || {}, brands = _h.brands, channelList = _h.channelList;
|
|
@@ -58,11 +59,13 @@ var Merchant = function (_a) {
|
|
|
58
59
|
dispatch(updateLeadBrand(formData));
|
|
59
60
|
};
|
|
60
61
|
var onBack = function () {
|
|
62
|
+
var _a, _b;
|
|
61
63
|
if (isNewUser) {
|
|
62
64
|
dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
65
|
-
|
|
67
|
+
var isKW = ((_b = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) === 'kw';
|
|
68
|
+
dispatch(handlePrevScreenStep(isAbsher ? (isKW ? 'CONNECT_ID_STEP' : 'CONNECT_NID_STEP') : 'CONNECT_MOBILE_STEP'));
|
|
66
69
|
};
|
|
67
70
|
React.useEffect(function () {
|
|
68
71
|
if (error)
|
|
@@ -100,8 +103,8 @@ var Merchant = function (_a) {
|
|
|
100
103
|
var isHasWebsite = (websiteUrl === null || websiteUrl === void 0 ? void 0 : websiteUrl.length) > 0;
|
|
101
104
|
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
102
105
|
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
103
|
-
var websiteData = channelList === null || channelList === void 0 ? void 0 : channelList.find(function (c) { return c.
|
|
104
|
-
var socialData = channelList === null || channelList === void 0 ? void 0 : channelList.find(function (c) { return c.
|
|
106
|
+
var websiteData = channelList === null || channelList === void 0 ? void 0 : channelList.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
|
|
107
|
+
var socialData = channelList === null || channelList === void 0 ? void 0 : channelList.find(function (c) { return c.name.en === 'social media'; });
|
|
105
108
|
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
106
109
|
selectedChannels = [websiteData, socialData];
|
|
107
110
|
else if (isHasTwitter || isHasInstagram)
|
|
@@ -109,6 +109,6 @@ var SalesChannels = function () {
|
|
|
109
109
|
return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
|
|
110
110
|
};
|
|
111
111
|
var selectedBrandIsOther = (formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) === 'other';
|
|
112
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), (channelsMenuList || []).map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: !selectedBrandIsOther && (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.
|
|
112
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), (channelsMenuList || []).map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: !selectedBrandIsOther && (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name.ar : channel.name.en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
|
|
113
113
|
};
|
|
114
114
|
export default SalesChannels;
|
|
@@ -109,19 +109,19 @@ var SocialMedia = function (_a) {
|
|
|
109
109
|
var _a, _b;
|
|
110
110
|
if ((selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0) {
|
|
111
111
|
setSelectedSocialMediaTypes(selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.map(function (_a) {
|
|
112
|
-
var
|
|
113
|
-
return
|
|
112
|
+
var name = _a.name;
|
|
113
|
+
return name.en.toLocaleLowerCase();
|
|
114
114
|
}));
|
|
115
115
|
var hasSelectedMediaTypeAvailable = !!(selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.find(function (_a) {
|
|
116
|
-
var
|
|
116
|
+
var name = _a.name;
|
|
117
117
|
if (socialMediaType === SocialMediaTypes.TWITTER || socialMediaType === SocialMediaTypes.INSTAGRAM)
|
|
118
|
-
return
|
|
118
|
+
return name.en.toLocaleLowerCase() === SocialMediaTypes.SOCIAL;
|
|
119
119
|
if (socialMediaType === SocialMediaTypes.APPLE_STORE || socialMediaType === SocialMediaTypes.PLAY_STORE)
|
|
120
|
-
return
|
|
121
|
-
return
|
|
120
|
+
return name.en.toLocaleLowerCase() === SocialMediaTypes.APP;
|
|
121
|
+
return name.en.toLocaleLowerCase() === socialMediaType;
|
|
122
122
|
}));
|
|
123
123
|
if (!hasSelectedMediaTypeAvailable) {
|
|
124
|
-
var type = (_b = (_a = selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels[0]) === null || _a === void 0 ? void 0 : _a.
|
|
124
|
+
var type = (_b = (_a = selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels[0]) === null || _a === void 0 ? void 0 : _a.name.en) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase();
|
|
125
125
|
if (type === SocialMediaTypes.SOCIAL)
|
|
126
126
|
setSocialMediaType(SocialMediaTypes.TWITTER);
|
|
127
127
|
else if (type === SocialMediaTypes.APP)
|
|
@@ -25,6 +25,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
25
25
|
import { clearError, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
|
|
26
26
|
import { useLanguage } from '../../../../hooks';
|
|
27
27
|
import Divider from '@mui/material/Divider';
|
|
28
|
+
import { isKW } from '../../../../utils';
|
|
28
29
|
import Text from '../../../../components/Text';
|
|
29
30
|
import MIDTitle from './Title';
|
|
30
31
|
import MobileNumber from './MobileNumber';
|
|
@@ -72,9 +73,10 @@ var ListType;
|
|
|
72
73
|
ListType["CountryCodeList"] = "CountryCodeList";
|
|
73
74
|
})(ListType || (ListType = {}));
|
|
74
75
|
var Mobile = function (_a) {
|
|
76
|
+
var _b;
|
|
75
77
|
var settingsStore = useAppSelector(settingsSelector);
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
+
var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
79
|
+
var _d = React.useState(), listType = _d[0], setListType = _d[1];
|
|
78
80
|
var dispatch = useAppDispatch();
|
|
79
81
|
var methods = useForm({
|
|
80
82
|
resolver: yupResolver(PhoneValidationSchema),
|
|
@@ -98,8 +100,9 @@ var Mobile = function (_a) {
|
|
|
98
100
|
var onSubmit = function (formData) {
|
|
99
101
|
dispatch(createMobileAuth(formData));
|
|
100
102
|
};
|
|
103
|
+
var isKWCountry = React.useMemo(function () { var _a; return isKW((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2]);
|
|
101
104
|
var onBack = function () {
|
|
102
|
-
dispatch(handlePrevScreenStep());
|
|
105
|
+
dispatch(handlePrevScreenStep(isKWCountry ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP'));
|
|
103
106
|
};
|
|
104
107
|
var isBusinessListActive = listType === ListType.BusinessList;
|
|
105
108
|
var isCountryListActive = listType === ListType.CountryCodeList;
|
|
@@ -107,6 +110,6 @@ var Mobile = function (_a) {
|
|
|
107
110
|
var disabled = !methods.formState.isValid || !!error;
|
|
108
111
|
var title = t('join_our_community');
|
|
109
112
|
var subTitle = t('ide_terms_and_conditions_description');
|
|
110
|
-
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] }))] })) }))] }));
|
|
113
|
+
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: isKWCountry ? t('paci_button_label') : t('absher_button_label') }))] }))] }))] })) }))] }));
|
|
111
114
|
};
|
|
112
115
|
export default React.memo(Mobile);
|
|
@@ -0,0 +1,118 @@
|
|
|
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 Box from '@mui/material/Box/Box';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import { connectSelector, verifyPACI as verifyPACIFun } from '../../../app/connect/connectStore';
|
|
19
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { MobileButton } from '../../../shared/Button';
|
|
22
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
|
+
import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
|
|
24
|
+
import Icon from '../../../../components/Icon';
|
|
25
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
26
|
+
import Button from '@mui/material/Button';
|
|
27
|
+
import { mobileOS } from '../../../../utils';
|
|
28
|
+
var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
|
|
29
|
+
var theme = _a.theme;
|
|
30
|
+
return ({
|
|
31
|
+
direction: theme.direction,
|
|
32
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: 'column',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
marginBottom: theme.spacing(2.5)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var VerifyPACITitleStyled = styled(Text)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
42
|
+
});
|
|
43
|
+
var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
|
|
44
|
+
var theme = _a.theme;
|
|
45
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line', textAlign: 'center' }));
|
|
46
|
+
});
|
|
47
|
+
var Container = styled(Box)(function (_a) {
|
|
48
|
+
var theme = _a.theme;
|
|
49
|
+
return ({
|
|
50
|
+
position: 'relative',
|
|
51
|
+
display: 'flex',
|
|
52
|
+
justifyContent: 'center',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
maxHeight: '300px'
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var IconStyled = styled(Icon)(function (_a) {
|
|
58
|
+
var theme = _a.theme;
|
|
59
|
+
return ({
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
top: '50%',
|
|
62
|
+
left: '50%',
|
|
63
|
+
transform: 'translate(-50%, -50%)',
|
|
64
|
+
width: 64,
|
|
65
|
+
height: 64
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
var BackButton = styled('button')(function (_a) {
|
|
69
|
+
var theme = _a.theme;
|
|
70
|
+
return ({
|
|
71
|
+
cursor: 'pointer',
|
|
72
|
+
height: 44,
|
|
73
|
+
appearance: 'none',
|
|
74
|
+
background: 'none',
|
|
75
|
+
border: 'none',
|
|
76
|
+
color: theme.palette.primary.main,
|
|
77
|
+
fontSize: theme.typography.body1.fontSize,
|
|
78
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
79
|
+
textTransform: 'capitalize',
|
|
80
|
+
'&:hover': {
|
|
81
|
+
backgroundColor: 'transparent'
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
var VerifyPACI = function () {
|
|
86
|
+
var dispatch = useAppDispatch();
|
|
87
|
+
var data = useAppSelector(connectSelector).data;
|
|
88
|
+
var responseBody = data.civilIdData.responseBody;
|
|
89
|
+
var t = useTranslation().t;
|
|
90
|
+
React.useEffect(function () {
|
|
91
|
+
if (responseBody)
|
|
92
|
+
dispatch(verifyPACIFun());
|
|
93
|
+
var interval = setInterval(function () {
|
|
94
|
+
if (responseBody)
|
|
95
|
+
dispatch(verifyPACIFun());
|
|
96
|
+
}, 10000);
|
|
97
|
+
setTimeout(function () {
|
|
98
|
+
clearInterval(interval);
|
|
99
|
+
}, ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120) * 1000);
|
|
100
|
+
return function () { return clearInterval(interval); };
|
|
101
|
+
}, [responseBody]);
|
|
102
|
+
var onRedirect = React.useCallback(function () {
|
|
103
|
+
if (os === 'Android') {
|
|
104
|
+
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
|
105
|
+
}
|
|
106
|
+
if (os === 'iOS') {
|
|
107
|
+
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios, '_blank');
|
|
108
|
+
}
|
|
109
|
+
}, [responseBody]);
|
|
110
|
+
var onBack = React.useCallback(function () {
|
|
111
|
+
dispatch(handlePrevScreenStep());
|
|
112
|
+
}, []);
|
|
113
|
+
var os = React.useMemo(function () { return mobileOS(); }, []);
|
|
114
|
+
var isAndroid = React.useMemo(function () { return os === 'Android' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
|
|
115
|
+
var isIOS = React.useMemo(function () { return os === 'iOS' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
|
|
116
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsxs(Container, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(Button, __assign({ variant: 'text', onClick: onBack }, { children: t('back') }))] })));
|
|
117
|
+
};
|
|
118
|
+
export default React.memo(VerifyPACI);
|
|
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
|
|
|
20
20
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
23
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
23
|
+
color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
|
|
24
24
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
25
25
|
htmlColor?: string | undefined;
|
|
26
26
|
inheritViewBox?: boolean | undefined;
|
|
@@ -107,6 +107,6 @@ var SalesChannels = function () {
|
|
|
107
107
|
if (channelsChecked)
|
|
108
108
|
return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
|
|
109
109
|
};
|
|
110
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('channel_of_service') }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.
|
|
110
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('channel_of_service') }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name.ar : channel.name.en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
|
|
111
111
|
};
|
|
112
112
|
export default SalesChannels;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import MobileScreen from './connect/screens/Mobile';
|
|
2
2
|
import NIDScreen from './connect/screens/NID';
|
|
3
|
+
import CivilIDScreen from '../features/connect/screens/CivilID';
|
|
4
|
+
import VerifyPACIScreen from './connect/screens/VerifyPACI';
|
|
3
5
|
import IndividualScreen from './connect/screens/Individual';
|
|
4
6
|
import MerchantInfoScreen from './connect/screens/Merchant';
|
|
5
7
|
import ConnectOTPScreen from './connect/screens/OTP';
|
|
@@ -50,6 +52,10 @@ export var connectFeatureScreens = [
|
|
|
50
52
|
name: 'CONNECT_NID_STEP',
|
|
51
53
|
element: NIDScreen
|
|
52
54
|
},
|
|
55
|
+
{
|
|
56
|
+
name: 'CONNECT_CIVIL_ID_STEP',
|
|
57
|
+
element: CivilIDScreen
|
|
58
|
+
},
|
|
53
59
|
{
|
|
54
60
|
name: 'CONNECT_MOBILE_STEP',
|
|
55
61
|
element: MobileScreen
|
|
@@ -58,6 +64,10 @@ export var connectFeatureScreens = [
|
|
|
58
64
|
name: 'CONNECT_OTP_STEP',
|
|
59
65
|
element: ConnectOTPScreen
|
|
60
66
|
},
|
|
67
|
+
{
|
|
68
|
+
name: 'CONNECT_VERIFY_PACI_STEP',
|
|
69
|
+
element: VerifyPACIScreen
|
|
70
|
+
},
|
|
61
71
|
{
|
|
62
72
|
name: 'CONNECT_INDIVIDUAL_STEP',
|
|
63
73
|
element: IndividualScreen
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
-
|
|
4
|
-
isTapOrigin: boolean;
|
|
5
|
-
open: boolean;
|
|
6
|
-
};
|
|
7
|
-
interface BackgroundProps extends TapOrigin {
|
|
3
|
+
interface BackgroundProps {
|
|
8
4
|
children: React.ReactNode;
|
|
9
5
|
loading?: boolean;
|
|
10
6
|
hideLogo?: boolean;
|
|
11
7
|
sx?: SxProps<Theme>;
|
|
12
8
|
open: boolean;
|
|
9
|
+
isTapOrigin: boolean;
|
|
13
10
|
}
|
|
14
11
|
declare const _default: React.MemoExoticComponent<({ children, isTapOrigin, loading, hideLogo, sx, open }: BackgroundProps) => JSX.Element>;
|
|
15
12
|
export default _default;
|
|
@@ -15,14 +15,15 @@ import { styled } from '@mui/material/styles';
|
|
|
15
15
|
import Box from '@mui/material/Box';
|
|
16
16
|
import LogoBackground from './LogoBackground';
|
|
17
17
|
import { BACKGROUND_ID } from '../../../constants';
|
|
18
|
+
import { useScreen } from '../../../hooks';
|
|
18
19
|
var BackgroundStyled = styled(Box, {
|
|
19
|
-
shouldForwardProp: function (prop) { return !['isTapOrigin', 'open'].includes(prop); }
|
|
20
|
+
shouldForwardProp: function (prop) { return !['isTapOrigin', 'open', 'isSmall'].includes(prop); }
|
|
20
21
|
})(function (_a) {
|
|
21
|
-
var isTapOrigin = _a.isTapOrigin, open = _a.open;
|
|
22
|
+
var isTapOrigin = _a.isTapOrigin, open = _a.open, isSmall = _a.isSmall;
|
|
22
23
|
return ({
|
|
23
24
|
width: '100vw',
|
|
24
25
|
height: '100vh',
|
|
25
|
-
zIndex: 999,
|
|
26
|
+
zIndex: isSmall ? 'auto' : 999,
|
|
26
27
|
position: 'absolute',
|
|
27
28
|
background: !open
|
|
28
29
|
? 'inherit'
|
|
@@ -34,6 +35,7 @@ var BackgroundStyled = styled(Box, {
|
|
|
34
35
|
var Background = function (_a) {
|
|
35
36
|
var children = _a.children, isTapOrigin = _a.isTapOrigin, loading = _a.loading, hideLogo = _a.hideLogo, sx = _a.sx, open = _a.open;
|
|
36
37
|
var showLogo = !loading && isTapOrigin;
|
|
37
|
-
|
|
38
|
+
var small = useScreen().small;
|
|
39
|
+
return (_jsxs(BackgroundStyled, __assign({ id: BACKGROUND_ID, isSmall: small, isTapOrigin: isTapOrigin, sx: sx, open: open }, { children: [showLogo && !hideLogo && _jsx(LogoBackground, {}), children] })));
|
|
38
40
|
};
|
|
39
41
|
export default memo(Background);
|
|
@@ -22,5 +22,5 @@ interface CustomButtonProps extends InputProps {
|
|
|
22
22
|
label?: string;
|
|
23
23
|
required?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export default function CustomInput({ label, required, ...props }: CustomButtonProps): JSX.Element;
|
|
25
|
+
export default function CustomInput({ label, required, placeholder, ...props }: CustomButtonProps): JSX.Element;
|
|
26
26
|
export {};
|
|
@@ -51,6 +51,6 @@ var LabelContainerStyled = styled(Box)(function (_a) {
|
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
export default function CustomInput(_a) {
|
|
54
|
-
var label = _a.label, required = _a.required, props = __rest(_a, ["label", "required"]);
|
|
55
|
-
return (_jsxs(_Fragment, { children: [label && (_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] })), _jsx(InputStyled, __assign({}, props))] }));
|
|
54
|
+
var label = _a.label, required = _a.required, placeholder = _a.placeholder, props = __rest(_a, ["label", "required", "placeholder"]);
|
|
55
|
+
return (_jsxs(_Fragment, { children: [label && (_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] })), _jsx(InputStyled, __assign({}, props, { placeholder: placeholder === null || placeholder === void 0 ? void 0 : placeholder.toString() }))] }));
|
|
56
56
|
}
|
|
@@ -10,12 +10,17 @@ export declare const InputContainerStyled: import("@emotion/styled").StyledCompo
|
|
|
10
10
|
interface UploadFileProps {
|
|
11
11
|
label: string;
|
|
12
12
|
required?: boolean;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
title: string;
|
|
14
|
+
subTitle: string;
|
|
15
|
+
dragDescription: string;
|
|
16
|
+
uploadingTitle: string;
|
|
17
|
+
successTitle: string;
|
|
15
18
|
error?: string;
|
|
16
19
|
isSubmitting?: boolean;
|
|
20
|
+
isUploading?: boolean;
|
|
21
|
+
isFileUploaded?: boolean;
|
|
17
22
|
onFileUploaded: (file: File) => void;
|
|
18
23
|
onReset: () => void;
|
|
19
24
|
}
|
|
20
|
-
declare const UploadFile: ({ label, required,
|
|
25
|
+
declare const UploadFile: ({ label, required, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, isUploading, isFileUploaded, error, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
|
|
21
26
|
export default UploadFile;
|
|
@@ -16,10 +16,14 @@ import { ScreenContainer } from '../../shared/Containers';
|
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { InputLabelStyled } from '../../shared/Input/Input';
|
|
18
18
|
import Mandatory from '../../shared/Mandatory';
|
|
19
|
-
import { DragAndDrop
|
|
19
|
+
import { DragAndDrop } from '../../../components/FileInput';
|
|
20
20
|
import Collapse from '../../../components/Collapse';
|
|
21
|
-
import Warning from '../../../components/Warning';
|
|
22
21
|
import ClearIcon from '@mui/icons-material/Clear';
|
|
22
|
+
import CheckIcon from '../../../features/shared/CheckIcon';
|
|
23
|
+
import { maskFileName } from '../../../utils';
|
|
24
|
+
import Icon from '../../../components/Icon';
|
|
25
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
26
|
+
import Text from '../../../components/Text';
|
|
23
27
|
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
24
28
|
var theme = _a.theme;
|
|
25
29
|
return ({
|
|
@@ -36,11 +40,11 @@ var LabelContainerStyled = styled(Box)(function (_a) {
|
|
|
36
40
|
});
|
|
37
41
|
var BoxStyled = styled(Box)(function (_a) {
|
|
38
42
|
var theme = _a.theme;
|
|
39
|
-
return (__assign(__assign({ direction: theme.direction }, theme.typography.subtitle2), { color: theme.palette.primary.main, fontWeight: theme.typography.fontWeightBold, background: theme.palette.background.default, padding: theme.spacing(1.5, 2.5, 1.5), width: '
|
|
43
|
+
return (__assign(__assign({ direction: theme.direction }, theme.typography.subtitle2), { color: theme.palette.primary.main, fontWeight: theme.typography.fontWeightBold, background: theme.palette.background.default, padding: theme.spacing(1.5, 2.5, 1.5), width: '88%', wordBreak: 'break-all', display: 'flex', justifyContent: 'space-between' }));
|
|
40
44
|
});
|
|
41
45
|
var UploadBoxStyled = styled(Box)(function (_a) {
|
|
42
46
|
var theme = _a.theme;
|
|
43
|
-
return (__assign(__assign({}, theme.typography.caption), { background: theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, cursor: 'pointer', width: '
|
|
47
|
+
return (__assign(__assign({}, theme.typography.caption), { background: theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, cursor: 'pointer', width: '12%', display: 'flex', justifyContent: 'center', alignItems: 'center' }));
|
|
44
48
|
});
|
|
45
49
|
var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
46
50
|
var theme = _a.theme;
|
|
@@ -55,14 +59,16 @@ export var InputContainerStyled = styled(Box)(function (_a) {
|
|
|
55
59
|
var theme = _a.theme;
|
|
56
60
|
return ({
|
|
57
61
|
display: 'flex',
|
|
58
|
-
width: '100%'
|
|
62
|
+
width: '100%',
|
|
63
|
+
justifyContent: 'center'
|
|
59
64
|
});
|
|
60
65
|
});
|
|
61
66
|
var UploadFile = function (_a) {
|
|
62
|
-
var label = _a.label, required = _a.required,
|
|
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, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
|
|
63
68
|
var _b = React.useState(''), fileName = _b[0], setFileName = _b[1];
|
|
69
|
+
var _c = React.useState(false), showFile = _c[0], setShowFile = _c[1];
|
|
64
70
|
var handleFileChange = function (file) {
|
|
65
|
-
setFileName(file === null || file === void 0 ? void 0 : file.name);
|
|
71
|
+
setFileName(maskFileName(file === null || file === void 0 ? void 0 : file.name));
|
|
66
72
|
onFileUploaded === null || onFileUploaded === void 0 ? void 0 : onFileUploaded(file);
|
|
67
73
|
};
|
|
68
74
|
var handleReset = function () {
|
|
@@ -71,6 +77,15 @@ var UploadFile = function (_a) {
|
|
|
71
77
|
onReset === null || onReset === void 0 ? void 0 : onReset();
|
|
72
78
|
}
|
|
73
79
|
};
|
|
74
|
-
|
|
80
|
+
React.useEffect(function () {
|
|
81
|
+
if (isFileUploaded && !!fileName) {
|
|
82
|
+
setTimeout(function () {
|
|
83
|
+
setShowFile(true);
|
|
84
|
+
}, 800);
|
|
85
|
+
}
|
|
86
|
+
else
|
|
87
|
+
setShowFile(false);
|
|
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, 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, {}) }))] }) }))] }));
|
|
75
90
|
};
|
|
76
91
|
export default UploadFile;
|
package/build/hooks/index.d.ts
CHANGED
package/build/hooks/index.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useWindowSize } from '.';
|
|
3
|
+
import { useTheme } from '@mui/material/styles';
|
|
4
|
+
export var useScreen = function (breakpoint) {
|
|
5
|
+
if (breakpoint === void 0) { breakpoint = 'sm'; }
|
|
6
|
+
var _a = useState(false), small = _a[0], setSmall = _a[1];
|
|
7
|
+
var width = useWindowSize().width;
|
|
8
|
+
var theme = useTheme();
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
var target = theme.breakpoints.values[breakpoint || 'sm'];
|
|
11
|
+
setSmall(width < target);
|
|
12
|
+
}, [width]);
|
|
13
|
+
return { small: small };
|
|
14
|
+
};
|