@tap-payments/auth-jsconnect 2.5.8-test → 2.5.9-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/app/settings.js +7 -3
- package/build/hooks/useAppConfig.js +2 -12
- package/build/utils/common.d.ts +1 -0
- package/build/utils/common.js +10 -0
- package/package.json +1 -1
package/build/app/settings.js
CHANGED
|
@@ -47,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
var _a;
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
|
-
import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, isKW, isSA, getParameterByName } from '../utils';
|
|
50
|
+
import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, isKW, isSA, getParameterByName, setBaseUrl } from '../utils';
|
|
51
51
|
import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
|
|
52
52
|
import i18n from '../i18n';
|
|
53
53
|
import { updateLocale } from '../utils/locale';
|
|
@@ -70,7 +70,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
70
70
|
setAxiosGlobalHeaders({
|
|
71
71
|
bi: visitorId || '',
|
|
72
72
|
mdn: encryptString(params.mdn || window.location.origin),
|
|
73
|
-
authorization:
|
|
73
|
+
authorization: configInfo.publicKey
|
|
74
74
|
});
|
|
75
75
|
initPayload = __assign(__assign({ type: 'website', app_client_version: 'js-auth-connect', requirer_browser: "".concat(client === null || client === void 0 ? void 0 : client.name, " , ").concat(client === null || client === void 0 ? void 0 : client.version), os: "".concat(os === null || os === void 0 ? void 0 : os.name, " , ").concat(os === null || os === void 0 ? void 0 : os.version), locale: language }, (configToken && { config_token: configToken })), { data_required: {
|
|
76
76
|
country_list: !disableCountries
|
|
@@ -87,8 +87,12 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
87
87
|
matureData = maturity_1 ? 'full' : 'express';
|
|
88
88
|
thunkApi.dispatch(handleSetAppConfig(configInfo));
|
|
89
89
|
thunkApi.dispatch(handleLanguage(language_1 || lang));
|
|
90
|
-
if (public_key)
|
|
90
|
+
if (public_key) {
|
|
91
|
+
if (configToken) {
|
|
92
|
+
setBaseUrl(public_key);
|
|
93
|
+
}
|
|
91
94
|
thunkApi.dispatch(handlePublicKey(public_key));
|
|
95
|
+
}
|
|
92
96
|
if (typeof board_maturity === 'boolean')
|
|
93
97
|
thunkApi.dispatch(handelBoardMaturity(board_maturity));
|
|
94
98
|
onVerifyConfigTokenSuccess === null || onVerifyConfigTokenSuccess === void 0 ? void 0 : onVerifyConfigTokenSuccess(config);
|
|
@@ -24,21 +24,11 @@ import { useEffect } from 'react';
|
|
|
24
24
|
import { handleActiveFlowScreens, handleSetAppConfig, handleLanguage, handleOpen, handleIsTapOrigin, fetchAppSettingsSync, handelBoardMaturity, settingsSelector } from '../app/settings';
|
|
25
25
|
import { useAppDispatch } from './useAppDispatch';
|
|
26
26
|
import { useAppSelector } from './useAppSelector';
|
|
27
|
-
import {
|
|
28
|
-
import { isTapDomain, removeRequestHeaders } from '../utils';
|
|
29
|
-
import { ENDPOINT_PATHS } from '../constants';
|
|
27
|
+
import { isTapDomain, removeRequestHeaders, setBaseUrl } from '../utils';
|
|
30
28
|
export var useAppConfig = function (_a) {
|
|
31
29
|
var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, disableCountries = _a.disableCountries, disableLocale = _a.disableLocale, disableSettingFetching = _a.disableSettingFetching, maturity = _a.maturity, boardMaturity = _a.boardMaturity, configToken = _a.configToken, onVerifyConfigTokenSuccess = _a.onVerifyConfigTokenSuccess, rest = __rest(_a, ["appInfo", "navigation", "publicKey", "disableCountries", "disableLocale", "disableSettingFetching", "maturity", "boardMaturity", "configToken", "onVerifyConfigTokenSuccess"]);
|
|
32
30
|
var dispatch = useAppDispatch();
|
|
33
31
|
var data = useAppSelector(settingsSelector).data;
|
|
34
|
-
var setBaseUrl = function () {
|
|
35
|
-
var isProd = publicKey.includes('pk_live');
|
|
36
|
-
if (isProd) {
|
|
37
|
-
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
|
|
41
|
-
};
|
|
42
32
|
var setAppConfig = function () {
|
|
43
33
|
dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey }, rest)));
|
|
44
34
|
dispatch(handleActiveFlowScreens(navigation));
|
|
@@ -56,7 +46,7 @@ export var useAppConfig = function (_a) {
|
|
|
56
46
|
if (!disableSettingFetching)
|
|
57
47
|
removeRequestHeaders();
|
|
58
48
|
checkDomain();
|
|
59
|
-
setBaseUrl();
|
|
49
|
+
setBaseUrl(publicKey);
|
|
60
50
|
setAppConfig();
|
|
61
51
|
if (typeof boardMaturity === 'boolean')
|
|
62
52
|
dispatch(handelBoardMaturity(boardMaturity));
|
package/build/utils/common.d.ts
CHANGED
package/build/utils/common.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { axiosInstance } from '../api';
|
|
2
|
+
import { ENDPOINT_PATHS } from '../constants';
|
|
1
3
|
export var sleep = function (milliseconds) {
|
|
2
4
|
if (milliseconds === void 0) { milliseconds = 1000; }
|
|
3
5
|
return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
|
|
@@ -8,3 +10,11 @@ export var dangerousMessage = function (message, callBack) {
|
|
|
8
10
|
}
|
|
9
11
|
callBack === null || callBack === void 0 ? void 0 : callBack({ message: message });
|
|
10
12
|
};
|
|
13
|
+
export var setBaseUrl = function (publicKey) {
|
|
14
|
+
var isProd = publicKey.includes('pk_live');
|
|
15
|
+
if (isProd) {
|
|
16
|
+
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
|
|
20
|
+
};
|