@tap-payments/auth-jsconnect 2.1.55-test → 2.1.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/features/connectExpress/screens/Brand/Brand.d.ts +0 -0
- package/build/features/connectExpress/screens/Brand/Brand.js +1 -0
- package/build/features/connectExpress/screens/Brand/BrandList.d.ts +10 -0
- package/build/features/connectExpress/screens/Brand/BrandList.js +106 -0
- package/build/features/connectExpress/screens/Brand/BrandName.d.ts +8 -0
- package/build/features/connectExpress/screens/Brand/BrandName.js +142 -0
- package/build/features/connectExpress/screens/Brand/SalesChannels.d.ts +5 -0
- package/build/features/connectExpress/screens/Brand/SalesChannels.js +38 -0
- package/build/features/connectExpress/screens/Brand/Segments.d.ts +8 -0
- package/build/features/connectExpress/screens/Brand/Segments.js +74 -0
- package/build/features/connectExpress/screens/Brand/TAC.d.ts +6 -0
- package/build/features/connectExpress/screens/Brand/TAC.js +84 -0
- package/build/features/connectExpress/screens/Brand/TeamSize.d.ts +8 -0
- package/build/features/connectExpress/screens/Brand/TeamSize.js +74 -0
- package/build/features/connectExpress/screens/Brand/index.d.ts +0 -0
- package/build/features/connectExpress/screens/Brand/index.js +1 -0
- package/build/features/connectExpress/screens/Brand/validation.d.ts +38 -0
- package/build/features/connectExpress/screens/Brand/validation.js +134 -0
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
- package/build/features/individual/screens/IndividualList/BoardList.d.ts +0 -0
- package/build/features/individual/screens/IndividualList/BoardList.js +1 -0
- package/build/features/individual/screens/IndividualList/ShareholderList.d.ts +0 -0
- package/build/features/individual/screens/IndividualList/ShareholderList.js +1 -0
- package/build/features/individual/screens/IndividualList/UserList.d.ts +0 -0
- package/build/features/individual/screens/IndividualList/UserList.js +1 -0
- package/build/features/individual/screens/IndividualList/index.d.ts +0 -0
- package/build/features/individual/screens/IndividualList/index.js +1 -0
- package/package.json +1 -1
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BrandInfo } from '../../../../@types';
|
|
3
|
+
interface BrandListProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
list: Array<BrandInfo>;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BrandListProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { connectSelector } from '../../../app/connect/connectStore';
|
|
25
|
+
import * as React from 'react';
|
|
26
|
+
import { useTranslation } from 'react-i18next';
|
|
27
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
28
|
+
import Box from '@mui/material/Box';
|
|
29
|
+
import { styled } from '@mui/material/styles';
|
|
30
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
31
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
32
|
+
import Input from '../../../shared/Input';
|
|
33
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
34
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
35
|
+
import Text from '../../../../components/Text';
|
|
36
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
|
+
import Collapse from '../../../../components/Collapse';
|
|
38
|
+
import { mapSalesChannel } from '../../../../utils';
|
|
39
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
40
|
+
'& .MuiInputBase-input': {
|
|
41
|
+
cursor: 'pointer'
|
|
42
|
+
}
|
|
43
|
+
}); });
|
|
44
|
+
var BrandContainer = styled(Box)(function () { return ({
|
|
45
|
+
display: 'flex'
|
|
46
|
+
}); });
|
|
47
|
+
var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
48
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
49
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
50
|
+
});
|
|
51
|
+
var BrandList = function (_a) {
|
|
52
|
+
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
53
|
+
var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
54
|
+
var t = useTranslation().t;
|
|
55
|
+
var isAr = useLanguage().isAr;
|
|
56
|
+
var data = useAppSelector(connectSelector).data;
|
|
57
|
+
var _c = data.individualData.responseBody || {}, segments_list = _c.segments_list, team_size_list = _c.team_size_list;
|
|
58
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
59
|
+
var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
|
|
60
|
+
var selectedBrand = selectedBrandControl.field.value;
|
|
61
|
+
var onOpenBrandList = function (event) {
|
|
62
|
+
var _a;
|
|
63
|
+
setAnchorEl(event.currentTarget);
|
|
64
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
65
|
+
};
|
|
66
|
+
var onCloseBrandList = function () {
|
|
67
|
+
var _a;
|
|
68
|
+
setAnchorEl(null);
|
|
69
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
70
|
+
};
|
|
71
|
+
var getBrandName = function (_a) {
|
|
72
|
+
var name = _a.name;
|
|
73
|
+
return (isAr ? name === null || name === void 0 ? void 0 : name.ar : name === null || name === void 0 ? void 0 : name.en) || '';
|
|
74
|
+
};
|
|
75
|
+
var getBrandId = function (item) {
|
|
76
|
+
return item.id || '';
|
|
77
|
+
};
|
|
78
|
+
var isOtherBrand = function (item) {
|
|
79
|
+
return getBrandId(item) === 'other';
|
|
80
|
+
};
|
|
81
|
+
var onSelectItem = function (brand) {
|
|
82
|
+
selectedBrandControl.field.onChange(brand);
|
|
83
|
+
if (!isOtherBrand(brand)) {
|
|
84
|
+
setValue('salesChannels', mapSalesChannel(brand.channel_services || []), { shouldValidate: true });
|
|
85
|
+
}
|
|
86
|
+
if (isOtherBrand(brand)) {
|
|
87
|
+
setValue('salesChannels', [], { shouldValidate: true });
|
|
88
|
+
setValue('brandName', '');
|
|
89
|
+
}
|
|
90
|
+
setValue('segment', segments_list.find(function (_a) {
|
|
91
|
+
var _b;
|
|
92
|
+
var id = _a.id;
|
|
93
|
+
return ((_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.type) === id;
|
|
94
|
+
}), { shouldValidate: true });
|
|
95
|
+
setValue('teamSize', team_size_list.find(function (_a) {
|
|
96
|
+
var _b;
|
|
97
|
+
var id = _a.id;
|
|
98
|
+
return ((_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.team) === id;
|
|
99
|
+
}), { shouldValidate: true });
|
|
100
|
+
onCloseBrandList();
|
|
101
|
+
};
|
|
102
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('select_brand_label'), readOnly: true, onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', list: list, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
103
|
+
return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(selectedBrand) }, { children: isOtherBrand(item) ? t(getBrandName(item)) : getBrandName(item) })) }), getBrandId(item) === getBrandId(selectedBrand) && _jsx(CheckIcon, {})] }));
|
|
104
|
+
} }) }))] }) })));
|
|
105
|
+
};
|
|
106
|
+
export default React.memo(BrandList);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface BrandNameProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
fetchingBrandName: (flag: boolean) => void;
|
|
5
|
+
brandNameChecking: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName }: BrandNameProps) => JSX.Element>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,142 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
+
import * as React from 'react';
|
|
50
|
+
import { useTranslation } from 'react-i18next';
|
|
51
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
52
|
+
import Box from '@mui/material/Box';
|
|
53
|
+
import axios from 'axios';
|
|
54
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
55
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
56
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
57
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
58
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
59
|
+
import Text from '../../../../components/Text';
|
|
60
|
+
import Input from '../../../shared/Input';
|
|
61
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
62
|
+
import Tooltip from '../../../../components/Tooltip';
|
|
63
|
+
import Collapse from '../../../../components/Collapse';
|
|
64
|
+
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
65
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
66
|
+
import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
|
|
67
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
68
|
+
import { debounce } from 'lodash-es';
|
|
69
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
70
|
+
var theme = _a.theme;
|
|
71
|
+
return ({
|
|
72
|
+
display: 'flex',
|
|
73
|
+
justifyContent: 'space-between',
|
|
74
|
+
padding: theme.spacing(0, 2.5, 1, 2.5)
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
78
|
+
var theme = _a.theme;
|
|
79
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
80
|
+
});
|
|
81
|
+
var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
82
|
+
var theme = _a.theme;
|
|
83
|
+
return ({
|
|
84
|
+
width: theme.spacing(2.75),
|
|
85
|
+
height: theme.spacing(2.125),
|
|
86
|
+
cursor: 'pointer',
|
|
87
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
91
|
+
var theme = _a.theme;
|
|
92
|
+
return ({
|
|
93
|
+
width: theme.spacing(2.75),
|
|
94
|
+
height: theme.spacing(2.125),
|
|
95
|
+
cursor: 'pointer',
|
|
96
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
var cancelToken = null;
|
|
100
|
+
var BrandName = function (_a) {
|
|
101
|
+
var _b;
|
|
102
|
+
var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName;
|
|
103
|
+
var dispatch = useAppDispatch();
|
|
104
|
+
var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
|
|
105
|
+
var t = useTranslation().t;
|
|
106
|
+
var data = useAppSelector(connectSelector).data;
|
|
107
|
+
var control = useFormContext().control;
|
|
108
|
+
var brandControl = useController({ control: control, name: 'brandName' });
|
|
109
|
+
var brandNameValue = brandControl.field.value;
|
|
110
|
+
var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
111
|
+
var checkBrand = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
var onSuccess;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
if (cancelToken) {
|
|
115
|
+
cancelToken.cancel('Aborted');
|
|
116
|
+
}
|
|
117
|
+
cancelToken = axios.CancelToken.source();
|
|
118
|
+
onSuccess = function () { return fetchingBrandName(false); };
|
|
119
|
+
dispatch(checkBrandNameAvailability({ name: value, cancelToken: cancelToken.token, onSuccess: onSuccess }));
|
|
120
|
+
return [2];
|
|
121
|
+
});
|
|
122
|
+
}); }, 500);
|
|
123
|
+
var handleBrandNameChange = function (_a) {
|
|
124
|
+
var target = _a.target;
|
|
125
|
+
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
126
|
+
brandControl.field.onChange(value);
|
|
127
|
+
};
|
|
128
|
+
React.useEffect(function () {
|
|
129
|
+
var _a, _b, _c;
|
|
130
|
+
var isValid = brandNameValue && !error && brandNameValue.length > 2;
|
|
131
|
+
var brand = (_c = (_b = (_a = data.otpData.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.en;
|
|
132
|
+
if (isValid && (brandNameValue === null || brandNameValue === void 0 ? void 0 : brandNameValue.toLowerCase()) != brand) {
|
|
133
|
+
fetchingBrandName(true);
|
|
134
|
+
checkBrand(brandNameValue);
|
|
135
|
+
}
|
|
136
|
+
}, [brandNameValue, error]);
|
|
137
|
+
var clearBrandName = function () {
|
|
138
|
+
brandControl.field.onChange('');
|
|
139
|
+
};
|
|
140
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
|
|
141
|
+
};
|
|
142
|
+
export default React.memo(BrandName);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
4
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
5
|
+
import { connectSelector, clearError } from '../../../app/connect/connectStore';
|
|
6
|
+
import { mapSalesChannel } from '../../../../utils';
|
|
7
|
+
import SalesChannel from '../../../shared/SalesChannels';
|
|
8
|
+
var SalesChannels = function (_a) {
|
|
9
|
+
var _b;
|
|
10
|
+
var _c = useFormContext(), control = _c.control, setValue = _c.setValue, getValues = _c.getValues;
|
|
11
|
+
var dispatch = useAppDispatch();
|
|
12
|
+
var _d = useController({ control: control, name: 'salesChannels' }), fieldState = _d.fieldState, field = _d.field;
|
|
13
|
+
var _e = useAppSelector(connectSelector), data = _e.data, error = _e.error;
|
|
14
|
+
var _f = data.brandData, selectedBrandItem = _f.selectedBrandItem, responseBody = _f.responseBody, defaultSalesChannels = _f.salesChannels;
|
|
15
|
+
var channelList = (responseBody || {}).channel_list;
|
|
16
|
+
var selectedBrandControl = getValues('selectedBrandItem');
|
|
17
|
+
React.useEffect(function () {
|
|
18
|
+
if (selectedBrandItem.id) {
|
|
19
|
+
setValue('selectedBrandItem', selectedBrandItem);
|
|
20
|
+
var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
|
|
21
|
+
field.onChange(sales);
|
|
22
|
+
}
|
|
23
|
+
}, [selectedBrandItem]);
|
|
24
|
+
React.useEffect(function () {
|
|
25
|
+
if (defaultSalesChannels.length > 0) {
|
|
26
|
+
var sales = mapSalesChannel(defaultSalesChannels);
|
|
27
|
+
field.onChange(sales);
|
|
28
|
+
}
|
|
29
|
+
}, [defaultSalesChannels]);
|
|
30
|
+
var selectedSalesChannels = React.useMemo(function () { return mapSalesChannel(field.value); }, [(field.value || []).length]);
|
|
31
|
+
var onChange = function (channels) {
|
|
32
|
+
if (error)
|
|
33
|
+
dispatch(clearError());
|
|
34
|
+
field.onChange(channels);
|
|
35
|
+
};
|
|
36
|
+
return (_jsx(SalesChannel, { error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, selectFirstIconListener: selectedBrandControl === null || selectedBrandControl === void 0 ? void 0 : selectedBrandControl.id, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
37
|
+
};
|
|
38
|
+
export default SalesChannels;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { connectSelector } from '../../../app/connect/connectStore';
|
|
14
|
+
import Collapse from '../../../../components/Collapse';
|
|
15
|
+
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
16
|
+
import Input from '../../../../features/shared/Input';
|
|
17
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { useTranslation } from 'react-i18next';
|
|
20
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
21
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
22
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
23
|
+
import Box from '@mui/material/Box';
|
|
24
|
+
import { styled } from '@mui/material/styles';
|
|
25
|
+
import Text from '../../../../components/Text';
|
|
26
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
27
|
+
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
28
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
29
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
30
|
+
});
|
|
31
|
+
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return ({
|
|
34
|
+
color: theme.palette.success.main,
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'flex-end'
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var Segments = function (_a) {
|
|
40
|
+
var _b, _c, _d, _e;
|
|
41
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
|
|
42
|
+
var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
|
|
43
|
+
var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
|
|
44
|
+
var t = useTranslation().t;
|
|
45
|
+
var isAr = useLanguage().isAr;
|
|
46
|
+
var data = useAppSelector(connectSelector).data;
|
|
47
|
+
var control = useFormContext().control;
|
|
48
|
+
var segmentsList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segments_list) || [];
|
|
49
|
+
var segmentControl = useController({ control: control, name: 'segment' });
|
|
50
|
+
var segment = segmentControl.field.value;
|
|
51
|
+
var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
52
|
+
React.useEffect(function () {
|
|
53
|
+
if ((segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.length) > 0) {
|
|
54
|
+
setSegmentList(segmentsList);
|
|
55
|
+
}
|
|
56
|
+
}, [segmentsList]);
|
|
57
|
+
var onOpenList = function (event) {
|
|
58
|
+
setAnchorEl(event.currentTarget);
|
|
59
|
+
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
60
|
+
};
|
|
61
|
+
var onCloseList = function () {
|
|
62
|
+
setAnchorEl(null);
|
|
63
|
+
onListClose === null || onListClose === void 0 ? void 0 : onListClose();
|
|
64
|
+
};
|
|
65
|
+
var onSelectItem = function (segment) {
|
|
66
|
+
onCloseList();
|
|
67
|
+
segmentControl.field.onChange(segment);
|
|
68
|
+
};
|
|
69
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('segment_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIconStyled, {})] }));
|
|
72
|
+
} }) }))] })) })));
|
|
73
|
+
};
|
|
74
|
+
export default Segments;
|
|
@@ -0,0 +1,84 @@
|
|
|
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 { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import Link from '@mui/material/Link';
|
|
19
|
+
import CheckBox from '../../../../components/CheckBox';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import Text from '../../../../components/Text';
|
|
22
|
+
import Warning from '../../../../components/Warning';
|
|
23
|
+
import { useLanguage } from '../../../../hooks';
|
|
24
|
+
import Collapse from '../../../../components/Collapse';
|
|
25
|
+
import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
|
|
26
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
27
|
+
import { useAppSelector } from '../../../../hooks';
|
|
28
|
+
var TACContainerStyled = styled(Box)(function (_a) {
|
|
29
|
+
var theme = _a.theme;
|
|
30
|
+
return ({
|
|
31
|
+
display: 'flex',
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
paddingInlineStart: theme.spacing(2.5)
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
38
|
+
var theme = _a.theme;
|
|
39
|
+
return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
|
|
40
|
+
});
|
|
41
|
+
var LinkStyled = styled(Link)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return ({
|
|
44
|
+
color: theme.palette.primary.main,
|
|
45
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
46
|
+
letterSpacing: theme.spacing(0)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
50
|
+
var theme = _a.theme;
|
|
51
|
+
return ({
|
|
52
|
+
margin: theme.spacing(0),
|
|
53
|
+
padding: theme.spacing(0),
|
|
54
|
+
marginInlineEnd: theme.spacing(1.5),
|
|
55
|
+
color: theme.palette.primary.main,
|
|
56
|
+
'& .MuiSvgIcon-root': {
|
|
57
|
+
fontSize: theme.spacing(3.75)
|
|
58
|
+
},
|
|
59
|
+
'&.Mui-checked': {
|
|
60
|
+
color: theme.palette.text.primary,
|
|
61
|
+
borderRadius: theme.spacing(2.5)
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
66
|
+
width: '100%'
|
|
67
|
+
}); });
|
|
68
|
+
var TAC = function (_a) {
|
|
69
|
+
var _b;
|
|
70
|
+
var show = _a.show;
|
|
71
|
+
var t = useTranslation().t;
|
|
72
|
+
var isAr = useLanguage().isAr;
|
|
73
|
+
var control = useFormContext().control;
|
|
74
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
75
|
+
var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
|
|
76
|
+
var tacChecked = tacControl.field.value;
|
|
77
|
+
var warningMessage = (_b = tacControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
78
|
+
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
79
|
+
var handleTACCheckedChange = function (event, checked) {
|
|
80
|
+
tacControl.field.onChange(checked);
|
|
81
|
+
};
|
|
82
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }) })));
|
|
83
|
+
};
|
|
84
|
+
export default React.memo(TAC);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { connectSelector } from '../../../app/connect/connectStore';
|
|
14
|
+
import Box from '@mui/material/Box';
|
|
15
|
+
import Collapse from '../../../../components/Collapse';
|
|
16
|
+
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
17
|
+
import Input from '../../../../features/shared/Input';
|
|
18
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { useTranslation } from 'react-i18next';
|
|
21
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
22
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
23
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
24
|
+
import { styled } from '@mui/material/styles';
|
|
25
|
+
import Text from '../../../../components/Text';
|
|
26
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
27
|
+
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
28
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
29
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
30
|
+
});
|
|
31
|
+
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return ({
|
|
34
|
+
color: theme.palette.success.main,
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'flex-end'
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var TeamSize = function (_a) {
|
|
40
|
+
var _b, _c, _d, _e;
|
|
41
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
|
|
42
|
+
var _f = React.useState([]), teamSizeList = _f[0], setTeamSizeList = _f[1];
|
|
43
|
+
var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
|
|
44
|
+
var t = useTranslation().t;
|
|
45
|
+
var isAr = useLanguage().isAr;
|
|
46
|
+
var data = useAppSelector(connectSelector).data;
|
|
47
|
+
var control = useFormContext().control;
|
|
48
|
+
var teamSizesList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.team_size_list) || [];
|
|
49
|
+
var teamSizeControl = useController({ control: control, name: 'teamSize' });
|
|
50
|
+
var teamSize = teamSizeControl.field.value;
|
|
51
|
+
var error = (_c = teamSizeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
52
|
+
React.useEffect(function () {
|
|
53
|
+
if ((teamSizesList === null || teamSizesList === void 0 ? void 0 : teamSizesList.length) > 0) {
|
|
54
|
+
setTeamSizeList(teamSizesList);
|
|
55
|
+
}
|
|
56
|
+
}, [teamSizesList]);
|
|
57
|
+
var onOpenList = function (event) {
|
|
58
|
+
setAnchorEl(event.currentTarget);
|
|
59
|
+
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
60
|
+
};
|
|
61
|
+
var onCloseList = function () {
|
|
62
|
+
setAnchorEl(null);
|
|
63
|
+
onListClose === null || onListClose === void 0 ? void 0 : onListClose();
|
|
64
|
+
};
|
|
65
|
+
var onSelectItem = function (teamSize) {
|
|
66
|
+
onCloseList();
|
|
67
|
+
teamSizeControl.field.onChange(teamSize);
|
|
68
|
+
};
|
|
69
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('team_size_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_team_size'), value: (isAr ? (_d = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en', 'name.ar'], list: teamSizeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(CheckIconStyled, {})] }));
|
|
72
|
+
} }) }))] })) })));
|
|
73
|
+
};
|
|
74
|
+
export default TeamSize;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
6
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
8
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
9
|
+
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
10
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
|
+
}>>[] | undefined>;
|
|
12
|
+
segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
13
|
+
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
14
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
|
+
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
17
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
18
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
20
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
21
|
+
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
22
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
|
+
}>>[] | undefined>;
|
|
24
|
+
segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
25
|
+
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
26
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
27
|
+
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
28
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
30
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
31
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
32
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
33
|
+
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
34
|
+
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
35
|
+
}>>[] | undefined>;
|
|
36
|
+
segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
37
|
+
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
38
|
+
}>>>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
import { REGEX_WEBSITE, REGEX_BRAND_NAME, LINKEDIN_URL, SOCIAL_USERNAME, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
|
|
11
|
+
import * as yup from 'yup';
|
|
12
|
+
var validationSalesChannels = function (channels) {
|
|
13
|
+
if (channels === void 0) { channels = []; }
|
|
14
|
+
var dic = {};
|
|
15
|
+
var typeDic = {};
|
|
16
|
+
channels.forEach(function (channel) {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
19
|
+
var key_1 = (_b = channel.code) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
20
|
+
if (key_1)
|
|
21
|
+
dic[key_1] = [];
|
|
22
|
+
channel.sub.forEach(function (sub) {
|
|
23
|
+
dic[key_1].push(sub.address || '');
|
|
24
|
+
typeDic[sub.code] = sub.address || '';
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
var key = (_c = channel.code) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
29
|
+
if (key)
|
|
30
|
+
dic[key] = [channel.address || ''];
|
|
31
|
+
typeDic[key] = channel.address || '';
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
for (var key in dic) {
|
|
35
|
+
var values = dic[key];
|
|
36
|
+
var atLestOne = values.every(function (item) { return item === ''; });
|
|
37
|
+
if (atLestOne)
|
|
38
|
+
return "enter_at_least_one_".concat(key);
|
|
39
|
+
}
|
|
40
|
+
for (var key in typeDic) {
|
|
41
|
+
var value = typeDic[key];
|
|
42
|
+
if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
|
|
43
|
+
return 'invalid_url';
|
|
44
|
+
}
|
|
45
|
+
if (key === 'linkedin' && value && !value.match(LINKEDIN_URL)) {
|
|
46
|
+
return 'invalid_linkedin_profile_url';
|
|
47
|
+
}
|
|
48
|
+
if (key === 'facebook' && value && !value.match(SOCIAL_USERNAME)) {
|
|
49
|
+
return 'invalid_facebook_username';
|
|
50
|
+
}
|
|
51
|
+
if (key === 'instagram' && value && !value.match(SOCIAL_USERNAME)) {
|
|
52
|
+
return 'invalid_instagram_username';
|
|
53
|
+
}
|
|
54
|
+
if (key === 'twitter' && value && !value.match(SOCIAL_USERNAME)) {
|
|
55
|
+
return 'invalid_twitter_username';
|
|
56
|
+
}
|
|
57
|
+
if (key === 'physical_store' && value && value.length < 3) {
|
|
58
|
+
return 'invalid_physical_store_location';
|
|
59
|
+
}
|
|
60
|
+
if (key === 'ios' && value && !value.match(REGEX_ALPHANUMERIC)) {
|
|
61
|
+
return 'invalid_ios_app';
|
|
62
|
+
}
|
|
63
|
+
if (key === 'android' && value && !value.match(REGEX_ALPHANUMERIC)) {
|
|
64
|
+
return 'invalid_android_app';
|
|
65
|
+
}
|
|
66
|
+
if (key === 'call_center' && value && !value.match(DIGITS_ONLY)) {
|
|
67
|
+
return 'invalid_call_center_number';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
};
|
|
72
|
+
export var MerchantValidationSchema = function (isNewBrand) {
|
|
73
|
+
if (isNewBrand === void 0) { isNewBrand = true; }
|
|
74
|
+
if (isNewBrand)
|
|
75
|
+
return yup.object().shape({
|
|
76
|
+
brandName: yup
|
|
77
|
+
.string()
|
|
78
|
+
.test({
|
|
79
|
+
test: function (value) {
|
|
80
|
+
if ((value === null || value === void 0 ? void 0 : value.length) === 0)
|
|
81
|
+
return true;
|
|
82
|
+
if (value && value.length >= 3 && (value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)))
|
|
83
|
+
return true;
|
|
84
|
+
return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
.required('enter_brand_name_english_chars_numbers_space'),
|
|
88
|
+
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
|
|
89
|
+
segment: yup.object().required('alert_choose_segment'),
|
|
90
|
+
teamSize: yup.object().required('alert_choose_teamSize'),
|
|
91
|
+
salesChannels: yup
|
|
92
|
+
.array()
|
|
93
|
+
.min(1, 'choose_atleast_one_channel')
|
|
94
|
+
.of(yup.object().shape({
|
|
95
|
+
id: yup.string().required('choose_atleast_one_channel')
|
|
96
|
+
}))
|
|
97
|
+
.test({
|
|
98
|
+
test: function (value) {
|
|
99
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
100
|
+
if (length === 0)
|
|
101
|
+
return true;
|
|
102
|
+
var channels = __spreadArray([], (value || []), true);
|
|
103
|
+
var result = validationSalesChannels(channels);
|
|
104
|
+
if (result === true)
|
|
105
|
+
return true;
|
|
106
|
+
return this.createError({ message: result });
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
.required('choose_atleast_one_channel')
|
|
110
|
+
});
|
|
111
|
+
return yup.object().shape({
|
|
112
|
+
salesChannels: yup
|
|
113
|
+
.array()
|
|
114
|
+
.min(1, 'choose_atleast_one_channel')
|
|
115
|
+
.of(yup.object().shape({
|
|
116
|
+
id: yup.string().required('choose_atleast_one_channel')
|
|
117
|
+
}))
|
|
118
|
+
.test({
|
|
119
|
+
test: function (value) {
|
|
120
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
121
|
+
if (length === 0)
|
|
122
|
+
return true;
|
|
123
|
+
var channels = __spreadArray([], (value || []), true);
|
|
124
|
+
var result = validationSalesChannels(channels);
|
|
125
|
+
if (result === true)
|
|
126
|
+
return true;
|
|
127
|
+
return this.createError({ message: result });
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
.required('choose_atleast_one_channel'),
|
|
131
|
+
segment: yup.object().required('alert_choose_segment'),
|
|
132
|
+
teamSize: yup.object().required('alert_choose_teamSize')
|
|
133
|
+
});
|
|
134
|
+
};
|
package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js
CHANGED
|
@@ -57,7 +57,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
57
57
|
var _h = user || {}, names = _h.names, identification = _h.identification;
|
|
58
58
|
var primary_contact = (business || {}).primary_contact;
|
|
59
59
|
var _j = entity || {}, license = _j.license, vat_id = _j.vat_id, legal_name = _j.legal_name;
|
|
60
|
-
var username = isAr ? concatenateObjectValues(names.ar || names.en, ['first', 'last']) : concatenateObjectValues(names.en, ['first', 'last']);
|
|
60
|
+
var username = isAr ? concatenateObjectValues((names === null || names === void 0 ? void 0 : names.ar) || (names === null || names === void 0 ? void 0 : names.en), ['first', 'last']) : concatenateObjectValues(names === null || names === void 0 ? void 0 : names.en, ['first', 'last']);
|
|
61
61
|
var licenseNumber = (license === null || license === void 0 ? void 0 : license.number) || '';
|
|
62
62
|
var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.name, 20) || t('bank');
|
|
63
63
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|