wisetrack 2.0.1 → 2.0.2
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/README.md +9 -10
- package/dist/cdn/sdk.bundle.min.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +4 -2
- package/dist/constants/constants.d.ts +0 -20
- package/dist/constants/constants.js +0 -19
- package/dist/constants/constants.js.map +0 -1
- package/dist/constants/endpoints.d.ts +0 -11
- package/dist/constants/endpoints.js +0 -10
- package/dist/constants/endpoints.js.map +0 -1
- package/dist/constants/environments.d.ts +0 -25
- package/dist/constants/environments.js +0 -37
- package/dist/constants/environments.js.map +0 -1
- package/dist/core/caching/queue-data.d.ts +0 -25
- package/dist/core/caching/queue-data.js +0 -50
- package/dist/core/caching/queue-data.js.map +0 -1
- package/dist/core/caching/request-queue-manager.d.ts +0 -54
- package/dist/core/caching/request-queue-manager.js +0 -333
- package/dist/core/caching/request-queue-manager.js.map +0 -1
- package/dist/core/fields/event-fields-builder.d.ts +0 -8
- package/dist/core/fields/event-fields-builder.js +0 -29
- package/dist/core/fields/event-fields-builder.js.map +0 -1
- package/dist/core/fields/fields-builder.d.ts +0 -9
- package/dist/core/fields/fields-builder.js +0 -120
- package/dist/core/fields/fields-builder.js.map +0 -1
- package/dist/core/network/api-client.d.ts +0 -9
- package/dist/core/network/api-client.js +0 -88
- package/dist/core/network/api-client.js.map +0 -1
- package/dist/core/network/network-error.d.ts +0 -17
- package/dist/core/network/network-error.js +0 -35
- package/dist/core/network/network-error.js.map +0 -1
- package/dist/core/network/network-manager.d.ts +0 -22
- package/dist/core/network/network-manager.js +0 -72
- package/dist/core/network/network-manager.js.map +0 -1
- package/dist/core/network/retry-policy.d.ts +0 -8
- package/dist/core/network/retry-policy.js +0 -26
- package/dist/core/network/retry-policy.js.map +0 -1
- package/dist/core/storage/storage-manager.d.ts +0 -52
- package/dist/core/storage/storage-manager.js +0 -221
- package/dist/core/storage/storage-manager.js.map +0 -1
- package/dist/core/wisetrack.d.ts +0 -125
- package/dist/core/wisetrack.js +0 -277
- package/dist/core/wisetrack.js.map +0 -1
- package/dist/core/wt-tracker.d.ts +0 -25
- package/dist/core/wt-tracker.js +0 -239
- package/dist/core/wt-tracker.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/types/config/initial-config.d.ts +0 -43
- package/dist/types/config/initial-config.js +0 -2
- package/dist/types/config/initial-config.js.map +0 -1
- package/dist/types/config/wt-app-settings.d.ts +0 -15
- package/dist/types/config/wt-app-settings.js +0 -25
- package/dist/types/config/wt-app-settings.js.map +0 -1
- package/dist/types/config/wt-config.d.ts +0 -18
- package/dist/types/config/wt-config.js +0 -28
- package/dist/types/config/wt-config.js.map +0 -1
- package/dist/types/event/revenue-currency.d.ts +0 -39
- package/dist/types/event/revenue-currency.js +0 -39
- package/dist/types/event/revenue-currency.js.map +0 -1
- package/dist/types/event/wt-event.d.ts +0 -94
- package/dist/types/event/wt-event.js +0 -93
- package/dist/types/event/wt-event.js.map +0 -1
- package/dist/utils/activity-ticker.d.ts +0 -12
- package/dist/utils/activity-ticker.js +0 -37
- package/dist/utils/activity-ticker.js.map +0 -1
- package/dist/utils/country-finder.d.ts +0 -9
- package/dist/utils/country-finder.js +0 -71
- package/dist/utils/country-finder.js.map +0 -1
- package/dist/utils/crypto-helper.d.ts +0 -4
- package/dist/utils/crypto-helper.js +0 -7
- package/dist/utils/crypto-helper.js.map +0 -1
- package/dist/utils/device-detector.d.ts +0 -41
- package/dist/utils/device-detector.js +0 -101
- package/dist/utils/device-detector.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -36
- package/dist/utils/logger.js +0 -84
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/storage-support.d.ts +0 -16
- package/dist/utils/storage-support.js +0 -86
- package/dist/utils/storage-support.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -5
- package/dist/utils/utils.js +0 -95
- package/dist/utils/utils.js.map +0 -1
- package/dist/utils/webgl-fingerprint.d.ts +0 -7
- package/dist/utils/webgl-fingerprint.js +0 -100
- package/dist/utils/webgl-fingerprint.js.map +0 -1
|
@@ -1,120 +0,0 @@
|
|
|
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
|
-
import { WTConstants } from "../../constants/constants";
|
|
11
|
-
import { countryFinder } from "../../utils/country-finder";
|
|
12
|
-
import { deviceDetector } from "../../utils/device-detector";
|
|
13
|
-
import { storageSupport } from "../../utils/storage-support";
|
|
14
|
-
import { Utils } from "../../utils/utils";
|
|
15
|
-
import { DeviceFingerprint } from "../../utils/webgl-fingerprint";
|
|
16
|
-
import { storageManager } from "../storage/storage-manager";
|
|
17
|
-
/** @internal */
|
|
18
|
-
export class FieldsBuilder {
|
|
19
|
-
build() {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const startTime = window.performance.now();
|
|
22
|
-
let fields = {};
|
|
23
|
-
fields.created_at = new Date().toISOString();
|
|
24
|
-
Object.assign(fields, this.getLocalFields());
|
|
25
|
-
Object.assign(fields, yield this.getApplicationFields());
|
|
26
|
-
Object.assign(fields, this.getDeviceFields());
|
|
27
|
-
fields.time_spent = (window.performance.now() - startTime).toFixed(1);
|
|
28
|
-
if (WTConstants.DEFAULTS.PARAMETERS_VALUE) {
|
|
29
|
-
fields = Object.fromEntries(Object.entries(fields).map(([key, value]) => [
|
|
30
|
-
key,
|
|
31
|
-
value === null || value === undefined
|
|
32
|
-
? WTConstants.DEFAULTS.PARAMETERS_VALUE
|
|
33
|
-
: value,
|
|
34
|
-
]));
|
|
35
|
-
}
|
|
36
|
-
if (!WTConstants.DEFAULTS.PARAMETERS_VALUE) {
|
|
37
|
-
fields = Object.fromEntries(Object.entries(fields).filter(([_, value]) => value !== null && value !== undefined));
|
|
38
|
-
}
|
|
39
|
-
return fields;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
getApplicationFields() {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const storageSupportResult = yield storageSupport.getSupportResult();
|
|
45
|
-
return {
|
|
46
|
-
connectivity_type: navigator.onLine ? "1" : "-1",
|
|
47
|
-
country: yield countryFinder.getCountryCode(),
|
|
48
|
-
package_name: window.location.hostname,
|
|
49
|
-
session_storage_enabled: storageSupportResult.sessionStorage,
|
|
50
|
-
indexed_db_enabled: storageSupportResult.indexedDB,
|
|
51
|
-
local_storage_enabled: storageSupportResult.localStorage,
|
|
52
|
-
session_storage: storageSupport
|
|
53
|
-
.getStorageSizeBytes(sessionStorage)
|
|
54
|
-
.toFixed(0),
|
|
55
|
-
local_storage: storageSupport
|
|
56
|
-
.getStorageSizeBytes(localStorage)
|
|
57
|
-
.toFixed(0),
|
|
58
|
-
web_gl_support: DeviceFingerprint.isWebGLSupported(),
|
|
59
|
-
web_gl_fingerprint: yield DeviceFingerprint.getWebGLFingerprint(),
|
|
60
|
-
web_gl_canvas_fingerprint: yield DeviceFingerprint.getCanvasFingerprint(),
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
getLocalFields() {
|
|
65
|
-
const initialConfig = storageManager.initialConfig;
|
|
66
|
-
if (!initialConfig)
|
|
67
|
-
return {};
|
|
68
|
-
return {
|
|
69
|
-
uuid: storageManager.deviceId,
|
|
70
|
-
app_token: initialConfig.appToken,
|
|
71
|
-
environment: initialConfig.userEnvironment,
|
|
72
|
-
store_name: "other",
|
|
73
|
-
app_version: initialConfig.appVersion,
|
|
74
|
-
push_token: storageManager.pushToken,
|
|
75
|
-
custom_device_id: initialConfig.customDeviceId,
|
|
76
|
-
default_tracker: initialConfig.defaultTracker,
|
|
77
|
-
platform: WTConstants.SDK.PLATFORM,
|
|
78
|
-
framework: initialConfig.appFrameWork.toLowerCase(),
|
|
79
|
-
initiated_by: `${WTConstants.SDK.PLATFORM}_${initialConfig.appFrameWork.toLowerCase()}`,
|
|
80
|
-
initiated_version: WTConstants.SDK.VERSION,
|
|
81
|
-
referrer: Utils.getUTMParamsString(),
|
|
82
|
-
installed_at: storageManager.initialDate,
|
|
83
|
-
session_count: storageManager.sessionCount.toString(),
|
|
84
|
-
session_length: parseInt((storageManager.activeDuration / 1000).toString()).toString(),
|
|
85
|
-
subsession_count: parseInt((storageManager.subSessionCount / 1000).toString()).toString(),
|
|
86
|
-
last_interval: parseInt((storageManager.inactiveDuration / 1000).toString()).toString(),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
getDeviceFields() {
|
|
90
|
-
const deviceInfo = deviceDetector.getDeviceInfo();
|
|
91
|
-
return {
|
|
92
|
-
browser_version: deviceInfo.browser.version,
|
|
93
|
-
device_manufacturer: deviceInfo.device.vendor,
|
|
94
|
-
device_name: deviceInfo.device.model,
|
|
95
|
-
device_type: deviceInfo.device.type,
|
|
96
|
-
os_name: deviceInfo.os.name,
|
|
97
|
-
os_version: deviceInfo.os.version,
|
|
98
|
-
cpu_type: deviceInfo.cpu.architecture,
|
|
99
|
-
web_user_agent: deviceInfo.ua,
|
|
100
|
-
display_height: window.innerHeight.toFixed(0),
|
|
101
|
-
display_width: window.innerWidth.toFixed(0),
|
|
102
|
-
language: navigator.language.split("-")[0],
|
|
103
|
-
screen_density: deviceDetector.screenDensity,
|
|
104
|
-
screen_format: deviceDetector.screenFormat,
|
|
105
|
-
screen_size: deviceDetector.screenSize,
|
|
106
|
-
ui_mode: deviceDetector.uiMode.toString(),
|
|
107
|
-
cpu_lpc: navigator.hardwareConcurrency.toString(),
|
|
108
|
-
ui_style: deviceDetector.uiStyle,
|
|
109
|
-
wout_width: window.outerWidth.toString(),
|
|
110
|
-
wout_height: window.outerHeight.toString(),
|
|
111
|
-
web_engine: deviceInfo.engine.name,
|
|
112
|
-
web_engine_version: deviceInfo.engine.version,
|
|
113
|
-
display_size: deviceDetector.displaySize,
|
|
114
|
-
screen_type: deviceDetector.screenType,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/** @internal */
|
|
119
|
-
export const fieldsBuilder = new FieldsBuilder();
|
|
120
|
-
//# sourceMappingURL=fields-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields-builder.js","sourceRoot":"","sources":["../../../src/core/fields/fields-builder.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,gBAAgB;AAChB,MAAM,OAAO,aAAa;IAClB,KAAK;;YACT,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;YAE3C,IAAI,MAAM,GAAwB,EAAE,CAAC;YACrC,MAAM,CAAC,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAE7C,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,C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c,EAAE,cAAc,CAAC,aAAa;YAC5C,aAAa,EAAE,cAAc,CAAC,YAAY;YAC1C,WAAW,EAAE,cAAc,CAAC,UAAU;YACtC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,QAAQ,EAAE;YACzC,OAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE;YACjD,QAAQ,EAAE,cAAc,CAAC,OAAO;YAChC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE;YACxC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;YAC1C,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI;YAClC,kBAAkB,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO;YAC7C,YAAY,EAAE,cAAc,CAAC,WAAW;YACxC,WAAW,EAAE,cAAc,CAAC,UAAU;SACvC,CAAC;IACJ,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { WTEndpoints } from "../../constants/endpoints";
|
|
2
|
-
import { WTAppSettings } from "../../types/config/wt-app-settings";
|
|
3
|
-
import { WTConfig } from "../../types/config/wt-config";
|
|
4
|
-
/** @internal */
|
|
5
|
-
export declare const apiClient: {
|
|
6
|
-
doGetConfig(): Promise<WTConfig>;
|
|
7
|
-
doGetAppSettings(): Promise<WTAppSettings>;
|
|
8
|
-
doCallRequest(endpoint: WTEndpoints, params: Record<string, any>): Promise<boolean>;
|
|
9
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
import { WTConstants } from "../../constants/constants";
|
|
11
|
-
import { EnvironmentUtils, WTSDKEnvironment } from "../../constants/environments";
|
|
12
|
-
import { WTAppSettings } from "../../types/config/wt-app-settings";
|
|
13
|
-
import { WTConfig } from "../../types/config/wt-config";
|
|
14
|
-
import { storageManager } from "../storage/storage-manager";
|
|
15
|
-
import { networkManager } from "./network-manager";
|
|
16
|
-
/** @internal */
|
|
17
|
-
export const apiClient = {
|
|
18
|
-
doGetConfig() {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const initialConfig = storageManager.initialConfig;
|
|
21
|
-
if (!initialConfig) {
|
|
22
|
-
throw "Initial Config is not set";
|
|
23
|
-
}
|
|
24
|
-
const params = {
|
|
25
|
-
app_token: initialConfig.appToken,
|
|
26
|
-
app_version: initialConfig.appVersion,
|
|
27
|
-
framework: initialConfig.appFrameWork,
|
|
28
|
-
env: EnvironmentUtils.sdkEnvironment,
|
|
29
|
-
sdk_hash: WTConstants.SDK.HASH,
|
|
30
|
-
package_name: window.location.hostname,
|
|
31
|
-
platform: WTConstants.SDK.PLATFORM,
|
|
32
|
-
store_name: "other",
|
|
33
|
-
};
|
|
34
|
-
const response = yield networkManager.sendRequest(WTConstants.CONFIG.BASE_URL, {
|
|
35
|
-
method: "POST",
|
|
36
|
-
formData: params,
|
|
37
|
-
});
|
|
38
|
-
return WTConfig.fromJson(response.result);
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
doGetAppSettings() {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const initialConfig = storageManager.initialConfig;
|
|
44
|
-
const wtConfig = storageManager.config;
|
|
45
|
-
if (!initialConfig)
|
|
46
|
-
throw "Initial Config is not set";
|
|
47
|
-
if (!wtConfig)
|
|
48
|
-
throw "SDK Config is not set";
|
|
49
|
-
if (!wtConfig.appSettings)
|
|
50
|
-
throw "AppSettings Url is not set";
|
|
51
|
-
const params = {
|
|
52
|
-
app_token: initialConfig.appToken,
|
|
53
|
-
app_version: initialConfig.appVersion,
|
|
54
|
-
framework: initialConfig.appFrameWork,
|
|
55
|
-
env: EnvironmentUtils.sdkEnvironment,
|
|
56
|
-
sdk_hash: WTConstants.SDK.HASH,
|
|
57
|
-
package_name: window.location.hostname,
|
|
58
|
-
platform: WTConstants.SDK.PLATFORM,
|
|
59
|
-
store_name: "other",
|
|
60
|
-
};
|
|
61
|
-
const response = yield networkManager.sendRequest(wtConfig.baseUrl + wtConfig.appSettings, {
|
|
62
|
-
method: "POST",
|
|
63
|
-
formData: params,
|
|
64
|
-
});
|
|
65
|
-
return WTAppSettings.fromJson(response.result);
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
doCallRequest(endpoint, params) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const initialConfig = storageManager.initialConfig;
|
|
71
|
-
const wtConfig = storageManager.config;
|
|
72
|
-
if (!initialConfig)
|
|
73
|
-
throw "Initial Config is not set";
|
|
74
|
-
if (!wtConfig)
|
|
75
|
-
throw "SDK Config is not set";
|
|
76
|
-
params.updated_at = new Date().toISOString();
|
|
77
|
-
const response = yield networkManager.sendRequest(wtConfig.baseUrl + endpoint, {
|
|
78
|
-
method: "POST",
|
|
79
|
-
params: {
|
|
80
|
-
needs_response_details: EnvironmentUtils.sdkEnvironment != WTSDKEnvironment.PRODUCTION,
|
|
81
|
-
parameters: params,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
return response.success;
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
//# sourceMappingURL=api-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
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MAAM,cAAc,CAAC,WAAW,CAC/C,QAAQ,CAAC,OAAO,GAAG,QAAQ,EAC3B;gBACE,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE;oBACN,sBAAsB,EACpB,gBAAgB,CAAC,cAAc,IAAI,gBAAgB,CAAC,UAAU;oBAChE,UAAU,EAAE,MAAM;iBACnB;aACF,CACF,CAAC;YAEF,OAAO,QAAQ,CAAC,OAAO,CAAC;QAC1B,CAAC;KAAA;CACF,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
export declare namespace ApiError {
|
|
3
|
-
class InvalidUrl extends Error {
|
|
4
|
-
constructor(url: string);
|
|
5
|
-
}
|
|
6
|
-
class ServerError extends Error {
|
|
7
|
-
statusCode: number;
|
|
8
|
-
message: string;
|
|
9
|
-
constructor(statusCode: number, message: string);
|
|
10
|
-
}
|
|
11
|
-
class NetworkError extends Error {
|
|
12
|
-
constructor(message: string);
|
|
13
|
-
}
|
|
14
|
-
class DecodingError extends Error {
|
|
15
|
-
constructor(message: string);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
export var ApiError;
|
|
3
|
-
(function (ApiError) {
|
|
4
|
-
class InvalidUrl extends Error {
|
|
5
|
-
constructor(url) {
|
|
6
|
-
super(`Invalid URL: ${url}`);
|
|
7
|
-
this.name = "InvalidUrl";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
ApiError.InvalidUrl = InvalidUrl;
|
|
11
|
-
class ServerError extends Error {
|
|
12
|
-
constructor(statusCode, message) {
|
|
13
|
-
super(`ServerError ${statusCode}: ${message}`);
|
|
14
|
-
this.statusCode = statusCode;
|
|
15
|
-
this.message = message;
|
|
16
|
-
this.name = "ServerError";
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
ApiError.ServerError = ServerError;
|
|
20
|
-
class NetworkError extends Error {
|
|
21
|
-
constructor(message) {
|
|
22
|
-
super(`NetworkError: ${message}`);
|
|
23
|
-
this.name = "NetworkFailure";
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
ApiError.NetworkError = NetworkError;
|
|
27
|
-
class DecodingError extends Error {
|
|
28
|
-
constructor(message) {
|
|
29
|
-
super(`DecodingError: ${message}`);
|
|
30
|
-
this.name = "DecodingError";
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
ApiError.DecodingError = DecodingError;
|
|
34
|
-
})(ApiError || (ApiError = {}));
|
|
35
|
-
//# sourceMappingURL=network-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network-error.js","sourceRoot":"","sources":["../../../src/core/network/network-error.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,MAAM,KAAW,QAAQ,CA4BxB;AA5BD,WAAiB,QAAQ;IACvB,MAAa,UAAW,SAAQ,KAAK;QACnC,YAAY,GAAW;YACrB,KAAK,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC;YAC7B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QAC3B,CAAC;KACF;IALY,mBAAU,aAKtB,CAAA;IAED,MAAa,WAAY,SAAQ,KAAK;QACpC,YAAmB,UAAkB,EAAS,OAAe;YAC3D,KAAK,CAAC,eAAe,UAAU,KAAK,OAAO,EAAE,CAAC,CAAC;YAD9B,eAAU,GAAV,UAAU,CAAQ;YAAS,YAAO,GAAP,OAAO,CAAQ;YAE3D,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC5B,CAAC;KACF;IALY,oBAAW,cAKvB,CAAA;IAED,MAAa,YAAa,SAAQ,KAAK;QACrC,YAAY,OAAe;YACzB,KAAK,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;YAClC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC/B,CAAC;KACF;IALY,qBAAY,eAKxB,CAAA;IAED,MAAa,aAAc,SAAQ,KAAK;QACtC,YAAY,OAAe;YACzB,KAAK,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC;YACnC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC9B,CAAC;KACF;IALY,sBAAa,gBAKzB,CAAA;AACH,CAAC,EA5BgB,QAAQ,KAAR,QAAQ,QA4BxB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { RetryPolicy } from "./retry-policy";
|
|
2
|
-
type HttpMethod = "GET" | "POST" | "PUT";
|
|
3
|
-
/** @internal */
|
|
4
|
-
export interface RequestOptions {
|
|
5
|
-
method?: HttpMethod;
|
|
6
|
-
headers?: Record<string, string>;
|
|
7
|
-
params?: Record<string, any>;
|
|
8
|
-
formData?: Record<string, any>;
|
|
9
|
-
retryAttempt?: number;
|
|
10
|
-
}
|
|
11
|
-
/** @internal */
|
|
12
|
-
export interface ApiResponseWrapper {
|
|
13
|
-
success: boolean;
|
|
14
|
-
message?: string;
|
|
15
|
-
result?: any;
|
|
16
|
-
}
|
|
17
|
-
/** @internal */
|
|
18
|
-
export declare const networkManager: {
|
|
19
|
-
readonly retryPolicy: () => RetryPolicy;
|
|
20
|
-
readonly sendRequest: (endpoint: string, options?: RequestOptions) => Promise<ApiResponseWrapper>;
|
|
21
|
-
};
|
|
22
|
-
export {};
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
import { WTLogger } from "../../utils/logger";
|
|
11
|
-
import { ApiError } from "./network-error";
|
|
12
|
-
import { RetryPolicy } from "./retry-policy";
|
|
13
|
-
/** @internal */
|
|
14
|
-
export const networkManager = {
|
|
15
|
-
retryPolicy() {
|
|
16
|
-
return new RetryPolicy();
|
|
17
|
-
},
|
|
18
|
-
sendRequest(endpoint_1) {
|
|
19
|
-
return __awaiter(this, arguments, void 0, function* (endpoint, options = {}) {
|
|
20
|
-
const retryAttempt = options.retryAttempt || 1;
|
|
21
|
-
WTLogger.debug(`🚀 REQUEST (${retryAttempt}) => ${options.method} ${endpoint}`);
|
|
22
|
-
WTLogger.debug("-- PARAMETERS =>", options.params || options.formData || {});
|
|
23
|
-
let body;
|
|
24
|
-
const requestHeaders = Object.assign({ Accept: "application/json" }, options.headers);
|
|
25
|
-
if (options.formData) {
|
|
26
|
-
const form = new FormData();
|
|
27
|
-
for (const key in options.formData) {
|
|
28
|
-
form.append(key, options.formData[key]);
|
|
29
|
-
}
|
|
30
|
-
body = form;
|
|
31
|
-
}
|
|
32
|
-
else if (options.params) {
|
|
33
|
-
requestHeaders["Content-Type"] = "application/json";
|
|
34
|
-
body = JSON.stringify(options.params);
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
const response = yield fetch(endpoint, {
|
|
38
|
-
method: options.method,
|
|
39
|
-
headers: requestHeaders,
|
|
40
|
-
body,
|
|
41
|
-
});
|
|
42
|
-
if (!response.ok) {
|
|
43
|
-
let json = yield response.json();
|
|
44
|
-
let errorText = json.message || (yield response.text());
|
|
45
|
-
WTLogger.warn(`❌ API ERROR (${response.status}) =>`, errorText);
|
|
46
|
-
throw new ApiError.ServerError(response.status, json.message || "Server error");
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
const result = yield response.json();
|
|
50
|
-
WTLogger.debug(`✅ API SUCCESS (${response.status}) =>`, result.message || "Request successful");
|
|
51
|
-
return result;
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
throw new ApiError.DecodingError(error.message || String(error));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
if (err instanceof ApiError.ServerError ||
|
|
59
|
-
err instanceof ApiError.DecodingError) {
|
|
60
|
-
throw err;
|
|
61
|
-
}
|
|
62
|
-
WTLogger.error("Error executing request", err);
|
|
63
|
-
if (this.retryPolicy().canRetry(retryAttempt)) {
|
|
64
|
-
yield this.retryPolicy().waitBeforeRetry();
|
|
65
|
-
return this.sendRequest(endpoint, Object.assign(Object.assign({}, options), { retryAttempt: retryAttempt + 1 }));
|
|
66
|
-
}
|
|
67
|
-
throw new ApiError.NetworkError(err.message || "Unknown error");
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
//# sourceMappingURL=network-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network-manager.js","sourceRoot":"","sources":["../../../src/core/network/network-manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAoB7C,gBAAgB;AAChB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW;QACT,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IAEK,WAAW;6DACf,QAAgB,EAChB,UAA0B,EAAE;YAE5B,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC;YAE/C,QAAQ,CAAC,KAAK,CACZ,eAAe,YAAY,QAAQ,OAAO,CAAC,MAAM,IAAI,QAAQ,EAAE,CAChE,CAAC;YACF,QAAQ,CAAC,KAAK,CACZ,kBAAkB,EAClB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,IAAI,EAAE,CACzC,CAAC;YAEF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MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;oBACzD,QAAQ,CAAC,KAAK,CACZ,kBAAkB,QAAQ,CAAC,MAAM,MAAM,EACvC,MAAM,CAAC,OAAO,IAAI,oBAAoB,CACvC,CAAC;oBACF,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAAC,OAAO,KAAU,EAAE,CAAC;oBACpB,MAAM,IAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,IACE,GAAG,YAAY,QAAQ,CAAC,WAAW;oBACnC,GAAG,YAAY,QAAQ,CAAC,aAAa,EACrC,CAAC;oBACD,MAAM,GAAG,CAAC;gBACZ,CAAC;gBACD,QAAQ,CAAC,KAAK,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;gBAE/C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;oBAC9C,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,eAAe,EAAE,CAAC;oBAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,kCAC3B,OAAO,KACV,YAAY,EAAE,YAAY,GAAG,CAAC,IAC9B,CAAC;gBACL,CAAC;gBAED,MAAM,IAAI,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,IAAI,eAAe,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;KAAA;CACO,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
/** @internal */
|
|
11
|
-
export class RetryPolicy {
|
|
12
|
-
constructor(maxRetries = 3, retryInterval = 2000 // milliseconds
|
|
13
|
-
) {
|
|
14
|
-
this.maxRetries = maxRetries;
|
|
15
|
-
this.retryInterval = retryInterval;
|
|
16
|
-
}
|
|
17
|
-
canRetry(attempt) {
|
|
18
|
-
return attempt < this.maxRetries;
|
|
19
|
-
}
|
|
20
|
-
waitBeforeRetry() {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
return new Promise((res) => setTimeout(res, this.retryInterval));
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=retry-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retry-policy.js","sourceRoot":"","sources":["../../../src/core/network/retry-policy.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gBAAgB;AAChB,MAAM,OAAO,WAAW;IACtB,YACU,aAAqB,CAAC,EACtB,gBAAwB,IAAI,CAAC,eAAe;;QAD5C,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;IACnC,CAAC;IAEJ,QAAQ,CAAC,OAAe;QACtB,OAAO,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,CAAC;IAEK,eAAe;;YACnB,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QACnE,CAAC;KAAA;CACF"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { WTInitialConfig } from "../../types/config/initial-config";
|
|
2
|
-
import { WTAppSettings } from "../../types/config/wt-app-settings";
|
|
3
|
-
import { WTConfig } from "../../types/config/wt-config";
|
|
4
|
-
import { RequestRecord } from "../caching/queue-data";
|
|
5
|
-
declare class StorageManager {
|
|
6
|
-
clear(): void;
|
|
7
|
-
private setJson;
|
|
8
|
-
private getJson;
|
|
9
|
-
private optionalNumber;
|
|
10
|
-
private optionalBool;
|
|
11
|
-
get deviceId(): string | null;
|
|
12
|
-
set deviceId(value: string | null);
|
|
13
|
-
get initialDate(): string | null;
|
|
14
|
-
set initialDate(value: string | null);
|
|
15
|
-
get initialConfig(): WTInitialConfig | null;
|
|
16
|
-
set initialConfig(value: WTInitialConfig | null);
|
|
17
|
-
get config(): WTConfig | null;
|
|
18
|
-
set config(value: WTConfig | null);
|
|
19
|
-
get appSettings(): WTAppSettings | null;
|
|
20
|
-
set appSettings(value: WTAppSettings | null);
|
|
21
|
-
get sdkEnabled(): boolean;
|
|
22
|
-
set sdkEnabled(value: boolean);
|
|
23
|
-
get sdkClickSubmit(): boolean;
|
|
24
|
-
set sdkClickSubmit(value: boolean);
|
|
25
|
-
get firstSessionSubmit(): boolean;
|
|
26
|
-
set firstSessionSubmit(value: boolean);
|
|
27
|
-
get fcmToken(): string | null;
|
|
28
|
-
set fcmToken(value: string | null);
|
|
29
|
-
get pushToken(): string | null;
|
|
30
|
-
set pushToken(value: string | null);
|
|
31
|
-
get sessionCount(): number;
|
|
32
|
-
set sessionCount(value: number);
|
|
33
|
-
get subSessionCount(): number;
|
|
34
|
-
set subSessionCount(value: number);
|
|
35
|
-
get activeDuration(): number;
|
|
36
|
-
set activeDuration(value: number);
|
|
37
|
-
get inactiveDuration(): number;
|
|
38
|
-
set inactiveDuration(value: number);
|
|
39
|
-
get inactiveTime(): number | null;
|
|
40
|
-
set inactiveTime(value: number | null);
|
|
41
|
-
get activeTime(): number | null;
|
|
42
|
-
set activeTime(value: number | null);
|
|
43
|
-
get requestRecords(): RequestRecord[];
|
|
44
|
-
set requestRecords(value: RequestRecord[]);
|
|
45
|
-
get pendingRequestRecords(): RequestRecord[];
|
|
46
|
-
set pendingRequestRecords(value: RequestRecord[]);
|
|
47
|
-
get eventCount(): number;
|
|
48
|
-
set eventCount(value: number);
|
|
49
|
-
}
|
|
50
|
-
/** @internal */
|
|
51
|
-
export declare const storageManager: StorageManager;
|
|
52
|
-
export {};
|