@tap-payments/auth-jsconnect 2.11.18-development → 2.11.20-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/account.d.ts +2 -2
- package/build/api/account.js +7 -4
- package/build/api/headers.d.ts +5 -0
- package/build/api/headers.js +3 -0
- package/build/api/index.d.ts +3 -3
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +5 -2
- package/build/features/app/auth/authStore.js +14 -14
- package/build/features/app/terminal/terminalStore.js +36 -11
- package/build/utils/error.d.ts +1 -0
- package/build/utils/error.js +3 -0
- package/package.json +1 -1
package/build/api/account.d.ts
CHANGED
|
@@ -19,8 +19,8 @@ export declare type ExpressCreateAccountBody = {
|
|
|
19
19
|
declare const accountService: {
|
|
20
20
|
createAccount: (data: CreateAccountBody) => Promise<any>;
|
|
21
21
|
expressCreateAccount: (data: ExpressCreateAccountBody) => Promise<any>;
|
|
22
|
-
checkAccountAvailability: (individualId: string) => Promise<any>;
|
|
23
|
-
checkAccountAvailabilityStatus: (individualId: string) => Promise<any>;
|
|
22
|
+
checkAccountAvailability: (individualId: string, authSession?: string) => Promise<any>;
|
|
23
|
+
checkAccountAvailabilityStatus: (individualId: string, authSession?: string) => Promise<any>;
|
|
24
24
|
checkMigrationStatus: (jobId: string) => Promise<any>;
|
|
25
25
|
};
|
|
26
26
|
export { accountService };
|
package/build/api/account.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ENDPOINT_PATHS } from '../constants';
|
|
2
2
|
import { httpClient } from './axios';
|
|
3
|
+
import { getAuthHeaders } from './headers';
|
|
3
4
|
var createAccount = function (data) {
|
|
4
5
|
return httpClient({
|
|
5
6
|
method: 'post',
|
|
@@ -14,16 +15,18 @@ var expressCreateAccount = function (data) {
|
|
|
14
15
|
data: data
|
|
15
16
|
});
|
|
16
17
|
};
|
|
17
|
-
var checkAccountAvailability = function (individualId) {
|
|
18
|
+
var checkAccountAvailability = function (individualId, authSession) {
|
|
18
19
|
return httpClient({
|
|
19
20
|
method: 'get',
|
|
20
|
-
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts")
|
|
21
|
+
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts"),
|
|
22
|
+
headers: getAuthHeaders(authSession)
|
|
21
23
|
});
|
|
22
24
|
};
|
|
23
|
-
var checkAccountAvailabilityStatus = function (individualId) {
|
|
25
|
+
var checkAccountAvailabilityStatus = function (individualId, authSession) {
|
|
24
26
|
return httpClient({
|
|
25
27
|
method: 'get',
|
|
26
|
-
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts?data=status")
|
|
28
|
+
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(individualId, "/accounts?data=status"),
|
|
29
|
+
headers: getAuthHeaders(authSession)
|
|
27
30
|
});
|
|
28
31
|
};
|
|
29
32
|
var checkMigrationStatus = function (jobId) {
|
package/build/api/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare const API: {
|
|
|
21
21
|
};
|
|
22
22
|
operatorService: {
|
|
23
23
|
validateOperator: (body: ValidateOperatorBody) => Promise<any>;
|
|
24
|
-
confirm: (data: ConfirmBody) => Promise<any>;
|
|
24
|
+
confirm: (data: ConfirmBody, authSession?: string) => Promise<any>;
|
|
25
25
|
};
|
|
26
26
|
countryService: {
|
|
27
27
|
getCountries: (disableCountries?: boolean | undefined) => Promise<any> | {
|
|
@@ -91,8 +91,8 @@ declare const API: {
|
|
|
91
91
|
accountService: {
|
|
92
92
|
createAccount: (data: CreateAccountBody) => Promise<any>;
|
|
93
93
|
expressCreateAccount: (data: ExpressCreateAccountBody) => Promise<any>;
|
|
94
|
-
checkAccountAvailability: (individualId: string) => Promise<any>;
|
|
95
|
-
checkAccountAvailabilityStatus: (individualId: string) => Promise<any>;
|
|
94
|
+
checkAccountAvailability: (individualId: string, authSession?: string | undefined) => Promise<any>;
|
|
95
|
+
checkAccountAvailabilityStatus: (individualId: string, authSession?: string | undefined) => Promise<any>;
|
|
96
96
|
checkMigrationStatus: (jobId: string) => Promise<any>;
|
|
97
97
|
};
|
|
98
98
|
dataService: {
|
package/build/api/operator.d.ts
CHANGED
|
@@ -17,6 +17,6 @@ export declare type ConfirmBody = {
|
|
|
17
17
|
};
|
|
18
18
|
declare const operatorService: {
|
|
19
19
|
validateOperator: (body: ValidateOperatorBody) => Promise<any>;
|
|
20
|
-
confirm: (data: ConfirmBody) => Promise<any>;
|
|
20
|
+
confirm: (data: ConfirmBody, authSession?: string) => Promise<any>;
|
|
21
21
|
};
|
|
22
22
|
export { operatorService };
|
package/build/api/operator.js
CHANGED
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import { ENDPOINT_PATHS } from '../constants';
|
|
38
38
|
import { httpClient } from './axios';
|
|
39
|
+
import { getAuthHeaders } from './headers';
|
|
39
40
|
var validateOperator = function (body) { return __awaiter(void 0, void 0, void 0, function () {
|
|
40
41
|
var data, error_1;
|
|
41
42
|
return __generator(this, function (_a) {
|
|
@@ -59,11 +60,13 @@ var validateOperator = function (body) { return __awaiter(void 0, void 0, void 0
|
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
}); };
|
|
62
|
-
var confirm = function (data) {
|
|
63
|
+
var confirm = function (data, authSession) {
|
|
64
|
+
if (authSession === void 0) { authSession = ''; }
|
|
63
65
|
return httpClient({
|
|
64
66
|
method: 'post',
|
|
65
67
|
url: "".concat(ENDPOINT_PATHS.CONNECT, "/confirm"),
|
|
66
|
-
data: data
|
|
68
|
+
data: data,
|
|
69
|
+
headers: getAuthHeaders(authSession)
|
|
67
70
|
});
|
|
68
71
|
};
|
|
69
72
|
var operatorService = {
|
|
@@ -681,36 +681,36 @@ export var checkMigrationStatus = createAsyncThunk('auth/checkMigrationStatus',
|
|
|
681
681
|
});
|
|
682
682
|
}); });
|
|
683
683
|
export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailability', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
684
|
-
var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, authId, accountData,
|
|
685
|
-
var
|
|
686
|
-
return __generator(this, function (
|
|
687
|
-
switch (
|
|
684
|
+
var _a, settings, auth, authConfigData, authDataHasValue, isDataHasIndividualOnly, data, _b, authId, auth_session, accountData, _c, step_name, brands, entities, brandList, entityList, isExistingUser;
|
|
685
|
+
var _d;
|
|
686
|
+
return __generator(this, function (_e) {
|
|
687
|
+
switch (_e.label) {
|
|
688
688
|
case 0:
|
|
689
689
|
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
690
690
|
authConfigData = settings.data.appConfig.data;
|
|
691
691
|
authDataHasValue = authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length;
|
|
692
692
|
isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
|
|
693
|
-
data = (
|
|
694
|
-
|
|
693
|
+
data = (_d = auth.data.responseData) === null || _d === void 0 ? void 0 : _d.authResponse;
|
|
694
|
+
_b = data || {}, authId = _b.id, auth_session = _b.auth_session;
|
|
695
695
|
accountData = undefined;
|
|
696
696
|
if (!isDataHasIndividualOnly) return [3, 2];
|
|
697
|
-
return [4, API.accountService.checkAccountAvailabilityStatus(data === null || data === void 0 ? void 0 : data.individual_id)];
|
|
697
|
+
return [4, API.accountService.checkAccountAvailabilityStatus(data === null || data === void 0 ? void 0 : data.individual_id, auth_session)];
|
|
698
698
|
case 1:
|
|
699
|
-
accountData =
|
|
699
|
+
accountData = _e.sent();
|
|
700
700
|
return [3, 4];
|
|
701
|
-
case 2: return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
|
|
701
|
+
case 2: return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id, auth_session)];
|
|
702
702
|
case 3:
|
|
703
|
-
accountData =
|
|
704
|
-
|
|
703
|
+
accountData = _e.sent();
|
|
704
|
+
_e.label = 4;
|
|
705
705
|
case 4:
|
|
706
|
-
|
|
706
|
+
_c = accountData || {}, step_name = _c.step_name, brands = _c.brands, entities = _c.entities;
|
|
707
707
|
brandList = brands || [];
|
|
708
708
|
entityList = entities || [];
|
|
709
709
|
isExistingUser = step_name === 'select_account';
|
|
710
710
|
if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 6];
|
|
711
711
|
return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
|
|
712
712
|
case 5:
|
|
713
|
-
|
|
713
|
+
_e.sent();
|
|
714
714
|
return [2, { brandList: brandList, entityList: entityList }];
|
|
715
715
|
case 6:
|
|
716
716
|
if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
|
|
@@ -807,7 +807,7 @@ export var confirmInfo = createAsyncThunk('auth/confirmInfo', function (_a, thun
|
|
|
807
807
|
entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || '',
|
|
808
808
|
data: settings.data.appConfig.data || []
|
|
809
809
|
};
|
|
810
|
-
return [4, API.operatorService.confirm(body)];
|
|
810
|
+
return [4, API.operatorService.confirm(body, authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_session)];
|
|
811
811
|
case 1:
|
|
812
812
|
data = _k.sent();
|
|
813
813
|
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, data);
|
|
@@ -51,11 +51,11 @@ import { handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../
|
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
52
|
import { CONNECT_FLOWS, NAFATH_PACI_TIMEOUT_DURATION, SELECTED_POS_DEFAULT_INFO, SELECTED_TERMINAL_DEFAULT_INFO, TERMINAL_PUSH_NOTIFICATION_DURATION, TERMINAL_PUSH_NOTIFICATION_FAILED, TERMINAL_STEP_NAMES } from '../../../constants';
|
|
53
53
|
import API from '../../../api';
|
|
54
|
-
import { isAuthenticationVerificationFailed, isNetworkError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
|
|
54
|
+
import { isAuthenticationVerificationFailed, isNetworkError, isNoDataFoundError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
|
|
55
55
|
export var verifyToken = createAsyncThunk('terminal/verifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, _b, step_name, merchant_id, config, country_code, publicKey, terminalData,
|
|
58
|
+
var payload, data, _b, step_name, merchant_id, config, country_code, publicKey, nextScreen, terminalData, err_1;
|
|
59
59
|
var _c;
|
|
60
60
|
return __generator(this, function (_d) {
|
|
61
61
|
switch (_d.label) {
|
|
@@ -79,16 +79,28 @@ export var verifyToken = createAsyncThunk('terminal/verifyLeadToken', function (
|
|
|
79
79
|
if (step_name === TERMINAL_STEP_NAMES.PHONE_AUTH) {
|
|
80
80
|
return [2, { data: data, token: token, nextScreen: CONNECT_FLOWS.terminal.verify }];
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
nextScreen = CONNECT_FLOWS.terminal.terminalDeviceList;
|
|
83
|
+
terminalData = undefined;
|
|
84
|
+
_d.label = 2;
|
|
83
85
|
case 2:
|
|
86
|
+
_d.trys.push([2, 4, , 5]);
|
|
87
|
+
return [4, API.terminalService.retrieveTerminalList([merchant_id])];
|
|
88
|
+
case 3:
|
|
84
89
|
terminalData = _d.sent();
|
|
85
90
|
nextScreen = ((_c = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _c === void 0 ? void 0 : _c.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
86
|
-
return [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
return [3, 5];
|
|
92
|
+
case 4:
|
|
93
|
+
err_1 = _d.sent();
|
|
94
|
+
if (!isNoDataFoundError(err_1 === null || err_1 === void 0 ? void 0 : err_1.message))
|
|
95
|
+
throw new Error(err_1);
|
|
96
|
+
nextScreen = CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
97
|
+
return [3, 5];
|
|
98
|
+
case 5: return [2, {
|
|
99
|
+
data: data,
|
|
100
|
+
token: token,
|
|
101
|
+
terminalData: terminalData,
|
|
102
|
+
nextScreen: nextScreen
|
|
103
|
+
}];
|
|
92
104
|
}
|
|
93
105
|
});
|
|
94
106
|
});
|
|
@@ -111,7 +123,7 @@ export var resendOTP = createAsyncThunk('terminal/resendOTP', function (params,
|
|
|
111
123
|
});
|
|
112
124
|
}); });
|
|
113
125
|
export var verifyTokenOTP = createAsyncThunk('terminal/verifyOtp', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
114
|
-
var _a, terminal, settings, authData, payload, data, _b, config, country_code, merchant_id, publicKey, countryIso2, terminalData,
|
|
126
|
+
var _a, terminal, settings, authData, payload, data, _b, config, country_code, merchant_id, publicKey, countryIso2, nextScreen, terminalData, err_2;
|
|
115
127
|
var _c, _d, _e, _f;
|
|
116
128
|
return __generator(this, function (_g) {
|
|
117
129
|
switch (_g.label) {
|
|
@@ -135,10 +147,23 @@ export var verifyTokenOTP = createAsyncThunk('terminal/verifyOtp', function (par
|
|
|
135
147
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
136
148
|
if (countryIso2)
|
|
137
149
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
138
|
-
|
|
150
|
+
nextScreen = CONNECT_FLOWS.terminal.terminalDeviceList;
|
|
151
|
+
terminalData = undefined;
|
|
152
|
+
_g.label = 2;
|
|
139
153
|
case 2:
|
|
154
|
+
_g.trys.push([2, 4, , 5]);
|
|
155
|
+
return [4, API.terminalService.retrieveTerminalList([merchant_id])];
|
|
156
|
+
case 3:
|
|
140
157
|
terminalData = _g.sent();
|
|
141
158
|
nextScreen = ((_d = terminalData === null || terminalData === void 0 ? void 0 : terminalData.list) === null || _d === void 0 ? void 0 : _d.length) ? CONNECT_FLOWS.terminal.terminalDeviceList : CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
159
|
+
return [3, 5];
|
|
160
|
+
case 4:
|
|
161
|
+
err_2 = _g.sent();
|
|
162
|
+
if (!isNoDataFoundError(err_2 === null || err_2 === void 0 ? void 0 : err_2.message))
|
|
163
|
+
throw new Error(err_2);
|
|
164
|
+
nextScreen = CONNECT_FLOWS.terminal.noTerminalLinked;
|
|
165
|
+
return [3, 5];
|
|
166
|
+
case 5:
|
|
142
167
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
143
168
|
return [2, { data: data, terminalData: terminalData, formData: params, nextScreen: nextScreen }];
|
|
144
169
|
}
|
package/build/utils/error.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export declare const isTokenExpired: (error: string | null) => boolean;
|
|
|
3
3
|
export declare const isTimeoutError: (error: string | null) => boolean;
|
|
4
4
|
export declare const isInternalServerError: (error: string | null) => boolean;
|
|
5
5
|
export declare const isAuthenticationVerificationFailed: (error: string | null) => boolean;
|
|
6
|
+
export declare const isNoDataFoundError: (error: string | null) => boolean;
|
package/build/utils/error.js
CHANGED
|
@@ -13,3 +13,6 @@ export var isInternalServerError = function (error) {
|
|
|
13
13
|
export var isAuthenticationVerificationFailed = function (error) {
|
|
14
14
|
return ['failed to verify the auth'].includes((error || '').trim().toLowerCase());
|
|
15
15
|
};
|
|
16
|
+
export var isNoDataFoundError = function (error) {
|
|
17
|
+
return ['no data found'].includes((error || '').trim().toLowerCase());
|
|
18
|
+
};
|