@tap-payments/auth-jsconnect 2.10.11-beta → 2.10.11
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/README.md +2 -2
- package/build/@types/app.d.ts +3 -1
- package/build/@types/app.js +1 -0
- package/build/@types/form.d.ts +7 -2
- package/build/api/account.d.ts +2 -2
- package/build/api/account.js +7 -4
- package/build/api/auth.d.ts +2 -1
- package/build/api/auth.js +7 -3
- package/build/api/axios.d.ts +1 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/headers.d.ts +5 -0
- package/build/api/headers.js +3 -0
- package/build/api/index.d.ts +4 -4
- package/build/api/lead.d.ts +1 -0
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +5 -2
- package/build/app/settings.d.ts +1 -0
- package/build/app/settings.js +8 -5
- package/build/assets/currencies/AEDSymbol.d.ts +7 -0
- package/build/assets/currencies/AEDSymbol.js +28 -0
- package/build/assets/currencies/SARSymbol.d.ts +7 -0
- package/build/assets/currencies/SARSymbol.js +28 -0
- package/build/assets/currencies/index.d.ts +2 -0
- package/build/assets/currencies/index.js +2 -0
- package/build/assets/currencies/utils.d.ts +4 -0
- package/build/assets/currencies/utils.js +6 -0
- package/build/assets/locales/ar.json +53 -7
- package/build/assets/locales/en.json +58 -11
- package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
- package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
- package/build/components/TextWithCurrency/index.d.ts +2 -0
- package/build/components/TextWithCurrency/index.js +2 -0
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +2 -0
- package/build/constants/app.d.ts +11 -0
- package/build/constants/app.js +110 -19
- package/build/constants/assets.d.ts +12 -3
- package/build/constants/assets.js +123 -105
- package/build/constants/dummy.js +27 -20
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.d.ts +24 -5
- package/build/features/app/auth/authStore.js +188 -113
- package/build/features/app/bank/bankStore.js +24 -20
- package/build/features/app/board/boardStore.js +11 -7
- package/build/features/app/brand/brandStore.js +22 -18
- package/build/features/app/business/businessStore.js +45 -36
- package/build/features/app/connect/connectStore.d.ts +6 -5
- package/build/features/app/connect/connectStore.js +48 -31
- package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -5
- package/build/features/app/connectExpress/connectExpressStore.js +99 -39
- package/build/features/app/entity/entityStore.js +21 -17
- package/build/features/app/individual/individualStore.js +33 -28
- package/build/features/app/password/passwordStore.js +44 -46
- package/build/features/app/signIn/signInStore.js +12 -16
- package/build/features/app/tax/taxStore.js +21 -17
- package/build/features/auth/Auth.d.ts +1 -1
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/auth/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
- package/build/features/auth/screens/OTP/OTP.js +15 -3
- package/build/features/auth/screens/OTP/index.d.ts +1 -2
- package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
- package/build/features/auth/screens/Passcode/Passcode.js +82 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
- package/build/features/auth/screens/Passcode/index.d.ts +2 -0
- package/build/features/auth/screens/Passcode/index.js +2 -0
- package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
- package/build/features/auth/screens/Passcode/validation.js +4 -0
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +15 -5
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +20 -12
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -10
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +27 -16
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
- package/build/features/connectExpress/screens/Mobile/Mobile.js +7 -6
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
- package/build/features/entity/screens/EntityName/EntityName.js +16 -15
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +50 -48
- package/build/features/entity/screens/EntityName/validation.js +100 -85
- package/build/features/featuresScreens.js +60 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
- package/build/features/shared/Background/LogoBackground.js +5 -17
- package/build/features/shared/Button/Button.js +1 -2
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts +3 -0
- package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
- package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
- package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
- package/build/hooks/useAppConfig.js +1 -1
- package/build/utils/common.d.ts +1 -1
- package/build/utils/common.js +14 -8
- package/build/utils/error.d.ts +2 -0
- package/build/utils/error.js +6 -0
- package/build/utils/string.d.ts +3 -2
- package/build/utils/string.js +4 -1
- package/build/utils/validation.js +1 -1
- package/package.json +3 -3
|
@@ -16,7 +16,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
|
-
import {
|
|
19
|
+
import { hasVerifiedValue } from '../../../../utils';
|
|
20
20
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -26,6 +26,7 @@ import InputSelect from '../../../shared/InputSelect';
|
|
|
26
26
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
27
27
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
28
28
|
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
29
|
+
import TextWithCurrency from '../../../../components/TextWithCurrency';
|
|
29
30
|
var Container = styled(Box)(function () { return ({
|
|
30
31
|
display: 'flex'
|
|
31
32
|
}); });
|
|
@@ -45,16 +46,12 @@ var MonthlyIncome = function (props) {
|
|
|
45
46
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
46
47
|
var monthlyIncomeList = (data.individualData.responseBody || {}).monthlyIncomeList;
|
|
47
48
|
var monthlyIncomeControl = useController({ control: control, name: 'monthlyIncome' });
|
|
48
|
-
var countryCode = settingsData.businessCountry;
|
|
49
49
|
var user = (data.verify.responseBody || {}).user;
|
|
50
50
|
var isMonthlyIncomeVerified = function (item) {
|
|
51
51
|
if (!(item === null || item === void 0 ? void 0 : item.id))
|
|
52
52
|
return false;
|
|
53
53
|
return hasVerifiedValue(user === null || user === void 0 ? void 0 : user.data_verification, "monthly_income.".concat(item.id));
|
|
54
54
|
};
|
|
55
|
-
var getCurrency = React.useMemo(function () {
|
|
56
|
-
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
57
|
-
}, [countryCode.iso2]);
|
|
58
55
|
React.useEffect(function () {
|
|
59
56
|
if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
|
|
60
57
|
setIncomeList(monthlyIncomeList);
|
|
@@ -83,9 +80,7 @@ var MonthlyIncome = function (props) {
|
|
|
83
80
|
};
|
|
84
81
|
var income = monthlyIncomeControl.field.value;
|
|
85
82
|
var error = (_a = monthlyIncomeControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
86
|
-
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(InputSelect, { label: t('
|
|
87
|
-
currency: getCurrency
|
|
88
|
-
}), required: true, readOnly: props.readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error), endAdornment: _jsx(EndAdornmentExpanded, { isVerified: isMonthlyIncomeVerified(income), anchorEl: anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
83
|
+
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(InputSelect, { label: _jsx(TextWithCurrency, { text: t('monthly_income'), countryCode: settingsData.businessCountry.iso2 }), required: true, readOnly: props.readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error), endAdornment: _jsx(EndAdornmentExpanded, { isVerified: isMonthlyIncomeVerified(income), anchorEl: anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
89
84
|
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIcon, { isVerified: isMonthlyIncomeVerified(item) })] }));
|
|
90
85
|
} }) }))] })) })));
|
|
91
86
|
};
|
|
@@ -14,13 +14,14 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
|
-
import { formatNumberAsCurrency,
|
|
17
|
+
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
21
|
import Input from '../../../shared/Input';
|
|
22
22
|
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
23
23
|
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
24
|
+
import TextWithCurrency from '../../../../components/TextWithCurrency';
|
|
24
25
|
var ShareValue = function (_a) {
|
|
25
26
|
var _b;
|
|
26
27
|
var show = _a.show, readOnly = _a.readOnly;
|
|
@@ -29,7 +30,6 @@ var ShareValue = function (_a) {
|
|
|
29
30
|
var control = useFormContext().control;
|
|
30
31
|
var bckError = useAppSelector(individualSelector).error;
|
|
31
32
|
var dispatch = useAppDispatch();
|
|
32
|
-
var countryCode = settingsData.businessCountry;
|
|
33
33
|
var handleChange = function (_a) {
|
|
34
34
|
var target = _a.target;
|
|
35
35
|
if (bckError)
|
|
@@ -37,14 +37,9 @@ var ShareValue = function (_a) {
|
|
|
37
37
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
38
38
|
shareValueControl.field.onChange(value);
|
|
39
39
|
};
|
|
40
|
-
var getCurrency = React.useMemo(function () {
|
|
41
|
-
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
42
|
-
}, [countryCode.iso2]);
|
|
43
40
|
var shareValueControl = useController({ control: control, name: 'shareValue' });
|
|
44
41
|
var shareValue = shareValueControl.field.value;
|
|
45
42
|
var error = (_b = shareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
46
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('
|
|
47
|
-
currency: getCurrency
|
|
48
|
-
}), onChange: handleChange, value: shareValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: shareValue, error: error }) }) })) })));
|
|
43
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: _jsx(TextWithCurrency, { text: t('share_value_input_label'), countryCode: settingsData.businessCountry.iso2 }), onChange: handleChange, value: shareValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: shareValue, error: error }) }) })) })));
|
|
49
44
|
};
|
|
50
45
|
export default React.memo(ShareValue);
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
5
|
import Icon from '../../../components/Icon';
|
|
6
6
|
import { ICONS_NAMES } from '../../../constants';
|
|
7
|
-
import { useLanguage } from '../../../hooks';
|
|
8
7
|
var BoxStyled = styled(Box)(function (_a) {
|
|
9
8
|
var _b;
|
|
10
9
|
var theme = _a.theme;
|
|
11
10
|
return (_b = {
|
|
12
11
|
display: 'flex',
|
|
13
|
-
flexDirection: 'column',
|
|
14
12
|
justifyContent: 'center',
|
|
15
|
-
|
|
16
|
-
paddingTop: theme.spacing(5)
|
|
13
|
+
paddingTop: theme.spacing(10)
|
|
17
14
|
},
|
|
18
15
|
_b[theme.breakpoints.down('sm')] = {
|
|
19
16
|
paddingTop: theme.spacing(11)
|
|
@@ -23,20 +20,11 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
23
20
|
var LogoBadgeStyled = styled(Icon)(function (_a) {
|
|
24
21
|
var theme = _a.theme;
|
|
25
22
|
return ({
|
|
26
|
-
height: theme.spacing(
|
|
27
|
-
width: theme.spacing(
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
var LogoIconStyled = styled(Icon)(function (_a) {
|
|
31
|
-
var theme = _a.theme;
|
|
32
|
-
return ({
|
|
33
|
-
width: theme.spacing(5.875),
|
|
34
|
-
height: theme.spacing(3.625),
|
|
35
|
-
marginTop: theme.spacing(2.5)
|
|
23
|
+
height: theme.spacing(9.5),
|
|
24
|
+
width: theme.spacing(19.322)
|
|
36
25
|
});
|
|
37
26
|
});
|
|
38
27
|
var LogoBackground = function () {
|
|
39
|
-
|
|
40
|
-
return (_jsxs(BoxStyled, { children: [_jsx(LogoBadgeStyled, { src: ICONS_NAMES.TAP_LOGO_EN_ICON }), _jsx(LogoIconStyled, { src: isAr ? ICONS_NAMES.TAP_LOGO_TEXT_AR : ICONS_NAMES.TAP_LOGO_TEXT_EN, alt: 'tap logo' })] }));
|
|
28
|
+
return (_jsx(BoxStyled, { children: _jsx(LogoBadgeStyled, { src: ICONS_NAMES.TAP_LOGO, alt: 'tap logo' }) }));
|
|
41
29
|
};
|
|
42
30
|
export default memo(LogoBackground);
|
|
@@ -53,8 +53,7 @@ var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return
|
|
|
53
53
|
var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
54
54
|
var theme = _a.theme;
|
|
55
55
|
return ({
|
|
56
|
-
margin: theme.spacing(
|
|
57
|
-
marginBlockStart: theme.spacing(5),
|
|
56
|
+
margin: theme.spacing(5, 2.5, 2.5, 2.5),
|
|
58
57
|
maxHeight: theme.spacing(5.375),
|
|
59
58
|
display: 'flex',
|
|
60
59
|
alignItems: 'center',
|
|
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
|
|
|
20
20
|
warningType?: "alert" | "error" | "hint" | undefined;
|
|
21
21
|
} & {} & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
|
|
22
22
|
export interface CustomInputProps extends InputProps {
|
|
23
|
-
label?: string;
|
|
23
|
+
label?: string | JSX.Element;
|
|
24
24
|
required?: boolean;
|
|
25
25
|
labelSx?: SxProps<Theme>;
|
|
26
26
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import GenericError from '../../shared/GenericError';
|
|
5
|
+
var OTPVerifySecurityError = function () {
|
|
6
|
+
var t = useTranslation().t;
|
|
7
|
+
return _jsx(GenericError, { error: t('something_went_wrong'), errorTitle: t('oops') });
|
|
8
|
+
};
|
|
9
|
+
export default React.memo(OTPVerifySecurityError);
|
|
@@ -48,7 +48,7 @@ export var useAppConfig = function (_a) {
|
|
|
48
48
|
if (!disableSettingFetching && !configToken)
|
|
49
49
|
removeRequestHeaders();
|
|
50
50
|
checkDomain();
|
|
51
|
-
setBaseUrl(publicKey, rest.
|
|
51
|
+
setBaseUrl(publicKey, rest.region);
|
|
52
52
|
setAppConfig();
|
|
53
53
|
if (typeof boardMaturity === 'boolean')
|
|
54
54
|
dispatch(handelBoardMaturity(boardMaturity));
|
package/build/utils/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const sleep: (milliseconds?: number) => Promise<unknown>;
|
|
2
2
|
export declare const dangerousMessage: (message: string, callBack?: Function) => void;
|
|
3
|
-
export declare const setBaseUrl: (publicKey: string,
|
|
3
|
+
export declare const setBaseUrl: (publicKey: string, region?: string) => void;
|
|
4
4
|
export declare const updateLocationUrlWithCountry: (countryIso2: string) => void;
|
|
5
5
|
export declare const openConnect: (pk: string, countryCode?: string) => void;
|
|
6
6
|
export declare function getMetaData(): Record<string, string> | undefined;
|
package/build/utils/common.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { axiosInstance } from '../api';
|
|
2
|
-
import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL,
|
|
2
|
+
import { ENDPOINT_PATHS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
|
|
3
3
|
import { objectHasValues } from './object';
|
|
4
|
-
import { isSA } from './string';
|
|
4
|
+
import { isDisasterRecoveryEnv, isSA } from './string';
|
|
5
5
|
export var sleep = function (milliseconds) {
|
|
6
6
|
if (milliseconds === void 0) { milliseconds = 1000; }
|
|
7
7
|
return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
|
|
@@ -12,14 +12,20 @@ export var dangerousMessage = function (message, callBack) {
|
|
|
12
12
|
}
|
|
13
13
|
callBack === null || callBack === void 0 ? void 0 : callBack({ message: message });
|
|
14
14
|
};
|
|
15
|
-
export var setBaseUrl = function (publicKey,
|
|
16
|
-
if (
|
|
15
|
+
export var setBaseUrl = function (publicKey, region) {
|
|
16
|
+
if (region === void 0) { region = ''; }
|
|
17
17
|
var isProd = publicKey.includes('pk_live');
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var _a = region.split('-'), country = _a[0], envType = _a[1];
|
|
19
|
+
if (!isProd) {
|
|
20
|
+
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
if (isSA(country)) {
|
|
24
|
+
axiosInstance.defaults.baseURL = isDisasterRecoveryEnv(envType) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA_DR : ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
28
|
+
}
|
|
23
29
|
};
|
|
24
30
|
export var updateLocationUrlWithCountry = function (countryIso2) {
|
|
25
31
|
var country = countryIso2.toLowerCase();
|
|
@@ -38,7 +44,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
|
|
|
38
44
|
window.history.replaceState({}, '', newUrl);
|
|
39
45
|
};
|
|
40
46
|
export var openConnect = function (pk, countryCode) {
|
|
41
|
-
var newUrl = new URL(pk.includes('pk_live') ?
|
|
47
|
+
var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
|
|
42
48
|
if (countryCode) {
|
|
43
49
|
newUrl.pathname = "/".concat(countryCode.toLowerCase());
|
|
44
50
|
}
|
package/build/utils/error.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const isNetworkError: (error: string | null) => boolean;
|
|
2
2
|
export declare const isTokenExpired: (error: string | null) => boolean;
|
|
3
3
|
export declare const isTimeoutError: (error: string | null) => boolean;
|
|
4
|
+
export declare const isInternalServerError: (error: string | null) => boolean;
|
|
5
|
+
export declare const isAuthenticationVerificationFailed: (error: string | null) => boolean;
|
package/build/utils/error.js
CHANGED
|
@@ -7,3 +7,9 @@ export var isTokenExpired = function (error) {
|
|
|
7
7
|
export var isTimeoutError = function (error) {
|
|
8
8
|
return (error || '').trim().toLowerCase().includes('timeout');
|
|
9
9
|
};
|
|
10
|
+
export var isInternalServerError = function (error) {
|
|
11
|
+
return ['internal_server_error'].includes((error || '').trim().toLowerCase());
|
|
12
|
+
};
|
|
13
|
+
export var isAuthenticationVerificationFailed = function (error) {
|
|
14
|
+
return ['failed to verify the auth'].includes((error || '').trim().toLowerCase());
|
|
15
|
+
};
|
package/build/utils/string.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare const getBaseUrl: () => string;
|
|
|
46
46
|
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP" | "INDIVIDUAL_LIST_STEP" | "PASSWORD_CREATE_PASSWORD_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP" | "ENTITY_NAME_STEP" | "BRAND_INFO_STEP";
|
|
47
47
|
export declare const getEighteenYearsAgo: () => string;
|
|
48
48
|
export declare const isKW: (flag: string) => boolean;
|
|
49
|
-
export declare const isSA: (flag: string) => boolean;
|
|
49
|
+
export declare const isSA: (flag: string | undefined) => boolean;
|
|
50
50
|
export declare const isOtherThanKWOrSA: (flag: string) => boolean;
|
|
51
51
|
export declare const isKWOrSA: (flag: string) => boolean;
|
|
52
52
|
export declare const isLinkedIn: (flag: string) => boolean;
|
|
@@ -75,6 +75,7 @@ export declare const getFileType: (type: string) => "" | "image/jpeg" | "image/p
|
|
|
75
75
|
export declare const isStringHasOneAsterisk: (value: string) => boolean;
|
|
76
76
|
export declare const isOtherLicense: (item?: License) => boolean;
|
|
77
77
|
export declare const formatNumberAsCurrency: (number: string) => string;
|
|
78
|
-
export declare const getCurrencyByCountryIso2: (countryCode
|
|
78
|
+
export declare const getCurrencyByCountryIso2: (countryCode?: string) => string;
|
|
79
79
|
export declare const getMobileNumberLen: (initialLen: number, number: string) => number;
|
|
80
80
|
export declare const getWebsiteLink: (isAr: boolean, countryCode: string, path: string) => string;
|
|
81
|
+
export declare const isDisasterRecoveryEnv: (type?: string) => boolean;
|
package/build/utils/string.js
CHANGED
|
@@ -214,7 +214,9 @@ export var isKW = function (flag) {
|
|
|
214
214
|
return ['kw', 'kwd'].includes(flag === null || flag === void 0 ? void 0 : flag.toLowerCase());
|
|
215
215
|
};
|
|
216
216
|
export var isSA = function (flag) {
|
|
217
|
-
|
|
217
|
+
if (!flag)
|
|
218
|
+
return false;
|
|
219
|
+
return ['sa', 'sau'].includes(flag.toLowerCase());
|
|
218
220
|
};
|
|
219
221
|
export var isOtherThanKWOrSA = function (flag) {
|
|
220
222
|
return !isKW(flag) && !isSA(flag);
|
|
@@ -344,3 +346,4 @@ export var getWebsiteLink = function (isAr, countryCode, path) {
|
|
|
344
346
|
var language = isAr ? LANGUAGE_ABBREVIATIONS.ARABIC : LANGUAGE_ABBREVIATIONS.ENGLISH;
|
|
345
347
|
return TAP_WEBSITE + language + '-' + countryCode + path;
|
|
346
348
|
};
|
|
349
|
+
export var isDisasterRecoveryEnv = function (type) { return type === 'dr'; };
|
|
@@ -53,7 +53,7 @@ export var keepLettersAndSpace = function (str) {
|
|
|
53
53
|
return str.replace(/[^a-zA-Z] /g, '');
|
|
54
54
|
};
|
|
55
55
|
export var isConnectTapDomain = function (domain) {
|
|
56
|
-
var regex = /^(https:\/\/)?connect(
|
|
56
|
+
var regex = /^(https:\/\/)?connect((\.|-)\w+)?\.tap\.(company|com\.\w{2})$/;
|
|
57
57
|
return regex.test(domain);
|
|
58
58
|
};
|
|
59
59
|
export var isTapDomain = function (domain) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "2.10.11
|
|
3
|
+
"version": "2.10.11",
|
|
4
4
|
"description": "connect library, auth",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
22
22
|
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
23
23
|
"ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
|
|
24
|
-
"push": "npm publish --access public
|
|
24
|
+
"push": "npm publish --access public"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [],
|
|
27
27
|
"author": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@mui/icons-material": "^5.8.4",
|
|
83
83
|
"@mui/material": "^5.8.7",
|
|
84
84
|
"@reduxjs/toolkit": "^1.8.3",
|
|
85
|
-
"axios": "^
|
|
85
|
+
"axios": "^1.11.0",
|
|
86
86
|
"device-detector-js": "^3.0.3",
|
|
87
87
|
"i18next": "^21.8.14",
|
|
88
88
|
"i18next-browser-languagedetector": "^6.1.4",
|