@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/lib/legacy/index.js
CHANGED
|
@@ -1,7 +1,297 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/*!
|
|
4
|
+
* Convert JS SDK
|
|
5
|
+
* Version 1.0.0
|
|
6
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
7
|
+
* License Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Validates variable is array and not empty
|
|
11
|
+
* @param array
|
|
12
|
+
*/
|
|
13
|
+
function arrayNotEmpty(array) {
|
|
14
|
+
return Array.isArray(array) && array.length > 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/*!
|
|
18
|
+
* Convert JS SDK
|
|
19
|
+
* Version 1.0.0
|
|
20
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
21
|
+
* License Apache-2.0
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Returns the value at path of object
|
|
25
|
+
* TODO: get this utility to work with the optional mapper() helper from config
|
|
26
|
+
* @param {Record<string, any>} object
|
|
27
|
+
* @param {string} path
|
|
28
|
+
* @param {any=} defaultValue
|
|
29
|
+
* @param {boolean=} truthy Should Number 0 number and Boolean false be considered as normal value
|
|
30
|
+
* @return {any}
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Validates variable is object and not empty
|
|
34
|
+
* @param object
|
|
35
|
+
*/
|
|
36
|
+
function objectNotEmpty(object) {
|
|
37
|
+
return (typeof object === 'object' &&
|
|
38
|
+
object !== null &&
|
|
39
|
+
Object.keys(object).length > 0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var murmurhash = {exports: {}};
|
|
43
|
+
|
|
44
|
+
(function (module) {
|
|
45
|
+
(function () {
|
|
46
|
+
const createBuffer = val => new TextEncoder().encode(val);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* JS Implementation of MurmurHash2
|
|
50
|
+
*
|
|
51
|
+
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
52
|
+
* @see http://github.com/garycourt/murmurhash-js
|
|
53
|
+
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
|
|
54
|
+
* @see http://sites.google.com/site/murmurhash/
|
|
55
|
+
*
|
|
56
|
+
* @param {Uint8Array | string} str ASCII only
|
|
57
|
+
* @param {number} seed Positive integer only
|
|
58
|
+
* @return {number} 32-bit positive integer hash
|
|
59
|
+
*/
|
|
60
|
+
function MurmurHashV2(str, seed) {
|
|
61
|
+
if (typeof str === 'string') str = createBuffer(str);
|
|
62
|
+
let l = str.length,
|
|
63
|
+
h = seed ^ l,
|
|
64
|
+
i = 0,
|
|
65
|
+
k;
|
|
66
|
+
while (l >= 4) {
|
|
67
|
+
k = str[i] & 0xff | (str[++i] & 0xff) << 8 | (str[++i] & 0xff) << 16 | (str[++i] & 0xff) << 24;
|
|
68
|
+
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
|
69
|
+
k ^= k >>> 24;
|
|
70
|
+
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
|
71
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
|
|
72
|
+
l -= 4;
|
|
73
|
+
++i;
|
|
74
|
+
}
|
|
75
|
+
switch (l) {
|
|
76
|
+
case 3:
|
|
77
|
+
h ^= (str[i + 2] & 0xff) << 16;
|
|
78
|
+
case 2:
|
|
79
|
+
h ^= (str[i + 1] & 0xff) << 8;
|
|
80
|
+
case 1:
|
|
81
|
+
h ^= str[i] & 0xff;
|
|
82
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
|
83
|
+
}
|
|
84
|
+
h ^= h >>> 13;
|
|
85
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
|
86
|
+
h ^= h >>> 15;
|
|
87
|
+
return h >>> 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/*
|
|
91
|
+
* JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)
|
|
92
|
+
*
|
|
93
|
+
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
94
|
+
* @see http://github.com/garycourt/murmurhash-js
|
|
95
|
+
* @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a>
|
|
96
|
+
* @see http://sites.google.com/site/murmurhash/
|
|
97
|
+
*
|
|
98
|
+
* @param {Uint8Array | string} key ASCII only
|
|
99
|
+
* @param {number} seed Positive integer only
|
|
100
|
+
* @return {number} 32-bit positive integer hash
|
|
101
|
+
*/
|
|
102
|
+
function MurmurHashV3(key, seed) {
|
|
103
|
+
if (typeof key === 'string') key = createBuffer(key);
|
|
104
|
+
let remainder, bytes, h1, h1b, c1, c2, k1, i;
|
|
105
|
+
remainder = key.length & 3; // key.length % 4
|
|
106
|
+
bytes = key.length - remainder;
|
|
107
|
+
h1 = seed;
|
|
108
|
+
c1 = 0xcc9e2d51;
|
|
109
|
+
c2 = 0x1b873593;
|
|
110
|
+
i = 0;
|
|
111
|
+
while (i < bytes) {
|
|
112
|
+
k1 = key[i] & 0xff | (key[++i] & 0xff) << 8 | (key[++i] & 0xff) << 16 | (key[++i] & 0xff) << 24;
|
|
113
|
+
++i;
|
|
114
|
+
k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
|
|
115
|
+
k1 = k1 << 15 | k1 >>> 17;
|
|
116
|
+
k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
|
|
117
|
+
h1 ^= k1;
|
|
118
|
+
h1 = h1 << 13 | h1 >>> 19;
|
|
119
|
+
h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
|
|
120
|
+
h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
|
|
121
|
+
}
|
|
122
|
+
k1 = 0;
|
|
123
|
+
switch (remainder) {
|
|
124
|
+
case 3:
|
|
125
|
+
k1 ^= (key[i + 2] & 0xff) << 16;
|
|
126
|
+
case 2:
|
|
127
|
+
k1 ^= (key[i + 1] & 0xff) << 8;
|
|
128
|
+
case 1:
|
|
129
|
+
k1 ^= key[i] & 0xff;
|
|
130
|
+
k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
|
|
131
|
+
k1 = k1 << 15 | k1 >>> 17;
|
|
132
|
+
k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
|
|
133
|
+
h1 ^= k1;
|
|
134
|
+
}
|
|
135
|
+
h1 ^= key.length;
|
|
136
|
+
h1 ^= h1 >>> 16;
|
|
137
|
+
h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
|
|
138
|
+
h1 ^= h1 >>> 13;
|
|
139
|
+
h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
|
|
140
|
+
h1 ^= h1 >>> 16;
|
|
141
|
+
return h1 >>> 0;
|
|
142
|
+
}
|
|
143
|
+
const murmur = MurmurHashV3;
|
|
144
|
+
murmur.v2 = MurmurHashV2;
|
|
145
|
+
murmur.v3 = MurmurHashV3;
|
|
146
|
+
{
|
|
147
|
+
module.exports = murmur;
|
|
148
|
+
}
|
|
149
|
+
})();
|
|
150
|
+
})(murmurhash);
|
|
151
|
+
|
|
152
|
+
/*!
|
|
153
|
+
* Convert JS SDK
|
|
154
|
+
* Version 1.0.0
|
|
155
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
156
|
+
* License Apache-2.0
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* String formatter tool. Transforms a space-separated string into camelCase
|
|
160
|
+
* @param {string} input
|
|
161
|
+
* @return {string}
|
|
162
|
+
*/
|
|
163
|
+
function camelCase(input) {
|
|
164
|
+
return input
|
|
165
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
|
|
166
|
+
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
167
|
+
})
|
|
168
|
+
.replace(/\s+/g, '');
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Check if a value is numeric
|
|
172
|
+
* @param {string | number} value
|
|
173
|
+
* @returns {boolean}
|
|
174
|
+
*/
|
|
175
|
+
function isNumeric(value) {
|
|
176
|
+
if (typeof value === 'number') {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
const number = parseFloat(String(value));
|
|
180
|
+
return Number.isFinite(number) && !isNaN(number);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Convert a string to a number
|
|
184
|
+
* @param {string | number} value
|
|
185
|
+
* @returns {number}
|
|
186
|
+
*/
|
|
187
|
+
function toNumber(value) {
|
|
188
|
+
if (typeof value === 'number') {
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
const parts = String(value).split(',');
|
|
192
|
+
return parseFloat(parts[0] == '0'
|
|
193
|
+
? String(value).replace(/,/g, '.')
|
|
194
|
+
: String(value).replace(/,/g, ''));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/*!
|
|
198
|
+
* Convert JS SDK
|
|
199
|
+
* Version 1.0.0
|
|
200
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
201
|
+
* License Apache-2.0
|
|
202
|
+
*/
|
|
203
|
+
var _a;
|
|
204
|
+
/**
|
|
205
|
+
* Comparison Processor. Provides comparison methods for rules validation
|
|
206
|
+
*/
|
|
207
|
+
class Comparisons {
|
|
208
|
+
static equals(value, testAgainst, negation) {
|
|
209
|
+
if (Array.isArray(value))
|
|
210
|
+
return this._returnNegationCheck(value.indexOf(testAgainst) !== -1, negation);
|
|
211
|
+
if (objectNotEmpty(value))
|
|
212
|
+
return this._returnNegationCheck(Object.keys(value).indexOf(String(testAgainst)) !== -1, negation);
|
|
213
|
+
value = String(value);
|
|
214
|
+
testAgainst = String(testAgainst);
|
|
215
|
+
value = value.valueOf().toLowerCase();
|
|
216
|
+
testAgainst = testAgainst.valueOf().toLowerCase();
|
|
217
|
+
return this._returnNegationCheck(value === testAgainst, negation);
|
|
218
|
+
}
|
|
219
|
+
static less(value, testAgainst, negation) {
|
|
220
|
+
value = isNumeric(value) ? toNumber(value) : value;
|
|
221
|
+
testAgainst = isNumeric(testAgainst) ? toNumber(testAgainst) : testAgainst;
|
|
222
|
+
if (typeof value !== typeof testAgainst) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
return this._returnNegationCheck(value < testAgainst, negation);
|
|
226
|
+
}
|
|
227
|
+
static lessEqual(value, testAgainst, negation) {
|
|
228
|
+
value = isNumeric(value) ? toNumber(value) : value;
|
|
229
|
+
testAgainst = isNumeric(testAgainst) ? toNumber(testAgainst) : testAgainst;
|
|
230
|
+
if (typeof value !== typeof testAgainst) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return this._returnNegationCheck(value <= testAgainst, negation);
|
|
234
|
+
}
|
|
235
|
+
static contains(value, testAgainst, negation) {
|
|
236
|
+
value = String(value);
|
|
237
|
+
testAgainst = String(testAgainst);
|
|
238
|
+
value = value.valueOf().toLowerCase();
|
|
239
|
+
testAgainst = testAgainst.valueOf().toLowerCase();
|
|
240
|
+
if (testAgainst.replace(/^([\s]*)|([\s]*)$/g, '').length === 0) {
|
|
241
|
+
return this._returnNegationCheck(true, negation);
|
|
242
|
+
}
|
|
243
|
+
return this._returnNegationCheck(value.indexOf(testAgainst) !== -1, negation);
|
|
244
|
+
}
|
|
245
|
+
static isIn(values, testAgainst, negation = false, splitter = '|') {
|
|
246
|
+
const matchedValuesArray = String(values)
|
|
247
|
+
.split(splitter)
|
|
248
|
+
.map((item) => {
|
|
249
|
+
return String(item);
|
|
250
|
+
});
|
|
251
|
+
if (typeof testAgainst === 'string') {
|
|
252
|
+
testAgainst = testAgainst.split(splitter);
|
|
253
|
+
}
|
|
254
|
+
if (!Array.isArray(testAgainst)) {
|
|
255
|
+
testAgainst = [];
|
|
256
|
+
}
|
|
257
|
+
testAgainst = testAgainst.map((item) => {
|
|
258
|
+
return String(item).valueOf().toLowerCase();
|
|
259
|
+
});
|
|
260
|
+
for (let i = 0; i < matchedValuesArray.length; i++) {
|
|
261
|
+
if (testAgainst.indexOf(matchedValuesArray[i]) !== -1) {
|
|
262
|
+
return this._returnNegationCheck(true, negation);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return this._returnNegationCheck(false, negation);
|
|
266
|
+
}
|
|
267
|
+
static startsWith(value, testAgainst, negation) {
|
|
268
|
+
value = String(value).valueOf().toLowerCase();
|
|
269
|
+
testAgainst = String(testAgainst).valueOf().toLowerCase();
|
|
270
|
+
return this._returnNegationCheck(value.indexOf(testAgainst) === 0, negation);
|
|
271
|
+
}
|
|
272
|
+
static endsWith(value, testAgainst, negation) {
|
|
273
|
+
value = String(value).valueOf().toLowerCase();
|
|
274
|
+
testAgainst = String(testAgainst).valueOf().toLowerCase();
|
|
275
|
+
return this._returnNegationCheck(value.indexOf(testAgainst, value.length - testAgainst.length) !== -1, negation);
|
|
276
|
+
}
|
|
277
|
+
static regexMatches(value, testAgainst, negation) {
|
|
278
|
+
value = String(value).valueOf().toLowerCase();
|
|
279
|
+
testAgainst = String(testAgainst).valueOf();
|
|
280
|
+
const regExp = new RegExp(testAgainst, 'i');
|
|
281
|
+
return this._returnNegationCheck(regExp.test(value), negation);
|
|
282
|
+
}
|
|
283
|
+
static _returnNegationCheck(value, negation = false) {
|
|
284
|
+
if (negation) {
|
|
285
|
+
return !value;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
return value;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
_a = Comparisons;
|
|
293
|
+
Comparisons.equalsNumber = _a.equals;
|
|
294
|
+
Comparisons.matches = _a.equals;
|
|
5
295
|
|
|
6
296
|
/******************************************************************************
|
|
7
297
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,122 +310,509 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
20
310
|
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
21
311
|
|
|
22
312
|
|
|
23
|
-
function __values(o) {
|
|
24
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
25
|
-
if (m) return m.call(o);
|
|
26
|
-
if (o && typeof o.length === "number") return {
|
|
27
|
-
next: function () {
|
|
28
|
-
if (o && i >= o.length) o = void 0;
|
|
29
|
-
return { value: o && o[i++], done: !o };
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
313
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
36
314
|
var e = new Error(message);
|
|
37
315
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
38
316
|
};
|
|
39
317
|
|
|
40
|
-
|
|
41
|
-
|
|
318
|
+
/*!
|
|
319
|
+
* Convert JS SDK
|
|
320
|
+
* Version 1.0.0
|
|
321
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
322
|
+
* License Apache-2.0
|
|
323
|
+
*/
|
|
324
|
+
var BucketingError;
|
|
325
|
+
(function (BucketingError) {
|
|
326
|
+
BucketingError["VARIAION_NOT_DECIDED"] = "convert.com_variation_not_decided";
|
|
327
|
+
})(BucketingError || (BucketingError = {}));
|
|
328
|
+
|
|
329
|
+
/*!
|
|
330
|
+
* Convert JS SDK
|
|
331
|
+
* Version 1.0.0
|
|
332
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
333
|
+
* License Apache-2.0
|
|
334
|
+
*/
|
|
335
|
+
var ConversionSettingKey;
|
|
336
|
+
(function (ConversionSettingKey) {
|
|
337
|
+
ConversionSettingKey["FORCE_MULTIPLE_TRANSACTIONS"] = "forceMultipleTransactions";
|
|
338
|
+
})(ConversionSettingKey || (ConversionSettingKey = {}));
|
|
339
|
+
|
|
340
|
+
/*!
|
|
341
|
+
* Convert JS SDK
|
|
342
|
+
* Version 1.0.0
|
|
343
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
344
|
+
* License Apache-2.0
|
|
345
|
+
*/
|
|
346
|
+
const ERROR_MESSAGES = {
|
|
347
|
+
SDK_KEY_MISSING: 'SDK key is missing',
|
|
348
|
+
DATA_OBJECT_MISSING: 'Data object is missing',
|
|
349
|
+
CONFIG_DATA_NOT_VALID: 'Config Data is not valid',
|
|
350
|
+
SDK_OR_DATA_OBJECT_REQUIRED: 'SDK key or Data object should be provided',
|
|
351
|
+
RULE_NOT_VALID: 'Provided rule is not valid',
|
|
352
|
+
RULE_DATA_NOT_VALID: 'Provided rule data is not valid',
|
|
353
|
+
RULE_MATCH_TYPE_NOT_SUPPORTED: 'Provided rule matching type "#" is not supported',
|
|
354
|
+
RULE_ERROR: 'Rule error',
|
|
355
|
+
DATA_STORE_NOT_VALID: 'DataStore object is not valid. It should contain get and set methods',
|
|
356
|
+
VISITOR_ID_REQUIRED: 'Visitor string string is not present',
|
|
357
|
+
GOAL_DATA_NOT_VALID: 'GoalData object is not valid',
|
|
358
|
+
UNABLE_TO_SELECT_BUCKET_FOR_VISITOR: 'Unable to bucket visitor',
|
|
359
|
+
UNABLE_TO_PERFORM_NETWORK_REQUEST: 'Unable to perform network request',
|
|
360
|
+
UNSUPPORTED_RESPONSE_TYPE: 'Unsupported response type'
|
|
361
|
+
};
|
|
362
|
+
const MESSAGES = {
|
|
363
|
+
CONFIG_DATA_UPDATED: 'Config Data updated',
|
|
364
|
+
CORE_CONSTRUCTOR: 'Core Manager constructor has been called',
|
|
365
|
+
CORE_INITIALIZED: 'Core Manager has been initialized',
|
|
366
|
+
EXPERIENCE_CONSTRUCTOR: 'Experience Manager constructor has been called',
|
|
367
|
+
EXPERIENCE_NOT_FOUND: 'Experience not found',
|
|
368
|
+
EXPERIENCE_ARCHIVED: 'Experience archived',
|
|
369
|
+
EXPERIENCE_ENVIRONMENT_NOT_MATCH: 'Experience environment does not match',
|
|
370
|
+
EXPERIENCE_RULES_MATCHED: 'Experience rules matched',
|
|
371
|
+
VARIATIONS_NOT_FOUND: 'Variations not found',
|
|
372
|
+
VARIATION_CHANGE_NOT_SUPPORTED: 'Variation change not supported',
|
|
373
|
+
FEATURE_CONSTRUCTOR: 'Feature Manager constructor has been called',
|
|
374
|
+
FEATURE_NOT_FOUND: 'Fullstack Feature not found',
|
|
375
|
+
FEATURE_VARIABLES_NOT_FOUND: 'Fullstack Feature Variables not found',
|
|
376
|
+
FEATURE_VARIABLES_TYPE_NOT_FOUND: 'Fullstack Feature Variables Type not found',
|
|
377
|
+
BUCKETING_CONSTRUCTOR: 'Bucketing Manager constructor has been called',
|
|
378
|
+
DATA_CONSTRUCTOR: 'Data Manager constructor has been called',
|
|
379
|
+
RULE_CONSTRUCTOR: 'Rule Manager constructor has been called',
|
|
380
|
+
PROCESSING_ENTITY: 'Processing #',
|
|
381
|
+
LOCATION_MATCH: 'Location # rule matched',
|
|
382
|
+
LOCATION_NOT_MATCH: 'Location does not match',
|
|
383
|
+
LOCATION_NOT_RESTRICTED: 'Location not restricted',
|
|
384
|
+
AUDIENCE_MATCH: 'Audience # rule matched',
|
|
385
|
+
AUDIENCE_NOT_MATCH: 'Audience does not match',
|
|
386
|
+
NON_PERMANENT_AUDIENCE_NOT_RESTRICTED: 'Non-Permanent Audience not restricted',
|
|
387
|
+
AUDIENCE_NOT_RESTRICTED: 'Audience not restricted',
|
|
388
|
+
SEGMENTATION_MATCH: 'Segmentation # rule matched',
|
|
389
|
+
SEGMENTATION_NOT_RESTRICTED: 'Segmentation not restricted',
|
|
390
|
+
RULE_NOT_MATCH: 'Rule does not match',
|
|
391
|
+
RULE_MATCH: 'Found matched rule at OR block #',
|
|
392
|
+
RULE_MATCH_AND: 'AND block rule macthed',
|
|
393
|
+
RULE_MATCH_START: 'About to evaluate rule #',
|
|
394
|
+
LOCATION_ACTIVATED: 'Location # activated',
|
|
395
|
+
LOCATION_DEACTIVATED: 'Location # deactivated',
|
|
396
|
+
BUCKETED_VISITOR_FOUND: 'Visitor is already bucketed for variation #',
|
|
397
|
+
BUCKETED_VISITOR_FORCED: 'Forcing variation #',
|
|
398
|
+
BUCKETED_VISITOR: 'Visitor is bucketed for variation #',
|
|
399
|
+
GOAL_NOT_FOUND: 'Goal not found',
|
|
400
|
+
GOAL_RULE_NOT_MATCH: 'Goal rule do not match',
|
|
401
|
+
GOAL_FOUND: 'Goal # already triggered',
|
|
402
|
+
SEGMENTS_NOT_FOUND: 'Segments not found',
|
|
403
|
+
SEGMENTS_RULE_NOT_MATCH: 'Segments rule do not match',
|
|
404
|
+
CUSTOM_SEGMENTS_KEY_FOUND: 'Custom segments key already set',
|
|
405
|
+
SEND_BEACON_SUCCESS: 'The user agent successfully queued the data for transfer',
|
|
406
|
+
RELEASING_QUEUE: 'Releasing event queue...'
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
/*!
|
|
410
|
+
* Convert JS SDK
|
|
411
|
+
* Version 1.0.0
|
|
412
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
413
|
+
* License Apache-2.0
|
|
414
|
+
*/
|
|
415
|
+
var DoNotTrack;
|
|
416
|
+
(function (DoNotTrack) {
|
|
417
|
+
DoNotTrack["OFF"] = "OFF";
|
|
418
|
+
DoNotTrack["EU_ONLY"] = "EU ONLY";
|
|
419
|
+
DoNotTrack["EEA_ONLY"] = "EEA ONLY";
|
|
420
|
+
DoNotTrack["WORLDWIDE"] = "Worldwide";
|
|
421
|
+
})(DoNotTrack || (DoNotTrack = {}));
|
|
422
|
+
|
|
423
|
+
/*!
|
|
424
|
+
* Convert JS SDK
|
|
425
|
+
* Version 1.0.0
|
|
426
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
427
|
+
* License Apache-2.0
|
|
428
|
+
*/
|
|
429
|
+
var EntityType;
|
|
430
|
+
(function (EntityType) {
|
|
431
|
+
EntityType["AUDIENCE"] = "audience";
|
|
432
|
+
EntityType["LOCATION"] = "location";
|
|
433
|
+
EntityType["SEGMENT"] = "segment";
|
|
434
|
+
EntityType["FEATURE"] = "feature";
|
|
435
|
+
EntityType["GOAL"] = "goal";
|
|
436
|
+
EntityType["EXPERIENCE"] = "experience";
|
|
437
|
+
EntityType["VARIATION"] = "variation";
|
|
438
|
+
})(EntityType || (EntityType = {}));
|
|
439
|
+
|
|
440
|
+
/*!
|
|
441
|
+
* Convert JS SDK
|
|
442
|
+
* Version 1.0.0
|
|
443
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
444
|
+
* License Apache-2.0
|
|
445
|
+
*/
|
|
446
|
+
var FeatureStatus;
|
|
447
|
+
(function (FeatureStatus) {
|
|
448
|
+
FeatureStatus["ENABLED"] = "enabled";
|
|
449
|
+
FeatureStatus["DISABLED"] = "disabled";
|
|
450
|
+
})(FeatureStatus || (FeatureStatus = {}));
|
|
451
|
+
|
|
452
|
+
/*!
|
|
453
|
+
* Convert JS SDK
|
|
454
|
+
* Version 1.0.0
|
|
455
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
456
|
+
* License Apache-2.0
|
|
457
|
+
*/
|
|
458
|
+
var GoalDataKey;
|
|
459
|
+
(function (GoalDataKey) {
|
|
460
|
+
GoalDataKey["AMOUNT"] = "amount";
|
|
461
|
+
GoalDataKey["PRODUCTS_COUNT"] = "productsCount";
|
|
462
|
+
GoalDataKey["TRANSACTION_ID"] = "transactionId";
|
|
463
|
+
})(GoalDataKey || (GoalDataKey = {}));
|
|
464
|
+
|
|
465
|
+
/*!
|
|
466
|
+
* Convert JS SDK
|
|
467
|
+
* Version 1.0.0
|
|
468
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
469
|
+
* License Apache-2.0
|
|
470
|
+
*/
|
|
471
|
+
var LogLevel;
|
|
472
|
+
(function (LogLevel) {
|
|
473
|
+
LogLevel[LogLevel["TRACE"] = 0] = "TRACE";
|
|
474
|
+
LogLevel[LogLevel["DEBUG"] = 1] = "DEBUG";
|
|
475
|
+
LogLevel[LogLevel["INFO"] = 2] = "INFO";
|
|
476
|
+
LogLevel[LogLevel["WARN"] = 3] = "WARN";
|
|
477
|
+
LogLevel[LogLevel["ERROR"] = 4] = "ERROR";
|
|
478
|
+
LogLevel[LogLevel["SILENT"] = 5] = "SILENT";
|
|
479
|
+
})(LogLevel || (LogLevel = {}));
|
|
480
|
+
|
|
481
|
+
/*!
|
|
482
|
+
* Convert JS SDK
|
|
483
|
+
* Version 1.0.0
|
|
484
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
485
|
+
* License Apache-2.0
|
|
486
|
+
*/
|
|
487
|
+
var LogMethod;
|
|
488
|
+
(function (LogMethod) {
|
|
489
|
+
LogMethod["LOG"] = "log";
|
|
490
|
+
LogMethod["TRACE"] = "trace";
|
|
491
|
+
LogMethod["DEBUG"] = "debug";
|
|
492
|
+
LogMethod["INFO"] = "info";
|
|
493
|
+
LogMethod["WARN"] = "warn";
|
|
494
|
+
LogMethod["ERROR"] = "error";
|
|
495
|
+
})(LogMethod || (LogMethod = {}));
|
|
496
|
+
|
|
497
|
+
/*!
|
|
498
|
+
* Convert JS SDK
|
|
499
|
+
* Version 1.0.0
|
|
500
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
501
|
+
* License Apache-2.0
|
|
502
|
+
*/
|
|
503
|
+
var ProjectType;
|
|
504
|
+
(function (ProjectType) {
|
|
505
|
+
ProjectType["WEB"] = "web";
|
|
506
|
+
ProjectType["FULLSTACK"] = "fullstack";
|
|
507
|
+
})(ProjectType || (ProjectType = {}));
|
|
508
|
+
|
|
509
|
+
/*!
|
|
510
|
+
* Convert JS SDK
|
|
511
|
+
* Version 1.0.0
|
|
512
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
513
|
+
* License Apache-2.0
|
|
514
|
+
*/
|
|
515
|
+
var RuleError;
|
|
516
|
+
(function (RuleError) {
|
|
517
|
+
RuleError["NO_DATA_FOUND"] = "convert.com_no_data_found";
|
|
518
|
+
RuleError["NEED_MORE_DATA"] = "convert.com_need_more_data";
|
|
519
|
+
})(RuleError || (RuleError = {}));
|
|
520
|
+
|
|
521
|
+
/*!
|
|
522
|
+
* Convert JS SDK
|
|
523
|
+
* Version 1.0.0
|
|
524
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
525
|
+
* License Apache-2.0
|
|
526
|
+
*/
|
|
527
|
+
/**
|
|
528
|
+
* SDK system events. Possible values: 'ready' | 'queue-released'
|
|
529
|
+
* or custom visitor's event
|
|
530
|
+
*/
|
|
531
|
+
var SystemEvents;
|
|
532
|
+
(function (SystemEvents) {
|
|
533
|
+
SystemEvents["READY"] = "ready";
|
|
534
|
+
SystemEvents["CONFIG_UPDATED"] = "config.updated";
|
|
535
|
+
SystemEvents["API_QUEUE_RELEASED"] = "api.queue.released";
|
|
536
|
+
SystemEvents["BUCKETING"] = "bucketing";
|
|
537
|
+
SystemEvents["CONVERSION"] = "conversion";
|
|
538
|
+
SystemEvents["SEGMENTS"] = "segments";
|
|
539
|
+
SystemEvents["LOCATION_ACTIVATED"] = "location.activated";
|
|
540
|
+
SystemEvents["LOCATION_DEACTIVATED"] = "location.deactivated";
|
|
541
|
+
SystemEvents["AUDIENCES"] = "audiences";
|
|
542
|
+
SystemEvents["DATA_STORE_QUEUE_RELEASED"] = "datastore.queue.released";
|
|
543
|
+
})(SystemEvents || (SystemEvents = {}));
|
|
544
|
+
|
|
545
|
+
/*!
|
|
546
|
+
* Convert JS SDK
|
|
547
|
+
* Version 1.0.0
|
|
548
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
549
|
+
* License Apache-2.0
|
|
550
|
+
*/
|
|
551
|
+
var VariationChangeType;
|
|
552
|
+
(function (VariationChangeType) {
|
|
553
|
+
VariationChangeType["RICH_STRUCTURE"] = "richStructure";
|
|
554
|
+
VariationChangeType["CUSTOM_CODE"] = "customCode";
|
|
555
|
+
VariationChangeType["DEFAULT_CODE"] = "defaultCode";
|
|
556
|
+
VariationChangeType["DEFAULT_CODE_MULTIPAGE"] = "defaultCodeMultipage";
|
|
557
|
+
VariationChangeType["DEFAULT_REDIRECT"] = "defaultRedirect";
|
|
558
|
+
VariationChangeType["FULLSTACK_FEATURE"] = "fullStackFeature";
|
|
559
|
+
})(VariationChangeType || (VariationChangeType = {}));
|
|
560
|
+
|
|
561
|
+
/*!
|
|
562
|
+
* Convert JS SDK
|
|
563
|
+
* Version 1.0.0
|
|
564
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
565
|
+
* License Apache-2.0
|
|
566
|
+
*/
|
|
567
|
+
var BrowserType;
|
|
568
|
+
(function (BrowserType) {
|
|
569
|
+
BrowserType["IE"] = "IE";
|
|
570
|
+
BrowserType["CH"] = "CH";
|
|
571
|
+
BrowserType["FF"] = "FF";
|
|
572
|
+
BrowserType["OP"] = "OP";
|
|
573
|
+
BrowserType["SF"] = "SF";
|
|
574
|
+
BrowserType["EDG"] = "EDG";
|
|
575
|
+
BrowserType["MO"] = "MO";
|
|
576
|
+
BrowserType["NS"] = "NS";
|
|
577
|
+
BrowserType["OTH"] = "OTH";
|
|
578
|
+
})(BrowserType || (BrowserType = {}));
|
|
579
|
+
|
|
580
|
+
/*!
|
|
581
|
+
* Convert JS SDK
|
|
582
|
+
* Version 1.0.0
|
|
583
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
584
|
+
* License Apache-2.0
|
|
585
|
+
*/
|
|
586
|
+
var DeviceType;
|
|
587
|
+
(function (DeviceType) {
|
|
588
|
+
DeviceType["ALLPH"] = "ALLPH";
|
|
589
|
+
DeviceType["IPH"] = "IPH";
|
|
590
|
+
DeviceType["OTHPH"] = "OTHPH";
|
|
591
|
+
DeviceType["ALLTAB"] = "ALLTAB";
|
|
592
|
+
DeviceType["IPAD"] = "IPAD";
|
|
593
|
+
DeviceType["OTHTAB"] = "OTHTAB";
|
|
594
|
+
DeviceType["DESK"] = "DESK";
|
|
595
|
+
DeviceType["OTHDEV"] = "OTHDEV";
|
|
596
|
+
})(DeviceType || (DeviceType = {}));
|
|
597
|
+
|
|
598
|
+
/*!
|
|
599
|
+
* Convert JS SDK
|
|
600
|
+
* Version 1.0.0
|
|
601
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
602
|
+
* License Apache-2.0
|
|
603
|
+
*/
|
|
604
|
+
var SegmentsKeys;
|
|
605
|
+
(function (SegmentsKeys) {
|
|
606
|
+
SegmentsKeys["COUNTRY"] = "country";
|
|
607
|
+
SegmentsKeys["BROWSER"] = "browser";
|
|
608
|
+
SegmentsKeys["DEVICES"] = "devices";
|
|
609
|
+
SegmentsKeys["SOURCE"] = "source";
|
|
610
|
+
SegmentsKeys["CAMPAIGN"] = "campaign";
|
|
611
|
+
SegmentsKeys["VISITOR_TYPE"] = "visitorType";
|
|
612
|
+
SegmentsKeys["CUSTOM_SEGMENTS"] = "customSegments";
|
|
613
|
+
})(SegmentsKeys || (SegmentsKeys = {}));
|
|
614
|
+
|
|
615
|
+
/*!
|
|
616
|
+
* Convert JS SDK
|
|
617
|
+
* Version 1.0.0
|
|
618
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
619
|
+
* License Apache-2.0
|
|
620
|
+
*/
|
|
621
|
+
var SourceType;
|
|
622
|
+
(function (SourceType) {
|
|
623
|
+
SourceType["CAMPAIGN"] = "campaign";
|
|
624
|
+
SourceType["SEARCH"] = "search";
|
|
625
|
+
SourceType["REFERRAL"] = "referral";
|
|
626
|
+
SourceType["DIRECT"] = "direct";
|
|
627
|
+
})(SourceType || (SourceType = {}));
|
|
628
|
+
|
|
629
|
+
/*!
|
|
630
|
+
* Convert JS SDK
|
|
631
|
+
* Version 1.0.0
|
|
632
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
633
|
+
* License Apache-2.0
|
|
634
|
+
*/
|
|
635
|
+
var VisitorType;
|
|
636
|
+
(function (VisitorType) {
|
|
637
|
+
VisitorType["NEW"] = "new";
|
|
638
|
+
VisitorType["RETURNING"] = "returning";
|
|
639
|
+
})(VisitorType || (VisitorType = {}));
|
|
640
|
+
|
|
641
|
+
/*!
|
|
642
|
+
* Convert JS SDK
|
|
643
|
+
* Version 1.0.0
|
|
644
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
645
|
+
* License Apache-2.0
|
|
646
|
+
*/
|
|
647
|
+
var HttpStatusCode;
|
|
648
|
+
(function (HttpStatusCode) {
|
|
649
|
+
HttpStatusCode[HttpStatusCode["Continue"] = 100] = "Continue";
|
|
650
|
+
HttpStatusCode[HttpStatusCode["SwitchingProtocols"] = 101] = "SwitchingProtocols";
|
|
651
|
+
HttpStatusCode[HttpStatusCode["Processing"] = 102] = "Processing";
|
|
652
|
+
HttpStatusCode[HttpStatusCode["EarlyHints"] = 103] = "EarlyHints";
|
|
653
|
+
HttpStatusCode[HttpStatusCode["Ok"] = 200] = "Ok";
|
|
654
|
+
HttpStatusCode[HttpStatusCode["Created"] = 201] = "Created";
|
|
655
|
+
HttpStatusCode[HttpStatusCode["Accepted"] = 202] = "Accepted";
|
|
656
|
+
HttpStatusCode[HttpStatusCode["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
|
|
657
|
+
HttpStatusCode[HttpStatusCode["NoContent"] = 204] = "NoContent";
|
|
658
|
+
HttpStatusCode[HttpStatusCode["ResetContent"] = 205] = "ResetContent";
|
|
659
|
+
HttpStatusCode[HttpStatusCode["PartialContent"] = 206] = "PartialContent";
|
|
660
|
+
HttpStatusCode[HttpStatusCode["MultiStatus"] = 207] = "MultiStatus";
|
|
661
|
+
HttpStatusCode[HttpStatusCode["AlreadyReported"] = 208] = "AlreadyReported";
|
|
662
|
+
HttpStatusCode[HttpStatusCode["ImUsed"] = 226] = "ImUsed";
|
|
663
|
+
HttpStatusCode[HttpStatusCode["MultipleChoices"] = 300] = "MultipleChoices";
|
|
664
|
+
HttpStatusCode[HttpStatusCode["MovedPermanently"] = 301] = "MovedPermanently";
|
|
665
|
+
HttpStatusCode[HttpStatusCode["Found"] = 302] = "Found";
|
|
666
|
+
HttpStatusCode[HttpStatusCode["SeeOther"] = 303] = "SeeOther";
|
|
667
|
+
HttpStatusCode[HttpStatusCode["NotModified"] = 304] = "NotModified";
|
|
668
|
+
HttpStatusCode[HttpStatusCode["UseProxy"] = 305] = "UseProxy";
|
|
669
|
+
HttpStatusCode[HttpStatusCode["Unused"] = 306] = "Unused";
|
|
670
|
+
HttpStatusCode[HttpStatusCode["TemporaryRedirect"] = 307] = "TemporaryRedirect";
|
|
671
|
+
HttpStatusCode[HttpStatusCode["PermanentRedirect"] = 308] = "PermanentRedirect";
|
|
672
|
+
HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
|
|
673
|
+
HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
|
|
674
|
+
HttpStatusCode[HttpStatusCode["PaymentRequired"] = 402] = "PaymentRequired";
|
|
675
|
+
HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
|
|
676
|
+
HttpStatusCode[HttpStatusCode["NotFound"] = 404] = "NotFound";
|
|
677
|
+
HttpStatusCode[HttpStatusCode["MethodNotAllowed"] = 405] = "MethodNotAllowed";
|
|
678
|
+
HttpStatusCode[HttpStatusCode["NotAcceptable"] = 406] = "NotAcceptable";
|
|
679
|
+
HttpStatusCode[HttpStatusCode["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
|
|
680
|
+
HttpStatusCode[HttpStatusCode["RequestTimeout"] = 408] = "RequestTimeout";
|
|
681
|
+
HttpStatusCode[HttpStatusCode["Conflict"] = 409] = "Conflict";
|
|
682
|
+
HttpStatusCode[HttpStatusCode["Gone"] = 410] = "Gone";
|
|
683
|
+
HttpStatusCode[HttpStatusCode["LengthRequired"] = 411] = "LengthRequired";
|
|
684
|
+
HttpStatusCode[HttpStatusCode["PreconditionFailed"] = 412] = "PreconditionFailed";
|
|
685
|
+
HttpStatusCode[HttpStatusCode["PayloadTooLarge"] = 413] = "PayloadTooLarge";
|
|
686
|
+
HttpStatusCode[HttpStatusCode["UriTooLong"] = 414] = "UriTooLong";
|
|
687
|
+
HttpStatusCode[HttpStatusCode["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
|
|
688
|
+
HttpStatusCode[HttpStatusCode["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
|
|
689
|
+
HttpStatusCode[HttpStatusCode["ExpectationFailed"] = 417] = "ExpectationFailed";
|
|
690
|
+
HttpStatusCode[HttpStatusCode["ImATeapot"] = 418] = "ImATeapot";
|
|
691
|
+
HttpStatusCode[HttpStatusCode["MisdirectedRequest"] = 421] = "MisdirectedRequest";
|
|
692
|
+
HttpStatusCode[HttpStatusCode["UnprocessableEntity"] = 422] = "UnprocessableEntity";
|
|
693
|
+
HttpStatusCode[HttpStatusCode["Locked"] = 423] = "Locked";
|
|
694
|
+
HttpStatusCode[HttpStatusCode["FailedDependency"] = 424] = "FailedDependency";
|
|
695
|
+
HttpStatusCode[HttpStatusCode["TooEarly"] = 425] = "TooEarly";
|
|
696
|
+
HttpStatusCode[HttpStatusCode["UpgradeRequired"] = 426] = "UpgradeRequired";
|
|
697
|
+
HttpStatusCode[HttpStatusCode["PreconditionRequired"] = 428] = "PreconditionRequired";
|
|
698
|
+
HttpStatusCode[HttpStatusCode["TooManyRequests"] = 429] = "TooManyRequests";
|
|
699
|
+
HttpStatusCode[HttpStatusCode["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
|
|
700
|
+
HttpStatusCode[HttpStatusCode["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
|
|
701
|
+
HttpStatusCode[HttpStatusCode["InternalServerError"] = 500] = "InternalServerError";
|
|
702
|
+
HttpStatusCode[HttpStatusCode["NotImplemented"] = 501] = "NotImplemented";
|
|
703
|
+
HttpStatusCode[HttpStatusCode["BadGateway"] = 502] = "BadGateway";
|
|
704
|
+
HttpStatusCode[HttpStatusCode["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
|
705
|
+
HttpStatusCode[HttpStatusCode["GatewayTimeout"] = 504] = "GatewayTimeout";
|
|
706
|
+
HttpStatusCode[HttpStatusCode["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
|
|
707
|
+
HttpStatusCode[HttpStatusCode["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
|
|
708
|
+
HttpStatusCode[HttpStatusCode["InsufficientStorage"] = 507] = "InsufficientStorage";
|
|
709
|
+
HttpStatusCode[HttpStatusCode["LoopDetected"] = 508] = "LoopDetected";
|
|
710
|
+
HttpStatusCode[HttpStatusCode["NotExtended"] = 510] = "NotExtended";
|
|
711
|
+
HttpStatusCode[HttpStatusCode["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
|
|
712
|
+
})(HttpStatusCode || (HttpStatusCode = {}));
|
|
713
|
+
|
|
714
|
+
/*!
|
|
715
|
+
* Convert JS SDK
|
|
716
|
+
* Version 1.0.0
|
|
717
|
+
* Copyright(c) 2020 Convert Insights, Inc
|
|
718
|
+
* License Apache-2.0
|
|
719
|
+
*/
|
|
720
|
+
const DEFAULT_KEYS_CASE_SENSITIVE = true;
|
|
721
|
+
const DEFAULT_NEGATION = '!';
|
|
42
722
|
/**
|
|
43
723
|
* Provides rule processing calculations with corresponding comparisons methods
|
|
44
724
|
* @category Modules
|
|
45
725
|
* @constructor
|
|
46
726
|
* @implements {RuleManagerInterface}
|
|
47
727
|
*/
|
|
48
|
-
|
|
728
|
+
class RuleManager {
|
|
49
729
|
/**
|
|
50
730
|
* @param {Config=} config
|
|
51
731
|
* @param {Object=} dependencies
|
|
52
732
|
* @param {LogManagerInterface=} dependencies.loggerManager
|
|
53
733
|
*/
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
this._comparisonProcessor = jsSdkUtils.Comparisons;
|
|
734
|
+
constructor(config, { loggerManager } = {}) {
|
|
735
|
+
var _a, _b, _c, _d, _e;
|
|
736
|
+
this._comparisonProcessor = Comparisons;
|
|
58
737
|
this._negation = DEFAULT_NEGATION;
|
|
59
738
|
this._keys_case_sensitive = DEFAULT_KEYS_CASE_SENSITIVE;
|
|
60
739
|
this._loggerManager = loggerManager;
|
|
61
740
|
this._comparisonProcessor =
|
|
62
|
-
((
|
|
63
|
-
this._negation = String(((
|
|
741
|
+
((_a = config === null || config === void 0 ? void 0 : config.rules) === null || _a === void 0 ? void 0 : _a.comparisonProcessor) || Comparisons;
|
|
742
|
+
this._negation = String(((_b = config === null || config === void 0 ? void 0 : config.rules) === null || _b === void 0 ? void 0 : _b.negation) || DEFAULT_NEGATION);
|
|
64
743
|
this._keys_case_sensitive =
|
|
65
|
-
((
|
|
66
|
-
this._mapper = (config === null || config === void 0 ? void 0 : config.mapper) || (
|
|
67
|
-
(
|
|
744
|
+
((_c = config === null || config === void 0 ? void 0 : config.rules) === null || _c === void 0 ? void 0 : _c.keys_case_sensitive) || DEFAULT_KEYS_CASE_SENSITIVE;
|
|
745
|
+
this._mapper = (config === null || config === void 0 ? void 0 : config.mapper) || ((value) => value);
|
|
746
|
+
(_e = (_d = this._loggerManager) === null || _d === void 0 ? void 0 : _d.trace) === null || _e === void 0 ? void 0 : _e.call(_d, 'RuleManager()', MESSAGES.RULE_CONSTRUCTOR, this);
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Setter for comparison processor
|
|
750
|
+
* @param {Record<string, any>} comparisonProcessor
|
|
751
|
+
*/
|
|
752
|
+
set comparisonProcessor(comparisonProcessor) {
|
|
753
|
+
this._comparisonProcessor = comparisonProcessor;
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Getter for comparison processor
|
|
757
|
+
*/
|
|
758
|
+
get comparisonProcessor() {
|
|
759
|
+
return this._comparisonProcessor;
|
|
68
760
|
}
|
|
69
|
-
Object.defineProperty(RuleManager.prototype, "comparisonProcessor", {
|
|
70
|
-
/**
|
|
71
|
-
* Getter for comparison processor
|
|
72
|
-
*/
|
|
73
|
-
get: function () {
|
|
74
|
-
return this._comparisonProcessor;
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* Setter for comparison processor
|
|
78
|
-
* @param {Record<string, any>} comparisonProcessor
|
|
79
|
-
*/
|
|
80
|
-
set: function (comparisonProcessor) {
|
|
81
|
-
this._comparisonProcessor = comparisonProcessor;
|
|
82
|
-
},
|
|
83
|
-
enumerable: false,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
86
761
|
/**
|
|
87
762
|
* Retrieve comparison methods from comparison processor
|
|
88
763
|
* @return {Array<string>} List of methods of comparison processor
|
|
89
764
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
};
|
|
765
|
+
getComparisonProcessorMethods() {
|
|
766
|
+
return Object.getOwnPropertyNames(this._comparisonProcessor).filter((name) => typeof this._comparisonProcessor[name] === 'function');
|
|
767
|
+
}
|
|
94
768
|
/**
|
|
95
769
|
* Check input data matching to rule set
|
|
96
770
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
97
771
|
* @param {RuleObject} ruleSet
|
|
98
772
|
* @return {boolean | RuleError}
|
|
99
773
|
*/
|
|
100
|
-
|
|
774
|
+
isRuleMatched(data, ruleSet, logEntry) {
|
|
101
775
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
102
776
|
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.trace) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager.isRuleMatched()', this._mapper({
|
|
103
777
|
data: data,
|
|
104
778
|
ruleSet: ruleSet
|
|
105
779
|
}));
|
|
106
780
|
if (logEntry) {
|
|
107
|
-
(_d = (_c = this._loggerManager) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.call(_c, 'RuleManager.isRuleMatched()',
|
|
781
|
+
(_d = (_c = this._loggerManager) === null || _c === void 0 ? void 0 : _c.info) === null || _d === void 0 ? void 0 : _d.call(_c, 'RuleManager.isRuleMatched()', MESSAGES.PROCESSING_ENTITY.replace('#', logEntry));
|
|
108
782
|
}
|
|
109
783
|
// Top OR level
|
|
110
|
-
|
|
784
|
+
let match;
|
|
111
785
|
if (Object.prototype.hasOwnProperty.call(ruleSet, 'OR') &&
|
|
112
|
-
|
|
113
|
-
for (
|
|
786
|
+
arrayNotEmpty(ruleSet === null || ruleSet === void 0 ? void 0 : ruleSet.OR)) {
|
|
787
|
+
for (let i = 0, l = ruleSet.OR.length; i < l; i++) {
|
|
114
788
|
match = this._processAND(data, ruleSet.OR[i]);
|
|
115
|
-
if (
|
|
116
|
-
|
|
789
|
+
if (match === true) {
|
|
790
|
+
return match;
|
|
791
|
+
}
|
|
792
|
+
if (Object.values(RuleError).includes(match)) {
|
|
793
|
+
(_f = (_e = this._loggerManager) === null || _e === void 0 ? void 0 : _e.info) === null || _f === void 0 ? void 0 : _f.call(_e, 'RuleManager.isRuleMatched()', logEntry || '', ERROR_MESSAGES.RULE_ERROR);
|
|
117
794
|
}
|
|
118
795
|
else {
|
|
119
796
|
(_h = (_g = this._loggerManager) === null || _g === void 0 ? void 0 : _g.info) === null || _h === void 0 ? void 0 : _h.call(_g, 'RuleManager.isRuleMatched()', logEntry || '', match === false
|
|
120
|
-
?
|
|
121
|
-
:
|
|
122
|
-
}
|
|
123
|
-
if (match !== false) {
|
|
124
|
-
return match;
|
|
797
|
+
? MESSAGES.RULE_NOT_MATCH
|
|
798
|
+
: MESSAGES.RULE_MATCH.replace('#', String(i)));
|
|
125
799
|
}
|
|
126
800
|
}
|
|
801
|
+
if (match !== false) {
|
|
802
|
+
return match;
|
|
803
|
+
}
|
|
127
804
|
}
|
|
128
805
|
else {
|
|
129
|
-
(_k = (_j = this._loggerManager) === null || _j === void 0 ? void 0 : _j.warn) === null || _k === void 0 ? void 0 : _k.call(_j, 'RuleManager.isRuleMatched()', logEntry || '',
|
|
806
|
+
(_k = (_j = this._loggerManager) === null || _j === void 0 ? void 0 : _j.warn) === null || _k === void 0 ? void 0 : _k.call(_j, 'RuleManager.isRuleMatched()', logEntry || '', ERROR_MESSAGES.RULE_NOT_VALID);
|
|
130
807
|
}
|
|
131
808
|
return false;
|
|
132
|
-
}
|
|
809
|
+
}
|
|
133
810
|
/**
|
|
134
811
|
* Check is rule object valid
|
|
135
812
|
* @param {RuleElement} rule
|
|
136
813
|
* @return {boolean}
|
|
137
814
|
*/
|
|
138
|
-
|
|
815
|
+
isValidRule(rule) {
|
|
139
816
|
var _a, _b;
|
|
140
817
|
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.trace) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager.isValidRule()', this._mapper({
|
|
141
818
|
rule: rule
|
|
@@ -147,7 +824,7 @@ var RuleManager = /** @class */ (function () {
|
|
|
147
824
|
Object.prototype.hasOwnProperty.call(rule.matching, 'negated') &&
|
|
148
825
|
typeof rule.matching.negated === 'boolean' &&
|
|
149
826
|
Object.prototype.hasOwnProperty.call(rule, 'value'));
|
|
150
|
-
}
|
|
827
|
+
}
|
|
151
828
|
/**
|
|
152
829
|
* Process AND block of rule set. Return first false if found
|
|
153
830
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
@@ -155,28 +832,28 @@ var RuleManager = /** @class */ (function () {
|
|
|
155
832
|
* @return {boolean | RuleError}
|
|
156
833
|
* @private
|
|
157
834
|
*/
|
|
158
|
-
|
|
835
|
+
_processAND(data, rulesSubset) {
|
|
159
836
|
var _a, _b, _c, _d;
|
|
160
837
|
// Second AND level
|
|
161
|
-
|
|
838
|
+
let match;
|
|
162
839
|
if (Object.prototype.hasOwnProperty.call(rulesSubset, 'AND') &&
|
|
163
|
-
|
|
164
|
-
for (
|
|
840
|
+
arrayNotEmpty(rulesSubset === null || rulesSubset === void 0 ? void 0 : rulesSubset.AND)) {
|
|
841
|
+
for (let i = 0, l = rulesSubset.AND.length; i < l; i++) {
|
|
165
842
|
match = this._processORWHEN(data, rulesSubset.AND[i]);
|
|
166
843
|
if (match === false) {
|
|
167
844
|
return false;
|
|
168
845
|
}
|
|
169
846
|
}
|
|
170
847
|
if (match !== false) {
|
|
171
|
-
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager._processAND()',
|
|
848
|
+
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager._processAND()', MESSAGES.RULE_MATCH_AND);
|
|
172
849
|
}
|
|
173
850
|
return match;
|
|
174
851
|
}
|
|
175
852
|
else {
|
|
176
|
-
(_d = (_c = this._loggerManager) === null || _c === void 0 ? void 0 : _c.warn) === null || _d === void 0 ? void 0 : _d.call(_c, 'RuleManager._processAND()',
|
|
853
|
+
(_d = (_c = this._loggerManager) === null || _c === void 0 ? void 0 : _c.warn) === null || _d === void 0 ? void 0 : _d.call(_c, 'RuleManager._processAND()', ERROR_MESSAGES.RULE_NOT_VALID);
|
|
177
854
|
}
|
|
178
855
|
return false;
|
|
179
|
-
}
|
|
856
|
+
}
|
|
180
857
|
/**
|
|
181
858
|
* Process OR block of rule set. Return first true if found
|
|
182
859
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
@@ -184,24 +861,27 @@ var RuleManager = /** @class */ (function () {
|
|
|
184
861
|
* @return {boolean | RuleError}
|
|
185
862
|
* @private
|
|
186
863
|
*/
|
|
187
|
-
|
|
864
|
+
_processORWHEN(data, rulesSubset) {
|
|
188
865
|
var _a, _b;
|
|
189
866
|
// Third OR level. Called OR_WHEN.
|
|
190
|
-
|
|
867
|
+
let match;
|
|
191
868
|
if (Object.prototype.hasOwnProperty.call(rulesSubset, 'OR_WHEN') &&
|
|
192
|
-
|
|
193
|
-
for (
|
|
869
|
+
arrayNotEmpty(rulesSubset === null || rulesSubset === void 0 ? void 0 : rulesSubset.OR_WHEN)) {
|
|
870
|
+
for (let i = 0, l = rulesSubset.OR_WHEN.length; i < l; i++) {
|
|
194
871
|
match = this._processRuleItem(data, rulesSubset.OR_WHEN[i]);
|
|
195
|
-
if (match
|
|
872
|
+
if (match === true) {
|
|
196
873
|
return match;
|
|
197
874
|
}
|
|
198
875
|
}
|
|
876
|
+
if (match !== false) {
|
|
877
|
+
return match;
|
|
878
|
+
}
|
|
199
879
|
}
|
|
200
880
|
else {
|
|
201
|
-
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.warn) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager._processORWHEN()',
|
|
881
|
+
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.warn) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager._processORWHEN()', ERROR_MESSAGES.RULE_NOT_VALID);
|
|
202
882
|
}
|
|
203
883
|
return false;
|
|
204
|
-
}
|
|
884
|
+
}
|
|
205
885
|
/**
|
|
206
886
|
* Process single rule item
|
|
207
887
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
@@ -209,110 +889,88 @@ var RuleManager = /** @class */ (function () {
|
|
|
209
889
|
* @return {boolean | RuleError} Comparison result
|
|
210
890
|
* @private
|
|
211
891
|
*/
|
|
212
|
-
|
|
213
|
-
var
|
|
214
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
892
|
+
_processRuleItem(data, rule) {
|
|
893
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
215
894
|
if (this.isValidRule(rule)) {
|
|
216
895
|
try {
|
|
217
|
-
|
|
218
|
-
|
|
896
|
+
const negation = rule.matching.negated || false;
|
|
897
|
+
const matching = rule.matching.match_type;
|
|
219
898
|
if (this.getComparisonProcessorMethods().indexOf(matching) !== -1) {
|
|
220
899
|
if (data && typeof data === 'object') {
|
|
221
900
|
// Validate data key-value set.
|
|
222
901
|
if (this.isUsingCustomInterface(data)) {
|
|
223
902
|
// RuleElement object has to have `rule_type` field
|
|
224
903
|
if (rule === null || rule === void 0 ? void 0 : rule.rule_type) {
|
|
225
|
-
(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return dataValue;
|
|
239
|
-
return this._comparisonProcessor[matching](dataValue, rule.value, negation);
|
|
240
|
-
}
|
|
904
|
+
(_b = (_a = this._loggerManager) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.call(_a, 'RuleManager._processRuleItem()', MESSAGES.RULE_MATCH_START.replace('#', rule.rule_type));
|
|
905
|
+
for (const method of Object.getOwnPropertyNames(data.constructor.prototype)) {
|
|
906
|
+
if (method === 'constructor')
|
|
907
|
+
continue;
|
|
908
|
+
const rule_method = camelCase(`get ${rule.rule_type.replace(/_/g, ' ')}`);
|
|
909
|
+
if (method === rule_method ||
|
|
910
|
+
((_c = data === null || data === void 0 ? void 0 : data.mapper) === null || _c === void 0 ? void 0 : _c.call(data, method)) === rule_method) {
|
|
911
|
+
const dataValue = data[method](rule);
|
|
912
|
+
if (Object.values(RuleError).includes(dataValue))
|
|
913
|
+
return dataValue;
|
|
914
|
+
if (rule.rule_type === 'js_condition')
|
|
915
|
+
return dataValue;
|
|
916
|
+
return this._comparisonProcessor[matching](dataValue, rule.value, negation);
|
|
241
917
|
}
|
|
242
918
|
}
|
|
243
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
244
|
-
finally {
|
|
245
|
-
try {
|
|
246
|
-
if (_s && !_s.done && (_a = _r.return)) _a.call(_r);
|
|
247
|
-
}
|
|
248
|
-
finally { if (e_1) throw e_1.error; }
|
|
249
|
-
}
|
|
250
919
|
}
|
|
251
920
|
}
|
|
252
|
-
else if (
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (k === rule_k) {
|
|
262
|
-
return this._comparisonProcessor[matching](data[key], rule.value, negation);
|
|
263
|
-
}
|
|
921
|
+
else if (objectNotEmpty(data)) {
|
|
922
|
+
// only handle RuleElement with a `key` field
|
|
923
|
+
for (const key of Object.keys(data)) {
|
|
924
|
+
const k = this._keys_case_sensitive ? key : key.toLowerCase();
|
|
925
|
+
const rule_k = this._keys_case_sensitive
|
|
926
|
+
? rule['key']
|
|
927
|
+
: String(rule['key']).toLowerCase();
|
|
928
|
+
if (k === rule_k) {
|
|
929
|
+
return this._comparisonProcessor[matching](data[key], rule.value, negation);
|
|
264
930
|
}
|
|
265
931
|
}
|
|
266
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
267
|
-
finally {
|
|
268
|
-
try {
|
|
269
|
-
if (_u && !_u.done && (_b = _t.return)) _b.call(_t);
|
|
270
|
-
}
|
|
271
|
-
finally { if (e_2) throw e_2.error; }
|
|
272
|
-
}
|
|
273
932
|
}
|
|
274
933
|
else {
|
|
275
|
-
(
|
|
276
|
-
warn:
|
|
277
|
-
data
|
|
934
|
+
(_e = (_d = this._loggerManager) === null || _d === void 0 ? void 0 : _d.trace) === null || _e === void 0 ? void 0 : _e.call(_d, 'RuleManager._processRuleItem()', {
|
|
935
|
+
warn: ERROR_MESSAGES.RULE_DATA_NOT_VALID,
|
|
936
|
+
data
|
|
278
937
|
});
|
|
279
938
|
}
|
|
280
939
|
}
|
|
281
940
|
else {
|
|
282
|
-
(
|
|
283
|
-
warn:
|
|
284
|
-
data
|
|
285
|
-
rule
|
|
941
|
+
(_g = (_f = this._loggerManager) === null || _f === void 0 ? void 0 : _f.trace) === null || _g === void 0 ? void 0 : _g.call(_f, 'RuleManager._processRuleItem()', {
|
|
942
|
+
warn: ERROR_MESSAGES.RULE_NOT_VALID,
|
|
943
|
+
data,
|
|
944
|
+
rule
|
|
286
945
|
});
|
|
287
946
|
}
|
|
288
947
|
}
|
|
289
948
|
else {
|
|
290
|
-
(
|
|
949
|
+
(_j = (_h = this._loggerManager) === null || _h === void 0 ? void 0 : _h.warn) === null || _j === void 0 ? void 0 : _j.call(_h, 'RuleManager._processRuleItem()', ERROR_MESSAGES.RULE_MATCH_TYPE_NOT_SUPPORTED.replace('#', matching));
|
|
291
950
|
}
|
|
292
951
|
}
|
|
293
952
|
catch (error) {
|
|
294
|
-
(
|
|
953
|
+
(_l = (_k = this._loggerManager) === null || _k === void 0 ? void 0 : _k.error) === null || _l === void 0 ? void 0 : _l.call(_k, 'RuleManager._processRuleItem()', {
|
|
295
954
|
error: error.message
|
|
296
955
|
});
|
|
297
956
|
}
|
|
298
957
|
}
|
|
299
958
|
else {
|
|
300
|
-
(
|
|
959
|
+
(_o = (_m = this._loggerManager) === null || _m === void 0 ? void 0 : _m.warn) === null || _o === void 0 ? void 0 : _o.call(_m, 'RuleManager._processRuleItem()', ERROR_MESSAGES.RULE_NOT_VALID);
|
|
301
960
|
}
|
|
302
961
|
return false;
|
|
303
|
-
}
|
|
962
|
+
}
|
|
304
963
|
/**
|
|
305
964
|
* Check is rule data object is a custom interface instead of a literal object
|
|
306
965
|
* @param {Record<string, any>} data Single value or key-value data set to compare
|
|
307
966
|
* @return {boolean}
|
|
308
967
|
*/
|
|
309
|
-
|
|
310
|
-
return (
|
|
968
|
+
isUsingCustomInterface(data) {
|
|
969
|
+
return (objectNotEmpty(data) &&
|
|
311
970
|
Object.prototype.hasOwnProperty.call(data, 'name') &&
|
|
312
971
|
data.name === 'RuleData');
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
}());
|
|
972
|
+
}
|
|
973
|
+
}
|
|
316
974
|
|
|
317
975
|
exports.RuleManager = RuleManager;
|
|
318
976
|
//# sourceMappingURL=index.js.map
|