@tap-payments/auth-jsconnect 2.4.17-test → 2.4.19-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/assets/locales/ar.json +2 -1
- package/build/assets/locales/en.json +2 -1
- package/build/components/SimpleList/SimpleList.js +2 -2
- package/build/features/entity/screens/EntityCapital/ActivityList.js +35 -12
- package/build/features/shared/Button/FlowsButtons.js +15 -2
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +13 -4
- package/build/utils/array.d.ts +2 -1
- package/build/utils/array.js +9 -0
- package/package.json +1 -1
|
@@ -407,5 +407,6 @@
|
|
|
407
407
|
"call_center_label": "مركز الاتصال",
|
|
408
408
|
"mobile_app_label": "تطبيقات هاتف",
|
|
409
409
|
"physical_store_label": "متجر",
|
|
410
|
-
"social_media_label": "وسائل التواصل الاجتماعي"
|
|
410
|
+
"social_media_label": "وسائل التواصل الاجتماعي",
|
|
411
|
+
"selected_activities": "اختر الأنشطة"
|
|
411
412
|
}
|
|
@@ -437,5 +437,6 @@
|
|
|
437
437
|
"call_center_label": "Call Center",
|
|
438
438
|
"mobile_app_label": "Mobile App",
|
|
439
439
|
"physical_store_label": "Physical Store",
|
|
440
|
-
"social_media_label": "Social Media"
|
|
440
|
+
"social_media_label": "Social Media",
|
|
441
|
+
"selected_activities": "Selected Activities"
|
|
441
442
|
}
|
|
@@ -99,7 +99,7 @@ function SimpleList(_a) {
|
|
|
99
99
|
var onKeySearch = function (_a) {
|
|
100
100
|
var code = _a.code;
|
|
101
101
|
if (code) {
|
|
102
|
-
var filteredArr = filterItemsByKey(
|
|
102
|
+
var filteredArr = filterItemsByKey(list, code);
|
|
103
103
|
if (filteredArr.length === 0 || code === 'Backspace')
|
|
104
104
|
setItems(list);
|
|
105
105
|
else
|
|
@@ -110,7 +110,7 @@ function SimpleList(_a) {
|
|
|
110
110
|
useEventListener('keydown', onKeySearch);
|
|
111
111
|
var onSearch = function (value) {
|
|
112
112
|
if (value) {
|
|
113
|
-
var filteredArr =
|
|
113
|
+
var filteredArr = list.filter(function (item) {
|
|
114
114
|
var target = (searchValuePath === null || searchValuePath === void 0 ? void 0 : searchValuePath.map(function (path) { return get(item, path) || ''; })) || [];
|
|
115
115
|
return target.some(function (item) { return item === null || item === void 0 ? void 0 : item.toLowerCase().includes(value.toLowerCase()); });
|
|
116
116
|
});
|
|
@@ -30,7 +30,7 @@ import SimpleList from '../../../../components/SimpleList';
|
|
|
30
30
|
import Collapse from '../../../../components/Collapse';
|
|
31
31
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
32
32
|
import Text from '../../../../components/Text';
|
|
33
|
-
import { findCurrencyByIso2, isExist, groupSectionWithSelectedActivitiesAtBeginning, hasVerifiedValue } from '../../../../utils';
|
|
33
|
+
import { findCurrencyByIso2, isExist, groupSectionWithSelectedActivitiesAtBeginning, hasVerifiedValue, filterActivitiesByName } from '../../../../utils';
|
|
34
34
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
35
35
|
import Search from '../../../shared/Search';
|
|
36
36
|
import Input from '../../../shared/Input';
|
|
@@ -45,6 +45,16 @@ var InputStyled = styled(Input)(function (_a) {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
|
+
var SelectedInputStyled = styled(InputStyled, { shouldForwardProp: function (prop) { return prop !== 'anchorEl'; } })(function (_a) {
|
|
49
|
+
var anchorEl = _a.anchorEl;
|
|
50
|
+
return ({
|
|
51
|
+
'&.MuiInputBase-root': {
|
|
52
|
+
'&.MuiInput-root': __assign({ borderTop: 'none' }, (!anchorEl && {
|
|
53
|
+
borderBottom: 'none'
|
|
54
|
+
}))
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
48
58
|
export var NameContainer = styled(Text, { shouldForwardProp: function (prop) { return !['isSelected', 'isAr'].includes(prop.toString()); } })(function (_a) {
|
|
49
59
|
var theme = _a.theme, isSelected = _a.isSelected, isAr = _a.isAr;
|
|
50
60
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { textAlign: isAr ? 'right' : 'left', fontWeight: isSelected ? theme.typography.fontWeightRegular : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
@@ -83,17 +93,31 @@ var ActivityList = function (_a) {
|
|
|
83
93
|
var onListClose = _a.onListClose, onListOpen = _a.onListOpen, readOnly = _a.readOnly;
|
|
84
94
|
var _b = React.useState([]), activities = _b[0], setActivities = _b[1];
|
|
85
95
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
86
|
-
var _d = React.useState(
|
|
87
|
-
var _e = React.useState(''),
|
|
96
|
+
var _d = React.useState(null), activityAnchorEl = _d[0], setActivityAnchorEl = _d[1];
|
|
97
|
+
var _e = React.useState(''), subIndex = _e[0], setSubIndex = _e[1];
|
|
98
|
+
var _f = React.useState(''), subItemIndex = _f[0], setSubItemIndex = _f[1];
|
|
88
99
|
var t = useTranslation().t;
|
|
89
100
|
var isAr = useLanguage().isAr;
|
|
90
101
|
var control = useFormContext().control;
|
|
91
102
|
var activitiesControl = useController({ name: 'activities', control: control });
|
|
92
103
|
var data = useAppSelector(entitySelector).data;
|
|
93
104
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
94
|
-
var
|
|
105
|
+
var _g = data.verify.responseBody || {}, activityList = _g.activityList, entity = _g.entity;
|
|
95
106
|
var controlValue = activitiesControl.field.value;
|
|
96
107
|
var countryCode = settingsData.businessCountry;
|
|
108
|
+
var handleOpenActivityMenu = function (event) {
|
|
109
|
+
setActivityAnchorEl(event.currentTarget);
|
|
110
|
+
};
|
|
111
|
+
var handleCloseActivityMenu = function () {
|
|
112
|
+
var isSearchActive = !(activityList === null || activityList === void 0 ? void 0 : activityList.find(function (s) { var _a; return (_a = s.divisions) === null || _a === void 0 ? void 0 : _a.length; }));
|
|
113
|
+
if (isSearchActive) {
|
|
114
|
+
var list = groupSectionWithSelectedActivitiesAtBeginning(activityList, controlValue);
|
|
115
|
+
if ((list === null || list === void 0 ? void 0 : list.length) > 0) {
|
|
116
|
+
setActivities(list);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
setActivityAnchorEl(null);
|
|
120
|
+
};
|
|
97
121
|
var handleOpenMainMenu = function (event) {
|
|
98
122
|
if (readOnly)
|
|
99
123
|
return;
|
|
@@ -218,13 +242,7 @@ var ActivityList = function (_a) {
|
|
|
218
242
|
setActivities(activityList);
|
|
219
243
|
return;
|
|
220
244
|
}
|
|
221
|
-
var filteredList = (activityList
|
|
222
|
-
.flatMap(function (s) { return s.divisions; })
|
|
223
|
-
.flatMap(function (d) { return d.activities; })
|
|
224
|
-
.filter(function (a) {
|
|
225
|
-
var _a, _b, _c, _d;
|
|
226
|
-
return ((_b = (_a = a === null || a === void 0 ? void 0 : a.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(value.toLowerCase())) || ((_d = (_c = a === null || a === void 0 ? void 0 : a.name) === null || _c === void 0 ? void 0 : _c.ar) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes(value.toLowerCase()));
|
|
227
|
-
});
|
|
245
|
+
var filteredList = filterActivitiesByName(activityList, value);
|
|
228
246
|
setActivities(filteredList);
|
|
229
247
|
};
|
|
230
248
|
React.useEffect(function () {
|
|
@@ -234,7 +252,12 @@ var ActivityList = function (_a) {
|
|
|
234
252
|
}, [anchorEl, controlValue]);
|
|
235
253
|
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
|
|
236
254
|
currency: t(findCurrencyByIso2(countryCode.iso2))
|
|
237
|
-
}) }), _jsx(InputStyled, { readOnly: readOnly, value: getSelectedActivities() || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [
|
|
255
|
+
}) }), _jsx(InputStyled, { readOnly: readOnly, value: getSelectedActivities() || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsxs(Collapse, __assign({ in: !!(controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) }, { children: [_jsx(SelectedInputStyled, { readOnly: readOnly, anchorEl: activityAnchorEl, value: t('selected_activities'), onClick: !!activityAnchorEl ? handleCloseActivityMenu : handleOpenActivityMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!activityAnchorEl }) }), _jsx(Collapse, __assign({ in: !!activityAnchorEl }, { children: _jsx(ActivityListStyled, { sx: { pt: 0, pb: 0 }, list: controlValue || [], onSelectItem: function (activity, e) {
|
|
256
|
+
e.stopPropagation();
|
|
257
|
+
onSelectItem(activity);
|
|
258
|
+
}, listItemProps: { sx: { padding: 0, '&:last-child': { paddingBottom: 0 } } }, renderItem: function (activity, idx) {
|
|
259
|
+
return (_jsxs(ListItem, __assign({ sx: { mt: idx === 0 ? 1 : 0 } }, { children: [_jsx(NameContainer, __assign({ isAr: isAr, isSelected: activity.id === getSelectedActivityFlag(activity) }, { children: getSelectedActivityName(activity) })), activity.id === getSelectedActivityFlag(activity) && _jsx(CheckIcon, { isVerified: isActivityVerified(activity) })] })));
|
|
260
|
+
} }) }))] })), _jsx(Search, { onSearchValue: handleSearch, placeholder: 'search_activities_placeholder' }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: activities, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (section) {
|
|
238
261
|
var isDivisionNotAvailable = !section.divisions || section.divisions.length === 0;
|
|
239
262
|
if (isDivisionNotAvailable)
|
|
240
263
|
onSelectItem(section);
|
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
48
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
49
|
import { useState } from 'react';
|
|
50
50
|
import Button from '../../../components/Button';
|
|
51
51
|
import { alpha, styled } from '@mui/material/styles';
|
|
@@ -145,6 +145,19 @@ var BrandNameStyled = styled(Text)(function (_a) {
|
|
|
145
145
|
fontWeight: 800
|
|
146
146
|
});
|
|
147
147
|
});
|
|
148
|
+
var Dot = styled('span', {
|
|
149
|
+
shouldForwardProp: function (prop) { return prop !== 'completed'; }
|
|
150
|
+
})(function (_a) {
|
|
151
|
+
var theme = _a.theme, completed = _a.completed;
|
|
152
|
+
return ({
|
|
153
|
+
height: theme.spacing(1),
|
|
154
|
+
width: theme.spacing(1),
|
|
155
|
+
backgroundColor: completed ? theme.palette.primary.main : theme.palette.text.secondary,
|
|
156
|
+
borderRadius: '50%',
|
|
157
|
+
marginInlineStart: theme.spacing(1),
|
|
158
|
+
marginInlineEnd: theme.spacing(-0.5)
|
|
159
|
+
});
|
|
160
|
+
});
|
|
148
161
|
export default function FlowsButtons(_a) {
|
|
149
162
|
var _this = this;
|
|
150
163
|
var buttons = _a.buttons, data = _a.data;
|
|
@@ -222,6 +235,6 @@ export default function FlowsButtons(_a) {
|
|
|
222
235
|
onResetPassword();
|
|
223
236
|
else
|
|
224
237
|
onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
|
|
225
|
-
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)' }, src: ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
|
|
238
|
+
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [_jsx(Dot, { completed: status === 'completed' || status === 'complete' }), _jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)', marginInlineStart: 0 }, src: ICONS_NAMES.Arrow_filled_right_icon })] }))), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
|
|
226
239
|
}) }));
|
|
227
240
|
}
|
|
@@ -65,14 +65,23 @@ var SuccessFlowButtons = function (_a) {
|
|
|
65
65
|
var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
|
|
66
66
|
var email = (primary_contact || {}).email;
|
|
67
67
|
var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, boardId, boardInfoId);
|
|
68
|
+
var flowsDetails = [
|
|
69
|
+
{ name: 'brand', status: brand === null || brand === void 0 ? void 0 : brand.data_state },
|
|
70
|
+
{ name: 'entity', status: entity === null || entity === void 0 ? void 0 : entity.data_state },
|
|
71
|
+
{ name: 'bank', status: bank === null || bank === void 0 ? void 0 : bank.data_state },
|
|
72
|
+
{ name: 'tax', status: entity === null || entity === void 0 ? void 0 : entity.tax_data_state },
|
|
73
|
+
{ name: 'individuals', status: individuals === null || individuals === void 0 ? void 0 : individuals.data_state }
|
|
74
|
+
];
|
|
68
75
|
var reMapFlowData = function (flows) {
|
|
69
76
|
if (flows === void 0) { flows = []; }
|
|
70
77
|
var images = ICONS_NAMES;
|
|
71
78
|
var mappedFlows = flows
|
|
72
79
|
.filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
|
|
73
80
|
.map(function (_a) {
|
|
74
|
-
var
|
|
75
|
-
var
|
|
81
|
+
var _b;
|
|
82
|
+
var name = _a.name, url = _a.url, flowStatus = _a.status, token = _a.token;
|
|
83
|
+
var status = name === 'password' ? flowStatus : (_b = flowsDetails.find(function (flow) { return flow.name === name; })) === null || _b === void 0 ? void 0 : _b.status;
|
|
84
|
+
var type = status === 'complete' || status === 'completed' ? 'completed' : 'pending';
|
|
76
85
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
77
86
|
individual_name: (is_authorized && count > 1 ? t('company_individuals_details', { count: count }) : username.toLowerCase() + maskedId) || t('individual'),
|
|
78
87
|
brand: brandName,
|
|
@@ -82,7 +91,7 @@ var SuccessFlowButtons = function (_a) {
|
|
|
82
91
|
iban: iban ? t('masking_symbols') + iban : '',
|
|
83
92
|
tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
|
|
84
93
|
});
|
|
85
|
-
var isCompleted = status === '
|
|
94
|
+
var isCompleted = status === 'verified' && name !== 'password';
|
|
86
95
|
var isIndividual = name === 'individual';
|
|
87
96
|
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
88
97
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
@@ -101,7 +110,7 @@ var SuccessFlowButtons = function (_a) {
|
|
|
101
110
|
setButtons(mappedFlows);
|
|
102
111
|
};
|
|
103
112
|
var checkIfFlowsAreCompletedExceptPassword = function (data) {
|
|
104
|
-
var isFlowsCompleted = data.every(function (flow) { return flow.status === '
|
|
113
|
+
var isFlowsCompleted = data.every(function (flow) { return flow.status === 'complete' && flow.name !== 'password'; });
|
|
105
114
|
return isFlowsCompleted;
|
|
106
115
|
};
|
|
107
116
|
useEffect(function () {
|
package/build/utils/array.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActivitiesIsIc, Activity, CountryCode, SaleChannel } from '../@types';
|
|
1
|
+
import { ActivitiesIsIc, Activity, ActivityParams, CountryCode, SaleChannel } from '../@types';
|
|
2
2
|
export declare const isArray: (value: any) => value is any[];
|
|
3
3
|
export declare const joinArray: (items: Array<any>, joiner?: string) => string;
|
|
4
4
|
export declare const replaceStringArrayItems: (items: Array<string>, include: string, withThis: string) => string[];
|
|
@@ -66,3 +66,4 @@ export declare const getFileDetailsFromDocument: (documents: Array<any>, purpose
|
|
|
66
66
|
export declare const getRecentDocumentBasedOnPurpose: (documents: Array<any>, purpose: string) => any;
|
|
67
67
|
export declare const findInArrayOrSubArray: (items: Array<any>, value: string | number) => null;
|
|
68
68
|
export declare const groupSectionWithSelectedActivitiesAtBeginning: (sections: Array<ActivitiesIsIc>, selectedActivities: Array<Activity>) => ActivitiesIsIc[];
|
|
69
|
+
export declare const filterActivitiesByName: (activityList: Array<ActivitiesIsIc>, value: string) => ActivityParams[];
|
package/build/utils/array.js
CHANGED
|
@@ -251,3 +251,12 @@ export var groupSectionWithSelectedActivitiesAtBeginning = function (sections, s
|
|
|
251
251
|
var remainingSections = sections.filter(function (section) { return !filteredSections.includes(section); });
|
|
252
252
|
return __spreadArray(__spreadArray([], mapSelectedActivitiesBeginning, true), remainingSections, true);
|
|
253
253
|
};
|
|
254
|
+
export var filterActivitiesByName = function (activityList, value) {
|
|
255
|
+
return (activityList || [])
|
|
256
|
+
.flatMap(function (s) { return s.divisions || []; })
|
|
257
|
+
.flatMap(function (d) { return d.activities || []; })
|
|
258
|
+
.filter(function (a) {
|
|
259
|
+
var _a, _b, _c, _d;
|
|
260
|
+
return ((_b = (_a = a === null || a === void 0 ? void 0 : a.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(value.toLowerCase())) || ((_d = (_c = a === null || a === void 0 ? void 0 : a.name) === null || _c === void 0 ? void 0 : _c.ar) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes(value.toLowerCase()));
|
|
261
|
+
});
|
|
262
|
+
};
|