@kameleoon/javascript-sdk-core 1.1.1 → 2.1.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.
Files changed (157) hide show
  1. package/dist/cacheManager/cacheManager.d.ts +38 -0
  2. package/dist/cacheManager/cacheManager.js +74 -0
  3. package/dist/cacheManager/cacheManager.js.map +1 -0
  4. package/dist/cacheManager/index.d.ts +2 -0
  5. package/dist/cacheManager/index.js +20 -0
  6. package/dist/cacheManager/index.js.map +1 -0
  7. package/dist/cacheManager/types.d.ts +14 -0
  8. package/dist/cacheManager/types.js +6 -0
  9. package/dist/cacheManager/types.js.map +1 -0
  10. package/dist/campaignConfiguration/campaignConfiguration.d.ts +2 -1
  11. package/dist/campaignConfiguration/campaignConfiguration.js +243 -196
  12. package/dist/campaignConfiguration/campaignConfiguration.js.map +1 -1
  13. package/dist/campaignConfiguration/constants.d.ts +3 -3
  14. package/dist/campaignConfiguration/constants.js +22 -16
  15. package/dist/campaignConfiguration/constants.js.map +1 -1
  16. package/dist/campaignConfiguration/index.d.ts +1 -0
  17. package/dist/campaignConfiguration/index.js +85 -6
  18. package/dist/campaignConfiguration/index.js.map +1 -1
  19. package/dist/campaignConfiguration/types.d.ts +7 -3
  20. package/dist/campaignConfiguration/types.js +53 -45
  21. package/dist/campaignConfiguration/types.js.map +1 -1
  22. package/dist/clientSettings/clientSettings.d.ts +1 -1
  23. package/dist/clientSettings/clientSettings.js +28 -21
  24. package/dist/clientSettings/clientSettings.js.map +1 -1
  25. package/dist/clientSettings/index.js +18 -4
  26. package/dist/clientSettings/index.js.map +1 -1
  27. package/dist/clientSettings/types.d.ts +1 -1
  28. package/dist/clientSettings/types.js +4 -1
  29. package/dist/clientSettings/types.js.map +1 -1
  30. package/dist/constants.d.ts +11 -0
  31. package/dist/constants.js +37 -14
  32. package/dist/constants.js.map +1 -1
  33. package/dist/eventSource/constants.js +6 -2
  34. package/dist/eventSource/constants.js.map +1 -1
  35. package/dist/eventSource/externalEventSource.js +28 -20
  36. package/dist/eventSource/externalEventSource.js.map +1 -1
  37. package/dist/eventSource/index.js +49 -6
  38. package/dist/eventSource/index.js.map +1 -1
  39. package/dist/eventSource/types.d.ts +1 -1
  40. package/dist/eventSource/types.js +4 -1
  41. package/dist/eventSource/types.js.map +1 -1
  42. package/dist/hasher/hasher.d.ts +1 -1
  43. package/dist/hasher/hasher.js +37 -26
  44. package/dist/hasher/hasher.js.map +1 -1
  45. package/dist/hasher/index.js +11 -4
  46. package/dist/hasher/index.js.map +1 -1
  47. package/dist/hasher/types.d.ts +1 -1
  48. package/dist/hasher/types.js +4 -1
  49. package/dist/hasher/types.js.map +1 -1
  50. package/dist/index.d.ts +4 -2
  51. package/dist/index.js +309 -28
  52. package/dist/index.js.map +1 -1
  53. package/dist/kameleoonClient.d.ts +32 -19
  54. package/dist/kameleoonClient.js +353 -235
  55. package/dist/kameleoonClient.js.map +1 -1
  56. package/dist/kameleoonData/browser.js +37 -32
  57. package/dist/kameleoonData/browser.js.map +1 -1
  58. package/dist/kameleoonData/constants.js +6 -2
  59. package/dist/kameleoonData/constants.js.map +1 -1
  60. package/dist/kameleoonData/conversion.js +47 -40
  61. package/dist/kameleoonData/conversion.js.map +1 -1
  62. package/dist/kameleoonData/customData.js +62 -58
  63. package/dist/kameleoonData/customData.js.map +1 -1
  64. package/dist/kameleoonData/device.js +37 -32
  65. package/dist/kameleoonData/device.js.map +1 -1
  66. package/dist/kameleoonData/index.js +101 -18
  67. package/dist/kameleoonData/index.js.map +1 -1
  68. package/dist/kameleoonData/nonce.js +25 -13
  69. package/dist/kameleoonData/nonce.js.map +1 -1
  70. package/dist/kameleoonData/pageView.js +52 -44
  71. package/dist/kameleoonData/pageView.js.map +1 -1
  72. package/dist/kameleoonData/types.js +41 -26
  73. package/dist/kameleoonData/types.js.map +1 -1
  74. package/dist/kameleoonData/userAgent.js +33 -24
  75. package/dist/kameleoonData/userAgent.js.map +1 -1
  76. package/dist/kameleoonError/constants.d.ts +1 -1
  77. package/dist/kameleoonError/constants.js +25 -21
  78. package/dist/kameleoonError/constants.js.map +1 -1
  79. package/dist/kameleoonError/helpers.js +6 -4
  80. package/dist/kameleoonError/helpers.js.map +1 -1
  81. package/dist/kameleoonError/index.js +25 -8
  82. package/dist/kameleoonError/index.js.map +1 -1
  83. package/dist/kameleoonError/kameleoonError.d.ts +1 -1
  84. package/dist/kameleoonError/kameleoonError.js +64 -53
  85. package/dist/kameleoonError/kameleoonError.js.map +1 -1
  86. package/dist/kameleoonError/types.d.ts +1 -1
  87. package/dist/kameleoonError/types.js +26 -22
  88. package/dist/kameleoonError/types.js.map +1 -1
  89. package/dist/kameleoonUtils.js +34 -33
  90. package/dist/kameleoonUtils.js.map +1 -1
  91. package/dist/requester/constants.d.ts +6 -7
  92. package/dist/requester/constants.js +58 -45
  93. package/dist/requester/constants.js.map +1 -1
  94. package/dist/requester/index.d.ts +2 -2
  95. package/dist/requester/index.js +67 -8
  96. package/dist/requester/index.js.map +1 -1
  97. package/dist/requester/requester.d.ts +7 -7
  98. package/dist/requester/requester.js +90 -113
  99. package/dist/requester/requester.js.map +1 -1
  100. package/dist/requester/types.d.ts +38 -10
  101. package/dist/requester/types.js +14 -36
  102. package/dist/requester/types.js.map +1 -1
  103. package/dist/storage/constants.js +11 -7
  104. package/dist/storage/constants.js.map +1 -1
  105. package/dist/storage/externalStorage.js +33 -26
  106. package/dist/storage/externalStorage.js.map +1 -1
  107. package/dist/storage/index.js +55 -6
  108. package/dist/storage/index.js.map +1 -1
  109. package/dist/storage/types.js +4 -1
  110. package/dist/storage/types.js.map +1 -1
  111. package/dist/targeting/conditions/conditionFactory.js +24 -19
  112. package/dist/targeting/conditions/conditionFactory.js.map +1 -1
  113. package/dist/targeting/conditions/customDataCondition.js +99 -88
  114. package/dist/targeting/conditions/customDataCondition.js.map +1 -1
  115. package/dist/targeting/conditions/exclusiveExperimentCondition.js +27 -15
  116. package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +1 -1
  117. package/dist/targeting/conditions/index.js +45 -10
  118. package/dist/targeting/conditions/index.js.map +1 -1
  119. package/dist/targeting/conditions/targetExperimentCondition.js +54 -32
  120. package/dist/targeting/conditions/targetExperimentCondition.js.map +1 -1
  121. package/dist/targeting/conditions/types.js +4 -1
  122. package/dist/targeting/conditions/types.js.map +1 -1
  123. package/dist/targeting/index.js +79 -13
  124. package/dist/targeting/index.js.map +1 -1
  125. package/dist/targeting/targetingNode.js +41 -33
  126. package/dist/targeting/targetingNode.js.map +1 -1
  127. package/dist/targeting/targetingTree.js +125 -104
  128. package/dist/targeting/targetingTree.js.map +1 -1
  129. package/dist/targeting/types.js +99 -91
  130. package/dist/targeting/types.js.map +1 -1
  131. package/dist/types.d.ts +34 -2
  132. package/dist/types.js +58 -21
  133. package/dist/types.js.map +1 -1
  134. package/dist/utilities/constants.js +6 -2
  135. package/dist/utilities/constants.js.map +1 -1
  136. package/dist/utilities/index.js +11 -4
  137. package/dist/utilities/index.js.map +1 -1
  138. package/dist/utilities/types.d.ts +9 -1
  139. package/dist/utilities/types.js +4 -1
  140. package/dist/utilities/types.js.map +1 -1
  141. package/dist/utilities/utilities.d.ts +6 -3
  142. package/dist/utilities/utilities.js +171 -105
  143. package/dist/utilities/utilities.js.map +1 -1
  144. package/dist/variationConfiguration/index.js +24 -4
  145. package/dist/variationConfiguration/index.js.map +1 -1
  146. package/dist/variationConfiguration/types.d.ts +1 -1
  147. package/dist/variationConfiguration/types.js +4 -1
  148. package/dist/variationConfiguration/types.js.map +1 -1
  149. package/dist/variationConfiguration/variation.js +35 -28
  150. package/dist/variationConfiguration/variation.js.map +1 -1
  151. package/dist/variationConfiguration/variationConfiguration.d.ts +5 -6
  152. package/dist/variationConfiguration/variationConfiguration.js +263 -230
  153. package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
  154. package/package.json +6 -4
  155. package/dist/hasher/constants.d.ts +0 -1
  156. package/dist/hasher/constants.js +0 -5
  157. package/dist/hasher/constants.js.map +0 -1
@@ -1,93 +1,101 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TargetingType = exports.MatchTypeTest = exports.MatchTypeVariation = exports.MatchTypeCustomData = exports.Operator = void 0;
4
- var Operator;
5
- (function (Operator) {
6
- Operator["And"] = "AND";
7
- Operator["Or"] = "OR";
8
- })(Operator = exports.Operator || (exports.Operator = {}));
9
- var MatchTypeCustomData;
10
- (function (MatchTypeCustomData) {
11
- MatchTypeCustomData["TRUE"] = "TRUE";
12
- MatchTypeCustomData["FALSE"] = "FALSE";
13
- MatchTypeCustomData["EXACT"] = "EXACT";
14
- MatchTypeCustomData["CONTAINS"] = "CONTAINS";
15
- MatchTypeCustomData["REGULAR_EXPRESSION"] = "REGULAR_EXPRESSION";
16
- MatchTypeCustomData["EQUAL"] = "EQUAL";
17
- MatchTypeCustomData["LOWER"] = "LOWER";
18
- MatchTypeCustomData["GREATER"] = "GREATER";
19
- MatchTypeCustomData["UNDEFINED"] = "UNDEFINED";
20
- MatchTypeCustomData["AMONG_VALUES"] = "AMONG_VALUES";
21
- })(MatchTypeCustomData = exports.MatchTypeCustomData || (exports.MatchTypeCustomData = {}));
22
- var MatchTypeVariation;
23
- (function (MatchTypeVariation) {
24
- MatchTypeVariation["ANY"] = "ANY";
25
- MatchTypeVariation["EXACT"] = "EXACT";
26
- })(MatchTypeVariation = exports.MatchTypeVariation || (exports.MatchTypeVariation = {}));
27
- var MatchTypeTest;
28
- (function (MatchTypeTest) {
29
- MatchTypeTest["ALL"] = "ALL";
30
- MatchTypeTest["TEST"] = "TEST";
31
- MatchTypeTest["PERSO"] = "PERSO";
32
- })(MatchTypeTest = exports.MatchTypeTest || (exports.MatchTypeTest = {}));
33
- var TargetingType;
34
- (function (TargetingType) {
35
- TargetingType["PAGE_URL"] = "PAGE_URL";
36
- TargetingType["PAGE_TITLE"] = "PAGE_TITLE";
37
- TargetingType["LANDING_PAGE"] = "LANDING_PAGE";
38
- TargetingType["ORIGIN"] = "ORIGIN";
39
- TargetingType["ORIGIN_TYPE"] = "ORIGIN_TYPE";
40
- TargetingType["REFERRERS"] = "REFERRERS";
41
- TargetingType["NEW_VISITORS"] = "NEW_VISITORS";
42
- TargetingType["INTERESTS"] = "INTERESTS";
43
- TargetingType["BROWSER_LANGUAGE"] = "BROWSER_LANGUAGE";
44
- TargetingType["GEOLOCATION"] = "GEOLOCATION";
45
- TargetingType["DEVICE_TYPE"] = "DEVICE_TYPE";
46
- TargetingType["SCREEN_DIMENSION"] = "SCREEN_DIMENSION";
47
- TargetingType["VISITOR_IP"] = "VISITOR_IP";
48
- TargetingType["AD_BLOCKER"] = "AD_BLOCKER";
49
- TargetingType["PREVIOUS_PAGE"] = "PREVIOUS_PAGE";
50
- TargetingType["KEY_PAGES"] = "KEY_PAGES";
51
- TargetingType["PAGE_VIEWS"] = "PAGE_VIEWS";
52
- TargetingType["FIRST_VISIT"] = "FIRST_VISIT";
53
- TargetingType["LAST_VISIT"] = "LAST_VISIT";
54
- TargetingType["ACTIVE_SESSION"] = "ACTIVE_SESSION";
55
- TargetingType["TIME_SINCE_PAGE_LOAD"] = "TIME_SINCE_PAGE_LOAD";
56
- TargetingType["SAME_DAY_VISITS"] = "SAME_DAY_VISITS";
57
- TargetingType["VISITS"] = "VISITS";
58
- TargetingType["VISITS_BY_PAGE"] = "VISITS_BY_PAGE";
59
- TargetingType["INTERNAL_SEARCH_KEYWORDS"] = "INTERNAL_SEARCH_KEYWORDS";
60
- TargetingType["TABS_ON_SITE"] = "TABS_ON_SITE";
61
- TargetingType["CONVERSION_PROBABILITY"] = "CONVERSION_PROBABILITY";
62
- TargetingType["HEAT_SLICE"] = "HEAT_SLICE";
63
- TargetingType["SKY_STATUS"] = "SKY_STATUS";
64
- TargetingType["TEMPERATURE"] = "TEMPERATURE";
65
- TargetingType["DAY_NIGHT"] = "DAY_NIGHT";
66
- TargetingType["FORECAST_SKY_STATUS"] = "FORECAST_SKY_STATUS";
67
- TargetingType["FORECAST_TEMPERATURE"] = "FORECAST_TEMPERATURE";
68
- TargetingType["DAY_OF_WEEK"] = "DAY_OF_WEEK";
69
- TargetingType["TIME_RANGE"] = "TIME_RANGE";
70
- TargetingType["HOUR_MINUTE_RANGE"] = "HOUR_MINUTE_RANGE";
71
- TargetingType["JS_CODE"] = "JS_CODE";
72
- TargetingType["COOKIE"] = "COOKIE";
73
- TargetingType["EVENT"] = "EVENT";
74
- TargetingType["BROWSER"] = "BROWSER";
75
- TargetingType["OPERATING_SYSTEM"] = "OPERATING_SYSTEM";
76
- TargetingType["DOM_ELEMENT"] = "DOM_ELEMENT";
77
- TargetingType["MOUSE_OUT"] = "MOUSE_OUT";
78
- TargetingType["TARGET_EXPERIMENT"] = "TARGET_EXPERIMENT";
79
- TargetingType["TARGET_PERSONALIZATION"] = "TARGET_PERSONALIZATION";
80
- TargetingType["EXCLUSIVE_EXPERIMENT"] = "EXCLUSIVE_EXPERIMENT";
81
- TargetingType["CONVERSIONS"] = "CONVERSIONS";
82
- TargetingType["CUSTOM_DATUM"] = "CUSTOM_DATUM";
83
- TargetingType["YSANCE_SEGMENT"] = "YSANCE_SEGMENT";
84
- TargetingType["YSANCE_ATTRIBUT"] = "YSANCE_ATTRIBUT";
85
- TargetingType["TEALIUM_BADGE"] = "TEALIUM_BADGE";
86
- TargetingType["TEALIUM_AUDIENCE"] = "TEALIUM_AUDIENCE";
87
- TargetingType["PRICE_OF_DISPLAYED_PAGE"] = "PRICE_OF_DISPLAYED_PAGE";
88
- TargetingType["NUMBER_OF_VISITED_PAGES"] = "NUMBER_OF_VISITED_PAGES";
89
- TargetingType["VISITED_PAGES"] = "VISITED_PAGES";
90
- TargetingType["CUSTOM"] = "CUSTOM";
91
- TargetingType["EXPLICIT_TRIGGER"] = "EXPLICIT_TRIGGER";
92
- })(TargetingType = exports.TargetingType || (exports.TargetingType = {}));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TargetingType = exports.Operator = exports.MatchTypeVariation = exports.MatchTypeTest = exports.MatchTypeCustomData = void 0;
7
+ let Operator = /*#__PURE__*/function (Operator) {
8
+ Operator["And"] = "AND";
9
+ Operator["Or"] = "OR";
10
+ return Operator;
11
+ }({});
12
+ exports.Operator = Operator;
13
+ let MatchTypeCustomData = /*#__PURE__*/function (MatchTypeCustomData) {
14
+ MatchTypeCustomData["TRUE"] = "TRUE";
15
+ MatchTypeCustomData["FALSE"] = "FALSE";
16
+ MatchTypeCustomData["EXACT"] = "EXACT";
17
+ MatchTypeCustomData["CONTAINS"] = "CONTAINS";
18
+ MatchTypeCustomData["REGULAR_EXPRESSION"] = "REGULAR_EXPRESSION";
19
+ MatchTypeCustomData["EQUAL"] = "EQUAL";
20
+ MatchTypeCustomData["LOWER"] = "LOWER";
21
+ MatchTypeCustomData["GREATER"] = "GREATER";
22
+ MatchTypeCustomData["UNDEFINED"] = "UNDEFINED";
23
+ MatchTypeCustomData["AMONG_VALUES"] = "AMONG_VALUES";
24
+ return MatchTypeCustomData;
25
+ }({});
26
+ exports.MatchTypeCustomData = MatchTypeCustomData;
27
+ let MatchTypeVariation = /*#__PURE__*/function (MatchTypeVariation) {
28
+ MatchTypeVariation["ANY"] = "ANY";
29
+ MatchTypeVariation["EXACT"] = "EXACT";
30
+ return MatchTypeVariation;
31
+ }({});
32
+ exports.MatchTypeVariation = MatchTypeVariation;
33
+ let MatchTypeTest = /*#__PURE__*/function (MatchTypeTest) {
34
+ MatchTypeTest["ALL"] = "ALL";
35
+ MatchTypeTest["TEST"] = "TEST";
36
+ MatchTypeTest["PERSO"] = "PERSO";
37
+ return MatchTypeTest;
38
+ }({});
39
+ exports.MatchTypeTest = MatchTypeTest;
40
+ let TargetingType = /*#__PURE__*/function (TargetingType) {
41
+ TargetingType["PAGE_URL"] = "PAGE_URL";
42
+ TargetingType["PAGE_TITLE"] = "PAGE_TITLE";
43
+ TargetingType["LANDING_PAGE"] = "LANDING_PAGE";
44
+ TargetingType["ORIGIN"] = "ORIGIN";
45
+ TargetingType["ORIGIN_TYPE"] = "ORIGIN_TYPE";
46
+ TargetingType["REFERRERS"] = "REFERRERS";
47
+ TargetingType["NEW_VISITORS"] = "NEW_VISITORS";
48
+ TargetingType["INTERESTS"] = "INTERESTS";
49
+ TargetingType["BROWSER_LANGUAGE"] = "BROWSER_LANGUAGE";
50
+ TargetingType["GEOLOCATION"] = "GEOLOCATION";
51
+ TargetingType["DEVICE_TYPE"] = "DEVICE_TYPE";
52
+ TargetingType["SCREEN_DIMENSION"] = "SCREEN_DIMENSION";
53
+ TargetingType["VISITOR_IP"] = "VISITOR_IP";
54
+ TargetingType["AD_BLOCKER"] = "AD_BLOCKER";
55
+ TargetingType["PREVIOUS_PAGE"] = "PREVIOUS_PAGE";
56
+ TargetingType["KEY_PAGES"] = "KEY_PAGES";
57
+ TargetingType["PAGE_VIEWS"] = "PAGE_VIEWS";
58
+ TargetingType["FIRST_VISIT"] = "FIRST_VISIT";
59
+ TargetingType["LAST_VISIT"] = "LAST_VISIT";
60
+ TargetingType["ACTIVE_SESSION"] = "ACTIVE_SESSION";
61
+ TargetingType["TIME_SINCE_PAGE_LOAD"] = "TIME_SINCE_PAGE_LOAD";
62
+ TargetingType["SAME_DAY_VISITS"] = "SAME_DAY_VISITS";
63
+ TargetingType["VISITS"] = "VISITS";
64
+ TargetingType["VISITS_BY_PAGE"] = "VISITS_BY_PAGE";
65
+ TargetingType["INTERNAL_SEARCH_KEYWORDS"] = "INTERNAL_SEARCH_KEYWORDS";
66
+ TargetingType["TABS_ON_SITE"] = "TABS_ON_SITE";
67
+ TargetingType["CONVERSION_PROBABILITY"] = "CONVERSION_PROBABILITY";
68
+ TargetingType["HEAT_SLICE"] = "HEAT_SLICE";
69
+ TargetingType["SKY_STATUS"] = "SKY_STATUS";
70
+ TargetingType["TEMPERATURE"] = "TEMPERATURE";
71
+ TargetingType["DAY_NIGHT"] = "DAY_NIGHT";
72
+ TargetingType["FORECAST_SKY_STATUS"] = "FORECAST_SKY_STATUS";
73
+ TargetingType["FORECAST_TEMPERATURE"] = "FORECAST_TEMPERATURE";
74
+ TargetingType["DAY_OF_WEEK"] = "DAY_OF_WEEK";
75
+ TargetingType["TIME_RANGE"] = "TIME_RANGE";
76
+ TargetingType["HOUR_MINUTE_RANGE"] = "HOUR_MINUTE_RANGE";
77
+ TargetingType["JS_CODE"] = "JS_CODE";
78
+ TargetingType["COOKIE"] = "COOKIE";
79
+ TargetingType["EVENT"] = "EVENT";
80
+ TargetingType["BROWSER"] = "BROWSER";
81
+ TargetingType["OPERATING_SYSTEM"] = "OPERATING_SYSTEM";
82
+ TargetingType["DOM_ELEMENT"] = "DOM_ELEMENT";
83
+ TargetingType["MOUSE_OUT"] = "MOUSE_OUT";
84
+ TargetingType["TARGET_EXPERIMENT"] = "TARGET_EXPERIMENT";
85
+ TargetingType["TARGET_PERSONALIZATION"] = "TARGET_PERSONALIZATION";
86
+ TargetingType["EXCLUSIVE_EXPERIMENT"] = "EXCLUSIVE_EXPERIMENT";
87
+ TargetingType["CONVERSIONS"] = "CONVERSIONS";
88
+ TargetingType["CUSTOM_DATUM"] = "CUSTOM_DATUM";
89
+ TargetingType["YSANCE_SEGMENT"] = "YSANCE_SEGMENT";
90
+ TargetingType["YSANCE_ATTRIBUT"] = "YSANCE_ATTRIBUT";
91
+ TargetingType["TEALIUM_BADGE"] = "TEALIUM_BADGE";
92
+ TargetingType["TEALIUM_AUDIENCE"] = "TEALIUM_AUDIENCE";
93
+ TargetingType["PRICE_OF_DISPLAYED_PAGE"] = "PRICE_OF_DISPLAYED_PAGE";
94
+ TargetingType["NUMBER_OF_VISITED_PAGES"] = "NUMBER_OF_VISITED_PAGES";
95
+ TargetingType["VISITED_PAGES"] = "VISITED_PAGES";
96
+ TargetingType["CUSTOM"] = "CUSTOM";
97
+ TargetingType["EXPLICIT_TRIGGER"] = "EXPLICIT_TRIGGER";
98
+ return TargetingType;
99
+ }({});
100
+ exports.TargetingType = TargetingType;
93
101
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/targeting/types.ts"],"names":[],"mappings":";;;AAKA,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,qBAAS,CAAA;AACX,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAqDD,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,sCAAe,CAAA;IACf,sCAAe,CAAA;IACf,4CAAqB,CAAA;IACrB,gEAAyC,CAAA;IACzC,sCAAe,CAAA;IACf,sCAAe,CAAA;IACf,0CAAmB,CAAA;IACnB,8CAAuB,CAAA;IACvB,oDAA6B,CAAA;AAC/B,CAAC,EAXW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAW9B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,iCAAW,CAAA;IACX,qCAAe,CAAA;AACjB,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,4BAAW,CAAA;IACX,8BAAa,CAAA;IACb,gCAAe,CAAA;AACjB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB;AAED,IAAY,aA0DX;AA1DD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,8CAA6B,CAAA;IAC7B,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;IAC3B,wCAAuB,CAAA;IACvB,8CAA6B,CAAA;IAC7B,wCAAuB,CAAA;IACvB,sDAAqC,CAAA;IACrC,4CAA2B,CAAA;IAC3B,4CAA2B,CAAA;IAC3B,sDAAqC,CAAA;IACrC,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;IACzB,gDAA+B,CAAA;IAC/B,wCAAuB,CAAA;IACvB,0CAAyB,CAAA;IACzB,4CAA2B,CAAA;IAC3B,0CAAyB,CAAA;IACzB,kDAAiC,CAAA;IACjC,8DAA6C,CAAA;IAC7C,oDAAmC,CAAA;IACnC,kCAAiB,CAAA;IACjB,kDAAiC,CAAA;IACjC,sEAAqD,CAAA;IACrD,8CAA6B,CAAA;IAC7B,kEAAiD,CAAA;IACjD,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;IACzB,4CAA2B,CAAA;IAC3B,wCAAuB,CAAA;IACvB,4DAA2C,CAAA;IAC3C,8DAA6C,CAAA;IAC7C,4CAA2B,CAAA;IAC3B,0CAAyB,CAAA;IACzB,wDAAuC,CAAA;IACvC,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,gCAAe,CAAA;IACf,oCAAmB,CAAA;IACnB,sDAAqC,CAAA;IACrC,4CAA2B,CAAA;IAC3B,wCAAuB,CAAA;IACvB,wDAAuC,CAAA;IACvC,kEAAiD,CAAA;IACjD,8DAA6C,CAAA;IAC7C,4CAA2B,CAAA;IAC3B,8CAA6B,CAAA;IAC7B,kDAAiC,CAAA;IACjC,oDAAmC,CAAA;IACnC,gDAA+B,CAAA;IAC/B,sDAAqC,CAAA;IACrC,oEAAmD,CAAA;IACnD,oEAAmD,CAAA;IACnD,gDAA+B,CAAA;IAC/B,kCAAiB,CAAA;IACjB,sDAAqC,CAAA;AACvC,CAAC,EA1DW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA0DxB"}
1
+ {"version":3,"file":"types.js","names":["Operator","exports","MatchTypeCustomData","MatchTypeVariation","MatchTypeTest","TargetingType"],"sources":["../../src/targeting/types.ts"],"sourcesContent":["import { KameleoonDataItemType } from '../kameleoonData';\nimport { ExperimentVariationsType } from '../storage';\nimport { ConditionDataType, ConditionType } from './conditions';\nimport { TargetingNode } from './targetingNode';\n\nexport enum Operator {\n And = 'AND',\n Or = 'OR',\n}\n\nexport type NonLeafNodeType = {\n left: TargetingNode;\n right: TargetingNode;\n value: Operator;\n};\n\nexport type LeafNodeType = {\n left: undefined;\n right: undefined;\n value: ConditionType;\n};\n\nexport type NodeValueType = ConditionType | Operator;\n\nexport type ConditionLevelType = {\n orOperators: boolean[];\n conditions: ConditionDataType[];\n};\n\nexport type SegmentType = {\n id: string;\n name: string;\n conditionsData: {\n firstLevelOrOperators: boolean[];\n firstLevel: ConditionLevelType[];\n };\n};\n\nexport type FlatSegmentType = {\n conditions: ConditionDataType[];\n operators: Operator[];\n};\n\nexport type TargetingDataItemType = {\n lastActivityTime: number;\n data: KameleoonDataItemType;\n};\n\nexport type TargetingDataType = {\n // --- Note ---\n // `undefined` is used to indicate possible data absence for certain\n // visitorCode\n [visitorCode: string]: TargetingDataItemType[] | undefined;\n};\n\nexport type EvaluationDataType = {\n targetingData: TargetingDataItemType[];\n variationData: ExperimentVariationsType;\n experimentId: number | null;\n};\n\nexport enum MatchTypeCustomData {\n TRUE = 'TRUE',\n FALSE = 'FALSE',\n EXACT = 'EXACT',\n CONTAINS = 'CONTAINS',\n REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',\n EQUAL = 'EQUAL',\n LOWER = 'LOWER',\n GREATER = 'GREATER',\n UNDEFINED = 'UNDEFINED',\n AMONG_VALUES = 'AMONG_VALUES',\n}\n\nexport enum MatchTypeVariation {\n ANY = 'ANY',\n EXACT = 'EXACT',\n}\n\nexport enum MatchTypeTest {\n ALL = 'ALL',\n TEST = 'TEST',\n PERSO = 'PERSO',\n}\n\nexport enum TargetingType {\n PAGE_URL = 'PAGE_URL',\n PAGE_TITLE = 'PAGE_TITLE',\n LANDING_PAGE = 'LANDING_PAGE',\n ORIGIN = 'ORIGIN',\n ORIGIN_TYPE = 'ORIGIN_TYPE',\n REFERRERS = 'REFERRERS',\n NEW_VISITORS = 'NEW_VISITORS',\n INTERESTS = 'INTERESTS',\n BROWSER_LANGUAGE = 'BROWSER_LANGUAGE',\n GEOLOCATION = 'GEOLOCATION',\n DEVICE_TYPE = 'DEVICE_TYPE',\n SCREEN_DIMENSION = 'SCREEN_DIMENSION',\n VISITOR_IP = 'VISITOR_IP',\n AD_BLOCKER = 'AD_BLOCKER',\n PREVIOUS_PAGE = 'PREVIOUS_PAGE',\n KEY_PAGES = 'KEY_PAGES',\n PAGE_VIEWS = 'PAGE_VIEWS',\n FIRST_VISIT = 'FIRST_VISIT',\n LAST_VISIT = 'LAST_VISIT',\n ACTIVE_SESSION = 'ACTIVE_SESSION',\n TIME_SINCE_PAGE_LOAD = 'TIME_SINCE_PAGE_LOAD',\n SAME_DAY_VISITS = 'SAME_DAY_VISITS',\n VISITS = 'VISITS',\n VISITS_BY_PAGE = 'VISITS_BY_PAGE',\n INTERNAL_SEARCH_KEYWORDS = 'INTERNAL_SEARCH_KEYWORDS',\n TABS_ON_SITE = 'TABS_ON_SITE',\n CONVERSION_PROBABILITY = 'CONVERSION_PROBABILITY',\n HEAT_SLICE = 'HEAT_SLICE',\n SKY_STATUS = 'SKY_STATUS',\n TEMPERATURE = 'TEMPERATURE',\n DAY_NIGHT = 'DAY_NIGHT',\n FORECAST_SKY_STATUS = 'FORECAST_SKY_STATUS',\n FORECAST_TEMPERATURE = 'FORECAST_TEMPERATURE',\n DAY_OF_WEEK = 'DAY_OF_WEEK',\n TIME_RANGE = 'TIME_RANGE',\n HOUR_MINUTE_RANGE = 'HOUR_MINUTE_RANGE',\n JS_CODE = 'JS_CODE',\n COOKIE = 'COOKIE',\n EVENT = 'EVENT',\n BROWSER = 'BROWSER',\n OPERATING_SYSTEM = 'OPERATING_SYSTEM',\n DOM_ELEMENT = 'DOM_ELEMENT',\n MOUSE_OUT = 'MOUSE_OUT',\n TARGET_EXPERIMENT = 'TARGET_EXPERIMENT',\n TARGET_PERSONALIZATION = 'TARGET_PERSONALIZATION',\n EXCLUSIVE_EXPERIMENT = 'EXCLUSIVE_EXPERIMENT',\n CONVERSIONS = 'CONVERSIONS',\n CUSTOM_DATUM = 'CUSTOM_DATUM',\n YSANCE_SEGMENT = 'YSANCE_SEGMENT',\n YSANCE_ATTRIBUT = 'YSANCE_ATTRIBUT',\n TEALIUM_BADGE = 'TEALIUM_BADGE',\n TEALIUM_AUDIENCE = 'TEALIUM_AUDIENCE',\n PRICE_OF_DISPLAYED_PAGE = 'PRICE_OF_DISPLAYED_PAGE',\n NUMBER_OF_VISITED_PAGES = 'NUMBER_OF_VISITED_PAGES',\n VISITED_PAGES = 'VISITED_PAGES',\n CUSTOM = 'CUSTOM',\n EXPLICIT_TRIGGER = 'EXPLICIT_TRIGGER',\n}\n"],"mappings":";;;;;;IAKYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAAAC,OAAA,CAAAD,QAAA,GAAAA,QAAA;AAAA,IAwDRE,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAAAD,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAAA,IAanBC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAAF,OAAA,CAAAE,kBAAA,GAAAA,kBAAA;AAAA,IAKlBC,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAAH,OAAA,CAAAG,aAAA,GAAAA,aAAA;AAAA,IAMbC,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAAJ,OAAA,CAAAI,aAAA,GAAAA,aAAA"}
package/dist/types.d.ts CHANGED
@@ -1,18 +1,28 @@
1
1
  /// <reference types="node" />
2
2
  import { IncomingMessage, ServerResponse } from 'http';
3
3
  import { JSONType } from './campaignConfiguration/types';
4
+ import { SDKType } from './constants';
4
5
  import { IExternalEventSourceConstructor } from './eventSource';
5
6
  import { IExternalStorageConstructor } from './storage';
7
+ import { IExternalRequestDispatcher, GetClientConfigurationResultType } from './requester';
6
8
  /**
7
9
  * @param {number} updateInterval - update interval in _minutes_ for sdk configuration, minimum value is 1 minute
8
10
  * @defaultvalue 60
9
11
  *
10
12
  * @param {Environment} environment - feature flag environment
11
13
  * @defaultvalue Environment.Production
14
+ *
15
+ * @param {number | undefined} targetingDataCleanupInterval - interval in _minutes_ for cleaning up targeting data, minimum value is 1 minute
16
+ * Note: if not specified, default value will be used
17
+ * @defaultvalue
18
+ * - JavaScript SDK: `undefined` (no cleanup)
19
+ * - React/React Native SDK: `undefined` (no cleanup)
20
+ * - NodeJS SDK: `30`
12
21
  * */
13
22
  export type SDKConfigurationType = {
14
23
  updateInterval?: number;
15
24
  environment?: Environment;
25
+ targetingDataCleanupInterval?: number;
16
26
  };
17
27
  /**
18
28
  * @param {string} siteCode - client's siteCode defined on Kameleoon platform
@@ -25,12 +35,28 @@ export type SDKCoreParameters = {
25
35
  internalConfiguration: InternalSDKConfigurationType;
26
36
  };
27
37
  /**
28
- * @param {IExternalStorage | undefiend} externalStorage - external file system storage implemented outside client initialization
29
- * @param {IExternalEventSourceConstructor | undefiend} externalEventSource - constructor for building external event source implementation
38
+ * @param {SDKType} type - type of the SDK
39
+ * @param {string} version - version of the package
40
+ * */
41
+ export type ExternalPackageInfoType = {
42
+ type: SDKType;
43
+ version: string;
44
+ };
45
+ /**
46
+ * @param {IExternalStorage | undefined} externalStorage - external file system storage implemented outside client initialization
47
+ * @param {IExternalEventSourceConstructor | undefined} externalEventSource - constructor for building external event source implementation
48
+ * @param {ExternalPackageInfoType} externalPackageInfo - external package info, used to get package version and name
49
+ * @param {GetClientConfigurationResultType} externalClientConfiguration - external fetched client configuration
50
+ * @param {IExternalRequestDispatcher} externalRequestDispatcher - external request dispatcher, used to track data or get data
51
+ * @param {number} targetingDataCleanupInterval - interval in *minutes* for cleaning up targeting data, minimum value is 1 minute
30
52
  * */
31
53
  export type InternalSDKConfigurationType = {
32
54
  externalStorage: IExternalStorageConstructor;
33
55
  externalEventSource: IExternalEventSourceConstructor;
56
+ externalPackageInfo: ExternalPackageInfoType;
57
+ externalRequestDispatcher: IExternalRequestDispatcher;
58
+ externalClientConfiguration?: GetClientConfigurationResultType;
59
+ targetingDataCleanupInterval?: number;
34
60
  };
35
61
  /**
36
62
  * @readonly
@@ -133,3 +159,9 @@ export type ClientGetVisitorCodeParametersType = {
133
159
  export type MobileGetVisitorCodeParametersType = {
134
160
  defaultVisitorCode?: string;
135
161
  };
162
+ export type TrackingCacheItemType = {
163
+ [experimentId: number]: {
164
+ variationId: number;
165
+ expirationTime: number;
166
+ };
167
+ };
package/dist/types.js CHANGED
@@ -1,31 +1,68 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Milliseconds = exports.VariableType = exports.Environment = void 0;
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.VariableType = exports.Milliseconds = exports.Environment = void 0;
7
+ /**
8
+ * @param {number} updateInterval - update interval in _minutes_ for sdk configuration, minimum value is 1 minute
9
+ * @defaultvalue 60
10
+ *
11
+ * @param {Environment} environment - feature flag environment
12
+ * @defaultvalue Environment.Production
13
+ *
14
+ * @param {number | undefined} targetingDataCleanupInterval - interval in _minutes_ for cleaning up targeting data, minimum value is 1 minute
15
+ * Note: if not specified, default value will be used
16
+ * @defaultvalue
17
+ * - JavaScript SDK: `undefined` (no cleanup)
18
+ * - React/React Native SDK: `undefined` (no cleanup)
19
+ * - NodeJS SDK: `30`
20
+ * */
21
+ /**
22
+ * @param {string} siteCode - client's siteCode defined on Kameleoon platform
23
+ * @param {Partial<SDKConfigurationType>} configuration - client's configuration
24
+ * @param {InternalSDKConfigurationType} internalConfiguration - internal configuration for sdk core to be initialized with certain parameters to certain type of JavaScript SDK
25
+ * */
26
+ /**
27
+ * @param {SDKType} type - type of the SDK
28
+ * @param {string} version - version of the package
29
+ * */
30
+ /**
31
+ * @param {IExternalStorage | undefined} externalStorage - external file system storage implemented outside client initialization
32
+ * @param {IExternalEventSourceConstructor | undefined} externalEventSource - constructor for building external event source implementation
33
+ * @param {ExternalPackageInfoType} externalPackageInfo - external package info, used to get package version and name
34
+ * @param {GetClientConfigurationResultType} externalClientConfiguration - external fetched client configuration
35
+ * @param {IExternalRequestDispatcher} externalRequestDispatcher - external request dispatcher, used to track data or get data
36
+ * @param {number} targetingDataCleanupInterval - interval in *minutes* for cleaning up targeting data, minimum value is 1 minute
37
+ * */
4
38
  /**
5
39
  * @readonly
6
40
  * @enum {string} an Enum containing all possible variants of environment, passed as an argument to KameleoonClient `configuration`s `environment` field
7
41
  * */
8
- var Environment;
9
- (function (Environment) {
10
- Environment["Production"] = "production";
11
- Environment["Staging"] = "staging";
12
- Environment["Development"] = "development";
13
- })(Environment = exports.Environment || (exports.Environment = {}));
42
+ let Environment = /*#__PURE__*/function (Environment) {
43
+ Environment["Production"] = "production";
44
+ Environment["Staging"] = "staging";
45
+ Environment["Development"] = "development";
46
+ return Environment;
47
+ }({});
14
48
  /**
15
49
  * @readonly
16
50
  * @enum {string} an Enum containing all possible variants of feature variable types
17
51
  * */
18
- var VariableType;
19
- (function (VariableType) {
20
- VariableType["BOOLEAN"] = "BOOLEAN";
21
- VariableType["NUMBER"] = "NUMBER";
22
- VariableType["STRING"] = "STRING";
23
- VariableType["JSON"] = "JSON";
24
- })(VariableType = exports.VariableType || (exports.VariableType = {}));
25
- var Milliseconds;
26
- (function (Milliseconds) {
27
- Milliseconds[Milliseconds["Second"] = 1000] = "Second";
28
- Milliseconds[Milliseconds["Minute"] = 60000] = "Minute";
29
- Milliseconds[Milliseconds["Hour"] = 3600000] = "Hour";
30
- })(Milliseconds = exports.Milliseconds || (exports.Milliseconds = {}));
52
+ exports.Environment = Environment;
53
+ let VariableType = /*#__PURE__*/function (VariableType) {
54
+ VariableType["BOOLEAN"] = "BOOLEAN";
55
+ VariableType["NUMBER"] = "NUMBER";
56
+ VariableType["STRING"] = "STRING";
57
+ VariableType["JSON"] = "JSON";
58
+ return VariableType;
59
+ }({});
60
+ exports.VariableType = VariableType;
61
+ let Milliseconds = function (Milliseconds) {
62
+ Milliseconds[Milliseconds["Second"] = 1000] = "Second";
63
+ Milliseconds[Milliseconds["Minute"] = 60 * Milliseconds.Second] = "Minute";
64
+ Milliseconds[Milliseconds["Hour"] = 60 * Milliseconds.Minute] = "Hour";
65
+ return Milliseconds;
66
+ }({});
67
+ exports.Milliseconds = Milliseconds;
31
68
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAqCA;;;KAGK;AACL,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,kCAAmB,CAAA;IACnB,0CAA2B,CAAA;AAC7B,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED;;;KAGK;AACL,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAKvB;AAmBD,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,sDAAa,CAAA;IACb,uDAAiC,CAAA;IACjC,qDAA+B,CAAA;AACjC,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB"}
1
+ {"version":3,"file":"types.js","names":["Environment","exports","VariableType","Milliseconds","Second","Minute"],"sources":["../src/types.ts"],"sourcesContent":["import { IncomingMessage, ServerResponse } from 'http';\nimport { JSONType } from './campaignConfiguration/types';\nimport { SDKType } from './constants';\nimport { IExternalEventSourceConstructor } from './eventSource';\nimport { IExternalStorageConstructor } from './storage';\nimport {\n IExternalRequestDispatcher,\n GetClientConfigurationResultType,\n} from './requester';\n\n/**\n * @param {number} updateInterval - update interval in _minutes_ for sdk configuration, minimum value is 1 minute\n * @defaultvalue 60\n *\n * @param {Environment} environment - feature flag environment\n * @defaultvalue Environment.Production\n *\n * @param {number | undefined} targetingDataCleanupInterval - interval in _minutes_ for cleaning up targeting data, minimum value is 1 minute\n * Note: if not specified, default value will be used\n * @defaultvalue\n * - JavaScript SDK: `undefined` (no cleanup)\n * - React/React Native SDK: `undefined` (no cleanup)\n * - NodeJS SDK: `30`\n * */\nexport type SDKConfigurationType = {\n updateInterval?: number;\n environment?: Environment;\n targetingDataCleanupInterval?: number;\n};\n\n/**\n * @param {string} siteCode - client's siteCode defined on Kameleoon platform\n * @param {Partial<SDKConfigurationType>} configuration - client's configuration\n * @param {InternalSDKConfigurationType} internalConfiguration - internal configuration for sdk core to be initialized with certain parameters to certain type of JavaScript SDK\n * */\nexport type SDKCoreParameters = {\n siteCode: string;\n configuration?: Partial<SDKConfigurationType>;\n internalConfiguration: InternalSDKConfigurationType;\n};\n\n/**\n * @param {SDKType} type - type of the SDK\n * @param {string} version - version of the package\n * */\nexport type ExternalPackageInfoType = {\n type: SDKType;\n version: string;\n};\n\n/**\n * @param {IExternalStorage | undefined} externalStorage - external file system storage implemented outside client initialization\n * @param {IExternalEventSourceConstructor | undefined} externalEventSource - constructor for building external event source implementation\n * @param {ExternalPackageInfoType} externalPackageInfo - external package info, used to get package version and name\n * @param {GetClientConfigurationResultType} externalClientConfiguration - external fetched client configuration\n * @param {IExternalRequestDispatcher} externalRequestDispatcher - external request dispatcher, used to track data or get data\n * @param {number} targetingDataCleanupInterval - interval in *minutes* for cleaning up targeting data, minimum value is 1 minute\n * */\nexport type InternalSDKConfigurationType = {\n externalStorage: IExternalStorageConstructor;\n externalEventSource: IExternalEventSourceConstructor;\n externalPackageInfo: ExternalPackageInfoType;\n externalRequestDispatcher: IExternalRequestDispatcher;\n externalClientConfiguration?: GetClientConfigurationResultType;\n targetingDataCleanupInterval?: number;\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants of environment, passed as an argument to KameleoonClient `configuration`s `environment` field\n * */\nexport enum Environment {\n Production = 'production',\n Staging = 'staging',\n Development = 'development',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants of feature variable types\n * */\nexport enum VariableType {\n BOOLEAN = 'BOOLEAN',\n NUMBER = 'NUMBER',\n STRING = 'STRING',\n JSON = 'JSON',\n}\n\nexport type BooleanVariableType = {\n type: VariableType.BOOLEAN;\n value: boolean;\n};\nexport type NumberVariableType = { type: VariableType.NUMBER; value: number };\nexport type StringVariableType = { type: VariableType.STRING; value: string };\nexport type JSONVariableType = { type: VariableType.JSON; value: JSONType };\n\n/**\n * @type FeatureVariableResultType - tuple of possible feature variable result types, each possible variation is an object containing `type` and `value` fields, `type` can be checked against `FeatureVariableType` enum, if the `type` is `FeatureVariableType.BOOLEAN` then the `value` type will be `boolean` and so on.\n * */\nexport type FeatureVariableResultType =\n | BooleanVariableType\n | NumberVariableType\n | StringVariableType\n | JSONVariableType;\n\nexport enum Milliseconds {\n Second = 1000,\n Minute = 60 * Milliseconds.Second,\n Hour = 60 * Milliseconds.Minute,\n}\n\nexport type TrackConversionParamsType = {\n visitorCode: string;\n goalId: number;\n revenue: number;\n};\n\nexport type ExperimentType = {\n id: number;\n name: string;\n};\n\nexport type FeatureFlagType = {\n id: number;\n key: string;\n};\n\n/**\n * @param {string} visitorCode - unique visitor identifier, shouldn't exceed 255 characters\n * @param {string} featureKey - key of the feature flag to look for, can be found on Kameleoon Platform\n * @param {string} variableKey - key of the variable to be found for a feature flag with provided `featureKey`, can be found on Kameleoon Platform\n * */\nexport type GetFeatureFlagVariableParamsType = {\n visitorCode: string;\n featureKey: string;\n variableKey: string;\n};\n\n/**\n * @param {string} domain - domain which cookie belongs to\n * @param {string} visitorCode - unique visitor identifier, shouldn't exceed 255 characters\n * */\nexport type GetResultCookieParametersType = {\n domain: string;\n visitorCode: string;\n};\n\n/**\n * @param {Request} request - request object to get the cookie from\n * @param {Response} response - response object to write the updated cookie to\n * @param {string} domain - domain which cookie belongs to\n * @param {string | undefined} defaultVisitorCode - visitor code to be used in case there is no visitor code in cookies *Note*: if not passed visitor code will be randomly generated\n * */\nexport type ServerGetVisitorCodeParametersType = {\n request: IncomingMessage;\n response: ServerResponse;\n domain: string;\n defaultVisitorCode?: string;\n};\n\n/**\n * @param {string} domain - domain which cookie belongs to\n * @param {string | undefined} defaultVisitorCode - visitor code to be used in case there is no visitor code in cookies *Note*: if not passed visitor code will be randomly generated\n * */\nexport type ClientGetVisitorCodeParametersType = {\n domain: string;\n defaultVisitorCode?: string;\n};\n\n/**\n * @param {string | undefined} defaultVisitorCode - visitor code to be used in case there is no visitor code in cookies *Note*: if not passed visitor code will be randomly generated\n * */\nexport type MobileGetVisitorCodeParametersType = {\n defaultVisitorCode?: string;\n};\n\nexport type TrackingCacheItemType = {\n [experimentId: number]: { variationId: number; expirationTime: number };\n};\n"],"mappings":";;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA;AACA;AACA;AAHA,IAIYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAMvB;AACA;AACA;AACA;AAHAC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAAA,IAIYE,YAAY,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAAAD,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAAA,IAwBZC,YAAY,aAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY,aAEb,EAAE,GAAGA,YAAY,CAACC,MAAM;EAFvBD,YAAY,CAAZA,YAAY,WAGf,EAAE,GAAGA,YAAY,CAACE,MAAM;EAAA,OAHrBF,YAAY;AAAA;AAAAF,OAAA,CAAAE,YAAA,GAAAA,YAAA"}
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.VISITOR_CODE_MAX_LENGTH = void 0;
4
- exports.VISITOR_CODE_MAX_LENGTH = 255;
7
+ const VISITOR_CODE_MAX_LENGTH = 255;
8
+ exports.VISITOR_CODE_MAX_LENGTH = VISITOR_CODE_MAX_LENGTH;
5
9
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utilities/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"constants.js","names":["VISITOR_CODE_MAX_LENGTH","exports"],"sources":["../../src/utilities/constants.ts"],"sourcesContent":["export const VISITOR_CODE_MAX_LENGTH = 255;\n"],"mappings":";;;;;;AAAO,MAAMA,uBAAuB,GAAG,GAAG;AAACC,OAAA,CAAAD,uBAAA,GAAAA,uBAAA"}
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Utilities = void 0;
4
- var utilities_1 = require("./utilities");
5
- Object.defineProperty(exports, "Utilities", { enumerable: true, get: function () { return utilities_1.Utilities; } });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Utilities", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _utilities.Utilities;
10
+ }
11
+ });
12
+ var _utilities = require("./utilities");
6
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_utilities","require"],"sources":["../../src/utilities/index.ts"],"sourcesContent":["export { Utilities } from './utilities';\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA"}
@@ -1,6 +1,8 @@
1
+ import { CacheManager } from '../cacheManager';
1
2
  import { CampaignConfiguration } from '../campaignConfiguration';
2
3
  import { Requester } from '../requester';
3
4
  import { SegmentType, TargetingDataItemType } from '../targeting';
5
+ import { TrackingCacheItemType } from '../types';
4
6
  import { VariationConfiguration, FeatureFlagVariationType } from '../variationConfiguration';
5
7
  export type CheckTargetingParamsType = {
6
8
  segment: SegmentType | null;
@@ -9,10 +11,16 @@ export type CheckTargetingParamsType = {
9
11
  targetingData?: TargetingDataItemType[];
10
12
  variationConfiguration?: VariationConfiguration;
11
13
  };
12
- export type TrackExperimentationRuleParamsType = {
14
+ export type TrackRuleParamsType = {
13
15
  featureFlagVariation: FeatureFlagVariationType;
14
16
  campaignConfiguration: CampaignConfiguration;
15
17
  visitorCode: string;
16
18
  requester: Requester;
17
19
  userAgent?: string;
18
20
  };
21
+ export type ManageCacheParametersType = {
22
+ cacheManager: CacheManager<TrackingCacheItemType>;
23
+ visitorCode: string;
24
+ experimentId: number;
25
+ variationId: number;
26
+ };
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utilities/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/utilities/types.ts"],"sourcesContent":["import { CacheManager } from '../cacheManager';\nimport { CampaignConfiguration } from '../campaignConfiguration';\nimport { Requester } from '../requester';\nimport { SegmentType, TargetingDataItemType } from '../targeting';\nimport { TrackingCacheItemType } from '../types';\nimport {\n VariationConfiguration,\n FeatureFlagVariationType,\n} from '../variationConfiguration';\n\nexport type CheckTargetingParamsType = {\n segment: SegmentType | null;\n experimentId: number | null;\n visitorCode: string;\n targetingData?: TargetingDataItemType[];\n variationConfiguration?: VariationConfiguration;\n};\n\nexport type TrackRuleParamsType = {\n featureFlagVariation: FeatureFlagVariationType;\n campaignConfiguration: CampaignConfiguration;\n visitorCode: string;\n requester: Requester;\n userAgent?: string;\n};\n\nexport type ManageCacheParametersType = {\n cacheManager: CacheManager<TrackingCacheItemType>;\n visitorCode: string;\n experimentId: number;\n variationId: number;\n};\n"],"mappings":""}
@@ -1,13 +1,16 @@
1
1
  import { Result } from 'ts-res';
2
2
  import { KameleoonError } from '../kameleoonError';
3
- import { CheckTargetingParamsType, TrackExperimentationRuleParamsType } from './types';
4
- import { FeatureVariableResultType } from '../types';
3
+ import { CheckTargetingParamsType, ManageCacheParametersType, TrackRuleParamsType } from './types';
4
+ import { FeatureVariableResultType, TrackingCacheItemType } from '../types';
5
5
  import { CampaignConfiguration, FeatureVariableType } from '../campaignConfiguration';
6
+ import { CacheManager } from '../cacheManager';
6
7
  export declare class Utilities {
7
8
  static checkTargeting({ segment, visitorCode, targetingData, experimentId, variationConfiguration, }: CheckTargetingParamsType): Result<boolean, KameleoonError>;
8
9
  static validateVisitorCode(visitorCode: string): Result<void, KameleoonError>;
9
10
  static getDataUrl(visitorCode: string, campaignConfiguration: CampaignConfiguration): string;
10
- static trackExperimentationRule({ featureFlagVariation, campaignConfiguration, visitorCode, requester, userAgent, }: TrackExperimentationRuleParamsType): void;
11
+ static trackRule({ featureFlagVariation, campaignConfiguration, visitorCode, requester, userAgent, }: TrackRuleParamsType): void;
11
12
  static parseFeatureVariable(variable: FeatureVariableType): Result<FeatureVariableResultType, KameleoonError>;
12
13
  static getUserAgent(visitorCode: string, campaignConfiguration: CampaignConfiguration): string | undefined;
14
+ static updateCache({ cacheManager, visitorCode, experimentId, variationId, }: ManageCacheParametersType): void;
15
+ static getTrackingCode(trackingCache: CacheManager<TrackingCacheItemType>, visitorCode: string): string;
13
16
  }