@tap-payments/auth-jsconnect 2.8.39-test → 2.8.41-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/constants/app.js +6 -0
- package/build/features/app/password/passwordStore.d.ts +5 -1
- package/build/features/app/password/passwordStore.js +51 -45
- package/build/features/featuresScreens.js +5 -0
- package/build/features/password/Password.js +72 -29
- package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
- package/build/features/password/screens/PrepareDataLoading/PrepareDataLoading.js +10 -0
- package/build/features/password/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/password/screens/PrepareDataLoading/index.js +2 -0
- package/build/hooks/useVerifyToken.d.ts +1 -1
- package/package.json +1 -1
package/build/constants/app.js
CHANGED
|
@@ -469,6 +469,12 @@ export var PASSWORD_SCREENS_NAVIGATION = [
|
|
|
469
469
|
prev: 'PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
470
470
|
order: 1
|
|
471
471
|
},
|
|
472
|
+
{
|
|
473
|
+
name: 'PASSWORD_LOADING_DATA_STEP',
|
|
474
|
+
next: 'PASSWORD_CREATE_PASSWORD_STEP',
|
|
475
|
+
prev: 'PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
476
|
+
order: 1
|
|
477
|
+
},
|
|
472
478
|
{
|
|
473
479
|
name: 'PASSWORD_CREATE_PASSWORD_STEP',
|
|
474
480
|
next: ['PASSWORD_SUCCESS_STEP', 'PASSWORD_RESET_PASSWORD_OTP_STEP'],
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { FlowsTypes, OTPFormValues, PasswordCreateFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
|
+
interface verifyLeadTokenProps {
|
|
4
|
+
token: string;
|
|
5
|
+
isInternally?: boolean;
|
|
6
|
+
}
|
|
3
7
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
8
|
data: any;
|
|
5
9
|
token: string;
|
|
6
|
-
},
|
|
10
|
+
}, verifyLeadTokenProps, {}>;
|
|
7
11
|
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
8
12
|
data: any;
|
|
9
13
|
}, void, {}>;
|
|
@@ -51,50 +51,56 @@ import API from '../../../api';
|
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
52
|
import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
53
53
|
import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
|
|
54
|
-
import { retrieveIndividualData } from '../../../utils';
|
|
55
|
-
export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
verify_token: token
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
54
|
+
import { retrieveIndividualData, sleep } from '../../../utils';
|
|
55
|
+
export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (_a, thunkApi) {
|
|
56
|
+
var token = _a.token, isInternally = _a.isInternally;
|
|
57
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
+
var payload, data, _b, config, board_info_password_status, country_code, board_id, countryIso2, publicKey, data_1;
|
|
59
|
+
var _c, _d;
|
|
60
|
+
return __generator(this, function (_e) {
|
|
61
|
+
switch (_e.label) {
|
|
62
|
+
case 0:
|
|
63
|
+
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
64
|
+
notification: {
|
|
65
|
+
sms: false
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
return [4, API.leadService.verifyLeadToken(payload)];
|
|
69
|
+
case 1:
|
|
70
|
+
data = (_e.sent()).data;
|
|
71
|
+
if (((_c = data === null || data === void 0 ? void 0 : data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
72
|
+
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
73
|
+
if (isInternally)
|
|
74
|
+
data.step_name = PASSWORD_STEP_NAMES.PASSWORD_INFO;
|
|
75
|
+
_b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.board_id;
|
|
76
|
+
countryIso2 = country_code;
|
|
77
|
+
if (countryIso2)
|
|
78
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
79
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
80
|
+
if (publicKey)
|
|
81
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
82
|
+
if (!!country_code) return [3, 3];
|
|
83
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
84
|
+
case 2:
|
|
85
|
+
data_1 = _e.sent();
|
|
86
|
+
if ((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.country)
|
|
87
|
+
thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
|
|
88
|
+
_e.label = 3;
|
|
89
|
+
case 3:
|
|
90
|
+
if (data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH) {
|
|
91
|
+
thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
|
|
92
|
+
}
|
|
93
|
+
else if (board_info_password_status === 'completed') {
|
|
94
|
+
thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
95
|
+
}
|
|
96
|
+
else if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
|
|
97
|
+
thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
|
|
98
|
+
}
|
|
99
|
+
return [2, { data: data, token: token }];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
96
102
|
});
|
|
97
|
-
});
|
|
103
|
+
});
|
|
98
104
|
export var resendOTP = createAsyncThunk('resendOTPPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
105
|
var password, payload, data;
|
|
100
106
|
return __generator(this, function (_a) {
|
|
@@ -199,7 +205,7 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
|
|
|
199
205
|
return [4, API.authService.createPassword(requestBody)];
|
|
200
206
|
case 1:
|
|
201
207
|
data = _f.sent();
|
|
202
|
-
thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
|
|
208
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP')); });
|
|
203
209
|
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
|
|
204
210
|
return [2, { data: data, formData: params }];
|
|
205
211
|
}
|
|
@@ -346,7 +352,7 @@ export var resetPassword = createAsyncThunk('resetPassword', function (params, t
|
|
|
346
352
|
if ((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length)
|
|
347
353
|
throw new Error(data.errors[0].description);
|
|
348
354
|
if (!(data === null || data === void 0 ? void 0 : data.errors)) {
|
|
349
|
-
thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
|
|
355
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP')); });
|
|
350
356
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, payload);
|
|
351
357
|
}
|
|
352
358
|
return [2, { data: data, formData: __assign(__assign({}, params), passwordData) }];
|
|
@@ -58,6 +58,7 @@ import BusVerifyPACIScreen from './business/screens/VerifyPACI';
|
|
|
58
58
|
import BrandVerifyScreen from './business/screens/BrandDetails';
|
|
59
59
|
import PasswordVerifyPage from './password/screens/Verify';
|
|
60
60
|
import CreatePasswordPage from './password/screens/CreatePassword';
|
|
61
|
+
import PasswordDataLoadingPage from './password/screens/PrepareDataLoading';
|
|
61
62
|
import PasswordOTPPage from './password/screens/OTP';
|
|
62
63
|
import SuccessPasswordPage from './password/screens/Success';
|
|
63
64
|
import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
|
|
@@ -342,6 +343,10 @@ export var passwordFeatureScreens = [
|
|
|
342
343
|
name: 'PASSWORD_CREATE_PASSWORD_STEP',
|
|
343
344
|
element: CreatePasswordPage
|
|
344
345
|
},
|
|
346
|
+
{
|
|
347
|
+
name: 'PASSWORD_LOADING_DATA_STEP',
|
|
348
|
+
element: PasswordDataLoadingPage
|
|
349
|
+
},
|
|
345
350
|
{
|
|
346
351
|
name: 'PASSWORD_RESET_PASSWORD_OTP_STEP',
|
|
347
352
|
element: PasswordOTPPage
|
|
@@ -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)
|
|
@@ -21,10 +57,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
57
|
return t;
|
|
22
58
|
};
|
|
23
59
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { memo
|
|
60
|
+
import { memo } from 'react';
|
|
25
61
|
import { createRoot } from 'react-dom/client';
|
|
26
|
-
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
|
|
27
|
-
import {
|
|
62
|
+
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useVerifyToken } from '../../hooks';
|
|
63
|
+
import { settingsSelector } from '../../app/settings';
|
|
28
64
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
29
65
|
import { store } from '../../app/store';
|
|
30
66
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -44,33 +80,40 @@ var Password = memo(function (_a) {
|
|
|
44
80
|
useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION, disableSettingFetching: props.mode === 'content' ? false : !!verifyToken || !!configToken }, props));
|
|
45
81
|
useErrorListener(passwordError || error);
|
|
46
82
|
useStepStartedListener();
|
|
47
|
-
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
|
|
48
|
-
var handleVerifyToken = function () {
|
|
49
|
-
var token =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
83
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress, featureScreensNavigation = data.featureScreensNavigation;
|
|
84
|
+
var handleVerifyToken = function (_a) {
|
|
85
|
+
var token = _a.token, isInternally = _a.isInternally;
|
|
86
|
+
return function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
|
+
var operationType, boardId, boardInfoId, userId, userType;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
operationType = getParameterByName('operation_type');
|
|
90
|
+
boardId = getParameterByName('board_id') || '';
|
|
91
|
+
boardInfoId = getParameterByName('board_info_id') || '';
|
|
92
|
+
userId = getParameterByName('user_id') || '';
|
|
93
|
+
userType = getParameterByName('user_type') || '';
|
|
94
|
+
sendPageView({
|
|
95
|
+
title: 'Password'
|
|
96
|
+
});
|
|
97
|
+
if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
|
|
98
|
+
dispatch(verifyOperationToken({ token: token, boardId: boardId, boardInfoId: boardInfoId, userId: userId, userType: userType }));
|
|
99
|
+
return [2];
|
|
100
|
+
}
|
|
101
|
+
dispatch(verifyLeadToken({ token: token, isInternally: isInternally }));
|
|
102
|
+
return [2];
|
|
103
|
+
});
|
|
104
|
+
}); };
|
|
68
105
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
106
|
+
useVerifyToken({
|
|
107
|
+
verify: handleVerifyToken,
|
|
108
|
+
loadingScreenName: 'PASSWORD_LOADING_DATA_STEP',
|
|
109
|
+
navigation: featureScreensNavigation,
|
|
110
|
+
open: open,
|
|
111
|
+
mode: props.mode,
|
|
112
|
+
internalToken: verifyToken,
|
|
113
|
+
settingLoading: settingLoading
|
|
114
|
+
});
|
|
115
|
+
var initialLoading = verifyToken && props.mode !== 'content' ? settingLoading : settingLoading || customLoading;
|
|
116
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ mode: props.mode, open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: initialLoading, error: error, open: open, breakpoint: 'sm', loaderColor: loaderColor, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, type: props.mode === 'content' ? 'CONTENT' : undefined, dialogEdgeFormat: data.appConfig.dialogEdgeFormat }, { children: _jsx(FeatureContainer, __assign({ mode: props.mode, isMaturityExpress: isMaturityExpress }, { children: passwordFeatureScreens.map(function (_a, index) {
|
|
74
117
|
var Element = _a.element, name = _a.name;
|
|
75
118
|
var isActive = activeScreen.name === name;
|
|
76
119
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useAppSelector } from '../../../../hooks';
|
|
4
|
+
import DataLoading from '../../../shared/DataLoading';
|
|
5
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
6
|
+
export var PrepareDataLoading = function () {
|
|
7
|
+
var error = useAppSelector(individualSelector).error;
|
|
8
|
+
return _jsx(DataLoading, { error: error });
|
|
9
|
+
};
|
|
10
|
+
export default memo(PrepareDataLoading);
|