@tap-payments/auth-jsconnect 1.0.20 → 1.0.23
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 +0 -9
- package/build/@types/form.d.ts +3 -0
- package/build/@types/redux.d.ts +1 -0
- package/build/api/availabilityServices.d.ts +12 -0
- package/build/api/availabilityServices.js +13 -0
- package/build/api/index.d.ts +6 -1
- package/build/api/index.js +3 -1
- package/build/app/settings.d.ts +2 -2
- package/build/app/settings.js +12 -8
- package/build/assets/locales/ar.json +2 -1
- package/build/assets/locales/en.json +2 -1
- package/build/components/Button/Button.js +1 -1
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +5 -1
- package/build/constants/app.js +3 -3
- package/build/features/app/connect/connectStore.d.ts +24 -4
- package/build/features/app/connect/connectStore.js +140 -17
- package/build/features/bank/screens/BankDetails/BankName.js +6 -1
- package/build/features/business/screens/Activities/Activities.js +6 -2
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +3 -3
- package/build/features/business/screens/Customers/Customers.js +19 -1
- package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +1 -0
- package/build/features/business/screens/Customers/ExpectedCustomers.js +3 -3
- package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +1 -0
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -3
- package/build/features/business/screens/VerifyNumber/VerifyNumber.js +1 -1
- package/build/features/connect/screens/Individual/Email.d.ts +2 -1
- package/build/features/connect/screens/Individual/Email.js +29 -3
- package/build/features/connect/screens/Individual/Individual.js +22 -9
- package/build/features/connect/screens/Individual/MobileNumber.d.ts +2 -0
- package/build/features/connect/screens/Individual/MobileNumber.js +8 -4
- package/build/features/connect/screens/Individual/Name.d.ts +2 -1
- package/build/features/connect/screens/Individual/Name.js +3 -1
- package/build/features/connect/screens/Merchant/BrandName.js +9 -0
- package/build/features/connect/screens/Merchant/Merchant.js +8 -2
- package/build/features/connect/screens/Merchant/validation.js +1 -1
- package/build/features/connect/screens/Mobile/Mobile.js +5 -4
- package/build/features/connect/screens/Mobile/MobileNumber.js +6 -6
- package/build/features/connect/screens/NID/DOB.js +12 -2
- package/build/features/connect/screens/NID/NID.js +6 -3
- package/build/features/connect/screens/NID/validation.js +1 -2
- package/build/features/connect/screens/OTP/OTP.js +4 -3
- package/build/features/connect/screens/OTP/OTPInput.js +7 -3
- package/build/features/connect/screens/Password/Password.js +17 -11
- package/build/features/connect/screens/Password/PasswordInput.js +1 -1
- package/build/features/connect/screens/ThankYou/ThankYou.js +6 -1
- package/build/features/shared/Button/Button.js +20 -6
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +5 -4
- package/package.json +3 -1
|
@@ -11,12 +11,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
+
import { useSelector } from 'react-redux';
|
|
15
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
14
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
15
17
|
import { useTranslation } from 'react-i18next';
|
|
16
18
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
18
19
|
import { styled } from '@mui/material/styles';
|
|
19
|
-
import {
|
|
20
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
+
import { clearError, connectSelector, verifyAuthPassword } from '../../../app/connect/connectStore';
|
|
20
22
|
import Form from '../../../../components/Form';
|
|
21
23
|
import Button from '../../../shared/Button';
|
|
22
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -30,23 +32,27 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
30
32
|
height: '100%'
|
|
31
33
|
}); });
|
|
32
34
|
var Password = function (_a) {
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var _b = useSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
33
37
|
var methods = useForm({
|
|
34
38
|
resolver: yupResolver(PasswordValidationSchema),
|
|
35
|
-
defaultValues:
|
|
36
|
-
password: ''
|
|
37
|
-
},
|
|
39
|
+
defaultValues: data.passwordData,
|
|
38
40
|
mode: 'onChange'
|
|
39
41
|
});
|
|
40
42
|
var t = useTranslation().t;
|
|
41
43
|
var isAr = useLanguage().isAr;
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
var isAbsher = data.otpData.isAbsher;
|
|
45
|
+
React.useEffect(function () {
|
|
46
|
+
if (error)
|
|
47
|
+
dispatch(clearError());
|
|
48
|
+
}, [methods.formState.isValid]);
|
|
49
|
+
var onSubmit = function (formData) {
|
|
50
|
+
dispatch(verifyAuthPassword(formData));
|
|
46
51
|
};
|
|
47
52
|
var onBack = function () {
|
|
48
|
-
dispatch(handlePrevScreenStep());
|
|
53
|
+
dispatch(handlePrevScreenStep(isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
|
|
49
54
|
};
|
|
50
|
-
|
|
55
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
56
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(PasswordInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
51
57
|
};
|
|
52
58
|
export default React.memo(Password);
|
|
@@ -34,6 +34,6 @@ var PasswordInput = function (_a) {
|
|
|
34
34
|
};
|
|
35
35
|
var passwordValue = passwordControl.field.value;
|
|
36
36
|
var error = (_b = passwordControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
37
|
-
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('tap_js_password_description'), inputProps: { autoComplete: 'off' }, onChange: handlePasswordChange, value: passwordValue, endAdornment: _jsx(PasswordIcon, { show: showPassword, onShow: handleShowPassword, onHide: handleHidePassword }), placeholder: t('tap_js_password_placeholder'), type: showPassword ? 'text' : 'password', warningType: 'alert', warningMessage: error && t(error, { length: 8 }) }) })));
|
|
37
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 5 } }, { children: _jsx(Input, { label: t('tap_js_password_description'), inputProps: { autoComplete: 'off' }, onChange: handlePasswordChange, value: passwordValue, endAdornment: _jsx(PasswordIcon, { show: showPassword, onShow: handleShowPassword, onHide: handleHidePassword }), placeholder: t('tap_js_password_placeholder'), type: showPassword ? 'text' : 'password', warningType: 'alert', warningMessage: error && t(error, { length: 8 }) }) })));
|
|
38
38
|
};
|
|
39
39
|
export default React.memo(PasswordInput);
|
|
@@ -7,8 +7,13 @@ import { updateLeadSuccess } from '../../../app/connect/connectStore';
|
|
|
7
7
|
var ThankYou = function (_a) {
|
|
8
8
|
var t = useTranslation().t;
|
|
9
9
|
var dispatch = useAppDispatch();
|
|
10
|
-
|
|
10
|
+
React.useEffect(function () {
|
|
11
11
|
dispatch(updateLeadSuccess());
|
|
12
|
+
}, []);
|
|
13
|
+
var onSuccess = function () {
|
|
14
|
+
console.log('success');
|
|
15
|
+
alert('Account created successfully, please check your email');
|
|
16
|
+
alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
|
|
12
17
|
};
|
|
13
18
|
return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
|
|
14
19
|
};
|
|
@@ -35,7 +35,8 @@ var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop
|
|
|
35
35
|
return ({
|
|
36
36
|
width: theme.spacing(3),
|
|
37
37
|
height: theme.spacing(3),
|
|
38
|
-
transform: isAr ? 'scaleX(-1)' : 'scaleX(1)'
|
|
38
|
+
transform: isAr ? 'scaleX(-1)' : 'scaleX(1)',
|
|
39
|
+
marginInlineEnd: theme.spacing(-0.75)
|
|
39
40
|
});
|
|
40
41
|
});
|
|
41
42
|
var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
@@ -43,15 +44,28 @@ var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return
|
|
|
43
44
|
return ({
|
|
44
45
|
width: theme.spacing(3),
|
|
45
46
|
height: theme.spacing(3),
|
|
46
|
-
transform: isAr ? 'scaleX(1)' : 'scaleX(-1)'
|
|
47
|
+
transform: isAr ? 'scaleX(1)' : 'scaleX(-1)',
|
|
48
|
+
marginInlineStart: theme.spacing(0.5)
|
|
47
49
|
});
|
|
48
50
|
});
|
|
49
|
-
var ButtonBoxStyled = styled(ButtonGroup)(function (_a) {
|
|
50
|
-
var theme = _a.theme;
|
|
51
|
+
var ButtonBoxStyled = styled(ButtonGroup, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
52
|
+
var theme = _a.theme, isAr = _a.isAr;
|
|
51
53
|
return ({
|
|
52
54
|
width: '100%',
|
|
53
55
|
margin: theme.spacing(0, 2.5, 2.5, 2.5),
|
|
54
|
-
paddingInlineEnd: theme.spacing(5)
|
|
56
|
+
paddingInlineEnd: theme.spacing(5),
|
|
57
|
+
'& .MuiButtonGroup-grouped:not(:first-of-type)': {
|
|
58
|
+
borderTopRightRadius: theme.spacing(4.1),
|
|
59
|
+
borderBottomRightRadius: theme.spacing(4.1),
|
|
60
|
+
borderTopLeftRadius: 0,
|
|
61
|
+
borderBottomLeftRadius: 0
|
|
62
|
+
},
|
|
63
|
+
'& .MuiButtonGroup-grouped:not(:last-of-type)': {
|
|
64
|
+
borderTopRightRadius: 0,
|
|
65
|
+
borderBottomRightRadius: 0,
|
|
66
|
+
borderTopLeftRadius: theme.spacing(4.1),
|
|
67
|
+
borderBottomLeftRadius: theme.spacing(4.1)
|
|
68
|
+
}
|
|
55
69
|
});
|
|
56
70
|
});
|
|
57
71
|
var ButtonStyled = styled(Button)(function (_a) {
|
|
@@ -62,7 +76,7 @@ var ButtonStyled = styled(Button)(function (_a) {
|
|
|
62
76
|
});
|
|
63
77
|
export default function CustomButton(_a) {
|
|
64
78
|
var children = _a.children, disabled = _a.disabled, isAr = _a.isAr, loading = _a.loading, disableBack = _a.disableBack, onBackClicked = _a.onBackClicked, error = _a.error, props = __rest(_a, ["children", "disabled", "isAr", "loading", "disableBack", "onBackClicked", "error"]);
|
|
65
|
-
return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, __assign({ sx: { mt: 5 } }, { children: [!disableBack && !loading && (_jsx(ButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, sx: { width: '10%' }, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled, type: 'submit', endIcon: _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }), startIcon: _jsx(Loader, { style: {
|
|
79
|
+
return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, __assign({ sx: { mt: 5 }, isAr: isAr, disableElevation: true, disableRipple: true, disableFocusRipple: true }, { children: [!disableBack && !loading && (_jsx(ButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, sx: { width: '10%' }, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled || loading, type: 'submit', endIcon: _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }), startIcon: _jsx(Loader, { style: {
|
|
66
80
|
visibility: disableBack && !loading ? 'hidden' : loading ? 'visible' : 'hidden',
|
|
67
81
|
display: !disableBack && !loading ? 'none' : 'block'
|
|
68
82
|
}, innerColor: 'white', outerColor: 'white', size: 30, toggleAnimation: !!loading }) }, props, { children: children }))] }))] }));
|
package/build/utils/string.d.ts
CHANGED
package/build/utils/string.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
export var string = '';
|
|
2
2
|
export var maskPhone = function (str) {
|
|
3
3
|
if (str === void 0) { str = ''; }
|
|
4
|
-
var first = str.substring(0, 1);
|
|
5
4
|
var lastTwo = str.substring(str.length - 2, str.length);
|
|
6
|
-
return
|
|
5
|
+
return ' ••••' + lastTwo;
|
|
7
6
|
};
|
|
8
7
|
export var maskID = function (str) {
|
|
9
|
-
var first = str.substring(0, 1);
|
|
10
8
|
var lastTwo = str.substring(str.length - 2, str.length);
|
|
11
|
-
return
|
|
9
|
+
return ' ••••' + lastTwo;
|
|
12
10
|
};
|
|
13
11
|
export var getIndividualName = function (name) {
|
|
14
12
|
var _a;
|
|
@@ -39,3 +37,6 @@ export var getIndividualName = function (name) {
|
|
|
39
37
|
}
|
|
40
38
|
return { first: first, middle: middle, last: last };
|
|
41
39
|
};
|
|
40
|
+
export var convertNumbers2English = function (str) {
|
|
41
|
+
return str.replace(/[٠-٩]/g, function (d) { return '٠١٢٣٤٥٦٧٨٩'.indexOf(d); });
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "connect library, auth",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"fork-ts-checker-webpack-plugin": "^7.2.12",
|
|
59
59
|
"html-loader": "^3.1.2",
|
|
60
60
|
"html-webpack-plugin": "^5.5.0",
|
|
61
|
+
"@types/moment-hijri": "^2.1.0",
|
|
61
62
|
"husky": "^8.0.1",
|
|
62
63
|
"lint-staged": "^13.0.3",
|
|
63
64
|
"mini-css-extract-plugin": "^2.6.1",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"i18next-browser-languagedetector": "^6.1.4",
|
|
88
89
|
"i18next-http-backend": "^1.4.1",
|
|
89
90
|
"lodash-es": "^4.17.21",
|
|
91
|
+
"moment-hijri": "~2.1.2",
|
|
90
92
|
"react": "^18.2.0",
|
|
91
93
|
"react-calendar": "~3.7.0",
|
|
92
94
|
"react-dom": "^18.2.0",
|