wisetrack 2.0.3 → 2.0.6
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 +71 -58
- package/dist/cdn/sdk.bundle.min.js +1 -1
- package/dist/cjs/constants/constants.d.ts +3 -4
- package/dist/cjs/constants/environments.d.ts +2 -2
- package/dist/cjs/core/network/api-client.d.ts +0 -2
- package/dist/cjs/core/network/network-manager.d.ts +0 -1
- package/dist/cjs/core/storage/storage-manager.d.ts +0 -3
- package/dist/cjs/core/wisetrack.d.ts +0 -2
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types/config/secure-config.d.ts +8 -0
- package/dist/cjs/types/config/wt-config.d.ts +6 -9
- package/dist/cjs/types/event/event-validation.d.ts +32 -0
- package/dist/cjs/types/event/wt-event.d.ts +20 -5
- package/dist/esm/constants/constants.d.ts +3 -4
- package/dist/esm/constants/environments.d.ts +2 -2
- package/dist/esm/core/network/api-client.d.ts +0 -2
- package/dist/esm/core/network/network-manager.d.ts +0 -1
- package/dist/esm/core/storage/storage-manager.d.ts +0 -3
- package/dist/esm/core/wisetrack.d.ts +0 -2
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/types/config/secure-config.d.ts +8 -0
- package/dist/esm/types/config/wt-config.d.ts +6 -9
- package/dist/esm/types/event/event-validation.d.ts +32 -0
- package/dist/esm/types/event/wt-event.d.ts +20 -5
- package/package.json +2 -2
- package/dist/cjs/types/config/wt-app-settings.d.ts +0 -15
- package/dist/esm/types/config/wt-app-settings.d.ts +0 -15
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EventParam } from "./wt-event";
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare class WTEventValidationError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare class WTEventValidator {
|
|
8
|
+
private static readonly MAX_LENGTH;
|
|
9
|
+
private static readonly FORBIDDEN_KEY;
|
|
10
|
+
/** Patterns for SQL Injection */
|
|
11
|
+
private static readonly SQL_INJECTION_PATTERNS;
|
|
12
|
+
/** Patterns for Script Injection (XSS) */
|
|
13
|
+
private static readonly SCRIPT_INJECTION_PATTERNS;
|
|
14
|
+
/** Dangerous characters */
|
|
15
|
+
private static readonly DANGEROUS_CHARS;
|
|
16
|
+
/** Check for SQL Injection patterns */
|
|
17
|
+
private static containsSQLInjection;
|
|
18
|
+
/** Check for Script Injection patterns */
|
|
19
|
+
private static containsScriptInjection;
|
|
20
|
+
/** Check for dangerous characters */
|
|
21
|
+
private static containsDangerousChars;
|
|
22
|
+
/** Check for malicious content */
|
|
23
|
+
private static isMaliciousContent;
|
|
24
|
+
/**
|
|
25
|
+
* Validate key parameter
|
|
26
|
+
*/
|
|
27
|
+
static validateKey(key: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Validate value parameter
|
|
30
|
+
*/
|
|
31
|
+
static validateValue(value: EventParam): void;
|
|
32
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RevenueCurrency } from "./revenue-currency";
|
|
2
2
|
type WTEventType = "default" | "revenue";
|
|
3
|
-
type EventParam = string | number | boolean;
|
|
3
|
+
export type EventParam = string | number | boolean;
|
|
4
4
|
export declare namespace WTEvent {
|
|
5
5
|
/**
|
|
6
6
|
* Represents a generic custom event.
|
|
@@ -34,12 +34,27 @@ export declare namespace WTEvent {
|
|
|
34
34
|
*/
|
|
35
35
|
constructor(name: string);
|
|
36
36
|
/**
|
|
37
|
-
|
|
37
|
+
* Adds a parameter to the event with validation.
|
|
38
|
+
*
|
|
39
|
+
* @param key - The parameter key (max 50 characters, cannot be "no_parameters").
|
|
40
|
+
* @param value - The parameter value (max 50 characters).
|
|
41
|
+
* @throws {WTEventValidationError} When validation fails.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* event.addParam("category", "electronics");
|
|
46
|
+
* event.addParam("item_count", 3);
|
|
47
|
+
* event.addParam("is_premium", true);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
addParam(key: string, value: EventParam): void;
|
|
51
|
+
/**
|
|
52
|
+
* Adds multiple parameters at once with validation.
|
|
38
53
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @
|
|
54
|
+
* @param params - Object containing key-value pairs to add.
|
|
55
|
+
* @throws {WTEventValidationError} When validation fails for any parameter.
|
|
41
56
|
*/
|
|
42
|
-
|
|
57
|
+
addParams(params: Record<string, EventParam>): void;
|
|
43
58
|
/** @internal */
|
|
44
59
|
toJSON(): {
|
|
45
60
|
event_type: WTEventType;
|
|
@@ -3,9 +3,8 @@ import { WTSDKEnvironment } from "./environments";
|
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare const WTConstants: {
|
|
5
5
|
readonly SDK: {
|
|
6
|
-
readonly HASH: "997bfbb583c1245a426a53dc1899ec779ff354f9";
|
|
7
6
|
readonly PLATFORM: "web";
|
|
8
|
-
readonly VERSION: "2.0.
|
|
7
|
+
readonly VERSION: "2.0.5";
|
|
9
8
|
};
|
|
10
9
|
readonly CONFIG: {
|
|
11
10
|
readonly BASE_URL: "https://config.wisetrack.io";
|
|
@@ -13,8 +12,8 @@ export declare const WTConstants: {
|
|
|
13
12
|
};
|
|
14
13
|
readonly DEFAULTS: {
|
|
15
14
|
readonly LOG_LEVEL: WTLogLevel;
|
|
16
|
-
readonly SESSION_INTERVAL: "
|
|
17
|
-
readonly SUBSESSION_INTERVAL: "
|
|
15
|
+
readonly SESSION_INTERVAL: "1800";
|
|
16
|
+
readonly SUBSESSION_INTERVAL: "300";
|
|
18
17
|
readonly PARAMETERS_VALUE: string | undefined;
|
|
19
18
|
};
|
|
20
19
|
};
|
|
@@ -20,6 +20,6 @@ export type WTSDKEnvironment = (typeof WTSDKEnvironment)[keyof typeof WTSDKEnvir
|
|
|
20
20
|
/** @internal */
|
|
21
21
|
export declare const EnvironmentUtils: {
|
|
22
22
|
sdkEnvironment: WTSDKEnvironment;
|
|
23
|
-
|
|
24
|
-
baseUrl
|
|
23
|
+
readonly needResponseDetails: boolean;
|
|
24
|
+
readonly baseUrl: string;
|
|
25
25
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { WTEndpoints } from "../../constants/endpoints";
|
|
2
|
-
import { WTAppSettings } from "../../types/config/wt-app-settings";
|
|
3
2
|
import { WTConfig } from "../../types/config/wt-config";
|
|
4
3
|
/** @internal */
|
|
5
4
|
export declare const apiClient: {
|
|
6
5
|
doGetConfig(): Promise<WTConfig>;
|
|
7
|
-
doGetAppSettings(): Promise<WTAppSettings>;
|
|
8
6
|
doCallRequest(endpoint: WTEndpoints, params: Record<string, any>): Promise<boolean>;
|
|
9
7
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WTInitialConfig } from "../../types/config/initial-config";
|
|
2
|
-
import { WTAppSettings } from "../../types/config/wt-app-settings";
|
|
3
2
|
import { WTConfig } from "../../types/config/wt-config";
|
|
4
3
|
import { RequestRecord } from "../caching/queue-data";
|
|
5
4
|
declare class StorageManager {
|
|
@@ -16,8 +15,6 @@ declare class StorageManager {
|
|
|
16
15
|
set initialConfig(value: WTInitialConfig | null);
|
|
17
16
|
get config(): WTConfig | null;
|
|
18
17
|
set config(value: WTConfig | null);
|
|
19
|
-
get appSettings(): WTAppSettings | null;
|
|
20
|
-
set appSettings(value: WTAppSettings | null);
|
|
21
18
|
get sdkEnabled(): boolean;
|
|
22
19
|
set sdkEnabled(value: boolean);
|
|
23
20
|
get sdkClickSubmit(): boolean;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { WiseTrack } from "./core/wisetrack";
|
|
2
2
|
export { WTInitialConfig } from "./types/config/initial-config";
|
|
3
|
-
export { WTEvent } from "./types/event/wt-event";
|
|
3
|
+
export { WTEvent, EventParam } from "./types/event/wt-event";
|
|
4
4
|
export { WTLogEngine, WTLogger, WTLogLevel } from "./utils/logger";
|
|
5
|
+
export { WTUserEnvironment } from "./constants/environments";
|
|
6
|
+
export { RevenueCurrency } from "./types/event/revenue-currency";
|