@convertcom/js-sdk-rules 1.0.0 → 1.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 +11 -0
- package/lib/{legacy/rules/src/rule-manager.d.ts → index.d.ts} +27 -4
- package/lib/index.js +59 -32
- package/lib/index.js.map +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.mjs +1 -1
- package/lib/index.mjs +60 -33
- package/lib/index.mjs.map +1 -1
- package/lib/legacy/index.js +73 -46
- package/lib/legacy/index.js.map +1 -1
- package/lib/legacy/index.min.js +1 -1
- package/lib/package.json +7 -1
- package/package.json +2 -7
- package/lib/enums/index.d.ts +0 -29
- package/lib/enums/src/audience-type.d.ts +0 -11
- package/lib/enums/src/data-enitites.d.ts +0 -7
- package/lib/enums/src/dictionary.d.ts +0 -60
- package/lib/enums/src/do-not-track.d.ts +0 -12
- package/lib/enums/src/event-type.d.ts +0 -10
- package/lib/enums/src/experience-type.d.ts +0 -16
- package/lib/enums/src/feature-status.d.ts +0 -10
- package/lib/enums/src/ga-type.d.ts +0 -10
- package/lib/enums/src/goal-data-key.d.ts +0 -11
- package/lib/enums/src/goal-type.d.ts +0 -22
- package/lib/enums/src/integration-provider.d.ts +0 -27
- package/lib/enums/src/log-level.d.ts +0 -14
- package/lib/enums/src/log-method.d.ts +0 -14
- package/lib/enums/src/project-type.d.ts +0 -10
- package/lib/enums/src/rule-error.d.ts +0 -10
- package/lib/enums/src/segments/browser-type.d.ts +0 -17
- package/lib/enums/src/segments/device-type.d.ts +0 -16
- package/lib/enums/src/segments/segments-keys.d.ts +0 -15
- package/lib/enums/src/segments/source-type.d.ts +0 -12
- package/lib/enums/src/segments/visitor-type.d.ts +0 -10
- package/lib/enums/src/system-events.d.ts +0 -22
- package/lib/enums/src/variable-types.d.ts +0 -7
- package/lib/enums/src/variation-change-type.d.ts +0 -14
- package/lib/legacy/enums/index.d.ts +0 -29
- package/lib/legacy/enums/src/audience-type.d.ts +0 -11
- package/lib/legacy/enums/src/data-enitites.d.ts +0 -7
- package/lib/legacy/enums/src/dictionary.d.ts +0 -60
- package/lib/legacy/enums/src/do-not-track.d.ts +0 -12
- package/lib/legacy/enums/src/event-type.d.ts +0 -10
- package/lib/legacy/enums/src/experience-type.d.ts +0 -16
- package/lib/legacy/enums/src/feature-status.d.ts +0 -10
- package/lib/legacy/enums/src/ga-type.d.ts +0 -10
- package/lib/legacy/enums/src/goal-data-key.d.ts +0 -11
- package/lib/legacy/enums/src/goal-type.d.ts +0 -22
- package/lib/legacy/enums/src/integration-provider.d.ts +0 -27
- package/lib/legacy/enums/src/log-level.d.ts +0 -14
- package/lib/legacy/enums/src/log-method.d.ts +0 -14
- package/lib/legacy/enums/src/project-type.d.ts +0 -10
- package/lib/legacy/enums/src/rule-error.d.ts +0 -10
- package/lib/legacy/enums/src/segments/browser-type.d.ts +0 -17
- package/lib/legacy/enums/src/segments/device-type.d.ts +0 -16
- package/lib/legacy/enums/src/segments/segments-keys.d.ts +0 -15
- package/lib/legacy/enums/src/segments/source-type.d.ts +0 -12
- package/lib/legacy/enums/src/segments/visitor-type.d.ts +0 -10
- package/lib/legacy/enums/src/system-events.d.ts +0 -22
- package/lib/legacy/enums/src/variable-types.d.ts +0 -7
- package/lib/legacy/enums/src/variation-change-type.d.ts +0 -14
- package/lib/legacy/logger/index.d.ts +0 -8
- package/lib/legacy/logger/src/interfaces/log-client.d.ts +0 -13
- package/lib/legacy/logger/src/interfaces/log-manager.d.ts +0 -18
- package/lib/legacy/logger/src/interfaces/log-method-map.d.ts +0 -15
- package/lib/legacy/logger/src/log-manager.d.ts +0 -64
- package/lib/legacy/rules/index.d.ts +0 -8
- package/lib/legacy/rules/src/interfaces/rule-manager.d.ts +0 -14
- package/lib/legacy/types/index.d.ts +0 -36
- package/lib/legacy/types/src/Audience.d.ts +0 -16
- package/lib/legacy/types/src/BucketedFeature.d.ts +0 -30
- package/lib/legacy/types/src/BucketedVariation.d.ts +0 -13
- package/lib/legacy/types/src/BucketingAttributes.d.ts +0 -13
- package/lib/legacy/types/src/Config.d.ts +0 -62
- package/lib/legacy/types/src/ConversionAttributes.d.ts +0 -11
- package/lib/legacy/types/src/Entity.d.ts +0 -13
- package/lib/legacy/types/src/Experience.d.ts +0 -37
- package/lib/legacy/types/src/Feature.d.ts +0 -18
- package/lib/legacy/types/src/Goal.d.ts +0 -30
- package/lib/legacy/types/src/Id.d.ts +0 -10
- package/lib/legacy/types/src/IndentityField.d.ts +0 -7
- package/lib/legacy/types/src/Integration.d.ts +0 -16
- package/lib/legacy/types/src/Location.d.ts +0 -14
- package/lib/legacy/types/src/Path.d.ts +0 -10
- package/lib/legacy/types/src/Project.d.ts +0 -37
- package/lib/legacy/types/src/RequireAtLeastOne.d.ts +0 -3
- package/lib/legacy/types/src/Rule.d.ts +0 -24
- package/lib/legacy/types/src/Segments.d.ts +0 -14
- package/lib/legacy/types/src/SegmentsAttributes.d.ts +0 -9
- package/lib/legacy/types/src/SegmentsData.d.ts +0 -16
- package/lib/legacy/types/src/StoreData.d.ts +0 -14
- package/lib/legacy/types/src/TrackingEvent.d.ts +0 -14
- package/lib/legacy/types/src/VariableType.d.ts +0 -8
- package/lib/legacy/types/src/Variation.d.ts +0 -49
- package/lib/legacy/types/src/VisitorsQueue.d.ts +0 -16
- package/lib/legacy/types/src/tracking/BucketingEvent.d.ts +0 -11
- package/lib/legacy/types/src/tracking/ConversionEvent.d.ts +0 -16
- package/lib/legacy/types/src/tracking/Visitor.d.ts +0 -14
- package/lib/legacy/types/src/tracking/VisitorEvent.d.ts +0 -13
- package/lib/legacy/utils/index.d.ts +0 -14
- package/lib/legacy/utils/src/array-utils.d.ts +0 -11
- package/lib/legacy/utils/src/comparisons.d.ts +0 -22
- package/lib/legacy/utils/src/data-store.d.ts +0 -39
- package/lib/legacy/utils/src/file-logger.d.ts +0 -40
- package/lib/legacy/utils/src/http-client.d.ts +0 -102
- package/lib/legacy/utils/src/object-utils.d.ts +0 -28
- package/lib/legacy/utils/src/string-utils.d.ts +0 -20
- package/lib/legacy/utils/src/types-utils.d.ts +0 -12
- package/lib/logger/index.d.ts +0 -8
- package/lib/logger/src/interfaces/log-client.d.ts +0 -13
- package/lib/logger/src/interfaces/log-manager.d.ts +0 -18
- package/lib/logger/src/interfaces/log-method-map.d.ts +0 -15
- package/lib/logger/src/log-manager.d.ts +0 -64
- package/lib/rules/index.d.ts +0 -8
- package/lib/rules/src/interfaces/rule-manager.d.ts +0 -14
- package/lib/rules/src/rule-manager.d.ts +0 -75
- package/lib/types/index.d.ts +0 -36
- package/lib/types/src/Audience.d.ts +0 -16
- package/lib/types/src/BucketedFeature.d.ts +0 -30
- package/lib/types/src/BucketedVariation.d.ts +0 -13
- package/lib/types/src/BucketingAttributes.d.ts +0 -13
- package/lib/types/src/Config.d.ts +0 -62
- package/lib/types/src/ConversionAttributes.d.ts +0 -11
- package/lib/types/src/Entity.d.ts +0 -13
- package/lib/types/src/Experience.d.ts +0 -37
- package/lib/types/src/Feature.d.ts +0 -18
- package/lib/types/src/Goal.d.ts +0 -30
- package/lib/types/src/Id.d.ts +0 -10
- package/lib/types/src/IndentityField.d.ts +0 -7
- package/lib/types/src/Integration.d.ts +0 -16
- package/lib/types/src/Location.d.ts +0 -14
- package/lib/types/src/Path.d.ts +0 -10
- package/lib/types/src/Project.d.ts +0 -37
- package/lib/types/src/RequireAtLeastOne.d.ts +0 -3
- package/lib/types/src/Rule.d.ts +0 -24
- package/lib/types/src/Segments.d.ts +0 -14
- package/lib/types/src/SegmentsAttributes.d.ts +0 -9
- package/lib/types/src/SegmentsData.d.ts +0 -16
- package/lib/types/src/StoreData.d.ts +0 -14
- package/lib/types/src/TrackingEvent.d.ts +0 -14
- package/lib/types/src/VariableType.d.ts +0 -8
- package/lib/types/src/Variation.d.ts +0 -49
- package/lib/types/src/VisitorsQueue.d.ts +0 -16
- package/lib/types/src/tracking/BucketingEvent.d.ts +0 -11
- package/lib/types/src/tracking/ConversionEvent.d.ts +0 -16
- package/lib/types/src/tracking/Visitor.d.ts +0 -14
- package/lib/types/src/tracking/VisitorEvent.d.ts +0 -13
- package/lib/utils/index.d.ts +0 -14
- package/lib/utils/src/array-utils.d.ts +0 -11
- package/lib/utils/src/comparisons.d.ts +0 -22
- package/lib/utils/src/data-store.d.ts +0 -39
- package/lib/utils/src/file-logger.d.ts +0 -40
- package/lib/utils/src/http-client.d.ts +0 -102
- package/lib/utils/src/object-utils.d.ts +0 -28
- package/lib/utils/src/string-utils.d.ts +0 -20
- package/lib/utils/src/types-utils.d.ts +0 -12
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Example of Data Store implementation with simple database Based JSON file.
|
|
9
|
-
* It's not recommended to use it in production as it can be memory and CPU intensive.
|
|
10
|
-
* @param {string} file
|
|
11
|
-
* @param {module} fs
|
|
12
|
-
*/
|
|
13
|
-
declare class DataStore {
|
|
14
|
-
private _file;
|
|
15
|
-
private _fs;
|
|
16
|
-
/**
|
|
17
|
-
* @param {string} file
|
|
18
|
-
* @param {module} fs
|
|
19
|
-
*/
|
|
20
|
-
constructor(file: string, fs: any);
|
|
21
|
-
/**
|
|
22
|
-
* Get value by key
|
|
23
|
-
* @param {string} key
|
|
24
|
-
* @return {any}
|
|
25
|
-
*/
|
|
26
|
-
get(key: string): any;
|
|
27
|
-
/**
|
|
28
|
-
* Store value by key
|
|
29
|
-
* @param {string} key
|
|
30
|
-
* @param {any} value
|
|
31
|
-
*/
|
|
32
|
-
set(key: string, value: any): void;
|
|
33
|
-
/**
|
|
34
|
-
* Delete value by key
|
|
35
|
-
* @param {string} key
|
|
36
|
-
*/
|
|
37
|
-
delete(key: string): void;
|
|
38
|
-
}
|
|
39
|
-
export { DataStore };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {string} file
|
|
3
|
-
* @param {module} fs
|
|
4
|
-
* @param {string=} appendMethod Defaults to 'appendFileSync'
|
|
5
|
-
* @example new FileLogger('./convert.log', require('fs'), 'appendFileSync')
|
|
6
|
-
* @constructor
|
|
7
|
-
*/
|
|
8
|
-
declare class FileLogger {
|
|
9
|
-
private _file;
|
|
10
|
-
private _fs;
|
|
11
|
-
private _appendMethod;
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} file
|
|
14
|
-
* @param {module} fs
|
|
15
|
-
* @param {string=} appendMethod
|
|
16
|
-
*/
|
|
17
|
-
constructor(file: string, fs: any, appendMethod?: string);
|
|
18
|
-
private _write;
|
|
19
|
-
/**
|
|
20
|
-
* @param {Array<any>} args
|
|
21
|
-
*/
|
|
22
|
-
log(...args: any): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* @param {Array<any>} args
|
|
25
|
-
*/
|
|
26
|
-
info(...args: any): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* @param {Array<any>} args
|
|
29
|
-
*/
|
|
30
|
-
debug(...args: any): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* @param {Array<any>} args
|
|
33
|
-
*/
|
|
34
|
-
warn(...args: any): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* @param {Array<any>} args
|
|
37
|
-
*/
|
|
38
|
-
error(...args: any): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
export { FileLogger };
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
export type HttpMethod = 'GET' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH';
|
|
8
|
-
export type HttpResponseType = 'json' | 'arraybuffer' | 'text';
|
|
9
|
-
export type HttpRequest = {
|
|
10
|
-
baseURL: string;
|
|
11
|
-
path?: string;
|
|
12
|
-
method?: HttpMethod;
|
|
13
|
-
headers?: {
|
|
14
|
-
[x: string]: any;
|
|
15
|
-
};
|
|
16
|
-
responseType?: HttpResponseType;
|
|
17
|
-
data?: Record<string, any>;
|
|
18
|
-
};
|
|
19
|
-
declare enum HttpStatusCode {
|
|
20
|
-
Continue = 100,
|
|
21
|
-
SwitchingProtocols = 101,
|
|
22
|
-
Processing = 102,
|
|
23
|
-
EarlyHints = 103,
|
|
24
|
-
Ok = 200,
|
|
25
|
-
Created = 201,
|
|
26
|
-
Accepted = 202,
|
|
27
|
-
NonAuthoritativeInformation = 203,
|
|
28
|
-
NoContent = 204,
|
|
29
|
-
ResetContent = 205,
|
|
30
|
-
PartialContent = 206,
|
|
31
|
-
MultiStatus = 207,
|
|
32
|
-
AlreadyReported = 208,
|
|
33
|
-
ImUsed = 226,
|
|
34
|
-
MultipleChoices = 300,
|
|
35
|
-
MovedPermanently = 301,
|
|
36
|
-
Found = 302,
|
|
37
|
-
SeeOther = 303,
|
|
38
|
-
NotModified = 304,
|
|
39
|
-
UseProxy = 305,
|
|
40
|
-
Unused = 306,
|
|
41
|
-
TemporaryRedirect = 307,
|
|
42
|
-
PermanentRedirect = 308,
|
|
43
|
-
BadRequest = 400,
|
|
44
|
-
Unauthorized = 401,
|
|
45
|
-
PaymentRequired = 402,
|
|
46
|
-
Forbidden = 403,
|
|
47
|
-
NotFound = 404,
|
|
48
|
-
MethodNotAllowed = 405,
|
|
49
|
-
NotAcceptable = 406,
|
|
50
|
-
ProxyAuthenticationRequired = 407,
|
|
51
|
-
RequestTimeout = 408,
|
|
52
|
-
Conflict = 409,
|
|
53
|
-
Gone = 410,
|
|
54
|
-
LengthRequired = 411,
|
|
55
|
-
PreconditionFailed = 412,
|
|
56
|
-
PayloadTooLarge = 413,
|
|
57
|
-
UriTooLong = 414,
|
|
58
|
-
UnsupportedMediaType = 415,
|
|
59
|
-
RangeNotSatisfiable = 416,
|
|
60
|
-
ExpectationFailed = 417,
|
|
61
|
-
ImATeapot = 418,
|
|
62
|
-
MisdirectedRequest = 421,
|
|
63
|
-
UnprocessableEntity = 422,
|
|
64
|
-
Locked = 423,
|
|
65
|
-
FailedDependency = 424,
|
|
66
|
-
TooEarly = 425,
|
|
67
|
-
UpgradeRequired = 426,
|
|
68
|
-
PreconditionRequired = 428,
|
|
69
|
-
TooManyRequests = 429,
|
|
70
|
-
RequestHeaderFieldsTooLarge = 431,
|
|
71
|
-
UnavailableForLegalReasons = 451,
|
|
72
|
-
InternalServerError = 500,
|
|
73
|
-
NotImplemented = 501,
|
|
74
|
-
BadGateway = 502,
|
|
75
|
-
ServiceUnavailable = 503,
|
|
76
|
-
GatewayTimeout = 504,
|
|
77
|
-
HttpVersionNotSupported = 505,
|
|
78
|
-
VariantAlsoNegotiates = 506,
|
|
79
|
-
InsufficientStorage = 507,
|
|
80
|
-
LoopDetected = 508,
|
|
81
|
-
NotExtended = 510,
|
|
82
|
-
NetworkAuthenticationRequired = 511
|
|
83
|
-
}
|
|
84
|
-
export type HttpResponse = {
|
|
85
|
-
data: any;
|
|
86
|
-
status: HttpStatusCode;
|
|
87
|
-
statusText: string;
|
|
88
|
-
headers?: {
|
|
89
|
-
[x: string]: any;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
interface HttpClientInterface {
|
|
93
|
-
request(config: HttpRequest): Promise<HttpResponse>;
|
|
94
|
-
}
|
|
95
|
-
export declare const serialize: (params: Record<string, any>, method: string) => string;
|
|
96
|
-
/**
|
|
97
|
-
* Provide http client for newtork requests
|
|
98
|
-
* @param {HttpRequest}
|
|
99
|
-
* @returns {HttpClient}
|
|
100
|
-
*/
|
|
101
|
-
export declare const HttpClient: HttpClientInterface;
|
|
102
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Returns the value at path of object
|
|
9
|
-
* @param {Record<string, any>} object
|
|
10
|
-
* @param {string} path
|
|
11
|
-
* @param {any=} defaultValue
|
|
12
|
-
* @param {boolean=} truthy Should Number 0 number and Boolean false be considered as normal value
|
|
13
|
-
* @return {any}
|
|
14
|
-
*/
|
|
15
|
-
export declare function objectDeepValue(object: Record<string, any>, path: string, defaultValue?: any, truthy?: boolean): any;
|
|
16
|
-
/**
|
|
17
|
-
* Deep merge objects and their keys and nested objects
|
|
18
|
-
* Accepts arrays
|
|
19
|
-
*
|
|
20
|
-
* @param {...Record<any, any>} objects Objects to merge
|
|
21
|
-
* @return {Record<any, any>}
|
|
22
|
-
*/
|
|
23
|
-
export declare function objectDeepMerge(...objects: any[]): any;
|
|
24
|
-
/**
|
|
25
|
-
* Validates variable is object and not empty
|
|
26
|
-
* @param object
|
|
27
|
-
*/
|
|
28
|
-
export declare function objectNotEmpty(object: any): boolean;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* String formatter tool. Use %s for string %d for digit and %j for JSON formatting
|
|
3
|
-
* @param {string} template
|
|
4
|
-
* @param {Array<string>} args
|
|
5
|
-
* @return {string}
|
|
6
|
-
*/
|
|
7
|
-
export declare function stringFormat(template: string, ...args: any[]): string;
|
|
8
|
-
/**
|
|
9
|
-
* String formatter tool. Transforms a space-separated string into camelCase
|
|
10
|
-
* @param {string} input
|
|
11
|
-
* @return {string}
|
|
12
|
-
*/
|
|
13
|
-
export declare function camelCase(input: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Generate numeric hash based on seed
|
|
16
|
-
* @param {string} value
|
|
17
|
-
* @param {number=} seed
|
|
18
|
-
* @return {number}
|
|
19
|
-
*/
|
|
20
|
-
export declare function generateHash(value: string, seed?: number): number;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Transform value type. Does not do any JSON validation
|
|
9
|
-
* @param value
|
|
10
|
-
* @param type
|
|
11
|
-
*/
|
|
12
|
-
export declare function castType(value: any, type: string): any;
|
package/lib/logger/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { LogLevel } from '@convertcom/js-sdk-enums';
|
|
8
|
-
import { LogMethodMapInterface } from './log-method-map';
|
|
9
|
-
export interface LogClientInterface {
|
|
10
|
-
sdk: any;
|
|
11
|
-
level: LogLevel;
|
|
12
|
-
mapper: LogMethodMapInterface;
|
|
13
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { LogLevel } from '@convertcom/js-sdk-enums';
|
|
8
|
-
import { LogMethodMapInterface } from './log-method-map';
|
|
9
|
-
export interface LogManagerInterface {
|
|
10
|
-
log(level: LogLevel, ...args: any[]): void;
|
|
11
|
-
trace(...args: any[]): void;
|
|
12
|
-
debug(...args: any[]): void;
|
|
13
|
-
info(...args: any[]): void;
|
|
14
|
-
warn(...args: any[]): void;
|
|
15
|
-
error(...args: any[]): void;
|
|
16
|
-
addClient(client?: any, level?: LogLevel, methodMap?: LogMethodMapInterface): void;
|
|
17
|
-
setClientLevel(level: LogLevel, client?: any): void;
|
|
18
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { LogMethod } from '@convertcom/js-sdk-enums';
|
|
8
|
-
export interface LogMethodMapInterface {
|
|
9
|
-
[LogMethod.LOG]?: string;
|
|
10
|
-
[LogMethod.DEBUG]?: string;
|
|
11
|
-
[LogMethod.INFO]?: string;
|
|
12
|
-
[LogMethod.WARN]?: string;
|
|
13
|
-
[LogMethod.ERROR]?: string;
|
|
14
|
-
[LogMethod.TRACE]?: string;
|
|
15
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { LogLevel } from '@convertcom/js-sdk-enums';
|
|
8
|
-
import { LogMethodMapInterface } from './interfaces/log-method-map';
|
|
9
|
-
import { LogManagerInterface } from './interfaces/log-manager';
|
|
10
|
-
/**
|
|
11
|
-
* Provides logging logic
|
|
12
|
-
* @category Modules
|
|
13
|
-
* @constructor
|
|
14
|
-
* @implements {LogManagerInterface}
|
|
15
|
-
*/
|
|
16
|
-
export declare class LogManager implements LogManagerInterface {
|
|
17
|
-
private _clients;
|
|
18
|
-
private _defaultMapper;
|
|
19
|
-
/**
|
|
20
|
-
* @param {any} client
|
|
21
|
-
* @param {LogLevel=} level
|
|
22
|
-
* @param {LogMethodMapInterface=} mapper
|
|
23
|
-
*/
|
|
24
|
-
constructor(client?: any, level?: LogLevel, mapper?: LogMethodMapInterface);
|
|
25
|
-
private _isValidLevel;
|
|
26
|
-
private _isValidMethod;
|
|
27
|
-
private _log;
|
|
28
|
-
/**
|
|
29
|
-
* @param {LogLevel} level
|
|
30
|
-
* @param {Array<any>} args
|
|
31
|
-
*/
|
|
32
|
-
log(level: LogLevel, ...args: any[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* @param {Array<any>} args
|
|
35
|
-
*/
|
|
36
|
-
trace(...args: any[]): void;
|
|
37
|
-
/**
|
|
38
|
-
* @param {Array<any>} args
|
|
39
|
-
*/
|
|
40
|
-
debug(...args: any[]): void;
|
|
41
|
-
/**
|
|
42
|
-
* @param {Array<any>} args
|
|
43
|
-
*/
|
|
44
|
-
info(...args: any[]): void;
|
|
45
|
-
/**
|
|
46
|
-
* @param {Array<any>} args
|
|
47
|
-
*/
|
|
48
|
-
warn(...args: any[]): void;
|
|
49
|
-
/**
|
|
50
|
-
* @param {Array<any>} args
|
|
51
|
-
*/
|
|
52
|
-
error(...args: any[]): void;
|
|
53
|
-
/**
|
|
54
|
-
* @param {any=} client
|
|
55
|
-
* @param {LogLevel=} level
|
|
56
|
-
* @param {LogMethodMapInterface=} methodMap
|
|
57
|
-
*/
|
|
58
|
-
addClient(client?: any, level?: LogLevel, methodMap?: LogMethodMapInterface): void;
|
|
59
|
-
/**
|
|
60
|
-
* @param {LogLevel=} level
|
|
61
|
-
* @param {any=} client
|
|
62
|
-
*/
|
|
63
|
-
setClientLevel(level: LogLevel, client?: any): void;
|
|
64
|
-
}
|
package/lib/rules/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { Rule, RuleSet } from '@convertcom/js-sdk-types';
|
|
8
|
-
import { RuleError } from '@convertcom/js-sdk-enums';
|
|
9
|
-
export interface RuleManagerInterface {
|
|
10
|
-
comparisonProcessor: Record<string, any>;
|
|
11
|
-
getComparisonProcessorMethods(): Array<string>;
|
|
12
|
-
isRuleMatched(data: Record<string, any>, ruleSet: RuleSet, logEntry?: string): boolean | RuleError;
|
|
13
|
-
isValidRule(rule: Rule): boolean;
|
|
14
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { RuleManagerInterface } from './interfaces/rule-manager';
|
|
2
|
-
import { Config, Rule, RuleSet } from '@convertcom/js-sdk-types';
|
|
3
|
-
import { LogManagerInterface } from '@convertcom/js-sdk-logger';
|
|
4
|
-
import { RuleError } from '@convertcom/js-sdk-enums';
|
|
5
|
-
/**
|
|
6
|
-
* Provides rule processing calculations with corresponding comparisons methods
|
|
7
|
-
* @category Modules
|
|
8
|
-
* @constructor
|
|
9
|
-
* @implements {RuleManagerInterface}
|
|
10
|
-
*/
|
|
11
|
-
export declare class RuleManager implements RuleManagerInterface {
|
|
12
|
-
private _comparisonProcessor;
|
|
13
|
-
private readonly _negation;
|
|
14
|
-
private readonly _keys_case_sensitive;
|
|
15
|
-
private _loggerManager;
|
|
16
|
-
/**
|
|
17
|
-
* @param {Config=} config
|
|
18
|
-
* @param {Object=} dependencies
|
|
19
|
-
* @param {LogManagerInterface=} dependencies.loggerManager
|
|
20
|
-
*/
|
|
21
|
-
constructor(config?: Config, { loggerManager }?: {
|
|
22
|
-
loggerManager?: LogManagerInterface;
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* Setter for comparison processor
|
|
26
|
-
* @param {Record<string, any>} comparisonProcessor
|
|
27
|
-
*/
|
|
28
|
-
set comparisonProcessor(comparisonProcessor: Record<string, any>);
|
|
29
|
-
/**
|
|
30
|
-
* Getter for comparison processor
|
|
31
|
-
*/
|
|
32
|
-
get comparisonProcessor(): Record<string, any>;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve comparison methods from comparison processor
|
|
35
|
-
* @return {Array<string>} List of methods of comparison processor
|
|
36
|
-
*/
|
|
37
|
-
getComparisonProcessorMethods(): Array<string>;
|
|
38
|
-
/**
|
|
39
|
-
* Check input data matching to rule set
|
|
40
|
-
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
41
|
-
* @param {RuleSet} ruleSet
|
|
42
|
-
* @return {boolean | RuleError}
|
|
43
|
-
*/
|
|
44
|
-
isRuleMatched(data: Record<string, any>, ruleSet: RuleSet, logEntry?: string): boolean | RuleError;
|
|
45
|
-
/**
|
|
46
|
-
* Check is rule object valid
|
|
47
|
-
* @param {Rule} rule
|
|
48
|
-
* @return {boolean}
|
|
49
|
-
*/
|
|
50
|
-
isValidRule(rule: Rule): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Process AND block of rule set. Return first false if found
|
|
53
|
-
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
54
|
-
* @param {RuleAnd} rulesSubset
|
|
55
|
-
* @return {boolean | RuleError}
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
|
-
private _processAND;
|
|
59
|
-
/**
|
|
60
|
-
* Process OR block of rule set. Return first true if found
|
|
61
|
-
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
62
|
-
* @param {RuleOrWhen} rulesSubset
|
|
63
|
-
* @return {boolean | RuleError}
|
|
64
|
-
* @private
|
|
65
|
-
*/
|
|
66
|
-
private _processORWHEN;
|
|
67
|
-
/**
|
|
68
|
-
* Process single rule item
|
|
69
|
-
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
70
|
-
* @param {Rule} rule A single rule to compare
|
|
71
|
-
* @return {boolean | RuleError} Comparison result
|
|
72
|
-
* @private
|
|
73
|
-
*/
|
|
74
|
-
private _processRuleItem;
|
|
75
|
-
}
|
package/lib/types/index.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK test
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
export * from './src/Audience';
|
|
8
|
-
export * from './src/BucketedFeature';
|
|
9
|
-
export * from './src/BucketedVariation';
|
|
10
|
-
export * from './src/BucketingAttributes';
|
|
11
|
-
export * from './src/Config';
|
|
12
|
-
export * from './src/ConversionAttributes';
|
|
13
|
-
export * from './src/Entity';
|
|
14
|
-
export * from './src/Experience';
|
|
15
|
-
export * from './src/Feature';
|
|
16
|
-
export * from './src/Goal';
|
|
17
|
-
export * from './src/Id';
|
|
18
|
-
export * from './src/IndentityField';
|
|
19
|
-
export * from './src/Integration';
|
|
20
|
-
export * from './src/Location';
|
|
21
|
-
export * from './src/Path';
|
|
22
|
-
export * from './src/Project';
|
|
23
|
-
export * from './src/RequireAtLeastOne';
|
|
24
|
-
export * from './src/Rule';
|
|
25
|
-
export * from './src/Segments';
|
|
26
|
-
export * from './src/SegmentsAttributes';
|
|
27
|
-
export * from './src/SegmentsData';
|
|
28
|
-
export * from './src/StoreData';
|
|
29
|
-
export * from './src/TrackingEvent';
|
|
30
|
-
export * from './src/VariableType';
|
|
31
|
-
export * from './src/Variation';
|
|
32
|
-
export * from './src/VisitorsQueue';
|
|
33
|
-
export * from './src/tracking/BucketingEvent';
|
|
34
|
-
export * from './src/tracking/ConversionEvent';
|
|
35
|
-
export * from './src/tracking/Visitor';
|
|
36
|
-
export * from './src/tracking/VisitorEvent';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { AudienceType } from '@convertcom/js-sdk-enums';
|
|
8
|
-
import { RuleSet } from './Rule';
|
|
9
|
-
import { Id } from './Id';
|
|
10
|
-
export type Audience = {
|
|
11
|
-
id: Id;
|
|
12
|
-
name: string;
|
|
13
|
-
key: string;
|
|
14
|
-
rules: RuleSet;
|
|
15
|
-
type: AudienceType;
|
|
16
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { Id } from './Id';
|
|
8
|
-
import { FeatureStatus } from '@convertcom/js-sdk-enums';
|
|
9
|
-
import { RequireAtLeastOne } from './RequireAtLeastOne';
|
|
10
|
-
type NotEnabledFeature = RequireAtLeastOne<{
|
|
11
|
-
experienceId?: Id;
|
|
12
|
-
experienceKey?: string;
|
|
13
|
-
experienceName?: string;
|
|
14
|
-
id?: Id;
|
|
15
|
-
key?: string;
|
|
16
|
-
name?: string;
|
|
17
|
-
status: FeatureStatus.DISABLED;
|
|
18
|
-
variables?: Record<string, any>;
|
|
19
|
-
}, 'id' | 'key'>;
|
|
20
|
-
export type BucketedFeature = {
|
|
21
|
-
experienceId?: Id;
|
|
22
|
-
experienceKey?: string;
|
|
23
|
-
experienceName?: string;
|
|
24
|
-
id?: Id;
|
|
25
|
-
key?: string;
|
|
26
|
-
name?: string;
|
|
27
|
-
status: FeatureStatus;
|
|
28
|
-
variables?: Record<string, any>;
|
|
29
|
-
} | NotEnabledFeature;
|
|
30
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { Id } from './Id';
|
|
8
|
-
import { Variation } from './Variation';
|
|
9
|
-
export type BucketedVariation = Variation & {
|
|
10
|
-
experienceId?: Id;
|
|
11
|
-
experienceKey?: string;
|
|
12
|
-
experienceName?: string;
|
|
13
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
export type BucketingAttributes = {
|
|
8
|
-
environment?: string;
|
|
9
|
-
locationProperties?: Record<any, any>;
|
|
10
|
-
visitorProperties?: Record<any, any>;
|
|
11
|
-
typeCasting?: boolean;
|
|
12
|
-
experienceKeys?: Array<string>;
|
|
13
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { Experience } from './Experience';
|
|
8
|
-
import { Feature } from './Feature';
|
|
9
|
-
import { Id } from './Id';
|
|
10
|
-
import { Project } from './Project';
|
|
11
|
-
import { Goal } from './Goal';
|
|
12
|
-
import { Audience } from './Audience';
|
|
13
|
-
import { Location } from './Location';
|
|
14
|
-
import { LogLevel } from '@convertcom/js-sdk-enums';
|
|
15
|
-
import { Segments } from './Segments';
|
|
16
|
-
export type ConfigData = {
|
|
17
|
-
account_id: Id;
|
|
18
|
-
project: Project;
|
|
19
|
-
goals?: Array<Goal>;
|
|
20
|
-
locations?: Array<Location>;
|
|
21
|
-
audiences?: Array<Audience>;
|
|
22
|
-
experiences?: Array<Experience>;
|
|
23
|
-
archived_experiences?: Array<Id>;
|
|
24
|
-
features?: Array<Feature>;
|
|
25
|
-
segments?: Array<Segments>;
|
|
26
|
-
};
|
|
27
|
-
export type Config = {
|
|
28
|
-
environment: string;
|
|
29
|
-
api?: {
|
|
30
|
-
endpoint?: {
|
|
31
|
-
config?: string;
|
|
32
|
-
track?: string;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
bucketing?: {
|
|
36
|
-
hash_seed?: number;
|
|
37
|
-
max_traffic?: number;
|
|
38
|
-
};
|
|
39
|
-
data: ConfigData;
|
|
40
|
-
dataStore?: object;
|
|
41
|
-
dataRefreshInterval?: number;
|
|
42
|
-
tracking?: boolean;
|
|
43
|
-
events?: {
|
|
44
|
-
batch_size?: number;
|
|
45
|
-
release_interval?: number;
|
|
46
|
-
};
|
|
47
|
-
rules?: {
|
|
48
|
-
comparisonProcessor?: Record<string, any>;
|
|
49
|
-
negation?: string;
|
|
50
|
-
keys_case_sensitive?: boolean;
|
|
51
|
-
};
|
|
52
|
-
sdkKey: string;
|
|
53
|
-
logger?: {
|
|
54
|
-
logLevel?: LogLevel;
|
|
55
|
-
file?: {
|
|
56
|
-
enabled?: boolean;
|
|
57
|
-
path?: string;
|
|
58
|
-
logLevel?: LogLevel;
|
|
59
|
-
};
|
|
60
|
-
customLoggers: Array<Record<string, any>>;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { GoalDataKey } from '@convertcom/js-sdk-enums';
|
|
8
|
-
export type ConversionAttributes = {
|
|
9
|
-
ruleData?: Record<string, any>;
|
|
10
|
-
conversionData?: Array<Record<GoalDataKey, number>>;
|
|
11
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Convert JS SDK
|
|
3
|
-
* Version 1.0.0
|
|
4
|
-
* Copyright(c) 2020 Convert Insights, Inc
|
|
5
|
-
* License Apache-2.0
|
|
6
|
-
*/
|
|
7
|
-
import { Experience } from './Experience';
|
|
8
|
-
import { Feature } from './Feature';
|
|
9
|
-
import { Audience } from './Audience';
|
|
10
|
-
import { Location } from './Location';
|
|
11
|
-
import { Segments } from './Segments';
|
|
12
|
-
import { Goal } from './Goal';
|
|
13
|
-
export type Entity = Experience | Feature | Audience | Location | Segments | Goal;
|