@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
package/dist/index.js CHANGED
@@ -1,30 +1,311 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PageView = exports.BrowserType = exports.DeviceType = exports.Browser = exports.Device = exports.Conversion = exports.CustomData = exports.VariableType = exports.Environment = exports.Err = exports.Ok = exports.VISITOR_CODE_LENGTH = exports.Cookie = exports.KameleoonStorageKey = exports.KameleoonError = exports.KameleoonException = exports.KameleoonCoreUtils = exports.KameleoonCore = void 0;
4
- var kameleoonClient_1 = require("./kameleoonClient");
5
- Object.defineProperty(exports, "KameleoonCore", { enumerable: true, get: function () { return kameleoonClient_1.KameleoonClient; } });
6
- var kameleoonUtils_1 = require("./kameleoonUtils");
7
- Object.defineProperty(exports, "KameleoonCoreUtils", { enumerable: true, get: function () { return kameleoonUtils_1.KameleoonUtils; } });
8
- var kameleoonError_1 = require("./kameleoonError");
9
- Object.defineProperty(exports, "KameleoonException", { enumerable: true, get: function () { return kameleoonError_1.KameleoonException; } });
10
- Object.defineProperty(exports, "KameleoonError", { enumerable: true, get: function () { return kameleoonError_1.KameleoonError; } });
11
- var storage_1 = require("./storage");
12
- Object.defineProperty(exports, "KameleoonStorageKey", { enumerable: true, get: function () { return storage_1.KameleoonStorageKey; } });
13
- var constants_1 = require("./constants");
14
- Object.defineProperty(exports, "Cookie", { enumerable: true, get: function () { return constants_1.Cookie; } });
15
- Object.defineProperty(exports, "VISITOR_CODE_LENGTH", { enumerable: true, get: function () { return constants_1.VISITOR_CODE_LENGTH; } });
16
- var ts_res_1 = require("ts-res");
17
- Object.defineProperty(exports, "Ok", { enumerable: true, get: function () { return ts_res_1.Ok; } });
18
- Object.defineProperty(exports, "Err", { enumerable: true, get: function () { return ts_res_1.Err; } });
19
- var types_1 = require("./types");
20
- Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return types_1.Environment; } });
21
- Object.defineProperty(exports, "VariableType", { enumerable: true, get: function () { return types_1.VariableType; } });
22
- var kameleoonData_1 = require("./kameleoonData");
23
- Object.defineProperty(exports, "CustomData", { enumerable: true, get: function () { return kameleoonData_1.CustomData; } });
24
- Object.defineProperty(exports, "Conversion", { enumerable: true, get: function () { return kameleoonData_1.Conversion; } });
25
- Object.defineProperty(exports, "Device", { enumerable: true, get: function () { return kameleoonData_1.Device; } });
26
- Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return kameleoonData_1.Browser; } });
27
- Object.defineProperty(exports, "DeviceType", { enumerable: true, get: function () { return kameleoonData_1.DeviceType; } });
28
- Object.defineProperty(exports, "BrowserType", { enumerable: true, get: function () { return kameleoonData_1.BrowserType; } });
29
- Object.defineProperty(exports, "PageView", { enumerable: true, get: function () { return kameleoonData_1.PageView; } });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Browser", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _kameleoonData.Browser;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "BrowserType", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _kameleoonData.BrowserType;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "CLEANUP_TARGETING_DATA_INTERVAL", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _campaignConfiguration.CLEANUP_TARGETING_DATA_INTERVAL;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "ClientGetVisitorCodeParametersType", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _types.ClientGetVisitorCodeParametersType;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "Conversion", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _kameleoonData.Conversion;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "ConversionParametersType", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _kameleoonData.ConversionParametersType;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "Cookie", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _constants.Cookie;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "CustomData", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _kameleoonData.CustomData;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "Device", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _kameleoonData.Device;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "DeviceType", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _kameleoonData.DeviceType;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "Environment", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _types.Environment;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "Err", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _tsRes.Err;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "EventSourceOpenParametersType", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _eventSource.EventSourceOpenParametersType;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "ExperimentType", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _types.ExperimentType;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "ExternalPackageInfoType", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _types.ExternalPackageInfoType;
94
+ }
95
+ });
96
+ Object.defineProperty(exports, "FeatureFlagType", {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _types.FeatureFlagType;
100
+ }
101
+ });
102
+ Object.defineProperty(exports, "FeatureVariableResultType", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _types.FeatureVariableResultType;
106
+ }
107
+ });
108
+ Object.defineProperty(exports, "GetClientConfigurationResultType", {
109
+ enumerable: true,
110
+ get: function () {
111
+ return _requester.GetClientConfigurationResultType;
112
+ }
113
+ });
114
+ Object.defineProperty(exports, "GetFeatureFlagVariableParamsType", {
115
+ enumerable: true,
116
+ get: function () {
117
+ return _types.GetFeatureFlagVariableParamsType;
118
+ }
119
+ });
120
+ Object.defineProperty(exports, "Header", {
121
+ enumerable: true,
122
+ get: function () {
123
+ return _requester.Header;
124
+ }
125
+ });
126
+ Object.defineProperty(exports, "HttpMethod", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _requester.HttpMethod;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, "IExternalEventSource", {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _eventSource.IExternalEventSource;
136
+ }
137
+ });
138
+ Object.defineProperty(exports, "IExternalEventSourceConstructor", {
139
+ enumerable: true,
140
+ get: function () {
141
+ return _eventSource.IExternalEventSourceConstructor;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, "IExternalRequestDispatcher", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _requester.IExternalRequestDispatcher;
148
+ }
149
+ });
150
+ Object.defineProperty(exports, "IExternalStorage", {
151
+ enumerable: true,
152
+ get: function () {
153
+ return _storage.IExternalStorage;
154
+ }
155
+ });
156
+ Object.defineProperty(exports, "IExternalStorageConstructor", {
157
+ enumerable: true,
158
+ get: function () {
159
+ return _storage.IExternalStorageConstructor;
160
+ }
161
+ });
162
+ Object.defineProperty(exports, "IKameleoonCore", {
163
+ enumerable: true,
164
+ get: function () {
165
+ return _kameleoonClient.IKameleoonClient;
166
+ }
167
+ });
168
+ Object.defineProperty(exports, "InternalSDKConfigurationType", {
169
+ enumerable: true,
170
+ get: function () {
171
+ return _types.InternalSDKConfigurationType;
172
+ }
173
+ });
174
+ Object.defineProperty(exports, "JSONType", {
175
+ enumerable: true,
176
+ get: function () {
177
+ return _campaignConfiguration.JSONType;
178
+ }
179
+ });
180
+ Object.defineProperty(exports, "KameleoonCore", {
181
+ enumerable: true,
182
+ get: function () {
183
+ return _kameleoonClient.KameleoonClient;
184
+ }
185
+ });
186
+ Object.defineProperty(exports, "KameleoonCoreUtils", {
187
+ enumerable: true,
188
+ get: function () {
189
+ return _kameleoonUtils.KameleoonUtils;
190
+ }
191
+ });
192
+ Object.defineProperty(exports, "KameleoonDataType", {
193
+ enumerable: true,
194
+ get: function () {
195
+ return _kameleoonData.KameleoonDataType;
196
+ }
197
+ });
198
+ Object.defineProperty(exports, "KameleoonError", {
199
+ enumerable: true,
200
+ get: function () {
201
+ return _kameleoonError.KameleoonError;
202
+ }
203
+ });
204
+ Object.defineProperty(exports, "KameleoonException", {
205
+ enumerable: true,
206
+ get: function () {
207
+ return _kameleoonError.KameleoonException;
208
+ }
209
+ });
210
+ Object.defineProperty(exports, "KameleoonStorageKey", {
211
+ enumerable: true,
212
+ get: function () {
213
+ return _storage.KameleoonStorageKey;
214
+ }
215
+ });
216
+ Object.defineProperty(exports, "MobileGetVisitorCodeParametersType", {
217
+ enumerable: true,
218
+ get: function () {
219
+ return _types.MobileGetVisitorCodeParametersType;
220
+ }
221
+ });
222
+ Object.defineProperty(exports, "Ok", {
223
+ enumerable: true,
224
+ get: function () {
225
+ return _tsRes.Ok;
226
+ }
227
+ });
228
+ Object.defineProperty(exports, "PageView", {
229
+ enumerable: true,
230
+ get: function () {
231
+ return _kameleoonData.PageView;
232
+ }
233
+ });
234
+ Object.defineProperty(exports, "PageViewParametersType", {
235
+ enumerable: true,
236
+ get: function () {
237
+ return _kameleoonData.PageViewParametersType;
238
+ }
239
+ });
240
+ Object.defineProperty(exports, "RealTimeEventType", {
241
+ enumerable: true,
242
+ get: function () {
243
+ return _eventSource.RealTimeEventType;
244
+ }
245
+ });
246
+ Object.defineProperty(exports, "Result", {
247
+ enumerable: true,
248
+ get: function () {
249
+ return _tsRes.Result;
250
+ }
251
+ });
252
+ Object.defineProperty(exports, "SDKConfigurationType", {
253
+ enumerable: true,
254
+ get: function () {
255
+ return _types.SDKConfigurationType;
256
+ }
257
+ });
258
+ Object.defineProperty(exports, "SDKCoreParameters", {
259
+ enumerable: true,
260
+ get: function () {
261
+ return _types.SDKCoreParameters;
262
+ }
263
+ });
264
+ Object.defineProperty(exports, "SDKType", {
265
+ enumerable: true,
266
+ get: function () {
267
+ return _constants.SDKType;
268
+ }
269
+ });
270
+ Object.defineProperty(exports, "ServerGetVisitorCodeParametersType", {
271
+ enumerable: true,
272
+ get: function () {
273
+ return _types.ServerGetVisitorCodeParametersType;
274
+ }
275
+ });
276
+ Object.defineProperty(exports, "TrackConversionParamsType", {
277
+ enumerable: true,
278
+ get: function () {
279
+ return _types.TrackConversionParamsType;
280
+ }
281
+ });
282
+ Object.defineProperty(exports, "TrackParametersType", {
283
+ enumerable: true,
284
+ get: function () {
285
+ return _requester.TrackParametersType;
286
+ }
287
+ });
288
+ Object.defineProperty(exports, "VISITOR_CODE_LENGTH", {
289
+ enumerable: true,
290
+ get: function () {
291
+ return _constants.VISITOR_CODE_LENGTH;
292
+ }
293
+ });
294
+ Object.defineProperty(exports, "VariableType", {
295
+ enumerable: true,
296
+ get: function () {
297
+ return _types.VariableType;
298
+ }
299
+ });
300
+ var _kameleoonClient = require("./kameleoonClient");
301
+ var _kameleoonUtils = require("./kameleoonUtils");
302
+ var _kameleoonError = require("./kameleoonError");
303
+ var _storage = require("./storage");
304
+ var _constants = require("./constants");
305
+ var _campaignConfiguration = require("./campaignConfiguration");
306
+ var _tsRes = require("ts-res");
307
+ var _types = require("./types");
308
+ var _kameleoonData = require("./kameleoonData");
309
+ var _eventSource = require("./eventSource");
310
+ var _requester = require("./requester");
30
311
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAG2B;AAFzB,gHAAA,eAAe,OAAiB;AAGlC,mDAAwE;AAA/D,oHAAA,cAAc,OAAsB;AAC7C,mDAAsE;AAA7D,oHAAA,kBAAkB,OAAA;AAAE,gHAAA,cAAc,OAAA;AAC3C,qCAImB;AAHjB,8GAAA,mBAAmB,OAAA;AAIrB,yCAA0D;AAAjD,mGAAA,MAAM,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAEpC,iCAAyC;AAAhC,4FAAA,EAAE,OAAA;AAAU,6FAAA,GAAG,OAAA;AACxB,iCAciB;AAbf,oGAAA,WAAW,OAAA;AACX,qGAAA,YAAY,OAAA;AAad,iDAWyB;AAVvB,2GAAA,UAAU,OAAA;AACV,2GAAA,UAAU,OAAA;AACV,uGAAA,MAAM,OAAA;AACN,wGAAA,OAAO,OAAA;AACP,2GAAA,UAAU,OAAA;AACV,4GAAA,WAAW,OAAA;AACX,yGAAA,QAAQ,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_kameleoonClient","require","_kameleoonUtils","_kameleoonError","_storage","_constants","_campaignConfiguration","_tsRes","_types","_kameleoonData","_eventSource","_requester"],"sources":["../src/index.ts"],"sourcesContent":["export {\n KameleoonClient as KameleoonCore,\n IKameleoonClient as IKameleoonCore,\n} from './kameleoonClient';\nexport { KameleoonUtils as KameleoonCoreUtils } from './kameleoonUtils';\nexport { KameleoonException, KameleoonError } from './kameleoonError';\nexport {\n KameleoonStorageKey,\n IExternalStorage,\n IExternalStorageConstructor,\n} from './storage';\nexport { Cookie, VISITOR_CODE_LENGTH, SDKType } from './constants';\nexport { CLEANUP_TARGETING_DATA_INTERVAL } from './campaignConfiguration';\nexport { JSONType } from './campaignConfiguration';\nexport { Ok, Result, Err } from 'ts-res';\nexport {\n Environment,\n VariableType,\n ExperimentType,\n FeatureFlagType,\n SDKCoreParameters,\n SDKConfigurationType,\n ExternalPackageInfoType,\n TrackConversionParamsType,\n FeatureVariableResultType,\n InternalSDKConfigurationType,\n GetFeatureFlagVariableParamsType,\n ServerGetVisitorCodeParametersType,\n ClientGetVisitorCodeParametersType,\n MobileGetVisitorCodeParametersType,\n} from './types';\nexport {\n CustomData,\n Conversion,\n Device,\n Browser,\n DeviceType,\n BrowserType,\n PageView,\n KameleoonDataType,\n PageViewParametersType,\n ConversionParametersType,\n} from './kameleoonData';\nexport {\n RealTimeEventType,\n IExternalEventSource,\n EventSourceOpenParametersType,\n IExternalEventSourceConstructor,\n} from './eventSource';\nexport {\n Header,\n HttpMethod,\n TrackParametersType,\n IExternalRequestDispatcher,\n GetClientConfigurationResultType,\n} from './requester';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAIA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAgBA,IAAAQ,cAAA,GAAAR,OAAA;AAYA,IAAAS,YAAA,GAAAT,OAAA;AAMA,IAAAU,UAAA,GAAAV,OAAA"}
@@ -3,7 +3,7 @@ import { KameleoonDataType } from './kameleoonData';
3
3
  import { TrackConversionParamsType, ExperimentType, FeatureFlagType, GetFeatureFlagVariableParamsType, FeatureVariableResultType, SDKCoreParameters } from './types';
4
4
  /**
5
5
  * @interface an interface of KameleoonClient instance
6
- * */
6
+ */
7
7
  export interface IKameleoonClient {
8
8
  /**
9
9
  * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached
@@ -12,7 +12,7 @@ export interface IKameleoonClient {
12
12
  *
13
13
  * - `KameleoonException.StorageWrite` Couldn't update storage data
14
14
  * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api
15
- * */
15
+ */
16
16
  initialize: () => Promise<boolean>;
17
17
  /**
18
18
  * @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.
@@ -24,7 +24,7 @@ export interface IKameleoonClient {
24
24
  * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
25
25
  * - `KameleoonException.StorageWrite` Couldn't update storage data
26
26
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
27
- * */
27
+ */
28
28
  addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;
29
29
  /**
30
30
  * @method triggerExperiment - triggers experiment by assigning the variation to the user with `visitorCode`, if the variation is already assigned just returns it's id. Note: returned id `0` indicates default variation. At the same time executes `flushData` without sending extra request.
@@ -38,7 +38,7 @@ export interface IKameleoonClient {
38
38
  * - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage
39
39
  * - `KameleoonException.NotTargeted` Current visitor is not targeted
40
40
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
41
- * */
41
+ */
42
42
  triggerExperiment: (visitorCode: string, experimentId: number) => number;
43
43
  /**
44
44
  * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter
@@ -48,7 +48,7 @@ export interface IKameleoonClient {
48
48
  *
49
49
  * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded
50
50
  * - `KameleoonException.StorageWrite` Couldn't update storage data
51
- * */
51
+ */
52
52
  trackConversion: ({ visitorCode, goalId, revenue, }: TrackConversionParamsType) => void;
53
53
  /**
54
54
  * @method flushData - takes visitor associated kameleoon data and sends the data tracking request with collected data
@@ -58,7 +58,7 @@ export interface IKameleoonClient {
58
58
  * @throws `KameleoonError` with one of the following `type` s:
59
59
  *
60
60
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
61
- * */
61
+ */
62
62
  flushData: (visitorCode: string) => void;
63
63
  /**
64
64
  * @method getExperiments - returns a list of experiments stored in the client configuration
@@ -66,7 +66,7 @@ export interface IKameleoonClient {
66
66
  * @throws `KameleoonError` with one of the following `type` s:
67
67
  *
68
68
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
69
- * */
69
+ */
70
70
  getExperiments: () => ExperimentType[];
71
71
  /**
72
72
  * @method getVisitorExperiments - returns a list of experiments that the visitor with `visitorCode` is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated if the experiment will be triggered).
@@ -77,15 +77,25 @@ export interface IKameleoonClient {
77
77
  *
78
78
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
79
79
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
80
- * */
80
+ */
81
81
  getVisitorExperiments: (visitorCode: string, isAllocated?: boolean) => ExperimentType[];
82
+ /**
83
+ * @method getExperimentVariationData - returns variation data in JSON format for the variation with `variationId`
84
+ * @param {number} variationId - id of variation
85
+ * @returns {JSONType} variation data in JSON format
86
+ * @throws `KameleoonError` with one of the following `type` s:
87
+ * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
88
+ * - `KameleoonException.JSONParse` - Couldn't pass JSON value
89
+ * - `KameleoonException.VariationNotFound` - No variation found for provided `variationId`
90
+ */
91
+ getExperimentVariationData: (variationId: number) => JSONType | null;
82
92
  /**
83
93
  * @method getFeatureFlags - returns a list of feature flags stored in the client configuration
84
94
  * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields
85
95
  * @throws `KameleoonError` with one of the following `type` s:
86
96
  *
87
97
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
88
- * */
98
+ */
89
99
  getFeatureFlags: () => FeatureFlagType[];
90
100
  /**
91
101
  * @method getVisitorFeatureFlags - returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).
@@ -96,10 +106,10 @@ export interface IKameleoonClient {
96
106
  * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded
97
107
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
98
108
  * - `KameleoonException.NotTargeted` - Current visitor is not targeted
99
- * */
109
+ */
100
110
  getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];
101
111
  /**
102
- * @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request if the feature rollout rule was of type of `Experimentation`
112
+ * @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request
103
113
  * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
104
114
  * @param {string} featureKey - a unique key for feature flag
105
115
  * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`
@@ -110,10 +120,10 @@ export interface IKameleoonClient {
110
120
  * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
111
121
  * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.
112
122
  * - `KameleoonException.NotTargeted` - Current visitor is not targeted
113
- * */
123
+ */
114
124
  isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;
115
125
  /**
116
- * @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request if the feature rollout rule was of type of `Experimentation`
126
+ * @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request
117
127
  * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length
118
128
  * @param {string} featureKey - a unique key for feature flag
119
129
  * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor
@@ -123,10 +133,10 @@ export interface IKameleoonClient {
123
133
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
124
134
  * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`
125
135
  * - `KameleoonException.NotTargeted` - Current visitor is not targeted
126
- * */
136
+ */
127
137
  getFeatureFlagVariationKey: (visitorCode: string, featureKey: string) => string;
128
138
  /**
129
- * @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request if the feature rollout rule was of type of `Experimentation`
139
+ * @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request
130
140
  * @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.
131
141
  * @returns {FeatureVariableResultType} a variable 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.
132
142
  * @throws `KameleoonError` with one of the following `type` s:
@@ -137,7 +147,7 @@ export interface IKameleoonClient {
137
147
  * - `KameleoonException.NotTargeted` - Current visitor is not targeted
138
148
  * - `KameleoonException.JSONParse` - Couldn't pass JSON value
139
149
  * - `KameleoonException.NumberParse` - Couldn't pass Number value
140
- * */
150
+ */
141
151
  getFeatureFlagVariable: ({ visitorCode, featureKey, variableKey, }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;
142
152
  /**
143
153
  * @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.
@@ -146,7 +156,7 @@ export interface IKameleoonClient {
146
156
  * @throws `KameleoonError` with one of the following `type` s:
147
157
  *
148
158
  * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server
149
- * */
159
+ */
150
160
  getRemoteData: (key: string) => Promise<JSONType>;
151
161
  /**
152
162
  * @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.
@@ -155,19 +165,20 @@ export interface IKameleoonClient {
155
165
  * @throws `KameleoonError` with one of the following `type` s:
156
166
  *
157
167
  * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`
158
- * */
168
+ */
159
169
  onConfigurationUpdate: (callback: () => void) => void;
160
170
  }
161
171
  /**
162
172
  * @class
163
173
  * KameleoonClient - a class for creating kameleoon client instance
164
174
  * for communicating with Kameleoon JavaScript SDK Core, when new instance is created
165
- * */
175
+ */
166
176
  export declare class KameleoonClient implements IKameleoonClient {
167
177
  private internalConfiguration;
168
178
  private variationConfiguration?;
169
179
  private campaignConfiguration?;
170
180
  private settings;
181
+ private trackingCache;
171
182
  private requester;
172
183
  /**
173
184
  * @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core
@@ -180,6 +191,7 @@ export declare class KameleoonClient implements IKameleoonClient {
180
191
  flushData(visitorCode: string): void;
181
192
  getExperiments(): ExperimentType[];
182
193
  getVisitorExperiments(visitorCode: string, isActive?: boolean): ExperimentType[];
194
+ getExperimentVariationData(variationId: number): JSONType;
183
195
  getFeatureFlags(): FeatureFlagType[];
184
196
  getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[];
185
197
  getFeatureFlagVariationKey(visitorCode: string, featureKey: string): string;
@@ -187,5 +199,6 @@ export declare class KameleoonClient implements IKameleoonClient {
187
199
  isFeatureFlagActive(visitorCode: string, featureKey: string): boolean;
188
200
  getRemoteData(key: string): Promise<JSONType>;
189
201
  onConfigurationUpdate(callback: () => void): void;
202
+ protected _getEngineTrackingCode(visitorCode: string): string;
190
203
  private _getFeatureFlagVariation;
191
204
  }