@kameleoon/javascript-sdk 0.0.2 → 1.0.0
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/LICENSE.md +165 -0
- package/README.md +49 -3
- package/dist/eventSource.d.ts +4 -0
- package/dist/eventSource.js +33 -0
- package/dist/eventSource.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +7 -102
- package/dist/kameleoonClient.js +21 -641
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonUtils.d.ts +12 -10
- package/dist/kameleoonUtils.js +44 -103
- package/dist/kameleoonUtils.js.map +1 -1
- package/dist/storage.d.ts +4 -0
- package/dist/storage.js +36 -0
- package/dist/storage.js.map +1 -0
- package/package.json +23 -12
- package/dist/configurations/configuration.d.ts +0 -15
- package/dist/configurations/configuration.js +0 -31
- package/dist/configurations/configuration.js.map +0 -1
- package/dist/configurations/experiment.d.ts +0 -13
- package/dist/configurations/experiment.js +0 -54
- package/dist/configurations/experiment.js.map +0 -1
- package/dist/configurations/featureFlag.d.ts +0 -23
- package/dist/configurations/featureFlag.js +0 -105
- package/dist/configurations/featureFlag.js.map +0 -1
- package/dist/configurations/variation.d.ts +0 -15
- package/dist/configurations/variation.js +0 -14
- package/dist/configurations/variation.js.map +0 -1
- package/dist/constants.d.ts +0 -17
- package/dist/constants.js +0 -23
- package/dist/constants.js.map +0 -1
- package/dist/data.d.ts +0 -67
- package/dist/data.js +0 -127
- package/dist/data.js.map +0 -1
- package/dist/exceptions/credentialsNotFound.d.ts +0 -6
- package/dist/exceptions/credentialsNotFound.js +0 -29
- package/dist/exceptions/credentialsNotFound.js.map +0 -1
- package/dist/exceptions/experimentConfigurationNotFound.d.ts +0 -6
- package/dist/exceptions/experimentConfigurationNotFound.js +0 -29
- package/dist/exceptions/experimentConfigurationNotFound.js.map +0 -1
- package/dist/exceptions/featureConfigurationNotFound.d.ts +0 -6
- package/dist/exceptions/featureConfigurationNotFound.js +0 -29
- package/dist/exceptions/featureConfigurationNotFound.js.map +0 -1
- package/dist/exceptions/notActivated.d.ts +0 -6
- package/dist/exceptions/notActivated.js +0 -29
- package/dist/exceptions/notActivated.js.map +0 -1
- package/dist/exceptions/notTargeted.d.ts +0 -6
- package/dist/exceptions/notTargeted.js +0 -29
- package/dist/exceptions/notTargeted.js.map +0 -1
- package/dist/exceptions/siteCodeDisabled.d.ts +0 -5
- package/dist/exceptions/siteCodeDisabled.js +0 -30
- package/dist/exceptions/siteCodeDisabled.js.map +0 -1
- package/dist/exceptions/variationConfigurationNotFound.d.ts +0 -6
- package/dist/exceptions/variationConfigurationNotFound.js +0 -29
- package/dist/exceptions/variationConfigurationNotFound.js.map +0 -1
- package/dist/exceptions/visitorCodeNotValid.d.ts +0 -5
- package/dist/exceptions/visitorCodeNotValid.js +0 -30
- package/dist/exceptions/visitorCodeNotValid.js.map +0 -1
- package/dist/interfaces/interfaces.d.ts +0 -81
- package/dist/interfaces/interfaces.js +0 -3
- package/dist/interfaces/interfaces.js.map +0 -1
- package/dist/nonce.d.ts +0 -1
- package/dist/nonce.js +0 -16
- package/dist/nonce.js.map +0 -1
- package/dist/realTimeConfigurationService.d.ts +0 -12
- package/dist/realTimeConfigurationService.js +0 -24
- package/dist/realTimeConfigurationService.js.map +0 -1
- package/dist/storage/types.d.ts +0 -13
- package/dist/storage/types.js +0 -3
- package/dist/storage/types.js.map +0 -1
- package/dist/storage/variationStorage.d.ts +0 -11
- package/dist/storage/variationStorage.js +0 -87
- package/dist/storage/variationStorage.js.map +0 -1
- package/dist/storage/visitorVariation.d.ts +0 -9
- package/dist/storage/visitorVariation.js +0 -22
- package/dist/storage/visitorVariation.js.map +0 -1
- package/dist/targeting/conditions/customDatum.d.ts +0 -12
- package/dist/targeting/conditions/customDatum.js +0 -129
- package/dist/targeting/conditions/customDatum.js.map +0 -1
- package/dist/targeting/conditions/exclusiveExperiment.d.ts +0 -9
- package/dist/targeting/conditions/exclusiveExperiment.js +0 -45
- package/dist/targeting/conditions/exclusiveExperiment.js.map +0 -1
- package/dist/targeting/conditions/targetExperiment.d.ts +0 -14
- package/dist/targeting/conditions/targetExperiment.js +0 -57
- package/dist/targeting/conditions/targetExperiment.js.map +0 -1
- package/dist/targeting/conditions/types.d.ts +0 -12
- package/dist/targeting/conditions/types.js +0 -3
- package/dist/targeting/conditions/types.js.map +0 -1
- package/dist/targeting/targetingCondition.d.ts +0 -7
- package/dist/targeting/targetingCondition.js +0 -9
- package/dist/targeting/targetingCondition.js.map +0 -1
- package/dist/targeting/targetingConditionsFactory.d.ts +0 -7
- package/dist/targeting/targetingConditionsFactory.js +0 -30
- package/dist/targeting/targetingConditionsFactory.js.map +0 -1
- package/dist/targeting/targetingData.d.ts +0 -7
- package/dist/targeting/targetingData.js +0 -11
- package/dist/targeting/targetingData.js.map +0 -1
- package/dist/targeting/targetingEngine.d.ts +0 -6
- package/dist/targeting/targetingEngine.js +0 -130
- package/dist/targeting/targetingEngine.js.map +0 -1
- package/dist/targeting/targetingSegment.d.ts +0 -5
- package/dist/targeting/targetingSegment.js +0 -9
- package/dist/targeting/targetingSegment.js.map +0 -1
- package/dist/targeting/targetingTree.d.ts +0 -9
- package/dist/targeting/targetingTree.js +0 -13
- package/dist/targeting/targetingTree.js.map +0 -1
- package/dist/targeting/targetingTreeBuilder.d.ts +0 -8
- package/dist/targeting/targetingTreeBuilder.js +0 -127
- package/dist/targeting/targetingTreeBuilder.js.map +0 -1
- package/dist/types.d.ts +0 -5
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import Experiment from '../configurations/experiment';
|
|
3
|
-
import FeatureFlag from '../configurations/featureFlag';
|
|
4
|
-
export interface SiteEnabledInterface {
|
|
5
|
-
siteEnabled: boolean;
|
|
6
|
-
}
|
|
7
|
-
interface CampaignInterface extends SiteEnabledInterface {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
siteCode: string;
|
|
11
|
-
siteId: string;
|
|
12
|
-
respoolTime?: AutomationRespoolTimeInterface[];
|
|
13
|
-
segment?: AutomationSegmentInterface;
|
|
14
|
-
deviations: AutomationDeviationInterface[];
|
|
15
|
-
variations: AutomationVariationsInterface[];
|
|
16
|
-
type: 'HYBRID' | 'SERVER_SIDE';
|
|
17
|
-
}
|
|
18
|
-
export interface AutomationExperimentInterface extends CampaignInterface {
|
|
19
|
-
status: 'ACTIVE';
|
|
20
|
-
}
|
|
21
|
-
export interface AutomationFeatureFlagInterface extends CampaignInterface {
|
|
22
|
-
featureStatus: string;
|
|
23
|
-
identificationKey: string;
|
|
24
|
-
schedules: {
|
|
25
|
-
dateStart?: string;
|
|
26
|
-
dateEnd?: string;
|
|
27
|
-
}[] | null;
|
|
28
|
-
status: 'ACTIVE' | 'PAUSED';
|
|
29
|
-
}
|
|
30
|
-
export interface AutomationVariationsInterface {
|
|
31
|
-
id: string;
|
|
32
|
-
customJson: any;
|
|
33
|
-
}
|
|
34
|
-
export interface AutomationRespoolTimeInterface {
|
|
35
|
-
variationId: string;
|
|
36
|
-
value: number;
|
|
37
|
-
}
|
|
38
|
-
export interface AutomationSegmentInterface {
|
|
39
|
-
conditionsData: ConditionsInterface;
|
|
40
|
-
}
|
|
41
|
-
export interface AutomationDeviationInterface {
|
|
42
|
-
variationId: string;
|
|
43
|
-
value: number;
|
|
44
|
-
}
|
|
45
|
-
export interface SDKConfiguration {
|
|
46
|
-
visitor_data_maximum_size?: number;
|
|
47
|
-
actions_configuration_refresh_interval?: number;
|
|
48
|
-
environment?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface ConfigurationInterface {
|
|
51
|
-
settings: ConfigurationSettings;
|
|
52
|
-
updateTime: number;
|
|
53
|
-
experiments: ConfigurationExperimentsInterface;
|
|
54
|
-
featureFlags: ConfigurationFeatureFlagsInterface;
|
|
55
|
-
}
|
|
56
|
-
export interface ConfigurationExperimentsInterface {
|
|
57
|
-
[id: string]: Experiment;
|
|
58
|
-
}
|
|
59
|
-
export interface ConfigurationFeatureFlagsInterface {
|
|
60
|
-
[id: string]: FeatureFlag;
|
|
61
|
-
}
|
|
62
|
-
export interface ConfigurationSettings {
|
|
63
|
-
realTimeUpdate: boolean;
|
|
64
|
-
}
|
|
65
|
-
export interface CallbackInterface {
|
|
66
|
-
success: () => void;
|
|
67
|
-
error: () => void;
|
|
68
|
-
timeout: NodeJS.Timeout;
|
|
69
|
-
}
|
|
70
|
-
export interface DataInterface {
|
|
71
|
-
obtainFullPostTextLine: () => string;
|
|
72
|
-
}
|
|
73
|
-
export interface ConditionsInterface {
|
|
74
|
-
firstLevel: any;
|
|
75
|
-
firstLevelOrOperators: any;
|
|
76
|
-
}
|
|
77
|
-
export interface IteratorInterface {
|
|
78
|
-
next: () => any;
|
|
79
|
-
hasNext: () => boolean;
|
|
80
|
-
}
|
|
81
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces/interfaces.ts"],"names":[],"mappings":""}
|
package/dist/nonce.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function obtainNonce(): string;
|
package/dist/nonce.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.obtainNonce = void 0;
|
|
4
|
-
var HEXADECIMAL_ALPHABET = '0123456789ABCDEF';
|
|
5
|
-
var NONCE_BYTE_LENGTH = 8;
|
|
6
|
-
function obtainNonce() {
|
|
7
|
-
var alphabetLength = HEXADECIMAL_ALPHABET.length;
|
|
8
|
-
var result = '';
|
|
9
|
-
for (var i = 0; i < NONCE_BYTE_LENGTH * 2; ++i) {
|
|
10
|
-
var randomNumber = Math.floor(Math.random() * alphabetLength);
|
|
11
|
-
result += HEXADECIMAL_ALPHABET.substring(randomNumber, randomNumber + 1);
|
|
12
|
-
}
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
exports.obtainNonce = obtainNonce;
|
|
16
|
-
//# sourceMappingURL=nonce.js.map
|
package/dist/nonce.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nonce.js","sourceRoot":"","sources":["../src/nonce.ts"],"names":[],"mappings":";;;AAAA,IAAM,oBAAoB,GAAG,kBAAkB,CAAC;AAChD,IAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,SAAgB,WAAW;IACzB,IAAM,cAAc,GAAG,oBAAoB,CAAC,MAAM,CAAC;IACnD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAC9C,IAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,CAAC;QAChE,MAAM,IAAI,oBAAoB,CAAC,SAAS,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;KAC1E;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,kCAQC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface RealTimeEvent {
|
|
2
|
-
ts: number;
|
|
3
|
-
}
|
|
4
|
-
export interface RealTimeConfigurationServiceInterface {
|
|
5
|
-
disconnect: () => void;
|
|
6
|
-
}
|
|
7
|
-
export declare class RealTimeConfigurationService {
|
|
8
|
-
private static readonly EVENT_NAME;
|
|
9
|
-
private eventSource;
|
|
10
|
-
constructor(eventUrl: string, handler?: (event: RealTimeEvent) => void);
|
|
11
|
-
disconnect: () => void;
|
|
12
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RealTimeConfigurationService = void 0;
|
|
4
|
-
var RealTimeConfigurationService = /** @class */ (function () {
|
|
5
|
-
function RealTimeConfigurationService(eventUrl, handler) {
|
|
6
|
-
var _this = this;
|
|
7
|
-
this.disconnect = function () {
|
|
8
|
-
_this.eventSource.close();
|
|
9
|
-
};
|
|
10
|
-
this.eventSource = new EventSource(eventUrl);
|
|
11
|
-
this.eventSource.onerror = function (error) {
|
|
12
|
-
console.log("SSE Client error called: ".concat(error));
|
|
13
|
-
};
|
|
14
|
-
this.eventSource.addEventListener(RealTimeConfigurationService.EVENT_NAME, function (message) {
|
|
15
|
-
var messageEvent = message;
|
|
16
|
-
var event = JSON.parse(messageEvent.data);
|
|
17
|
-
handler && handler(event);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
RealTimeConfigurationService.EVENT_NAME = 'configuration-update-event';
|
|
21
|
-
return RealTimeConfigurationService;
|
|
22
|
-
}());
|
|
23
|
-
exports.RealTimeConfigurationService = RealTimeConfigurationService;
|
|
24
|
-
//# sourceMappingURL=realTimeConfigurationService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"realTimeConfigurationService.js","sourceRoot":"","sources":["../src/realTimeConfigurationService.ts"],"names":[],"mappings":";;;AAQA;IAIE,sCAAY,QAAgB,EAAE,OAAwC;QAAtE,iBAeC;QAED,eAAU,GAAG;YACX,KAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QAC3B,CAAC,CAAC;QAlBA,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;QAE7C,IAAI,CAAC,WAAW,CAAC,OAAO,GAAG,UAAC,KAAK;YAC/B,OAAO,CAAC,GAAG,CAAC,mCAA4B,KAAK,CAAE,CAAC,CAAC;QACnD,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAC/B,4BAA4B,CAAC,UAAU,EACvC,UAAC,OAAO;YACN,IAAM,YAAY,GAAG,OAAuB,CAAC;YAC7C,IAAM,KAAK,GAAkB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YAC3D,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC,CACF,CAAC;IACJ,CAAC;IAlBuB,uCAAU,GAAG,4BAA4B,CAAC;IAuBpE,mCAAC;CAAA,AAxBD,IAwBC;AAxBY,oEAA4B"}
|
package/dist/storage/types.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Variation from '../configurations/variation';
|
|
2
|
-
export declare type VariationStorageRecordType = Record<string, Record<number, VisitorVariationInterface>>;
|
|
3
|
-
export interface VariationStorageInterface {
|
|
4
|
-
getVariationId: (visitorCode: string, experimentId: number) => number | null;
|
|
5
|
-
updateVariation: (visitorCode: string, experimentId: number, variation: Variation) => void;
|
|
6
|
-
getMapVariationId: (visitorCode: string) => Record<number, number> | null;
|
|
7
|
-
}
|
|
8
|
-
export interface VisitorVariationInterface {
|
|
9
|
-
variationId: number;
|
|
10
|
-
respoolTime?: number;
|
|
11
|
-
assignmentDate?: Date;
|
|
12
|
-
isValid: () => boolean;
|
|
13
|
-
}
|
package/dist/storage/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/storage/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Variation from '../configurations/variation';
|
|
2
|
-
import { VariationStorageInterface } from './types';
|
|
3
|
-
export declare class VariationStorage implements VariationStorageInterface {
|
|
4
|
-
private variations;
|
|
5
|
-
constructor();
|
|
6
|
-
updateVariation: (visitorCode: string, experimentId: number, variation: Variation) => void;
|
|
7
|
-
getVariationId: (visitorCode: string, experimentId: number) => number | null;
|
|
8
|
-
getMapVariationId: (visitorCode: string) => Record<number, number> | null;
|
|
9
|
-
private loadFromLocalStorage;
|
|
10
|
-
private saveToLocalStorage;
|
|
11
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.VariationStorage = void 0;
|
|
20
|
-
var visitorVariation_1 = require("./visitorVariation");
|
|
21
|
-
var VariationStorage = /** @class */ (function () {
|
|
22
|
-
function VariationStorage() {
|
|
23
|
-
var _this = this;
|
|
24
|
-
this.variations = {};
|
|
25
|
-
this.updateVariation = function (visitorCode, experimentId, variation) {
|
|
26
|
-
if (!_this.variations[visitorCode]) {
|
|
27
|
-
_this.variations[visitorCode] = {};
|
|
28
|
-
}
|
|
29
|
-
_this.variations[visitorCode][experimentId] = new visitorVariation_1.VisitorVariation(variation.id, variation.respoolTime);
|
|
30
|
-
_this.saveToLocalStorage();
|
|
31
|
-
};
|
|
32
|
-
this.getVariationId = function (visitorCode, experimentId) {
|
|
33
|
-
var savedVisitorVariation = _this.variations[visitorCode] &&
|
|
34
|
-
_this.variations[visitorCode][experimentId];
|
|
35
|
-
if (savedVisitorVariation && savedVisitorVariation.isValid()) {
|
|
36
|
-
return savedVisitorVariation.variationId;
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
39
|
-
};
|
|
40
|
-
this.getMapVariationId = function (visitorCode) {
|
|
41
|
-
var visitorExperiments = _this.variations[visitorCode];
|
|
42
|
-
if (visitorExperiments) {
|
|
43
|
-
var variationIds_1 = {};
|
|
44
|
-
Object.keys(visitorExperiments).map(function (key) {
|
|
45
|
-
var variationKey = Number(key);
|
|
46
|
-
variationIds_1[variationKey] =
|
|
47
|
-
visitorExperiments[variationKey].variationId;
|
|
48
|
-
});
|
|
49
|
-
return variationIds_1;
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
};
|
|
53
|
-
this.loadFromLocalStorage = function () {
|
|
54
|
-
var data = localStorage.kameleoonVariationStorage;
|
|
55
|
-
if (data) {
|
|
56
|
-
try {
|
|
57
|
-
var dataJSON = JSON.parse(data);
|
|
58
|
-
var newSavedVariations_1 = {};
|
|
59
|
-
Object.entries(dataJSON).forEach(function (_a) {
|
|
60
|
-
var _b = __read(_a, 2), visitorCode = _b[0], experiment = _b[1];
|
|
61
|
-
var savedExperiments = experiment;
|
|
62
|
-
Object.entries(savedExperiments).forEach(function (_a) {
|
|
63
|
-
var _b = __read(_a, 2), experimentId = _b[0], visitorVariation = _b[1];
|
|
64
|
-
var experimentIdNumber = parseInt(experimentId);
|
|
65
|
-
if (!newSavedVariations_1[visitorCode]) {
|
|
66
|
-
newSavedVariations_1[visitorCode] = {};
|
|
67
|
-
}
|
|
68
|
-
newSavedVariations_1[visitorCode][experimentIdNumber] =
|
|
69
|
-
visitorVariation_1.VisitorVariation.createFromJSON(visitorVariation);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
_this.variations = newSavedVariations_1;
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
console.log(e);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
this.saveToLocalStorage = function () {
|
|
80
|
-
localStorage.setItem('kameleoonVariationStorage', JSON.stringify(_this.variations));
|
|
81
|
-
};
|
|
82
|
-
this.loadFromLocalStorage();
|
|
83
|
-
}
|
|
84
|
-
return VariationStorage;
|
|
85
|
-
}());
|
|
86
|
-
exports.VariationStorage = VariationStorage;
|
|
87
|
-
//# sourceMappingURL=variationStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variationStorage.js","sourceRoot":"","sources":["../../src/storage/variationStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,uDAAsD;AAEtD;IAGE;QAAA,iBAEC;QAJO,eAAU,GAA+B,EAAE,CAAC;QAMpD,oBAAe,GAAG,UAChB,WAAmB,EACnB,YAAoB,EACpB,SAAoB;YAEpB,IAAI,CAAC,KAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;gBACjC,KAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;aACnC;YACD,KAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,GAAG,IAAI,mCAAgB,CAC/D,SAAS,CAAC,EAAE,EACZ,SAAS,CAAC,WAAW,CACtB,CAAC;YACF,KAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,CAAC,CAAC;QAEF,mBAAc,GAAG,UACf,WAAmB,EACnB,YAAoB;YAEpB,IAAM,qBAAqB,GACzB,KAAI,CAAC,UAAU,CAAC,WAAW,CAAC;gBAC5B,KAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;YAC7C,IAAI,qBAAqB,IAAI,qBAAqB,CAAC,OAAO,EAAE,EAAE;gBAC5D,OAAO,qBAAqB,CAAC,WAAW,CAAC;aAC1C;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAEF,sBAAiB,GAAG,UAAC,WAAmB;YACtC,IAAM,kBAAkB,GAAG,KAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YACxD,IAAI,kBAAkB,EAAE;gBACtB,IAAM,cAAY,GAA2B,EAAE,CAAC;gBAChD,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,UAAC,GAAG;oBACtC,IAAM,YAAY,GAAG,MAA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AAG;YAC3B,YAAY,CAAC,OAAO,CAClB,2BAA2B,EAC3B,IAAI,CAAC,SAAS,CAAC,KAAI,CAAC,UAAU,CAAC,CAChC,CAAC;QACJ,CAAC,CAAC;QA/EA,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IA+EH,uBAAC;AAAD,CAAC,AApFD,IAoFC;AApFY,4CAAgB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { VisitorVariationInterface } from './types';
|
|
2
|
-
export declare class VisitorVariation implements VisitorVariationInterface {
|
|
3
|
-
variationId: number;
|
|
4
|
-
respoolTime?: number;
|
|
5
|
-
assignmentDate: Date;
|
|
6
|
-
static createFromJSON(json: VisitorVariationInterface): VisitorVariation;
|
|
7
|
-
constructor(variationId: number | string, respoolTime?: number, assignmentDate?: Date);
|
|
8
|
-
isValid: () => boolean;
|
|
9
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VisitorVariation = void 0;
|
|
4
|
-
var VisitorVariation = /** @class */ (function () {
|
|
5
|
-
function VisitorVariation(variationId, respoolTime, assignmentDate) {
|
|
6
|
-
var _this = this;
|
|
7
|
-
this.isValid = function () {
|
|
8
|
-
return (!_this.respoolTime ||
|
|
9
|
-
_this.assignmentDate.getTime() / 1000 > _this.respoolTime);
|
|
10
|
-
};
|
|
11
|
-
this.variationId = Number(variationId);
|
|
12
|
-
this.respoolTime = respoolTime;
|
|
13
|
-
this.assignmentDate = assignmentDate !== null && assignmentDate !== void 0 ? assignmentDate : new Date();
|
|
14
|
-
}
|
|
15
|
-
VisitorVariation.createFromJSON = function (json) {
|
|
16
|
-
var variationId = json.variationId, respoolTime = json.respoolTime, assignmentDate = json.assignmentDate;
|
|
17
|
-
return new VisitorVariation(variationId, respoolTime, assignmentDate);
|
|
18
|
-
};
|
|
19
|
-
return VisitorVariation;
|
|
20
|
-
}());
|
|
21
|
-
exports.VisitorVariation = VisitorVariation;
|
|
22
|
-
//# sourceMappingURL=visitorVariation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visitorVariation.js","sourceRoot":"","sources":["../../src/storage/visitorVariation.ts"],"names":[],"mappings":";;;AAEA;IAUE,0BACE,WAA4B,EAC5B,WAAoB,EACpB,cAAqB;QAHvB,iBAQC;QAED,YAAO,GAAG;YACR,OAAO,CACL,CAAC,KAAI,CAAC,WAAW;gBACjB,KAAI,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,KAAI,CAAC,WAAW,CACxD,CAAC;QACJ,CAAC,CAAC;QAVA,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,IAAI,EAAE,CAAC;IACrD,CAAC;IAbM,+BAAc,GAArB,UAAsB,IAA+B;QAC3C,IAAA,WAAW,GAAkC,IAAI,YAAtC,EAAE,WAAW,GAAqB,IAAI,YAAzB,EAAE,cAAc,GAAK,IAAI,eAAT,CAAU;QAC1D,OAAO,IAAI,gBAAgB,CAAC,WAAW,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IACxE,CAAC;IAkBH,uBAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,4CAAgB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import TargetingCondition from '../targetingCondition';
|
|
2
|
-
import { TargetingConditionType } from './types';
|
|
3
|
-
export declare class CustomDatum extends TargetingCondition {
|
|
4
|
-
index: number;
|
|
5
|
-
operator: string;
|
|
6
|
-
value: string;
|
|
7
|
-
include: boolean;
|
|
8
|
-
conditionType: string;
|
|
9
|
-
constructor(index: number, value: string, isInclude: boolean, matchType: string);
|
|
10
|
-
check: (data: TargetingConditionType) => boolean;
|
|
11
|
-
}
|
|
12
|
-
export default CustomDatum;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.CustomDatum = void 0;
|
|
22
|
-
var targetingCondition_1 = __importDefault(require("../targetingCondition"));
|
|
23
|
-
var data_1 = require("../../data");
|
|
24
|
-
var constants_1 = require("../../constants");
|
|
25
|
-
var CustomDatum = /** @class */ (function (_super) {
|
|
26
|
-
__extends(CustomDatum, _super);
|
|
27
|
-
function CustomDatum(index, value, isInclude, matchType) {
|
|
28
|
-
var _this = _super.call(this) || this;
|
|
29
|
-
_this.check = function (data) {
|
|
30
|
-
var targetingData = data.targetingData;
|
|
31
|
-
var targeting = true;
|
|
32
|
-
var customData = targetingData
|
|
33
|
-
.filter(function (item) {
|
|
34
|
-
return item.data instanceof data_1.CustomData && item.data.id == _this.index;
|
|
35
|
-
})
|
|
36
|
-
.map(function (d) {
|
|
37
|
-
return d.data;
|
|
38
|
-
});
|
|
39
|
-
if (customData.length == 0) {
|
|
40
|
-
targeting = _this.operator == 'UNDEFINED';
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
targeting = false;
|
|
44
|
-
var customDatum = customData.slice(-1)[0];
|
|
45
|
-
switch (_this.operator) {
|
|
46
|
-
case 'CONTAINS':
|
|
47
|
-
if (customDatum.value.indexOf(_this.value) >= 0) {
|
|
48
|
-
targeting = true;
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
case 'EXACT':
|
|
52
|
-
if (customDatum.value == _this.value) {
|
|
53
|
-
targeting = true;
|
|
54
|
-
}
|
|
55
|
-
break;
|
|
56
|
-
case 'REGULAR_EXPRESSION':
|
|
57
|
-
if (customDatum.value.match(_this.value)) {
|
|
58
|
-
targeting = true;
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
case 'LOWER':
|
|
62
|
-
case 'EQUAL':
|
|
63
|
-
case 'GREATER': {
|
|
64
|
-
var number = parseFloat(_this.value);
|
|
65
|
-
if (!isNaN(number)) {
|
|
66
|
-
var valueNumber = parseFloat(customDatum.value);
|
|
67
|
-
if (!isNaN(valueNumber)) {
|
|
68
|
-
switch (_this.operator) {
|
|
69
|
-
case 'LOWER':
|
|
70
|
-
if (valueNumber < number) {
|
|
71
|
-
targeting = true;
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
case 'EQUAL':
|
|
75
|
-
if (valueNumber == number) {
|
|
76
|
-
targeting = true;
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
case 'GREATER':
|
|
80
|
-
if (valueNumber > number) {
|
|
81
|
-
targeting = true;
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
case 'TRUE':
|
|
90
|
-
if (customDatum.value == 'true') {
|
|
91
|
-
targeting = true;
|
|
92
|
-
}
|
|
93
|
-
break;
|
|
94
|
-
case 'FALSE':
|
|
95
|
-
if (customDatum.value == 'false') {
|
|
96
|
-
targeting = true;
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
case 'AMONG_VALUES': {
|
|
100
|
-
var regexp = new RegExp('"([^"]*)"', 'g');
|
|
101
|
-
var match = void 0;
|
|
102
|
-
/* this.value has a format "["id1", "id2", "id3", "id3"]"
|
|
103
|
-
need to find all matches (id1, id2, id3, id4 for current sample)
|
|
104
|
-
in a string `this.value`and to compare them all
|
|
105
|
-
with `customDatum.value` for a match */
|
|
106
|
-
while ((match = regexp.exec(_this.value)) !== null) {
|
|
107
|
-
if (match[1] === customDatum.value) {
|
|
108
|
-
targeting = true;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return targeting;
|
|
117
|
-
};
|
|
118
|
-
_this.include = isInclude;
|
|
119
|
-
_this.conditionType = constants_1.ConditionTypes.CUSTOM_DATUM;
|
|
120
|
-
_this.index = index;
|
|
121
|
-
_this.value = value;
|
|
122
|
-
_this.operator = matchType;
|
|
123
|
-
return _this;
|
|
124
|
-
}
|
|
125
|
-
return CustomDatum;
|
|
126
|
-
}(targetingCondition_1.default));
|
|
127
|
-
exports.CustomDatum = CustomDatum;
|
|
128
|
-
exports.default = CustomDatum;
|
|
129
|
-
//# sourceMappingURL=customDatum.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customDatum.js","sourceRoot":"","sources":["../../../src/targeting/conditions/customDatum.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6EAAuD;AACvD,mCAAwC;AAExC,6CAAiD;AAEjD;IAAiC,+BAAkB;IAOjD,qBACE,KAAa,EACb,KAAa,EACb,SAAkB,EAClB,SAAiB;QAJnB,YAME,iBAAO,SAOR;QAED,WAAK,GAAG,UAAC,IAA4B;YACnC,IAAM,aAA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FA,KAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,KAAI,CAAC,aAAa,GAAG,0BAAc,CAAC,YAAY,CAAC;QACjD,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;;IAC5B,CAAC;IA2FH,kBAAC;AAAD,CAAC,AA/GD,CAAiC,4BAAkB,GA+GlD;AA/GY,kCAAW;AAiHxB,kBAAe,WAAW,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import TargetingCondition from '../targetingCondition';
|
|
2
|
-
import { TargetingConditionType } from './types';
|
|
3
|
-
export declare class ExclusiveExperiment extends TargetingCondition {
|
|
4
|
-
static readonly CONDITION_TYPE = "exclusiveExperiment";
|
|
5
|
-
include: boolean;
|
|
6
|
-
conditionType: string;
|
|
7
|
-
constructor();
|
|
8
|
-
check: (data: TargetingConditionType) => boolean;
|
|
9
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.ExclusiveExperiment = void 0;
|
|
22
|
-
var constants_1 = require("../../constants");
|
|
23
|
-
var targetingCondition_1 = __importDefault(require("../targetingCondition"));
|
|
24
|
-
var ExclusiveExperiment = /** @class */ (function (_super) {
|
|
25
|
-
__extends(ExclusiveExperiment, _super);
|
|
26
|
-
function ExclusiveExperiment() {
|
|
27
|
-
var _this = _super.call(this) || this;
|
|
28
|
-
_this.check = function (data) {
|
|
29
|
-
//need to return true if variation storage is empty or it has only single current experiment in the storage
|
|
30
|
-
var _a = data, currentExperimentId = _a.currentExperimentId, variationStorage = _a.variationStorage;
|
|
31
|
-
var isVariationStorageEmpty = !variationStorage || Object.keys(variationStorage).length === 0;
|
|
32
|
-
var isCurrentExperimentSingle = !isVariationStorageEmpty &&
|
|
33
|
-
Object.keys(variationStorage).length === 1 &&
|
|
34
|
-
(variationStorage === null || variationStorage === void 0 ? void 0 : variationStorage[currentExperimentId]) != null;
|
|
35
|
-
return isVariationStorageEmpty || isCurrentExperimentSingle;
|
|
36
|
-
};
|
|
37
|
-
_this.include = true;
|
|
38
|
-
_this.conditionType = constants_1.ConditionTypes.EXCLUSIVE_EXPERIMENT;
|
|
39
|
-
return _this;
|
|
40
|
-
}
|
|
41
|
-
ExclusiveExperiment.CONDITION_TYPE = 'exclusiveExperiment';
|
|
42
|
-
return ExclusiveExperiment;
|
|
43
|
-
}(targetingCondition_1.default));
|
|
44
|
-
exports.ExclusiveExperiment = ExclusiveExperiment;
|
|
45
|
-
//# sourceMappingURL=exclusiveExperiment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclusiveExperiment.js","sourceRoot":"","sources":["../../../src/targeting/conditions/exclusiveExperiment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiD;AACjD,6EAAuD;AAMvD;IAAyC,uCAAkB;IAMzD;QAAA,YACE,iBAAO,SAIR;QAED,WAAK,GAAG,UAAC,IAA4B;YACnC,2GAA2G;YACrG,IAAA,KACJ,IAAwC,EADlC,mBAAmB,yBAAA,EAAE,gBAAgB,sBACH,CAAC;YAC3C,IAAM,uBAAuB,GAC3B,CAAC,gBAAgB,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;YAClE,IAAM,yBAAyB,GAC7B,CAAC,uBAAuB;gBACxB,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,KAAK,CAAC;gBAC1C,CAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,mBAAmB,CAAC,KAAI,IAAI,CAAC;YAClD,OAAO,uBAAuB,IAAI,yBAAyB,CAAC;QAC9D,CAAC,CAAC;QAfA,KAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,KAAI,CAAC,aAAa,GAAG,0BAAc,CAAC,oBAAoB,CAAC;;IAC3D,CAAC;IAVe,kCAAc,GAAG,qBAAqB,CAAC;IAwBzD,0BAAC;CAAA,AAzBD,CAAyC,4BAAkB,GAyB1D;AAzBY,kDAAmB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import TargetingCondition from '../targetingCondition';
|
|
2
|
-
import { TargetingConditionType } from './types';
|
|
3
|
-
export interface TargetExperimentConditionData {
|
|
4
|
-
variationStorage: Record<number, number> | null;
|
|
5
|
-
}
|
|
6
|
-
export declare class TargetExperiment extends TargetingCondition {
|
|
7
|
-
include: boolean;
|
|
8
|
-
conditionType: string;
|
|
9
|
-
experiment: number;
|
|
10
|
-
variation: number | undefined;
|
|
11
|
-
variationMatchType: string;
|
|
12
|
-
constructor(isInclude: boolean, experiment: number, variation: number | undefined, variationMatchType: string);
|
|
13
|
-
check: (data: TargetingConditionType) => boolean;
|
|
14
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.TargetExperiment = void 0;
|
|
22
|
-
var constants_1 = require("../../constants");
|
|
23
|
-
var targetingCondition_1 = __importDefault(require("../targetingCondition"));
|
|
24
|
-
var TargetExperiment = /** @class */ (function (_super) {
|
|
25
|
-
__extends(TargetExperiment, _super);
|
|
26
|
-
function TargetExperiment(isInclude, experiment, variation, variationMatchType) {
|
|
27
|
-
var _this = _super.call(this) || this;
|
|
28
|
-
_this.check = function (data) {
|
|
29
|
-
var targeting = false;
|
|
30
|
-
var variationStorage = data
|
|
31
|
-
.variationStorage;
|
|
32
|
-
var currentExperimentIdExist = variationStorage != null && variationStorage[_this.experiment] != null;
|
|
33
|
-
switch (_this.variationMatchType) {
|
|
34
|
-
case 'EXACT':
|
|
35
|
-
targeting =
|
|
36
|
-
currentExperimentIdExist &&
|
|
37
|
-
variationStorage[_this.experiment] === _this.variation;
|
|
38
|
-
break;
|
|
39
|
-
case 'ANY':
|
|
40
|
-
targeting = currentExperimentIdExist;
|
|
41
|
-
break;
|
|
42
|
-
default:
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
return targeting;
|
|
46
|
-
};
|
|
47
|
-
_this.include = isInclude;
|
|
48
|
-
_this.conditionType = constants_1.ConditionTypes.TARGET_EXPERIMENT;
|
|
49
|
-
_this.experiment = experiment;
|
|
50
|
-
_this.variation = variation;
|
|
51
|
-
_this.variationMatchType = variationMatchType;
|
|
52
|
-
return _this;
|
|
53
|
-
}
|
|
54
|
-
return TargetExperiment;
|
|
55
|
-
}(targetingCondition_1.default));
|
|
56
|
-
exports.TargetExperiment = TargetExperiment;
|
|
57
|
-
//# sourceMappingURL=targetExperiment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"targetExperiment.js","sourceRoot":"","sources":["../../../src/targeting/conditions/targetExperiment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6CAAiD;AACjD,6EAAuD;AAOvD;IAAsC,oCAAkB;IAOtD,0BACE,SAAkB,EAClB,UAAkB,EAClB,SAA6B,EAC7B,kBAA0B;QAJ5B,YAME,iBAAO,SAOR;QAED,WAAK,GAAG,UAAC,IAA4B;YACnC,IAAI,SAAS,GAAG,KAAK,CAAC;YACtB,IAAM,gBAAgB,GAAI,IAAsC;iBAC7D,gBAAgB,CAAC;YACpB,IAAM,wBAAwB,GAC5B,gBAAgB,IAAI,IAAI,IAAI,gBAAgB,CAAC,KAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;YACxE,QAAQ,KAAI,CAAC,kBAAkB,EAAE;gBAC/B,KAAK,OAAO;oBACV,SAAS;wBACP,wBAAwB;4BACxB,gBAAgB,CAAC,KAAI,CAAC,UAAU,CAAC,KAAK,KAAI,CAAC,SAAS,CAAC;oBACvD,MAAM;gBACR,KAAK,KAAK;oBACR,SAAS,GAAG,wBAAwB,CAAC;oBACrC,MAAM;gBACR;oBACE,MAAM;aACT;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC;QA1BA,KAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,KAAI,CAAC,aAAa,GAAG,0BAAc,CAAC,iBAAiB,CAAC;QACtD,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;;IAC/C,CAAC;IAsBH,uBAAC;AAAD,CAAC,AA1CD,CAAsC,4BAAkB,GA0CvD;AA1CY,4CAAgB"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import TargetingData from '../targetingData';
|
|
2
|
-
export interface CustomDatumConditionData {
|
|
3
|
-
targetingData: TargetingData[];
|
|
4
|
-
}
|
|
5
|
-
export interface ExclusiveExperimentConditionData {
|
|
6
|
-
currentExperimentId: number;
|
|
7
|
-
variationStorage: Record<number, number> | null;
|
|
8
|
-
}
|
|
9
|
-
export interface TargetExperimentConditionData {
|
|
10
|
-
variationStorage: Record<number, number> | null;
|
|
11
|
-
}
|
|
12
|
-
export declare type TargetingConditionType = CustomDatumConditionData | ExclusiveExperimentConditionData | TargetExperimentConditionData | null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/targeting/conditions/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TargetingConditionType } from './conditions/types';
|
|
2
|
-
declare abstract class TargetingCondition {
|
|
3
|
-
abstract conditionType: string;
|
|
4
|
-
abstract include: boolean;
|
|
5
|
-
abstract check: (data: TargetingConditionType) => boolean;
|
|
6
|
-
}
|
|
7
|
-
export default TargetingCondition;
|