@tap-payments/auth-jsconnect 1.0.30 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +17 -1
- package/build/@types/form.d.ts +16 -1
- package/build/api/axios.d.ts +2 -0
- package/build/api/axios.js +10 -0
- package/build/api/entity.d.ts +20 -0
- package/build/api/entity.js +9 -0
- package/build/api/firebase.d.ts +4 -0
- package/build/api/firebase.js +9 -0
- package/build/api/index.d.ts +16 -2
- package/build/api/index.js +7 -1
- package/build/api/lead.d.ts +22 -0
- package/build/api/lead.js +21 -1
- package/build/app/settings.d.ts +1 -0
- package/build/app/settings.js +44 -18
- package/build/assets/locales/ar.json +1 -1
- package/build/components/Input/Input.d.ts +1 -1
- package/build/components/Input/Input.js +3 -2
- package/build/components/Slide/Slide.d.ts +1 -1
- package/build/components/Warning/Warning.d.ts +1 -1
- package/build/components/Warning/Warning.js +13 -2
- package/build/constants/api.d.ts +5 -0
- package/build/constants/api.js +11 -1
- package/build/constants/app.d.ts +7 -1
- package/build/constants/app.js +7 -1
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +2 -1
- package/build/constants/dummy.js +3 -3
- package/build/constants/validation.d.ts +2 -0
- package/build/constants/validation.js +2 -0
- package/build/features/app/business/businessStore.d.ts +54 -4
- package/build/features/app/business/businessStore.js +325 -5
- package/build/features/app/connect/connectStore.d.ts +3 -1
- package/build/features/app/connect/connectStore.js +72 -43
- package/build/features/bank/screens/BankDetails/validation.js +2 -1
- package/build/features/business/Business.js +7 -3
- package/build/features/business/screens/Activities/Activities.js +3 -3
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +2 -2
- package/build/features/business/screens/Activities/OperationStartDate.js +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.d.ts +1 -8
- package/build/features/business/screens/BusinessType/BusinessType.js +25 -27
- package/build/features/business/screens/Confirm/Confirm.js +8 -9
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -3
- package/build/features/business/screens/IDBOD/DOB.js +1 -1
- package/build/features/business/screens/IDBOD/IDBOD.js +19 -12
- package/build/features/business/screens/OTP/OTP.d.ts +2 -5
- package/build/features/business/screens/OTP/OTP.js +18 -15
- package/build/features/business/screens/OTP/OTPInput.js +20 -5
- package/build/features/business/screens/Verify/OTPInput.js +7 -3
- package/build/features/business/screens/Verify/Verify.d.ts +1 -9
- package/build/features/business/screens/Verify/Verify.js +15 -17
- package/build/features/business/screens/Verify/index.d.ts +1 -2
- package/build/features/connect/screens/Individual/MobileNumber.js +23 -11
- package/build/features/connect/screens/Individual/Name.js +10 -1
- package/build/features/connect/screens/Individual/validation.js +3 -2
- package/build/features/connect/screens/Mobile/Mobile.js +2 -3
- package/build/features/connect/screens/Mobile/MobileNumber.js +22 -28
- package/build/features/connect/screens/NID/NID.js +1 -2
- package/build/features/connect/screens/OTP/OTPInput.js +3 -0
- package/build/features/connect/screens/Password/Password.js +2 -2
- package/build/features/featuresScreens.js +3 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -4
- package/build/features/shared/Button/AbsherButton.js +1 -1
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +12 -2
- package/build/hooks/useAppConfig.js +100 -24
- package/build/theme/palette.js +4 -0
- package/build/utils/locale.d.ts +2 -0
- package/build/utils/locale.js +21 -0
- package/build/utils/string.d.ts +26 -1
- package/build/utils/string.js +62 -1
- package/package.json +1 -1
|
@@ -74,6 +74,7 @@ var ListType;
|
|
|
74
74
|
ListType["CountryCodeList"] = "CountryCodeList";
|
|
75
75
|
})(ListType || (ListType = {}));
|
|
76
76
|
var Mobile = function (_a) {
|
|
77
|
+
var settingsStore = useSelector(settingsSelector);
|
|
77
78
|
var _b = useSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
78
79
|
var _c = React.useState(data.mobileData.countryCode.digits), mobileLength = _c[0], setMobileLength = _c[1];
|
|
79
80
|
var _d = React.useState(), listType = _d[0], setListType = _d[1];
|
|
@@ -85,7 +86,6 @@ var Mobile = function (_a) {
|
|
|
85
86
|
});
|
|
86
87
|
var t = useTranslation().t;
|
|
87
88
|
var isAr = useLanguage().isAr;
|
|
88
|
-
var settingsStore = useSelector(settingsSelector);
|
|
89
89
|
var handleMenuListClick = function (flag) {
|
|
90
90
|
setListType(flag);
|
|
91
91
|
};
|
|
@@ -110,8 +110,7 @@ var Mobile = function (_a) {
|
|
|
110
110
|
var isBusinessListActive = listType === ListType.BusinessList;
|
|
111
111
|
var isCountryListActive = listType === ListType.CountryCodeList;
|
|
112
112
|
var listActive = isBusinessListActive || isCountryListActive;
|
|
113
|
-
var isLoading = settingsStore.loading || loading;
|
|
114
113
|
var disabled = !methods.formState.isValid || !!error;
|
|
115
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(BusinessCountry, { country: data.businessCountry, show: !isCountryListActive }), _jsx(MobileNumber, { show: !isBusinessListActive, setMobileLength: setMobileLength, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } })] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading:
|
|
114
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(BusinessCountry, { country: data.businessCountry, show: !isCountryListActive }), _jsx(MobileNumber, { show: !isBusinessListActive, setMobileLength: setMobileLength, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } })] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, isAr: isAr }, { children: t('absher_button_label') }))] }))] })) }))] }));
|
|
116
115
|
};
|
|
117
116
|
export default React.memo(Mobile);
|
|
@@ -36,6 +36,7 @@ import Input from '../../../shared/Input';
|
|
|
36
36
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
37
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
38
38
|
import { useLanguage } from '../../../../hooks';
|
|
39
|
+
import { SAUDI_NUMBER_LENGTH } from '../../../../constants';
|
|
39
40
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
40
41
|
var theme = _a.theme;
|
|
41
42
|
return ({
|
|
@@ -74,38 +75,35 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
|
|
|
74
75
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
75
76
|
var _b, _c, _d;
|
|
76
77
|
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
77
|
-
var
|
|
78
|
-
var
|
|
78
|
+
var countriesCode = React.useState(countries || [])[0];
|
|
79
|
+
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
79
80
|
var t = useTranslation().t;
|
|
80
81
|
var isAr = useLanguage().isAr;
|
|
81
|
-
var
|
|
82
|
+
var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
|
|
82
83
|
var phoneControl = useController({ name: 'mobile', control: control });
|
|
83
84
|
var countryCodeControl = useController({ name: 'countryCode', control: control });
|
|
84
|
-
var
|
|
85
|
+
var countryCodeValue = countryCodeControl.field.value;
|
|
86
|
+
var mobileValue = phoneControl.field.value || '';
|
|
87
|
+
var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
|
|
88
|
+
var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
89
|
+
var isSA = countryCodeValue.iso2 === 'SA';
|
|
90
|
+
var isStartingWithZero = mobileValue.startsWith('0');
|
|
91
|
+
var mobileLen = isSA
|
|
92
|
+
? isStartingWithZero
|
|
93
|
+
? countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits
|
|
94
|
+
: SAUDI_NUMBER_LENGTH
|
|
95
|
+
: countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
85
96
|
React.useEffect(function () {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
setValue('mobile', phoneControl.field.value, { shouldValidate: true });
|
|
89
|
-
}
|
|
90
|
-
if (countryCodeControl.field.value) {
|
|
91
|
-
var country = countryCodeControl.field.value;
|
|
92
|
-
setValue('countryCode', country, { shouldValidate: true });
|
|
93
|
-
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, (country === null || country === void 0 ? void 0 : country.digits) || 10);
|
|
97
|
+
if (mobileValue) {
|
|
98
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
94
99
|
}
|
|
95
100
|
}, []);
|
|
96
101
|
React.useEffect(function () {
|
|
97
102
|
var _a;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
setValue('countryCode', businessCountry);
|
|
101
|
-
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.digits) || 10);
|
|
103
|
+
if (mobileValue.length === 1 && isSA) {
|
|
104
|
+
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, mobileLen);
|
|
102
105
|
}
|
|
103
|
-
}, [
|
|
104
|
-
React.useEffect(function () {
|
|
105
|
-
if (countriesCode.length === 0) {
|
|
106
|
-
setCountriesCode(countries);
|
|
107
|
-
}
|
|
108
|
-
}, [countries]);
|
|
106
|
+
}, [mobileValue]);
|
|
109
107
|
var onPhoneNumberChange = function (_a) {
|
|
110
108
|
var target = _a.target;
|
|
111
109
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -128,14 +126,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
128
126
|
var _a;
|
|
129
127
|
onCloseCountryList();
|
|
130
128
|
setValue('mobile', '');
|
|
131
|
-
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, (country === null || country === void 0 ? void 0 : country.digits) || 10);
|
|
132
129
|
countryCodeControl.field.onChange(country);
|
|
130
|
+
(_a = rest.setMobileLength) === null || _a === void 0 ? void 0 : _a.call(rest, country.digits);
|
|
133
131
|
};
|
|
134
|
-
|
|
135
|
-
var mobileValue = phoneControl.field.value || '';
|
|
136
|
-
var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
|
|
137
|
-
var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
|
|
138
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits) || 10 }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat((countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA' ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
132
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: mobileLen }, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: mobileLen }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
139
133
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
140
134
|
} }) }))] })) })));
|
|
141
135
|
});
|
|
@@ -87,7 +87,6 @@ var NID = function (_a) {
|
|
|
87
87
|
dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
|
|
88
88
|
};
|
|
89
89
|
var disabled = !methods.formState.isValid || !!error;
|
|
90
|
-
|
|
91
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BusinessCountry, { show: !collapse, country: data.businessCountry }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: isLoading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ onClick: function () { return onBack(); }, disabled: loading, hideIcon: true, isAr: isAr }, { children: t('mobile_button_label') }))] }))] })) })) }));
|
|
90
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BusinessCountry, { show: !collapse, country: data.businessCountry }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading, hideIcon: true, isAr: isAr }, { children: t('mobile_button_label') }))] }))] })) })) }));
|
|
92
91
|
};
|
|
93
92
|
export default React.memo(NID);
|
|
@@ -37,6 +37,9 @@ var OTPInput = function (_a) {
|
|
|
37
37
|
var mobileData = data.mobileData;
|
|
38
38
|
var nidData = data.nidData;
|
|
39
39
|
var isAbsher = data.otpData.isAbsher;
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
otpControl.field.onChange('');
|
|
42
|
+
}, []);
|
|
40
43
|
var handleOnOTPChange = function (otp) {
|
|
41
44
|
otpControl.field.onChange(otp);
|
|
42
45
|
};
|
|
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
18
18
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
19
|
import { styled } from '@mui/material/styles';
|
|
20
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectSelector,
|
|
21
|
+
import { clearError, connectSelector, createVerifyAuthPassword } from '../../../app/connect/connectStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -47,7 +47,7 @@ var Password = function (_a) {
|
|
|
47
47
|
dispatch(clearError());
|
|
48
48
|
}, [methods.formState.isValid]);
|
|
49
49
|
var onSubmit = function (formData) {
|
|
50
|
-
dispatch(
|
|
50
|
+
dispatch(createVerifyAuthPassword(formData));
|
|
51
51
|
};
|
|
52
52
|
var onBack = function () {
|
|
53
53
|
dispatch(handlePrevScreenStep(isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import MobileScreen from '
|
|
1
|
+
import MobileScreen from './connect/screens/Mobile';
|
|
2
2
|
import NIDScreen from './connect/screens/NID';
|
|
3
3
|
import IndividualScreen from './connect/screens/Individual';
|
|
4
4
|
import MerchantInfoScreen from './connect/screens/Merchant';
|
|
@@ -7,8 +7,8 @@ import ThankYouScreen from './connect/screens/ThankYou';
|
|
|
7
7
|
import PasswordScreen from './connect/screens/Password';
|
|
8
8
|
import CustomersPage from './business/screens/Customers';
|
|
9
9
|
import IDBODPage from './business/screens/IDBOD';
|
|
10
|
-
import BusinessVerifyPage from '
|
|
11
|
-
import BusinessOTPPage from '
|
|
10
|
+
import BusinessVerifyPage from './business/screens/Verify';
|
|
11
|
+
import BusinessOTPPage from './business/screens/OTP';
|
|
12
12
|
import BusinessTypePage from './business/screens/BusinessType';
|
|
13
13
|
import ActivitiesPage from './business/screens/Activities';
|
|
14
14
|
import SuccessPage from './business/screens/Success';
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
+
import { REGEX_FULL_NAME } from '../../../../constants';
|
|
2
3
|
export var IndividualInfoValidationSchema = yup.object().shape({
|
|
3
4
|
sourceIncome: yup.object().required('choose_any_source_of_income'),
|
|
4
5
|
monthlyIncome: yup.string().optional(),
|
|
5
6
|
employerName: yup.string().when('sourceIncome', function (sourceIncomeValue) {
|
|
6
7
|
var _a;
|
|
7
8
|
if (((_a = sourceIncomeValue === null || sourceIncomeValue === void 0 ? void 0 : sourceIncomeValue.nameEn) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary') {
|
|
8
|
-
return yup
|
|
9
|
-
.string()
|
|
10
|
-
.matches(/^([a-zA-Z0-9]+\s{1}[a-zA-Z0-9]{2,}|[a-zA-Z0-9]+\s{1}[a-zA-Z0-9]{1,}\s{1}[a-zA-Z0-9]{2,})$/g, 'employer_name_invalid')
|
|
11
|
-
.required('please_enter_employer_name');
|
|
9
|
+
return yup.string().matches(REGEX_FULL_NAME, 'employer_name_invalid').required('please_enter_employer_name');
|
|
12
10
|
}
|
|
13
11
|
else {
|
|
14
12
|
return yup.string().optional();
|
|
@@ -31,7 +31,7 @@ var IconStyled = styled(Icon)(function (_a) {
|
|
|
31
31
|
return ({
|
|
32
32
|
width: theme.spacing(3),
|
|
33
33
|
height: theme.spacing(3),
|
|
34
|
-
marginInlineStart: theme.spacing(
|
|
34
|
+
marginInlineStart: theme.spacing(0.75)
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
@@ -16,7 +16,7 @@ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent
|
|
|
16
16
|
export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick<InputProps, "name" | "type" | "className" | "style" | "classes" | "color" | "margin" | "translate" | "slot" | "title" | "ref" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "size" | "disabled" | "error" | "components" | "componentsProps" | "value" | "autoFocus" | "fullWidth" | "required" | "rows" | "inputProps" | "inputRef" | "readOnly" | "autoComplete" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "multiline" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment" | "disableUnderline" | "onEnterPressed" | "warningMessage"> & {
|
|
17
17
|
placeholder?: string | undefined;
|
|
18
18
|
hide?: boolean | undefined;
|
|
19
|
-
warningType?: "alert" | "error" | undefined;
|
|
19
|
+
warningType?: "alert" | "error" | "hint" | undefined;
|
|
20
20
|
} & {} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
21
21
|
interface CustomButtonProps extends InputProps {
|
|
22
22
|
label?: string;
|
|
@@ -18,6 +18,8 @@ import { useLanguage } from '../../../hooks';
|
|
|
18
18
|
import Text from '../../../components/Text';
|
|
19
19
|
import Container from '../Containers/ScreenContainer';
|
|
20
20
|
import { AbsherButton } from '../../shared/Button';
|
|
21
|
+
import Icon from '../../../components/Icon';
|
|
22
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
21
23
|
var MailBoxStyled = styled(Box)(function () { return ({
|
|
22
24
|
width: '100%'
|
|
23
25
|
}); });
|
|
@@ -32,7 +34,7 @@ var TextContainerStyled = styled(Box)(function (_a) {
|
|
|
32
34
|
borderRadius: theme.spacing(0, 0, 1.25, 1.25)
|
|
33
35
|
},
|
|
34
36
|
_b[theme.breakpoints.up('sm')] = {
|
|
35
|
-
marginBottom: theme.spacing(
|
|
37
|
+
marginBottom: theme.spacing(7.5)
|
|
36
38
|
},
|
|
37
39
|
_b);
|
|
38
40
|
});
|
|
@@ -48,10 +50,18 @@ var ContainerStyled = styled(Container)(function (_a) {
|
|
|
48
50
|
alignItems: 'center'
|
|
49
51
|
});
|
|
50
52
|
});
|
|
53
|
+
var IconStyled = styled(Icon)(function (_a) {
|
|
54
|
+
var theme = _a.theme;
|
|
55
|
+
return ({
|
|
56
|
+
width: theme.spacing(10),
|
|
57
|
+
height: theme.spacing(10),
|
|
58
|
+
marginBlockEnd: theme.spacing(7.5)
|
|
59
|
+
});
|
|
60
|
+
});
|
|
51
61
|
var ThankYou = function (_a) {
|
|
52
62
|
var onSuccess = _a.onSuccess, title = _a.title;
|
|
53
63
|
var t = useTranslation().t;
|
|
54
64
|
var isAr = useLanguage().isAr;
|
|
55
|
-
return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t('open_mail_box') })) })] }));
|
|
65
|
+
return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), _jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t('open_mail_box') })) })] }));
|
|
56
66
|
};
|
|
57
67
|
export default React.memo(ThankYou);
|
|
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
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
|
+
};
|
|
12
48
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
49
|
var t = {};
|
|
14
50
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -20,42 +56,82 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
56
|
}
|
|
21
57
|
return t;
|
|
22
58
|
};
|
|
23
|
-
import { useEffect } from 'react';
|
|
24
|
-
import { handleActiveFlowScreens, settingsSelector, getClientIp, getBrowserFingerPrint, getOperator, handleSetAppConfig, handleLanguage } from '../app/settings';
|
|
59
|
+
import { useEffect, useState } from 'react';
|
|
60
|
+
import { handleActiveFlowScreens, settingsSelector, getClientIp, getLocale, getBrowserFingerPrint, getOperator, handleSetAppConfig, handleLanguage } from '../app/settings';
|
|
25
61
|
import { useAppDispatch } from './useAppDispatch';
|
|
26
62
|
import { useAppSelector } from './useAppSelector';
|
|
63
|
+
import { setAxiosGlobalHeaders } from '../api';
|
|
64
|
+
import { getRequestHeaders, encryptString } from '../utils';
|
|
27
65
|
export var useAppConfig = function (_a) {
|
|
28
66
|
var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, rest = __rest(_a, ["appInfo", "navigation", "publicKey"]);
|
|
67
|
+
var _b = useState(true), loading = _b[0], setLoading = _b[1];
|
|
29
68
|
var dispatch = useAppDispatch();
|
|
30
|
-
var
|
|
31
|
-
var deviceInfo = data.deviceInfo, language = data.language;
|
|
32
|
-
var device = deviceInfo.device, browser = deviceInfo.browser;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
dispatch(getClientIp());
|
|
36
|
-
dispatch(getBrowserFingerPrint(appInfo));
|
|
37
|
-
dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey }, rest)));
|
|
38
|
-
}, []);
|
|
39
|
-
var handleGetOperator = function () {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
var payload = {
|
|
42
|
-
type: 'website',
|
|
43
|
-
app_client_version: 'onboarding_version_2',
|
|
44
|
-
requirer_browser: "".concat(browser === null || browser === void 0 ? void 0 : browser.name, " , ").concat(browser === null || browser === void 0 ? void 0 : browser.version),
|
|
45
|
-
os: "".concat((_a = device.os) === null || _a === void 0 ? void 0 : _a.name, " , ").concat((_b = device.os) === null || _b === void 0 ? void 0 : _b.version),
|
|
46
|
-
locale: language,
|
|
47
|
-
connect_pkey: publicKey || ''
|
|
48
|
-
};
|
|
49
|
-
dispatch(getOperator(payload));
|
|
69
|
+
var _c = useAppSelector(settingsSelector), data = _c.data, error = _c.error;
|
|
70
|
+
var deviceInfo = data.deviceInfo, language = data.language, appConfig = data.appConfig;
|
|
71
|
+
var device = deviceInfo.device, browser = deviceInfo.browser, connection = deviceInfo.connection;
|
|
72
|
+
var addAxiosHeader = function () {
|
|
73
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getRequestHeaders(deviceInfo)), { authorization: encryptString(publicKey), mdn: encryptString(window.location.origin) }));
|
|
50
74
|
};
|
|
75
|
+
var handleAppConfig = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey }, rest)));
|
|
78
|
+
dispatch(handleActiveFlowScreens(navigation));
|
|
79
|
+
return [2];
|
|
80
|
+
});
|
|
81
|
+
}); };
|
|
82
|
+
var handleAppApiConfig = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
switch (_a.label) {
|
|
85
|
+
case 0: return [4, dispatch(getLocale())];
|
|
86
|
+
case 1:
|
|
87
|
+
_a.sent();
|
|
88
|
+
return [4, dispatch(getClientIp())];
|
|
89
|
+
case 2:
|
|
90
|
+
_a.sent();
|
|
91
|
+
return [4, dispatch(getBrowserFingerPrint(appInfo))];
|
|
92
|
+
case 3:
|
|
93
|
+
_a.sent();
|
|
94
|
+
return [2];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}); };
|
|
98
|
+
var handleGetOperator = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
+
var payload;
|
|
100
|
+
var _a, _b;
|
|
101
|
+
return __generator(this, function (_c) {
|
|
102
|
+
switch (_c.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
payload = {
|
|
105
|
+
type: 'website',
|
|
106
|
+
app_client_version: 'js-auth-connect',
|
|
107
|
+
requirer_browser: "".concat(browser === null || browser === void 0 ? void 0 : browser.name, " , ").concat(browser === null || browser === void 0 ? void 0 : browser.version),
|
|
108
|
+
os: "".concat((_a = device.os) === null || _a === void 0 ? void 0 : _a.name, " , ").concat((_b = device.os) === null || _b === void 0 ? void 0 : _b.version),
|
|
109
|
+
locale: language
|
|
110
|
+
};
|
|
111
|
+
return [4, dispatch(getOperator(payload))];
|
|
112
|
+
case 1:
|
|
113
|
+
_c.sent();
|
|
114
|
+
setLoading(false);
|
|
115
|
+
return [2];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
51
119
|
useEffect(function () {
|
|
52
120
|
if (data.appConfig.language)
|
|
53
121
|
dispatch(handleLanguage(data.appConfig.language));
|
|
54
122
|
}, [data.appConfig.language]);
|
|
55
123
|
useEffect(function () {
|
|
56
|
-
|
|
124
|
+
handleAppConfig();
|
|
125
|
+
}, []);
|
|
126
|
+
useEffect(function () {
|
|
127
|
+
if (appConfig.publicKey)
|
|
128
|
+
handleAppApiConfig();
|
|
129
|
+
}, [appConfig]);
|
|
130
|
+
useEffect(function () {
|
|
131
|
+
if (connection.ip && browser.browser_id) {
|
|
132
|
+
addAxiosHeader();
|
|
57
133
|
handleGetOperator();
|
|
58
134
|
}
|
|
59
|
-
}, [
|
|
135
|
+
}, [connection, browser]);
|
|
60
136
|
return { loading: loading, error: error };
|
|
61
137
|
};
|
package/build/theme/palette.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { initReactI18next } from 'react-i18next';
|
|
2
|
+
import i18n from '../i18n';
|
|
3
|
+
export var updateLocale = function (locale) {
|
|
4
|
+
if (i18n.isInitialized) {
|
|
5
|
+
i18n.removeResourceBundle('*', 'translation');
|
|
6
|
+
i18n.addResourceBundle('en', 'translation', locale.en.translation);
|
|
7
|
+
i18n.addResourceBundle('ar', 'translation', locale.ar.translation);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
i18n.use(initReactI18next).init({
|
|
11
|
+
resources: locale,
|
|
12
|
+
fallbackLng: 'en',
|
|
13
|
+
initImmediate: false,
|
|
14
|
+
preload: ['ar', 'en'],
|
|
15
|
+
debug: false,
|
|
16
|
+
interpolation: {
|
|
17
|
+
escapeValue: false
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
package/build/utils/string.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { DeviceInfo } from '../@types';
|
|
2
2
|
export declare const maskPhone: (str?: string) => string;
|
|
3
3
|
export declare const maskID: (str: string) => string;
|
|
4
4
|
export declare const getIndividualName: (name: string) => {
|
|
@@ -9,3 +9,28 @@ export declare const getIndividualName: (name: string) => {
|
|
|
9
9
|
export declare const convertNumbers2English: (str: string) => string;
|
|
10
10
|
export declare const getParameterByName: (name: string) => string | null;
|
|
11
11
|
export declare const getClientEmailUrl: () => string;
|
|
12
|
+
export declare const capitalizeTheFirstLetterOfEachWord: (words: string) => string;
|
|
13
|
+
export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
|
|
14
|
+
al: string;
|
|
15
|
+
at: string;
|
|
16
|
+
aid: string;
|
|
17
|
+
an: string;
|
|
18
|
+
av: string;
|
|
19
|
+
acv: string;
|
|
20
|
+
asv: string;
|
|
21
|
+
rn: string;
|
|
22
|
+
rt: string;
|
|
23
|
+
rb: string;
|
|
24
|
+
rm: string;
|
|
25
|
+
ro: string;
|
|
26
|
+
rov: string;
|
|
27
|
+
bn: string;
|
|
28
|
+
bb: string;
|
|
29
|
+
bv: string;
|
|
30
|
+
bua: string;
|
|
31
|
+
bi: string;
|
|
32
|
+
ci: string;
|
|
33
|
+
cm: string;
|
|
34
|
+
l: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const removeRequestHeaders: () => void;
|
package/build/utils/string.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { encryptString } from '.';
|
|
2
|
+
import { removeAxiosGlobalHeaders } from '../api';
|
|
2
3
|
export var maskPhone = function (str) {
|
|
3
4
|
if (str === void 0) { str = ''; }
|
|
4
5
|
var lastTwo = str.substring(str.length - 2, str.length);
|
|
@@ -51,3 +52,63 @@ export var getClientEmailUrl = function () {
|
|
|
51
52
|
}
|
|
52
53
|
return origin + '/auth/business?token=';
|
|
53
54
|
};
|
|
55
|
+
export var capitalizeTheFirstLetterOfEachWord = function (words) {
|
|
56
|
+
var separateWord = words.toLowerCase().split(' ');
|
|
57
|
+
for (var i = 0; i < separateWord.length; i++) {
|
|
58
|
+
separateWord[i] = separateWord[i].charAt(0).toUpperCase() + separateWord[i].substring(1);
|
|
59
|
+
}
|
|
60
|
+
return separateWord.join(' ');
|
|
61
|
+
};
|
|
62
|
+
export var getRequestHeaders = function (deviceInfo) {
|
|
63
|
+
var app = deviceInfo.app, browser = deviceInfo.browser, connection = deviceInfo.connection, device = deviceInfo.device, source = deviceInfo.source;
|
|
64
|
+
return {
|
|
65
|
+
al: encryptString(app.language || ''),
|
|
66
|
+
at: encryptString(source || ''),
|
|
67
|
+
aid: encryptString(app.identifier || ''),
|
|
68
|
+
an: encryptString(app.name || ''),
|
|
69
|
+
av: encryptString(app.version || '0.0.0'),
|
|
70
|
+
acv: encryptString(''),
|
|
71
|
+
asv: encryptString(''),
|
|
72
|
+
rn: encryptString(device.name || ''),
|
|
73
|
+
rt: encryptString(device.type || ''),
|
|
74
|
+
rb: encryptString(device.brand || ''),
|
|
75
|
+
rm: encryptString(device.model || ''),
|
|
76
|
+
ro: encryptString(device.os.name || ''),
|
|
77
|
+
rov: encryptString(device.os.version || ''),
|
|
78
|
+
bn: encryptString(browser.name || ''),
|
|
79
|
+
bb: encryptString(''),
|
|
80
|
+
bv: encryptString(browser.version || ''),
|
|
81
|
+
bua: encryptString(browser.user_agent),
|
|
82
|
+
bi: encryptString(browser.browser_id || ''),
|
|
83
|
+
ci: encryptString(connection.ip || ''),
|
|
84
|
+
cm: encryptString(connection.mac || ''),
|
|
85
|
+
l: encryptString((connection.latitude || 0).toString() + '-' + (connection.longitude || 0).toString())
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export var removeRequestHeaders = function () {
|
|
89
|
+
removeAxiosGlobalHeaders([
|
|
90
|
+
'al',
|
|
91
|
+
'at',
|
|
92
|
+
'aid',
|
|
93
|
+
'an',
|
|
94
|
+
'av',
|
|
95
|
+
'acv',
|
|
96
|
+
'asv',
|
|
97
|
+
'rn',
|
|
98
|
+
'rt',
|
|
99
|
+
'rb',
|
|
100
|
+
'rm',
|
|
101
|
+
'ro',
|
|
102
|
+
'rov',
|
|
103
|
+
'bn',
|
|
104
|
+
'bb',
|
|
105
|
+
'bv',
|
|
106
|
+
'bua',
|
|
107
|
+
'bi',
|
|
108
|
+
'ci',
|
|
109
|
+
'cm',
|
|
110
|
+
'l',
|
|
111
|
+
'mdn',
|
|
112
|
+
'authorization'
|
|
113
|
+
]);
|
|
114
|
+
};
|