@tap-payments/auth-jsconnect 2.0.54-test → 2.0.56-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 +39 -14
- package/build/@types/app.js +9 -0
- package/build/@types/form.d.ts +11 -0
- package/build/api/auth.d.ts +14 -1
- package/build/api/auth.js +24 -1
- package/build/api/axios.js +2 -2
- package/build/api/data.d.ts +33 -7
- package/build/api/data.js +41 -16
- package/build/api/entity.d.ts +2 -0
- package/build/api/index.d.ts +11 -8
- package/build/api/individual.d.ts +1 -1
- package/build/app/rootReducer.d.ts +3 -0
- package/build/app/rootReducer.js +7 -1
- package/build/app/settings.js +8 -2
- package/build/app/store.d.ts +7 -1
- package/build/assets/locales/ar.json +14 -4
- package/build/assets/locales/en.json +14 -4
- package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
- package/build/components/AnimationFlow/AnimationFlow.js +5 -7
- package/build/components/AnimationFlow/BottomSheet.js +2 -1
- package/build/components/AnimationFlow/Dialog.d.ts +4 -1
- package/build/components/AnimationFlow/Dialog.js +9 -4
- package/build/components/FileInput/DragAndDrop.d.ts +9 -1
- package/build/components/FileInput/DragAndDrop.js +113 -8
- package/build/components/Lottie/Lottie.d.ts +878 -0
- package/build/components/Lottie/Lottie.js +58 -0
- package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
- package/build/components/Lottie/files/success.json +425 -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/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -1
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +27 -34
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +10 -7
- package/build/constants/app.d.ts +15 -0
- package/build/constants/app.js +75 -3
- package/build/constants/assets.d.ts +17 -1
- package/build/constants/assets.js +22 -6
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.d.ts +35 -0
- package/build/features/app/auth/authStore.js +148 -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 +53 -43
- package/build/features/app/connect/connectStore.d.ts +13 -1
- package/build/features/app/connect/connectStore.js +164 -4
- package/build/features/app/entity/entityStore.d.ts +53 -0
- package/build/features/app/entity/entityStore.js +461 -0
- package/build/features/app/individual/individualStore.js +19 -11
- package/build/features/app/otp/otpStore.d.ts +28 -0
- package/build/features/app/otp/otpStore.js +153 -0
- package/build/features/app/signIn/signInStore.js +2 -2
- package/build/features/auth/Auth.d.ts +10 -0
- package/build/features/auth/Auth.js +87 -0
- package/build/features/auth/index.d.ts +1 -0
- package/build/features/auth/index.js +1 -0
- package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTP.js +72 -0
- package/build/features/auth/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTPInput.js +44 -0
- package/build/features/auth/screens/OTP/index.d.ts +3 -0
- package/build/features/auth/screens/OTP/index.js +2 -0
- package/build/features/auth/screens/OTP/validation.d.ts +8 -0
- package/build/features/auth/screens/OTP/validation.js +4 -0
- package/build/features/bank/Bank.js +10 -4
- package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
- package/build/features/bank/screens/BankDetails/BankStatement.js +33 -8
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +12 -5
- 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/business/screens/Customers/CustomerLocations.js +25 -7
- package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
- package/build/features/connect/Connect.d.ts +2 -1
- package/build/features/connect/Connect.js +40 -10
- 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 +6 -2
- package/build/features/connect/screens/Merchant/Merchant.js +35 -11
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +5 -0
- package/build/features/connect/screens/Merchant/SalesChannels.js +114 -0
- package/build/features/connect/screens/Merchant/SocialMedia.js +56 -11
- package/build/features/connect/screens/Merchant/validation.d.ts +87 -0
- package/build/features/connect/screens/Merchant/validation.js +68 -2
- 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 +169 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +22 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -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/Entity.d.ts +7 -0
- package/build/features/entity/Entity.js +70 -0
- package/build/features/entity/index.d.ts +1 -0
- package/build/features/entity/index.js +1 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +139 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +56 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +112 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.js +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/entity/screens/Success/Success.d.ts +5 -0
- package/build/features/entity/screens/Success/Success.js +16 -0
- package/build/features/entity/screens/Success/index.d.ts +3 -0
- package/build/features/entity/screens/Success/index.js +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +109 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/entity/screens/Verify/OTPInput.d.ts +7 -0
- package/build/features/entity/screens/Verify/OTPInput.js +47 -0
- package/build/features/entity/screens/Verify/Verify.d.ts +5 -0
- package/build/features/entity/screens/Verify/Verify.js +78 -0
- package/build/features/entity/screens/Verify/index.d.ts +2 -0
- package/build/features/entity/screens/Verify/index.js +2 -0
- package/build/features/entity/screens/Verify/validation.d.ts +8 -0
- package/build/features/entity/screens/Verify/validation.js +4 -0
- package/build/features/featuresScreens.d.ts +3 -0
- package/build/features/featuresScreens.js +48 -0
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +12 -5
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +14 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
- package/build/features/otp/OTP.d.ts +7 -0
- package/build/features/otp/OTP.js +58 -0
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +1 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +6 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.js +47 -0
- package/build/features/otp/screens/OTPVerify/Verify.d.ts +5 -0
- package/build/features/otp/screens/OTPVerify/Verify.js +49 -0
- package/build/features/otp/screens/OTPVerify/index.d.ts +2 -0
- package/build/features/otp/screens/OTPVerify/index.js +2 -0
- package/build/features/otp/screens/OTPVerify/validation.d.ts +8 -0
- package/build/features/otp/screens/OTPVerify/validation.js +4 -0
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +12 -5
- package/build/features/shared/Background/Background.d.ts +7 -5
- package/build/features/shared/Background/Background.js +16 -5
- package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
- package/build/features/shared/Dialog/CloseDialog.js +62 -0
- package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
- package/build/features/shared/Dialog/DialogContainer.js +56 -0
- package/build/features/shared/Dialog/index.d.ts +4 -0
- package/build/features/shared/Dialog/index.js +4 -0
- 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/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +12 -4
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +12 -4
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useAppConfig.js +2 -0
- package/build/hooks/useAppDispatch.d.ts +3 -0
- package/build/hooks/useErrorListener.js +3 -2
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/index.d.ts +5 -2
- package/build/index.js +11 -2
- package/build/utils/device.d.ts +1 -0
- package/build/utils/device.js +13 -0
- package/build/utils/html.d.ts +1 -0
- package/build/utils/html.js +6 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/rsa.d.ts +2 -2
- package/build/utils/rsa.js +1 -1
- package/build/utils/string.d.ts +22 -20
- package/build/utils/string.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
22
|
+
import * as 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 { useController, useFormContext } from 'react-hook-form';
|
|
27
|
+
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
28
|
+
import Text from '../../../../components/Text';
|
|
29
|
+
import { connectSelector, clearError } from '../../../app/connect/connectStore';
|
|
30
|
+
import CheckBox from '../../../../components/CheckBox';
|
|
31
|
+
import Warning from '../../../../components/Warning';
|
|
32
|
+
import Collapse from '../../../../components/Collapse';
|
|
33
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return (__assign({ margin: theme.spacing(2.5, 2.5, 0.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
37
|
+
});
|
|
38
|
+
var ContainerStyled = styled(Box)(function (_a) {
|
|
39
|
+
var theme = _a.theme;
|
|
40
|
+
return ({
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
padding: theme.spacing(0, 0.5, 0, 0.5),
|
|
45
|
+
height: theme.spacing(3.625),
|
|
46
|
+
marginBlockEnd: theme.spacing(0.2)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
50
|
+
var theme = _a.theme;
|
|
51
|
+
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) }));
|
|
52
|
+
});
|
|
53
|
+
var CheckBoxStyled = styled(CheckBox)(function (_a) {
|
|
54
|
+
var theme = _a.theme;
|
|
55
|
+
return ({
|
|
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
|
+
export 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
|
+
export var CollapseStyled = styled(Collapse)(function (_a) {
|
|
71
|
+
var theme = _a.theme;
|
|
72
|
+
return ({
|
|
73
|
+
marginBlockStart: theme.spacing(2)
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
var SalesChannels = function () {
|
|
77
|
+
var _a;
|
|
78
|
+
var _b = React.useState([]), channelsMenuList = _b[0], setChannelsMenuList = _b[1];
|
|
79
|
+
var t = useTranslation().t;
|
|
80
|
+
var isAr = useLanguage().isAr;
|
|
81
|
+
var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
|
|
82
|
+
var dispatch = useAppDispatch();
|
|
83
|
+
var channelsControl = useController({ name: 'salesChannels', control: control });
|
|
84
|
+
var channelsChecked = channelsControl.field.value;
|
|
85
|
+
var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
86
|
+
var _d = useAppSelector(connectSelector), data = _d.data, error = _d.error;
|
|
87
|
+
var channelList = (data.brandData.responseBody || {}).channelList;
|
|
88
|
+
var salesChannels = (data.brandData || {}).salesChannels;
|
|
89
|
+
var formDataSelectedBrand = getValues('selectedBrandItem');
|
|
90
|
+
React.useEffect(function () {
|
|
91
|
+
if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
|
|
92
|
+
setChannelsMenuList(channelList);
|
|
93
|
+
}
|
|
94
|
+
}, [channelList]);
|
|
95
|
+
var handleSalesChannelChange = function (event) {
|
|
96
|
+
var selected = channelsMenuList.find(function (channel) { return channel.id === event.target.id; });
|
|
97
|
+
var isExists = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (selected === null || selected === void 0 ? void 0 : selected.id); });
|
|
98
|
+
if (isExists) {
|
|
99
|
+
var updatedIdList = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.filter(function (channel) { return channel.id !== (selected === null || selected === void 0 ? void 0 : selected.id); });
|
|
100
|
+
channelsControl.field.onChange(updatedIdList);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
channelsControl.field.onChange(__spreadArray(__spreadArray([], channelsChecked, true), [selected], false));
|
|
104
|
+
if (error)
|
|
105
|
+
dispatch(clearError());
|
|
106
|
+
};
|
|
107
|
+
var getSelectedChannelsFlag = function (item) {
|
|
108
|
+
if (channelsChecked)
|
|
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
|
+
};
|
|
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.name.ar : channel.name.en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
|
|
113
|
+
};
|
|
114
|
+
export default SalesChannels;
|
|
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
@@ -37,8 +37,7 @@ var InputStyled = styled(Input)(function (_a) {
|
|
|
37
37
|
padding: theme.spacing(0, 2, 0, 0),
|
|
38
38
|
paddingInlineEnd: theme.spacing(2),
|
|
39
39
|
input: {
|
|
40
|
-
paddingInlineStart: theme.spacing(0)
|
|
41
|
-
textTransform: 'lowercase'
|
|
40
|
+
paddingInlineStart: theme.spacing(0)
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
});
|
|
@@ -58,23 +57,26 @@ var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
|
58
57
|
});
|
|
59
58
|
});
|
|
60
59
|
var SocialMedia = function (_a) {
|
|
61
|
-
var _b, _c, _d, _e;
|
|
60
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
62
61
|
var show = _a.show, sx = _a.sx, isNewUser = _a.isNewUser;
|
|
63
|
-
var
|
|
62
|
+
var _k = React.useState(SocialMediaTypes.WEB), socialMediaType = _k[0], setSocialMediaType = _k[1];
|
|
63
|
+
var _l = React.useState([SocialMediaTypes.WEB]), selectedSocialMediaTypes = _l[0], setSelectedSocialMediaTypes = _l[1];
|
|
64
64
|
var t = useTranslation().t;
|
|
65
|
-
var
|
|
65
|
+
var _m = useFormContext(), control = _m.control, setValue = _m.setValue, watch = _m.watch;
|
|
66
66
|
var linksControl = useController({ control: control, name: 'links' });
|
|
67
67
|
var links = linksControl.field.value;
|
|
68
68
|
var brandName = watch('brandName');
|
|
69
|
+
var selectedChannels = watch('salesChannels');
|
|
69
70
|
var data = useAppSelector(connectSelector).data;
|
|
70
71
|
var brandList = ((_b = data.brandData.responseBody) === null || _b === void 0 ? void 0 : _b.brands) || [];
|
|
71
72
|
var handleChange = function (_a) {
|
|
72
73
|
var _b;
|
|
73
74
|
var target = _a.target;
|
|
74
|
-
linksControl.field.onChange(__assign(__assign({}, links), (_b = {}, _b[socialMediaType] = target.value, _b)));
|
|
75
|
+
linksControl.field.onChange(__assign(__assign({}, links), (_b = {}, _b[socialMediaType.replace(' ', '_')] = target.value, _b)));
|
|
75
76
|
};
|
|
76
|
-
var handleClear = function () {
|
|
77
|
+
var handleClear = function (e) {
|
|
77
78
|
var _a;
|
|
79
|
+
e.stopPropagation();
|
|
78
80
|
linksControl.field.onChange(__assign(__assign({}, links), (_a = {}, _a[socialMediaType] = '', _a)));
|
|
79
81
|
};
|
|
80
82
|
var handleBlueWebsite = function () {
|
|
@@ -103,15 +105,58 @@ var SocialMedia = function (_a) {
|
|
|
103
105
|
setValue('links', __assign(__assign({}, links), { website: website }));
|
|
104
106
|
}
|
|
105
107
|
}, [brandName]);
|
|
108
|
+
React.useEffect(function () {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
if ((selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0) {
|
|
111
|
+
setSelectedSocialMediaTypes(selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.map(function (_a) {
|
|
112
|
+
var name = _a.name;
|
|
113
|
+
return name.en.toLocaleLowerCase();
|
|
114
|
+
}));
|
|
115
|
+
var hasSelectedMediaTypeAvailable = !!(selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.find(function (_a) {
|
|
116
|
+
var name = _a.name;
|
|
117
|
+
if (socialMediaType === SocialMediaTypes.TWITTER || socialMediaType === SocialMediaTypes.INSTAGRAM)
|
|
118
|
+
return name.en.toLocaleLowerCase() === SocialMediaTypes.SOCIAL;
|
|
119
|
+
if (socialMediaType === SocialMediaTypes.APPLE_STORE || socialMediaType === SocialMediaTypes.PLAY_STORE)
|
|
120
|
+
return name.en.toLocaleLowerCase() === SocialMediaTypes.APP;
|
|
121
|
+
return name.en.toLocaleLowerCase() === socialMediaType;
|
|
122
|
+
}));
|
|
123
|
+
if (!hasSelectedMediaTypeAvailable) {
|
|
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
|
+
if (type === SocialMediaTypes.SOCIAL)
|
|
126
|
+
setSocialMediaType(SocialMediaTypes.TWITTER);
|
|
127
|
+
else if (type === SocialMediaTypes.APP)
|
|
128
|
+
setSocialMediaType(SocialMediaTypes.APPLE_STORE);
|
|
129
|
+
else
|
|
130
|
+
setSocialMediaType(type);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, [selectedChannels]);
|
|
106
134
|
var websiteValue = links.website || '';
|
|
107
135
|
var twitterValue = links.twitter || '';
|
|
108
136
|
var instagramValue = links.instagram || '';
|
|
137
|
+
var appleStoreValue = links.apple_store || '';
|
|
138
|
+
var playStoreValue = links.play_store || '';
|
|
139
|
+
var callCenterValue = links.call_center || '';
|
|
140
|
+
var physicalStoreValue = links.physical_store || '';
|
|
109
141
|
var errors = linksControl.fieldState.error;
|
|
110
142
|
var websiteError = (_c = errors === null || errors === void 0 ? void 0 : errors.website) === null || _c === void 0 ? void 0 : _c.message;
|
|
111
143
|
var twitterError = (_d = errors === null || errors === void 0 ? void 0 : errors.twitter) === null || _d === void 0 ? void 0 : _d.message;
|
|
112
144
|
var instagramError = (_e = errors === null || errors === void 0 ? void 0 : errors.instagram) === null || _e === void 0 ? void 0 : _e.message;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
145
|
+
var appleStoreError = (_f = errors === null || errors === void 0 ? void 0 : errors.apple_store) === null || _f === void 0 ? void 0 : _f.message;
|
|
146
|
+
var playStoreError = (_g = errors === null || errors === void 0 ? void 0 : errors.play_store) === null || _g === void 0 ? void 0 : _g.message;
|
|
147
|
+
var callCenterError = (_h = errors === null || errors === void 0 ? void 0 : errors.call_center) === null || _h === void 0 ? void 0 : _h.message;
|
|
148
|
+
var physicalStoreError = (_j = errors === null || errors === void 0 ? void 0 : errors.physical_store) === null || _j === void 0 ? void 0 : _j.message;
|
|
149
|
+
var hasWebsite = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) { return s === SocialMediaTypes.WEB; }));
|
|
150
|
+
var hasSocial = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) {
|
|
151
|
+
return s === SocialMediaTypes.TWITTER || s === SocialMediaTypes.INSTAGRAM || s === SocialMediaTypes.SOCIAL;
|
|
152
|
+
}));
|
|
153
|
+
var hasApp = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) {
|
|
154
|
+
return s === SocialMediaTypes.APPLE_STORE || s === SocialMediaTypes.PLAY_STORE || s === SocialMediaTypes.APP;
|
|
155
|
+
}));
|
|
156
|
+
var hasCallCenter = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) { return s === SocialMediaTypes.CALL_CENTER; }));
|
|
157
|
+
var hasPhysicalStore = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) { return s === SocialMediaTypes.PHYSICAL_STORE; }));
|
|
158
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mb: show && (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) === 0 ? 3 : 0 } }, { children: _jsx(Collapse, __assign({ in: show && (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0, sx: { mb: (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) === 0 ? 3 : 0 } }, { children: _jsxs(ScreenContainer, __assign({ sx: __assign({ mt: 3, mb: 3, direction: 'ltr' }, sx) }, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, showSocialMediaTypes: selectedSocialMediaTypes, exclusive: true, onChange: function (e, value) {
|
|
159
|
+
setSocialMediaType(value);
|
|
160
|
+
} }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB && hasWebsite, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, onBlur: function () { return handleBlueWebsite(); }, startAdornment: _jsx(TextStyled, {}), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(_Fragment, {}) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.APPLE_STORE && hasApp, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: appleStoreValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('apple_store_placeholder'), warningType: 'alert', warningMessage: appleStoreError && t(appleStoreError), endAdornment: !appleStoreError && appleStoreValue ? (_jsx(CheckIcon, {})) : (appleStoreValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.PLAY_STORE && hasApp, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: playStoreValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('play_store_placeholder'), warningType: 'alert', warningMessage: playStoreError && t(playStoreError), endAdornment: !playStoreError && playStoreValue ? (_jsx(CheckIcon, {})) : (playStoreValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.PHYSICAL_STORE && hasPhysicalStore, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: physicalStoreValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('physical_store_placeholder'), warningType: 'alert', warningMessage: physicalStoreError && t(physicalStoreError), endAdornment: !physicalStoreError && physicalStoreValue ? (_jsx(CheckIcon, {})) : (physicalStoreValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER && hasSocial, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? (_jsx(CheckIcon, {})) : (twitterValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM && hasSocial, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.CALL_CENTER && hasCallCenter, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: callCenterValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('call_center_placeholder'), warningType: 'alert', warningMessage: callCenterError && t(callCenterError), endAdornment: !callCenterError && callCenterValue ? (_jsx(CheckIcon, {})) : (callCenterValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })) })) })));
|
|
116
161
|
};
|
|
117
162
|
export default React.memo(SocialMedia);
|
|
@@ -7,49 +7,136 @@ export declare enum ValidationOptions {
|
|
|
7
7
|
export declare const MerchantValidationSchema: (userType: ValidationOptions) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
8
8
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
9
9
|
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
10
|
+
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
11
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
13
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
14
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
16
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
19
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
21
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
|
+
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
23
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
|
+
}>>[] | undefined>;
|
|
10
27
|
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
11
28
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
29
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
13
30
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
31
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
32
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
33
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
34
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
14
35
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
36
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
16
37
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
17
38
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
39
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
40
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
41
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
42
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
18
43
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
19
44
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
45
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
21
46
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
47
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
48
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
49
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
50
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
22
51
|
}>>>;
|
|
23
52
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
53
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
54
|
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
55
|
+
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
56
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
57
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
58
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
59
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
60
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
61
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
62
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
63
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
64
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
65
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
66
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
67
|
+
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
68
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
69
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
70
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
71
|
+
}>>[] | undefined>;
|
|
26
72
|
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
27
73
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
74
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
29
75
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
76
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
77
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
78
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
79
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
30
80
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
31
81
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
82
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
33
83
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
84
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
85
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
86
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
87
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
34
88
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
35
89
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
36
90
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
37
91
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
92
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
93
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
94
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
95
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
38
96
|
}>>>;
|
|
39
97
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
40
98
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
41
99
|
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
100
|
+
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
101
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
102
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
103
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
104
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
105
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
106
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
107
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
108
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
109
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
110
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
111
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
112
|
+
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
113
|
+
id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
114
|
+
name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
115
|
+
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
116
|
+
}>>[] | undefined>;
|
|
42
117
|
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
43
118
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
44
119
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
45
120
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
121
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
122
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
123
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
124
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
46
125
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
47
126
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
48
127
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
49
128
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
129
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
130
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
131
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
132
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
50
133
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
51
134
|
website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
52
135
|
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
53
136
|
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
137
|
+
apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
138
|
+
play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
139
|
+
call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
140
|
+
physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
54
141
|
}>>>;
|
|
55
142
|
}>>>;
|
|
@@ -24,6 +24,15 @@ export var MerchantValidationSchema = function (userType) {
|
|
|
24
24
|
})
|
|
25
25
|
.required(''),
|
|
26
26
|
termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond'),
|
|
27
|
+
salesChannels: yup
|
|
28
|
+
.array()
|
|
29
|
+
.min(1, 'choose_atleast_one_channel')
|
|
30
|
+
.of(yup.object().shape({
|
|
31
|
+
id: yup.string(),
|
|
32
|
+
name_en: yup.string(),
|
|
33
|
+
name_ar: yup.string()
|
|
34
|
+
}))
|
|
35
|
+
.required('choose_atleast_one_channel'),
|
|
27
36
|
links: yup.object().shape({
|
|
28
37
|
website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
|
|
29
38
|
if (!instagram && !twitter) {
|
|
@@ -67,7 +76,31 @@ export var MerchantValidationSchema = function (userType) {
|
|
|
67
76
|
else {
|
|
68
77
|
return yup.string().optional();
|
|
69
78
|
}
|
|
70
|
-
})
|
|
79
|
+
}),
|
|
80
|
+
apple_store: yup
|
|
81
|
+
.string()
|
|
82
|
+
.nullable()
|
|
83
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
84
|
+
.min(2, 'enter_at_least_one')
|
|
85
|
+
.optional(),
|
|
86
|
+
play_store: yup
|
|
87
|
+
.string()
|
|
88
|
+
.nullable()
|
|
89
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
90
|
+
.min(2, 'enter_at_least_one')
|
|
91
|
+
.optional(),
|
|
92
|
+
call_center: yup
|
|
93
|
+
.string()
|
|
94
|
+
.nullable()
|
|
95
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
96
|
+
.min(2, 'enter_at_least_one')
|
|
97
|
+
.optional(),
|
|
98
|
+
physical_store: yup
|
|
99
|
+
.string()
|
|
100
|
+
.nullable()
|
|
101
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
102
|
+
.min(2, 'enter_at_least_one')
|
|
103
|
+
.optional()
|
|
71
104
|
}, [
|
|
72
105
|
['instagram', 'website'],
|
|
73
106
|
['twitter', 'website'],
|
|
@@ -78,6 +111,15 @@ export var MerchantValidationSchema = function (userType) {
|
|
|
78
111
|
return yup.object().shape({
|
|
79
112
|
brandName: yup.string().optional(),
|
|
80
113
|
termAndConditionChecked: yup.boolean().optional(),
|
|
114
|
+
salesChannels: yup
|
|
115
|
+
.array()
|
|
116
|
+
.min(1, 'choose_atleast_one_channel')
|
|
117
|
+
.of(yup.object().shape({
|
|
118
|
+
id: yup.string(),
|
|
119
|
+
name_en: yup.string(),
|
|
120
|
+
name_ar: yup.string()
|
|
121
|
+
}))
|
|
122
|
+
.required('choose_atleast_one_channel'),
|
|
81
123
|
links: yup.object().shape({
|
|
82
124
|
website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
|
|
83
125
|
if (!instagram && !twitter) {
|
|
@@ -121,7 +163,31 @@ export var MerchantValidationSchema = function (userType) {
|
|
|
121
163
|
else {
|
|
122
164
|
return yup.string().optional();
|
|
123
165
|
}
|
|
124
|
-
})
|
|
166
|
+
}),
|
|
167
|
+
apple_store: yup
|
|
168
|
+
.string()
|
|
169
|
+
.nullable()
|
|
170
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
171
|
+
.min(2, 'enter_at_least_one')
|
|
172
|
+
.optional(),
|
|
173
|
+
play_store: yup
|
|
174
|
+
.string()
|
|
175
|
+
.nullable()
|
|
176
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
177
|
+
.min(2, 'enter_at_least_one')
|
|
178
|
+
.optional(),
|
|
179
|
+
call_center: yup
|
|
180
|
+
.string()
|
|
181
|
+
.nullable()
|
|
182
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
183
|
+
.min(2, 'enter_at_least_one')
|
|
184
|
+
.optional(),
|
|
185
|
+
physical_store: yup
|
|
186
|
+
.string()
|
|
187
|
+
.nullable()
|
|
188
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
189
|
+
.min(2, 'enter_at_least_one')
|
|
190
|
+
.optional()
|
|
125
191
|
}, [
|
|
126
192
|
['instagram', 'website'],
|
|
127
193
|
['twitter', 'website'],
|
|
@@ -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);
|