@convertcom/js-sdk-rules 2.0.0 → 2.1.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 +2 -2
- package/lib/enums/index.d.ts +26 -0
- package/lib/enums/src/bucketing-error.d.ts +9 -0
- package/lib/enums/src/conversion-setting-key.d.ts +9 -0
- package/lib/enums/src/data-enitites.d.ts +16 -0
- package/lib/enums/src/dictionary.d.ts +68 -0
- package/lib/enums/src/do-not-track.d.ts +12 -0
- package/lib/enums/src/entity-type.d.ts +15 -0
- package/lib/enums/src/feature-status.d.ts +10 -0
- package/lib/enums/src/goal-data-key.d.ts +11 -0
- package/lib/enums/src/log-level.d.ts +14 -0
- package/lib/enums/src/log-method.d.ts +14 -0
- package/lib/enums/src/project-type.d.ts +10 -0
- package/lib/enums/src/rule-error.d.ts +10 -0
- package/lib/enums/src/segments/browser-type.d.ts +17 -0
- package/lib/enums/src/segments/device-type.d.ts +16 -0
- package/lib/enums/src/segments/segments-keys.d.ts +15 -0
- package/lib/enums/src/segments/source-type.d.ts +12 -0
- package/lib/enums/src/segments/visitor-type.d.ts +10 -0
- package/lib/enums/src/system-events.d.ts +22 -0
- package/lib/enums/src/variable-types.d.ts +7 -0
- package/lib/enums/src/variation-change-type.d.ts +14 -0
- package/lib/index.d.ts +5 -4
- package/lib/index.js +767 -30
- package/lib/index.js.map +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.map +1 -1
- package/lib/index.min.mjs +1 -1
- package/lib/index.min.mjs.map +1 -1
- package/lib/index.mjs +743 -6
- package/lib/index.mjs.map +1 -1
- package/lib/legacy/index.js +798 -140
- package/lib/legacy/index.js.map +1 -1
- package/lib/legacy/index.min.js +1 -1
- package/lib/legacy/index.min.js.map +1 -1
- package/lib/logger/index.d.ts +8 -0
- package/lib/logger/src/interfaces/log-client.d.ts +13 -0
- package/lib/logger/src/interfaces/log-manager.d.ts +18 -0
- package/lib/logger/src/interfaces/log-method-map.d.ts +15 -0
- package/lib/logger/src/log-manager.d.ts +64 -0
- package/lib/package.json +6 -6
- package/lib/rules/index.d.ts +8 -0
- package/lib/rules/src/interfaces/rule-manager.d.ts +15 -0
- package/lib/rules/src/rule-manager.d.ts +82 -0
- package/lib/types/index.d.ts +28 -0
- package/lib/types/src/BucketedFeature.d.ts +29 -0
- package/lib/types/src/BucketedVariation.d.ts +13 -0
- package/lib/types/src/BucketingAllocation.d.ts +10 -0
- package/lib/types/src/BucketingAttributes.d.ts +17 -0
- package/lib/types/src/BucketingHash.d.ts +11 -0
- package/lib/types/src/Config.d.ts +60 -0
- package/lib/types/src/ConversionAttributes.d.ts +13 -0
- package/lib/types/src/Entity.d.ts +8 -0
- package/lib/types/src/GoalData.d.ts +11 -0
- package/lib/types/src/IndentityField.d.ts +7 -0
- package/lib/types/src/Integration.d.ts +8 -0
- package/lib/types/src/LocationAttributes.d.ts +12 -0
- package/lib/types/src/Path.d.ts +10 -0
- package/lib/types/src/RequireAtLeastOne.d.ts +3 -0
- package/lib/types/src/Rule.d.ts +13 -0
- package/lib/types/src/SegmentsAttributes.d.ts +9 -0
- package/lib/types/src/StoreData.d.ts +13 -0
- package/lib/types/src/TrackingEvent.d.ts +14 -0
- package/lib/types/src/VariableType.d.ts +8 -0
- package/lib/types/src/Visitor.d.ts +12 -0
- package/lib/types/src/VisitorsQueue.d.ts +14 -0
- package/lib/types/src/config/index.d.ts +1 -0
- package/lib/types/src/config/types.gen.d.ts +2387 -0
- package/lib/utils/index.d.ts +14 -0
- package/lib/utils/src/array-utils.d.ts +11 -0
- package/lib/utils/src/comparisons.d.ts +22 -0
- package/lib/utils/src/data-store.d.ts +39 -0
- package/lib/utils/src/file-logger.d.ts +40 -0
- package/lib/utils/src/http-client.d.ts +115 -0
- package/lib/utils/src/object-utils.d.ts +35 -0
- package/lib/utils/src/string-utils.d.ts +32 -0
- package/lib/utils/src/types-utils.d.ts +12 -0
- package/package.json +35 -31
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## About
|
|
6
6
|
|
|
7
|
-
This repository contains the **Rules Manager** dependency for **JavaScript SDK** needed to integrate Convert.com's **Fullstack Product (feature tests, feature flags, feature rollouts)** inside third-party apps. This is maintained by the Convert.com team.
|
|
7
|
+
This repository contains the **Rules Manager** dependency for the **JavaScript SDK** needed to integrate Convert.com's **Fullstack Product (feature tests, feature flags, feature rollouts)** inside third-party apps. This is maintained by the Convert.com team.
|
|
8
8
|
|
|
9
9
|
## Credits
|
|
10
10
|
|
|
11
|
-
Copyright(c) 2023 Convert Insights, Inc.
|
|
11
|
+
Copyright (c) 2023 Convert Insights, Inc.
|
|
@@ -0,0 +1,26 @@
|
|
|
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/bucketing-error';
|
|
8
|
+
export * from './src/conversion-setting-key';
|
|
9
|
+
export * from './src/data-enitites';
|
|
10
|
+
export * from './src/dictionary';
|
|
11
|
+
export * from './src/do-not-track';
|
|
12
|
+
export * from './src/entity-type';
|
|
13
|
+
export * from './src/feature-status';
|
|
14
|
+
export * from './src/goal-data-key';
|
|
15
|
+
export * from './src/log-level';
|
|
16
|
+
export * from './src/log-method';
|
|
17
|
+
export * from './src/project-type';
|
|
18
|
+
export * from './src/rule-error';
|
|
19
|
+
export * from './src/system-events';
|
|
20
|
+
export * from './src/variable-types';
|
|
21
|
+
export * from './src/variation-change-type';
|
|
22
|
+
export * from './src/segments/browser-type';
|
|
23
|
+
export * from './src/segments/device-type';
|
|
24
|
+
export * from './src/segments/segments-keys';
|
|
25
|
+
export * from './src/segments/source-type';
|
|
26
|
+
export * from './src/segments/visitor-type';
|
|
@@ -0,0 +1,16 @@
|
|
|
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 declare const DATA_ENTITIES: string[];
|
|
8
|
+
export declare const DATA_ENTITIES_MAP: {
|
|
9
|
+
goal: string;
|
|
10
|
+
audience: string;
|
|
11
|
+
location: string;
|
|
12
|
+
segment: string;
|
|
13
|
+
experience: string;
|
|
14
|
+
variation: string;
|
|
15
|
+
feature: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
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 declare const ERROR_MESSAGES: {
|
|
8
|
+
SDK_KEY_MISSING: string;
|
|
9
|
+
DATA_OBJECT_MISSING: string;
|
|
10
|
+
CONFIG_DATA_NOT_VALID: string;
|
|
11
|
+
SDK_OR_DATA_OBJECT_REQUIRED: string;
|
|
12
|
+
RULE_NOT_VALID: string;
|
|
13
|
+
RULE_DATA_NOT_VALID: string;
|
|
14
|
+
RULE_MATCH_TYPE_NOT_SUPPORTED: string;
|
|
15
|
+
RULE_ERROR: string;
|
|
16
|
+
DATA_STORE_NOT_VALID: string;
|
|
17
|
+
VISITOR_ID_REQUIRED: string;
|
|
18
|
+
GOAL_DATA_NOT_VALID: string;
|
|
19
|
+
UNABLE_TO_SELECT_BUCKET_FOR_VISITOR: string;
|
|
20
|
+
UNABLE_TO_PERFORM_NETWORK_REQUEST: string;
|
|
21
|
+
UNSUPPORTED_RESPONSE_TYPE: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const MESSAGES: {
|
|
24
|
+
CONFIG_DATA_UPDATED: string;
|
|
25
|
+
CORE_CONSTRUCTOR: string;
|
|
26
|
+
CORE_INITIALIZED: string;
|
|
27
|
+
EXPERIENCE_CONSTRUCTOR: string;
|
|
28
|
+
EXPERIENCE_NOT_FOUND: string;
|
|
29
|
+
EXPERIENCE_ARCHIVED: string;
|
|
30
|
+
EXPERIENCE_ENVIRONMENT_NOT_MATCH: string;
|
|
31
|
+
EXPERIENCE_RULES_MATCHED: string;
|
|
32
|
+
VARIATIONS_NOT_FOUND: string;
|
|
33
|
+
VARIATION_CHANGE_NOT_SUPPORTED: string;
|
|
34
|
+
FEATURE_CONSTRUCTOR: string;
|
|
35
|
+
FEATURE_NOT_FOUND: string;
|
|
36
|
+
FEATURE_VARIABLES_NOT_FOUND: string;
|
|
37
|
+
FEATURE_VARIABLES_TYPE_NOT_FOUND: string;
|
|
38
|
+
BUCKETING_CONSTRUCTOR: string;
|
|
39
|
+
DATA_CONSTRUCTOR: string;
|
|
40
|
+
RULE_CONSTRUCTOR: string;
|
|
41
|
+
PROCESSING_ENTITY: string;
|
|
42
|
+
LOCATION_MATCH: string;
|
|
43
|
+
LOCATION_NOT_MATCH: string;
|
|
44
|
+
LOCATION_NOT_RESTRICTED: string;
|
|
45
|
+
AUDIENCE_MATCH: string;
|
|
46
|
+
AUDIENCE_NOT_MATCH: string;
|
|
47
|
+
NON_PERMANENT_AUDIENCE_NOT_RESTRICTED: string;
|
|
48
|
+
AUDIENCE_NOT_RESTRICTED: string;
|
|
49
|
+
SEGMENTATION_MATCH: string;
|
|
50
|
+
SEGMENTATION_NOT_RESTRICTED: string;
|
|
51
|
+
RULE_NOT_MATCH: string;
|
|
52
|
+
RULE_MATCH: string;
|
|
53
|
+
RULE_MATCH_AND: string;
|
|
54
|
+
RULE_MATCH_START: string;
|
|
55
|
+
LOCATION_ACTIVATED: string;
|
|
56
|
+
LOCATION_DEACTIVATED: string;
|
|
57
|
+
BUCKETED_VISITOR_FOUND: string;
|
|
58
|
+
BUCKETED_VISITOR_FORCED: string;
|
|
59
|
+
BUCKETED_VISITOR: string;
|
|
60
|
+
GOAL_NOT_FOUND: string;
|
|
61
|
+
GOAL_RULE_NOT_MATCH: string;
|
|
62
|
+
GOAL_FOUND: string;
|
|
63
|
+
SEGMENTS_NOT_FOUND: string;
|
|
64
|
+
SEGMENTS_RULE_NOT_MATCH: string;
|
|
65
|
+
CUSTOM_SEGMENTS_KEY_FOUND: string;
|
|
66
|
+
SEND_BEACON_SUCCESS: string;
|
|
67
|
+
RELEASING_QUEUE: string;
|
|
68
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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 declare enum EntityType {
|
|
8
|
+
AUDIENCE = "audience",
|
|
9
|
+
LOCATION = "location",
|
|
10
|
+
SEGMENT = "segment",
|
|
11
|
+
FEATURE = "feature",
|
|
12
|
+
GOAL = "goal",
|
|
13
|
+
EXPERIENCE = "experience",
|
|
14
|
+
VARIATION = "variation"
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 declare enum LogMethod {
|
|
8
|
+
LOG = "log",
|
|
9
|
+
TRACE = "trace",
|
|
10
|
+
DEBUG = "debug",
|
|
11
|
+
INFO = "info",
|
|
12
|
+
WARN = "warn",
|
|
13
|
+
ERROR = "error"
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 declare enum BrowserType {
|
|
8
|
+
IE = "IE",
|
|
9
|
+
CH = "CH",
|
|
10
|
+
FF = "FF",
|
|
11
|
+
OP = "OP",
|
|
12
|
+
SF = "SF",
|
|
13
|
+
EDG = "EDG",
|
|
14
|
+
MO = "MO",
|
|
15
|
+
NS = "NS",
|
|
16
|
+
OTH = "OTH"
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 declare enum DeviceType {
|
|
8
|
+
ALLPH = "ALLPH",
|
|
9
|
+
IPH = "IPH",
|
|
10
|
+
OTHPH = "OTHPH",
|
|
11
|
+
ALLTAB = "ALLTAB",
|
|
12
|
+
IPAD = "IPAD",
|
|
13
|
+
OTHTAB = "OTHTAB",
|
|
14
|
+
DESK = "DESK",
|
|
15
|
+
OTHDEV = "OTHDEV"
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 declare enum SegmentsKeys {
|
|
8
|
+
COUNTRY = "country",
|
|
9
|
+
BROWSER = "browser",
|
|
10
|
+
DEVICES = "devices",
|
|
11
|
+
SOURCE = "source",
|
|
12
|
+
CAMPAIGN = "campaign",
|
|
13
|
+
VISITOR_TYPE = "visitorType",
|
|
14
|
+
CUSTOM_SEGMENTS = "customSegments"
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
* SDK system events. Possible values: 'ready' | 'queue-released'
|
|
9
|
+
* or custom visitor's event
|
|
10
|
+
*/
|
|
11
|
+
export declare enum SystemEvents {
|
|
12
|
+
READY = "ready",
|
|
13
|
+
CONFIG_UPDATED = "config.updated",
|
|
14
|
+
API_QUEUE_RELEASED = "api.queue.released",
|
|
15
|
+
BUCKETING = "bucketing",
|
|
16
|
+
CONVERSION = "conversion",
|
|
17
|
+
SEGMENTS = "segments",
|
|
18
|
+
LOCATION_ACTIVATED = "location.activated",
|
|
19
|
+
LOCATION_DEACTIVATED = "location.deactivated",
|
|
20
|
+
AUDIENCES = "audiences",
|
|
21
|
+
DATA_STORE_QUEUE_RELEASED = "datastore.queue.released"
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 declare enum VariationChangeType {
|
|
8
|
+
RICH_STRUCTURE = "richStructure",
|
|
9
|
+
CUSTOM_CODE = "customCode",
|
|
10
|
+
DEFAULT_CODE = "defaultCode",
|
|
11
|
+
DEFAULT_CODE_MULTIPAGE = "defaultCodeMultipage",
|
|
12
|
+
DEFAULT_REDIRECT = "defaultRedirect",
|
|
13
|
+
FULLSTACK_FEATURE = "fullStackFeature"
|
|
14
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RuleObject, RuleElement, Config } from '
|
|
2
|
-
import { RuleError } from '
|
|
3
|
-
import { LogManagerInterface } from '
|
|
1
|
+
import { RuleObject, RuleElement, Config } from './types';
|
|
2
|
+
import { RuleError } from './enums';
|
|
3
|
+
import { LogManagerInterface } from './logger';
|
|
4
4
|
|
|
5
5
|
/*!
|
|
6
6
|
* Convert JS SDK
|
|
@@ -14,6 +14,7 @@ interface RuleManagerInterface {
|
|
|
14
14
|
getComparisonProcessorMethods(): Array<string>;
|
|
15
15
|
isRuleMatched(data: Record<string, any>, ruleSet: RuleObject, logEntry?: string): boolean | RuleError;
|
|
16
16
|
isValidRule(rule: RuleElement): boolean;
|
|
17
|
+
isUsingCustomInterface(data: Record<string, any>): boolean;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -92,7 +93,7 @@ declare class RuleManager implements RuleManagerInterface {
|
|
|
92
93
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
93
94
|
* @return {boolean}
|
|
94
95
|
*/
|
|
95
|
-
|
|
96
|
+
isUsingCustomInterface(data: Record<string, any>): boolean;
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
export { RuleManager, type RuleManagerInterface };
|