@tap-payments/auth-jsconnect 1.0.93-test → 2.0.1

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.
Files changed (48) hide show
  1. package/README.md +2 -2
  2. package/build/@types/app.d.ts +2 -2
  3. package/build/api/auth.d.ts +2 -0
  4. package/build/api/axios.d.ts +2 -0
  5. package/build/api/axios.js +65 -0
  6. package/build/api/country.d.ts +1 -2
  7. package/build/api/country.js +7 -8
  8. package/build/api/firebase.d.ts +1 -1
  9. package/build/api/firebase.js +5 -2
  10. package/build/api/index.d.ts +4 -5
  11. package/build/api/ip.d.ts +1 -1
  12. package/build/api/ip.js +5 -2
  13. package/build/api/lead.d.ts +2 -0
  14. package/build/api/operator.d.ts +1 -1
  15. package/build/api/operator.js +60 -4
  16. package/build/app/settings.d.ts +9 -12
  17. package/build/app/settings.js +87 -111
  18. package/build/components/AnimationFlow/Loader.js +1 -1
  19. package/build/constants/app.d.ts +1 -0
  20. package/build/constants/app.js +1 -0
  21. package/build/features/app/bank/bankStore.js +2 -2
  22. package/build/features/app/business/businessStore.d.ts +1 -7
  23. package/build/features/app/business/businessStore.js +5 -42
  24. package/build/features/app/connect/connectStore.d.ts +1 -7
  25. package/build/features/app/connect/connectStore.js +12 -53
  26. package/build/features/app/individual/individualStore.d.ts +1 -6
  27. package/build/features/app/individual/individualStore.js +16 -47
  28. package/build/features/app/password/passwordStore.js +2 -2
  29. package/build/features/app/tax/taxStore.js +2 -2
  30. package/build/features/bank/Bank.js +3 -3
  31. package/build/features/business/Business.js +4 -7
  32. package/build/features/connect/Connect.js +3 -7
  33. package/build/features/connect/screens/Merchant/BrandName.js +3 -2
  34. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  35. package/build/features/individual/Individual.js +4 -7
  36. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -2
  37. package/build/features/password/Password.js +3 -3
  38. package/build/features/shared/Background/Background.js +3 -2
  39. package/build/features/shared/Background/LogoBackground.d.ts +1 -4
  40. package/build/features/shared/Background/LogoBackground.js +4 -32
  41. package/build/features/shared/Button/FlowsButtons.js +3 -2
  42. package/build/features/shared/Footer/Footer.js +2 -3
  43. package/build/features/tax/Tax.js +3 -3
  44. package/build/hooks/useAppConfig.d.ts +1 -4
  45. package/build/hooks/useAppConfig.js +13 -110
  46. package/build/utils/array.d.ts +3 -0
  47. package/build/utils/array.js +10 -0
  48. package/package.json +1 -1
package/README.md CHANGED
@@ -77,8 +77,8 @@ const App = () => {
77
77
  <meta charset="utf-8" />
78
78
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no" />
79
79
  <title>Auth-JsConnect</title>
80
- <script src="https://auth-jsconnect.b-cdn.net/build-1.0.90-test/main.js"></script>
81
- <link href="https://auth-jsconnect.b-cdn.net/build-1.0.90-test/main.css" rel="stylesheet" />
80
+ <script src="https://auth-jsconnect.b-cdn.net/build-2.0.0/main.js"></script>
81
+ <link href="https://auth-jsconnect.b-cdn.net/build-2.0.0/main.css" rel="stylesheet" />
82
82
  </head>
83
83
  <body>
84
84
  <div id="root"></div>
@@ -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: Entry;
153
+ entry?: Entry;
154
154
  }
155
155
  export interface LocalProps {
156
156
  [country: string]: {
@@ -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;
@@ -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;
@@ -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, description, error_1, response, data, description;
83
+ var _a, _b;
84
+ return __generator(this, function (_c) {
85
+ switch (_c.label) {
86
+ case 0:
87
+ _c.trys.push([0, 2, , 3]);
88
+ return [4, instance(config)];
89
+ case 1:
90
+ data = (_c.sent()).data;
91
+ if (data.errors && Array.isArray(data.errors)) {
92
+ description = ((_a = data.errors) === null || _a === void 0 ? void 0 : _a[0]).description;
93
+ throw new Error(description);
94
+ }
95
+ return [2, data];
96
+ case 2:
97
+ error_1 = _c.sent();
98
+ response = error_1.response;
99
+ data = (response || {}).data;
100
+ if (typeof data === 'string')
101
+ throw new Error(data);
102
+ description = (((_b = data.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
103
+ throw new Error(description || 'Something went wrong');
104
+ case 3: return [2];
105
+ }
106
+ });
107
+ }); };
43
108
  export default instance;
@@ -1,5 +1,4 @@
1
1
  declare const countryService: {
2
- getBusinessCountries: () => Promise<import("axios").AxiosResponse<any, any>>;
3
- getAllCountries: () => Promise<import("axios").AxiosResponse<any, any>>;
2
+ getCountries: () => Promise<any>;
4
3
  };
5
4
  export { countryService };
@@ -1,13 +1,12 @@
1
- import axios from 'axios';
1
+ import { httpClient } from './axios';
2
2
  import { ENDPOINT_PATHS } from '../constants';
3
- var getBusinessCountries = function () {
4
- return axios.get(ENDPOINT_PATHS.BUSINESS_COUNTRIES);
5
- };
6
- var getAllCountries = function () {
7
- return axios.post(ENDPOINT_PATHS.COUNTRIES);
3
+ var getCountries = function () {
4
+ return httpClient({
5
+ method: 'post',
6
+ url: ENDPOINT_PATHS.COUNTRIES
7
+ });
8
8
  };
9
9
  var countryService = {
10
- getBusinessCountries: getBusinessCountries,
11
- getAllCountries: getAllCountries
10
+ getCountries: getCountries
12
11
  };
13
12
  export { countryService };
@@ -1,4 +1,4 @@
1
1
  declare const firebaseService: {
2
- getLocale: () => Promise<import("axios").AxiosResponse<any, any>>;
2
+ getLocale: () => Promise<any>;
3
3
  };
4
4
  export { firebaseService };
@@ -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 axios.get(ENDPOINT_PATHS.FIREBASE_URL);
4
+ return httpClient({
5
+ method: 'get',
6
+ url: ENDPOINT_PATHS.FIREBASE_URL
7
+ });
5
8
  };
6
9
  var firebaseService = {
7
10
  getLocale: getLocale
@@ -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<import("axios").AxiosResponse<any, any>>;
11
+ getIP: () => Promise<any>;
12
12
  };
13
13
  operatorService: {
14
- validateOperator: (body: ValidateOperatorBody) => Promise<import("axios").AxiosResponse<any, any>>;
14
+ validateOperator: (body: ValidateOperatorBody) => Promise<any>;
15
15
  };
16
16
  countryService: {
17
- getBusinessCountries: () => Promise<import("axios").AxiosResponse<any, any>>;
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<import("axios").AxiosResponse<any, any>>;
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
@@ -1,4 +1,4 @@
1
1
  declare const ipService: {
2
- getIP: () => Promise<import("axios").AxiosResponse<any, any>>;
2
+ getIP: () => Promise<any>;
3
3
  };
4
4
  export { ipService };
package/build/api/ip.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { ENDPOINT_PATHS } from '../constants';
2
- import instance from './axios';
2
+ import { httpClient } from './axios';
3
3
  var getIP = function () {
4
- return instance.get(ENDPOINT_PATHS.IP);
4
+ return httpClient({
5
+ method: 'get',
6
+ url: ENDPOINT_PATHS.IP
7
+ });
5
8
  };
6
9
  var ipService = {
7
10
  getIP: getIP
@@ -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;
@@ -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<import("axios").AxiosResponse<any, any>>;
10
+ validateOperator: (body: ValidateOperatorBody) => Promise<any>;
11
11
  };
12
12
  export { operatorService };
@@ -1,8 +1,64 @@
1
- import { ENDPOINT_PATHS } from '../constants';
2
- import instance from './axios';
3
- var validateOperator = function (body) {
4
- return instance.post(ENDPOINT_PATHS.OPERATOR, body);
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
  };
@@ -1,16 +1,11 @@
1
1
  import { RootState } from './store';
2
- import { ActionState, LanguageMode, SharedState, ThemeMode, ScreenStepNavigation, DeviceInfo, AppInfo, LibConfig } from '../@types';
3
- import { ValidateOperatorBody } from '../api';
4
- export declare const getClientIp: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
5
- export declare const getBrowserFingerPrint: import("@reduxjs/toolkit").AsyncThunk<{
6
- fingerPrint: import("@fingerprintjs/fingerprintjs").GetResult;
7
- client: import("device-detector-js/dist/parsers/client").ClientResult;
8
- device: import("device-detector-js/dist/parsers/device").DeviceResult;
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
  }
@@ -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 getClientIp = createAsyncThunk('getClientIp', function () { return __awaiter(void 0, void 0, void 0, function () {
45
- var data;
46
- return __generator(this, function (_a) {
47
- switch (_a.label) {
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
- _a = getBrowserInfo(), client = _a.client, device = _a.device, os = _a.os;
61
- return [4, getFingerPrint()];
62
- case 1:
63
- fingerPrint = _b.sent();
64
- return [2, { fingerPrint: fingerPrint, client: client, device: device, os: os, appInfo: params }];
65
- }
66
- });
67
- }); });
68
- export var getOperator = createAsyncThunk('getOperator', function (params) { return __awaiter(void 0, void 0, void 0, function () {
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
- data = (_a.sent()).data;
86
- return [2, data];
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: false,
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
- state.loading = true;
250
- })
251
- .addCase(getLocale.fulfilled, function (state, action) {
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
- state.error = null;
254
- updateLocale(action.payload, state.data.appConfig.businessCountryCode);
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
  }
@@ -80,6 +80,7 @@ export declare const CONNECT_STEP_NAMES: {
80
80
  CONNECT_SUCCESS: string;
81
81
  };
82
82
  export declare const BUSINESS_STEP_NAMES: {
83
+ BUSINESS_INFO: string;
83
84
  PHONE_AUTH: string;
84
85
  IDENTITY_AUTH: string;
85
86
  IDENTITY_VERIFY_AUTH: string;
@@ -272,6 +272,7 @@ export var CONNECT_STEP_NAMES = {
272
272
  CONNECT_SUCCESS: 'connect_completed'
273
273
  };
274
274
  export var BUSINESS_STEP_NAMES = {
275
+ BUSINESS_INFO: 'business_info',
275
276
  PHONE_AUTH: 'business_phone_auth',
276
277
  IDENTITY_AUTH: 'business_identity_auth',
277
278
  IDENTITY_VERIFY_AUTH: 'business_identity_auth_verify',
@@ -49,7 +49,7 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { hasKey, removeRequestHeaders } from '../../../utils';
52
+ import { hasKey } from '../../../utils';
53
53
  import { handleNextScreenStep } from '../../../app/settings';
54
54
  import { BANK_STEP_NAMES } from '../../../constants';
55
55
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
@@ -211,6 +211,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadBankSuccess', functio
211
211
  if (!id)
212
212
  return [2];
213
213
  payload = {
214
+ lang: settings.data.language,
214
215
  step_name: BANK_STEP_NAMES.BANK_SUCCESS,
215
216
  id: id,
216
217
  encryption_contract: []
@@ -355,7 +356,6 @@ export var bankSlice = createSlice({
355
356
  }
356
357
  var flows = response.flows, steps = response.steps;
357
358
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
358
- removeRequestHeaders();
359
359
  })
360
360
  .addCase(updateLeadSuccess.pending, function (state) {
361
361
  state.loading = true;