@tap-payments/auth-jsconnect 2.0.0 → 2.0.3
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 +2 -2
- package/build/api/auth.d.ts +2 -0
- package/build/api/axios.d.ts +2 -0
- package/build/api/axios.js +65 -0
- package/build/api/country.d.ts +1 -2
- package/build/api/country.js +7 -8
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +5 -2
- package/build/api/index.d.ts +4 -5
- package/build/api/ip.d.ts +1 -1
- package/build/api/ip.js +5 -2
- package/build/api/lead.d.ts +2 -0
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +60 -4
- package/build/app/settings.d.ts +9 -12
- package/build/app/settings.js +87 -111
- package/build/components/AnimationFlow/Loader.js +1 -1
- package/build/components/DatePicker/customStyle.css +86 -86
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +1 -0
- package/build/features/app/bank/bankStore.js +2 -2
- package/build/features/app/business/businessStore.d.ts +1 -7
- package/build/features/app/business/businessStore.js +4 -41
- package/build/features/app/connect/connectStore.d.ts +1 -7
- package/build/features/app/connect/connectStore.js +11 -45
- package/build/features/app/individual/individualStore.d.ts +1 -6
- package/build/features/app/individual/individualStore.js +15 -46
- package/build/features/app/password/passwordStore.js +2 -2
- package/build/features/app/tax/taxStore.js +2 -2
- package/build/features/bank/Bank.js +3 -3
- package/build/features/business/Business.js +4 -7
- package/build/features/connect/Connect.js +3 -7
- package/build/features/connect/screens/Merchant/BrandName.js +3 -2
- package/build/features/connect/screens/Mobile/Mobile.js +1 -1
- package/build/features/individual/Individual.js +4 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -2
- package/build/features/password/Password.js +3 -3
- package/build/features/shared/Background/Background.js +3 -2
- package/build/features/shared/Background/LogoBackground.d.ts +1 -4
- package/build/features/shared/Background/LogoBackground.js +4 -32
- package/build/features/shared/Button/FlowsButtons.js +3 -2
- package/build/features/shared/Footer/Footer.js +2 -3
- package/build/features/tax/Tax.js +3 -3
- package/build/hooks/useAppConfig.d.ts +1 -4
- package/build/hooks/useAppConfig.js +13 -110
- package/build/index.css +135 -135
- package/build/utils/array.d.ts +3 -0
- package/build/utils/array.js +10 -0
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
|
@@ -143,14 +143,14 @@ export interface Entry {
|
|
|
143
143
|
version: string;
|
|
144
144
|
}
|
|
145
145
|
export interface DeviceInfo {
|
|
146
|
-
source: 'browser|app';
|
|
146
|
+
source: 'browser' | 'app';
|
|
147
147
|
device: DeviceDetails;
|
|
148
148
|
browser: BrowserDetails;
|
|
149
149
|
app: AppInfo & {
|
|
150
150
|
language?: string;
|
|
151
151
|
};
|
|
152
152
|
connection: Connection;
|
|
153
|
-
entry
|
|
153
|
+
entry?: Entry;
|
|
154
154
|
}
|
|
155
155
|
export interface LocalProps {
|
|
156
156
|
[country: string]: {
|
package/build/api/auth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { LanguageMode } from '../@types';
|
|
2
3
|
export declare type MobileCredential = {
|
|
3
4
|
code: string;
|
|
4
5
|
phone: string;
|
|
@@ -17,6 +18,7 @@ export declare type CreateAuthBody = {
|
|
|
17
18
|
sign_in: boolean;
|
|
18
19
|
step_name: string;
|
|
19
20
|
encryption_contract: Array<string>;
|
|
21
|
+
lang?: LanguageMode;
|
|
20
22
|
};
|
|
21
23
|
export declare type VerifyAuthBody = {
|
|
22
24
|
auth_token: string;
|
package/build/api/axios.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
1
2
|
declare const instance: import("axios").AxiosInstance;
|
|
2
3
|
export declare const setAxiosGlobalHeaders: (headers: Record<string, string>) => void;
|
|
3
4
|
export declare const removeAxiosGlobalHeaders: (arr: Array<string>) => void;
|
|
5
|
+
export declare const httpClient: (config: AxiosRequestConfig) => Promise<any>;
|
|
4
6
|
export default instance;
|
package/build/api/axios.js
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
1
37
|
import axios from 'axios';
|
|
2
38
|
import { get, set } from 'lodash-es';
|
|
3
39
|
import { ENCRYPTION_FLAG } from '../constants';
|
|
@@ -33,11 +69,40 @@ var encryptionContractTransformer = function (config) {
|
|
|
33
69
|
export var setAxiosGlobalHeaders = function (headers) {
|
|
34
70
|
Object.keys(headers).forEach(function (key) {
|
|
35
71
|
instance.defaults.headers.common[key] = headers[key];
|
|
72
|
+
axios.defaults.headers.common[key] = headers[key];
|
|
36
73
|
});
|
|
37
74
|
};
|
|
38
75
|
export var removeAxiosGlobalHeaders = function (arr) {
|
|
39
76
|
arr.forEach(function (key) {
|
|
40
77
|
delete instance.defaults.headers.common[key];
|
|
78
|
+
delete axios.defaults.headers.common[key];
|
|
41
79
|
});
|
|
42
80
|
};
|
|
81
|
+
export var httpClient = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
+
var data, _a, description, error, err_1, response, data, _b, description, error;
|
|
83
|
+
var _c, _d;
|
|
84
|
+
return __generator(this, function (_e) {
|
|
85
|
+
switch (_e.label) {
|
|
86
|
+
case 0:
|
|
87
|
+
_e.trys.push([0, 2, , 3]);
|
|
88
|
+
return [4, instance(config)];
|
|
89
|
+
case 1:
|
|
90
|
+
data = (_e.sent()).data;
|
|
91
|
+
_a = ((_c = data.errors) === null || _c === void 0 ? void 0 : _c[0]) || {}, description = _a.description, error = _a.error;
|
|
92
|
+
if (description || error) {
|
|
93
|
+
throw new Error(description, error);
|
|
94
|
+
}
|
|
95
|
+
return [2, data];
|
|
96
|
+
case 2:
|
|
97
|
+
err_1 = _e.sent();
|
|
98
|
+
response = err_1.response;
|
|
99
|
+
data = (response || {}).data;
|
|
100
|
+
if (typeof data === 'string')
|
|
101
|
+
throw new Error(data);
|
|
102
|
+
_b = ((_d = data.errors) === null || _d === void 0 ? void 0 : _d[0]) || {}, description = _b.description, error = _b.error;
|
|
103
|
+
throw new Error(description || error || 'Something went wrong');
|
|
104
|
+
case 3: return [2];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); };
|
|
43
108
|
export default instance;
|
package/build/api/country.d.ts
CHANGED
package/build/api/country.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { httpClient } from './axios';
|
|
2
2
|
import { ENDPOINT_PATHS } from '../constants';
|
|
3
|
-
var
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
var getCountries = function () {
|
|
4
|
+
return httpClient({
|
|
5
|
+
method: 'post',
|
|
6
|
+
url: ENDPOINT_PATHS.COUNTRIES
|
|
7
|
+
});
|
|
8
8
|
};
|
|
9
9
|
var countryService = {
|
|
10
|
-
|
|
11
|
-
getAllCountries: getAllCountries
|
|
10
|
+
getCountries: getCountries
|
|
12
11
|
};
|
|
13
12
|
export { countryService };
|
package/build/api/firebase.d.ts
CHANGED
package/build/api/firebase.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
1
|
import { ENDPOINT_PATHS } from '../constants';
|
|
2
|
+
import { httpClient } from './axios';
|
|
3
3
|
var getLocale = function () {
|
|
4
|
-
return
|
|
4
|
+
return httpClient({
|
|
5
|
+
method: 'get',
|
|
6
|
+
url: ENDPOINT_PATHS.FIREBASE_URL
|
|
7
|
+
});
|
|
5
8
|
};
|
|
6
9
|
var firebaseService = {
|
|
7
10
|
getLocale: getLocale
|
package/build/api/index.d.ts
CHANGED
|
@@ -8,14 +8,13 @@ import { CreateAccountBody } from './account';
|
|
|
8
8
|
import { BrandListBody } from './individual';
|
|
9
9
|
declare const API: {
|
|
10
10
|
ipService: {
|
|
11
|
-
getIP: () => Promise<
|
|
11
|
+
getIP: () => Promise<any>;
|
|
12
12
|
};
|
|
13
13
|
operatorService: {
|
|
14
|
-
validateOperator: (body: ValidateOperatorBody) => Promise<
|
|
14
|
+
validateOperator: (body: ValidateOperatorBody) => Promise<any>;
|
|
15
15
|
};
|
|
16
16
|
countryService: {
|
|
17
|
-
|
|
18
|
-
getAllCountries: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
17
|
+
getCountries: () => Promise<any>;
|
|
19
18
|
};
|
|
20
19
|
authService: {
|
|
21
20
|
createAuth: (data: CreateAuthBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -43,7 +42,7 @@ declare const API: {
|
|
|
43
42
|
checkIbanBank: (data: import("./availabilityServices").CheckIBanBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
44
43
|
};
|
|
45
44
|
firebaseService: {
|
|
46
|
-
getLocale: () => Promise<
|
|
45
|
+
getLocale: () => Promise<any>;
|
|
47
46
|
};
|
|
48
47
|
accountService: {
|
|
49
48
|
createAccount: (data: CreateAccountBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
package/build/api/ip.d.ts
CHANGED
package/build/api/ip.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ENDPOINT_PATHS } from '../constants';
|
|
2
|
-
import
|
|
2
|
+
import { httpClient } from './axios';
|
|
3
3
|
var getIP = function () {
|
|
4
|
-
return
|
|
4
|
+
return httpClient({
|
|
5
|
+
method: 'get',
|
|
6
|
+
url: ENDPOINT_PATHS.IP
|
|
7
|
+
});
|
|
5
8
|
};
|
|
6
9
|
var ipService = {
|
|
7
10
|
getIP: getIP
|
package/build/api/lead.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { LanguageMode } from '../@types';
|
|
2
3
|
declare type Name = {
|
|
3
4
|
title?: string;
|
|
4
5
|
first?: string;
|
|
@@ -60,6 +61,7 @@ export declare type UpdateLeadBody = {
|
|
|
60
61
|
name: string;
|
|
61
62
|
url: string;
|
|
62
63
|
}[];
|
|
64
|
+
lang?: LanguageMode;
|
|
63
65
|
};
|
|
64
66
|
export declare type LeadVerifyBody = {
|
|
65
67
|
verify_token: string;
|
package/build/api/operator.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export declare type ValidateOperatorBody = {
|
|
|
7
7
|
connect_pkey?: string;
|
|
8
8
|
};
|
|
9
9
|
declare const operatorService: {
|
|
10
|
-
validateOperator: (body: ValidateOperatorBody) => Promise<
|
|
10
|
+
validateOperator: (body: ValidateOperatorBody) => Promise<any>;
|
|
11
11
|
};
|
|
12
12
|
export { operatorService };
|
package/build/api/operator.js
CHANGED
|
@@ -1,8 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
5
36
|
};
|
|
37
|
+
import { ENDPOINT_PATHS } from '../constants';
|
|
38
|
+
import { httpClient } from './axios';
|
|
39
|
+
var validateOperator = function (body) { return __awaiter(void 0, void 0, void 0, function () {
|
|
40
|
+
var data, error_1;
|
|
41
|
+
return __generator(this, function (_a) {
|
|
42
|
+
switch (_a.label) {
|
|
43
|
+
case 0:
|
|
44
|
+
_a.trys.push([0, 2, , 3]);
|
|
45
|
+
return [4, httpClient({
|
|
46
|
+
method: 'post',
|
|
47
|
+
url: ENDPOINT_PATHS.OPERATOR,
|
|
48
|
+
data: body
|
|
49
|
+
})];
|
|
50
|
+
case 1:
|
|
51
|
+
data = _a.sent();
|
|
52
|
+
if (data !== 'valid')
|
|
53
|
+
throw new Error('invalid operator');
|
|
54
|
+
return [2, data];
|
|
55
|
+
case 2:
|
|
56
|
+
error_1 = _a.sent();
|
|
57
|
+
throw new Error(error_1);
|
|
58
|
+
case 3: return [2];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}); };
|
|
6
62
|
var operatorService = {
|
|
7
63
|
validateOperator: validateOperator
|
|
8
64
|
};
|
package/build/app/settings.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { RootState } from './store';
|
|
2
|
-
import { ActionState, LanguageMode, SharedState, ThemeMode, ScreenStepNavigation, DeviceInfo,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
os: import("device-detector-js/dist/parsers/operating-system").Result;
|
|
10
|
-
appInfo: AppInfo;
|
|
11
|
-
}, AppInfo, {}>;
|
|
12
|
-
export declare const getOperator: import("@reduxjs/toolkit").AsyncThunk<any, ValidateOperatorBody, {}>;
|
|
13
|
-
export declare const getLocale: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
2
|
+
import { ActionState, LanguageMode, SharedState, ThemeMode, ScreenStepNavigation, DeviceInfo, LibConfig, CountryCode } from '../@types';
|
|
3
|
+
export declare const fetchAppSettingsSync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
+
countries: CountryCode[];
|
|
5
|
+
businessCountry: CountryCode;
|
|
6
|
+
locale: any;
|
|
7
|
+
deviceInfo: DeviceInfo;
|
|
8
|
+
}, void, {}>;
|
|
14
9
|
export interface SettingsData {
|
|
15
10
|
skin: ThemeMode;
|
|
16
11
|
language: LanguageMode;
|
|
@@ -20,6 +15,8 @@ export interface SettingsData {
|
|
|
20
15
|
appConfig: LibConfig;
|
|
21
16
|
open: boolean;
|
|
22
17
|
isTapOrigin: boolean;
|
|
18
|
+
businessCountry: CountryCode;
|
|
19
|
+
countries: Array<CountryCode>;
|
|
23
20
|
}
|
|
24
21
|
export interface SettingsState extends SharedState<SettingsData> {
|
|
25
22
|
}
|
package/build/app/settings.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
13
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
14
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -36,60 +47,78 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
47
|
};
|
|
37
48
|
var _a;
|
|
38
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
39
|
-
import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint } from '../utils';
|
|
40
|
-
import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
|
|
50
|
+
import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString } from '../utils';
|
|
51
|
+
import { defaultCountry, DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
|
|
41
52
|
import i18n from '../i18n';
|
|
42
53
|
import { updateLocale } from '../utils/locale';
|
|
43
|
-
import API from '../api';
|
|
44
|
-
export var
|
|
45
|
-
var
|
|
46
|
-
return __generator(this, function (
|
|
47
|
-
switch (
|
|
48
|
-
case 0: return [4, API.ipService.getIP()];
|
|
49
|
-
case 1:
|
|
50
|
-
data = (_a.sent()).data;
|
|
51
|
-
return [2, data];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}); });
|
|
55
|
-
export var getBrowserFingerPrint = createAsyncThunk('getBrowserFingerPrint', function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var _a, client, device, os, fingerPrint;
|
|
57
|
-
return __generator(this, function (_b) {
|
|
58
|
-
switch (_b.label) {
|
|
54
|
+
import API, { setAxiosGlobalHeaders } from '../api';
|
|
55
|
+
export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
+
var settings, _a, appConfig, language, _b, client, device, os, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, countries, businessCountry;
|
|
57
|
+
return __generator(this, function (_e) {
|
|
58
|
+
switch (_e.label) {
|
|
59
59
|
case 0:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var data;
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
switch (_a.label) {
|
|
72
|
-
case 0: return [4, API.operatorService.validateOperator(params)];
|
|
73
|
-
case 1:
|
|
74
|
-
data = (_a.sent()).data;
|
|
75
|
-
return [2, data];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}); });
|
|
79
|
-
export var getLocale = createAsyncThunk('getLocale', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var data;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0: return [4, API.firebaseService.getLocale()];
|
|
60
|
+
settings = thunkApi.getState().settings;
|
|
61
|
+
_a = settings.data, appConfig = _a.appConfig, language = _a.language;
|
|
62
|
+
_b = getBrowserInfo(), client = _b.client, device = _b.device, os = _b.os;
|
|
63
|
+
return [4, Promise.all([
|
|
64
|
+
getFingerPrint(),
|
|
65
|
+
API.ipService.getIP(),
|
|
66
|
+
API.firebaseService.getLocale(),
|
|
67
|
+
API.countryService.getCountries()
|
|
68
|
+
])];
|
|
84
69
|
case 1:
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
_c = _e.sent(), visitorId = _c[0].visitorId, _d = _c[1], ip = _d.ip, latitude = _d.latitude, longitude = _d.longitude, locale = _c[2], list = _c[3].list;
|
|
71
|
+
operatorData = {
|
|
72
|
+
type: 'website',
|
|
73
|
+
app_client_version: 'js-auth-connect',
|
|
74
|
+
requirer_browser: "".concat(client === null || client === void 0 ? void 0 : client.name, " , ").concat(client === null || client === void 0 ? void 0 : client.version),
|
|
75
|
+
os: "".concat(os === null || os === void 0 ? void 0 : os.name, " , ").concat(os === null || os === void 0 ? void 0 : os.version),
|
|
76
|
+
locale: language
|
|
77
|
+
};
|
|
78
|
+
deviceInfo = {
|
|
79
|
+
app: {
|
|
80
|
+
language: appConfig.language || 'en',
|
|
81
|
+
name: appConfig.appInfo.name,
|
|
82
|
+
identifier: appConfig.appInfo.identifier || 'auth-connect',
|
|
83
|
+
version: appConfig.appInfo.version || '2.0.0'
|
|
84
|
+
},
|
|
85
|
+
browser: {
|
|
86
|
+
browser_id: visitorId,
|
|
87
|
+
name: (client === null || client === void 0 ? void 0 : client.name) || '',
|
|
88
|
+
user_agent: window.navigator.userAgent,
|
|
89
|
+
version: (client === null || client === void 0 ? void 0 : client.version) || ''
|
|
90
|
+
},
|
|
91
|
+
device: {
|
|
92
|
+
name: '',
|
|
93
|
+
brand: (device === null || device === void 0 ? void 0 : device.brand) || '',
|
|
94
|
+
model: (device === null || device === void 0 ? void 0 : device.model) || '',
|
|
95
|
+
type: (device === null || device === void 0 ? void 0 : device.type) || '',
|
|
96
|
+
os: {
|
|
97
|
+
name: (os === null || os === void 0 ? void 0 : os.name) || '',
|
|
98
|
+
version: (os === null || os === void 0 ? void 0 : os.version) || ''
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
connection: {
|
|
102
|
+
ip: ip,
|
|
103
|
+
latitude: latitude,
|
|
104
|
+
longitude: longitude,
|
|
105
|
+
mac: ''
|
|
106
|
+
},
|
|
107
|
+
source: 'browser'
|
|
108
|
+
};
|
|
109
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getRequestHeaders(deviceInfo)), { authorization: encryptString(appConfig.publicKey), mdn: encryptString(window.location.origin) }));
|
|
110
|
+
return [4, API.operatorService.validateOperator(operatorData)];
|
|
111
|
+
case 2:
|
|
112
|
+
_e.sent();
|
|
113
|
+
countries = sortCountries(list);
|
|
114
|
+
businessCountry = findCountryByIso2(countries, appConfig.businessCountryCode) || defaultCountry;
|
|
115
|
+
return [2, { countries: countries, businessCountry: businessCountry, locale: locale, deviceInfo: deviceInfo }];
|
|
87
116
|
}
|
|
88
117
|
});
|
|
89
118
|
}); });
|
|
90
119
|
var initialState = {
|
|
91
120
|
error: null,
|
|
92
|
-
loading:
|
|
121
|
+
loading: true,
|
|
93
122
|
data: {
|
|
94
123
|
open: true,
|
|
95
124
|
isTapOrigin: true,
|
|
@@ -98,7 +127,9 @@ var initialState = {
|
|
|
98
127
|
featureScreensNavigation: [],
|
|
99
128
|
activeScreen: {},
|
|
100
129
|
deviceInfo: DefaultDeviceInfo,
|
|
101
|
-
appConfig: {}
|
|
130
|
+
appConfig: {},
|
|
131
|
+
businessCountry: defaultCountry,
|
|
132
|
+
countries: []
|
|
102
133
|
}
|
|
103
134
|
};
|
|
104
135
|
export var settingsSlice = createSlice({
|
|
@@ -186,74 +217,19 @@ export var settingsSlice = createSlice({
|
|
|
186
217
|
}
|
|
187
218
|
},
|
|
188
219
|
extraReducers: function (builder) {
|
|
189
|
-
builder
|
|
190
|
-
.addCase(getClientIp.pending, function (state) {
|
|
191
|
-
state.error = null;
|
|
192
|
-
state.loading = true;
|
|
193
|
-
})
|
|
194
|
-
.addCase(getClientIp.fulfilled, function (state, action) {
|
|
195
|
-
state.error = null;
|
|
196
|
-
state.loading = false;
|
|
197
|
-
var _a = action.payload, ip = _a.ip, latitude = _a.latitude, longitude = _a.longitude;
|
|
198
|
-
state.data.deviceInfo.connection.ip = ip;
|
|
199
|
-
state.data.deviceInfo.connection.latitude = latitude;
|
|
200
|
-
state.data.deviceInfo.connection.longitude = longitude;
|
|
201
|
-
})
|
|
202
|
-
.addCase(getClientIp.rejected, function (state, action) {
|
|
203
|
-
state.error = action.error.message;
|
|
204
|
-
state.loading = false;
|
|
205
|
-
})
|
|
206
|
-
.addCase(getBrowserFingerPrint.pending, function (state) {
|
|
207
|
-
state.loading = true;
|
|
208
|
-
state.error = null;
|
|
209
|
-
})
|
|
210
|
-
.addCase(getBrowserFingerPrint.fulfilled, function (state, action) {
|
|
211
|
-
state.loading = false;
|
|
212
|
-
state.error = null;
|
|
213
|
-
var _a = action.payload, appInfo = _a.appInfo, client = _a.client, device = _a.device, fingerPrint = _a.fingerPrint, os = _a.os;
|
|
214
|
-
state.data.deviceInfo.app.language = state.data.appConfig.language || 'en';
|
|
215
|
-
state.data.deviceInfo.app.name = appInfo.name;
|
|
216
|
-
state.data.deviceInfo.app.version = appInfo.version || '2.0.0';
|
|
217
|
-
state.data.deviceInfo.app.identifier = appInfo.identifier || 'auth-connect-demo';
|
|
218
|
-
state.data.deviceInfo.browser.browser_id = fingerPrint === null || fingerPrint === void 0 ? void 0 : fingerPrint.visitorId;
|
|
219
|
-
state.data.deviceInfo.browser.name = (client === null || client === void 0 ? void 0 : client.name) || '';
|
|
220
|
-
state.data.deviceInfo.browser.user_agent = window.navigator.userAgent;
|
|
221
|
-
state.data.deviceInfo.browser.version = (client === null || client === void 0 ? void 0 : client.version) || '';
|
|
222
|
-
state.data.deviceInfo.device.brand = (device === null || device === void 0 ? void 0 : device.brand) || '';
|
|
223
|
-
state.data.deviceInfo.device.model = (device === null || device === void 0 ? void 0 : device.model) || '';
|
|
224
|
-
state.data.deviceInfo.device.os.name = (os === null || os === void 0 ? void 0 : os.name) || '';
|
|
225
|
-
state.data.deviceInfo.device.os.version = (os === null || os === void 0 ? void 0 : os.version) || '';
|
|
226
|
-
state.data.deviceInfo.device.type = (device === null || device === void 0 ? void 0 : device.type) || '';
|
|
227
|
-
})
|
|
228
|
-
.addCase(getBrowserFingerPrint.rejected, function (state, action) {
|
|
229
|
-
state.loading = false;
|
|
230
|
-
state.loading = false;
|
|
231
|
-
state.error = action.error.message;
|
|
232
|
-
})
|
|
233
|
-
.addCase(getOperator.pending, function (state) {
|
|
234
|
-
state.error = null;
|
|
220
|
+
builder.addCase(fetchAppSettingsSync.pending, function (state) {
|
|
235
221
|
state.loading = true;
|
|
236
|
-
})
|
|
237
|
-
.addCase(getOperator.fulfilled, function (state, action) {
|
|
238
|
-
state.loading = false;
|
|
239
|
-
if (action.payload === 'valid') {
|
|
240
|
-
state.error = null;
|
|
241
|
-
}
|
|
242
|
-
})
|
|
243
|
-
.addCase(getOperator.rejected, function (state, action) {
|
|
244
|
-
state.error = action.error.message;
|
|
245
|
-
state.loading = false;
|
|
246
|
-
})
|
|
247
|
-
.addCase(getLocale.pending, function (state) {
|
|
248
222
|
state.error = null;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
.
|
|
223
|
+
});
|
|
224
|
+
builder.addCase(fetchAppSettingsSync.fulfilled, function (state, action) {
|
|
225
|
+
var _a = action.payload, businessCountry = _a.businessCountry, countries = _a.countries, locale = _a.locale, deviceInfo = _a.deviceInfo;
|
|
226
|
+
state.data.countries = countries;
|
|
227
|
+
state.data.businessCountry = businessCountry;
|
|
228
|
+
state.data.deviceInfo = deviceInfo;
|
|
229
|
+
updateLocale(locale, businessCountry.iso2);
|
|
252
230
|
state.loading = false;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
})
|
|
256
|
-
.addCase(getLocale.rejected, function (state, action) {
|
|
231
|
+
});
|
|
232
|
+
builder.addCase(fetchAppSettingsSync.rejected, function (state, action) {
|
|
257
233
|
state.loading = false;
|
|
258
234
|
state.error = action.error.message;
|
|
259
235
|
});
|
|
@@ -12,5 +12,5 @@ var BoxStyled = styled(Box)(function () { return ({
|
|
|
12
12
|
zIndex: 2
|
|
13
13
|
}); });
|
|
14
14
|
export default function FlowLoading() {
|
|
15
|
-
return (_jsx(BoxStyled, { children: _jsx(Loader, { svgStyle: { width: 60, height: 60 }, innerColor: 'white', outerColor: 'white', toggleAnimation: true }) }));
|
|
15
|
+
return (_jsx(BoxStyled, { children: _jsx(Loader, { style: { width: 60, height: 60 }, svgStyle: { width: 60, height: 60 }, innerColor: 'white', outerColor: 'white', toggleAnimation: true }) }));
|
|
16
16
|
}
|