@tap-payments/auth-jsconnect 2.0.30-test → 2.0.32-test
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 +3 -1
- package/build/@types/app.js +2 -0
- package/build/@types/form.d.ts +7 -0
- package/build/app/rootReducer.d.ts +2 -0
- package/build/app/rootReducer.js +5 -1
- package/build/app/store.d.ts +4 -0
- package/build/constants/app.d.ts +11 -0
- package/build/constants/app.js +49 -0
- package/build/features/app/entity/entityStore.d.ts +48 -0
- package/build/features/app/entity/entityStore.js +322 -0
- package/build/features/app/otp/otpStore.d.ts +28 -0
- package/build/features/app/otp/otpStore.js +153 -0
- package/build/features/entity/Entity.d.ts +7 -0
- package/build/features/entity/Entity.js +63 -0
- package/build/features/entity/index.d.ts +1 -0
- package/build/features/entity/index.js +1 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +6 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.js +2 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/entity/screens/Success/Success.d.ts +5 -0
- package/build/features/entity/screens/Success/Success.js +16 -0
- package/build/features/entity/screens/Success/index.d.ts +3 -0
- package/build/features/entity/screens/Success/index.js +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +109 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/entity/screens/Verify/OTPInput.d.ts +7 -0
- package/build/features/entity/screens/Verify/OTPInput.js +47 -0
- package/build/features/entity/screens/Verify/Verify.d.ts +5 -0
- package/build/features/entity/screens/Verify/Verify.js +78 -0
- package/build/features/entity/screens/Verify/index.d.ts +2 -0
- package/build/features/entity/screens/Verify/index.js +2 -0
- package/build/features/entity/screens/Verify/validation.d.ts +8 -0
- package/build/features/entity/screens/Verify/validation.js +4 -0
- package/build/features/featuresScreens.d.ts +2 -0
- package/build/features/featuresScreens.js +31 -0
- package/build/features/otp/OTP.d.ts +7 -0
- package/build/features/otp/OTP.js +55 -0
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +1 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +6 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.js +47 -0
- package/build/features/otp/screens/OTPVerify/Verify.d.ts +5 -0
- package/build/features/otp/screens/OTPVerify/Verify.js +50 -0
- package/build/features/otp/screens/OTPVerify/index.d.ts +2 -0
- package/build/features/otp/screens/OTPVerify/index.js +2 -0
- package/build/features/otp/screens/OTPVerify/validation.d.ts +8 -0
- package/build/features/otp/screens/OTPVerify/validation.js +4 -0
- package/build/features/shared/Background/Background.d.ts +2 -1
- package/build/features/shared/Background/Background.js +3 -3
- package/build/hooks/useAppDispatch.d.ts +2 -0
- package/build/index.d.ts +4 -2
- package/build/index.js +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
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
|
+
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
|
+
};
|
|
48
|
+
var _a;
|
|
49
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
|
+
import API from '../../../api';
|
|
51
|
+
import { FlowsTypes } from '../../../@types';
|
|
52
|
+
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
|
+
import { OTP_STEP_NAMES } from '../../../constants';
|
|
54
|
+
export var resendOTP = createAsyncThunk('otpResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var otp, payload, data;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
otp = thunkApi.getState().otp;
|
|
60
|
+
payload = {
|
|
61
|
+
service_name: 'tap_email',
|
|
62
|
+
verify_token: otp.data.verify.token
|
|
63
|
+
};
|
|
64
|
+
return [4, API.leadService.verifyLeadToken(payload)];
|
|
65
|
+
case 1:
|
|
66
|
+
data = (_a.sent()).data;
|
|
67
|
+
return [2, { data: data }];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); });
|
|
71
|
+
export var verifyOtpLeadOTP = createAsyncThunk('verifyOtpLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
+
var otp, responseBody, payload;
|
|
73
|
+
var _a;
|
|
74
|
+
return __generator(this, function (_b) {
|
|
75
|
+
otp = thunkApi.getState().otp;
|
|
76
|
+
responseBody = otp.data.verify.responseBody;
|
|
77
|
+
payload = {
|
|
78
|
+
data: params.otp,
|
|
79
|
+
service_name: (_a = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _a === void 0 ? void 0 : _a.service_name,
|
|
80
|
+
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
81
|
+
step_name: OTP_STEP_NAMES.PHONE_AUTH,
|
|
82
|
+
encryption_contract: ['data']
|
|
83
|
+
};
|
|
84
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
85
|
+
return [2, { formData: params }];
|
|
86
|
+
});
|
|
87
|
+
}); });
|
|
88
|
+
var initialState = {
|
|
89
|
+
error: null,
|
|
90
|
+
loading: false,
|
|
91
|
+
customLoading: false,
|
|
92
|
+
data: {
|
|
93
|
+
flowName: FlowsTypes.OTP,
|
|
94
|
+
verify: {
|
|
95
|
+
token: ''
|
|
96
|
+
},
|
|
97
|
+
otpData: {
|
|
98
|
+
otp: ''
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export var otpSlice = createSlice({
|
|
103
|
+
name: 'otp/store',
|
|
104
|
+
initialState: initialState,
|
|
105
|
+
reducers: {
|
|
106
|
+
clearError: function (state) {
|
|
107
|
+
state.error = null;
|
|
108
|
+
},
|
|
109
|
+
stopLoader: function (state) {
|
|
110
|
+
state.loading = false;
|
|
111
|
+
},
|
|
112
|
+
resetOTPScreen: function (state) {
|
|
113
|
+
state.data.otpData.otp = '';
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
extraReducers: function (builder) {
|
|
117
|
+
builder
|
|
118
|
+
.addCase(resendOTP.pending, function (state) {
|
|
119
|
+
state.error = null;
|
|
120
|
+
})
|
|
121
|
+
.addCase(resendOTP.fulfilled, function (state, action) {
|
|
122
|
+
var _a;
|
|
123
|
+
state.error = null;
|
|
124
|
+
var data = action.payload.data;
|
|
125
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
126
|
+
if (description) {
|
|
127
|
+
state.error = description;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
|
|
131
|
+
})
|
|
132
|
+
.addCase(resendOTP.rejected, function (state, action) {
|
|
133
|
+
state.error = action.error.message;
|
|
134
|
+
})
|
|
135
|
+
.addCase(verifyOtpLeadOTP.pending, function (state) {
|
|
136
|
+
state.loading = true;
|
|
137
|
+
state.error = null;
|
|
138
|
+
})
|
|
139
|
+
.addCase(verifyOtpLeadOTP.fulfilled, function (state, action) {
|
|
140
|
+
state.loading = false;
|
|
141
|
+
state.error = null;
|
|
142
|
+
var formData = action.payload.formData;
|
|
143
|
+
state.data.otpData = formData;
|
|
144
|
+
})
|
|
145
|
+
.addCase(verifyOtpLeadOTP.rejected, function (state, action) {
|
|
146
|
+
state.loading = false;
|
|
147
|
+
state.error = action.error.message;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
export var clearError = (_a = otpSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
152
|
+
export default otpSlice.reducer;
|
|
153
|
+
export var otpSelector = function (state) { return state.otp; };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LibConfig } from '../../@types';
|
|
3
|
+
export interface EntityLibProps extends LibConfig {
|
|
4
|
+
}
|
|
5
|
+
export declare function EntityLib(props: EntityLibProps): JSX.Element;
|
|
6
|
+
export declare function renderEntityLib(config: EntityLibProps, elementId: string): void;
|
|
7
|
+
export declare function unmountEntityLib(elementId: string): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 { memo, useEffect } from 'react';
|
|
14
|
+
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
|
|
15
|
+
import { handleLanguage, settingsSelector } from '../../app/settings';
|
|
16
|
+
import AnimationFlow from '../../components/AnimationFlow';
|
|
17
|
+
import { store } from '../../app/store';
|
|
18
|
+
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
19
|
+
import Collapse from '../../components/Collapse';
|
|
20
|
+
import { getParameterByName, reactElement } from '../../utils';
|
|
21
|
+
import { FeatureContainer } from '../shared/Containers';
|
|
22
|
+
import { ENTITY_SCREENS_NAVIGATION } from '../../constants';
|
|
23
|
+
import { entityFeatureScreens } from '../featuresScreens';
|
|
24
|
+
import CustomFooter from '../shared/Footer';
|
|
25
|
+
import { entitySelector, verifyLeadToken } from '../app/entity/entityStore';
|
|
26
|
+
import Background from '../shared/Background';
|
|
27
|
+
var Entity = memo(function (props) {
|
|
28
|
+
var theme = useAppTheme().theme;
|
|
29
|
+
var dispatch = useAppDispatch();
|
|
30
|
+
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, loading = _a.loading;
|
|
31
|
+
var _b = useAppSelector(entitySelector), customLoading = _b.customLoading, entityError = _b.error;
|
|
32
|
+
useAppConfig(__assign({ navigation: ENTITY_SCREENS_NAVIGATION }, props));
|
|
33
|
+
useErrorListener(entityError || error);
|
|
34
|
+
useStepStartedListener();
|
|
35
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
36
|
+
var verifyToken = function () {
|
|
37
|
+
var token = getParameterByName('token');
|
|
38
|
+
var lang = getParameterByName('lang');
|
|
39
|
+
if (lang)
|
|
40
|
+
dispatch(handleLanguage(lang));
|
|
41
|
+
if (!token)
|
|
42
|
+
throw new Error('Auth token is not found!');
|
|
43
|
+
dispatch(verifyLeadToken(token));
|
|
44
|
+
};
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
if (!loading)
|
|
47
|
+
verifyToken();
|
|
48
|
+
}, [loading]);
|
|
49
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: loading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, open: open, error: error, loading: loading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: entityFeatureScreens.map(function (_a, index) {
|
|
50
|
+
var Element = _a.element, name = _a.name;
|
|
51
|
+
var isActive = activeScreen.name === name;
|
|
52
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
53
|
+
}) }) })) })) })));
|
|
54
|
+
});
|
|
55
|
+
export function EntityLib(props) {
|
|
56
|
+
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Entity, __assign({}, props)) })));
|
|
57
|
+
}
|
|
58
|
+
export function renderEntityLib(config, elementId) {
|
|
59
|
+
reactElement(elementId).render(_jsx(EntityLib, __assign({}, config)));
|
|
60
|
+
}
|
|
61
|
+
export function unmountEntityLib(elementId) {
|
|
62
|
+
reactElement(elementId).unmount();
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Entity';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Entity';
|
|
@@ -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 SuccessScreen from '../../../shared/SuccessScreen';
|
|
5
|
+
var ResetPasswordSuccess = function (_a) {
|
|
6
|
+
var t = useTranslation().t;
|
|
7
|
+
return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
|
|
8
|
+
};
|
|
9
|
+
export default React.memo(ResetPasswordSuccess);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
5
|
+
import { updateBoardSuccess, entitySelector } from '../../../app/entity/entityStore';
|
|
6
|
+
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
7
|
+
var Success = function (_a) {
|
|
8
|
+
var t = useTranslation().t;
|
|
9
|
+
var dispatch = useAppDispatch();
|
|
10
|
+
var _b = useAppSelector(entitySelector), loading = _b.loading, error = _b.error;
|
|
11
|
+
var onSuccess = function () {
|
|
12
|
+
dispatch(updateBoardSuccess());
|
|
13
|
+
};
|
|
14
|
+
return (_jsx(SuccessScreen, { title: t('entity_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
|
|
15
|
+
};
|
|
16
|
+
export default React.memo(Success);
|
|
@@ -0,0 +1,109 @@
|
|
|
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 { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useEffect, useState } from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { FlowsButtons } from '../../../shared/Button';
|
|
17
|
+
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
+
import { getResetFlowUrl, showLastFour } from '../../../../utils';
|
|
20
|
+
import { entitySelector } from '../../../app/entity/entityStore';
|
|
21
|
+
import Box from '@mui/material/Box';
|
|
22
|
+
import Text from '../../../../components/Text';
|
|
23
|
+
import Container from '../../../shared/Containers/ScreenContainer';
|
|
24
|
+
import AcceptancePayouts from '../../../shared/AcceptancePayouts';
|
|
25
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
26
|
+
var TitleStyled = styled(Text)(function (_a) {
|
|
27
|
+
var _b;
|
|
28
|
+
var theme = _a.theme;
|
|
29
|
+
return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
|
|
30
|
+
});
|
|
31
|
+
var ContainerStyled = styled(Container)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return ({
|
|
34
|
+
justifyContent: 'space-between',
|
|
35
|
+
minHeight: theme.spacing(30),
|
|
36
|
+
alignItems: 'center'
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return ({
|
|
42
|
+
width: '100%',
|
|
43
|
+
paddingTop: theme.spacing(3)
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
var SuccessWithFlowButtons = function () {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
var t = useTranslation().t;
|
|
49
|
+
var isAr = useLanguage().isAr;
|
|
50
|
+
var data = useAppSelector(entitySelector).data;
|
|
51
|
+
var _d = data.verify.responseBody || {}, flows = _d.flows, nameObj = _d.name, entity = _d.entity, brand = _d.brand, bank = _d.bank, merchant = _d.merchant, identification_id = _d.identification_id, vatID = _d.vatID;
|
|
52
|
+
var _e = useState([]), buttons = _e[0], setButtons = _e[1];
|
|
53
|
+
var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
|
|
54
|
+
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
55
|
+
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
56
|
+
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
57
|
+
var taxID = vatID || '';
|
|
58
|
+
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
59
|
+
var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
|
|
60
|
+
var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
|
|
61
|
+
var maskedId = !!identification_id ? " ".concat(t('masking_symbols')).concat(identification_id) : '';
|
|
62
|
+
var settings = useAppSelector(settingsSelector);
|
|
63
|
+
var _f = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _f.contact, board_id = _f.board_id, board_info_id = _f.board_info_id;
|
|
64
|
+
var email = (contact || { email: '' }).email;
|
|
65
|
+
var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, board_id, board_info_id);
|
|
66
|
+
var reMapFlowData = function (flows) {
|
|
67
|
+
if (flows === void 0) { flows = []; }
|
|
68
|
+
var images = ICONS_NAMES;
|
|
69
|
+
var mappedFlows = flows
|
|
70
|
+
.filter(function (item) { return item.name; })
|
|
71
|
+
.map(function (_a) {
|
|
72
|
+
var name = _a.name, url = _a.url, status = _a.status;
|
|
73
|
+
var type = status === 'initiated' || status === 'in_progress' ? 'pending' : 'completed';
|
|
74
|
+
var title = t("".concat(name, "_flow_").concat(type), {
|
|
75
|
+
individual_name: username.toLowerCase() + maskedId,
|
|
76
|
+
business_type: brandName,
|
|
77
|
+
license_number: t('masking_symbols') + showLastFour(licenseNumber),
|
|
78
|
+
bank_name: bankName,
|
|
79
|
+
iban: t('masking_symbols') + iban,
|
|
80
|
+
tax_id: t('masking_symbols') + showLastFour(taxID)
|
|
81
|
+
});
|
|
82
|
+
var isCompleted = status === 'completed' && name !== 'password';
|
|
83
|
+
var isIndividual = name === 'individual';
|
|
84
|
+
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
85
|
+
var hoverSrc = "".concat(name, "_white_icon");
|
|
86
|
+
return {
|
|
87
|
+
name: name,
|
|
88
|
+
status: status,
|
|
89
|
+
title: title,
|
|
90
|
+
href: url,
|
|
91
|
+
src: images[src],
|
|
92
|
+
hoverSrc: images[hoverSrc],
|
|
93
|
+
isCompleted: isCompleted,
|
|
94
|
+
sx: isIndividual ? { textTransform: 'capitalize' } : {}
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
setButtons(mappedFlows);
|
|
98
|
+
};
|
|
99
|
+
useEffect(function () {
|
|
100
|
+
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
101
|
+
reMapFlowData(flows);
|
|
102
|
+
}, [flows, isAr]);
|
|
103
|
+
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
|
|
104
|
+
flowName: data.flowName,
|
|
105
|
+
email: email,
|
|
106
|
+
emailUrl: url
|
|
107
|
+
} }) })] }));
|
|
108
|
+
};
|
|
109
|
+
export default memo(SuccessWithFlowButtons);
|
|
@@ -0,0 +1,47 @@
|
|
|
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 } from '../../../../hooks';
|
|
21
|
+
import { resendOTP } from '../../../app/entity/entityStore';
|
|
22
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return ({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
fontFamily: theme.typography.fontFamily
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
var OTPInput = function (_a) {
|
|
31
|
+
var loading = _a.loading, setLoading = _a.setLoading;
|
|
32
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
33
|
+
var t = useTranslation().t;
|
|
34
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var handleOnOTPChange = function (otp) {
|
|
37
|
+
otpControl.field.onChange(otp);
|
|
38
|
+
};
|
|
39
|
+
var handleOnResendOTP = function () {
|
|
40
|
+
if (otpControl.field.value)
|
|
41
|
+
setValue('otp', '', { shouldValidate: true });
|
|
42
|
+
dispatch(resendOTP());
|
|
43
|
+
};
|
|
44
|
+
var otpValue = otpControl.field.value;
|
|
45
|
+
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, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
|
+
};
|
|
47
|
+
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,78 @@
|
|
|
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 } 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 { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
22
|
+
import { maskPhone } from '../../../../utils';
|
|
23
|
+
import Form from '../../../../components/Form';
|
|
24
|
+
import Text from '../../../../components/Text';
|
|
25
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
|
+
import { entitySelector, clearError, resetOTPScreen, verifyEntityLeadOTP } from '../../../app/entity/entityStore';
|
|
27
|
+
import Button from '../../../shared/Button';
|
|
28
|
+
import { OTPValidation } from './validation';
|
|
29
|
+
import OTPInput from './OTPInput';
|
|
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.75 }));
|
|
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(entitySelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
53
|
+
var methods = useForm({
|
|
54
|
+
resolver: yupResolver(OTPValidation),
|
|
55
|
+
defaultValues: data.otpData,
|
|
56
|
+
mode: 'onChange'
|
|
57
|
+
});
|
|
58
|
+
var t = useTranslation().t;
|
|
59
|
+
var isAr = useLanguage().isAr;
|
|
60
|
+
var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
|
|
61
|
+
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
if (error && methods.formState.isValid && phone)
|
|
64
|
+
dispatch(clearError());
|
|
65
|
+
return function () {
|
|
66
|
+
dispatch(resetOTPScreen());
|
|
67
|
+
};
|
|
68
|
+
}, [methods.formState.isValid]);
|
|
69
|
+
var onSubmit = function (formData) {
|
|
70
|
+
dispatch(verifyEntityLeadOTP(formData));
|
|
71
|
+
};
|
|
72
|
+
var onBack = function () {
|
|
73
|
+
dispatch(handlePrevScreenStep());
|
|
74
|
+
};
|
|
75
|
+
var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
|
|
76
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
|
+
};
|
|
78
|
+
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
|
+
}>>>;
|
|
@@ -6,3 +6,5 @@ export declare const individualFeatureScreens: Array<FeatureScreenStep>;
|
|
|
6
6
|
export declare const bankFeatureScreens: Array<FeatureScreenStep>;
|
|
7
7
|
export declare const taxFeatureScreens: Array<FeatureScreenStep>;
|
|
8
8
|
export declare const signInFeatureScreens: Array<FeatureScreenStep>;
|
|
9
|
+
export declare const entityFeatureScreens: Array<FeatureScreenStep>;
|
|
10
|
+
export declare const otpFeatureScreens: Array<FeatureScreenStep>;
|