@tap-payments/auth-jsconnect 2.0.42 → 2.0.43
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/app/business/businessStore.d.ts +11 -2
- package/build/features/app/business/businessStore.js +156 -168
- package/build/features/app/entity/entityStore.js +4 -6
- package/build/features/app/individual/individualStore.js +0 -14
- package/build/features/bank/screens/BankDetails/IBAN.js +4 -1
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/business/screens/Activities/validation.js +4 -1
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/connect/screens/Merchant/Merchant.js +10 -4
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +2 -1
- package/build/features/connect/screens/Merchant/SalesChannels.js +4 -6
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +3 -1
- package/build/features/connect/screens/Merchant/SocialMedia.js +7 -33
- package/build/features/connect/screens/Merchant/validation.js +3 -5
- package/build/features/connect/screens/ThankYou/ThankYou.js +8 -2
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/shared/Button/Button.js +1 -0
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -1
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/utils/array.d.ts +1 -0
- package/build/utils/array.js +8 -0
- package/build/utils/date.d.ts +1 -0
- package/build/utils/date.js +5 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +14 -2
- package/package.json +129 -129
|
@@ -387,18 +387,11 @@ export var individualSlice = createSlice({
|
|
|
387
387
|
(sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
388
388
|
if (!!selectedSourceIncome)
|
|
389
389
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
390
|
-
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
|
|
391
|
-
(monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
392
|
-
if (!!selectedMonthlyIncome)
|
|
393
|
-
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
394
390
|
var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
|
|
395
391
|
if (!!code) {
|
|
396
392
|
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
397
393
|
state.data.individualData.employerLocation = employerLocation;
|
|
398
394
|
}
|
|
399
|
-
var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
|
|
400
|
-
if (!!selectedOccupation)
|
|
401
|
-
state.data.individualData.occupation = selectedOccupation;
|
|
402
395
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
403
396
|
state.data.individualData.isInfluencer = is_influencer;
|
|
404
397
|
})
|
|
@@ -447,18 +440,11 @@ export var individualSlice = createSlice({
|
|
|
447
440
|
(sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
448
441
|
if (!!selectedSourceIncome)
|
|
449
442
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
450
|
-
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
|
|
451
|
-
(monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
452
|
-
if (!!selectedMonthlyIncome)
|
|
453
|
-
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
454
443
|
var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
|
|
455
444
|
if (!!code) {
|
|
456
445
|
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
457
446
|
state.data.individualData.employerLocation = employerLocation;
|
|
458
447
|
}
|
|
459
|
-
var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
|
|
460
|
-
if (!!selectedOccupation)
|
|
461
|
-
state.data.individualData.occupation = selectedOccupation;
|
|
462
448
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
463
449
|
state.data.individualData.isInfluencer = is_influencer;
|
|
464
450
|
})
|
|
@@ -50,6 +50,8 @@ import axios from 'axios';
|
|
|
50
50
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
51
51
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
52
52
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
53
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
54
|
+
import { useAppSelector } from '../../../../hooks';
|
|
53
55
|
var InputStyled = styled(Input)(function () { return ({
|
|
54
56
|
input: {
|
|
55
57
|
textTransform: 'uppercase'
|
|
@@ -60,6 +62,7 @@ var IBAN = function (_a) {
|
|
|
60
62
|
var _b;
|
|
61
63
|
var fetchingIban = _a.fetchingIban, ibanChecking = _a.ibanChecking;
|
|
62
64
|
var dispatch = useAppDispatch();
|
|
65
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
63
66
|
var t = useTranslation().t;
|
|
64
67
|
var control = useFormContext().control;
|
|
65
68
|
var ibanControl = useController({ name: 'iban', control: control });
|
|
@@ -92,6 +95,6 @@ var IBAN = function (_a) {
|
|
|
92
95
|
var clearValue = function () {
|
|
93
96
|
ibanControl.field.onChange('');
|
|
94
97
|
};
|
|
95
|
-
return (_jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('
|
|
98
|
+
return (_jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('iban_input_placeholder', { countrycode: settingsData.businessCountry.iso2.toUpperCase() }), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
|
|
96
99
|
};
|
|
97
100
|
export default IBAN;
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
17
|
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { getResetFlowUrl, showLastFour, concatenateObjectValues } from '../../../../utils';
|
|
19
|
+
import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenBankName } from '../../../../utils';
|
|
20
20
|
import { bankSelector } from '../../../app/bank/bankStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
55
55
|
? concatenateObjectValues(ar || en, ['first', 'last'])
|
|
56
56
|
: concatenateObjectValues(en, ['first', 'last']);
|
|
57
57
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
58
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || t('bank');
|
|
58
|
+
var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.name) || t('bank');
|
|
59
59
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
60
60
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
|
|
61
61
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export var ActivitiesValidationSchema = yup.object().shape({
|
|
3
|
-
activities: yup
|
|
3
|
+
activities: yup
|
|
4
|
+
.array()
|
|
5
|
+
.min(1, 'activities_list_alert')
|
|
6
|
+
.of(yup.object().shape({
|
|
4
7
|
ar: yup.string(),
|
|
5
8
|
en: yup.string()
|
|
6
9
|
})),
|
|
@@ -17,7 +17,7 @@ import { FlowsButtons } from '../../../shared/Button';
|
|
|
17
17
|
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
19
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
20
|
-
import { concatenateObjectValues, getResetFlowUrl, showLastFour } from '../../../../utils';
|
|
20
|
+
import { concatenateObjectValues, getResetFlowUrl, shortenBankName, showLastFour } from '../../../../utils';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
23
23
|
import Container from '../../../shared/Containers/ScreenContainer';
|
|
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
55
55
|
? concatenateObjectValues(ar || en, ['first', 'last'])
|
|
56
56
|
: concatenateObjectValues(en, ['first', 'last']);
|
|
57
57
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
58
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
58
|
+
var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
59
59
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
60
60
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
|
|
61
61
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
@@ -23,7 +23,7 @@ import Button from '../../../shared/Button';
|
|
|
23
23
|
import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
|
|
24
24
|
import { useLanguage } from '../../../../hooks';
|
|
25
25
|
import { AuthForType } from '../../../../@types';
|
|
26
|
-
import { isKW, mapSalesChannel } from '../../../../utils';
|
|
26
|
+
import { findFirstId, isKW, mapSalesChannel } from '../../../../utils';
|
|
27
27
|
import { MerchantValidationSchema } from './validation';
|
|
28
28
|
import BrandName from './BrandName';
|
|
29
29
|
import SocialMedia from './SocialMedia';
|
|
@@ -35,11 +35,12 @@ var Merchant = function (_a) {
|
|
|
35
35
|
var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
|
|
36
36
|
var _e = React.useState(false), isBrandListOpen = _e[0], setIsBrandListOpen = _e[1];
|
|
37
37
|
var _f = React.useState(false), isRequiredNewBrand = _f[0], setIsRequiredNewBrand = _f[1];
|
|
38
|
-
var _g =
|
|
38
|
+
var _g = React.useState(''), activeIconId = _g[0], setActiveIconId = _g[1];
|
|
39
|
+
var _h = useAppSelector(connectSelector), data = _h.data, loading = _h.loading, error = _h.error;
|
|
39
40
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
40
41
|
var isNewIndividual = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.is_new_individual;
|
|
41
42
|
var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
42
|
-
var
|
|
43
|
+
var _j = data.brandData, brandName = _j.brandName, selectedBrandItem = _j.selectedBrandItem, termAndConditionChecked = _j.termAndConditionChecked, responseBody = _j.responseBody, salesChannels = _j.salesChannels;
|
|
43
44
|
var brandList = (responseBody || {}).brand_list;
|
|
44
45
|
var methods = useForm({
|
|
45
46
|
resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
|
|
@@ -76,16 +77,21 @@ var Merchant = function (_a) {
|
|
|
76
77
|
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
|
|
77
78
|
methods.setError('brandName', { message: 'brand_name_already_exist' });
|
|
78
79
|
}, [responseBody]);
|
|
80
|
+
var onSaleIconChange = function (id) {
|
|
81
|
+
setActiveIconId(id);
|
|
82
|
+
};
|
|
79
83
|
React.useEffect(function () {
|
|
80
84
|
if (selectedBrandItem.id) {
|
|
81
85
|
methods.setValue('selectedBrandItem', selectedBrandItem);
|
|
82
86
|
var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
|
|
87
|
+
setActiveIconId(findFirstId(sales));
|
|
83
88
|
methods.setValue('salesChannels', sales, { shouldValidate: true });
|
|
84
89
|
}
|
|
85
90
|
}, [selectedBrandItem]);
|
|
86
91
|
React.useEffect(function () {
|
|
87
92
|
if (salesChannels.length > 0) {
|
|
88
93
|
var sales = mapSalesChannel(salesChannels);
|
|
94
|
+
setActiveIconId(findFirstId(sales));
|
|
89
95
|
methods.setValue('salesChannels', sales, { shouldValidate: true });
|
|
90
96
|
}
|
|
91
97
|
}, [salesChannels]);
|
|
@@ -101,6 +107,6 @@ var Merchant = function (_a) {
|
|
|
101
107
|
React.useEffect(function () {
|
|
102
108
|
setIsRequiredNewBrand(isOtherBrand || isNewBrand);
|
|
103
109
|
}, [isOtherBrand, isNewBrand]);
|
|
104
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, {}) })), _jsx(SocialMedia, { show: !isBrandListOpen }), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen }), _jsx(Collapse, __assign({ in: !isBrandListOpen, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
110
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, { onSaleIconChange: onSaleIconChange }) })), _jsx(SocialMedia, { show: !isBrandListOpen, activeIconId: activeIconId, onSaleIconChange: onSaleIconChange }), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen }), _jsx(Collapse, __assign({ in: !isBrandListOpen, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
105
111
|
};
|
|
106
112
|
export default React.memo(Merchant);
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
3
3
|
export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
4
|
interface SalesChannelsProps {
|
|
5
|
+
onSaleIconChange: (id: string) => void;
|
|
5
6
|
}
|
|
6
|
-
declare const SalesChannels: ({}: SalesChannelsProps) => JSX.Element;
|
|
7
|
+
declare const SalesChannels: ({ onSaleIconChange }: SalesChannelsProps) => JSX.Element;
|
|
7
8
|
export default SalesChannels;
|
|
@@ -29,6 +29,7 @@ import { connectSelector, clearError } from '../../../app/connect/connectStore';
|
|
|
29
29
|
import CheckBox from '../../../../components/CheckBox';
|
|
30
30
|
import Warning from '../../../../components/Warning';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
32
|
+
import { findFirstId } from '../../../../utils';
|
|
32
33
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
33
34
|
var theme = _a.theme;
|
|
34
35
|
return (__assign({ margin: theme.spacing(2.5, 2.5, 0.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
@@ -74,6 +75,7 @@ export var CollapseStyled = styled(Collapse)(function (_a) {
|
|
|
74
75
|
});
|
|
75
76
|
var SalesChannels = function (_a) {
|
|
76
77
|
var _b;
|
|
78
|
+
var onSaleIconChange = _a.onSaleIconChange;
|
|
77
79
|
var t = useTranslation().t;
|
|
78
80
|
var isAr = useLanguage().isAr;
|
|
79
81
|
var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
|
|
@@ -90,16 +92,12 @@ var SalesChannels = function (_a) {
|
|
|
90
92
|
dispatch(clearError());
|
|
91
93
|
if (isChecked(channel.id)) {
|
|
92
94
|
var filterChannels = channelsControl.field.value.filter(function (item) { return item.id !== channel.id; });
|
|
95
|
+
onSaleIconChange(findFirstId([filterChannels.at(-1)]));
|
|
93
96
|
channelsControl.field.onChange(filterChannels);
|
|
94
97
|
}
|
|
95
98
|
else {
|
|
96
|
-
|
|
99
|
+
onSaleIconChange(findFirstId([channel]));
|
|
97
100
|
var newChannel = __assign({}, channel);
|
|
98
|
-
if (newChannel.code === 'website' && brandName) {
|
|
99
|
-
var brandValue = brandName.replaceAll(' ', '-').toLowerCase();
|
|
100
|
-
var address = (brandValue[brandValue.length - 1] === '-' ? brandValue.slice(0, -1) : brandValue) + '.com';
|
|
101
|
-
newChannel.address = 'www.' + address;
|
|
102
|
-
}
|
|
103
101
|
channelsControl.field.onChange(__spreadArray(__spreadArray([], channelsControl.field.value, true), [newChannel], false));
|
|
104
102
|
}
|
|
105
103
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface SocialMediaProps {
|
|
3
3
|
show: boolean;
|
|
4
|
+
activeIconId: string;
|
|
5
|
+
onSaleIconChange: (id: string) => void;
|
|
4
6
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: SocialMediaProps) => JSX.Element>;
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ show, activeIconId, onSaleIconChange }: SocialMediaProps) => JSX.Element>;
|
|
6
8
|
export default _default;
|
|
@@ -79,16 +79,12 @@ var SocialMediaButtonStyled = styled(ToggleButton, {
|
|
|
79
79
|
});
|
|
80
80
|
var SocialMedia = function (_a) {
|
|
81
81
|
var _b;
|
|
82
|
-
var show = _a.show;
|
|
83
|
-
var _c = React.useState(''), activeSocialId = _c[0], setActiveSocialId = _c[1];
|
|
82
|
+
var show = _a.show, activeIconId = _a.activeIconId, onSaleIconChange = _a.onSaleIconChange;
|
|
84
83
|
var t = useTranslation().t;
|
|
85
84
|
var isAr = useLanguage().isAr;
|
|
86
|
-
var
|
|
85
|
+
var _c = useFormContext(), setValue = _c.setValue, watch = _c.watch, getFieldState = _c.getFieldState;
|
|
87
86
|
var selectedChannels = watch('salesChannels');
|
|
88
87
|
var salesChannelsState = getFieldState('salesChannels');
|
|
89
|
-
var onChangeIcons = function (id) {
|
|
90
|
-
setActiveSocialId(id);
|
|
91
|
-
};
|
|
92
88
|
var onChangeInput = function (value, id) {
|
|
93
89
|
if (selectedChannels.length <= 0)
|
|
94
90
|
return;
|
|
@@ -123,28 +119,6 @@ var SocialMedia = function (_a) {
|
|
|
123
119
|
});
|
|
124
120
|
setValue('salesChannels', __spreadArray([], updatedChannels, true), { shouldValidate: true });
|
|
125
121
|
};
|
|
126
|
-
var setDefaultActiveSocialId = React.useCallback(function () {
|
|
127
|
-
var _a;
|
|
128
|
-
var idExist = selectedChannels.find(function (channel) {
|
|
129
|
-
var _a;
|
|
130
|
-
if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
131
|
-
return channel.sub.find(function (subChannel) { return subChannel.id === activeSocialId; });
|
|
132
|
-
}
|
|
133
|
-
return channel.id === activeSocialId;
|
|
134
|
-
});
|
|
135
|
-
if (selectedChannels.length >= 1 && !idExist) {
|
|
136
|
-
var firstChannel = selectedChannels[0];
|
|
137
|
-
if ((_a = firstChannel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
138
|
-
setActiveSocialId(firstChannel.sub[0].id);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
setActiveSocialId(firstChannel.id);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}, [selectedChannels]);
|
|
145
|
-
React.useEffect(function () {
|
|
146
|
-
setDefaultActiveSocialId();
|
|
147
|
-
}, [setDefaultActiveSocialId]);
|
|
148
122
|
var getPlaceHolder = function (item) {
|
|
149
123
|
var _a, _b;
|
|
150
124
|
if (isAr)
|
|
@@ -158,19 +132,19 @@ var SocialMedia = function (_a) {
|
|
|
158
132
|
}, [salesChannelsState]);
|
|
159
133
|
var linksErrorMsg = (_b = salesChannelsState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
160
134
|
return (_jsx(Box, { children: _jsx(Collapse, __assign({ in: show && selectedChannels.length > 0 }, { children: _jsxs(Box, __assign({ sx: { mb: 3, direction: 'ltr' } }, { children: [_jsx(SocialMediaGroupStyled, __assign({ exclusive: true, onChange: function (e, value) {
|
|
161
|
-
|
|
135
|
+
onSaleIconChange(value);
|
|
162
136
|
} }, { children: selectedChannels.map(function (channel, index) {
|
|
163
137
|
var _a;
|
|
164
|
-
var isActive =
|
|
138
|
+
var isActive = activeIconId === channel.id;
|
|
165
139
|
return ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) ? (channel.sub.map(function (sub, subIndex) {
|
|
166
|
-
var isSubActive =
|
|
140
|
+
var isSubActive = activeIconId === sub.id;
|
|
167
141
|
return (_jsx(SocialMediaButtonStyled, __assign({ isShow: true, isActive: isSubActive, value: sub.id }, { children: _jsx(ToggleIconStyled, { isActive: isSubActive, src: (sub === null || sub === void 0 ? void 0 : sub.logo) || '' }) }), "sub_".concat(subIndex)));
|
|
168
142
|
})) : (_jsx(SocialMediaButtonStyled, __assign({ isShow: true, isActive: isActive, value: channel.id || '' }, { children: _jsx(ToggleIconStyled, { isActive: isActive, src: (channel === null || channel === void 0 ? void 0 : channel.logo) || '' }) }), index));
|
|
169
143
|
}) })), selectedChannels.map(function (channel, index) {
|
|
170
144
|
var _a;
|
|
171
|
-
var isActive =
|
|
145
|
+
var isActive = activeIconId === channel.id;
|
|
172
146
|
return ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) ? (channel.sub.map(function (sub, subIndex) {
|
|
173
|
-
var isSubActive =
|
|
147
|
+
var isSubActive = activeIconId === sub.id;
|
|
174
148
|
return (_jsx(Collapse, __assign({ in: isSubActive, timeout: 300 }, { children: _jsx(InputStyled, { onChange: function (e) {
|
|
175
149
|
onChangeInput(e.target.value, sub.id);
|
|
176
150
|
}, value: sub.address || '', startAdornment: _jsx(TextStyled, __assign({ sx: __assign({}, (isTwitter(sub.code) && { fontSize: '20px' })) }, { children: isWebsite(sub.code) ? "https://" : isTwitter(sub.code) ? "@" : '' })), placeholder: t(getPlaceHolder(sub)) }) }), "sub_".concat(subIndex)));
|
|
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
import { REGEX_WEBSITE, REGEX_BRAND_NAME, LINKEDIN_URL, SOCIAL_USERNAME, DIGITS_ONLY,
|
|
10
|
+
import { REGEX_WEBSITE, REGEX_BRAND_NAME, LINKEDIN_URL, SOCIAL_USERNAME, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
|
|
11
11
|
import * as yup from 'yup';
|
|
12
12
|
var validationSalesChannels = function (channels) {
|
|
13
13
|
if (channels === void 0) { channels = []; }
|
|
@@ -37,8 +37,6 @@ var validationSalesChannels = function (channels) {
|
|
|
37
37
|
if (atLestOne)
|
|
38
38
|
return "enter_at_least_one_".concat(key);
|
|
39
39
|
}
|
|
40
|
-
console.log('dic', dic);
|
|
41
|
-
console.log('typeDic', typeDic);
|
|
42
40
|
for (var key in typeDic) {
|
|
43
41
|
var value = typeDic[key];
|
|
44
42
|
if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
|
|
@@ -59,10 +57,10 @@ var validationSalesChannels = function (channels) {
|
|
|
59
57
|
if (key === 'physical_store' && value && value.length < 3) {
|
|
60
58
|
return 'invalid_physical_store_location';
|
|
61
59
|
}
|
|
62
|
-
if (key === 'ios' && value && !value.match(
|
|
60
|
+
if (key === 'ios' && value && !value.match(REGEX_ALPHANUMERIC)) {
|
|
63
61
|
return 'invalid_ios_app';
|
|
64
62
|
}
|
|
65
|
-
if (key === 'android' && value && !value.match(
|
|
63
|
+
if (key === 'android' && value && !value.match(REGEX_ALPHANUMERIC)) {
|
|
66
64
|
return 'invalid_android_app';
|
|
67
65
|
}
|
|
68
66
|
if (key === 'call_center' && value && !value.match(DIGITS_ONLY)) {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
4
4
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
5
|
+
import { connectSelector } from '../../../../features/app/connect/connectStore';
|
|
6
|
+
import { useAppSelector } from '../../../../hooks';
|
|
7
|
+
import { maskEmail } from '../../../../utils';
|
|
5
8
|
var ThankYou = function (_a) {
|
|
9
|
+
var _b, _c;
|
|
6
10
|
var t = useTranslation().t;
|
|
7
|
-
|
|
11
|
+
var data = useAppSelector(connectSelector).data;
|
|
12
|
+
var email = maskEmail((_c = (_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.email);
|
|
13
|
+
return (_jsx(SuccessScreen, { title: t("connect_completed_title"), description: _jsx(Trans, { i18nKey: 'connect_completed_description', values: { email: email } }), showEmailProviders: true }));
|
|
8
14
|
};
|
|
9
15
|
export default React.memo(ThankYou);
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
17
|
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { getResetFlowUrl, showLastFour } from '../../../../utils';
|
|
19
|
+
import { getResetFlowUrl, shortenBankName, showLastFour } from '../../../../utils';
|
|
20
20
|
import { entitySelector } from '../../../app/entity/entityStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -52,7 +52,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
52
52
|
var _f = useState([]), buttons = _f[0], setButtons = _f[1];
|
|
53
53
|
var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
|
|
54
54
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
55
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
55
|
+
var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
56
56
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
57
57
|
var taxID = vatID || '';
|
|
58
58
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
17
|
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { concatenateObjectValues, getResetFlowUrl, showLastFour } from '../../../../utils';
|
|
19
|
+
import { concatenateObjectValues, getResetFlowUrl, shortenBankName, showLastFour } from '../../../../utils';
|
|
20
20
|
import { individualSelector } from '../../../app/individual/individualStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
55
55
|
? concatenateObjectValues(ar || en, ['first', 'last'])
|
|
56
56
|
: concatenateObjectValues(en, ['first', 'last']);
|
|
57
57
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
58
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
58
|
+
var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
59
59
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
60
60
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
|
|
61
61
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
17
|
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { getResetFlowUrl, showLastFour, concatenateObjectValues } from '../../../../utils';
|
|
19
|
+
import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenBankName } from '../../../../utils';
|
|
20
20
|
import { passwordSelector } from '../../../app/password/passwordStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
55
55
|
? concatenateObjectValues(ar || en, ['first', 'last'])
|
|
56
56
|
: concatenateObjectValues(en, ['first', 'last']);
|
|
57
57
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
58
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
58
|
+
var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
59
59
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
60
60
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
|
|
61
61
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
@@ -6,7 +6,7 @@ export interface ThankYouProps {
|
|
|
6
6
|
successTitle?: string;
|
|
7
7
|
loading?: boolean;
|
|
8
8
|
error?: string;
|
|
9
|
-
description?: string;
|
|
9
|
+
description?: string | React.ReactElement;
|
|
10
10
|
}
|
|
11
11
|
declare const _default: React.MemoExoticComponent<({ title, description, showEmailProviders, onSuccess, successTitle, loading, error }: ThankYouProps) => JSX.Element>;
|
|
12
12
|
export default _default;
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
17
|
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { getResetFlowUrl, showLastFour, concatenateObjectValues } from '../../../../utils';
|
|
19
|
+
import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenBankName } from '../../../../utils';
|
|
20
20
|
import { taxSelector } from '../../../app/tax/taxStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -55,7 +55,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
55
55
|
? concatenateObjectValues(ar || en, ['first', 'last'])
|
|
56
56
|
: concatenateObjectValues(en, ['first', 'last']);
|
|
57
57
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
58
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
58
|
+
var bankName = shortenBankName(bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
59
59
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
60
60
|
var taxID = vatID || '';
|
|
61
61
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
package/build/utils/array.d.ts
CHANGED
package/build/utils/array.js
CHANGED
|
@@ -121,3 +121,11 @@ export var fixBrandList = function (items, salesChannel) {
|
|
|
121
121
|
return __assign(__assign({}, item), { channel_services: removeDuplicationById(mapBrandSalesChannel(salesChannel, item.channel_services || [])) });
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
|
+
export var findFirstId = function (items) {
|
|
125
|
+
var first = items[0];
|
|
126
|
+
if (!first)
|
|
127
|
+
return '';
|
|
128
|
+
if (first.sub && first.sub.length > 0)
|
|
129
|
+
return first.sub[0].id;
|
|
130
|
+
return first.id;
|
|
131
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dateFormat: (date: Date, fmt?: string) => string;
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED
package/build/utils/string.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DeviceInfo } from '../@types';
|
|
2
2
|
export declare const maskPhone: (str?: string) => string;
|
|
3
|
+
export declare const shortenBankName: (str: string) => string;
|
|
3
4
|
export declare const maskID: (str: string) => string;
|
|
4
5
|
export declare const maskEmail: (str: string) => string;
|
|
5
6
|
export declare const showLastFour: (str: string) => string;
|
package/build/utils/string.js
CHANGED
|
@@ -8,13 +8,25 @@ export var maskPhone = function (str) {
|
|
|
8
8
|
var lastTwo = str.substring(str.length - 2, str.length);
|
|
9
9
|
return ' ••••' + lastTwo;
|
|
10
10
|
};
|
|
11
|
+
export var shortenBankName = function (str) {
|
|
12
|
+
if (str)
|
|
13
|
+
return str.slice(0, 20);
|
|
14
|
+
return '';
|
|
15
|
+
};
|
|
11
16
|
export var maskID = function (str) {
|
|
12
17
|
var lastTwo = str.substring(str.length - 2, str.length);
|
|
13
18
|
return ' ••••' + lastTwo;
|
|
14
19
|
};
|
|
15
20
|
export var maskEmail = function (str) {
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
if (str) {
|
|
22
|
+
var name_1 = str.split('@')[0];
|
|
23
|
+
var maskedName = name_1[0] + '*' + name_1[name_1.length - 1];
|
|
24
|
+
var domain = str.split('@')[1].split('.')[0];
|
|
25
|
+
var maskedDomain = '@' + domain[0] + '*' + domain[domain.length - 1];
|
|
26
|
+
var TLD = '.' + str.split('@')[1].split('.')[1];
|
|
27
|
+
return maskedName + maskedDomain + TLD;
|
|
28
|
+
}
|
|
29
|
+
return '';
|
|
18
30
|
};
|
|
19
31
|
export var showLastFour = function (str) {
|
|
20
32
|
if (str && str.length >= 4) {
|