@tap-payments/auth-jsconnect 2.9.4-development → 2.9.5-beta
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/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +1 -3
- package/build/app/store.d.ts +0 -2
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +2 -0
- package/build/constants/app.d.ts +2 -0
- package/build/constants/app.js +2 -0
- package/build/features/app/auth/authStore.js +17 -12
- package/build/features/app/connect/connectStore.js +13 -9
- package/build/features/app/connectExpress/connectExpressStore.js +18 -13
- package/build/features/app/individual/individualStore.js +1 -0
- package/build/features/app/signIn/signInStore.js +19 -15
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +0 -43
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/index.d.ts +2 -3
- package/build/index.js +2 -4
- package/build/utils/common.js +4 -4
- package/package.json +2 -2
- package/build/features/app/kyc/kycStore.d.ts +0 -121
- package/build/features/app/kyc/kycStore.js +0 -401
- package/build/features/kyc/KYC.d.ts +0 -10
- package/build/features/kyc/KYC.js +0 -99
- package/build/features/kyc/index.d.ts +0 -1
- package/build/features/kyc/index.js +0 -1
- package/build/features/kyc/screens/Loading/Loading.d.ts +0 -4
- package/build/features/kyc/screens/Loading/Loading.js +0 -10
- package/build/features/kyc/screens/Loading/index.d.ts +0 -2
- package/build/features/kyc/screens/Loading/index.js +0 -2
- package/build/features/kyc/screens/OperatorError/OperatorError.d.ts +0 -5
- package/build/features/kyc/screens/OperatorError/OperatorError.js +0 -9
- package/build/features/kyc/screens/OperatorError/index.d.ts +0 -2
- package/build/features/kyc/screens/OperatorError/index.js +0 -2
- package/build/features/kyc/screens/Success/Success.d.ts +0 -5
- package/build/features/kyc/screens/Success/Success.js +0 -19
- package/build/features/kyc/screens/Success/index.d.ts +0 -2
- package/build/features/kyc/screens/Success/index.js +0 -2
- package/build/features/kyc/screens/Terms/Header.d.ts +0 -6
- package/build/features/kyc/screens/Terms/Header.js +0 -36
- package/build/features/kyc/screens/Terms/Terms.d.ts +0 -4
- package/build/features/kyc/screens/Terms/Terms.js +0 -72
- package/build/features/kyc/screens/Terms/index.d.ts +0 -2
- package/build/features/kyc/screens/Terms/index.js +0 -2
- package/build/features/kyc/screens/TokenError/TokenError.d.ts +0 -5
- package/build/features/kyc/screens/TokenError/TokenError.js +0 -9
- package/build/features/kyc/screens/TokenError/index.d.ts +0 -2
- package/build/features/kyc/screens/TokenError/index.js +0 -2
- package/build/features/kyc/screens/Users/Users.d.ts +0 -3
- package/build/features/kyc/screens/Users/Users.js +0 -76
- package/build/features/kyc/screens/Users/index.d.ts +0 -2
- package/build/features/kyc/screens/Users/index.js +0 -2
- package/build/features/kyc/screens/VerifyNafath/VerifyNafath.d.ts +0 -5
- package/build/features/kyc/screens/VerifyNafath/VerifyNafath.js +0 -45
- package/build/features/kyc/screens/VerifyNafath/index.d.ts +0 -3
- package/build/features/kyc/screens/VerifyNafath/index.js +0 -2
- package/build/features/kyc/screens/VerifyPaci/VerifyPACI.d.ts +0 -5
- package/build/features/kyc/screens/VerifyPaci/VerifyPACI.js +0 -44
- package/build/features/kyc/screens/VerifyPaci/index.d.ts +0 -3
- package/build/features/kyc/screens/VerifyPaci/index.js +0 -2
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, FlowsTypes, NIDFormValues, OTPFormValues, SharedState, User } from '../../../@types';
|
|
3
|
-
interface VerifyLeadTokenProps {
|
|
4
|
-
token: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const verifyTokenApi: import("@reduxjs/toolkit").AsyncThunk<{
|
|
7
|
-
data: any;
|
|
8
|
-
userList: any;
|
|
9
|
-
token: string;
|
|
10
|
-
nextScreen: import("../../../constants").KYC_FLOWS;
|
|
11
|
-
}, VerifyLeadTokenProps, {
|
|
12
|
-
state?: unknown;
|
|
13
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
14
|
-
extra?: unknown;
|
|
15
|
-
rejectValue?: unknown;
|
|
16
|
-
serializedErrorType?: unknown;
|
|
17
|
-
pendingMeta?: unknown;
|
|
18
|
-
fulfilledMeta?: unknown;
|
|
19
|
-
rejectedMeta?: unknown;
|
|
20
|
-
}>;
|
|
21
|
-
export declare const createPaciAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
22
|
-
data: any;
|
|
23
|
-
nextScreen: import("../../../constants").KYC_FLOWS;
|
|
24
|
-
}, User, {
|
|
25
|
-
state?: unknown;
|
|
26
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
27
|
-
extra?: unknown;
|
|
28
|
-
rejectValue?: unknown;
|
|
29
|
-
serializedErrorType?: unknown;
|
|
30
|
-
pendingMeta?: unknown;
|
|
31
|
-
fulfilledMeta?: unknown;
|
|
32
|
-
rejectedMeta?: unknown;
|
|
33
|
-
}>;
|
|
34
|
-
export declare const createNafathAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
35
|
-
data: any;
|
|
36
|
-
nextScreen: import("../../../constants").KYC_FLOWS;
|
|
37
|
-
}, User, {
|
|
38
|
-
state?: unknown;
|
|
39
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
40
|
-
extra?: unknown;
|
|
41
|
-
rejectValue?: unknown;
|
|
42
|
-
serializedErrorType?: unknown;
|
|
43
|
-
pendingMeta?: unknown;
|
|
44
|
-
fulfilledMeta?: unknown;
|
|
45
|
-
rejectedMeta?: unknown;
|
|
46
|
-
}>;
|
|
47
|
-
interface verifyNafathParams {
|
|
48
|
-
onSuccess: () => void;
|
|
49
|
-
onFailure?: () => void;
|
|
50
|
-
}
|
|
51
|
-
export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<{
|
|
52
|
-
data: any;
|
|
53
|
-
createAuthData: any;
|
|
54
|
-
nextScreen?: undefined;
|
|
55
|
-
} | {
|
|
56
|
-
data: any;
|
|
57
|
-
nextScreen: import("../../../constants").KYC_FLOWS;
|
|
58
|
-
createAuthData: any;
|
|
59
|
-
}, verifyNafathParams, {
|
|
60
|
-
state?: unknown;
|
|
61
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
62
|
-
extra?: unknown;
|
|
63
|
-
rejectValue?: unknown;
|
|
64
|
-
serializedErrorType?: unknown;
|
|
65
|
-
pendingMeta?: unknown;
|
|
66
|
-
fulfilledMeta?: unknown;
|
|
67
|
-
rejectedMeta?: unknown;
|
|
68
|
-
}>;
|
|
69
|
-
interface verifyPACIParams {
|
|
70
|
-
onSuccess: () => void;
|
|
71
|
-
}
|
|
72
|
-
export declare const verifyPaci: import("@reduxjs/toolkit").AsyncThunk<{
|
|
73
|
-
data: any;
|
|
74
|
-
nextScreen: import("../../../constants").KYC_FLOWS;
|
|
75
|
-
createAuthData: any;
|
|
76
|
-
}, verifyPACIParams, {
|
|
77
|
-
state?: unknown;
|
|
78
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
79
|
-
extra?: unknown;
|
|
80
|
-
rejectValue?: unknown;
|
|
81
|
-
serializedErrorType?: unknown;
|
|
82
|
-
pendingMeta?: unknown;
|
|
83
|
-
fulfilledMeta?: unknown;
|
|
84
|
-
rejectedMeta?: unknown;
|
|
85
|
-
}>;
|
|
86
|
-
export declare const updateKYCSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
87
|
-
data: any;
|
|
88
|
-
} | undefined, void, {
|
|
89
|
-
state?: unknown;
|
|
90
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
91
|
-
extra?: unknown;
|
|
92
|
-
rejectValue?: unknown;
|
|
93
|
-
serializedErrorType?: unknown;
|
|
94
|
-
pendingMeta?: unknown;
|
|
95
|
-
fulfilledMeta?: unknown;
|
|
96
|
-
rejectedMeta?: unknown;
|
|
97
|
-
}>;
|
|
98
|
-
interface ResponseData {
|
|
99
|
-
responseData?: Record<string, any>;
|
|
100
|
-
}
|
|
101
|
-
type VerifyData = {
|
|
102
|
-
token: string;
|
|
103
|
-
};
|
|
104
|
-
export interface KYCData {
|
|
105
|
-
flowName: FlowsTypes;
|
|
106
|
-
verify: VerifyData;
|
|
107
|
-
otpData: OTPFormValues;
|
|
108
|
-
idInfo: NIDFormValues;
|
|
109
|
-
}
|
|
110
|
-
export interface KYCDataState extends SharedState<KYCData & ResponseData> {
|
|
111
|
-
customLoading?: boolean;
|
|
112
|
-
}
|
|
113
|
-
export declare const kycSlice: import("@reduxjs/toolkit").Slice<KYCDataState, {
|
|
114
|
-
clearError: (state: KYCDataState) => void;
|
|
115
|
-
setError(state: KYCDataState, action: ActionState<string>): void;
|
|
116
|
-
stopLoader: (state: KYCDataState) => void;
|
|
117
|
-
}, "kyc/store">;
|
|
118
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"kyc/store/clearError">, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "kyc/store/setError">, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"kyc/store/stopLoader">;
|
|
119
|
-
declare const _default: import("redux").Reducer<KYCDataState, import("redux").AnyAction>;
|
|
120
|
-
export default _default;
|
|
121
|
-
export declare const kycSelector: (state: RootState) => KYCDataState;
|
|
@@ -1,401 +0,0 @@
|
|
|
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 (g && (g = 0, op[0] && (_ = 0)), _) 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 { handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
51
|
-
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { CONNECT_FLOWS, KYC_STEP_NAMES } from '../../../constants';
|
|
53
|
-
import API from '../../../api';
|
|
54
|
-
import { sendCustomEventToGTM, sleep } from '../../../utils';
|
|
55
|
-
export var verifyTokenApi = createAsyncThunk('kyc/verifyTokenApi', function (_a, thunkApi) {
|
|
56
|
-
var token = _a.token;
|
|
57
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, _b, config, country_code, segment_id, boardId, recipient, publicKey, nextScreen, userList, userPayload, users;
|
|
59
|
-
return __generator(this, function (_c) {
|
|
60
|
-
switch (_c.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
payload = {
|
|
63
|
-
service_name: 'tap_email',
|
|
64
|
-
verify_token: token,
|
|
65
|
-
notification: {
|
|
66
|
-
sms: false
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return [4, API.leadService.verifyToken(payload)];
|
|
70
|
-
case 1:
|
|
71
|
-
data = _c.sent();
|
|
72
|
-
_b = data || {}, config = _b.config, country_code = _b.country_code, segment_id = _b.segment_id, boardId = _b.id, recipient = _b.recipient;
|
|
73
|
-
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
74
|
-
nextScreen = CONNECT_FLOWS.kyc.terms;
|
|
75
|
-
userList = [];
|
|
76
|
-
if (country_code)
|
|
77
|
-
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
78
|
-
if (publicKey)
|
|
79
|
-
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
80
|
-
userPayload = {
|
|
81
|
-
page: 1,
|
|
82
|
-
limit: 25,
|
|
83
|
-
is_authorized: recipient.is_authorized,
|
|
84
|
-
segment_ids: [segment_id]
|
|
85
|
-
};
|
|
86
|
-
return [4, API.userService.getUserListUsingSegmentId(userPayload)];
|
|
87
|
-
case 2:
|
|
88
|
-
users = (_c.sent()).users;
|
|
89
|
-
userList = users || [];
|
|
90
|
-
return [2, {
|
|
91
|
-
data: __assign(__assign({}, data), { boardId: boardId }),
|
|
92
|
-
userList: userList,
|
|
93
|
-
token: token,
|
|
94
|
-
nextScreen: nextScreen
|
|
95
|
-
}];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
export var createPaciAuth = createAsyncThunk('kyc/createPaciAuth', function (user, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
101
|
-
var _a, settings, kyc, verifyTokenData, id, requestBody, data, nextScreen;
|
|
102
|
-
var _b, _c;
|
|
103
|
-
return __generator(this, function (_d) {
|
|
104
|
-
switch (_d.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
_a = thunkApi.getState(), settings = _a.settings, kyc = _a.kyc;
|
|
107
|
-
verifyTokenData = (kyc.data.responseData || {}).verifyTokenData;
|
|
108
|
-
id = (user || {}).id;
|
|
109
|
-
requestBody = {
|
|
110
|
-
country: settings.data.businessCountry.iso2,
|
|
111
|
-
lang: settings.data.language,
|
|
112
|
-
is_lead: false,
|
|
113
|
-
scope: 'auth',
|
|
114
|
-
board_id: verifyTokenData === null || verifyTokenData === void 0 ? void 0 : verifyTokenData.boardId,
|
|
115
|
-
user_id: id,
|
|
116
|
-
step_name: KYC_STEP_NAMES.KYC_CREATE_PACI,
|
|
117
|
-
encryption_contract: []
|
|
118
|
-
};
|
|
119
|
-
return [4, API.authService.createAuth(requestBody)];
|
|
120
|
-
case 1:
|
|
121
|
-
data = _d.sent();
|
|
122
|
-
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { id: id });
|
|
123
|
-
nextScreen = CONNECT_FLOWS.kyc.verifyPACI;
|
|
124
|
-
return [2, { data: data, nextScreen: nextScreen }];
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}); });
|
|
128
|
-
export var createNafathAuth = createAsyncThunk('kyc/createNafathAuth', function (user, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
129
|
-
var _a, settings, kyc, verifyTokenData, id, requestBody, data, nextScreen;
|
|
130
|
-
var _b, _c;
|
|
131
|
-
return __generator(this, function (_d) {
|
|
132
|
-
switch (_d.label) {
|
|
133
|
-
case 0:
|
|
134
|
-
_a = thunkApi.getState(), settings = _a.settings, kyc = _a.kyc;
|
|
135
|
-
verifyTokenData = (kyc.data.responseData || {}).verifyTokenData;
|
|
136
|
-
id = (user || {}).id;
|
|
137
|
-
requestBody = {
|
|
138
|
-
country: settings.data.businessCountry.iso2,
|
|
139
|
-
lang: settings.data.language,
|
|
140
|
-
is_lead: false,
|
|
141
|
-
scope: 'auth',
|
|
142
|
-
board_id: verifyTokenData === null || verifyTokenData === void 0 ? void 0 : verifyTokenData.boardId,
|
|
143
|
-
user_id: id,
|
|
144
|
-
step_name: KYC_STEP_NAMES.KYC_CREATE_NAFATH,
|
|
145
|
-
encryption_contract: []
|
|
146
|
-
};
|
|
147
|
-
return [4, API.authService.createAuth(requestBody)];
|
|
148
|
-
case 1:
|
|
149
|
-
data = _d.sent();
|
|
150
|
-
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
|
|
151
|
-
nextScreen = CONNECT_FLOWS.kyc.verifyNafath;
|
|
152
|
-
return [2, { data: data, nextScreen: nextScreen }];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}); });
|
|
156
|
-
export var verifyNafath = createAsyncThunk('kyc/verifyNafath', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
-
var kyc, createAuthData, expiry, interval, maxCalls, count, data, isSuccess, isFailed, nextScreen;
|
|
158
|
-
var _a, _b, _c, _d;
|
|
159
|
-
return __generator(this, function (_e) {
|
|
160
|
-
switch (_e.label) {
|
|
161
|
-
case 0:
|
|
162
|
-
kyc = thunkApi.getState().kyc;
|
|
163
|
-
createAuthData = (kyc.data.responseData || {}).createAuthData;
|
|
164
|
-
expiry = (createAuthData === null || createAuthData === void 0 ? void 0 : createAuthData.expiry) || 120;
|
|
165
|
-
interval = 3;
|
|
166
|
-
maxCalls = Math.floor(expiry / interval);
|
|
167
|
-
count = 1;
|
|
168
|
-
_e.label = 1;
|
|
169
|
-
case 1:
|
|
170
|
-
if (!(count <= maxCalls)) return [3, 7];
|
|
171
|
-
if (thunkApi.signal.aborted) {
|
|
172
|
-
return [3, 7];
|
|
173
|
-
}
|
|
174
|
-
return [4, API.authService.getVerifyAuth(createAuthData === null || createAuthData === void 0 ? void 0 : createAuthData.auth_token)];
|
|
175
|
-
case 2:
|
|
176
|
-
data = _e.sent();
|
|
177
|
-
isSuccess = ((_a = data === null || data === void 0 ? void 0 : data.status) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'success';
|
|
178
|
-
isFailed = ((_b = data === null || data === void 0 ? void 0 : data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'failed';
|
|
179
|
-
if (isFailed) {
|
|
180
|
-
(_c = params.onFailure) === null || _c === void 0 ? void 0 : _c.call(params);
|
|
181
|
-
return [2, { data: data, createAuthData: createAuthData }];
|
|
182
|
-
}
|
|
183
|
-
if (!isSuccess) return [3, 4];
|
|
184
|
-
(_d = params.onSuccess) === null || _d === void 0 ? void 0 : _d.call(params);
|
|
185
|
-
return [4, thunkApi.dispatch(updateKYCSuccess())];
|
|
186
|
-
case 3:
|
|
187
|
-
_e.sent();
|
|
188
|
-
nextScreen = CONNECT_FLOWS.kyc.success;
|
|
189
|
-
return [2, { data: data, nextScreen: nextScreen, createAuthData: createAuthData }];
|
|
190
|
-
case 4: return [4, sleep(interval * 1000)];
|
|
191
|
-
case 5:
|
|
192
|
-
_e.sent();
|
|
193
|
-
_e.label = 6;
|
|
194
|
-
case 6:
|
|
195
|
-
count++;
|
|
196
|
-
return [3, 1];
|
|
197
|
-
case 7: throw new Error('nafath_verification_failed');
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
}); });
|
|
201
|
-
export var verifyPaci = createAsyncThunk('kyc/verifyPaci', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
202
|
-
var kyc, createAuthData, expiry, interval, maxCalls, count, data, isSuccess, nextScreen;
|
|
203
|
-
var _a, _b;
|
|
204
|
-
return __generator(this, function (_c) {
|
|
205
|
-
switch (_c.label) {
|
|
206
|
-
case 0:
|
|
207
|
-
kyc = thunkApi.getState().kyc;
|
|
208
|
-
createAuthData = (kyc.data.responseData || {}).createAuthData;
|
|
209
|
-
expiry = (createAuthData === null || createAuthData === void 0 ? void 0 : createAuthData.expiry) || 120;
|
|
210
|
-
interval = 3;
|
|
211
|
-
maxCalls = Math.floor(expiry / interval);
|
|
212
|
-
count = 1;
|
|
213
|
-
_c.label = 1;
|
|
214
|
-
case 1:
|
|
215
|
-
if (!(count <= maxCalls)) return [3, 7];
|
|
216
|
-
if (thunkApi.signal.aborted) {
|
|
217
|
-
return [3, 7];
|
|
218
|
-
}
|
|
219
|
-
return [4, API.authService.getVerifyAuth(createAuthData === null || createAuthData === void 0 ? void 0 : createAuthData.auth_token)];
|
|
220
|
-
case 2:
|
|
221
|
-
data = _c.sent();
|
|
222
|
-
isSuccess = ((_a = data.status) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'success';
|
|
223
|
-
if (!isSuccess) return [3, 4];
|
|
224
|
-
(_b = params.onSuccess) === null || _b === void 0 ? void 0 : _b.call(params);
|
|
225
|
-
return [4, thunkApi.dispatch(updateKYCSuccess())];
|
|
226
|
-
case 3:
|
|
227
|
-
_c.sent();
|
|
228
|
-
nextScreen = CONNECT_FLOWS.kyc.success;
|
|
229
|
-
return [2, { data: data, nextScreen: nextScreen, createAuthData: createAuthData }];
|
|
230
|
-
case 4: return [4, sleep(interval * 1000)];
|
|
231
|
-
case 5:
|
|
232
|
-
_c.sent();
|
|
233
|
-
_c.label = 6;
|
|
234
|
-
case 6:
|
|
235
|
-
count++;
|
|
236
|
-
return [3, 1];
|
|
237
|
-
case 7: throw new Error('paci_verification_failed');
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}); });
|
|
241
|
-
export var updateKYCSuccess = createAsyncThunk('kyc/updateKYCSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
242
|
-
var _a, settings, kyc, _b, boardId, infoId, payload, data;
|
|
243
|
-
var _c, _d, _e, _f, _g;
|
|
244
|
-
return __generator(this, function (_h) {
|
|
245
|
-
switch (_h.label) {
|
|
246
|
-
case 0:
|
|
247
|
-
_a = thunkApi.getState(), settings = _a.settings, kyc = _a.kyc;
|
|
248
|
-
_b = ((_c = kyc.data.responseData) === null || _c === void 0 ? void 0 : _c.verifyTokenData) || {}, boardId = _b.boardId, infoId = _b.board_info_id;
|
|
249
|
-
if (!boardId)
|
|
250
|
-
return [2];
|
|
251
|
-
payload = {
|
|
252
|
-
lang: settings.data.language,
|
|
253
|
-
step_name: KYC_STEP_NAMES.KYC_COMPLETED,
|
|
254
|
-
id: boardId
|
|
255
|
-
};
|
|
256
|
-
return [4, API.boardService.updateBoardInfo(__assign({ id: boardId, infoId: infoId }, payload))];
|
|
257
|
-
case 1:
|
|
258
|
-
data = _h.sent();
|
|
259
|
-
sendCustomEventToGTM({
|
|
260
|
-
event: 'Send Event',
|
|
261
|
-
event_category: 'Board Flows - KYC',
|
|
262
|
-
event_action: 'KYC Update Success Page',
|
|
263
|
-
event_label: settings.data.businessCountry.iso2
|
|
264
|
-
});
|
|
265
|
-
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
|
|
266
|
-
(_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: data });
|
|
267
|
-
return [2, { data: data }];
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
}); });
|
|
271
|
-
var initialState = {
|
|
272
|
-
error: null,
|
|
273
|
-
loading: false,
|
|
274
|
-
customLoading: false,
|
|
275
|
-
data: {
|
|
276
|
-
flowName: FlowsTypes.CONNECT,
|
|
277
|
-
verify: {
|
|
278
|
-
token: ''
|
|
279
|
-
},
|
|
280
|
-
otpData: {
|
|
281
|
-
otp: ''
|
|
282
|
-
},
|
|
283
|
-
idInfo: {
|
|
284
|
-
nid: '',
|
|
285
|
-
dob: ''
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
export var kycSlice = createSlice({
|
|
290
|
-
name: 'kyc/store',
|
|
291
|
-
initialState: initialState,
|
|
292
|
-
reducers: {
|
|
293
|
-
clearError: function (state) {
|
|
294
|
-
state.error = null;
|
|
295
|
-
},
|
|
296
|
-
setError: function (state, action) {
|
|
297
|
-
state.error = action.payload;
|
|
298
|
-
},
|
|
299
|
-
stopLoader: function (state) {
|
|
300
|
-
state.loading = false;
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
extraReducers: function (builder) {
|
|
304
|
-
builder
|
|
305
|
-
.addCase(verifyTokenApi.pending, function (state) {
|
|
306
|
-
state.error = null;
|
|
307
|
-
state.customLoading = true;
|
|
308
|
-
})
|
|
309
|
-
.addCase(verifyTokenApi.fulfilled, function (state, action) {
|
|
310
|
-
state.error = null;
|
|
311
|
-
state.customLoading = false;
|
|
312
|
-
var _a = action.payload || {}, data = _a.data, token = _a.token, userList = _a.userList;
|
|
313
|
-
state.data.responseData = {
|
|
314
|
-
verifyTokenData: data,
|
|
315
|
-
userList: userList
|
|
316
|
-
};
|
|
317
|
-
state.data.verify.token = token;
|
|
318
|
-
})
|
|
319
|
-
.addCase(verifyTokenApi.rejected, function (state, action) {
|
|
320
|
-
state.error = action.error.message;
|
|
321
|
-
state.customLoading = false;
|
|
322
|
-
})
|
|
323
|
-
.addCase(createNafathAuth.pending, function (state) {
|
|
324
|
-
state.loading = true;
|
|
325
|
-
state.error = null;
|
|
326
|
-
})
|
|
327
|
-
.addCase(createNafathAuth.fulfilled, function (state, action) {
|
|
328
|
-
state.loading = false;
|
|
329
|
-
state.error = null;
|
|
330
|
-
var data = action.payload.data;
|
|
331
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { createAuthData: data });
|
|
332
|
-
})
|
|
333
|
-
.addCase(createNafathAuth.rejected, function (state, action) {
|
|
334
|
-
state.loading = false;
|
|
335
|
-
state.error = action.error.message;
|
|
336
|
-
})
|
|
337
|
-
.addCase(verifyNafath.pending, function (state) {
|
|
338
|
-
state.loading = true;
|
|
339
|
-
state.error = null;
|
|
340
|
-
})
|
|
341
|
-
.addCase(verifyNafath.fulfilled, function (state, action) {
|
|
342
|
-
state.loading = false;
|
|
343
|
-
var data = action.payload.data;
|
|
344
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { verifyAuthData: data });
|
|
345
|
-
})
|
|
346
|
-
.addCase(verifyNafath.rejected, function (state, action) {
|
|
347
|
-
state.loading = false;
|
|
348
|
-
var error = action.error.message;
|
|
349
|
-
if (error !== 'Aborted') {
|
|
350
|
-
state.error = error;
|
|
351
|
-
}
|
|
352
|
-
})
|
|
353
|
-
.addCase(createPaciAuth.pending, function (state) {
|
|
354
|
-
state.loading = true;
|
|
355
|
-
state.error = null;
|
|
356
|
-
})
|
|
357
|
-
.addCase(createPaciAuth.fulfilled, function (state, action) {
|
|
358
|
-
state.loading = false;
|
|
359
|
-
state.error = null;
|
|
360
|
-
var data = action.payload.data;
|
|
361
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { createAuthData: data });
|
|
362
|
-
})
|
|
363
|
-
.addCase(createPaciAuth.rejected, function (state, action) {
|
|
364
|
-
state.loading = false;
|
|
365
|
-
state.error = action.error.message;
|
|
366
|
-
})
|
|
367
|
-
.addCase(verifyPaci.pending, function (state) {
|
|
368
|
-
state.loading = true;
|
|
369
|
-
state.error = null;
|
|
370
|
-
})
|
|
371
|
-
.addCase(verifyPaci.fulfilled, function (state, action) {
|
|
372
|
-
state.loading = false;
|
|
373
|
-
var data = action.payload.data;
|
|
374
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { verifyAuthData: data });
|
|
375
|
-
})
|
|
376
|
-
.addCase(verifyPaci.rejected, function (state, action) {
|
|
377
|
-
state.loading = false;
|
|
378
|
-
var error = action.error.message;
|
|
379
|
-
if (error !== 'Aborted') {
|
|
380
|
-
state.error = error;
|
|
381
|
-
}
|
|
382
|
-
})
|
|
383
|
-
.addCase(updateKYCSuccess.fulfilled, function (state, action) {
|
|
384
|
-
state.loading = false;
|
|
385
|
-
state.error = null;
|
|
386
|
-
var data = (action.payload || {}).data;
|
|
387
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { boardSuccess: data });
|
|
388
|
-
})
|
|
389
|
-
.addCase(updateKYCSuccess.pending, function (state) {
|
|
390
|
-
state.loading = true;
|
|
391
|
-
state.error = null;
|
|
392
|
-
})
|
|
393
|
-
.addCase(updateKYCSuccess.rejected, function (state, action) {
|
|
394
|
-
state.loading = false;
|
|
395
|
-
state.error = action.error.message;
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
export var clearError = (_a = kycSlice.actions, _a.clearError), setError = _a.setError, stopLoader = _a.stopLoader;
|
|
400
|
-
export default kycSlice.reducer;
|
|
401
|
-
export var kycSelector = function (state) { return state.kyc; };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LibConfig } from '../../@types';
|
|
2
|
-
export interface KYCLibProps extends LibConfig {
|
|
3
|
-
verifyToken?: string;
|
|
4
|
-
configToken?: string;
|
|
5
|
-
loaderColor?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function KYCElement(props: KYCLibProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function renderKYCLib(config: KYCLibProps, elementId: string): {
|
|
9
|
-
unmount: () => void;
|
|
10
|
-
};
|
|
@@ -1,99 +0,0 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import React, { memo } from 'react';
|
|
25
|
-
import { createRoot } from 'react-dom/client';
|
|
26
|
-
import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useVerifyToken, useAppDispatch } from '../../hooks';
|
|
27
|
-
import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
|
|
28
|
-
import { store } from '../../app/store';
|
|
29
|
-
import AnimationFlow from '../../components/AnimationFlow';
|
|
30
|
-
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
31
|
-
import Collapse from '../../components/Collapse';
|
|
32
|
-
import { findOrCreateElementAndInject, initializeGTM, sendPageView } from '../../utils';
|
|
33
|
-
import { CONNECT_FLOWS, KYC_SCREENS_NAVIGATION } from '../../constants';
|
|
34
|
-
import { FeatureContainer } from '../shared/Containers';
|
|
35
|
-
import { kycSelector, verifyTokenApi } from '../app/kyc/kycStore';
|
|
36
|
-
import { kycFeatureScreens } from '../featuresScreens';
|
|
37
|
-
import Background from '../shared/Background';
|
|
38
|
-
var KYC = memo(function (_a) {
|
|
39
|
-
var _b, _c;
|
|
40
|
-
var configToken = _a.configToken, verifyToken = _a.verifyToken, loaderColor = _a.loaderColor, props = __rest(_a, ["configToken", "verifyToken", "loaderColor"]);
|
|
41
|
-
var theme = useAppTheme().theme;
|
|
42
|
-
var dispatch = useAppDispatch();
|
|
43
|
-
var _d = useAppSelector(settingsSelector), data = _d.data, error = _d.error, settingLoading = _d.loading;
|
|
44
|
-
var _e = useAppSelector(kycSelector), customLoading = _e.customLoading, kycError = _e.error, loading = _e.loading;
|
|
45
|
-
useAppConfig(__assign(__assign({ navigation: KYC_SCREENS_NAVIGATION }, props), { disableSettingFetching: props.mode === 'content' ? false : !!verifyToken }));
|
|
46
|
-
useErrorListener(kycError || error);
|
|
47
|
-
useStepStartedListener();
|
|
48
|
-
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress, appConfig = data.appConfig;
|
|
49
|
-
var animationDirection = open ? (_b = appConfig.features) === null || _b === void 0 ? void 0 : _b.dialogStartTransition : (_c = appConfig.features) === null || _c === void 0 ? void 0 : _c.dialogEndTransition;
|
|
50
|
-
var verifyTokenAndMoveToNextScreen = function (_a) {
|
|
51
|
-
var token = _a.token;
|
|
52
|
-
return function () {
|
|
53
|
-
dispatch(verifyTokenApi({ token: token }))
|
|
54
|
-
.unwrap()
|
|
55
|
-
.then(function (_a) {
|
|
56
|
-
var nextScreen = _a.nextScreen;
|
|
57
|
-
dispatch(handleCurrentActiveScreen(nextScreen));
|
|
58
|
-
})
|
|
59
|
-
.catch(function (error) {
|
|
60
|
-
if (error.message.toLowerCase() === 'failed to decrypt verify_token') {
|
|
61
|
-
dispatch(handleCurrentActiveScreen(CONNECT_FLOWS.kyc.tokenError));
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
useVerifyToken({
|
|
67
|
-
verify: verifyTokenAndMoveToNextScreen,
|
|
68
|
-
loadingScreenName: CONNECT_FLOWS.kyc.loadingData,
|
|
69
|
-
navigation: featureScreensNavigation,
|
|
70
|
-
open: open,
|
|
71
|
-
mode: props.mode,
|
|
72
|
-
internalToken: verifyToken,
|
|
73
|
-
settingLoading: settingLoading,
|
|
74
|
-
operatorErrorScreenName: CONNECT_FLOWS.kyc.operatorError,
|
|
75
|
-
isValidOperator: data.isValidOperator
|
|
76
|
-
});
|
|
77
|
-
React.useEffect(function () {
|
|
78
|
-
initializeGTM();
|
|
79
|
-
sendPageView({
|
|
80
|
-
title: 'KYC'
|
|
81
|
-
});
|
|
82
|
-
}, []);
|
|
83
|
-
var initialLoading = verifyToken && props.mode !== 'content' ? settingLoading : settingLoading || customLoading;
|
|
84
|
-
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, animationDirection: animationDirection, open: open, error: error, loading: initialLoading, loaderColor: loaderColor, breakpoint: 'sm', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress, type: props.mode === 'content' ? 'CONTENT' : undefined, dialogEdgeFormat: data.appConfig.dialogEdgeFormat, features: appConfig.features }, { children: _jsx(FeatureContainer, __assign({ mode: props.mode, isMaturityExpress: isMaturityExpress }, { children: kycFeatureScreens.map(function (_a, index) {
|
|
85
|
-
var Element = _a.element, name = _a.name;
|
|
86
|
-
var isActive = activeScreen.name === name;
|
|
87
|
-
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
88
|
-
}) })) })) })) })));
|
|
89
|
-
});
|
|
90
|
-
export function KYCElement(props) {
|
|
91
|
-
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(KYC, __assign({}, props)) })));
|
|
92
|
-
}
|
|
93
|
-
export function renderKYCLib(config, elementId) {
|
|
94
|
-
var element = findOrCreateElementAndInject(elementId);
|
|
95
|
-
var root = createRoot(element);
|
|
96
|
-
root.render(_jsx(KYCElement, __assign({}, config)));
|
|
97
|
-
var unmount = function () { return root.unmount(); };
|
|
98
|
-
return { unmount: unmount };
|
|
99
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './KYC';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './KYC';
|
|
@@ -1,10 +0,0 @@
|
|
|
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 { kycSelector } from '../../../app/kyc/kycStore';
|
|
6
|
-
export var Loading = function () {
|
|
7
|
-
var error = useAppSelector(kycSelector).error;
|
|
8
|
-
return _jsx(DataLoading, { error: error });
|
|
9
|
-
};
|
|
10
|
-
export default memo(Loading);
|