@tap-payments/auth-jsconnect 2.11.31-development → 2.12.0-development
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/api/lead.d.ts +2 -2
- package/build/assets/locales/ar.json +3 -3
- package/build/constants/app.js +60 -3
- package/build/constants/flows.d.ts +1 -0
- package/build/constants/flows.js +2 -1
- package/build/features/app/bank/bankStore.d.ts +7 -0
- package/build/features/app/bank/bankStore.js +84 -0
- package/build/features/app/board/boardStore.d.ts +5 -0
- package/build/features/app/board/boardStore.js +81 -0
- package/build/features/app/brand/brandStore.d.ts +7 -0
- package/build/features/app/brand/brandStore.js +83 -1
- package/build/features/app/business/businessStore.d.ts +10 -0
- package/build/features/app/business/businessStore.js +83 -1
- package/build/features/app/entity/entityStore.d.ts +7 -0
- package/build/features/app/entity/entityStore.js +85 -1
- package/build/features/app/individual/individualStore.d.ts +9 -0
- package/build/features/app/individual/individualStore.js +85 -1
- package/build/features/app/password/passwordStore.d.ts +9 -0
- package/build/features/app/password/passwordStore.js +82 -0
- package/build/features/app/tax/taxStore.d.ts +7 -0
- package/build/features/app/tax/taxStore.js +81 -0
- package/build/features/app/terminal/terminalStore.d.ts +9 -0
- package/build/features/app/terminal/terminalStore.js +76 -0
- package/build/features/auth/screens/OTPSessionExpired/OTPSessionExpired.js +2 -2
- package/build/features/bank/Bank.js +3 -2
- package/build/features/bank/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/bank/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/bank/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/bank/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/bank/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/bank/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/bank/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/bank/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/board/Board.js +5 -4
- package/build/features/board/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/board/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/board/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/board/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/board/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/board/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/board/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/board/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/brand/Brand.js +3 -2
- package/build/features/brand/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/brand/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/brand/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/brand/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/brand/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/brand/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/brand/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/brand/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/business/Business.js +3 -2
- package/build/features/business/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/business/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/business/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/business/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/business/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/business/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/business/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/business/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/connect/screens/OTPSessionExpired/OTPSessionExpired.js +2 -2
- package/build/features/connectExpress/screens/OTPSessionExpired/OTPSessionExpired.js +2 -2
- package/build/features/entity/Entity.js +3 -2
- package/build/features/entity/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/entity/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/entity/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/entity/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/entity/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/entity/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/entity/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/entity/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/featuresScreens.js +45 -0
- package/build/features/individual/Individual.js +3 -2
- package/build/features/individual/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/individual/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/individual/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/individual/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/individual/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/individual/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/individual/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/individual/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/password/Password.js +3 -2
- package/build/features/password/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/password/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/password/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/password/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/password/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/password/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/password/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/password/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/tax/Tax.js +3 -2
- package/build/features/tax/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/tax/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/tax/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/tax/screens/OTPSessionExpired/OTPSessionExpired.js +75 -0
- package/build/features/tax/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/tax/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/tax/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/tax/screens/OTPSessionExpired/validation.js +4 -0
- package/build/features/terminal/Terminal.js +3 -2
- package/build/features/terminal/screens/OTPSessionExpired/OTPInput.d.ts +7 -0
- package/build/features/terminal/screens/OTPSessionExpired/OTPInput.js +51 -0
- package/build/features/terminal/screens/OTPSessionExpired/OTPSessionExpired.d.ts +5 -0
- package/build/features/terminal/screens/OTPSessionExpired/OTPSessionExpired.js +89 -0
- package/build/features/terminal/screens/OTPSessionExpired/index.d.ts +2 -0
- package/build/features/terminal/screens/OTPSessionExpired/index.js +2 -0
- package/build/features/terminal/screens/OTPSessionExpired/validation.d.ts +8 -0
- package/build/features/terminal/screens/OTPSessionExpired/validation.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import Box from '@mui/material/Box/Box';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import OTPField from '../../../shared/OTP';
|
|
17
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { isTokenExpired } from '../../../../utils';
|
|
22
|
+
import { clearError, terminalSelector, verifyTokenSessionExpired } from '../../../app/terminal/terminalStore';
|
|
23
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return ({
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
fontFamily: theme.typography.fontFamily
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var OTPInput = function (_a) {
|
|
32
|
+
var loading = _a.loading;
|
|
33
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
34
|
+
var t = useTranslation().t;
|
|
35
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
36
|
+
var dispatch = useAppDispatch();
|
|
37
|
+
var error = useAppSelector(terminalSelector).error;
|
|
38
|
+
var handleOnOTPChange = function (otp) {
|
|
39
|
+
if (error)
|
|
40
|
+
dispatch(clearError());
|
|
41
|
+
otpControl.field.onChange(otp);
|
|
42
|
+
};
|
|
43
|
+
var handleOnResendOTP = function () {
|
|
44
|
+
if (otpControl.field.value)
|
|
45
|
+
setValue('otp', '', { shouldValidate: true });
|
|
46
|
+
dispatch(verifyTokenSessionExpired());
|
|
47
|
+
};
|
|
48
|
+
var otpValue = otpControl.field.value;
|
|
49
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
50
|
+
};
|
|
51
|
+
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useAppDispatch, useSetFromDefaultValues, useSanitizedTranslation, useLanguage, useAppSelector } from '../../../../hooks';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import Box from '@mui/material/Box/Box';
|
|
19
|
+
import { styled } from '@mui/material/styles';
|
|
20
|
+
import { handleCurrentActiveScreen } from '../../../../app/settings';
|
|
21
|
+
import { deepCopy, isAuthenticationVerificationFailed, maskPhone } from '../../../../utils';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import Text from '../../../../components/Text';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import { terminalSelector, clearError, resetOTPScreen, verifyTokenOTPSessionExpired } from '../../../app/terminal/terminalStore';
|
|
26
|
+
import Button from '../../../shared/Button';
|
|
27
|
+
import { OTPValidation } from './validation';
|
|
28
|
+
import OTPInput from './OTPInput';
|
|
29
|
+
import { CONNECT_FLOWS } from '../../../../constants';
|
|
30
|
+
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
31
|
+
var theme = _a.theme;
|
|
32
|
+
return ({
|
|
33
|
+
background: theme.palette.common.white,
|
|
34
|
+
border: '1px solid',
|
|
35
|
+
borderColor: theme.palette.divider,
|
|
36
|
+
direction: theme.direction,
|
|
37
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
38
|
+
marginBottom: theme.spacing(5.75)
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInlineStart: theme.spacing(2.5), lineHeight: 1.5, display: 'flex', flexDirection: 'column' }));
|
|
44
|
+
});
|
|
45
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column'
|
|
48
|
+
}); });
|
|
49
|
+
var VerifyNumber = function (_a) {
|
|
50
|
+
var _b, _c, _d;
|
|
51
|
+
var dispatch = useAppDispatch();
|
|
52
|
+
var _e = useAppSelector(terminalSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
53
|
+
var otp = data.otpData.otp;
|
|
54
|
+
var methods = useForm({
|
|
55
|
+
resolver: yupResolver(OTPValidation),
|
|
56
|
+
defaultValues: {
|
|
57
|
+
otp: otp
|
|
58
|
+
},
|
|
59
|
+
mode: 'onChange'
|
|
60
|
+
});
|
|
61
|
+
useSetFromDefaultValues(methods, data.otpData);
|
|
62
|
+
var t = useTranslation().t;
|
|
63
|
+
var st = useSanitizedTranslation();
|
|
64
|
+
var isAr = useLanguage().isAr;
|
|
65
|
+
var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
|
|
66
|
+
var phone = (_d = (_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authData) === null || _c === void 0 ? void 0 : _c.verification_by) === null || _d === void 0 ? void 0 : _d.sent_to;
|
|
67
|
+
React.useEffect(function () {
|
|
68
|
+
if (error && methods.formState.isValid && phone)
|
|
69
|
+
dispatch(clearError());
|
|
70
|
+
return function () {
|
|
71
|
+
dispatch(resetOTPScreen());
|
|
72
|
+
};
|
|
73
|
+
}, [methods.formState.isValid]);
|
|
74
|
+
var onSubmit = function (formData) {
|
|
75
|
+
dispatch(verifyTokenOTPSessionExpired(deepCopy(formData)))
|
|
76
|
+
.unwrap()
|
|
77
|
+
.then(function (_a) {
|
|
78
|
+
var nextScreen = _a.nextScreen;
|
|
79
|
+
dispatch(handleCurrentActiveScreen(nextScreen));
|
|
80
|
+
})
|
|
81
|
+
.catch(function (err) {
|
|
82
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
83
|
+
dispatch(handleCurrentActiveScreen(CONNECT_FLOWS.terminal.otpVerifySecurityError));
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
87
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('session_expired_otp'), !loading && phone && (_jsxs("span", { children: [st('code_sent_to'), " ", _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
88
|
+
};
|
|
89
|
+
export default React.memo(VerifyNumber);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|